max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
Lab5/Example 6.6 Read a character, and if it's an uppercase letter, display it.asm
Deboraj-roy/COMPUTER-ORGANIZATION-AND-ARCHITECTURE-C-
0
172126
<gh_stars>0 .MODEL SMALL .STACK 100H .CODE MAIN PROC MOV AH,1 INT 21H CMP AL, 'A' JNGE END_IF CMP AL,'Z' JNLE END_IF MOV DL,AL MOV AH,2 INT 21H END_IF: ;DOS EXIT MOV AH,4CH INT 21H MAIN ENDP END MAIN
programs/oeis/266/A266252.asm
karttu/loda
0
87188
<filename>programs/oeis/266/A266252.asm ; A266252: Total number of OFF (white) cells after n iterations of the "Rule 9" elementary cellular automaton starting with a single ON (black) cell. ; 0,3,6,11,16,22,31,37,50,56,73,79,100,106,131,137,166,172,205,211,248,254,295,301,346,352,401,407,460,466,523,529,590,596,661,667,736,742,815,821,898,904,985,991,1076,1082,1171,1177,1270,1276,1373,1379,1480,1486,1591,1597,1706,1712,1825,1831,1948,1954,2075,2081,2206,2212,2341,2347,2480,2486,2623,2629,2770,2776,2921,2927,3076,3082,3235,3241,3398,3404,3565,3571,3736,3742,3911,3917,4090,4096,4273,4279,4460,4466,4651,4657,4846,4852,5045,5051,5248,5254,5455,5461,5666,5672,5881,5887,6100,6106,6323,6329,6550,6556,6781,6787,7016,7022,7255,7261,7498,7504,7745,7751,7996,8002,8251,8257,8510,8516,8773,8779,9040,9046,9311,9317,9586,9592,9865,9871,10148,10154,10435,10441,10726,10732,11021,11027,11320,11326,11623,11629,11930,11936,12241,12247,12556,12562,12875,12881,13198,13204,13525,13531,13856,13862,14191,14197,14530,14536,14873,14879,15220,15226,15571,15577,15926,15932,16285,16291,16648,16654,17015,17021,17386,17392,17761,17767,18140,18146,18523,18529,18910,18916,19301,19307,19696,19702,20095,20101,20498,20504,20905,20911,21316,21322,21731,21737,22150,22156,22573,22579,23000,23006,23431,23437,23866,23872,24305,24311,24748,24754,25195,25201,25646,25652,26101,26107,26560,26566,27023,27029,27490,27496,27961,27967,28436,28442,28915,28921,29398,29404,29885,29891,30376,30382,30871,30877,31370,31376 mov $2,$0 mov $4,$0 sub $0,2 mov $3,$2 sub $3,1 lpb $0,1 sub $0,1 add $2,1 mov $1,$2 add $3,$0 mov $2,$3 add $2,$0 sub $3,$3 add $3,$1 lpe trn $3,2 add $3,1 mov $1,$3 lpb $4,1 add $1,3 sub $4,1 lpe sub $1,1
tools/SPARK2005/packages/polypaver/pp_f_rounded.adb
michalkonecny/polypaver
1
8355
<gh_stars>1-10 -- This file cannot be processed by the SPARK Examiner. with Ada.Numerics, Ada.Numerics.Elementary_Functions; package body PP_F_Rounded is function Plus (Prec : Integer; X,Y : Float) return Float is begin return X+Y; end Plus; function Minus (Prec : Integer; X,Y : Float) return Float is begin return X-Y; end Minus; function Multiply (Prec : Integer; X,Y : Float) return Float is begin return X*Y; end Multiply; function Divide (Prec : Integer; X,Y : Float) return Float is begin return X/Y; end Divide; function Pi(Prec : Integer) return Float is begin return Ada.Numerics.Pi; end Pi; function Sqrt (Prec : Integer; X : Float) return Float is begin return Ada.Numerics.Elementary_Functions.Sqrt(X); end Sqrt; function Exp (Prec : Integer; X : Float) return Float is begin return Ada.Numerics.Elementary_Functions.Exp(X); end Exp; end PP_F_Rounded;
oeis/133/A133283.asm
neoneye/loda-programs
11
90261
<filename>oeis/133/A133283.asm ; A133283: Numbers n such that 30*n^2 + 6 is a square. ; Submitted by <NAME> ; 1,23,505,11087,243409,5343911,117322633,2575754015,56549265697,1241508091319,27256628743321,598404324261743,13137638505015025,288429642786068807,6332314502788498729,139022489418560903231,3052162452705551372353,67008551470103569288535,1471135969889572972975417,32297982786100501836170639,709084485324321467422778641,15567560694348971781464959463,341777250790353057724806329545,7503531956693418298164274290527,164735925796464849501889228062049,3616686835565533270743398743074551 lpb $0 mov $2,$0 sub $0,1 seq $2,77422 ; Chebyshev sequence T(n,11) with Diophantine property. add $1,$2 lpe mov $0,$1 mul $0,2 add $0,1
programs/oeis/245/A245402.asm
jmorken/loda
1
161380
<filename>programs/oeis/245/A245402.asm ; A245402: Number of nonnegative integers with property that their base 7/6 expansion (see A024643) has n digits. ; 7,7,7,7,7,7,7,14,14,14,21,21,28,28,35,42,49,56,63,77,91,105,119,140,161,189,224,259,301,350,413,483,560,651,763,889,1036,1211,1414,1645,1925,2240,2618,3052,3563,4158,4851,5656,6601,7700,8981,10479,12229,14266 mov $6,$0 mov $15,$0 lpb $6 mov $0,$15 sub $6,1 sub $0,$6 mov $11,$0 mov $13,2 lpb $13 mov $0,$11 sub $13,1 add $0,$13 sub $0,1 mov $7,$0 mov $9,2 lpb $9 mov $0,$7 sub $9,1 add $0,$9 sub $0,1 mov $4,0 lpb $0 sub $0,1 mov $2,$4 add $2,1 mov $3,$4 div $3,6 mov $5,$2 add $5,$3 mov $4,$5 lpe mov $2,$4 mov $10,$9 lpb $10 mov $8,$2 sub $10,1 lpe lpe lpb $7 mov $7,0 sub $8,$2 lpe mov $2,$8 mov $14,$13 lpb $14 mov $12,$2 sub $14,1 lpe lpe lpb $11 mov $11,0 sub $12,$2 lpe mov $2,$12 mul $2,4 add $1,$2 lpe trn $1,4 div $1,4 mul $1,7 add $1,7
thirdparty/libvpx/vpx_dsp/x86/vpx_subpixel_8t_ssse3.asm
N0hbdy/godot
222
161116
; ; Copyright (c) 2015 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 "third_party/x86inc/x86inc.asm" SECTION_RODATA pw_64: times 8 dw 64 ; %define USE_PMULHRSW ; NOTE: pmulhrsw has a latency of 5 cycles. Tests showed a performance loss ; when using this instruction. ; ; The add order below (based on ffvp9) must be followed to prevent outranges. ; x = k0k1 + k4k5 ; y = k2k3 + k6k7 ; z = signed SAT(x + y) SECTION .text %if ARCH_X86_64 %define LOCAL_VARS_SIZE 16*4 %else %define LOCAL_VARS_SIZE 16*6 %endif %macro SETUP_LOCAL_VARS 0 ; TODO(slavarnway): using xmm registers for these on ARCH_X86_64 + ; pmaddubsw has a higher latency on some platforms, this might be eased by ; interleaving the instructions. %define k0k1 [rsp + 16*0] %define k2k3 [rsp + 16*1] %define k4k5 [rsp + 16*2] %define k6k7 [rsp + 16*3] packsswb m4, m4 ; TODO(slavarnway): multiple pshufb instructions had a higher latency on ; some platforms. pshuflw m0, m4, 0b ;k0_k1 pshuflw m1, m4, 01010101b ;k2_k3 pshuflw m2, m4, 10101010b ;k4_k5 pshuflw m3, m4, 11111111b ;k6_k7 punpcklqdq m0, m0 punpcklqdq m1, m1 punpcklqdq m2, m2 punpcklqdq m3, m3 mova k0k1, m0 mova k2k3, m1 mova k4k5, m2 mova k6k7, m3 %if ARCH_X86_64 %define krd m12 %define tmp m13 mova krd, [GLOBAL(pw_64)] %else %define tmp [rsp + 16*4] %define krd [rsp + 16*5] %if CONFIG_PIC=0 mova m6, [GLOBAL(pw_64)] %else ; build constants without accessing global memory pcmpeqb m6, m6 ;all ones psrlw m6, 15 psllw m6, 6 ;aka pw_64 %endif mova krd, m6 %endif %endm %macro HORIZx4_ROW 2 mova %2, %1 punpcklbw %1, %1 punpckhbw %2, %2 mova m3, %2 palignr %2, %1, 1 palignr m3, %1, 5 pmaddubsw %2, k0k1k4k5 pmaddubsw m3, k2k3k6k7 mova m4, %2 ;k0k1 mova m5, m3 ;k2k3 psrldq %2, 8 ;k4k5 psrldq m3, 8 ;k6k7 paddsw %2, m4 paddsw m5, m3 paddsw %2, m5 paddsw %2, krd psraw %2, 7 packuswb %2, %2 %endm ;------------------------------------------------------------------------------- %macro SUBPIX_HFILTER4 1 cglobal filter_block1d4_%1, 6, 6+(ARCH_X86_64*2), 11, LOCAL_VARS_SIZE, \ src, sstride, dst, dstride, height, filter mova m4, [filterq] packsswb m4, m4 %if ARCH_X86_64 %define k0k1k4k5 m8 %define k2k3k6k7 m9 %define krd m10 %define orig_height r7d mova krd, [GLOBAL(pw_64)] pshuflw k0k1k4k5, m4, 0b ;k0_k1 pshufhw k0k1k4k5, k0k1k4k5, 10101010b ;k0_k1_k4_k5 pshuflw k2k3k6k7, m4, 01010101b ;k2_k3 pshufhw k2k3k6k7, k2k3k6k7, 11111111b ;k2_k3_k6_k7 %else %define k0k1k4k5 [rsp + 16*0] %define k2k3k6k7 [rsp + 16*1] %define krd [rsp + 16*2] %define orig_height [rsp + 16*3] pshuflw m6, m4, 0b ;k0_k1 pshufhw m6, m6, 10101010b ;k0_k1_k4_k5 pshuflw m7, m4, 01010101b ;k2_k3 pshufhw m7, m7, 11111111b ;k2_k3_k6_k7 %if CONFIG_PIC=0 mova m1, [GLOBAL(pw_64)] %else ; build constants without accessing global memory pcmpeqb m1, m1 ;all ones psrlw m1, 15 psllw m1, 6 ;aka pw_64 %endif mova k0k1k4k5, m6 mova k2k3k6k7, m7 mova krd, m1 %endif mov orig_height, heightd shr heightd, 1 .loop: ;Do two rows at once movh m0, [srcq - 3] movh m1, [srcq + 5] punpcklqdq m0, m1 mova m1, m0 movh m2, [srcq + sstrideq - 3] movh m3, [srcq + sstrideq + 5] punpcklqdq m2, m3 mova m3, m2 punpcklbw m0, m0 punpckhbw m1, m1 punpcklbw m2, m2 punpckhbw m3, m3 mova m4, m1 palignr m4, m0, 1 pmaddubsw m4, k0k1k4k5 palignr m1, m0, 5 pmaddubsw m1, k2k3k6k7 mova m7, m3 palignr m7, m2, 1 pmaddubsw m7, k0k1k4k5 palignr m3, m2, 5 pmaddubsw m3, k2k3k6k7 mova m0, m4 ;k0k1 mova m5, m1 ;k2k3 mova m2, m7 ;k0k1 upper psrldq m4, 8 ;k4k5 psrldq m1, 8 ;k6k7 paddsw m4, m0 paddsw m5, m1 mova m1, m3 ;k2k3 upper psrldq m7, 8 ;k4k5 upper psrldq m3, 8 ;k6k7 upper paddsw m7, m2 paddsw m4, m5 paddsw m1, m3 paddsw m7, m1 paddsw m4, krd psraw m4, 7 packuswb m4, m4 paddsw m7, krd psraw m7, 7 packuswb m7, m7 %ifidn %1, h8_avg movd m0, [dstq] pavgb m4, m0 movd m2, [dstq + dstrideq] pavgb m7, m2 %endif movd [dstq], m4 movd [dstq + dstrideq], m7 lea srcq, [srcq + sstrideq ] prefetcht0 [srcq + 4 * sstrideq - 3] lea srcq, [srcq + sstrideq ] lea dstq, [dstq + 2 * dstrideq ] prefetcht0 [srcq + 2 * sstrideq - 3] dec heightd jnz .loop ; Do last row if output_height is odd mov heightd, orig_height and heightd, 1 je .done movh m0, [srcq - 3] ; load src movh m1, [srcq + 5] punpcklqdq m0, m1 HORIZx4_ROW m0, m1 %ifidn %1, h8_avg movd m0, [dstq] pavgb m1, m0 %endif movd [dstq], m1 .done RET %endm %macro HORIZx8_ROW 5 mova %2, %1 punpcklbw %1, %1 punpckhbw %2, %2 mova %3, %2 mova %4, %2 mova %5, %2 palignr %2, %1, 1 palignr %3, %1, 5 palignr %4, %1, 9 palignr %5, %1, 13 pmaddubsw %2, k0k1 pmaddubsw %3, k2k3 pmaddubsw %4, k4k5 pmaddubsw %5, k6k7 paddsw %2, %4 paddsw %5, %3 paddsw %2, %5 paddsw %2, krd psraw %2, 7 packuswb %2, %2 SWAP %1, %2 %endm ;------------------------------------------------------------------------------- %macro SUBPIX_HFILTER8 1 cglobal filter_block1d8_%1, 6, 6+(ARCH_X86_64*1), 14, LOCAL_VARS_SIZE, \ src, sstride, dst, dstride, height, filter mova m4, [filterq] SETUP_LOCAL_VARS %if ARCH_X86_64 %define orig_height r7d %else %define orig_height heightmp %endif mov orig_height, heightd shr heightd, 1 .loop: movh m0, [srcq - 3] movh m3, [srcq + 5] movh m4, [srcq + sstrideq - 3] movh m7, [srcq + sstrideq + 5] punpcklqdq m0, m3 mova m1, m0 punpcklbw m0, m0 punpckhbw m1, m1 mova m5, m1 palignr m5, m0, 13 pmaddubsw m5, k6k7 mova m2, m1 mova m3, m1 palignr m1, m0, 1 pmaddubsw m1, k0k1 punpcklqdq m4, m7 mova m6, m4 punpcklbw m4, m4 palignr m2, m0, 5 punpckhbw m6, m6 palignr m3, m0, 9 mova m7, m6 pmaddubsw m2, k2k3 pmaddubsw m3, k4k5 palignr m7, m4, 13 mova m0, m6 palignr m0, m4, 5 pmaddubsw m7, k6k7 paddsw m1, m3 paddsw m2, m5 paddsw m1, m2 mova m5, m6 palignr m6, m4, 1 pmaddubsw m0, k2k3 pmaddubsw m6, k0k1 palignr m5, m4, 9 paddsw m1, krd pmaddubsw m5, k4k5 psraw m1, 7 paddsw m0, m7 %ifidn %1, h8_avg movh m7, [dstq] movh m2, [dstq + dstrideq] %endif packuswb m1, m1 paddsw m6, m5 paddsw m6, m0 paddsw m6, krd psraw m6, 7 packuswb m6, m6 %ifidn %1, h8_avg pavgb m1, m7 pavgb m6, m2 %endif movh [dstq], m1 movh [dstq + dstrideq], m6 lea srcq, [srcq + sstrideq ] prefetcht0 [srcq + 4 * sstrideq - 3] lea srcq, [srcq + sstrideq ] lea dstq, [dstq + 2 * dstrideq ] prefetcht0 [srcq + 2 * sstrideq - 3] dec heightd jnz .loop ;Do last row if output_height is odd mov heightd, orig_height and heightd, 1 je .done movh m0, [srcq - 3] movh m3, [srcq + 5] punpcklqdq m0, m3 HORIZx8_ROW m0, m1, m2, m3, m4 %ifidn %1, h8_avg movh m1, [dstq] pavgb m0, m1 %endif movh [dstq], m0 .done: RET %endm ;------------------------------------------------------------------------------- %macro SUBPIX_HFILTER16 1 cglobal filter_block1d16_%1, 6, 6+(ARCH_X86_64*0), 14, LOCAL_VARS_SIZE, \ src, sstride, dst, dstride, height, filter mova m4, [filterq] SETUP_LOCAL_VARS .loop: prefetcht0 [srcq + 2 * sstrideq -3] movh m0, [srcq - 3] movh m4, [srcq + 5] movh m6, [srcq + 13] punpcklqdq m0, m4 mova m7, m0 punpckhbw m0, m0 mova m1, m0 punpcklqdq m4, m6 mova m3, m0 punpcklbw m7, m7 palignr m3, m7, 13 mova m2, m0 pmaddubsw m3, k6k7 palignr m0, m7, 1 pmaddubsw m0, k0k1 palignr m1, m7, 5 pmaddubsw m1, k2k3 palignr m2, m7, 9 pmaddubsw m2, k4k5 paddsw m1, m3 mova m3, m4 punpckhbw m4, m4 mova m5, m4 punpcklbw m3, m3 mova m7, m4 palignr m5, m3, 5 mova m6, m4 palignr m4, m3, 1 pmaddubsw m4, k0k1 pmaddubsw m5, k2k3 palignr m6, m3, 9 pmaddubsw m6, k4k5 palignr m7, m3, 13 pmaddubsw m7, k6k7 paddsw m0, m2 paddsw m0, m1 %ifidn %1, h8_avg mova m1, [dstq] %endif paddsw m4, m6 paddsw m5, m7 paddsw m4, m5 paddsw m0, krd paddsw m4, krd psraw m0, 7 psraw m4, 7 packuswb m0, m4 %ifidn %1, h8_avg pavgb m0, m1 %endif lea srcq, [srcq + sstrideq] mova [dstq], m0 lea dstq, [dstq + dstrideq] dec heightd jnz .loop RET %endm INIT_XMM ssse3 SUBPIX_HFILTER16 h8 SUBPIX_HFILTER16 h8_avg SUBPIX_HFILTER8 h8 SUBPIX_HFILTER8 h8_avg SUBPIX_HFILTER4 h8 SUBPIX_HFILTER4 h8_avg ;------------------------------------------------------------------------------- %macro SUBPIX_VFILTER 2 cglobal filter_block1d%2_%1, 6, 6+(ARCH_X86_64*3), 14, LOCAL_VARS_SIZE, \ src, sstride, dst, dstride, height, filter mova m4, [filterq] SETUP_LOCAL_VARS %if ARCH_X86_64 %define src1q r7 %define sstride6q r8 %define dst_stride dstrideq %else %define src1q filterq %define sstride6q dstrideq %define dst_stride dstridemp %endif mov src1q, srcq add src1q, sstrideq lea sstride6q, [sstrideq + sstrideq * 4] add sstride6q, sstrideq ;pitch * 6 %ifidn %2, 8 %define movx movh %else %define movx movd %endif .loop: movx m0, [srcq ] ;A movx m1, [srcq + sstrideq ] ;B punpcklbw m0, m1 ;A B movx m2, [srcq + sstrideq * 2 ] ;C pmaddubsw m0, k0k1 mova m6, m2 movx m3, [src1q + sstrideq * 2] ;D punpcklbw m2, m3 ;C D pmaddubsw m2, k2k3 movx m4, [srcq + sstrideq * 4 ] ;E mova m7, m4 movx m5, [src1q + sstrideq * 4] ;F punpcklbw m4, m5 ;E F pmaddubsw m4, k4k5 punpcklbw m1, m6 ;A B next iter movx m6, [srcq + sstride6q ] ;G punpcklbw m5, m6 ;E F next iter punpcklbw m3, m7 ;C D next iter pmaddubsw m5, k4k5 movx m7, [src1q + sstride6q ] ;H punpcklbw m6, m7 ;G H pmaddubsw m6, k6k7 pmaddubsw m3, k2k3 pmaddubsw m1, k0k1 paddsw m0, m4 paddsw m2, m6 movx m6, [srcq + sstrideq * 8 ] ;H next iter punpcklbw m7, m6 pmaddubsw m7, k6k7 paddsw m0, m2 paddsw m0, krd psraw m0, 7 paddsw m1, m5 packuswb m0, m0 paddsw m3, m7 paddsw m1, m3 paddsw m1, krd psraw m1, 7 lea srcq, [srcq + sstrideq * 2 ] lea src1q, [src1q + sstrideq * 2] packuswb m1, m1 %ifidn %1, v8_avg movx m2, [dstq] pavgb m0, m2 %endif movx [dstq], m0 add dstq, dst_stride %ifidn %1, v8_avg movx m3, [dstq] pavgb m1, m3 %endif movx [dstq], m1 add dstq, dst_stride sub heightd, 2 cmp heightd, 1 jg .loop cmp heightd, 0 je .done movx m0, [srcq ] ;A movx m1, [srcq + sstrideq ] ;B movx m6, [srcq + sstride6q ] ;G punpcklbw m0, m1 ;A B movx m7, [src1q + sstride6q ] ;H pmaddubsw m0, k0k1 movx m2, [srcq + sstrideq * 2 ] ;C punpcklbw m6, m7 ;G H movx m3, [src1q + sstrideq * 2] ;D pmaddubsw m6, k6k7 movx m4, [srcq + sstrideq * 4 ] ;E punpcklbw m2, m3 ;C D movx m5, [src1q + sstrideq * 4] ;F punpcklbw m4, m5 ;E F pmaddubsw m2, k2k3 pmaddubsw m4, k4k5 paddsw m2, m6 paddsw m0, m4 paddsw m0, m2 paddsw m0, krd psraw m0, 7 packuswb m0, m0 %ifidn %1, v8_avg movx m1, [dstq] pavgb m0, m1 %endif movx [dstq], m0 .done: RET %endm ;------------------------------------------------------------------------------- %macro SUBPIX_VFILTER16 1 cglobal filter_block1d16_%1, 6, 6+(ARCH_X86_64*3), 14, LOCAL_VARS_SIZE, \ src, sstride, dst, dstride, height, filter mova m4, [filterq] SETUP_LOCAL_VARS %if ARCH_X86_64 %define src1q r7 %define sstride6q r8 %define dst_stride dstrideq %else %define src1q filterq %define sstride6q dstrideq %define dst_stride dstridemp %endif mov src1q, srcq add src1q, sstrideq lea sstride6q, [sstrideq + sstrideq * 4] add sstride6q, sstrideq ;pitch * 6 .loop: movh m0, [srcq ] ;A movh m1, [srcq + sstrideq ] ;B movh m2, [srcq + sstrideq * 2 ] ;C movh m3, [src1q + sstrideq * 2] ;D movh m4, [srcq + sstrideq * 4 ] ;E movh m5, [src1q + sstrideq * 4] ;F punpcklbw m0, m1 ;A B movh m6, [srcq + sstride6q] ;G punpcklbw m2, m3 ;C D movh m7, [src1q + sstride6q] ;H punpcklbw m4, m5 ;E F pmaddubsw m0, k0k1 movh m3, [srcq + 8] ;A pmaddubsw m2, k2k3 punpcklbw m6, m7 ;G H movh m5, [srcq + sstrideq + 8] ;B pmaddubsw m4, k4k5 punpcklbw m3, m5 ;A B movh m7, [srcq + sstrideq * 2 + 8] ;C pmaddubsw m6, k6k7 movh m5, [src1q + sstrideq * 2 + 8] ;D punpcklbw m7, m5 ;C D paddsw m2, m6 pmaddubsw m3, k0k1 movh m1, [srcq + sstrideq * 4 + 8] ;E paddsw m0, m4 pmaddubsw m7, k2k3 movh m6, [src1q + sstrideq * 4 + 8] ;F punpcklbw m1, m6 ;E F paddsw m0, m2 paddsw m0, krd movh m2, [srcq + sstride6q + 8] ;G pmaddubsw m1, k4k5 movh m5, [src1q + sstride6q + 8] ;H psraw m0, 7 punpcklbw m2, m5 ;G H pmaddubsw m2, k6k7 %ifidn %1, v8_avg mova m4, [dstq] %endif movh [dstq], m0 paddsw m7, m2 paddsw m3, m1 paddsw m3, m7 paddsw m3, krd psraw m3, 7 packuswb m0, m3 add srcq, sstrideq add src1q, sstrideq %ifidn %1, v8_avg pavgb m0, m4 %endif mova [dstq], m0 add dstq, dst_stride dec heightd jnz .loop RET %endm INIT_XMM ssse3 SUBPIX_VFILTER16 v8 SUBPIX_VFILTER16 v8_avg SUBPIX_VFILTER v8, 8 SUBPIX_VFILTER v8_avg, 8 SUBPIX_VFILTER v8, 4 SUBPIX_VFILTER v8_avg, 4
boot loader/disk_io.asm
Tomer2003/ro-os
0
19420
[bits 16] ;DISK IO in real mode 16 bit with bios interrupts ;The function load data from device storage to memory location ; param bx - memory address to load ; param al - how many sectors to read ; param dl - index of storage device to read from ; param dh - index of head to read from ; param ch - index of cylinder to read from ; param cl - index of sector to read from disk_load: pusha push ax mov ah, 0x02 int 0x13 jc disk_error pop bx cmp bl, al jne disk_error popa ret disk_error: ;mov bx, DISK_ERROR_MSG ;call print_string jmp $ DISK_ERROR_MSG: db "Disk read error!", 13, 10, 0
asm/BBCBasic/basic2.asm
jefftranter/6502
188
5199
<reponame>jefftranter/6502 ; Source for 6502 BASIC II ; BBC BASIC Copyright (C) 1982/1983 Acorn Computer and <NAME> ; Source reconstruction and commentary Copyright (C) J.G.Harston ; Port to CC65 and 6502 SBC by <NAME> ; Define this to build for my 6502 Single Board Computer. ; Comment out to build original code for Acorn Computer. PSBC = 1 ; Macros to pack instruction mnemonics into two high bytes .macro MNEML c1,c2,c3 .byte ((c2 & $1F) << 5 + (c3 & $1F)) & $FF .endmacro .macro MNEMH c1,c2,c3 .byte ((c1 & $1F) << 2 + (c2 & $1F) / 8) & $FF .endmacro ; Symbols FAULT = $FD ; Pointer to error block ESCFLG = $FF ; Escape pending flag F_LOAD = $39 ; LOAD/SAVE control block F_EXEC = F_LOAD+4 F_START = F_LOAD+8 F_END = F_LOAD+12 ; MOS Entry Points: .if .not .defined(PSBC) OS_CLI = $FFF7 OSBYTE = $FFF4 OSWORD = $FFF1 OSWRCH = $FFEE OSWRCR = $FFEC OSNEWL = $FFE7 OSASCI = $FFE3 OSRDCH = $FFE0 OSFILE = $FFDD OSARGS = $FFDA OSBGET = $FFD7 OSBPUT = $FFD4 OSGBPB = $FFD1 OSFIND = $FFCE .endif BRKV = $0202 WRCHV = $020E ; Dummy variables for non-Atom code OSECHO = $0000 OSLOAD = $0000 OSSAVE = $0000 OSRDAR = $0000 OSSTAR = $0000 OSSHUT = $0000 ; BASIC token values tknAND = $80 tknDIV = $81 tknEOR = $82 tknMOD = $83 tknOR = $84 tknERROR = $85 tknLINE = $86 tknOFF = $87 tknSTEP = $88 tknSPC = $89 tknTAB = $8A tknELSE = $8B tknTHEN = $8C tknERL = $9E tknEXP = $A1 tknEXT = $A2 tknFN = $A4 tknLOG = $AB tknTO = $B8 tknAUTO = $C6 tknPTRc = $CF tknDATA = $DC tknDEF = $DD tknRENUMBER = $CC tknDIM = $DE tknEND = $E0 tknFOR = $E3 tknGOSUB = $E4 tknGOTO = $E5 tknIF = $E7 tknLOCAL = $EA tknMODE = $EB tknON = $EE tknPRINT = $F1 tknPROC = $F2 tknREPEAT = $F5 tknSTOP = $FA tknLOMEM = $92 tknHIMEM = $93 tknREPORT = $F6 .if .defined(PSBC) .org $C000 .else .org $8000 .endif ; BBC Code Header L8000: cmp #$01 ; Language entry beq L8023 rts nop .byte $60 ; ROM type=Lang+Tube+6502 BASIC .byte L800E-L8000 ; Offset to copyright string .byte $01 ; ROM version number, 2=$01, 3=$03 .byte "BASIC" ; ROM title L800E: .byte 0 .byte "(C)1982 Acorn" ; ROM copyright string .byte 10 .byte 13 .byte 0 .word $8000 .word $0000 ; Language startup L8023: lda #$84 ; Read top of memory jsr OSBYTE stx $06 ; Set HIMEM sty $07 lda #$83 jsr OSBYTE ; Read bottom of memory sty $18 ; Set PAGE ldx #$00 stx $1F ; Set LISTO to 0 stx $0402 ; Set @5 to 0000xxxx stx $0403 dex ; Set WIDTH to $FF stx $23 ldx #$0A ; Set @% to $0000090A stx $0400 dex stx $0401 lda #$01 ; Check RND seed and $11 ora $0D ora $0E ora $0F ; If nonzero, skip past ora $10 bne L8063 lda #$41 ; Set RND seed to $575241 sta $0D lda #$52 sta $0E lda #$57 ; "ARW" - <NAME>? sta $0F L8063: lda #LB402 & 255 ; Set up error handler sta BRKV lda #LB402 / 256 sta BRKV+1 cli ; Enable IRQs, jump to immediate loop jmp L8ADD ; TOKEN TABLE ; =========== ; string, token (b7=1), flag ; ; Token flag: ; Bit 0 - Conditional tokenisation (don't tokenise if followed by an alphabetic character). ; Bit 1 - Go into "middle of Statement" mode. ; Bit 2 - Go into "Start of Statement" mode. ; Bit 3 - FN/PROC keyword - don't tokenise the name of the subroutine. ; Bit 4 - Start tokenising a line number now (after a GOTO, etc...). ; Bit 5 - Don't tokenise rest of line (REM, DATA, etc...) ; Bit 6 - Pseudo variable flag - add &40 to token if at the start of a statement/hex number ; Bit 7 - Unused - used externally for quote toggle. L8071: .byte "AND",$80,$00 ; 00000000 .byte "ABS",$94,$00 ; 00000000 .byte "ACS",$95,$00 ; 00000000 .byte "ADVAL",$96,$00 ; 00000000 .byte "ASC",$97,$00 ; 00000000 .byte "ASN",$98,$00 ; 00000000 .byte "ATN",$99,$00 ; 00000000 .byte "AUTO",$C6,$10 ; 00010000 .byte "BGET",$9A,$01 ; 00000001 .byte "BPUT",$D5,$03 ; 00000011 .byte "COLOUR",$FB,$02 ; 00000010 .byte "CALL",$D6,$02 ; 00000010 .byte "CHAIN",$D7,$02 ; 00000010 .byte "CHR$",$BD,$00 ; 00000000 .byte "CLEAR",$D8,$01 ; 00000001 .byte "CLOSE",$D9,$03 ; 00000011 .byte "CLG",$DA,$01 ; 00000001 .byte "CLS",$DB,$01 ; 00000001 .byte "COS",$9B,$00 ; 00000000 .byte "COUNT",$9C,$01 ; 00000001 .byte "DATA",$DC,$20 ; 00100000 .byte "DEG",$9D,$00 ; 00000000 .byte "DEF",$DD,$00 ; 00000000 .byte "DELETE",$C7,$10 ; 00010000 .byte "DIV",$81,$00 ; 00000000 .byte "DIM",$DE,$02 ; 00000010 .byte "DRAW",$DF,$02 ; 00000010 .byte "ENDPROC",$E1,$01 ; 00000001 .byte "END",$E0,$01 ; 00000001 .byte "ENVELOPE",$E2,$02 ; 00000010 .byte "ELSE",$8B,$14 ; 00010100 .byte "EVAL",$A0,$00 ; 00000000 .byte "ERL",$9E,$01 ; 00000001 .byte "ERROR",$85,$04 ; 00000100 .byte "EOF",$C5,$01 ; 00000001 .byte "EOR",$82,$00 ; 00000000 .byte "ERR",$9F,$01 ; 00000001 .byte "EXP",$A1,$00 ; 00000000 .byte "EXT",$A2,$01 ; 00000001 .byte "FOR",$E3,$02 ; 00000010 .byte "FALSE",$A3,$01 ; 00000001 .byte "FN",$A4,$08 ; 00001000 .byte "GOTO",$E5,$12 ; 00010010 .byte "GET$",$BE,$00 ; 00000000 .byte "GET",$A5,$00 ; 00000000 .byte "GOSUB",$E4,$12 ; 00010010 .byte "GCOL",$E6,$02 ; 00000010 .byte "HIMEM",$93,$43 ; 00100011 .byte "INPUT",$E8,$02 ; 00000010 .byte "IF",$E7,$02 ; 00000010 .byte "INKEY$",$BF,$00 ; 00000000 .byte "INKEY",$A6,$00 ; 00000000 .byte "INT",$A8,$00 ; 00000000 .byte "INSTR(",$A7,$00 ; 00000000 .byte "LIST",$C9,$10 ; 00010000 .byte "LINE",$86,$00 ; 00000000 .byte "LOAD",$C8,$02 ; 00000010 .byte "LOMEM",$92,$43 ; 01000011 .byte "LOCAL",$EA,$02 ; 00000010 .byte "LEFT$(",$C0,$00 ; 00000000 .byte "LEN",$A9,$00 ; 00000000 .byte "LET",$E9,$04 ; 00000100 .byte "LOG",$AB,$00 ; 00000000 .byte "LN",$AA,$00 ; 00000000 .byte "MID$(",$C1,$00 ; 00000000 .byte "MODE",$EB,$02 ; 00000010 .byte "MOD",$83,$00 ; 00000000 .byte "MOVE",$EC,$02 ; 00000010 .byte "NEXT",$ED,$02 ; 00000010 .byte "NEW",$CA,$01 ; 00000001 .byte "NOT",$AC,$00 ; 00000000 .byte "OLD",$CB,$01 ; 00000001 .byte "ON",$EE,$02 ; 00000010 .byte "OFF",$87,$00 ; 00000000 .byte "OR",$84,$00 ; 00000000 .byte "OPENIN",$8E,$00 ; 00000000 .byte "OPENOUT",$AE,$00 ; 00000000 .byte "OPENUP",$AD,$00 ; 00000000 .byte "OSCLI",$FF,$02 ; 00000010 .byte "PRINT",$F1,$02 ; 00000010 .byte "PAGE",$90,$43 ; 01000011 .byte "PTR",$8F,$43 ; 01000011 .byte "PI",$AF,$01 ; 00000001 .byte "PLOT",$F0,$02 ; 00000010 .byte "POINT(",$B0,$00 ; 00000000 .byte "PROC",$F2,$0A ; 00001010 .byte "POS",$B1,$01 ; 00000001 .byte "RETURN",$F8,$01 ; 00000001 .byte "REPEAT",$F5,$00 ; 00000000 .byte "REPORT",$F6,$01 ; 00000001 .byte "READ",$F3,$02 ; 00000010 .byte "REM",$F4,$20 ; 00100000 .byte "RUN",$F9,$01 ; 00000001 .byte "RAD",$B2,$00 ; 00000000 .byte "RESTORE",$F7,$12 ; 00010010 .byte "RIGHT$(",$C2,$00 ; 00000000 .byte "RND",$B3,$01 ; 00000001 .byte "RENUMBER",$CC,$10 ; 00010000 .byte "STEP",$88,$00 ; 00000000 .byte "SAVE",$CD,$02 ; 00000010 .byte "SGN",$B4,$00 ; 00000000 .byte "SIN",$B5,$00 ; 00000000 .byte "SQR",$B6,$00 ; 00000000 .byte "SPC",$89,$00 ; 00000000 .byte "STR$",$C3,$00 ; 00000000 .byte "STRING$(",$C4,$00 ; 00000000 .byte "SOUND",$D4,$02 ; 00000010 .byte "STOP",$FA,$01 ; 00000001 .byte "TAN",$B7,$00 ; 00000000 .byte "THEN",$8C,$14 ; 00010100 .byte "TO",$B8,$00 ; 00000000 .byte "TAB(",$8A,$00 ; 00000000 .byte "TRACE",$FC,$12 ; 00010010 .byte "TIME",$91,$43 ; 01000011 .byte "TRUE",$B9,$01 ; 00000001 .byte "UNTIL",$FD,$02 ; 00000010 .byte "USR",$BA,$00 ; 00000000 .byte "VDU",$EF,$02 ; 00000010 .byte "VAL",$BB,$00 ; 00000000 .byte "VPOS",$BC,$01 ; 00000001 .byte "WIDTH",$FE,$02 ; 00000010 .byte "PAGE",$D0,$00 ; 00000000 .byte "PTR",$CF,$00 ; 00000000 .byte "TIME",$D1,$00 ; 00000000 .byte "LOMEM",$D2,$00 ; 00000000 .byte "HIMEM",$D3,$00 ; 00000000 ; FUNCTION/COMMAND DISPATCH TABLE, ADDRESS LOW BYTES ; ================================================== L836D: .byte LBF78 & $FF ; &8E - OPENIN .byte LBF47 & $FF ; &8F - PTR .byte LAEC0 & 255 ; &90 - PAGE .byte LAEB4 & 255 ; &91 - TIME .byte LAEFC & 255 ; &92 - LOMEM .byte LAF03 & 255 ; &93 - HIMEM .byte LAD6A & $FF ; &94 - ABS .byte LA8D4 & $FF ; &95 - ACS .byte LAB33 & $FF ; &96 - ADVAL .byte LAC9E & $FF ; &97 - ASC .byte LA8DA & $FF ; &98 - ASN .byte LA907 & $FF ; &99 - ATN .byte LBF6F & $FF ; &9A - BGET .byte LA98D & $FF ; &9B - COS .byte LAEF7 & $FF ; &9C - COUNT .byte LABC2 & $FF ; &9D - DEG .byte LAF9F & $FF ; &9E - ERL .byte LAFA6 & $FF ; &9F - ERR .byte LABE9 & $FF ; &A0 - EVAL .byte LAA91 & $FF ; &A1 - EXP .byte LBF46 & $FF ; &A2 - EXT .byte LAECA & $FF ; &A3 - FALSE .byte LB195 & $FF ; &A4 - FN .byte LAFB9 & $FF ; &A5 - GET .byte LACAD & $FF ; &A6 - INKEY .byte LACE2 & $FF ; &A7 - INSTR( .byte LAC78 & $FF ; &A8 - INT .byte LAED1 & $FF ; &A9 - LEN .byte LA7FE & $FF ; &AA - LN .byte LABA8 & $FF ; &AB - LOG .byte LACD1 & $FF ; &AC - NOT .byte LBF80 & $FF ; &AD - OPENUP .byte LBF7C & $FF ; &AE - OPENOUT .byte LABCB & $FF ; &AF - PI .byte LAB41 & $FF ; &B0 - POINT( .byte LAB6D & $FF ; &B1 - POS .byte LABB1 & $FF ; &B2 - RAD .byte LAF49 & $FF ; &B3 - RND .byte LAB88 & $FF ; &B4 - SGN .byte LA998 & $FF ; &B5 - SIN .byte LA7B4 & $FF ; &B6 - SQR .byte LA6BE & $FF ; &B7 - TAN .byte LAEDC & $FF ; &B8 - TO .byte LACC4 & $FF ; &B9 - TRUE .byte LABD2 & $FF ; &BA - USR .byte LAC2F & $FF ; &BB - VAL .byte LAB76 & $FF ; &BC - VPOS .byte LB3BD & $FF ; &BD - CHR$ .byte LAFBF & $FF ; &BE - GET$ .byte LB026 & $FF ; &BF - INKEY$ .byte LAFCC & $FF ; &C0 - LEFT$( .byte LB039 & $FF ; &C1 - MID$( .byte LAFEE & $FF ; &C2 - RIGHT$( .byte LB094 & $FF ; &C3 - STR$( .byte LB0C2 & $FF ; &C4 - STRING$( .byte LACB8 & $FF ; &C5 - EOF .byte L90AC & $FF ; &C6 - AUTO .byte L8F31 & $FF ; &C7 - DELETE .byte LBF24 & $FF ; &C8 - LOAD .byte LB59C & $FF ; &C9 - LIST .byte L8ADA & $FF ; &CA - NEW .byte L8AB6 & $FF ; &CB - OLD .byte L8FA3 & $FF ; &CC - RENUMBER .byte LBEF3 & $FF ; &CD - SAVE .byte L982A & $FF ; &CE - unused .byte LBF30 & $FF ; &CF - PTR .byte L9283 & $FF ; &D0 - PAGE .byte L92C9 & $FF ; &D1 - TIME .byte L926F & $FF ; &D2 - LOMEM .byte L925D & $FF ; &D3 - HIMEM .byte LB44C & $FF ; &D4 - SOUND .byte LBF58 & $FF ; &D5 - BPUT .byte L8ED2 & $FF ; &D6 - CALL .byte LBF2A & $FF ; &D7 - CHAIN .byte L928D & $FF ; &D8 - CLEAR .byte LBF99 & $FF ; &D9 - CLOSE .byte L8EBD & $FF ; &DA - CLG .byte L8EC4 & $FF ; &DB - CLS .byte L8B7D & $FF ; &DC - DATA .byte L8B7D & $FF ; &DD - DEF .byte L912F & $FF ; &DE - DIM .byte L93E8 & $FF ; &DF - DRAW .byte L8AC8 & $FF ; &E0 - END .byte L9356 & $FF ; &E1 - ENDPROC .byte LB472 & $FF ; &E2 - ENVELOPE .byte LB7C4 & $FF ; &E3 - FOR .byte LB888 & $FF ; &E4 - GOSUB .byte LB8CC & $FF ; &E5 - GOTO .byte L937A & $FF ; &E6 - GCOL .byte L98C2 & $FF ; &E7 - IF .byte LBA44 & $FF ; &E8 - INPUT .byte L8BE4 & $FF ; &E9 - LET .byte L9323 & $FF ; &EA - LOCAL .byte L939A & $FF ; &EB - MODE .byte L93E4 & $FF ; &EC - MOVE .byte LB695 & $FF ; &ED - NEXT .byte LB915 & $FF ; &EE - ON .byte L942F & $FF ; &EF - VDU .byte L93F1 & $FF ; &F0 - PLOT .byte L8D9A & $FF ; &F1 - PRINT .byte L9304 & $FF ; &F2 - PROC .byte LBB1F & $FF ; &F3 - READ .byte L8B7D & $FF ; &F4 - REM .byte LBBE4 & $FF ; &F5 - REPEAT .byte LBFE4 & $FF ; &F6 - REPORT .byte LBAE6 & $FF ; &F7 - RESTORE .byte LB8B6 & $FF ; &F8 - RETURN .byte LBD11 & $FF ; &F9 - RUN .byte L8AD0 & $FF ; &FA - STOP .byte L938E & $FF ; &FB - COLOUR .byte L9295 & $FF ; &FC - TRACE .byte LBBB1 & $FF ; &FD - UNTIL .byte LB4A0 & $FF ; &FE - WIDTH .byte LBEC2 & $FF ; &FF - OSCLI ; FUNCTION/COMMAND DISPATCH TABLE, ADDRESS HIGH BYTES ; =================================================== L83DF: ; &83E6 .byte LBF78 / 256 ; &8E - OPENIN .byte LBF47 / 256 ; &8F - PTR .byte LAEC0 / 256 ; &90 - PAGE .byte LAEB4 / 256 ; &91 - TIME .byte LAEFC / 256 ; &92 - LOMEM .byte LAF03 / 256 ; &93 - HIMEM .byte LAD6A / 256 ; &94 - ABS .byte LA8D4 / 256 ; &95 - ACS .byte LAB33 / 256 ; &96 - ADVAL .byte LAC9E / 256 ; &97 - ASC .byte LA8DA / 256 ; &98 - ASN .byte LA907 / 256 ; &99 - ATN .byte LBF6F / 256 ; &9A - BGET .byte LA98D / 256 ; &9B - COS .byte LAEF7 / 256 ; &9C - COUNT .byte LABC2 / 256 ; &9D - DEG .byte LAF9F / 256 ; &9E - ERL .byte LAFA6 / 256 ; &9F - ERR .byte LABE9 / 256 ; &A0 - EVAL .byte LAA91 / 256 ; &A1 - EXP .byte LBF46 / 256 ; &A2 - EXT .byte LAECA / 256 ; &A3 - FALSE .byte LB195 / 256 ; &A4 - FN .byte LAFB9 / 256 ; &A5 - GET .byte LACAD / 256 ; &A6 - INKEY .byte LACE2 / 256 ; &A7 - INSTR( .byte LAC78 / 256 ; &A8 - INT .byte LAED1 / 256 ; &A9 - LEN .byte LA7FE / 256 ; &AA - LN .byte LABA8 / 256 ; &AB - LOG .byte LACD1 / 256 ; &AC - NOT .byte LBF80 / 256 ; &AD - OPENUP .byte LBF7C / 256 ; &AE - OPENOUT .byte LABCB / 256 ; &AF - PI .byte LAB41 / 256 ; &B0 - POINT( .byte LAB6D / 256 ; &B1 - POS .byte LABB1 / 256 ; &B2 - RAD .byte LAF49 / 256 ; &B3 - RND .byte LAB88 / 256 ; &B4 - SGN .byte LA998 / 256 ; &B5 - SIN .byte LA7B4 / 256 ; &B6 - SQR .byte LA6BE / 256 ; &B7 - TAN .byte LAEDC / 256 ; &B8 - TO .byte LACC4 / 256 ; &B9 - TRUE .byte LABD2 / 256 ; &BA - USR .byte LAC2F / 256 ; &BB - VAL .byte LAB76 / 256 ; &BC - VPOS .byte LB3BD / 256 ; &BD - CHR$ .byte LAFBF / 256 ; &BE - GET$ .byte LB026 / 256 ; &BF - INKEY$ .byte LAFCC / 256 ; &C0 - LEFT$( .byte LB039 / 256 ; &C1 - MID$( .byte LAFEE / 256 ; &C2 - RIGHT$( .byte LB094 / 256 ; &C3 - STR$( .byte LB0C2 / 256 ; &C4 - STRING$( .byte LACB8 / 256 ; &C5 - EOF .byte L90AC / 256 ; &C6 - AUTO .byte L8F31 / 256 ; &C7 - DELETE .byte LBF24 / 256 ; &C8 - LOAD .byte LB59C / 256 ; &C9 - LIST .byte L8ADA / 256 ; &CA - NEW .byte L8AB6 / 256 ; &CB - OLD .byte L8FA3 / 256 ; &CC - RENUMBER .byte LBEF3 / 256 ; &CD - SAVE .byte L982A / 256 ; &CE - unused .byte LBF30 / 256 ; &CF - PTR .byte L9283 / 256 ; &D0 - PAGE .byte L92C9 / 256 ; &D1 - TIME .byte L926F / 256 ; &D2 - LOMEM .byte L925D / 256 ; &D3 - HIMEM .byte LB44C / 256 ; &D4 - SOUND .byte LBF58 / 256 ; &D5 - BPUT .byte L8ED2 / 256 ; &D6 - CALL .byte LBF2A / 256 ; &D7 - CHAIN .byte L928D / 256 ; &D8 - CLEAR .byte LBF99 / 256 ; &D9 - CLOSE .byte L8EBD / 256 ; &DA - CLG .byte L8EC4 / 256 ; &DB - CLS .byte L8B7D / 256 ; &DC - DATA .byte L8B7D / 256 ; &DD - DEF .byte L912F / 256 ; &DE - DIM .byte L93E8 / 256 ; &DF - DRAW .byte L8AC8 / 256 ; &E0 - END .byte L9356 / 256 ; &E1 - ENDPROC .byte LB472 / 256 ; &E2 - ENVELOPE .byte LB7C4 / 256 ; &E3 - FOR .byte LB888 / 256 ; &E4 - GOSUB .byte LB8CC / 256 ; &E5 - GOTO .byte L937A / 256 ; &E6 - GCOL .byte L98C2 / 256 ; &E7 - IF .byte LBA44 / 256 ; &E8 - INPUT .byte L8BE4 / 256 ; &E9 - LET .byte L9323 / 256 ; &EA - LOCAL .byte L939A / 256 ; &EB - MODE .byte L93E4 / 256 ; &EC - MOVE .byte LB695 / 256 ; &ED - NEXT .byte LB915 / 256 ; &EE - ON .byte L942F / 256 ; &EF - VDU .byte L93F1 / 256 ; &F0 - PLOT .byte L8D9A / 256 ; &F1 - PRINT .byte L9304 / 256 ; &F2 - PROC .byte LBB1F / 256 ; &F3 - READ .byte L8B7D / 256 ; &F4 - REM .byte LBBE4 / 256 ; &F5 - REPEAT .byte LBFE4 / 256 ; &F6 - REPORT .byte LBAE6 / 256 ; &F7 - RESTORE .byte LB8B6 / 256 ; &F8 - RETURN .byte LBD11 / 256 ; &F9 - RUN .byte L8AD0 / 256 ; &FA - STOP .byte L938E / 256 ; &FB - COLOUR .byte L9295 / 256 ; &FC - TRACE .byte LBBB1 / 256 ; &FD - UNTIL .byte LB4A0 / 256 ; &FE - WIDTH .byte LBEC2 / 256 ; &FF - OSCLI ; ASSEMBLER ; ========= ; ; Packed mnemonic table, low bytes ; -------------------------------- L8451: MNEML 'B','R','K' MNEML 'C','L','C' MNEML 'C','L','D' MNEML 'C','L','I' MNEML 'C','L','V' MNEML 'D','E','X' MNEML 'D','E','Y' MNEML 'I','N','X' MNEML 'I','N','Y' MNEML 'N','O','P' MNEML 'P','H','A' MNEML 'P','H','P' MNEML 'P','L','A' MNEML 'P','L','P' MNEML 'R','T','I' MNEML 'R','T','S' MNEML 'S','E','C' MNEML 'S','E','D' MNEML 'S','E','I' MNEML 'T','A','X' MNEML 'T','A','Y' MNEML 'T','S','X' MNEML 'T','X','A' MNEML 'T','X','S' MNEML 'T','Y','A' MNEML 'B','C','C' MNEML 'B','C','S' MNEML 'B','E','Q' MNEML 'B','M','I' MNEML 'B','N','E' MNEML 'B','P','L' MNEML 'B','V','C' MNEML 'B','V','S' MNEML 'A','N','D' MNEML 'E','O','R' MNEML 'O','R','A' MNEML 'A','D','C' MNEML 'C','M','P' MNEML 'L','D','A' MNEML 'S','B','C' MNEML 'A','S','L' MNEML 'L','S','R' MNEML 'R','O','L' MNEML 'R','O','R' MNEML 'D','E','C' MNEML 'I','N','C' MNEML 'C','P','X' MNEML 'C','P','Y' MNEML 'B','I','T' MNEML 'J','M','P' MNEML 'J','S','R' MNEML 'L','D','X' MNEML 'L','D','Y' MNEML 'S','T','A' MNEML 'S','T','X' MNEML 'S','T','Y' MNEML 'O','P','T' MNEML 'E','Q','U' ; Packed mnemonic table, high bytes ; --------------------------------- L848B: MNEMH 'B','R','K' MNEMH 'C','L','C' MNEMH 'C','L','D' MNEMH 'C','L','I' MNEMH 'C','L','V' MNEMH 'D','E','X' MNEMH 'D','E','Y' MNEMH 'I','N','X' MNEMH 'I','N','Y' MNEMH 'N','O','P' MNEMH 'P','H','A' MNEMH 'P','H','P' MNEMH 'P','L','A' MNEMH 'P','L','P' MNEMH 'R','T','I' MNEMH 'R','T','S' MNEMH 'S','E','C' MNEMH 'S','E','D' MNEMH 'S','E','I' MNEMH 'T','A','X' MNEMH 'T','A','Y' MNEMH 'T','S','X' MNEMH 'T','X','A' MNEMH 'T','X','S' MNEMH 'T','Y','A' MNEMH 'B','C','C' MNEMH 'B','C','S' MNEMH 'B','E','Q' MNEMH 'B','M','I' MNEMH 'B','N','E' MNEMH 'B','P','L' MNEMH 'B','V','C' MNEMH 'B','V','S' MNEMH 'A','N','D' MNEMH 'E','O','R' MNEMH 'O','R','A' MNEMH 'A','D','C' MNEMH 'C','M','P' MNEMH 'L','D','A' MNEMH 'S','B','C' MNEMH 'A','S','L' MNEMH 'L','S','R' MNEMH 'R','O','L' MNEMH 'R','O','R' MNEMH 'D','E','C' MNEMH 'I','N','C' MNEMH 'C','P','X' MNEMH 'C','P','Y' MNEMH 'B','I','T' MNEMH 'J','M','P' MNEMH 'J','S','R' MNEMH 'L','D','X' MNEMH 'L','D','Y' MNEMH 'S','T','A' MNEMH 'S','T','X' MNEMH 'S','T','Y' MNEMH 'O','P','T' MNEMH 'E','Q','U' ; Opcode base table ; ----------------- L84C5: ; No arguments ; ------------ BRK CLC CLD CLI CLV DEX DEY INX INY NOP PHA PHP PLA PLP RTI RTS SEC SED SEI TAX TAY TSX TXA TXS TYA ; Branches ; -------- .byte $90, $B0, $F0, $30 ; BMI, BCC, BCS, BEQ .byte $D0, $10, $50, $70 ; BNE, BPL, BVC, BVS ; Arithmetic ; ---------- .byte $21, $41, $01, $61 ; AND, EOR, ORA, ADC .byte $C1, $A1, $E1, $06 ; CMP, LDA, SBC, ASL .byte $46, $26, $66, $C6 ; LSR, ROL, ROR, DEC .byte $E6, $E0, $C0, $20 ; INC, CPX, CPY, BIT ; Others ; ------ .byte $4C, $20, $A2, $A0 ; JMP, JSR, LDX, LDY .byte $81, $86, $84 ; STA, STX, STY ; Exit Assembler ; -------------- L84FD: lda #$FF ; Set OPT to 'BASIC' L84FF: sta $28 ; Set OPT, return to execution loop jmp L8BA3 L8504: lda #$03 ; Set OPT 3, default on entry to '[' sta $28 L8508: jsr L8A97 ; Skip spaces cmp #']' ; ']' - exit assembler beq L84FD jsr L986D L8512: dec $0A jsr L85BA dec $0A lda $28 lsr a bcc L857E lda $1E adc #$04 sta $3F lda $38 jsr LB545 lda $37 jsr LB562 ldx #$FC ldy $39 bpl L8536 ldy $36 L8536: sty $38 beq L8556 ldy #$00 L853C: inx bne L854C jsr LBC25 ; Print newline ldx $3F L8544: jsr LB565 ; Print a space dex ; Loop to print spaces bne L8544 ldx #$FD L854C: lda ($3A),y jsr LB562 iny dec $38 bne L853C L8556: inx bpl L8565 jsr LB565 jsr LB558 jsr LB558 jmp L8556 L8565: ldy #$00 L8567: lda ($0B),y cmp #$3A beq L8577 cmp #$0D beq L857B L8571: jsr LB50E ; Print character or token iny bne L8567 L8577: cpy $0A bcc L8571 L857B: jsr LBC25 ; Print newline L857E: ldy $0A dey L8581: iny lda ($0B),y cmp #$3A beq L858C cmp #$0D bne L8581 L858C: jsr L9859 dey lda ($0B),y cmp #$3A beq L85A2 lda $0C cmp #$07 bne L859F jmp L8AF6 L859F: jsr L9890 L85A2: jmp L8508 L85A5: jsr L9582 beq L8604 bcs L8604 jsr LBD94 jsr LAE3A ; Find P% sta $27 jsr LB4B4 jsr L8827 L85BA: ldx #$03 ; Prepare to fetch three characters jsr L8A97 ; Skip spaces ldy #$00 sty $3D cmp #':' ; End of statement beq L862B cmp #$0D ; End of line beq L862B cmp #'\' ; Comment beq L862B cmp #'.' ; Label beq L85A5 dec $0A L85D5: ldy $0A ; Get current character, inc. index inc $0A lda ($0B),y ; Token, check for tokenised AND, EOR, OR bmi L8607 cmp #$20 ; Space, step past beq L85F1 ldy #$05 asl a ; Compact first character asl a asl a L85E6: asl a rol $3D rol $3E dey bne L85E6 dex ; Loop to fetch three characters bne L85D5 ; The current opcode has now been compressed into two bytes ; --------------------------------------------------------- L85F1: ldx #$3A ; Point to end of opcode lookup table lda $3D ; Get low byte of compacted mnemonic L85F5: cmp L8451-1,x ; Low half doesn't match bne L8601 ldy L848B-1,x ; Check high half cpy $3E ; Mnemonic matches beq L8620 L8601: dex ; Loop through opcode lookup table bne L85F5 L8604: jmp L982A ; Mnemonic not matched, Mistake L8607: ldx #$22 ; opcode number for 'AND' cmp #tknAND ; Tokenised 'AND' beq L8620 inx ; opcode number for 'EOR' cmp #tknEOR ; Tokenized 'EOR' beq L8620 inx ; opcode number for 'ORA' cmp #tknOR ; Not tokenized 'OR' bne L8604 inc $0A ; Get next character iny lda ($0B),y cmp #'A' ; Ensure 'OR' followed by 'A' bne L8604 ; Opcode found ; ------------ L8620: lda L84C5-1,x ; Get base opcode sta $29 ldy #$01 ; Y=1 for one byte cpx #$1A ; Opcode $1A+ have arguments bcs L8673 L862B: lda $0440 ; Get P% low byte sta $37 sty $39 ldx $28 ; Offset assembly (opt>3) cpx #$04 ldx $0441 ; Get P% high byte stx $38 bcc L8643 ; No offset assembly lda $043C ldx $043D ; Get O% L8643: sta $3A ; Store destination pointer stx $3B tya beq L8672 bpl L8650 ldy $36 beq L8672 L8650: dey ; Get opcode byte lda $0029,y bit $39 ; Opcode - jump to store it bpl L865B lda $0600,y ; Get EQU byte L865B: sta ($3A),y ; Store byte inc $0440 ; Increment P% bne L8665 inc $0441 L8665: bcc L866F inc $043C ; Increment O% bne L866F inc $043D L866F: tya bne L8650 L8672: rts L8673: cpx #$22 bcs L86B7 jsr L8821 clc lda $2A sbc $0440 tay lda $2B sbc $0441 cpy #$01 dey sbc #$00 beq L86B2 cmp #$FF beq L86AD L8691: lda $28 ; Get OPT lsr a beq L86A5 ; If OPT.b0=0, ignore error brk .byte $01,"Out of range" brk L86A5: tay L86A6: sty $2A L86A8: ldy #$02 jmp L862B L86AD: tya bmi L86A6 bpl L8691 L86B2: tya bpl L86A6 bmi L8691 L86B7: cpx #$29 bcs L86D3 jsr L8A97 ; Skip spaces cmp #'#' bne L86DA jsr L882F L86C5: jsr L8821 L86C8: lda $2B beq L86A8 L86CC: brk .byte $02,"Byte" brk ; Parse (zp),Y addressing mode ; ---------------------------- L86D3: cpx #$36 bne L873F jsr L8A97 ; Skip spaces L86DA: cmp #'(' bne L8715 jsr L8821 jsr L8A97 ; Skip spaces cmp #')' bne L86FB jsr L8A97 ; Skip spaces cmp #',' ; No comma, jump to Index error bne L870D jsr L882C jsr L8A97 ; Skip spaces cmp #'Y' ; (z),Y missing Y, jump to Index error bne L870D beq L86C8 ; Parse (zp,X) addressing mode ; ---------------------------- L86FB: cmp #',' ; No comma, jump to Index error bne L870D jsr L8A97 ; Skip spaces cmp #'X' ; zp,X missing X, jump to Index error bne L870D jsr L8A97 cmp #')' ; zp,X) - jump to process beq L86C8 L870D: brk .byte $03,"Index" brk L8715: dec $0A jsr L8821 jsr L8A97 ; Skip spaces cmp #',' ; No comma - jump to process as abs,X bne L8735 jsr L882C jsr L8A97 ; Skip spaces cmp #'X' ; abs,X - jump to process beq L8735 cmp #'Y' ; Not abs,Y - jump to Index error bne L870D L872F: jsr L882F jmp L879A ; abs and abs,X ; ------------- L8735: jsr L8832 L8738: lda $2B bne L872F jmp L86A8 L873F: cpx #$2F bcs L876E cpx #$2D bcs L8750 jsr L8A97 ; Skip spaces cmp #'A' ; ins A - beq L8767 dec $0A L8750: jsr L8821 jsr L8A97 ; Skip spaces cmp #',' bne L8738 ; No comma, jump to ... jsr L882C jsr L8A97 ; Skip spaces cmp #'X' beq L8738 ; Jump with address,X jmp L870D ; Otherwise, jump to Index error L8767: jsr L8832 ldy #$01 bne L879C L876E: cpx #$32 bcs L8788 cpx #$31 beq L8782 jsr L8A97 ; Skip spaces cmp #'#' bne L8780 ; Not #, jump with address jmp L86C5 L8780: dec $0A L8782: jsr L8821 jmp L8735 L8788: cpx #$33 beq L8797 bcs L87B2 jsr L8A97 ; Skip spaces cmp #'(' beq L879F ; Jump With (... addressing mode dec $0A L8797: jsr L8821 L879A: ldy #$03 L879C: jmp L862B L879F: jsr L882C jsr L882C jsr L8821 jsr L8A97 ; Skip spaces cmp #')' beq L879A jmp L870D ; No ) - jump to Index error L87B2: cpx #$39 bcs L8813 lda $3D eor #$01 and #$1F pha cpx #$37 bcs L87F0 jsr L8A97 ; Skip spaces cmp #'#' bne L87CC pla jmp L86C5 L87CC: dec $0A jsr L8821 pla sta $37 jsr L8A97 cmp #',' beq L87DE jmp L8735 L87DE: jsr L8A97 and #$1F cmp $37 bne L87ED jsr L882C jmp L8735 L87ED: jmp L870D ; Jump to Index error L87F0: jsr L8821 pla sta $37 jsr L8A97 cmp #',' bne L8810 jsr L8A97 and #$1F cmp $37 bne L87ED jsr L882C lda $2B beq L8810 ; High byte=0, continue jmp L86CC ; value>255, jump to Byte error L8810: jmp L8738 L8813: bne L883A jsr L8821 lda $2A sta $28 ldy #$00 jmp L862B L8821: jsr L9B1D jsr L92F0 L8827: ldy $1B sty $0A rts L882C: jsr L882F L882F: jsr L8832 L8832: lda $29 clc adc #$04 sta $29 rts L883A: ldx #$01 ; Prepare for one byte ldy $0A inc $0A ; Increment address lda ($0B),y ; Get next character cmp #'B' beq L8858 ; EQUB inx ; Prepare for two bytes cmp #'W' beq L8858 ; EQUW ldx #$04 ; Prepare for four bytes cmp #'D' beq L8858 ; EQUD cmp #'S' beq L886A ; EQUS jmp L982A ; Syntax error L8858: txa pha jsr L8821 ldx #$29 jsr LBE44 pla tay L8864: jmp L862B L8867: jmp L8C0E L886A: lda $28 pha jsr L9B1D bne L8867 pla sta $28 jsr L8827 ldy #$FF bne L8864 L887C: pha clc tya adc $37 sta $39 ldy #$00 tya adc $38 sta $3A pla sta ($37),y L888D: iny lda ($39),y sta ($37),y cmp #$0D bne L888D rts L8897: and #$0F sta $3D sty $3E L889D: iny lda ($37),y cmp #'9'+1 bcs L88DA cmp #'0' bcc L88DA and #$0F pha ldx $3E lda $3D asl a rol $3E bmi L88D5 asl a rol $3E bmi L88D5 adc $3D sta $3D txa adc $3E asl $3D rol a bmi L88D5 bcs L88D5 sta $3E pla adc $3D sta $3D bcc L889D inc $3E bpl L889D pha L88D5: pla ldy #$00 sec rts L88DA: dey lda #$8D jsr L887C lda $37 adc #$02 sta $39 lda $38 adc #$00 sta $3A L88EC: lda ($37),y sta ($39),y dey bne L88EC ldy #$03 L88F5: lda $3E ora #$40 sta ($37),y dey lda $3D and #$3F ora #$40 sta ($37),y dey lda $3D and #$C0 sta $3D lda $3E and #$C0 lsr a lsr a ora $3D lsr a lsr a eor #$54 sta ($37),y jsr L8944 ; Increment $37/8 jsr L8944 ; Increment $37/8 jsr L8944 ; Increment $37/8 ldy #$00 L8924: clc rts L8926: cmp #$7B bcs L8924 cmp #$5F bcs L893C cmp #$5B bcs L8924 cmp #$41 bcs L893C L8936: cmp #$3A bcs L8924 cmp #$30 L893C: rts L893D: cmp #$2E bne L8936 rts L8942: lda ($37),y L8944: inc $37 bne L894A inc $38 L894A: rts L894B: jsr L8944 ; Increment $37/8 lda ($37),y rts ; Tokenise line at &37/8 ; ====================== L8951: ldy #$00 sty $3B ; Set tokenizer to left-hand-side L8955: sty $3C L8957: lda ($37),y ; Get current character cmp #$0D beq L894A ; Exit with <cr> cmp #$20 bne L8966 ; Skip <spc> L8961: jsr L8944 bne L8957 ; Increment $37/8 and check next character L8966: cmp #'&' bne L897C ; Jump if not '&' L896A: jsr L894B ; Increment $37/8 and get next character jsr L8936 bcs L896A ; Jump if numeric character cmp #'A' bcc L8957 ; Loop back if <'A' cmp #'F'+1 bcc L896A ; Step to next if 'A'..'F' bcs L8957 ; Loop back for next character L897C: cmp #$22 bne L898C L8980: jsr L894B ; Increment $37/8 and get next character cmp #$22 beq L8961 ; Not quote, jump to process next character cmp #$0D bne L8980 rts L898C: cmp #':' bne L8996 sty $3B sty $3C beq L8961 L8996: cmp #',' beq L8961 cmp #'*' bne L89A3 lda $3B bne L89E3 rts L89A3: cmp #'.' beq L89B5 jsr L8936 bcc L89DF ldx $3C beq L89B5 jsr L8897 bcc L89E9 L89B5: lda ($37),y jsr L893D bcc L89C2 jsr L8944 jmp L89B5 L89C2: ldx #$FF stx $3B sty $3C jmp L8957 L89CB: jsr L8926 bcc L89E3 L89D0: ldy #$00 L89D2: lda ($37),y jsr L8926 bcc L89C2 jsr L8944 jmp L89D2 L89DF: cmp #'A' bcs L89EC ; Jump if letter L89E3: ldx #$FF stx $3B sty $3C L89E9: jmp L8961 L89EC: cmp #'X' bcs L89CB ; Jump if >='X', nothing starts with X,Y,Z ldx #L8071 & 255 ; Point to token table stx $39 ldx #L8071 / 256 stx $3A L89F8: cmp ($39),y bcc L89D2 bne L8A0D L89FE: iny lda ($39),y bmi L8A37 cmp ($37),y beq L89FE lda ($37),y cmp #'.' beq L8A18 L8A0D: iny lda ($39),y bpl L8A0D cmp #$FE bne L8A25 bcs L89D0 L8A18: iny L8A19: lda ($39),y bmi L8A37 inc $39 bne L8A19 inc $3A bne L8A19 L8A25: sec iny tya adc $39 sta $39 bcc L8A30 inc $3A L8A30: ldy #$00 lda ($37),y jmp L89F8 L8A37: tax iny lda ($39),y sta $3D ; Get token flag dey lsr a bcc L8A48 lda ($37),y jsr L8926 bcs L89D0 L8A48: txa bit $3D bvc L8A54 ldx $3B bne L8A54 clc ; Superfluous as all paths to here have CLC adc #$40 L8A54: dey jsr L887C ldy #$00 ldx #$FF lda $3D lsr a lsr a bcc L8A66 stx $3B sty $3C L8A66: lsr a bcc L8A6D sty $3B sty $3C L8A6D: lsr a bcc L8A81 pha iny L8A72: lda ($37),y jsr L8926 bcc L8A7F jsr L8944 jmp L8A72 L8A7F: dey pla L8A81: lsr a bcc L8A86 stx $3C L8A86: lsr a bcs L8A96 jmp L8961 ; Skip Spaces ; =========== L8A8C: ldy $1B ; Get offset, increment it inc $1B lda ($19),y ; Get current character cmp #' ' beq L8A8C ; Loop until not space L8A96: rts ; Skip spaces at PtrA ; ------------------- L8A97: ldy $0A inc $0A lda ($0B),y cmp #$20 beq L8A97 L8AA1: rts L8AA2: brk .byte $05 .byte "Missing ," brk L8AAE: jsr L8A8C cmp #',' bne L8AA2 rts ; OLD - Attempt to restore program ; ================================ L8AB6: jsr L9857 ; Check end of statement lda $18 sta $38 ; Point $37/8 to PAGE lda #$00 sta $37 sta ($37),y ; Remove end marker jsr LBE6F ; Check program and set TOP bne L8AF3 ; Jump to clear heap and go to immediate mode ; END - Return to immediate mode ; ============================== L8AC8: jsr L9857 ; Check end of statement jsr LBE6F ; Check program and set TOP bne L8AF6 ; Jump to immediate mode, keeping variables, etc ; STOP - Abort program with an error ; ================================== L8AD0: jsr L9857 ; Check end of statement brk .byte $00 .byte "STOP" brk ; NEW - Clear program, enter immediate mode ; ========================================= L8ADA: jsr L9857 ; Check end if statement ; Start up with NEW program ; ------------------------- L8ADD: lda #$0D ; TOP hi=PAGE hi ldy $18 sty $13 ldy #$00 ; TOP=PAGE, TRACE OFF sty $12 sty $20 sta ($12),y ; ?(PAGE+0)=<cr> lda #$FF ; ?(PAGE+1)=$FF iny sta ($12),y iny ; TOP=PAGE+2 sty $12 L8AF3: jsr LBD20 ; Clear variables, heap, stack ; IMMEDIATE LOOP ; ============== L8AF6: ldy #$07 ; PtrA=&0700 - input buffer sty $0C ldy #$00 sty $0B lda #LB433 & 255 ; ON ERROR OFF sta $16 lda #LB433 / 256 sta $17 lda #'>' ; Print '>' prompt, read input to buffer at PtrA jsr LBC02 ; Execute line at program pointer in &0B/C ; ---------------------------------------- L8B0B: lda #LB433 & 255 ; ON ERROR OFF again sta $16 lda #LB433 / 256 sta $17 ldx #$FF ; OPT=$FF - not within assembler stx $28 stx $3C ; Clear machine stack txs jsr LBD3A ; Clear DATA and stacks tay lda $0B ; Point $37/8 to program line sta $37 lda $0C sta $38 sty $3B sty $0A jsr L8957 jsr L97DF ; Tokenise, jump forward if no line number bcc L8B38 jsr LBC8D ; Insert into program, jump back to immediate loop jmp L8AF3 ; Command entered at immediate prompt ; ----------------------------------- L8B38: jsr L8A97 ; Skip spaces at PtrA cmp #$C6 ; If command token, jump to execute command bcs L8BB1 bcc L8BBF ; Not command token, try variable assignment L8B41: jmp L8AF6 ; Jump back to immediate mode ; [ - enter assembler ; =================== L8B44: jmp L8504 ; Jump to assembler ; =<value> - return from FN ; ========================= ; Stack needs to contain these items, ; ret_lo, ret_hi, PtrB_hi, PtrB_lo, PtrB_off, numparams, PtrA_hi, PtrA_lo, PtrA_off, tknFN L8B47: tsx ; If stack is empty, jump to give error cpx #$FC bcs L8B59 lda $01FF ; If pushed token<>'FN', give error cmp #tknFN bne L8B59 jsr L9B1D ; Evaluate expression jmp L984C ; Check for end of statement and return to pop from function L8B59: brk .byte $07,"No ",tknFN brk ; Check for =, *, [ commands ; ========================== L8B60: ldy $0A ; Step program pointer back and fetch char dey lda ($0B),y cmp #'=' ; Jump for '=', return from FN beq L8B47 cmp #'*' ; Jump for '*', embedded *command beq L8B73 cmp #'[' ; Jump for '[', start assembler beq L8B44 bne L8B96 ; Otherwise, see if end of statement ; Embedded *command ; ================= L8B73: jsr L986D ; Update PtrA to current address ldx $0B ldy $0C jsr OS_CLI ; Pass command at ptrA to OSCLI ; DATA, DEF, REM, ELSE ; ==================== ; Skip to end of line ; ------------------- L8B7D: lda #$0D ; Get program pointer ldy $0A dey L8B82: iny ; Loop until <cr> found cmp ($0B),y bne L8B82 L8B87: cmp #tknELSE ; If 'ELSE', jump to skip to end of line beq L8B7D lda $0C ; Program in command buffer, jump back to immediate loop cmp #$0700 /256 beq L8B41 jsr L9890 ; Check for end of program, step past <cr> bne L8BA3 L8B96: dec $0A L8B98: jsr L9857 ; Main execution loop ; ------------------- L8B9B: ldy #$00 ; Get current character lda ($0B),y cmp #':' ; Not <colon>, check for ELSE bne L8B87 L8BA3: ldy $0A ; Get program pointer, increment for next time inc $0A lda ($0B),y ; Get current character cmp #$20 beq L8BA3 cmp #$CF ; Not program command, jump to try variable assignment bcc L8BBF ; Dispatch function/command ; ------------------------- L8BB1: tax ; Index into dispatch table lda L836D-$8E,x ; Get routine address from table sta $37 lda L83DF-$8E,x sta $38 jmp ($0037) ; Jump to routine ; Not a command byte, try variable assignment, or =, *, [ ; ------------------------------------------------------- L8BBF: ldx $0B ; Copy PtrA to PtrB stx $19 ldx $0C stx $1A sty $1B ; Check if variable or indirection jsr L95DD bne L8BE9 ; NE - jump for existing variable or indirection assignment bcs L8B60 ; CS - not variable assignment, try =, *, [ commands ; Variable not found, create a new one ; ------------------------------------ stx $1B ; Check for and step past '=' jsr L9841 jsr L94FC ; Create new variable ldx #$05 ; X=&05 = float cpx $2C ; Jump if dest. not a float bne L8BDF inx ; X=&06 L8BDF: jsr L9531 dec $0A ; LET variable = expression ; ========================= L8BE4: jsr L9582 beq L8C0B L8BE9: bcc L8BFB jsr LBD94 ; Stack integer (address of data) jsr L9813 ; Check for end of statement lda $27 ; Get evaluation type bne L8C0E ; If not string, error jsr L8C1E ; Assign the string jmp L8B9B ; Return to execution loop L8BFB: jsr LBD94 ; Stack integer (address of data) jsr L9813 ; Check for end of statement lda $27 ; Get evaluation type beq L8C0E ; If not number, error jsr LB4B4 ; Assign the number jmp L8B9B ; Return to execution loop L8C0B: jmp L982A L8C0E: brk .byte $06, "Type mismatch" brk L8C1E: jsr LBDEA ; Unstack integer (address of data) L8C21: lda $2C cmp #$80 ; Jump if absolute string $addr beq L8CA2 ldy #$02 lda ($2A),y cmp $36 bcs L8C84 lda $02 sta $2C lda $03 sta $2D lda $36 cmp #$08 bcc L8C43 adc #$07 bcc L8C43 lda #$FF L8C43: clc pha tax lda ($2A),y ldy #$00 adc ($2A),y eor $02 bne L8C5F iny adc ($2A),y eor $03 bne L8C5F sta $2D txa iny sec sbc ($2A),y tax L8C5F: txa clc adc $02 tay lda $03 adc #$00 cpy $04 tax sbc $05 bcs L8CB7 sty $02 stx $03 pla ldy #$02 sta ($2A),y dey lda $2D beq L8C84 sta ($2A),y dey lda $2C sta ($2A),y L8C84: ldy #$03 lda $36 sta ($2A),y beq L8CA1 dey dey lda ($2A),y sta $2D dey lda ($2A),y sta $2C L8C97: lda $0600,y sta ($2C),y iny cpy $36 bne L8C97 L8CA1: rts L8CA2: jsr LBEBA cpy #$00 beq L8CB4 L8CA9: lda $0600,y sta ($2A),y dey bne L8CA9 lda $0600 L8CB4: sta ($2A),y rts L8CB7: brk .byte $00, "No room" brk L8CC1: lda $39 cmp #$80 beq L8CEE bcc L8D03 ldy #$00 lda ($04),y tax beq L8CE5 lda ($37),y sbc #$01 sta $39 iny lda ($37),y sbc #$00 sta $3A L8CDD: lda ($04),y sta ($39),y iny dex bne L8CDD L8CE5: lda ($04,x) ldy #$03 L8CE9: sta ($37),y jmp LBDDC L8CEE: ldy #$00 lda ($04),y tax beq L8CFF L8CF5: iny lda ($04),y dey sta ($37),y iny dex bne L8CF5 L8CFF: lda #$0D bne L8CE9 L8D03: ldy #$00 lda ($04),y sta ($37),y iny cpy $39 bcs L8D26 lda ($04),y sta ($37),y iny lda ($04),y sta ($37),y iny lda ($04),y sta ($37),y iny cpy $39 bcs L8D26 lda ($04),y sta ($37),y iny L8D26: tya clc jmp LBDE1 L8D2B: dec $0A jsr LBFA9 L8D30: tya pha jsr L8A8C cmp #$2C bne L8D77 jsr L9B29 jsr LA385 pla tay lda $27 jsr OSBPUT tax beq L8D64 bmi L8D57 ldx #$03 L8D4D: lda $2A,x jsr OSBPUT dex bpl L8D4D bmi L8D30 L8D57: ldx #$04 L8D59: lda $046C,x jsr OSBPUT dex bpl L8D59 bmi L8D30 L8D64: lda $36 jsr OSBPUT tax beq L8D30 L8D6C: lda $05FF,x jsr OSBPUT dex bne L8D6C beq L8D30 L8D77: pla sty $0A jmp L8B98 ; End of PRINT statement ; ---------------------- L8D7D: jsr LBC25 ; Output new line and set COUNT to zero L8D80: jmp L8B96 ; Check end of statement, return to execution loop L8D83: lda #$00 ; Set current field to zero, hex/dec flag to decimal sta $14 sta $15 jsr L8A97 ; Get next non-space character cmp #':' ; <colon> found, finish printing beq L8D80 cmp #$0D ; <cr> found, finish printing beq L8D80 cmp #tknELSE ; 'ELSE' found, finish printing beq L8D80 bne L8DD2 ; Otherwise, continue into main loop ; PRINT [~][print items]['][,][;] ; =============================== L8D9A: jsr L8A97 ; Get next non-space char cmp #'#' ; If '#' jump to do PRINT# beq L8D2B dec $0A ; Jump into PRINT loop jmp L8DBB ; Print a comma ; ------------- L8DA6: lda $0400 ; If field width zero, no padding needed, jump back into main loop beq L8DBB lda $1E ; Get COUNT L8DAD: beq L8DBB ; Zero, just started a new line, no padding, jump back into main loop sbc $0400 ; Get COUNT-field width bcs L8DAD ; Loop to reduce until (COUNT MOD fieldwidth)<0 tay ; Y=number of spaces to get back to (COUNT MOD width)=zero L8DB5: jsr LB565 ; Loop to print required spaces iny bne L8DB5 L8DBB: clc ; Prepare to print decimal lda $0400 ; Set current field width from @% sta $14 L8DC1: ror $15 ; Set hex/dec flag from Carry L8DC3: jsr L8A97 ; Get next non-space character cmp #':' ; End of statement if <colon> found beq L8D7D cmp #$0D ; End if statement if <cr> found beq L8D7D cmp #tknELSE ; End of statement if 'ELSE' found beq L8D7D L8DD2: cmp #'~' ; Jump back to set hex/dec flag from Carry beq L8DC1 cmp #',' ; Jump to pad to next print field beq L8DA6 cmp #';' ; Jump to check for end of print statement beq L8D83 jsr L8E70 ; Check for ' TAB SPC, if print token found return to outer main loop bcc L8DC3 ; All print formatting have been checked, so it now must be an expression ; ----------------------------------------------------------------------- lda $14 ; Save field width and flags, as evaluator pha ; may call PRINT (eg FN, STR$, etc.) lda $15 pha dec $1B ; Evaluate expression jsr L9B29 pla ; Restore field width and flags sta $15 pla sta $14 lda $1B ; Update program pointer sta $0A tya ; If type=0, jump to print string beq L8E0E jsr L9EDF ; Convert numeric value to string lda $14 ; Get current field width sec ; A=width-stringlength sbc $36 bcc L8E0E ; length>width - print it beq L8E0E ; length=width - print it tay L8E08: jsr LB565 ; Loop to print required spaces to pad the number dey bne L8E08 ; Print string in string buffer ; ----------------------------- L8E0E: lda $36 ; Null string, jump back to main loop beq L8DC3 ldy #$00 ; Point to start of string L8E14: lda $0600,y ; Print character from string buffer jsr LB558 iny ; Increment pointer, loop for full string cpy $36 bne L8E14 beq L8DC3 ; Jump back for next print item L8E21: jmp L8AA2 L8E24: cmp #',' ; No comma, jump to TAB(x) bne L8E21 lda $2A ; Save X pha jsr LAE56 jsr L92F0 ; BBC - send VDU 31,x,y sequence ; ------------------------------ lda #$1F ; TAB() jsr OSWRCH pla ; X coord jsr OSWRCH jsr L9456 ; Y coord jmp L8E6A ; Continue to next PRINT item L8E40: jsr L92DD jsr L8A8C cmp #')' bne L8E24 lda $2A sbc $1E beq L8E6A tay bcs L8E5F jsr LBC25 beq L8E5B L8E58: jsr L92E3 L8E5B: ldy $2A beq L8E6A L8E5F: jsr LB565 dey bne L8E5F beq L8E6A L8E67: jsr LBC25 L8E6A: clc ldy $1B sty $0A rts L8E70: ldx $0B stx $19 ldx $0C stx $1A ldx $0A stx $1B cmp #$27 beq L8E67 cmp #$8A beq L8E40 cmp #$89 beq L8E58 sec L8E89: rts L8E8A: jsr L8A97 ; Skip spaces jsr L8E70 bcc L8E89 cmp #$22 beq L8EA7 sec rts L8E98: brk .byte $09, "Missing ", '"' brk L8EA4: jsr LB558 L8EA7: iny lda ($19),y cmp #$0D beq L8E98 cmp #$22 bne L8EA4 iny sty $1B lda ($19),y cmp #$22 bne L8E6A beq L8EA4 ; CLG ; === L8EBD: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr L9857 ; Check end of statement lda #$10 ; Jump to do VDU 16 bne L8ECC .endif ; CLS ; === L8EC4: jsr L9857 ; Check end of statement jsr LBC28 ; Set COUNT to zero lda #$0C ; Do VDU 12 L8ECC: jsr OSWRCH ; Send A to OSWRCH, jump to execution loop jmp L8B9B ; CALL numeric [,items ... ] ; ========================== L8ED2: jsr L9B1D jsr L92EE jsr LBD94 ldy #$00 sty $0600 L8EE0: sty $06FF jsr L8A8C cmp #$2C bne L8F0C ldy $1B jsr L95D5 beq L8F1B ldy $06FF iny lda $2A sta $0600,y iny lda $2B sta $0600,y iny lda $2C sta $0600,y inc $0600 jmp L8EE0 L8F0C: dec $1B jsr L9852 jsr LBDEA jsr L8F1E cld jmp L8B9B L8F1B: jmp LAE43 ;Call code ;--------- L8F1E: lda $040C ; Get Carry from C%, A from A% lsr a lda $0404 ldx $0460 ; Get X from X%, Y from Y% ldy $0464 jmp ($002A) ; Jump to address in IntA L8F2E: jmp L982A ; DELETE linenum, linenum ; ======================= L8F31: jsr L97DF bcc L8F2E jsr LBD94 jsr L8A97 cmp #$2C bne L8F2E jsr L97DF bcc L8F2E jsr L9857 lda $2A sta $39 lda $2B sta $3A jsr LBDEA L8F53: jsr LBC2D jsr L987B jsr L9222 lda $39 cmp $2A lda $3A sbc $2B bcs L8F53 jmp L8AF3 L8F69: lda #$0A jsr LAED8 jsr L97DF jsr LBD94 lda #$0A jsr LAED8 jsr L8A97 cmp #$2C bne L8F8D jsr L97DF lda $2B bne L8FDF lda $2A beq L8FDF inc $0A L8F8D: dec $0A jmp L9857 L8F92: lda $12 sta $3B lda $13 sta $3C L8F9A: lda $18 sta $38 lda #$01 sta $37 rts ; RENUMBER [linenume [,linenum]] ; ============================== L8FA3: jsr L8F69 ldx #$39 jsr LBE0D jsr LBE6F jsr L8F92 L8FB1: ldy #$00 lda ($37),y ; Line.hi>&7F, end of program bmi L8FE7 sta ($3B),y iny lda ($37),y sta ($3B),y sec tya adc $3B sta $3B tax lda $3C adc #$00 sta $3C cpx $06 sbc $07 bcs L8FD6 jsr L909F bcc L8FB1 L8FD6: brk .byte $00, tknRENUMBER .byte " space" ; Terminated by following BRK L8FDF: brk .byte $00, "Silly" brk L8FE7: jsr L8F9A L8FEA: ldy #$00 lda ($37),y bmi L900D lda $3A sta ($37),y lda $39 iny sta ($37),y clc lda $2A adc $39 sta $39 lda #$00 adc $3A and #$7F sta $3A jsr L909F bcc L8FEA L900D: lda $18 sta $0C ldy #$00 sty $0B iny lda ($0B),y bmi L903A L901A: ldy #$04 L901C: lda ($0B),y cmp #$8D beq L903D iny cmp #$0D bne L901C lda ($0B),y bmi L903A ldy #$03 lda ($0B),y clc adc $0B sta $0B bcc L901A inc $0C bcs L901A L903A: jmp L8AF3 L903D: jsr L97EB jsr L8F92 L9043: ldy #$00 lda ($37),y bmi L9080 lda ($3B),y iny cmp $2B bne L9071 lda ($3B),y cmp $2A bne L9071 lda ($37),y sta $3D dey lda ($37),y sta $3E ldy $0A dey lda $0B sta $37 lda $0C sta $38 jsr L88F5 L906D: ldy $0A bne L901C L9071: jsr L909F lda $3B adc #$02 sta $3B bcc L9043 inc $3C bcs L9043 L9080: L9082: jsr LBFCF ; Print inline text .byte "Failed at " iny lda ($0B),y sta $2B iny lda ($0B),y sta $2A jsr L991F ; Print in decimal jsr LBC25 ; Print newline beq L906D L909F: iny lda ($37),y adc $37 sta $37 bcc L90AB inc $38 clc L90AB: rts ; AUTO [numeric [, numeric ]] ; =========================== L90AC: jsr L8F69 lda $2A pha jsr LBDEA L90B5: jsr LBD94 jsr L9923 lda #$20 jsr LBC02 jsr LBDEA jsr L8951 jsr LBC8D jsr LBD20 pla pha clc adc $2A sta $2A bcc L90B5 inc $2B bpl L90B5 L90D9: jmp L8AF3 L90DC: jmp L9218 L90DF: dec $0A jsr L9582 beq L9127 bcs L9127 jsr LBD94 jsr L92DD jsr L9222 lda $2D ora $2C bne L9127 clc lda $2A adc $02 tay lda $2B adc $03 tax cpy $04 sbc $05 bcs L90DC lda $02 sta $2A lda $03 sta $2B sty $02 stx $03 lda #$00 sta $2C sta $2D lda #$40 sta $27 jsr LB4B4 jsr L8827 jmp L920B L9127: brk .byte 10, "Bad ", tknDIM brk ; DIM numvar [numeric] [(arraydef)] ; ================================= L912F: jsr L8A97 tya clc adc $0B ldx $0C bcc L913C inx clc L913C: sbc #$00 sta $37 txa sbc #$00 sta $38 ldx #$05 stx $3F ldx $0A jsr L9559 cpy #$01 beq L9127 cmp #'(' beq L916B cmp #$24 beq L915E cmp #$25 bne L9168 L915E: dec $3F iny inx lda ($37),y cmp #'(' beq L916B L9168: jmp L90DF L916B: sty $39 stx $0A jsr L9469 bne L9127 jsr L94FC ldx #$01 jsr L9531 lda $3F pha lda #$01 pha jsr LAED8 L9185: jsr LBD94 jsr L8821 lda $2B and #$C0 ora $2C ora $2D bne L9127 jsr L9222 pla tay lda $2A sta ($02),y iny lda $2B sta ($02),y iny tya pha jsr L9231 jsr L8A97 cmp #$2C beq L9185 cmp #')' beq L91B7 jmp L9127 L91B7: pla sta $15 pla sta $3F lda #$00 sta $40 jsr L9236 ldy #$00 lda $15 sta ($02),y adc $2A sta $2A bcc L91D2 inc $2B L91D2: lda $03 sta $38 lda $02 sta $37 clc adc $2A tay lda $2B adc $03 bcs L9218 tax cpy $04 sbc $05 bcs L9218 sty $02 stx $03 lda $37 adc $15 tay lda #$00 sta $37 bcc L91FC inc $38 L91FC: sta ($37),y iny bne L9203 inc $38 L9203: cpy $02 bne L91FC cpx $38 bne L91FC L920B: jsr L8A97 cmp #$2C beq L9215 jmp L8B96 L9215: jmp L912F L9218: brk .byte 11, tknDIM, " space" brk L9222: inc $2A bne L9230 inc $2B bne L9230 inc $2C bne L9230 inc $2D L9230: rts L9231: ldx #$3F jsr LBE0D L9236: ldx #$00 ldy #$00 L923A: lsr $40 ror $3F bcc L924B clc tya adc $2A tay txa adc $2B tax bcs L925A L924B: asl $2A rol $2B lda $3F ora $40 bne L923A sty $2A stx $2B rts L925A: jmp L9127 ; HIMEM=numeric ; ============= L925D: jsr L92EB ; Set past '=', evaluate integer lda $2A ; Set HIMEM and STACK sta $06 sta $04 lda $2B sta $07 sta $05 jmp L8B9B ; Jump back to execution loop ; LOMEM=numeric ; ============= L926F: jsr L92EB ; Step past '=', evaluate integer lda $2A ; Set LOMEM and VAREND sta $00 sta $02 lda $2B sta $01 sta $03 jsr LBD2F ; Clear dynamic variables, jump to execution loop beq L928A ; PAGE=numeric ; ============ L9283: jsr L92EB ; Step past '=', evaluate integer lda $2B ; Set PAGE sta $18 L928A: jmp L8B9B ; Jump to execution loop ; CLEAR ; ===== L928D: jsr L9857 ; Check end of statement jsr LBD20 ; Clear heap, stack, data, variables beq L928A ; Jump to execution loop ; TRACE ON | OFF | numeric ; ======================== L9295: jsr L97DF ; If line number, jump for TRACE linenum bcs L92A5 cmp #$EE ; Jump for TRACE ON beq L92B7 cmp #$87 ; Jump for TRACE OFF beq L92C0 jsr L8821 ; Evaluate integer ; TRACE numeric ; ------------- L92A5: jsr L9857 ; Check end of statement lda $2A ; Set trace limit low byte sta $21 lda $2B L92AE: sta $22 ; Set trace limit high byte, set TRACE ON lda #$FF L92B2: sta $20 ; Set TRACE flag, return to execution loop jmp L8B9B ; TRACE ON ; -------- L92B7: inc $0A ; Step past, check end of statement jsr L9857 lda #$FF ; Jump to set TRACE &FFxx bne L92AE ; TRACE OFF ; --------- L92C0: inc $0A ; Step past, check end of statement jsr L9857 lda #$00 ; Jump to set TRACE OFF beq L92B2 ; TIME=numeric ; ============ L92C9: jsr L92EB ; Step past '=', evaluate integer ldx #$2A ; Point to integer, set 5th byte to 0 ldy #$00 sty $2E lda #$02 ; Call OSWORD &02 to do TIME= jsr OSWORD jmp L8B9B ; Evaluate <comma><numeric> ; ========================= L92DA: jsr L8AAE ; Check for and step past comma L92DD: jsr L9B29 jmp L92F0 L92E3: jsr LADEC beq L92F7 bmi L92F4 L92EA: rts ; Evaluate <equals><integer> ; ========================== L92EB: jsr L9807 ; Check for equals, evaluate numeric L92EE: lda $27 ; Get result type L92F0: beq L92F7 ; String, jump to 'Type mismatch' bpl L92EA ; Integer, return L92F4: jmp LA3E4 ; Real, jump to convert to integer L92F7: jmp L8C0E ; Jump to 'Type mismatch' error ; Evaluate <real> ; =============== L92FA: jsr LADEC ; Evaluate expression ; Ensure value is real ; -------------------- L92FD: beq L92F7 ; String, jump to 'Type mismatch' bmi L92EA ; Real, return jmp LA2BE ; Integer, jump to convert to real ; PROCname [(parameters)] ; ======================= L9304: lda $0B ; PtrB=PtrA=>after 'PROC' token sta $19 lda $0C sta $1A lda $0A sta $1B lda #$F2 ; Call PROC/FN dispatcher jsr LB197 ; Will return here after ENDPROC jsr L9852 ; Check for end of statement jmp L8B9B ; Return to execution loop ; Make string zero length ; ----------------------- L931B: ldy #$03 ; Set length to zero lda #$00 sta ($2A),y ; Jump to look for next LOCAL item beq L9341 ; LOCAL variable [,variable ...] ; ============================== L9323: tsx ; Not inside subroutine, error cpx #$FC bcs L936B jsr L9582 ; Find variable, jump if bad variable name beq L9353 jsr LB30D ; Push value on stack, push variable info on stack ldy $2C ; If a string, jump to make zero length bmi L931B jsr LBD94 lda #$00 ; Set IntA to zero jsr LAED8 sta $27 ; Set current variable to IntA (zero) jsr LB4B4 ; Next LOCAL item ; --------------- L9341: tsx ; Increment number of LOCAL items inc $0106,x ldy $1B ; Update line pointer sty $0A jsr L8A97 ; Get next character cmp #$2C ; Comma, loop back to do another item beq L9323 jmp L8B96 ; Jump to main execution loop L9353: jmp L8B98 ; ENDPROC ; ======= ; Stack needs to contain these items, ; ret_lo, ret_hi, PtrB_hi, PtrB_lo, PtrB_off, numparams, PtrA_hi, PtrA_lo, PtrA_off, tknPROC L9356: tsx ; If stack empty, jump to give error cpx #$FC bcs L9365 lda $01FF ; If pushed token<>'PROC', give error cmp #$F2 bne L9365 jmp L9857 ; Check for end of statement and return to pop from subroutine L9365: brk .byte 13, "No ", tknPROC ; Terminated by following BRK L936B: brk .byte 12, "Not ", tknLOCAL ; Terminated by following BRK L9372: brk .byte $19, "Bad ", tknMODE brk ; GCOL numeric, numeric ; ===================== L937A: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr L8821 ; Evaluate integer lda $2A pha jsr L92DA ; Step past comma, evaluate integer jsr L9852 ; Update program pointer, check for end of statement lda #$12 ; Send VDU 18 for GCOL jsr OSWRCH jmp L93DA ; Jump to send two bytes to OSWRCH .endif ; COLOUR numeric ; ============== L938E: .if .defined (PSBC) jmp L9821 ; Syntax error .else lda #$11 ; Stack VDU 17 for COLOUR pha jsr L8821 ; Evaluate integer, check end of statement jsr L9857 jmp L93DA ; Jump to send two bytes to OSWRCH .endif ; MODE numeric ; ============ L939A: lda #$16 ; Stack VDU 22 for MODE pha jsr L8821 ; Evaluate integer, check end of statement jsr L9857 ; BBC - Check if changing MODE will move screen into stack ; -------------------------------------------------------- jsr LBEE7 ; Get machine address high word cpx #$FF ; Not &xxFFxxxx, skip memory test bne L93D7 cpy #$FF ; Not &FFFFxxxx, skip memory test bne L93D7 ; MODE change in I/O processor, must check memory limits lda $04 ; STACK<>HIMEM, stack not empty, give 'Bad MODE' error cmp $06 bne L9372 lda $05 cmp $07 bne L9372 ldx $2A ; Get top of memory if we used this MODE lda #$85 jsr OSBYTE cpx $02 ; Would be below VAREND, give error tya sbc $03 bcc L9372 cpx $12 ; Would be below TOP, give error tya sbc $13 bcc L9372 ; BASIC stack is empty, screen would not hit heap or program stx $06 ; Set STACK and HIMEM to new address stx $04 sty $07 sty $05 ; Change MODE L93D7: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr LBC28 ; Set COUNT to zero ; Send two bytes to OSWRCH, stacked byte, then IntA ; ------------------------------------------------- L93DA: pla ; Send stacked byte to OSWRCH jsr OSWRCH jsr L9456 ; Send IntA to OSWRCH, jump to execution loop jmp L8B9B .endif ; MOVE numeric, numeric ; ===================== L93E4: .if .defined (PSBC) jmp L9821 ; Syntax error .else lda #$04 ; Jump forward to do PLOT 4 for MOVE bne L93EA .endif ; DRAW numeric, numeric ; ===================== L93E8: .if .defined (PSBC) jmp L9821 ; Syntax error .else lda #$05 ; Do PLOT 5 for DRAW L93EA: pha ; Evaluate first expression jsr L9B1D jmp L93FD ; Jump to evaluate second expression and send to OSWRCH .endif ; PLOT numeric, numeric, numeric ; ============================== L93F1: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr L8821 ; Evaluate integer lda $2A pha jsr L8AAE ; Step past comma, evaluate expression jsr L9B29 L93FD: jsr L92EE ; Confirm numeric and ensure is integer jsr LBD94 ; Stack integer jsr L92DA ; Step past command and evaluate integer jsr L9852 ; Update program pointer, check for end of statement lda #$19 ; Send VDU 25 for PLOT jsr OSWRCH pla ; Send PLOT action jsr OSWRCH jsr LBE0B ; Pop integer to temporary store at &37/8 lda $37 ; Send first coordinate to OSWRCH jsr OSWRCH lda $38 jsr OSWRCH jsr L9456 ; Send IntA to OSWRCH, second coordinate lda $2B ; Send IntA high byte to OSWRCH jsr OSWRCH jmp L8B9B ; Jump to execution loop .endif L942A: lda $2B ; Send IntA byte 2 to OSWRCH jsr OSWRCH ; VDU num[,][;][...] ; ================== L942F: jsr L8A97 ; Get next character L9432: cmp #$3A ; If end of statement, jump to exit beq L9453 cmp #$0D beq L9453 cmp #$8B beq L9453 dec $0A ; Step back to current character jsr L8821 ; Evaluate integer and output low byte jsr L9456 jsr L8A97 ; Get next character cmp #',' ; Comma, loop to read another number beq L942F cmp #';' ; Not semicolon, loop to check for end of statement bne L9432 beq L942A ; Loop to output high byte and read another L9453: jmp L8B96 ; Jump to execution loop ; Send IntA to OSWRCH via WRCHV ; ============================= L9456: lda $2A jmp (WRCHV) ; VARIABLE PROCESSING ; =================== ; Look for a FN/PROC in heap ; -------------------------- ; On entry, (&37)+1=>FN/PROC token (ie, first character of name) ; L945B: ldy #$01 ; Get PROC/FN character lda ($37),y ldy #$F6 ; Get PROC/FN character cmp #tknPROC ; If PROC, jump to scan list beq L946F ldy #$F8 ; Point to FN list start and scan list bne L946F ; Look for a variable in the heap ; ------------------------------- ; On entry, (&37)+1=>first character of name ; L9469: ldy #$01 ; Get first character of variable lda ($37),y asl a ; Double it to index into index list tay ; Scan though linked lists in heap ; -------------------------------- L946F: lda $0400,y ; Get start of linked list sta $3A lda $0401,y sta $3B L9479: lda $3B ; End of list beq L94B2 ldy #$00 lda ($3A),y sta $3C iny lda ($3A),y sta $3D iny ; Jump if not null name lda ($3A),y bne L949A dey cpy $39 bne L94B3 iny bcs L94A7 L9495: iny lda ($3A),y beq L94B3 L949A: cmp ($37),y bne L94B3 cpy $39 bne L9495 iny lda ($3A),y bne L94B3 L94A7: tya adc $3A sta $2A lda $3B adc #$00 sta $2B L94B2: rts L94B3: lda $3D beq L94B2 ldy #$00 lda ($3C),y sta $3A iny lda ($3C),y sta $3B iny lda ($3C),y bne L94D4 dey cpy $39 bne L9479 iny bcs L94E1 L94CF: iny lda ($3C),y beq L9479 L94D4: cmp ($37),y bne L9479 cpy $39 bne L94CF iny lda ($3C),y bne L9479 L94E1: tya adc $3C sta $2A lda $3D adc #$00 sta $2B rts L94ED: ldy #$01 lda ($37),y tax lda #$F6 cpx #$F2 beq L9501 lda #$F8 bne L9501 L94FC: ldy #$01 lda ($37),y asl a L9501: sta $3A lda #$04 sta $3B L9507: lda ($3A),y beq L9516 tax dey lda ($3A),y sta $3A stx $3B iny bpl L9507 L9516: lda $03 sta ($3A),y lda $02 dey sta ($3A),y tya iny sta ($02),y cpy $39 beq L9558 L9527: iny lda ($37),y sta ($02),y cpy $39 bne L9527 rts L9531: lda #$00 L9533: iny sta ($02),y dex bne L9533 L9539: sec tya adc $02 bcc L9541 inc $03 L9541: ldy $03 cpy $05 bcc L9556 bne L954D cmp $04 bcc L9556 L954D: lda #$00 ldy #$01 sta ($3A),y jmp L8CB7 L9556: sta $02 L9558: rts ; Check if variable name is valid ; =============================== L9559: ldy #$01 L955B: lda ($37),y cmp #$30 bcc L9579 cmp #$40 bcs L9571 cmp #$3A bcs L9579 cpy #$01 beq L9579 L956D: inx iny bne L955B L9571: cmp #$5F bcs L957A cmp #$5B bcc L956D L9579: rts L957A: cmp #$7B bcc L956D rts L957F: jsr L9531 L9582: jsr L95C9 bne L95A4 bcs L95A4 jsr L94FC ldx #$05 cpx $2C bne L957F inx bne L957F L9595: cmp #$21 beq L95A5 cmp #$24 beq L95B0 eor #$3F beq L95A7 lda #$00 sec L95A4: rts L95A5: lda #$04 L95A7: pha inc $1B jsr L92E3 jmp L969F L95B0: inc $1B jsr L92E3 lda $2B beq L95BF lda #$80 sta $2C sec rts L95BF: brk .byte 8, "$ range" brk L95C9: lda $0B sta $19 lda $0C sta $1A ldy $0A dey L95D4: iny L95D5: sty $1B lda ($19),y cmp #$20 beq L95D4 L95DD: cmp #$40 bcc L9595 cmp #$5B bcs L95FF asl a asl a sta $2A lda #$04 sta $2B iny lda ($19),y iny cmp #$25 bne L95FF ldx #$04 stx $2C lda ($19),y cmp #'(' bne L9665 L95FF: ldx #$05 stx $2C lda $1B clc adc $19 ldx $1A bcc L960E inx clc L960E: sbc #$00 sta $37 bcs L9615 dex L9615: stx $38 ldx $1B ldy #$01 L961B: lda ($37),y cmp #$41 bcs L962D cmp #$30 bcc L9641 cmp #$3A bcs L9641 inx iny bne L961B L962D: cmp #$5B bcs L9635 inx iny bne L961B L9635: cmp #$5F bcc L9641 cmp #$7B bcs L9641 inx iny bne L961B L9641: dey beq L9673 cmp #$24 beq L96AF cmp #$25 bne L9654 dec $2C iny inx iny lda ($37),y dey L9654: sty $39 cmp #'(' beq L96A6 jsr L9469 beq L9677 stx $1B L9661: ldy $1B lda ($19),y L9665: cmp #$21 beq L967F cmp #$3F beq L967B clc sty $1B lda #$FF rts L9673: lda #$00 sec rts L9677: lda #$00 clc rts L967B: lda #$00 beq L9681 L967F: lda #$04 L9681: pha iny sty $1B jsr LB32C jsr L92F0 lda $2B pha lda $2A pha jsr L92E3 clc pla adc $2A sta $2A pla adc $2B sta $2B L969F: pla sta $2C clc lda #$FF rts L96A6: inx inc $39 jsr L96DF jmp L9661 L96AF: inx iny sty $39 iny dec $2C lda ($37),y cmp #'(' beq L96C9 jsr L9469 beq L9677 stx $1B lda #$81 sta $2C sec rts L96C9: inx sty $39 dec $2C jsr L96DF lda #$81 sta $2C sec rts L96D7: brk .byte 14, "Array" brk L96DF: jsr L9469 beq L96D7 stx $1B lda $2C pha lda $2A pha lda $2B pha ldy #$00 lda ($2A),y cmp #$04 bcc L976C tya jsr LAED8 lda #$01 sta $2D L96FF: jsr LBD94 jsr L92DD inc $1B cpx #$2C bne L96D7 ldx #$39 jsr LBE0D ldy $3C pla sta $38 pla sta $37 pha lda $38 pha jsr L97BA sty $2D lda ($37),y sta $3F iny lda ($37),y sta $40 lda $2A adc $39 sta $2A lda $2B adc $3A sta $2B jsr L9236 ldy #$00 sec lda ($37),y sbc $2D cmp #$03 bcs L96FF jsr LBD94 jsr LAE56 jsr L92F0 pla sta $38 pla sta $37 ldx #$39 jsr LBE0D ldy $3C jsr L97BA clc lda $39 adc $2A sta $2A lda $3A adc $2B sta $2B bcc L977D L976C: jsr LAE56 jsr L92F0 pla sta $38 pla sta $37 ldy #$01 jsr L97BA L977D: pla sta $2C cmp #$05 bne L979B ldx $2B lda $2A asl $2A rol $2B asl $2A rol $2B adc $2A sta $2A txa adc $2B sta $2B bcc L97A3 L979B: asl $2A rol $2B asl $2A rol $2B L97A3: tya adc $2A sta $2A bcc L97AD inc $2B clc L97AD: lda $37 adc $2A sta $2A lda $38 adc $2B sta $2B rts L97BA: lda $2B and #$C0 ora $2C ora $2D bne L97D1 lda $2A cmp ($37),y iny lda $2B sbc ($37),y bcs L97D1 iny rts L97D1: brk .byte 15, "Subscript" brk L97DD: inc $0A L97DF: ldy $0A lda ($0B),y cmp #$20 beq L97DD cmp #$8D bne L9805 L97EB: iny lda ($0B),y asl a asl a tax and #$C0 iny eor ($0B),y sta $2A txa asl a asl a iny eor ($0B),y sta $2B iny sty $0A sec rts L9805: clc rts L9807: lda $0B sta $19 lda $0C sta $1A lda $0A sta $1B L9813: ldy $1B inc $1B lda ($19),y cmp #$20 beq L9813 cmp #$3D beq L9849 L9821: brk .byte 4, "Mistake" L982A: brk .byte 16, "Syntax error" ; Escape error ; ------------ L9838: brk .byte 17, "Escape" brk L9841: jsr L8A8C cmp #'=' bne L9821 rts L9849: jsr L9B29 L984C: txa ldy $1B jmp L9861 L9852: ldy $1B jmp L9859 ; Check for end of statement, check for Escape ; ============================================ L9857: ldy $0A ; Get program pointer offset L9859: dey ; Step back to previous character L985A: iny ; Get next character lda ($0B),y cmp #' ' ; Skip spaces beq L985A L9861: cmp #':' ; Colon, jump to update program pointer beq L986D cmp #$0D ; <cr>, jump to update program pointer beq L986D cmp #tknELSE ; Not 'ELSE', jump to 'Syntax error' bne L982A ; Update program pointer ; ---------------------- L986D: clc ; Update program pointer in PtrA tya adc $0B sta $0B bcc L9877 inc $0C L9877: ldy #$01 sty $0A ; Check background Escape state ; ----------------------------- L987B: ; BBC - check background Escape state ; ----------------------------------- bit ESCFLG ; If Escape set, jump to give error bmi L9838 L987F: rts L9880: jsr L9857 dey lda ($0B),y cmp #$3A beq L987F lda $0C cmp #$07 beq L98BC L9890: iny lda ($0B),y bmi L98BC lda $20 beq L98AC tya pha iny lda ($0B),y pha dey lda ($0B),y tay pla jsr LAEEA jsr L9905 pla tay L98AC: iny sec tya adc $0B sta $0B bcc L98B7 inc $0C L98B7: ldy #$01 sty $0A L98BB: rts L98BC: jmp L8AF6 L98BF: jmp L8C0E ; IF numeric ; ========== L98C2: jsr L9B1D beq L98BF bpl L98CC jsr LA3E4 L98CC: ldy $1B sty $0A lda $2A ora $2B ora $2C ora $2D beq L98F1 cpx #$8C beq L98E1 L98DE: jmp L8BA3 L98E1: inc $0A L98E3: jsr L97DF bcc L98DE jsr LB9AF jsr L9877 jmp LB8D2 L98F1: ldy $0A L98F3: lda ($0B),y cmp #$0D beq L9902 iny cmp #$8B bne L98F3 sty $0A beq L98E3 L9902: jmp L8B87 L9905: lda $2A cmp $21 lda $2B sbc $22 bcs L98BB lda #$5B L9911: jsr LB558 jsr L991F lda #$5D jsr LB558 jmp LB565 ;Print 16-bit decimal number ;=========================== L991F: lda #$00 ; No padding beq L9925 L9923: lda #$05 ; Pad to five characters L9925: sta $14 ldx #$04 L9929: lda #$00 sta $3F,x sec L992E: lda $2A sbc L996B,x ; Subtract 10s low byte tay lda $2B sbc L99B9,x ; Subtract 10s high byte bcc L9943 ; Result<0, no more for this digit sta $2B ; Update number sty $2A inc $3F,x bne L992E L9943: dex bpl L9929 ldx #$05 L9948: dex beq L994F lda $3F,x beq L9948 L994F: stx $37 lda $14 beq L9960 sbc $37 beq L9960 tay L995A: jsr LB565 dey bne L995A L9960: lda $3F,x ora #$30 jsr LB558 dex bpl L9960 rts ; Low bytes of powers of ten L996B: .byte 1, 10, 100, $E8, $10 ; Line Search L9970: ldy #$00 sty $3D lda $18 sta $3E L9978: ldy #$01 lda ($3D),y cmp $2B bcs L998E L9980: ldy #$03 lda ($3D),y adc $3D sta $3D bcc L9978 inc $3E bcs L9978 L998E: bne L99A4 ldy #$02 lda ($3D),y cmp $2A bcc L9980 bne L99A4 tya adc $3D sta $3D bcc L99A4 inc $3E clc L99A4: ldy #$02 rts L99A7: brk .byte $12, "Division by zero" ; High byte of powers of ten L99B9: brk brk brk .byte $03 .byte $27 L99BE: tay jsr L92F0 lda $2D pha jsr LAD71 jsr L9E1D stx $27 tay jsr L92F0 pla sta $38 eor $2D sta $37 jsr LAD71 ldx #$39 jsr LBE0D sty $3D sty $3E sty $3F sty $40 lda $2D ora $2A ora $2B ora $2C beq L99A7 ldy #$20 L99F4: dey beq L9A38 asl $39 rol $3A rol $3B rol $3C bpl L99F4 L9A01: rol $39 rol $3A rol $3B rol $3C rol $3D rol $3E rol $3F rol $40 sec lda $3D sbc $2A pha lda $3E sbc $2B pha lda $3F sbc $2C tax lda $40 sbc $2D bcc L9A33 sta $40 stx $3F pla sta $3E pla sta $3D bcs L9A35 L9A33: pla pla L9A35: dey bne L9A01 L9A38: rts L9A39: stx $27 jsr LBDEA jsr LBD51 jsr LA2BE jsr LA21E jsr LBD7E jsr LA3B5 jmp L9A62 L9A50: jsr LBD51 jsr L9C42 stx $27 tay jsr L92FD jsr LBD7E L9A5F: jsr LA34E ; Compare FPA = FPB ; ----------------- L9A62: ldx $27 ldy #$00 lda $3B and #$80 sta $3B lda $2E and #$80 cmp $3B bne L9A92 lda $3D cmp $30 bne L9A93 lda $3E cmp $31 bne L9A93 lda $3F cmp $32 bne L9A93 lda $40 cmp $33 bne L9A93 lda $41 cmp $34 bne L9A93 L9A92: rts L9A93: ror a eor $3B rol a lda #$01 rts L9A9A: jmp L8C0E ; Jump to 'Type mismatch' error ; Evaluate next expression and compare with previous ; -------------------------------------------------- L9A9D: txa L9A9E: beq L9AE7 ; Jump if current is string bmi L9A50 ; Jump if current is float jsr LBD94 ; Stack integer jsr L9C42 ; Evaluate next expression tay beq L9A9A ; Error if string bmi L9A39 ; Float, jump to compare floats ; Compare IntA with top of stack ; ------------------------------ lda $2D eor #$80 sta $2D sec ldy #$00 lda ($04),y sbc $2A sta $2A iny lda ($04),y sbc $2B sta $2B iny lda ($04),y sbc $2C sta $2C iny lda ($04),y ldy #$00 eor #$80 sbc $2D ora $2A ora $2B ora $2C php ; Drop integer from stack clc lda #$04 adc $04 sta $04 bcc L9AE5 inc $05 L9AE5: plp rts ; Compare string with next expression ; ----------------------------------- L9AE7: jsr LBDB2 jsr L9C42 tay bne L9A9A stx $37 ldx $36 ldy #$00 lda ($04),y sta $39 cmp $36 bcs L9AFF tax L9AFF: stx $3A ldy #$00 L9B03: cpy $3A beq L9B11 iny lda ($04),y cmp $05FF,y beq L9B03 bne L9B15 L9B11: lda $39 cmp $36 L9B15: php jsr LBDDC ldx $37 plp rts ; EXPRESSION EVALUATOR ; ==================== ; Evaluate expression at PtrA ; --------------------------- L9B1D: lda $0B ; Copy PtrA to PtrB sta $19 lda $0C sta $1A lda $0A sta $1B ; Evaluate expression at PtrB ; --------------------------- ; TOP LEVEL EVALUATOR ; ; Evaluator Level 7 - OR, EOR ; --------------------------- L9B29: jsr L9B72 ; Call Evaluator Level 6 - AND ; Returns A=type, value in IntA/FPA/StrA, X=next char L9B2C: cpx #tknOR ; Jump if next char is OR beq L9B3A cpx #tknEOR ; Jump if next char is EOR beq L9B55 dec $1B ; Step PtrB back to last char tay sta $27 rts ; OR numeric ; ---------- L9B3A: jsr L9B6B ; Stack as integer, call Evaluator Level 6 tay jsr L92F0 ; If float, convert to integer ldy #$03 L9B43: lda ($04),y ; OR IntA with top of stack ora $002A,y sta $002A,y ; Store result in IntA dey bpl L9B43 L9B4E: jsr LBDFF ; Drop integer from stack lda #$40 bne L9B2C ; Return type=Int, jump to check for more OR/EOR ; EOR numeric ; ----------- L9B55: jsr L9B6B tay jsr L92F0 ; If float, convert to integer ldy #$03 L9B5E: lda ($04),y ; EOR IntA with top of stack eor $002A,y sta $002A,y ; Store result in IntA dey bpl L9B5E bmi L9B4E ; Jump to drop from stack and continue ; Stack current as integer, evaluate another Level 6 ; -------------------------------------------------- L9B6B: tay ; If float, convert to integer, push into stack jsr L92F0 jsr LBD94 ; Evaluator Level 6 - AND ; ----------------------- L9B72: jsr L9B9C ; Call Evaluator Level 5, < <= = >= > <> L9B75: cpx #tknAND ; Return if next char not AND beq L9B7A rts ; AND numeric ; ----------- L9B7A: tay ; If float, convert to integer, push onto stack jsr L92F0 jsr LBD94 jsr L9B9C ; Call Evaluator Level 5, < <= = >= > <> tay ; If float, convert to integer jsr L92F0 ldy #$03 L9B8A: lda ($04),y ; AND IntA with top of stack and $002A,y sta $002A,y ; Store result in IntA dey bpl L9B8A jsr LBDFF ; Drop integer from stack lda #$40 ; Return type=Int, jump to check for another AND bne L9B75 ; Evaluator Level 5 - >... =... or <... ; ------------------------------------- L9B9C: jsr L9C42 ; Call Evaluator Level 4, + - cpx #'>'+1 ; Larger than '>', return bcs L9BA7 cpx #'<' ; Smaller than '<', return bcs L9BA8 L9BA7: rts ; >... =... or <... ; ----------------- L9BA8: beq L9BC0 ; Jump with '<' cpx #'>' ; Jump with '>' beq L9BE8 ; Must be '=' ; = numeric ; --------- tax ; Jump with result=0 for not equal jsr L9A9E bne L9BB5 L9BB4: dey ; Decrement to &FF for equal L9BB5: sty $2A ; Store 0/-1 in IntA sty $2B sty $2C sty $2D ; Return type=Int lda #$40 rts ; < <= <> ; ------- L9BC0: tax ; Get next char from PtrB ldy $1B lda ($19),y cmp #'=' ; Jump for <= beq L9BD4 cmp #'>' ; Jump for <> beq L9BDF ; Must be < numeric ; ----------------- jsr L9A9D ; Evaluate next and compare bcc L9BB4 ; Jump to return TRUE if <, FALSE if not < bcs L9BB5 ; <= numeric ; ---------- L9BD4: inc $1B ; Step past '=', evaluate next and compare jsr L9A9D beq L9BB4 ; Jump to return TRUE if =, TRUE if < bcc L9BB4 bcs L9BB5 ; Jump to return FALSE otherwise ; <> numeric ; ---------- L9BDF: inc $1B ; Step past '>', evaluate next and compare jsr L9A9D bne L9BB4 ; Jump to return TRUE if <>, FALSE if = beq L9BB5 ; > >= ; ---- L9BE8: tax ; Get next char from PtrB ldy $1B lda ($19),y cmp #'=' ; Jump for >= beq L9BFA ; > numeric ; --------- jsr L9A9D ; Evaluate next and compare beq L9BB5 ; Jump to return FALSE if =, TRUE if > bcs L9BB4 bcc L9BB5 ; Jump to return FALSE if < ; >= numeric ; ---------- L9BFA: inc $1B ; Step past '=', evaluate next and compare jsr L9A9D bcs L9BB4 ; Jump to return TRUE if >=, FALSE if < bcc L9BB5 L9C03: brk .byte $13, "String too long" brk ; String addition ; --------------- L9C15: jsr LBDB2 ; Stack string, call Evaluator Level 2 jsr L9E20 tay ; string + number, jump to 'Type mismatch' error bne L9C88 clc stx $37 ldy #$00 ; Get stacked string length lda ($04),y adc $36 ; If added string length >255, jump to error bcs L9C03 tax ; Save new string length pha ldy $36 L9C2D: lda $05FF,y ; Move current string up in string buffer sta $05FF,x dex dey bne L9C2D jsr LBDCB ; Unstack string to start of string buffer pla ; Set new string length sta $36 ldx $37 tya ; Set type=string, jump to check for more + or - beq L9C45 ; Evaluator Level 4, + - ; ---------------------- L9C42: jsr L9DD1 ; Call Evaluator Level 3, * / DIV MOD L9C45: cpx #'+' ; Jump with addition beq L9C4E cpx #'-' ; Jump with subtraction beq L9CB5 rts ; + <value> ; --------- L9C4E: tay ; Jump if current value is a string beq L9C15 bmi L9C8B ; Jump if current value is a float ; Integer addition ; ---------------- jsr L9DCE ; Stack current and call Evaluator Level 3 tay ; If int + string, jump to 'Type mismatch' error beq L9C88 bmi L9CA7 ; If int + float, jump ... ldy #$00 clc ; Add top of stack to IntA lda ($04),y adc $2A sta $2A iny ; Store result in IntA lda ($04),y adc $2B sta $2B iny lda ($04),y adc $2C sta $2C iny lda ($04),y adc $2D L9C77: sta $2D clc lda $04 ; Drop integer from stack adc #$04 sta $04 lda #$40 ; Set result=integer, jump to check for more + or - bcc L9C45 inc $05 bcs L9C45 L9C88: jmp L8C0E ; Jump to 'Type mismatch' error ;Real addition ;------------- L9C8B: jsr LBD51 ; Stack float, call Evaluator Level 3 jsr L9DD1 tay ; float + string, jump to 'Type mismatch' error beq L9C88 stx $27 ; float + float, skip conversion bmi L9C9B jsr LA2BE ; float + int, convert int to float L9C9B: jsr LBD7E ; Pop float from stack, point FPTR to it jsr LA500 ; Unstack float to FPA2 and add to FP1A L9CA1: ldx $27 ; Get next char back lda #$FF ; Set result=float, loop to check for more + or - bne L9C45 ; int + float ; ----------- L9CA7: stx $27 ; Unstack integer to IntA jsr LBDEA jsr LBD51 ; Stack float, convert integer in IntA to float in FPA1 jsr LA2BE jmp L9C9B ; Jump to do float + <stacked float> ; - numeric ; --------- L9CB5: tay ; If current value is a string, jump to error beq L9C88 bmi L9CE1 ; Jump if current value is a float ; Integer subtraction ; ------------------- jsr L9DCE ; Stack current and call Evaluator Level 3 tay ; int + string, jump to error beq L9C88 bmi L9CFA ; int + float, jump to convert and do real subtraction sec ldy #$00 lda ($04),y sbc $2A sta $2A iny ; Subtract IntA from top of stack lda ($04),y sbc $2B sta $2B iny ; Store in IntA lda ($04),y sbc $2C sta $2C iny lda ($04),y sbc $2D jmp L9C77 ; Jump to pop stack and loop for more + or - ; Real subtraction ; ---------------- L9CE1: jsr LBD51 ; Stack float, call Evaluator Level 3 jsr L9DD1 tay ; float - string, jump to 'Type mismatch' error beq L9C88 stx $27 ; float - float, skip conversion bmi L9CF1 jsr LA2BE ; float - int, convert int to float L9CF1: jsr LBD7E ; Pop float from stack and point FPTR to it jsr LA4FD ; Unstack float to FPA2 and subtract it from FPA1 jmp L9CA1 ; Jump to set result and loop for more + or - ; int - float ; ----------- L9CFA: stx $27 ; Unstack integer to IntA jsr LBDEA jsr LBD51 ; Stack float, convert integer in IntA to float in FPA1 jsr LA2BE jsr LBD7E ; Pop float from stack, point FPTR to it jsr LA4D0 ; Subtract FPTR float from FPA1 float jmp L9CA1 ; Jump to set result and loop for more + or - L9D0E: jsr LA2BE L9D11: jsr LBDEA jsr LBD51 jsr LA2BE jmp L9D2C L9D1D: jsr LA2BE L9D20: jsr LBD51 jsr L9E20 stx $27 tay jsr L92FD L9D2C: jsr LBD7E jsr LA656 lda #$FF ldx $27 jmp L9DD4 L9D39: jmp L8C0E ; * <value> ; --------- L9D3C: tay ; If current value is string, jump to error beq L9D39 bmi L9D20 ; Jump if current value is a float lda $2D cmp $2C bne L9D1D tay beq L9D4E cmp #$FF bne L9D1D L9D4E: eor $2B bmi L9D1D jsr L9E1D stx $27 tay beq L9D39 bmi L9D11 lda $2D cmp $2C bne L9D0E tay beq L9D69 cmp #$FF bne L9D0E L9D69: eor $2B bmi L9D0E lda $2D pha jsr LAD71 ldx #$39 jsr LBE44 jsr LBDEA pla eor $2D sta $37 jsr LAD71 ldy #$00 ldx #$00 sty $3F sty $40 L9D8B: lsr $3A ror $39 bcc L9DA6 clc tya adc $2A tay txa adc $2B tax lda $3F adc $2C sta $3F lda $40 adc $2D sta $40 L9DA6: asl $2A rol $2B rol $2C rol $2D lda $39 ora $3A bne L9D8B sty $3D stx $3E lda $37 php L9DBB: ldx #$3D L9DBD: jsr LAF56 plp bpl L9DC6 jsr LAD93 L9DC6: ldx $27 jmp L9DD4 ; * <value> ; --------- L9DCB: jmp L9D3C ; Bounce back to multiply code ; Stack current value and continue in Evaluator Level 3 ; ------------------------------------------------------- L9DCE: jsr LBD94 ; Evaluator Level 3, * / DIV MOD ; ------------------------------ L9DD1: jsr L9E20 ; Call Evaluator Level 2, ^ L9DD4: cpx #'*' ; Jump with multiply beq L9DCB cpx # '/' ; Jump with divide beq L9DE5 cpx #tknMOD ; Jump with MOD beq L9E01 cpx #tknDIV ; Jump with DIV beq L9E0A rts ;/ <value> ;--------- L9DE5: tay ; Ensure current value is real jsr L92FD jsr LBD51 ; Stack float, call Evaluator Level 2 jsr L9E20 stx $27 ; Ensure current value is real tay jsr L92FD jsr LBD7E ; Unstack to FPTR, call divide routine jsr LA6AD ldx $27 ; Set result, loop for more * / MOD DIV lda #$FF bne L9DD4 ;MOD <value> ; ----------- L9E01: jsr L99BE ; Ensure current value is integer lda $38 php jmp L9DBB ; Jump to MOD routine ; DIV <value> ; ----------- L9E0A: jsr L99BE ; Ensure current value is integer rol $39 ; Multiply IntA by 2 rol $3A rol $3B rol $3C bit $37 php ldx #$39 ; Jump to DIV routine jmp L9DBD ; Stack current integer and evaluate another Level 2 ; -------------------------------------------------- L9E1D: jsr LBD94 ; Stack integer ; Evaluator Level 2, ^ ; -------------------- L9E20: jsr LADEC ; Call Evaluator Level 1, - + NOT function ( ) ? ! $ | " L9E23: pha L9E24: ldy $1B ; Get character inc $1B lda ($19),y cmp #' ' ; Skip spaces beq L9E24 tax pla cpx #'^' ; Return if not ^ beq L9E35 rts ; ^ <value> ; --------- L9E35: tay ; Ensure current value is a float jsr L92FD jsr LBD51 ; Stack float, evaluate a real jsr L92FA lda $30 cmp #$87 bcs L9E88 jsr LA486 bne L9E59 jsr LBD7E jsr LA3B5 lda $4A jsr LAB12 lda #$FF ; Set result=real, loop to check for more ^ bne L9E23 L9E59: jsr LA381 lda $04 sta $4B lda $05 sta $4C jsr LA3B5 lda $4A jsr LAB12 L9E6C: jsr LA37D jsr LBD7E jsr LA3B5 jsr LA801 jsr LAAD1 jsr LAA94 jsr LA7ED jsr LA656 lda #$FF ; Set result=real, loop to check for more ^ bne L9E23 L9E88: jsr LA381 jsr LA699 bne L9E6C ;Convert number to hex string ;---------------------------- L9E90: tya ; Convert real to integer bpl L9E96 jsr LA3E4 L9E96: ldx #$00 ldy #$00 L9E9A: lda $002A,y ; Expand four bytes into eight digits pha and #$0F sta $3F,x pla lsr a lsr a lsr a lsr a inx sta $3F,x inx iny cpy #$04 ; Loop for four bytes bne L9E9A L9EB0: dex ; No digits left, output a single zero beq L9EB7 lda $3F,x ; Skip leading zeros beq L9EB0 L9EB7: lda $3F,x ; Get byte from workspace cmp #$0A bcc L9EBF adc #$06 L9EBF: adc #'0' ; Convert to digit and store in buffer jsr LA066 dex bpl L9EB7 rts ; Output nonzero real number ; -------------------------- L9EC8: bpl L9ED1 ; Jump forward if positive lda #'-' ; A='-', clear sign flag sta $2E jsr LA066 ; Add '-' to string buffer L9ED1: lda $30 ; Get exponent cmp #$81 ; If m*2^1 or larger, number>=1, jump to output it bcs L9F25 jsr LA1F4 ; FloatA=FloatA*10 dec $49 jmp L9ED1 ; Convert numeric value to string ; =============================== ; On entry, FloatA (&2E-&35) = number ; or IntA (&2A-&2D) = number ; Y = type ; @% = print format ; &15.b7 set if hex ; Uses, &37=format type 0/1/2=G/E/F ; &38=max digits ; &49 ; On exit, StrA contains string version of number ; &36=string length ; L9EDF: ldx $0402 ; Get format byte cpx #$03 ; If <3, ok - use it bcc L9EE8 ldx #$00 ; If invalid, &00 for General format L9EE8: stx $37 ; Store format type lda $0401 ; If digits=0, jump to check format beq L9EF5 cmp #$0A ; If 10+ digits, jump to use 10 digits bcs L9EF9 bcc L9EFB ; If <10 digits, use specified number L9EF5: cpx #$02 ; If fixed format, use zero digits beq L9EFB ; STR$ enters here to use general format ; -------------------------------------- L9EF9: lda #$0A ; Otherwise, default to ten digits L9EFB: sta $38 ; Store digit length sta $4E lda #$00 ; Set initial output length to 0, initial exponent to 0 sta $36 sta $49 bit $15 ; Jump for hex conversion if &15.b7 set bmi L9E90 tya ; Convert integer to real bmi L9F0F jsr LA2BE L9F0F: jsr LA1DA ; Get -1/0/+1 sign, jump if not zero to output nonzero number bne L9EC8 lda $37 ; If not General format, output fixed or exponential zero bne L9F1D lda #'0' ; Store single '0' into string buffer and return jmp LA066 L9F1D: jmp L9F9C ; Jump to output zero in fixed or exponential format L9F20: jsr LA699 ; FloatA=1.0 bne L9F34 ; FloatA now is >=1, check that it is <10 ; --------------------------------------- L9F25: cmp #$84 ; Exponent<4, FloatA<10, jump to convert it bcc L9F39 bne L9F31 ; Exponent<>4, need to divide it lda $31 ; Get mantissa top byte cmp #$A0 ; Less than &A0, less than ten, jump to convert it bcc L9F39 L9F31: jsr LA24D ; FloatA=FloatA / 10 L9F34: inc $49 ; Jump back to get the number >=1 again jmp L9ED1 ; FloatA is now between 1 and 9.999999999 ; --------------------------------------- L9F39: lda $35 ; Copy FloatA to FloatTemp at &27/&046C sta $27 jsr LA385 lda $4E ; Get number of digits sta $38 ldx $37 ; Get print format cpx #$02 ; Not fixed format, jump to do exponent/general bne L9F5C adc $49 bmi L9FA0 sta $38 cmp #$0B bcc L9F5C lda #$0A sta $38 lda #$00 sta $37 L9F5C: jsr LA686 ; Clear FloatA lda #$A0 sta $31 lda #$83 sta $30 ldx $38 beq L9F71 L9F6B: jsr LA24D ; FloatA=FloatA/10 dex bne L9F6B L9F71: jsr LA7F5 ; Point to &46C jsr LA34E ; Unpack to FloatB lda $27 sta $42 jsr LA50B ; Add L9F7E: lda $30 cmp #$84 bcs L9F92 ror $31 ror $32 ror $33 ror $34 ror $35 inc $30 bne L9F7E L9F92: lda $31 cmp #$A0 bcs L9F20 lda $38 bne L9FAD ; Output zero in Exponent or Fixed format ; --------------------------------------- L9F9C: cmp #$01 beq L9FE6 L9FA0: jsr LA686 ; Clear FloatA lda #$00 sta $49 lda $4E sta $38 inc $38 L9FAD: lda #$01 cmp $37 beq L9FE6 ldy $49 bmi L9FC3 cpy $38 bcs L9FE6 lda #$00 sta $49 iny tya bne L9FE6 L9FC3: lda $37 cmp #$02 beq L9FCF lda #$01 cpy #$FF bne L9FE6 L9FCF: lda #'0' ; Output '0' jsr LA066 lda #'.' ; Output '.' jsr LA066 lda #'0' ; Prepare '0' L9FDB: inc $49 beq L9FE4 jsr LA066 ; Output bne L9FDB L9FE4: lda #$80 L9FE6: sta $4E L9FE8: jsr LA040 dec $4E bne L9FF4 lda #$2E jsr LA066 L9FF4: dec $38 bne L9FE8 ldy $37 dey beq LA015 dey beq LA011 ldy $36 LA002: dey lda $0600,y cmp #'0' beq LA002 cmp #'.' beq LA00F iny LA00F: sty $36 LA011: lda $49 beq LA03F LA015: lda #'E' ; Output 'E' jsr LA066 lda $49 bpl LA028 lda #'-' ; Output '-' jsr LA066 sec lda #$00 sbc $49 ; Negate LA028: jsr LA052 lda $37 beq LA03F lda #$20 ldy $49 bmi LA038 jsr LA066 LA038: cpx #$00 bne LA03F jmp LA066 LA03F: rts LA040: lda $31 lsr a lsr a lsr a lsr a jsr LA064 lda $31 and #$0F sta $31 jmp LA197 LA052: ldx #$FF sec LA055: inx sbc #$0A bcs LA055 adc #$0A pha txa beq LA063 jsr LA064 LA063: pla LA064: ora #'0' ; Store character in string buffer ; -------------------------------- LA066: stx $3B ; Store character ldx $36 sta $0600,x ldx $3B ; Increment string length inc $36 rts LA072: clc stx $35 jsr LA1DA lda #$FF rts ; Scan decimal number ; ------------------- LA07B: ldx #$00 ; Clear FloatA stx $31 stx $32 stx $33 stx $34 stx $35 stx $48 ; Clear 'Decimal point' flag stx $49 cmp #'.' ; Leading decimal point beq LA0A0 cmp #'9'+1 ; Not a decimal digit, finish bcs LA072 sbc #'0'-1 ; Convert to binary, if not digit finish bmi LA072 sta $35 ; Store digit LA099: iny ; Get next character lda ($19),y cmp #'.' ; Not decimal point bne LA0A8 LA0A0: lda $48 ; Already got decimal point, bne LA0E8 inc $48 ; Set Decimal Point flag, loop for next bne LA099 LA0A8: cmp #'E' ; Jump to scan exponent beq LA0E1 cmp #'9'+1 ; Not a digit, jump to finish bcs LA0E8 sbc #'0'-1 ; Not a digit, jump to finish bcc LA0E8 ldx $31 ; Get mantissa top byte cpx #$18 ; If <25, still small enough to add to bcc LA0C2 ldx $48 ; Decimal point found, skip digits to end of number bne LA099 inc $49 ; No decimal point, increment exponent and skip digits bcs LA099 LA0C2: ldx $48 beq LA0C8 dec $49 ; Decimal point found, decrement exponent LA0C8: jsr LA197 ; Multiply FloatA by 10 adc $35 ; Add digit to mantissa low byte sta $35 bcc LA099 ; No overflow inc $34 ; Add carry through mantissa bne LA099 inc $33 bne LA099 inc $32 bne LA099 inc $31 ; Loop to check next digit bne LA099 ; Deal with Exponent in scanned number ; ------------------------------------ LA0E1: jsr LA140 ; Scan following number adc $49 ; Add to current exponent sta $49 ; End of number found ; ------------------- LA0E8: sty $1B ; Store PtrB offset lda $49 ; Check exponent and 'decimal point' flag ora $48 beq LA11F ; No exponent, no decimal point, return integer jsr LA1DA beq LA11B LA0F5: lda #$A8 sta $30 lda #$00 sta $2F sta $2E jsr LA303 lda $49 bmi LA111 beq LA118 LA108: jsr LA1F4 dec $49 bne LA108 beq LA118 LA111: jsr LA24D inc $49 bne LA111 LA118: jsr LA65C LA11B: sec lda #$FF rts LA11F: lda $32 sta $2D and #$80 ora $31 bne LA0F5 lda $35 sta $2A lda $34 sta $2B lda $33 sta $2C lda #$40 sec rts LA139: jsr LA14B ; Scan following number eor #$FF ; Negate it, return CS=Ok sec rts ; Scan exponent, allows E E+ E- followed by one or two digits ; ----------------------------------------------------------- LA140: iny ; Get next character lda ($19),y cmp #'-' ; If '-', jump to scan and negate beq LA139 cmp #'+' ; If '+', just step past bne LA14E LA14B: iny ; Get next character lda ($19),y LA14E: cmp #'9'+1 ; Not a digit, exit with CC and A=0 bcs LA174 sbc #'0'-1 ; Not a digit, exit with CC and A=0 bcc LA174 sta $4A ; Store exponent digit iny ; Get next character lda ($19),y cmp #'9'+1 ; Not a digit, exit with CC and A=exp bcs LA170 sbc #'0'-1 ; Not a digit, exit with CC and A=exp bcc LA170 iny ; Step past digit, store current digit sta $43 lda $4A ; Get current exponent asl a ; exp=exp*10 asl a adc $4A asl a ; exp=exp*10+digit adc $43 rts LA170: lda $4A ; Get exp and return CC=Ok clc rts LA174: lda #$00 ; Return exp=0 and CC=Ok clc rts LA178: lda $35 adc $42 sta $35 lda $34 adc $41 sta $34 lda $33 adc $40 sta $33 lda $32 adc $3F sta $32 lda $31 adc $3E sta $31 rts LA197: pha ldx $34 lda $31 pha lda $32 pha lda $33 pha lda $35 asl a rol $34 rol $33 rol $32 rol $31 asl a rol $34 rol $33 rol $32 rol $31 adc $35 sta $35 txa adc $34 sta $34 pla adc $33 sta $33 pla adc $32 sta $32 pla adc $31 asl $35 rol $34 rol $33 rol $32 rol a sta $31 pla rts LA1DA: lda $31 ora $32 ora $33 ora $34 ora $35 beq LA1ED lda $2E bne LA1F3 lda #$01 rts LA1ED: sta $2E sta $30 sta $2F LA1F3: rts LA1F4: clc lda $30 adc #$03 sta $30 bcc LA1FF inc $2F LA1FF: jsr LA21E jsr LA242 jsr LA242 LA208: jsr LA178 LA20B: bcc LA21D ror $31 ror $32 ror $33 ror $34 ror $35 inc $30 bne LA21D inc $2F LA21D: rts LA21E: lda $2E LA220: sta $3B lda $2F sta $3C lda $30 sta $3D lda $31 sta $3E lda $32 sta $3F lda $33 sta $40 lda $34 sta $41 lda $35 sta $42 rts LA23F: jsr LA21E LA242: lsr $3E ror $3F ror $40 ror $41 ror $42 rts LA24D: sec lda $30 sbc #$04 sta $30 bcs LA258 dec $2F LA258: jsr LA23F jsr LA208 jsr LA23F jsr LA242 jsr LA242 jsr LA242 jsr LA208 lda #$00 sta $3E lda $31 sta $3F lda $32 sta $40 lda $33 sta $41 lda $34 sta $42 lda $35 rol a jsr LA208 lda #$00 sta $3E sta $3F lda $31 sta $40 lda $32 sta $41 lda $33 sta $42 lda $34 rol a jsr LA208 lda $32 rol a lda $31 LA2A4: adc $35 sta $35 bcc LA2BD inc $34 bne LA2BD inc $33 bne LA2BD inc $32 bne LA2BD inc $31 bne LA2BD jmp LA20B LA2BD: rts LA2BE: ldx #$00 stx $35 stx $2F lda $2D bpl LA2CD jsr LAD93 ldx #$FF LA2CD: stx $2E lda $2A sta $34 lda $2B sta $33 lda $2C sta $32 lda $2D sta $31 lda #$A0 sta $30 jmp LA303 LA2E6: sta $2E sta $30 sta $2F LA2EC: rts LA2ED: pha jsr LA686 pla beq LA2EC bpl LA2FD sta $2E lda #$00 sec sbc $2E LA2FD: sta $31 lda #$88 sta $30 LA303: lda $31 bmi LA2EC ora $32 ora $33 ora $34 ora $35 beq LA2E6 lda $30 LA313: ldy $31 bmi LA2EC bne LA33A ldx $32 stx $31 ldx $33 stx $32 ldx $34 stx $33 ldx $35 stx $34 sty $35 sec sbc #$08 sta $30 bcs LA313 dec $2F bcc LA313 LA336: ldy $31 bmi LA2EC LA33A: asl $35 rol $34 rol $33 rol $32 rol $31 sbc #$00 sta $30 bcs LA336 dec $2F bcc LA336 LA34E: ldy #$04 lda ($4B),y sta $41 dey lda ($4B),y sta $40 dey lda ($4B),y sta $3F dey lda ($4B),y sta $3B dey sty $42 sty $3C lda ($4B),y sta $3D ora $3B ora $3F ora $40 ora $41 beq LA37A lda $3B ora #$80 LA37A: sta $3E rts LA37D: lda #$71 bne LA387 LA381: lda #$76 bne LA387 LA385: lda #$6C LA387: sta $4B lda #$04 sta $4C LA38D: ldy #$00 lda $30 sta ($4B),y iny lda $2E and #$80 sta $2E lda $31 and #$7F ora $2E sta ($4B),y lda $32 iny sta ($4B),y lda $33 iny sta ($4B),y lda $34 iny sta ($4B),y rts LA3B2: jsr LA7F5 LA3B5: ldy #$04 lda ($4B),y sta $34 dey lda ($4B),y sta $33 dey lda ($4B),y sta $32 dey lda ($4B),y sta $2E dey lda ($4B),y sta $30 sty $35 sty $2F ora $2E ora $32 ora $33 ora $34 beq LA3E1 lda $2E ora #$80 LA3E1: sta $31 rts ; Convert real to integer ; ======================= LA3E4: jsr LA3FE ; Convert real to integer LA3E7: lda $31 ; Copy to Integer Accumulator sta $2D lda $32 sta $2C lda $33 sta $2B lda $34 sta $2A rts LA3F8: jsr LA21E ; Copy FloatA to FloatB jmp LA686 ; Set FloatA to zero and return ; Convert float to integer ; ======================== ; On entry, FloatA (&30-&34) holds a float ; On exit, FloatA (&30-&34) holds integer part ; --------------------------------------------- ; The real value is partially denormalised by repeatedly dividing the mantissa ; by 2 and incrementing the exponent to multiply the number by 2, until the ; exponent is &80, indicating that we have got to mantissa * 2^0. ; LA3FE: lda $30 ; Exponent<&80, number<1, jump to return 0 bpl LA3F8 jsr LA453 ; Set &3B-&42 to zero jsr LA1DA bne LA43C beq LA468 LA40C: lda $30 ; Get exponent cmp #$A0 ; Exponent is +32, float has been denormalised to an integer bcs LA466 cmp #$99 bcs LA43C adc #$08 sta $30 lda $40 sta $41 lda $3F sta $40 lda $3E sta $3F lda $34 sta $3E lda $33 ; Divide mantissa by 2^8 sta $34 lda $32 sta $33 lda $31 sta $32 lda #$00 sta $31 beq LA40C ; Loop to keep dividing LA43C: lsr $31 ror $32 ror $33 ror $34 ror $3E ror $3F ror $40 ror $41 inc $30 bne LA40C LA450: jmp LA66C LA453: lda #$00 sta $3B sta $3C sta $3D sta $3E sta $3F sta $40 sta $41 sta $42 rts LA466: bne LA450 ; Exponent>32, jump to 'Too big' error LA468: lda $2E ; If positive, jump to return bpl LA485 LA46C: sec ; Negate the mantissa to get integer lda #$00 sbc $34 sta $34 lda #$00 sbc $33 sta $33 lda #$00 sbc $32 sta $32 lda #$00 sbc $31 sta $31 LA485: rts LA486: lda $30 bmi LA491 lda #$00 sta $4A jmp LA1DA LA491: jsr LA3FE lda $34 sta $4A jsr LA4E8 lda #$80 sta $30 ldx $31 bpl LA4B3 eor $2E sta $2E bpl LA4AE inc $4A jmp LA4B0 LA4AE: dec $4A LA4B0: jsr LA46C LA4B3: jmp LA303 LA4B6: inc $34 bne LA4C6 inc $33 bne LA4C6 inc $32 bne LA4C6 inc $31 beq LA450 LA4C6: rts LA4C7: jsr LA46C jsr LA4B6 jmp LA46C LA4D0 : jsr LA4FD jmp LAD7E LA4D6: jsr LA34E jsr LA38D LA4DC: lda $3B sta $2E lda $3C sta $2F lda $3D sta $30 LA4E8: lda $3E sta $31 lda $3F sta $32 lda $40 sta $33 lda $41 sta $34 lda $42 sta $35 LA4FC: rts LA4FD: jsr LAD7E LA500: jsr LA34E beq LA4FC LA505: jsr LA50B jmp LA65C LA50B: jsr LA1DA beq LA4DC ldy #$00 sec lda $30 sbc $3D beq LA590 bcc LA552 cmp #$25 bcs LA4FC pha and #$38 beq LA53D lsr a lsr a lsr a tax LA528: lda $41 sta $42 lda $40 sta $41 lda $3F sta $40 lda $3E sta $3F sty $3E dex bne LA528 LA53D: pla and #$07 beq LA590 tax LA543: lsr $3E ror $3F ror $40 ror $41 ror $42 dex bne LA543 beq LA590 LA552: sec lda $3D sbc $30 cmp #$25 bcs LA4DC pha and #$38 beq LA579 lsr a lsr a lsr a tax LA564: lda $34 sta $35 lda $33 sta $34 lda $32 sta $33 lda $31 sta $32 sty $31 dex bne LA564 LA579: pla and #$07 beq LA58C tax LA57F: lsr $31 ror $32 ror $33 ror $34 ror $35 dex bne LA57F LA58C: lda $3D sta $30 LA590: lda $2E eor $3B bpl LA5DF lda $31 cmp $3E bne LA5B7 lda $32 cmp $3F bne LA5B7 lda $33 cmp $40 bne LA5B7 lda $34 cmp $41 bne LA5B7 lda $35 cmp $42 bne LA5B7 jmp LA686 LA5B7: bcs LA5E3 sec lda $42 sbc $35 sta $35 lda $41 sbc $34 sta $34 lda $40 sbc $33 sta $33 lda $3F sbc $32 sta $32 lda $3E sbc $31 sta $31 lda $3B sta $2E jmp LA303 LA5DF: clc jmp LA208 LA5E3: sec lda $35 sbc $42 sta $35 lda $34 sbc $41 sta $34 lda $33 sbc $40 sta $33 lda $32 sbc $3F sta $32 lda $31 sbc $3E sta $31 jmp LA303 LA605: rts LA606: jsr LA1DA beq LA605 jsr LA34E bne LA613 jmp LA686 LA613: clc lda $30 adc $3D bcc LA61D inc $2F clc LA61D: sbc #$7F sta $30 bcs LA625 dec $2F LA625: ldx #$05 ldy #$00 LA629: lda $30,x sta $42,x sty $30,x dex bne LA629 lda $2E eor $3B sta $2E ldy #$20 LA63A: lsr $3E ror $3F ror $40 ror $41 ror $42 asl $46 rol $45 rol $44 rol $43 bcc LA652 clc jsr LA178 LA652: dey bne LA63A rts LA656: jsr LA606 LA659: jsr LA303 LA65C: lda $35 cmp #$80 bcc LA67C beq LA676 lda #$FF jsr LA2A4 jmp LA67C LA66C: brk .byte $14, "Too big" brk LA676: lda $34 ora #$01 sta $34 LA67C: lda #$00 sta $35 lda $2F beq LA698 bpl LA66C LA686: lda #$00 sta $2E sta $2F sta $30 sta $31 sta $32 sta $33 sta $34 sta $35 LA698: rts LA699: jsr LA686 ldy #$80 sty $31 iny sty $30 tya rts LA6A5: jsr LA385 jsr LA699 bne LA6E7 LA6AD: jsr LA1DA beq LA6BB jsr LA21E jsr LA3B5 bne LA6F1 rts LA6BB: jmp L99A7 ; =TAN numeric ; ============ LA6BE: jsr L92FA jsr LA9D3 lda $4A pha jsr LA7E9 jsr LA38D inc $4A jsr LA99E jsr LA7E9 jsr LA4D6 pla sta $4A jsr LA99E jsr LA7E9 jsr LA6E7 lda #$FF rts LA6E7: jsr LA1DA beq LA698 jsr LA34E beq LA6BB LA6F1: lda $2E eor $3B sta $2E sec lda $30 sbc $3D bcs LA701 dec $2F sec LA701: adc #$80 sta $30 bcc LA70A inc $2F clc LA70A: ldx #$20 LA70C: bcs LA726 lda $31 cmp $3E bne LA724 lda $32 cmp $3F bne LA724 lda $33 cmp $40 bne LA724 lda $34 cmp $41 LA724: bcc LA73F LA726: lda $34 sbc $41 sta $34 lda $33 sbc $40 sta $33 lda $32 sbc $3F sta $32 lda $31 sbc $3E sta $31 sec LA73F: rol $46 rol $45 rol $44 rol $43 asl $34 rol $33 rol $32 rol $31 dex bne LA70C ldx #$07 LA754: bcs LA76E lda $31 cmp $3E bne LA76C lda $32 cmp $3F bne LA76C lda $33 cmp $40 bne LA76C lda $34 cmp $41 LA76C: bcc LA787 LA76E: lda $34 sbc $41 sta $34 lda $33 sbc $40 sta $33 lda $32 sbc $3F sta $32 lda $31 sbc $3E sta $31 sec LA787: rol $35 asl $34 rol $33 rol $32 rol $31 dex bne LA754 asl $35 lda $46 sta $34 lda $45 sta $33 lda $44 sta $32 lda $43 sta $31 jmp LA659 LA7A9: brk .byte $15, "-ve root" brk ; =SQR numeric ; ============ LA7B4: jsr L92FA LA7B7: jsr LA1DA beq LA7E6 bmi LA7A9 jsr LA385 lda $30 lsr a adc #$40 sta $30 lda #$05 sta $4A jsr LA7ED LA7CF: jsr LA38D lda #$6C sta $4B jsr LA6AD lda #$71 sta $4B jsr LA500 dec $30 dec $4A bne LA7CF LA7E6: lda #$FF rts ; Point &4B/C to a floating point temp ; ------------------------------------ LA7E9: lda #$7B bne LA7F7 LA7ED: lda #$71 bne LA7F7 LA7F1: lda #$76 bne LA7F7 LA7F5: lda #$6C LA7F7: sta $4B lda #$04 sta $4C rts ; =LN numeric ; =========== LA7FE: jsr L92FA LA801: jsr LA1DA beq LA808 bpl LA814 LA808: brk .byte $16, "Log range" brk LA814: jsr LA453 ldy #$80 sty $3B sty $3E iny sty $3D ldx $30 beq LA82A lda $31 cmp #$B5 bcc LA82C LA82A: inx dey LA82C: txa pha sty $30 jsr LA505 lda #$7B jsr LA387 lda #$73 ldy #$A8 jsr LA897 jsr LA7E9 jsr LA656 jsr LA656 jsr LA500 jsr LA385 pla sec sbc #$81 jsr LA2ED lda #$6E sta $4B lda #$A8 sta $4C jsr LA656 jsr LA7F5 jsr LA500 lda #$FF rts LA869: .byte $7F, $5E, $5B, $D8, $AA LA86E: .byte $80, $31, $72, $17, $F8 LA873: .byte $06, $7A, $12 LA876: .byte $38, $A5, $0B, $88, $79, $0E, $9F .byte $F3, $7C, $2A, $AC, $3F, $B5, $86, $34 .byte $01, $A2, $7A, $7F, $63, $8E, $37, $EC .byte $82, $3F, $FF, $FF, $C1, $7F, $FF, $FF .byte $FF, $FF LA897: sta $4D sty $4E jsr LA385 ldy #$00 lda ($4D),y sta $48 inc $4D bne LA8AA inc $4E LA8AA: lda $4D sta $4B lda $4E sta $4C jsr LA3B5 LA8B5: jsr LA7F5 jsr LA6AD clc lda $4D adc #$05 sta $4D sta $4B lda $4E adc #$00 sta $4E sta $4C jsr LA500 dec $48 bne LA8B5 rts ;=ACS numeric ; ============ LA8D4: jsr LA8DA jmp LA927 ; =ASN numeric ; ============ LA8DA: jsr L92FA jsr LA1DA bpl LA8EA lsr $2E jsr LA8EA jmp LA916 LA8EA: jsr LA381 jsr LA9B1 jsr LA1DA beq LA8FE jsr LA7F1 jsr LA6AD jmp LA90A LA8FE: jsr LAA55 jsr LA3B5 LA904: lda #$FF rts ; =ATN numeric ; ============ LA907: jsr L92FA LA90A: jsr LA1DA beq LA904 bpl LA91B lsr $2E jsr LA91B LA916: lda #$80 sta $2E rts LA91B: lda $30 cmp #$81 bcc LA936 jsr LA6A5 jsr LA936 LA927: jsr LAA48 jsr LA500 jsr LAA4C jsr LA500 jmp LAD7E LA936: lda $30 cmp #$73 bcc LA904 jsr LA381 jsr LA453 lda #$80 sta $3D sta $3E sta $3B jsr LA505 lda #LA95A & 255 ldy #LA95A / 256 jsr LA897 jsr LAAD1 lda #$FF rts LA95A: ora #$85 .byte $A3, $59, $E8, $67, $80, $1C, $9D, $07 .byte $36, $80, $57, $BB, $78, $DF, $80, $CA .byte $9A, $0E, $83, $84, $8C, $BB, $CA, $6E .byte $81, $95, $96, $06, $DE, $81, $0A, $C7 .byte $6C, $52, $7F, $7D, $AD, $90, $A1, $82 .byte $FB, $62, $57, $2F, $80, $6D, $63, $38 .byte $2C ; =COS numeric ; ============ LA98D: jsr L92FA ; Evaluate float jsr LA9D3 inc $4A jmp LA99E ; =SIN numeric ; ============ LA998: jsr L92FA ; Evaluate float jsr LA9D3 LA99E: lda $4A and #$02 beq LA9AA jsr LA9AA jmp LAD7E LA9AA: lsr $4A bcc LA9C3 jsr LA9C3 LA9B1: jsr LA385 jsr LA656 jsr LA38D jsr LA699 jsr LA4D0 jmp LA7B7 LA9C3: jsr LA381 jsr LA656 lda #LAA72 & 255 ldy #LAA72 / 256 jsr LA897 jmp LAAD1 LA9D3: lda $30 cmp #$98 bcs LAA38 jsr LA385 jsr LAA55 jsr LA34E lda $2E sta $3B dec $3D jsr LA505 jsr LA6E7 jsr LA3FE lda $34 sta $4A ora $33 ora $32 ora $31 beq LAA35 lda #$A0 sta $30 ldy #$00 sty $35 lda $31 sta $2E bpl LAA0E jsr LA46C LAA0E: jsr LA303 jsr LA37D jsr LAA48 jsr LA656 jsr LA7F5 jsr LA500 jsr LA38D jsr LA7ED jsr LA3B5 jsr LAA4C jsr LA656 jsr LA7F5 jmp LA500 LAA35: jmp LA3B2 LAA38: brk .byte $17, "Accuracy lost" brk LAA48: lda #LAA59 & 255 bne LAA4E LAA4C: lda #LAA5E & 255 LAA4E: sta $4B lda #LAA59 / 256 sta $4C rts LAA55: lda #LAA63 & 255 bne LAA4E LAA59: sta ($C9,x) bpl LAA5D LAA5D: brk LAA5E: .byte $6F, $15, $77, $7A, $61 LAA63: .byte $81, $49, $0F .byte $DA, $A2 LAA68: .byte $7B, $0E, $FA, $35, $12 LAA6D: .byte $86 .byte $65, $2E, $E0, $D3 LAA72: .byte $05, $84, $8A, $EA .byte $0C, $1B, $84, $1A, $BE, $BB, $2B, $84 .byte $37, $45, $55, $AB, $82, $D5, $55, $57 .byte $7C, $83, $C0, $00, $00, $05, $81, $00 .byte $00, $00, $00 ; = EXP numeric ; ============= LAA91: jsr L92FA LAA94: lda $30 cmp #$87 bcc LAAB8 bne LAAA2 LAA9C: ldy $31 cpy #$B3 bcc LAAB8 LAAA2: lda $2E bpl LAAAC jsr LA686 lda #$FF rts LAAAC: brk .byte $18, "Exp range" brk LAAB8: jsr LA486 jsr LAADA jsr LA381 lda #LAAE4 & 255 sta $4B lda #LAAE4 / 256 sta $4C jsr LA3B5 lda $4A jsr LAB12 LAAD1: jsr LA7F1 jsr LA656 lda #$FF rts LAADA: lda #LAAE9 & 255 ldy #LAAE9 / 256 jsr LA897 lda #$FF rts LAAE4: .byte $82, $2D, $F8, $54, $58 LAAE9: .byte $07, $83, $E0 .byte $20, $86, $5B, $82, $80, $53, $93, $B8 .byte $83, $20, $00, $06, $A1, $82, $00, $00 .byte $21, $63, $82, $C0, $00, $00, $02, $82 .byte $80, $00, $00, $0C, $81, $00, $00, $00 .byte $00, $81, $00, $00, $00, $00 LAB12: tax bpl LAB1E dex txa eor #$FF pha jsr LA6A5 pla LAB1E: pha jsr LA385 jsr LA699 LAB25: pla beq LAB32 sec sbc #$01 pha jsr LA656 jmp LAB25 LAB32: rts ; =ADVAL numeric - Call OSBYTE to read buffer/device ; ================================================== LAB33: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr L92E3 ; Evaluate integer ldx $2A ; X=low byte, A=&80 for ADVAL lda #$80 jsr OSBYTE txa jmp LAEEA .endif LAB41: ; POINT() .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr L92DD jsr LBD94 jsr L8AAE jsr LAE56 jsr L92F0 lda $2A pha lda $2B pha jsr LBDEA pla sta $2D pla sta $2C ldx #$2A lda #$09 jsr OSWORD lda $2E bmi LAB9D jmp LAED8 .endif ; =POS ; ==== LAB6D: lda #$86 jsr OSBYTE txa jmp LAED8 ; =VPOS ; ===== LAB76: lda #$86 jsr OSBYTE tya jmp LAED8 LAB7F: jsr LA1DA beq LABA2 bpl LABA0 bmi LAB9D ; =SGN numeric ;\ ============ LAB88: jsr LADEC beq LABE6 bmi LAB7F lda $2D ora $2C ora $2B ora $2A beq LABA5 lda $2D bpl LABA0 LAB9D: jmp LACC4 LABA0: lda #$01 LABA2: jmp LAED8 LABA5: lda #$40 rts ; =LOG numeric ; ============ LABA8: jsr LA7FE ldy #LA869 & 255 lda #LA869 / 256 bne LABB8 ; =RAD numeric ; ============ LABB1: jsr L92FA ldy #LAA68 & 255 lda #LAA68 / 256 LABB8: sty $4B sta $4C jsr LA656 lda #$FF rts ; =DEG numeric ; ============ LABC2: jsr L92FA ldy #LAA6D & 255 lda #LAA6D / 256 bne LABB8 ; =PI ; === LABCB: jsr LA8FE inc $30 tay rts ; =USR numeric ; ============ LABD2: jsr L92E3 jsr L8F1E sta $2A stx $2B sty $2C php pla sta $2D cld lda #$40 rts LABE6: jmp L8C0E ; =EVAL string$ - Tokenise and evaluate expression ; ================================================ LABE9: jsr LADEC ; Evaluate value bne LABE6 ; Error if not string inc $36 ; Increment string length to add a <cr> ldy $36 lda #$0D ; Put in terminating <cr> sta $05FF,y jsr LBDB2 ; Stack the string ; String has to be stacked as otherwise would ; be overwritten by any string operations ; called by Evaluator lda $19 ; Save PTRB pha lda $1A pha lda $1B pha ldy $04 ; YX=>stackbottom (wrong way around) ldx $05 iny ; Step over length byte sty $19 ; PTRB=>stacked string sty $37 ; GPTR=>stacked string bne LAC0F inx LAC0F: stx $1A ; PTRB and GPTR high bytes stx $38 ldy #$FF sty $3B iny ; Point PTRB offset back to start sty $1B jsr L8955 ; Tokenise string on stack at GPTR jsr L9B29 ; Call expression evaluator jsr LBDDC ; Drop string from stack LAC23: pla ; Restore PTRB sta $1B pla sta $1A pla sta $19 lda $27 ; Get expression return value rts ; And return ; =VAL numeric ; ============ LAC2F: jsr LADEC bne LAC9B LAC34: ldy $36 lda #$00 sta $0600,y lda $19 pha lda $1A pha lda $1B pha lda #$00 sta $1B lda #$00 sta $19 lda #$06 sta $1A jsr L8A8C cmp #$2D beq LAC66 cmp #$2B bne LAC5E jsr L8A8C LAC5E: dec $1B jsr LA07B jmp LAC73 LAC66: jsr L8A8C dec $1B jsr LA07B bcc LAC73 jsr LAD8F LAC73: sta $27 jmp LAC23 ; =INT numeric ; ============ LAC78: jsr LADEC beq LAC9B bpl LAC9A lda $2E php jsr LA3FE plp bpl LAC95 lda $3E ora $3F ora $40 ora $41 beq LAC95 jsr LA4C7 LAC95: jsr LA3E7 lda #$40 LAC9A: rts LAC9B: jmp L8C0E ; =ASC string$ ; ============ LAC9E: jsr LADEC bne LAC9B lda $36 beq LACC4 lda $0600 LACAA: jmp LAED8 ; =INKEY numeric ; ============== LACAD: jsr LAFAD cpy #$00 bne LACC4 txa jmp LAEEA ; =EOF#numeric ; ============ LACB8: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr LBFB5 tax lda #$7F jsr OSBYTE txa beq LACAA .endif ; =TRUE ; ===== LACC4: lda #$FF LACC6: sta $2A sta $2B sta $2C sta $2D LACC8: lda #$40 rts ; =NOT numeric ; ============ LACD1: jsr L92E3 ldx #$03 LACD6: lda $2A,x eor #$FF sta $2A,x dex bpl LACD6 lda #$40 rts ; =INSTR(string$, string$ [, numeric]) ; ==================================== LACE2: jsr L9B29 bne LAC9B cpx #$2C bne LAD03 inc $1B jsr LBDB2 jsr L9B29 bne LAC9B lda #$01 sta $2A inc $1B cpx #')' beq LAD12 cpx #$2C beq LAD06 LAD03: jmp L8AA2 LAD06: jsr LBDB2 jsr LAE56 jsr L92F0 jsr LBDCB LAD12: ldy #$00 ldx $2A bne LAD1A ldx #$01 LAD1A: stx $2A txa dex stx $2D clc adc $04 sta $37 tya adc $05 sta $38 lda ($04),y sec sbc $2D bcc LAD52 sbc $36 bcc LAD52 adc #$00 sta $2B jsr LBDDC LAD3C: ldy #$00 ldx $36 beq LAD4D LAD42: lda ($37),y cmp $0600,y bne LAD59 iny dex bne LAD42 LAD4D: lda $2A LAD4F: jmp LAED8 LAD52: jsr LBDDC LAD55: lda #$00 beq LAD4F LAD59: inc $2A dec $2B beq LAD55 inc $37 bne LAD3C inc $38 bne LAD3C LAD67: jmp L8C0E ; =ABS numeric ; ============ LAD6A: jsr LADEC beq LAD67 bmi LAD77 LAD71: bit $2D bmi LAD93 bpl LADAA LAD77: jsr LA1DA bpl LAD89 bmi LAD83 LAD7E: jsr LA1DA beq LAD89 LAD83: lda $2E eor #$80 sta $2E LAD89: lda #$FF rts LAD8C: jsr LAE02 LAD8F: beq LAD67 bmi LAD7E LAD93: sec lda #$00 tay sbc $2A sta $2A tya sbc $2B sta $2B tya sbc $2C sta $2C tya sbc $2D sta $2D LADAA: lda #$40 rts LADAD: jsr L8A8C cmp #$22 beq LADC9 ldx #$00 LADB6: lda ($19),y sta $0600,x iny inx cmp #$0D beq LADC5 cmp #$2C bne LADB6 LADC5: dey jmp LADE1 LADC9: ldx #$00 LADCB: iny LADCC: lda ($19),y cmp #$0D beq LADE9 iny sta $0600,x inx cmp #$22 bne LADCC lda ($19),y cmp #$22 beq LADCB LADE1: dex stx $36 sty $1B lda #$00 rts LADE9: jmp L8E98 ; Evaluator Level 1, - + NOT function ( ) ? ! $ | " ; ------------------------------------------------- LADEC: ldy $1B ; Get next character inc $1B lda ($19),y cmp #$20 ; Loop to skip spaces beq LADEC cmp #'-' ; Jump with unary minus beq LAD8C cmp #'"' ; Jump with string beq LADC9 cmp #'+' ; Jump with unary plus bne LAE05 LAE02: jsr L8A8C ; Get current character LAE05: cmp #$8E ; Lowest function token, test for indirections bcc LAE10 cmp #$C6 ; Highest function token, jump to error bcs LAE43 jmp L8BB1 ; Jump via function dispatch table ; Indirection, hex, brackets ; -------------------------- LAE10: cmp #'?' ; Jump with ?numeric or higher bcs LAE20 cmp #'.' ; Jump with .numeric or higher bcs LAE2A cmp #'&' ; Jump with hex number beq LAE6D cmp #'(' ; Jump with brackets beq LAE56 LAE20: dec $1B jsr L95DD beq LAE30 ; Jump with undefined variable or bad name jmp LB32C LAE2A: jsr LA07B bcc LAE43 rts LAE30: lda $28 ; Check assembler option and #$02 ; Is 'ignore undefined variables' set? bne LAE43 ; b1=1, jump to give No such variable bcs LAE43 ; Jump with bad variable name stx $1B LAE3A: lda $0440 ; Use P% for undefined variable ldy $0441 jmp LAEEA ; Jump to return 16-bit integer LAE43: brk .byte $1A, "No such variable" LAE54: brk LAE56: jsr L9B29 inc $1B cpx #')' bne LAE61 tay rts LAE61: brk .byte $1B, "Missing )" brk LAE6D: ldx #$00 stx $2A stx $2B stx $2C stx $2D ldy $1B LAE79: lda ($19),y cmp #$30 bcc LAEA2 cmp #$3A bcc LAE8D sbc #$37 cmp #$0A bcc LAEA2 cmp #$10 bcs LAEA2 LAE8D: asl a asl a asl a asl a ldx #$03 LAE93: asl a rol $2A rol $2B rol $2C rol $2D dex bpl LAE93 iny bne LAE79 LAEA2: txa bpl LAEAA sty $1B lda #$40 rts LAEAA: brk .byte $1C, "Bad HEX" brk ; =TIME - Read system TIME ; ======================== LAEB4: ldx #$2A ; Point to integer accumulator ldy #$00 lda #$01 ; Read TIME to IntA via OSWORD &01 jsr OSWORD lda #$40 ; Return 'integer' rts ; =PAGE - Read PAGE ; ================= LAEC0: lda #$00 ldy $18 jmp LAEEA LAEC7: jmp LAE43 ; =FALSE ; ====== LAECA: lda #$00 ; Jump to return &00 as 16-bit integer beq LAED8 LAECE: jmp L8C0E ; =LEN string$ ; ============ LAED1: jsr LADEC bne LAECE lda $36 ; Return 8-bit integer ; -------------------- LAED8: ldy #$00 ; Clear b8-b15, jump to return 16-bit int beq LAEEA ; =TOP - Return top of program ; ============================ LAEDC: ldy $1B lda ($19),y cmp #$50 bne LAEC7 inc $1B lda $12 ldy $13 ; Return 16-bit integer in AY ; --------------------------- LAEEA: sta $2A ; Store AY in integer accumulator sty $2B lda #$00 ; Set b16-b31 to 0 sta $2C sta $2D lda #$40 ; Return 'integer' rts ; =COUNT - Return COUNT ; ===================== LAEF7: lda $1E ; Get COUNT, jump to return 8-bit integer jmp LAED8 ; =LOMEM - Start of BASIC heap ; ============================ LAEFC: lda $00 ; Get LOMEM to AY, jump to return as integer ldy $01 jmp LAEEA ; =HIMEM - Top of BASIC memory ; ============================ LAF03: lda $06 ; Get HIMEM to AY, jump to return as integer ldy $07 jmp LAEEA ; =RND(numeric) ; ------------- LAF0A: inc $1B jsr LAE56 jsr L92F0 lda $2D bmi LAF3F ora $2C ora $2B bne LAF24 lda $2A beq LAF6C cmp #$01 beq LAF69 LAF24: jsr LA2BE jsr LBD51 jsr LAF69 jsr LBD7E jsr LA606 jsr LA303 jsr LA3E4 jsr L9222 lda #$40 rts LAF3F: ldx #$0D jsr LBE44 lda #$40 sta $11 rts ; RND [(numeric)] ; =============== LAF49: ldy $1B ; Get current character lda ($19),y cmp #'(' ; Jump with RND(numeric) beq LAF0A jsr LAF87 ; Get random number ldx #$0D LAF56: lda $00,x ; Copy random number to IntA sta $2A lda $01,x sta $2B lda $02,x sta $2C lda $03,x sta $2D lda #$40 ;Return Integer rts LAF69: jsr LAF87 LAF6C: ldx #$00 stx $2E stx $2F stx $35 lda #$80 sta $30 LAF78: lda $0D,x sta $31,x inx cpx #$04 bne LAF78 jsr LA659 lda #$FF rts LAF87: ldy #$20 LAF89: lda $0F lsr a lsr a lsr a eor $11 ror a rol $0D rol $0E rol $0F rol $10 rol $11 dey bne LAF89 rts ; =ERL - Return error line number ; =============================== LAF9F: ldy $09 ; Get ERL to AY, jump to return 16-bit integer lda $08 jmp LAEEA ;ERR - Return current error number ; ================================== LAFA6: ldy #$00 ; Get error number, jump to return 16-bit integer lda (FAULT),y jmp LAEEA ; INKEY ; ===== LAFAD: jsr L92E3 ; Evaluate <numeric> ; BBC - Call MOS to wait for keypress ; ----------------------------------- lda #$81 LAFB2: ldx $2A ldy $2B jmp OSBYTE ; =GET ; ==== LAFB9: jsr OSRDCH jmp LAED8 ; =GET$ ; ===== LAFBF: jsr OSRDCH LAFC2: sta $0600 lda #$01 sta $36 lda #$00 rts ; =LEFT$(string$, numeric) ; ======================== LAFCC: jsr L9B29 bne LB033 cpx #$2C bne LB036 inc $1B jsr LBDB2 jsr LAE56 jsr L92F0 jsr LBDCB lda $2A cmp $36 bcs LAFEB sta $36 LAFEB: lda #$00 rts ; =RIGHT$(string$, numeric) ; ========================= LAFEE: jsr L9B29 bne LB033 cpx #$2C bne LB036 inc $1B jsr LBDB2 jsr LAE56 jsr L92F0 jsr LBDCB lda $36 sec sbc $2A bcc LB023 beq LB025 tax lda $2A sta $36 beq LB025 ldy #$00 LB017: lda $0600,x sta $0600,y inx iny dec $2A bne LB017 LB023: lda #$00 LB025: rts ; =INKEY$ numeric ; =============== LB026: jsr LAFAD txa cpy #$00 beq LAFC2 LB02E: lda #$00 sta $36 rts LB033: jmp L8C0E LB036: jmp L8AA2 ; =MID$(string$, numeric [, numeric] ) ; ==================================== LB039: jsr L9B29 bne LB033 cpx #$2C bne LB036 jsr LBDB2 inc $1B jsr L92DD lda $2A pha lda #$FF sta $2A inc $1B cpx #')' beq LB061 cpx #$2C bne LB036 jsr LAE56 jsr L92F0 LB061: jsr LBDCB pla tay clc beq LB06F sbc $36 bcs LB02E dey tya LB06F: sta $2C tax ldy #$00 lda $36 sec sbc $2C cmp $2A bcs LB07F sta $2A LB07F: lda $2A beq LB02E LB083: lda $0600,x sta $0600,y iny inx cpy $2A bne LB083 sty $36 lda #$00 rts ; =STR$ [~] numeric ; ================= LB094: jsr L8A8C ; Skip spaces ldy #$FF ; Y=&FF for decimal cmp #'~' beq LB0A1 ldy #$00 ; Y=&00 for hex, step past ~ dec $1B LB0A1: tya ; Save format pha jsr LADEC ; Evaluate, error if not number beq LB0BF tay pla ; Get format back sta $15 lda $0403 ; Top byte of @%, STR$ uses @% bne LB0B9 sta $37 ; Store 'General format' jsr L9EF9 ; Convert using general format lda #$00 ; Return string rts LB0B9: jsr L9EDF ; Convert using @% format lda #$00 ; Return string rts LB0BF: jmp L8C0E ; Jump to Type mismatch error ; =STRING$(numeric, string$) ; ========================== LB0C2: jsr L92DD jsr LBD94 jsr L8AAE jsr LAE56 bne LB0BF jsr LBDEA ldy $36 beq LB0F5 lda $2A beq LB0F8 dec $2A beq LB0F5 LB0DF: ldx #$00 LB0E1: lda $0600,x sta $0600,y inx iny beq LB0FB cpx $36 bcc LB0E1 dec $2A bne LB0DF sty $36 LB0F5: lda #$00 rts LB0F8: sta $36 rts LB0FB: jmp L9C03 LB0FE: pla sta $0C pla sta $0B brk .byte $1D, "No such ", tknFN, "/", tknPROC brk ; Look through program for FN/PROC ; -------------------------------- LB112: lda $18 ; Start at PAGE sta $0C lda #$00 sta $0B LB11A: ldy #$01 ; Get line number high byte lda ($0B),y bmi LB0FE ; End of program, jump to 'No such FN/PROC' error ldy #$03 LB122: iny lda ($0B),y cmp #' ' ; Skip past spaces beq LB122 cmp #tknDEF ; Found DEF at start of lien beq LB13C LB12D: ldy #$03 ; Get line length lda ($0B),y clc ; Point to next line adc $0B sta $0B bcc LB11A inc $0C bcs LB11A ; Loop back to check next line LB13C: iny sty $0A jsr L8A97 tya tax clc adc $0B ldy $0C bcc LB14D iny clc LB14D: sbc #$00 sta $3C tya sbc #$00 sta $3D ldy #$00 LB158: iny inx lda ($3C),y cmp ($37),y bne LB12D cpy $39 bne LB158 iny lda ($3C),y jsr L8926 bcs LB12D txa tay jsr L986D jsr L94ED ldx #$01 jsr L9531 ldy #$00 lda $0B sta ($02),y iny lda $0C sta ($02),y jsr L9539 jmp LB1F4 LB18A: brk .byte $1E, "Bad call" brk ; =FNname [parameters] ; ==================== LB195: lda #$A4 ; 'FN' token ; Call subroutine ; --------------- ; A=FN or PROC ; PtrA=>start of FN/PROC name ; LB197: sta $27 ; Save PROC/FN token tsx ; Drop BASIC stack by size of 6502 stack txa clc adc $04 jsr LBE2E ; Store new BASIC stack pointer, check for No Room ldy #$00 ; Store 6502 Stack Pointer on BASIC stack txa sta ($04),y LB1A6: inx iny lda $0100,x ; Copy 6502 stack onto BASIC stack sta ($04),y cpx #$FF bne LB1A6 txs ; Clear 6502 stack lda $27 ; Push PROC/FN token pha lda $0A ; Push PtrA line pointer pha lda $0B pha lda $0C ; Push PtrA line pointer offset pha lda $1B tax clc adc $19 ldy $1A bcc LB1CA LB1C8: iny clc LB1CA: sbc #$01 sta $37 tya ; &37/8=>PROC token sbc #$00 sta $38 ldy #$02 ; Check name is valid jsr L955B cpy #$02 ; No valid characters, jump to 'Bad call' error beq LB18A stx $1B ; Line pointer offset => after valid FN/PROC name dey sty $39 jsr L945B ; Look for FN/PROC name in heap, if found, jump to it bne LB1E9 jmp LB112 ; Not in heap, jump to look through program ; FN/PROC destination found ; ------------------------- LB1E9: ldy #$00 ; Set PtrA to address from FN/PROC infoblock lda ($2A),y sta $0B iny lda ($2A),y sta $0C LB1F4: lda #$00 ; Push 'no parameters' (?) pha sta $0A jsr L8A97 cmp #'(' beq LB24D dec $0A LB202: lda $1B pha lda $19 pha lda $1A pha jsr L8BA3 pla sta $1A pla sta $19 pla sta $1B pla beq LB226 sta $3F LB21C: jsr LBE0B jsr L8CC1 dec $3F bne LB21C LB226: pla sta $0C pla sta $0B pla sta $0A pla ldy #$00 lda ($04),y tax txs LB236: iny inx lda ($04),y ; Copy stacked 6502 stack back onto 6502 stack sta $0100,x cpx #$FF bne LB236 tya ; Adjust BASIC stack pointer adc $04 sta $04 bcc LB24A inc $05 LB24A: lda $27 rts LB24D: lda $1B pha lda $19 pha lda $1A pha jsr L9582 beq LB2B5 lda $1B sta $0A pla sta $1A pla sta $19 pla sta $1B pla tax lda $2C pha lda $2B pha lda $2A pha inx txa pha jsr LB30D jsr L8A97 cmp #',' beq LB24D cmp #')' bne LB2B5 lda #$00 pha jsr L8A8C cmp #'(' bne LB2B5 LB28E: jsr L9B29 jsr LBD90 lda $27 sta $2D jsr LBD94 pla tax inx txa pha jsr L8A8C cmp #$2C beq LB28E cmp #$29 bne LB2B5 pla pla sta $4D sta $4E cpx $4D beq LB2CA LB2B5: ldx #$FB txs pla sta $0C pla sta $0B brk .byte $1F, "Arguments" brk LB2CA: jsr LBDEA pla sta $2A pla sta $2B pla sta $2C bmi LB2F9 lda $2D beq LB2B5 sta $27 ldx #$37 jsr LBE44 lda $27 bpl LB2F0 jsr LBD7E jsr LA3B5 jmp LB2F3 LB2F0: jsr LBDEA LB2F3: jsr LB4B7 jmp LB303 LB2F9: lda $2D bne LB2B5 jsr LBDCB jsr L8C21 LB303: dec $4D bne LB2CA lda $4E pha jmp LB202 ; Push a value onto the stack ; --------------------------- LB30D: ldy $2C cpy #$04 bne LB318 ldx #$37 jsr LBE44 LB318: jsr LB32C php jsr LBD90 plp beq LB329 bmi LB329 ldx #$37 jsr LAF56 LB329: jmp LBD94 LB32C: ldy $2C bmi LB384 beq LB34F cpy #$05 beq LB354 ldy #$03 lda ($2A),y sta $2D dey lda ($2A),y sta $2C dey lda ($2A),y tax dey lda ($2A),y sta $2A stx $2B lda #$40 rts LB34F: lda ($2A),y jmp LAEEA LB354: dey lda ($2A),y sta $34 dey lda ($2A),y sta $33 dey lda ($2A),y sta $32 dey lda ($2A),y sta $2E dey lda ($2A),y sta $30 sty $35 sty $2F ora $2E ora $32 ora $33 ora $34 beq LB37F lda $2E ora #$80 LB37F: sta $31 lda #$FF rts LB384: cpy #$80 beq LB3A7 ldy #$03 lda ($2A),y sta $36 beq LB3A6 ldy #$01 lda ($2A),y sta $38 dey lda ($2A),y sta $37 ldy $36 LB39D: dey lda ($37),y sta $0600,y tya bne LB39D LB3A6: rts LB3A7: lda $2B beq LB3C0 LB3AB: ldy #$00 LB3AD: lda ($2A),y sta $0600,y eor #$0D beq LB3BA iny bne LB3AD tya LB3BA: sty $36 rts ; =CHR$ numeric ; ============= LB3BD: jsr L92E3 LB3C0: lda $2A jmp LAFC2 LB3C5: ldy #$00 sty $08 sty $09 ldx $18 stx $38 sty $37 ldx $0C cpx #$07 beq LB401 ldx $0B LB3D9: jsr L8942 cmp #$0D bne LB3F9 cpx $37 lda $0C sbc $38 bcc LB401 jsr L8942 ora #$00 bmi LB401 sta $09 jsr L8942 sta $08 jsr L8942 LB3F9: cpx $37 lda $0C sbc $38 bcs LB3D9 LB401: rts ; ERROR HANDLER ; ============= LB402: ; FAULT set up, now process BRK error ; ----------------------------------- jsr LB3C5 sty $20 lda (FAULT),Y ; If ERR<>0, skip past ON ERROR OFF bne LB413 lda #LB433 & 255 ; ON ERROR OFF sta $16 lda #LB433 / 256 sta $17 LB413: lda $16 ; Point program point to ERROR program sta $0B lda $17 sta $0C jsr LBD3A ; Clear DATA and stack tax stx $0A lda #$DA ; Clear VDU queue jsr OSBYTE lda #$7E ; Acknowledge any Escape state jsr OSBYTE ldx #$FF ; Clear system stack stx $28 txs jmp L8BA3 ; Jump to execution loop LD428: ; Default ERROR program ; --------------------- LB433: .byte tknREPORT, ":", tknIF, tknERL .byte tknPRINT, '"', " at line ", '"', ';', tknERL, ':', tknEND .byte tknELSE, tknPRINT, ":" .byte tknEND, 13 ; SOUND numeric, numeric, numeric, numeric ; ======================================== LB44C: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr L8821 ; Evaluate integer ldx #$03 ; Three more to evaluate LB451: lda $2A ; Stack current 16-bit integer pha lda $2B pha txa pha jsr L92DA pla tax dex bne LB451 jsr L9852 lda $2A sta $3D lda $2B sta $3E ldy #$07 ldx #$05 bne LB48F .endif ; ENVELOPE a,b,c,d,e,f,g,h,i,j,k,l,m,n ; ==================================== LB472: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr L8821 ; Evaluate integer ldx #$0D ; 13 more to evaluate LB477: lda $2A ; Stack current 8-bit integer pha txa ; Step past comma, evaluate next integer pha jsr L92DA pla ; Loop to stack this one tax dex bne LB477 LB484: jsr L9852 ; Check end of statement lda $2A ; Copy current 8-bit integer to end of control block sta $44 ldx #$0C ; Prepare for 12 more bytes and OSWORD 8 ldy #$08 LB48F: pla ; Pop bytes into control block sta $37,x dex bpl LB48F tya ; Y=OSWORD number ldx #$37 ; XY=>control block ldy #$00 jsr OSWORD jmp L8B9B ; Return to execution loop .endif ; WIDTH numeric ; ============= LB4A0: jsr L8821 jsr L9852 ldy $2A dey sty $23 jmp L8B9B LB4AE: jmp L8C0E ; Store byte or word integer ; ========================== LB4B1: jsr L9B29 ; Evaluate expression LB4B4: jsr LBE0B ; Unstack integer (address of data) LB4B7: lda $39 cmp #$05 ; Size=5, jump to store float beq LB4E0 lda $27 ; Type<>num, jump to error beq LB4AE bpl LB4C6 ; Type=int, jump to store it jsr LA3E4 ; Convert float to integer LB4C6: ldy #$00 lda $2A ; Store byte 1 sta ($37),y lda $39 ; Exit if size=0, byte beq LB4DF lda $2B ; Store byte 2 iny sta ($37),y lda $2C ; Store byte 3 iny sta ($37),y lda $2D ; Store byte 4 iny sta ($37),y LB4DF: rts ; Store float ; =========== LB4E0: lda $27 ; Type<>num, jump to error beq LB4AE bmi LB4E9 ; Type=float, jump to store it jsr LA2BE ; Convert integer to float LB4E9: ldy #$00 ; Store 5-byte float lda $30 ; exponent sta ($37),y iny lda $2E ; Unpack sign and #$80 sta $2E lda $31 ; Unpack mantissa 1 and #$7F ora $2E ; sign + mantissa 1 sta ($37),y iny ; mantissa 2 lda $32 sta ($37),y iny ; mantissa 3 lda $33 sta ($37),y iny ; mantissa 3 lda $34 sta ($37),y rts LB500: LB50E: sta $37 cmp #$80 bcc LB558 lda #L8071 & 255 ; Point to token table sta $38 lda #L8071 / 256 sta $39 sty $3A LB51E: ldy #$00 LB520: iny lda ($38),y bpl LB520 cmp $37 beq LB536 iny tya sec adc $38 sta $38 bcc LB51E inc $39 bcs LB51E LB536: ldy #$00 LB538: lda ($38),y bmi LB542 jsr LB558 iny bne LB538 LB542: ldy $3A rts LB545: pha lsr a lsr a lsr a lsr a jsr LB550 pla and #$0F LB550: cmp #$0A bcc LB556 adc #$06 LB556: adc #$30 LB558: cmp #$0D bne LB567 jsr OSWRCH jmp LBC28 LB562: jsr LB545 LB565: lda #$20 LB567: pha lda $23 cmp $1E bcs LB571 jsr LBC25 LB571: pla inc $1E jmp (WRCHV) LB577: and $1F beq LB589 txa beq LB589 bmi LB565 LB580: jsr LB565 jsr LB558 dex bne LB580 LB589: rts LB58A: inc $0A jsr L9B1D jsr L984C jsr L92EE lda $2A sta $1F jmp L8AF6 ; LIST [linenum [,linenum]] ; ========================= LB59C: iny lda ($0B),y cmp #'O' beq LB58A lda #$00 sta $3B sta $3C jsr LAED8 jsr L97DF php jsr LBD94 lda #$FF sta $2A lda #$7F sta $2B plp bcc LB5CF jsr L8A97 cmp #',' beq LB5D8 jsr LBDEA jsr LBD94 dec $0A bpl LB5DB LB5CF: jsr L8A97 cmp #',' beq LB5D8 dec $0A LB5D8: jsr L97DF LB5DB: lda $2A sta $31 lda $2B sta $32 jsr L9857 jsr LBE6F jsr LBDEA jsr L9970 lda $3D sta $0B lda $3E sta $0C bcc LB60F dey bcs LB602 LB5FC: jsr LBC25 jsr L986D LB602: lda ($0B),y sta $2B iny lda ($0B),y sta $2A iny iny sty $0A LB60F: lda $2A clc sbc $31 lda $2B sbc $32 bcc LB61D jmp L8AF6 LB61D: jsr L9923 ldx #$FF stx $4D lda #$01 jsr LB577 ldx $3B lda #$02 jsr LB577 ldx $3C lda #$04 jsr LB577 LB637: ldy $0A LB639: lda ($0B),y cmp #$0D beq LB5FC cmp #$22 bne LB651 lda #$FF eor $4D sta $4D lda #$22 LB64B: jsr LB558 iny bne LB639 LB651: bit $4D bpl LB64B cmp #$8D bne LB668 jsr L97EB sty $0A lda #$00 sta $14 jsr L991F jmp LB637 LB668: cmp #$E3 bne LB66E inc $3B LB66E: cmp #$ED bne LB678 ldx $3B beq LB678 dec $3B LB678: cmp #$F5 bne LB67E inc $3C LB67E: cmp #$FD bne LB688 ldx $3C beq LB688 dec $3C LB688: jsr LB50E iny bne LB639 LB68E: brk .byte $20, "No ", tknFOR brk ; NEXT [variable [,...]] ; ====================== LB695: jsr L95C9 bne LB6A3 ldx $26 beq LB68E bcs LB6D7 LB6A0: jmp L982A LB6A3: bcs LB6A0 ldx $26 beq LB68E LB6A9: lda $2A cmp $04F1,x bne LB6BE lda $2B cmp $04F2,x bne LB6BE lda $2C cmp $04F3,x beq LB6D7 LB6BE: txa sec sbc #$0F tax stx $26 bne LB6A9 brk .byte $21, "Can't Match ", tknFOR brk LB6D7: lda $04F1,x sta $2A lda $04F2,x sta $2B ldy $04F3,x cpy #$05 beq LB766 ldy #$00 lda ($2A),y adc $04F4,x sta ($2A),y sta $37 iny lda ($2A),y adc $04F5,x sta ($2A),y sta $38 iny lda ($2A),y adc $04F6,x sta ($2A),y sta $39 iny lda ($2A),y adc $04F7,x sta ($2A),y tay lda $37 sec sbc $04F9,x sta $37 lda $38 sbc $04FA,x sta $38 lda $39 sbc $04FB,x sta $39 tya sbc $04FC,x ora $37 ora $38 ora $39 beq LB741 tya eor $04F7,x eor $04FC,x bpl LB73F bcs LB741 bcc LB751 LB73F: bcs LB751 LB741: ldy $04FE,x lda $04FF,x sty $0B sta $0C jsr L9877 jmp L8BA3 LB751: lda $26 sec sbc #$0F sta $26 ldy $1B sty $0A jsr L8A97 cmp #',' bne LB7A1 jmp LB695 LB766: jsr LB354 lda $26 clc adc #$F4 sta $4B lda #$05 sta $4C jsr LA500 lda $2A sta $37 lda $2B sta $38 jsr LB4E9 lda $26 sta $27 clc adc #$F9 sta $4B lda #$05 sta $4C jsr L9A5F beq LB741 lda $04F5,x bmi LB79D bcs LB741 bcc LB751 LB79D: bcc LB741 bcs LB751 LB7A1: jmp L8B96 LB7A4: brk .byte $22, tknFOR, " variable" LB7B0: brk .byte $23, "Too many ", tknFOR, "s" LB7BD: brk .byte $24, "No ", tknTO brk ; FOR numvar = numeric TO numeric [STEP numeric] ; ============================================== LB7C4: jsr L9582 beq LB7A4 bcs LB7A4 jsr LBD94 jsr L9841 jsr LB4B1 ldy $26 cpy #$96 bcs LB7B0 lda $37 sta $0500,y lda $38 sta $0501,y lda $39 sta $0502,y tax jsr L8A8C cmp #$B8 bne LB7BD cpx #$05 beq LB84F jsr L92DD ldy $26 lda $2A sta $0508,y lda $2B sta $0509,y lda $2C sta $050A,y lda $2D sta $050B,y lda #$01 jsr LAED8 jsr L8A8C cmp #$88 bne LB81F jsr L92DD ldy $1B LB81F: sty $0A ldy $26 lda $2A sta $0503,y lda $2B sta $0504,y lda $2C sta $0505,y lda $2D sta $0506,y LB837: jsr L9880 ldy $26 lda $0B sta $050D,y lda $0C sta $050E,y clc tya adc #$0F sta $26 jmp L8BA3 LB84F: jsr L9B29 jsr L92FD lda $26 clc adc #$08 sta $4B lda #$05 sta $4C jsr LA38D jsr LA699 jsr L8A8C cmp #$88 bne LB875 jsr L9B29 jsr L92FD ldy $1B LB875: sty $0A lda $26 clc adc #$03 sta $4B lda #$05 sta $4C jsr LA38D jmp LB837 ; GOSUB numeric ;============= LB888: jsr LB99A LB88B: jsr L9857 ldy $25 cpy #$1A bcs LB8A2 lda $0B sta $05CC,y lda $0C sta $05E6,y inc $25 bcc LB8D2 LB8A2: brk .byte $25, "Too many ", tknGOSUB, "s" LB8AF: brk .byte $26, "No ", tknGOSUB brk ; RETURN ; ====== LB8B6: jsr L9857 ; Check for end of statement ldx $25 ; If GOSUB stack empty, error beq LB8AF dec $25 ; Decrement GOSUB stack ldy $05CB,x ; Get stacked line pointer lda $05E5,x sty $0B ; Set line pointer sta $0C jmp L8B9B ; Jump back to execution loop ; GOTO numeric ; ============ LB8CC: jsr LB99A ; Find destination line, check for end of statement jsr L9857 LB8D2: lda $20 ; If TRACE ON, print current line number beq LB8D9 jsr L9905 LB8D9: ldy $3D ; Get destination line address lda $3E LB8DD: sty $0B ; Set line pointer sta $0C jmp L8BA3 ; Jump back to execution loop ; ON ERROR OFF ; ------------ LB8E4: jsr L9857 ; Check end of statement lda #LB433 & 255 ; ON ERROR OFF sta $16 lda #LB433 / 256 sta $17 jmp L8B9B ; Jump to execution loop ; ON ERROR [OFF | program ] ; ------------------------- LB8F2: jsr L8A97 cmp #tknOFF ; ON ERROR OFF beq LB8E4 ldy $0A dey jsr L986D lda $0B ; Point ON ERROR pointer to here sta $16 lda $0C sta $17 jmp L8B7D ; Skip past end of line LB90A: brk .byte $27, tknON, " syntax" brk ; ON [ERROR] [numeric] ; ==================== LB915: jsr L8A97 ; Skip spaces and get next character cmp #tknERROR ; Jump with ON ERROR beq LB8F2 dec $0A jsr L9B1D jsr L92F0 ldy $1B iny sty $0A cpx #tknGOTO beq LB931 cpx #tknGOSUB bne LB90A LB931: txa ; Save GOTO/GOSUB token pha lda $2B ; Get IntA ora $2C ora $2D ; ON >255 - out of range, look for an ELSE bne LB97D ldx $2A ; ON zero - out of range, look for an ELSE beq LB97D dex ; Dec. counter, if zero use first destination beq LB95C ldy $0A ; Get line index LB944: lda ($0B),y iny cmp #$0D ; End of line - error beq LB97D cmp #':' ; End of statement - error beq LB97D cmp #tknELSE ; ELSE - drop everything else to here beq LB97D cmp #',' ; No comma, keep looking bne LB944 dex ; Comma found, loop until count decremented to zero bne LB944 sty $0A ; Store line index LB95C: jsr LB99A ; Read line number pla ; Get stacked token back cmp #tknGOSUB ; Jump to do GOSUB beq LB96A jsr L9877 ; Update line index and check Escape jmp LB8D2 ; Update line pointer so RETURN comes back to next statement ; ---------------------------------------------------------- LB96A: ldy $0A ; Get line pointer LB96C: lda ($0B),y ; Get character from line iny cmp #$0D ; End of line, RETURN to here beq LB977 cmp #':' ; <colon>, return to here bne LB96C LB977: dey ; Update line index to RETURN point sty $0A jmp LB88B ; Jump to do the GOSUB ; ON num out of range - check for an ELSE clause ; ---------------------------------------------- LB97D: ldy $0A ; Get line index pla ; Drop GOTO/GOSUB token LB980: lda ($0B),y ; Get character from line iny cmp #tknELSE ; Found ELSE, jump to use it beq LB995 cmp #$0D ; Loop until end of line bne LB980 brk .byte $28, tknON, " range" brk LB995: sty $0A ; Store line index and jump to GOSUB jmp L98E3 LB99A: jsr L97DF ; Embedded line number found bcs LB9AF jsr L9B1D ; Evaluate expression, ensure integer jsr L92F0 lda $1B ; Line number low byte sta $0A lda $2B ; Line number high byte and #$7F ; Note - this makes goto &8000+10 the same as goto 10 sta $2B LB9AF: jsr L9970 ; Look for line, error if not found bcs LB9B5 rts LB9B5: brk .byte $29, "No such line" brk LB9C4: jmp L8C0E LB9C7: jmp L982A LB9CA: sty $0A jmp L8B98 ; INPUT #channel, ... ; ------------------- LB9CF: dec $0A jsr LBFA9 lda $1B sta $0A sty $4D LB9DA: jsr L8A97 cmp #',' bne LB9CA lda $4D pha jsr L9582 beq LB9C7 lda $1B sta $0A pla sta $4D php jsr LBD94 ldy $4D jsr OSBGET sta $27 plp bcc LBA19 lda $27 bne LB9C4 jsr OSBGET sta $36 tax beq LBA13 LBA0A: jsr OSBGET sta $05FF,x dex bne LBA0A LBA13: jsr L8C1E jmp LB9DA LBA19: lda $27 beq LB9C4 bmi LBA2B ldx #$03 LBA21: jsr OSBGET sta $2A,x dex bpl LBA21 bmi LBA39 LBA2B: ldx #$04 LBA2D: jsr OSBGET sta $046C,x dex bpl LBA2D jsr LA3B2 LBA39: jsr LB4B4 jmp LB9DA LBA3F: pla pla jmp L8B98 ; INPUT [LINE] [print items][variables] ; ===================================== LBA44: jsr L8A97 ; Get next non-space char cmp #'#' ; If '#' jump to do INPUT# beq LB9CF cmp #tknLINE ; If 'LINE', skip next with CS beq LBA52 dec $0A ; Step back to non-LINE char, set CC clc LBA52: ror $4D ; bit7=0, bit6=notLINE/LINE lsr $4D lda #$FF sta $4E LBA5A: jsr L8E8A ; Process ' " TAB SPC, jump if none found bcs LBA69 LBA5F: jsr L8E8A ; Keep processing any print items bcc LBA5F ldx #$FF stx $4E clc LBA69: php asl $4D plp ror $4D cmp #',' ; ',' - jump to do next item beq LBA5A cmp #';' ; ';' - jump to do next item beq LBA5A dec $0A lda $4D pha lda $4E pha jsr L9582 beq LBA3F pla sta $4E pla sta $4D lda $1B sta $0A php bit $4D bvs LBA99 lda $4E cmp #$FF bne LBAB0 LBA99: bit $4D bpl LBAA2 lda #'?' jsr LB558 LBAA2: jsr LBBFC sty $36 asl $4D clc ror $4D bit $4D bvs LBACD LBAB0: sta $1B lda #$00 sta $19 lda #$06 sta $1A jsr LADAD LBABD: jsr L8A8C cmp #',' beq LBACA cmp #$0D bne LBABD ldy #$FE LBACA: iny sty $4E LBACD: plp bcs LBADC jsr LBD94 jsr LAC34 jsr LB4B4 jmp LBA5A LBADC: lda #$00 sta $27 jsr L8C21 jmp LBA5A ; RESTORE [linenum] ; ================= LBAE6: ldy #$00 ; Set DATA pointer to PAGE sty $3D ldy $18 sty $3E jsr L8A97 dec $0A cmp #':' beq LBB07 cmp #$0D beq LBB07 cmp #tknELSE beq LBB07 jsr LB99A ldy #$01 jsr LBE55 LBB07: jsr L9857 lda $3D sta $1C lda $3E sta $1D jmp L8B9B LBB15: jsr L8A97 cmp #',' beq LBB1F jmp L8B96 ; READ varname [,...] ; =================== LBB1F: jsr L9582 beq LBB15 bcs LBB32 jsr LBB50 jsr LBD94 jsr LB4B1 jmp LBB40 LBB32: jsr LBB50 jsr LBD94 jsr LADAD sta $27 jsr L8C1E LBB40: clc lda $1B adc $19 sta $1C lda $1A adc #$00 sta $1D jmp LBB15 LBB50: lda $1B sta $0A lda $1C sta $19 lda $1D sta $1A ldy #$00 sty $1B jsr L8A8C cmp #',' beq LBBB0 cmp #tknDATA beq LBBB0 cmp #$0D beq LBB7A LBB6F: jsr L8A8C cmp #',' beq LBBB0 cmp #$0D bne LBB6F LBB7A: ldy $1B lda ($19),y bmi LBB9C iny iny lda ($19),y tax LBB85: iny lda ($19),y cmp #$20 beq LBB85 cmp #tknDATA beq LBBAD txa clc adc $19 sta $19 bcc LBB7A inc $1A bcs LBB7A LBB9C: brk .byte $2A, "Out of ", tknDATA LBBA6: brk .byte $2B, "No ", tknREPEAT brk LBBAD: iny sty $1B LBBB0: rts ; UNTIL numeric ; ============= LBBB1: jsr L9B1D jsr L984C jsr L92EE ldx $24 beq LBBA6 lda $2A ora $2B ora $2C ora $2D beq LBBCD dec $24 jmp L8B9B LBBCD: ldy $05A3,x lda $05B7,x jmp LB8DD LBBD6: brk .byte $2C, "Too many ", tknREPEAT, "s" brk ; REPEAT ; ====== LBBE4: ldx $24 cpx #$14 bcs LBBD6 jsr L986D lda $0B sta $05A4,x lda $0C sta $05B8,x inc $24 jmp L8BA3 ; Input string to string buffer ; ----------------------------- LBBFC: ldy #$00 lda #$06 ; String buffer at $0600 bne LBC09 ; Print character, read input line ; -------------------------------- LBC02: jsr LB558 ; Print character ldy #$00 ; $AAYY=input buffer at &0700 lda #$07 LBC09: sty $37 ; $37/8=>input buffer sta $38 ; BBC - Call MOS to read a line ; ----------------------------- lda #$EE ; Maximum length sta $39 lda #$20 ; Lowest acceptable character sta $3A ldy #$FF ; Highest acceptable character sty $3B iny ; XY=>control block at &0037 ldx #$37 tya ; Call OSWORD 0 to read line of text jsr OSWORD bcc LBC28 ; CC, Escape not pressed jmp L9838 ; Escape LBC25: jsr OSNEWL LBC28: lda #$00 ; Set COUNT to zero sta $1E rts LBC2D: jsr L9970 bcs LBC80 lda $3D sbc #$02 sta $37 sta $3D sta $12 lda $3E sbc #$00 sta $38 sta $13 sta $3E ldy #$03 lda ($37),y clc adc $37 sta $37 bcc LBC53 inc $38 LBC53: ldy #$00 LBC55: lda ($37),y sta ($12),y cmp #$0D beq LBC66 LBC5D: iny bne LBC55 inc $38 inc $13 bne LBC55 LBC66: iny bne LBC6D inc $38 inc $13 LBC6D: lda ($37),y sta ($12),y bmi LBC7C jsr LBC81 jsr LBC81 jmp LBC5D LBC7C: jsr LBE92 clc LBC80: rts LBC81: iny bne LBC88 inc $13 inc $38 LBC88: lda ($37),y sta ($12),y rts LBC8D: sty $3B jsr LBC2D ldy #$07 sty $3C ldy #$00 lda #$0D cmp ($3B),y beq LBD10 LBC9E: iny cmp ($3B),y bne LBC9E iny iny iny sty $3F inc $3F lda $12 sta $39 lda $13 sta $3A jsr LBE92 sta $37 lda $13 sta $38 dey lda $06 cmp $12 lda $07 sbc $13 bcs LBCD6 jsr LBE6F jsr LBD20 brk .byte 0, tknLINE, " space" brk LBCD6: lda ($39),y sta ($37),y tya bne LBCE1 dec $3A dec $38 LBCE1: dey tya adc $39 ldx $3A bcc LBCEA inx LBCEA: cmp $3D txa sbc $3E bcs LBCD6 sec ldy #$01 lda $2B sta ($3D),y iny lda $2A sta ($3D),y iny lda $3F sta ($3D),y jsr LBE56 ldy #$FF LBD07: iny lda ($3B),y sta ($3D),y cmp #$0D bne LBD07 LBD10: rts ; RUN ; === LBD11: jsr L9857 LBD14: jsr LBD20 lda $18 sta $0C ; Point PtrA to PAGE stx $0B jmp L8B0B ; Clear BASIC heap, stack and DATA pointer ; ======================================== LBD20: lda $12 ; LOMEM=TOP, VAREND=TOP sta $00 sta $02 lda $13 sta $01 sta $03 jsr LBD3A ; Clear DATA and stack LBD2F: ldx #$80 lda #$00 LBD33: sta $047F,x ; Clear dynamic variables list dex bne LBD33 rts ; Clear DATA pointer and BASIC stack ; ================================== LBD3A: lda $18 ; DATA pointer hi=PAGE hi sta $1D lda $06 ; STACK=HIMEM sta $04 lda $07 sta $05 lda #$00 ; Clear REPEAT, FOR, GOSUB stacks sta $24 sta $26 sta $25 sta $1C ; DATA pointer=PAGE rts LBD51: lda $04 sec sbc #$05 jsr LBE2E ldy #$00 lda $30 sta ($04),y iny lda $2E and #$80 sta $2E lda $31 and #$7F ora $2E sta ($04),y iny lda $32 sta ($04),y iny lda $33 sta ($04),y iny lda $34 sta ($04),y rts LBD7E: lda $04 clc sta $4B adc #$05 sta $04 lda $05 sta $4C adc #$00 sta $05 rts LBD90: beq LBDB2 bmi LBD51 LBD94: lda $04 sec sbc #$04 LBD99: jsr LBE2E ldy #$03 lda $2D sta ($04),y dey lda $2C sta ($04),y dey lda $2B sta ($04),y dey lda $2A sta ($04),y rts ; Stack the current string ; ======================== LBDB2: clc ; stackbot=stackbot-length-1 lda $04 sbc $36 jsr LBE2E ; Check enough space ldy $36 ; Zero length, just stack length beq LBDC6 LBDBE: lda $05FF,y ; Copy string to stack sta ($04),y dey ; Loop for all characters bne LBDBE LBDC6: lda $36 ; Copy string length sta ($04),y rts ; Unstack a string ; ================ LBDCB: ldy #$00 ; Get stacked string length lda ($04),y sta $36 ; If zero length, just unstack length beq LBDDC tay LBDD4: lda ($04),y ; Copy string to string buffer sta $05FF,y dey ; Loop for all characters bne LBDD4 LBDDC: ldy #$00 ; Get string length again lda ($04),y sec LBDE1: adc $04 ; Update stack pointer sta $04 bcc LBE0A inc $05 rts ; Unstack an integer to IntA ; -------------------------- LBDEA: ldy #$03 lda ($04),y ; Copy to IntA sta $2D dey lda ($04),y sta $2C dey lda ($04),y sta $2B dey lda ($04),y sta $2A LBDFF: clc lda $04 adc #$04 ; Drop 4 bytes from stack sta $04 bcc LBE0A inc $05 LBE0A: rts ; Unstack an integer to zero page ; ------------------------------- LBE0B: ldx #$37 LBE0D: ldy #$03 lda ($04),y sta $03,x dey lda ($04),y sta $02,x dey lda ($04),y sta $01,x dey lda ($04),y sta $00,x clc lda $04 ; Drop 4 bytes from stack adc #$04 sta $04 bcc LBE0A inc $05 rts LBE2E: sta $04 bcs LBE34 dec $05 LBE34: ldy $05 cpy $03 bcc LBE41 bne LBE40 cmp $02 bcc LBE41 LBE40: rts LBE41: jmp L8CB7 LBE44: lda $2A sta $00,x lda $2B sta $01,x lda $2C sta $02,x lda $2D sta $03,x rts LBE55: clc LBE56: tya adc $3D sta $3D bcc LBE5F inc $3E LBE5F: ldy #$01 rts LBE62: jsr LBEDD ; FILE.LOAD=PAGE tay lda #$FF sty F_EXEC ; FILE.EXEC=0, load to specified address ldx #$37 jsr OSFILE ; Scan program to check consistency and find TOP ; ---------------------------------------------- LBE6F: lda $18 sta $13 ldy #$00 ; Point TOP to PAGE sty $12 iny LBE78: dey ; Get byte preceding line lda ($12),y cmp #$0D ; Not <cr>, jump to 'Bad program' bne LBE9E iny ; Step to line number/terminator lda ($12),y bmi LBE90 ldy #$03 ; Point to line length lda ($12),y ; Zero length, jump to 'Bad program' beq LBE9E clc ; Update TOP to point to next line jsr LBE93 bne LBE78 ; Loop to check next line ; End of program found, set TOP ; ----------------------------- LBE90: iny clc LBE92: tya LBE93: adc $12 ; TOP=TOP+A sta $12 bcc LBE9B inc $13 LBE9B: ldy #$01 ; Return Y=1, NE rts ; Report 'Bad program' and jump to immediate mode ; ----------------------------------------------- LBE9E: jsr LBFCF ; Print inline text .byte 13, "Bad program", 13 nop jmp L8AF6 ; Jump to immediate mode ; Point &37/8 to <cr>-terminated string in string buffer ; ------------------------------------------------------ LBEB2: lda #$00 sta $37 lda #$06 sta $38 LBEBA: ldy $36 lda #$0D sta $0600,y rts ; OSCLI string$ - Pass string to OSCLI to execute ; =============================================== LBEC2: jsr LBED2 ; $37/8=>cr-string ldx #$00 ldy #$0600 / 256 jsr OS_CLI ; Call OSCLI and return to execution loop jmp L8B9B LBECF: jmp L8C0E LBED2: jsr L9B1D ; Evaluate expression, error if not string bne LBECF jsr LBEB2 ; Convert to <cr>-string, check end of statement jmp L984C ; Set FILE.LOAD to MEMHI.PAGE ; --------------------------- LBEDD: jsr LBED2 ; LOAD.lo=&00 dey sty F_LOAD+0 lda $18 ; LOAD.hi=PAGEhi sta F_LOAD+1 LBEE7: lda #$82 ; Get memory base high word jsr OSBYTE stx F_LOAD+2 ; Set LOAD high word sty F_LOAD+3 lda #$00 rts ; SAVE string$ ; ============= LBEF3: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr LBE6F ; Set FILE.END to TOP lda $12 sta F_END+0 ; Set FILE.END to TOP lda $13 sta F_END+1 lda #L8023 & 255 ; Set FILE.EXEC to STARTUP sta F_EXEC+0 lda #L8023 / 256 sta F_EXEC+1 lda $18 ; Set FILE.START to PAGE sta F_START+1 jsr LBEDD ; Set FILE.LOAD to PAGE stx F_EXEC+2 ; Set address high words sty F_EXEC+3 stx F_START+2 sty F_START+3 stx F_END+2 sty F_END+3 sta F_START+0 ; Low byte of FILE.START tay ldx #$37 jsr OSFILE jmp L8B9B .endif ; LOAD string$ ; ============ LBF24: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr LBE62 ; Do LOAD, jump to immediate mode jmp L8AF3 .endif ; CHAIN string$ ; ============= LBF2A: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr LBE62 ; Do LOAD, jump to execution loop jmp LBD14 .endif ; PTR#numeric=numeric ; =================== LBF30: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr LBFA9 ; Evaluate #handle pha jsr L9813 ; Step past '=', evaluate integer jsr L92EE pla ; Get handle, point to IntA tay ldx #$2A lda #$01 jsr OSARGS jmp L8B9B ; Jump to execution loop .endif ; =EXT#numeric - Read file pointer via OSARGS ; =========================================== LBF46: .if .defined (PSBC) jmp L9821 ; Syntax error .else sec ; Flag to do =EXT .endif ; =PTR#numeric - Read file pointer via OSARGS ; =========================================== LBF47: lda #$00 ; A=0 or 1 for =PTR or =EXT rol a rol a pha ; Atom - A=0/1, BBC - A=0/2 jsr LBFB5 ; Evaluate #handle, point to IntA ldx #$2A pla jsr OSARGS lda #$40 ; Return integer rts ; BPUT#numeric, numeric ; ===================== LBF58: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr LBFA9 ; Evaluate #handle pha jsr L8AAE jsr L9849 jsr L92EE pla tay lda $2A jsr OSBPUT ; Call OSBPUT, jump to execution loop jmp L8B9B .endif ;=BGET#numeric ;============= LBF6F: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr LBFB5 ; Evaluate #handle jsr OSBGET jmp LAED8 ; Jump to return 8-bit integer .endif ; OPENIN f$ - Call OSFIND to open file for input ; ============================================== LBF78: .if .defined (PSBC) jmp L9821 ; Syntax error .else lda #$40 ; $40=OPENUP bne LBF82 .endif ; OPENOUT f$ - Call OSFIND to open file for output ; ================================================ LBF7C: .if .defined (PSBC) jmp L9821 ; Syntax error .else lda #$80 ; $80=OPENOUT bne LBF82 .endif ; OPENUP f$ - Call OSFIND to open file for update ; =============================================== LBF80: .if .defined (PSBC) jmp L9821 ; Syntax error .else lda #$C0 ; $C0=OPENUP LBF82: pha jsr LADEC ; Evaluate, if not string, jump to error bne LBF96 jsr LBEBA ; Terminate string with <cr> ldx #$00 ; Point to string buffer, get action back ldy #$06 pla jsr OSFIND ; Pass to OSFIND, jump to return integer from A jmp LAED8 LBF96: jmp L8C0E ; Jump to 'Type mismatch' error .endif ; CLOSE#numeric ; ============= LBF99: .if .defined (PSBC) jmp L9821 ; Syntax error .else jsr LBFA9 ; Evaluate #handle, check end of statement jsr L9852 ldy $2A ; Get handle from IntA lda #$00 jsr OSFIND jmp L8B9B ; Jump back to execution loop .endif ; Copy PtrA to PtrB, then get handle ; ================================== LBFA9: lda $0A ; Set PtrB to program pointer in PtrA sta $1B lda $0B sta $19 lda $0C sta $1A ; Check for '#', evaluate channel ; =============================== LBFB5: jsr L8A8C ; Skip spaces cmp #'#' ; If not '#', jump to give error bne LBFC3 jsr L92E3 ; Evaluate as integer LBFBF: ldy $2A ; Get low byte and return tya rts LBFC3: brk .byte $2D, "Missing #" brk ; Print inline text ; ================= LBFCF: pla ; Pop return address to pointer sta $37 pla sta $38 ldy #$00 ; Jump into loop beq LBFDC LBFD9: jsr OSASCI ; Print character LBFDC: jsr L894B ; Update pointer, get character, loop if b7=0 bpl LBFD9 jmp ($0037) ; Jump back to program ; REPORT ; ====== LBFE4: jsr L9857 ; Check end of statement, print newline, clear COUNT jsr LBC25 ldy #$01 LBFEC: lda (FAULT),y ; Get byte, exit if &00 terminator beq LBFF6 jsr LB50E ; Print character or token, loop for next iny bne LBFEC LBFF6: jmp L8B9B ; Jump to main execution loop brk .byte "Roger" brk LC000: .if .defined(PSBC) .include "mos.asm" .endif
scripts/qt7play.applescript
slpopejoy/fadno
13
1621
<reponame>slpopejoy/fadno<filename>scripts/qt7play.applescript<gh_stars>10-100 #!/usr/bin/osascript on run(arguments) set fpath to POSIX path of (first item of arguments) set AppleScript's text item delimiters to "/" set fname to text item -1 of fpath --display dialog fname tell application "QuickTime Player 7" try repeat with i from 1 to the 30 tell document i set dname to get name if dname is fname then close end if end tell end repeat on error end try open fpath delay 0.5 tell document 1 play end tell end tell end run
src/core/external/jpeg-6bx/jsimddjg.asm
miahmie/krkrz
4
15347
; ; jsimddjg.asm - SIMD instruction support check (for DJGPP V.2) ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. ; For conditions of distribution and use, see copyright notice in jsimdext.inc ; ; This file should be assembled with NASM (Netwide Assembler), ; can *not* be assembled with Microsoft's MASM or any compatible ; assembler (including Borland's Turbo Assembler). ; NASM is available from http://nasm.sourceforge.net/ or ; http://sourceforge.net/project/showfiles.php?group_id=6208 ; ; Last Modified : September 26, 2004 ; ; [TAB8] %include "jsimdext.inc" ; -------------------------------------------------------------------------- SECTION SEG_TEXT BITS 32 ; ; Check if the OS supports SIMD instructions (DJGPP V.2) ; ; GLOBAL(unsigned int) ; jpeg_simd_os_support (unsigned int simd) ; %define EXCEPTION_ILLEGAL_INSTRUCTION 6 ; vector number of #UD %define simd ebp+8 ; unsigned int simd %define mxcsr ebp-4 ; unsigned int mxcsr = 0x1F80 align 16 global EXTN(jpeg_simd_os_support) EXTN(jpeg_simd_os_support): push ebp mov ebp,esp push dword 0x1F80 ; default value of MXCSR register push ebx push DWORD [simd] ; simd_flags - modified from exception_handler mov bl, EXCEPTION_ILLEGAL_INSTRUCTION mov ax, 0x0202 ; Get Processor Exception Handler Vector int 0x31 ; DPMI function call push ecx ; selector of old exception handler push edx ; offset of old exception handler mov ecx,cs mov edx, exception_handler mov bl, EXCEPTION_ILLEGAL_INSTRUCTION mov ax, 0x0203 ; Set Processor Exception Handler Vector int 0x31 ; DPMI function call mov eax, DWORD [simd] ; If floating point emulation is enabled (CR0.EM = 1), ; executing an MMX/3DNow! instruction generates invalid ; opcode exception (#UD). push byte (.mmx_1 - .mmx_0) ; inst_bytes push byte (JSIMD_MMX | JSIMD_3DNOW) ; test_flags test eax, DWORD [esp] jz short .mmx_1 .mmx_0: emms ; executing MMX instruction .mmx_1: add esp, byte 8 push byte (.sse_1 - .sse_0) push byte (JSIMD_SSE | JSIMD_SSE2) test eax, DWORD [esp] jz short .sse_1 .sse_0: ldmxcsr DWORD [mxcsr] ; executing SSE instruction .sse_1: add esp, byte 8 pop edx ; offset of old exception handler pop ecx ; selector of old exception handler mov bl, EXCEPTION_ILLEGAL_INSTRUCTION mov ax, 0x0203 ; Set Processor Exception Handler Vector int 0x31 ; DPMI function call pop eax ; return simd_flags and eax, byte JSIMD_ALL pop ebx mov esp,ebp pop ebp ret ; -------------------------------------------------------------------------- ; ; LOCAL(void) far ; exception_handler (unsigned long error_code, ; void * context_eip, unsigned short context_cs, ; unsigned long context_eflags, ; void * context_esp, unsigned short context_ss); ; %define error_code esp+12+8 ; unsigned long error_code %define context_eip esp+12+12 ; void * context_eip %define context_cs esp+12+16 ; unsigned short context_cs %define context_eflags esp+12+20 ; unsigned long context_eflags %define context_esp esp+12+24 ; void * context_esp %define context_ss esp+12+28 ; unsigned short context_ss %define test_flags(b) (b)+0 %define inst_bytes(b) (b)+4 %define simd_flags(b) (b)+16 align 16 exception_handler: push eax push ecx push edx mov eax, POINTER [context_esp] mov ecx, DWORD [test_flags(eax)] mov edx, DWORD [inst_bytes(eax)] not ecx add POINTER [context_eip], edx ; next instruction and DWORD [simd_flags(eax)], ecx ; turn off flag pop edx pop ecx pop eax retf
packages/cashc/src/grammar/CashScript.g4
Sydwell/cashscript
0
3244
<gh_stars>0 grammar CashScript; sourceFile : pragmaDirective* contractDefinition EOF ; pragmaDirective : 'pragma' pragmaName pragmaValue ';' ; pragmaName : 'cashscript' ; pragmaValue : versionConstraint versionConstraint? ; versionConstraint : versionOperator? VersionLiteral ; versionOperator : '^' | '~' | '>=' | '>' | '<' | '<=' | '=' ; contractDefinition : 'contract' Identifier parameterList '{' functionDefinition* '}' ; functionDefinition : 'function' Identifier parameterList '{' statement* '}' ; parameterList : '(' (parameter (',' parameter)* ','?)? ')' ; parameter : typeName Identifier ; block : '{' statement* '}' | statement ; statement : variableDefinition | assignStatement | timeOpStatement | requireStatement | ifStatement ; variableDefinition : typeName Identifier '=' expression ';' ; assignStatement : Identifier '=' expression ';' ; timeOpStatement : 'require' '(' TxVar '>=' expression ')' ';' ; requireStatement : 'require' '(' expression ')' ';' ; ifStatement : 'if' '(' expression ')' ifBlock=block ('else' elseBlock=block)? ; functionCall : Identifier expressionList // Only built-in functions are accepted ; expressionList : '(' (expression (',' expression)* ','?)? ')' ; expression : '(' expression ')' # Parenthesised | typeName '(' castable=expression (',' size=expression)? ','? ')' # Cast | functionCall # FunctionCallExpression | 'new' Identifier expressionList #Instantiation | expression '[' index=NumberLiteral ']' # TupleIndexOp | expression op=('.reverse()' | '.length') # UnaryOp | op=('!' | '-') expression # UnaryOp // | expression '**' expression --- OP_POW does not exist in BCH Script // | expression ('*' | '/' | '%') expression --- OP_MUL is disabled in BCH Script | left=expression op='.split' '(' right=expression ')' # BinaryOp | left=expression op=('/' | '%') right=expression # BinaryOp | left=expression op=('+' | '-') right=expression # BinaryOp // | expression ('>>' | '<<') expression --- OP_LSHIFT & RSHIFT are disabled in BCH Script | left=expression op=('<' | '<=' | '>' | '>=') right=expression # BinaryOp | left=expression op=('==' | '!=') right=expression # BinaryOp | left=expression op='&' right=expression # BinaryOp | left=expression op='^' right=expression # BinaryOp | left=expression op='|' right=expression # BinaryOp | left=expression op='&&' right=expression # BinaryOp | left=expression op='||' right=expression # BinaryOp | '[' (expression (',' expression)* ','?)? ']' # Array | PreimageField # PreimageField | Identifier # Identifier | literal # LiteralExpression ; literal : BooleanLiteral | numberLiteral | StringLiteral | DateLiteral | HexLiteral ; numberLiteral : NumberLiteral NumberUnit? ; typeName : 'int' | 'bool' | 'string' | 'pubkey' | 'sig' | 'datasig' | Bytes ; VersionLiteral : [0-9]+ '.' [0-9]+ '.' [0-9]+ ; BooleanLiteral : 'true' | 'false' ; NumberUnit : 'satoshis' | 'sats' | 'finney' | 'bits' | 'bitcoin' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' ; NumberLiteral : [-]?[0-9]+ ([eE] [0-9]+)? ; Bytes : 'bytes' Bound? ; Bound : [1-9] [0-9]* ; StringLiteral : '"' ('\\"' | ~["\r\n])*? '"' | '\'' ('\\\'' | ~['\r\n])*? '\'' ; DateLiteral : 'date(' StringLiteral ')' ; HexLiteral : '0' [xX] [0-9A-Fa-f]* ; TxVar : 'tx.age' | 'tx.time' ; PreimageField : 'tx.version' | 'tx.hashPrevouts' | 'tx.hashSequence' | 'tx.outpoint' | 'tx.bytecode' | 'tx.value' | 'tx.sequence' | 'tx.hashOutputs' | 'tx.locktime' | 'tx.hashtype' | 'tx.preimage' ; Identifier : [a-zA-Z] [a-zA-Z0-9_]* ; WHITESPACE : [ \t\r\n\u000C]+ -> skip ; COMMENT : '/*' .*? '*/' -> channel(HIDDEN) ; LINE_COMMENT : '//' ~[\r\n]* -> channel(HIDDEN) ;
src/SystemF/WtTerm.agda
sstucki/system-f-agda
68
16645
------------------------------------------------------------------------ -- Well-typed polymorphic and iso-recursive lambda terms ------------------------------------------------------------------------ module SystemF.WtTerm where import Category.Functor as Functor import Category.Applicative.Indexed as Applicative open Functor.Morphism using (op-<$>) open import Data.Fin using (Fin; zero; suc; inject+) open import Data.Fin.Substitution open import Data.Fin.Substitution.Lemmas open import Data.List using (List; _∷_) open import Data.List.All using (All; []; _∷_) open import Data.Nat using (zero; suc; ℕ; _+_) open import Data.Product using (_,_) open import Data.Vec using (Vec; []; _∷_; _++_; lookup; map; toList; zip) open import Data.Vec.Properties using (map-∘; map-cong; lookup-++-inject+) open import Data.Vec.Categorical using (lookup-functor-morphism) open import Function as Fun using (_∘_) open import Relation.Binary.PropositionalEquality as PropEq using (_≡_; refl; cong; cong₂; subst; sym) open PropEq.≡-Reasoning open import Relation.Nullary using (¬_) open import SystemF.Type open import SystemF.Term ------------------------------------------------------------------------ -- Typing derivations for polymorphic and iso-recursive lambda terms -- Typing contexts mapping free (term) variables to types. A context -- of type Ctx m n maps m free variables to types containing up to n -- free type variables each. Ctx : ℕ → ℕ → Set Ctx m n = Vec (Type n) m -- Type and variable substitutions lifted to typing contexts module CtxSubst where infixl 8 _/_ _/Var_ -- Type substitution lifted to typing contexts _/_ : ∀ {m n k} → Ctx m n → Sub Type n k → Ctx m k Γ / σ = Γ TypeSubst.⊙ σ -- Weakening of typing contexts with additional type variables weaken : ∀ {m n} → Ctx m n → Ctx m (1 + n) weaken Γ = map TypeSubst.weaken Γ -- Variable substitution (renaming) lifted to typing contexts _/Var_ : ∀ {m n k} → Sub Fin m k → Ctx k n → Ctx m n σ /Var Γ = map (λ x → lookup Γ x) σ open TypeSubst using () renaming (_[/_] to _[/tp_]) open CtxSubst using () renaming (weaken to weakenCtx) infix 4 _⊢_∈_ _⊢_∉_ _⊢val_∈_ _⊢ⁿ_∈_ infixl 9 _·_ _[_] -- Typing derivations for well-typed terms data _⊢_∈_ {m n} (Γ : Ctx m n) : Term m n → Type n → Set where var : (x : Fin m) → Γ ⊢ var x ∈ lookup Γ x Λ : ∀ {t a} → (weakenCtx Γ) ⊢ t ∈ a → Γ ⊢ Λ t ∈ ∀' a λ' : ∀ {t b} → (a : Type n) → a ∷ Γ ⊢ t ∈ b → Γ ⊢ λ' a t ∈ a →' b μ : ∀ {t} → (a : Type n) → a ∷ Γ ⊢ t ∈ a → Γ ⊢ μ a t ∈ a _[_] : ∀ {t a} → Γ ⊢ t ∈ ∀' a → (b : Type n) → Γ ⊢ t [ b ] ∈ a [/tp b ] _·_ : ∀ {s t a b} → Γ ⊢ s ∈ a →' b → Γ ⊢ t ∈ a → Γ ⊢ s · t ∈ b fold : ∀ {t} → (a : Type (1 + n)) → Γ ⊢ t ∈ a [/tp μ a ] → Γ ⊢ fold a t ∈ μ a unfold : ∀ {t} → (a : Type (1 + n)) → Γ ⊢ t ∈ μ a → Γ ⊢ unfold a t ∈ a [/tp μ a ] -- Negation of well-typedness. _⊢_∉_ : ∀ {m n} → Ctx m n → Term m n → Type n → Set Γ ⊢ t ∉ a = ¬ Γ ⊢ t ∈ a -- Typing derivations for well-typed values. data _⊢val_∈_ {m n} (Γ : Ctx m n) : Val m n → Type n → Set where Λ : ∀ {t a} → (weakenCtx Γ) ⊢ t ∈ a → Γ ⊢val Λ t ∈ ∀' a λ' : ∀ {t b} → (a : Type n) → a ∷ Γ ⊢ t ∈ b → Γ ⊢val λ' a t ∈ a →' b fold : ∀ {v} → (a : Type (1 + n)) → Γ ⊢val v ∈ a [/tp μ a ] → Γ ⊢val fold a v ∈ μ a -- Conversion from well-typed values to well-typed terms. ⊢⌜_⌝ : ∀ {m n} {Γ : Ctx m n} {v a} → Γ ⊢val v ∈ a → Γ ⊢ ⌜ v ⌝ ∈ a ⊢⌜ Λ x ⌝ = Λ x ⊢⌜ λ' a t ⌝ = λ' a t ⊢⌜ fold a t ⌝ = fold a ⊢⌜ t ⌝ -- Collections of typing derivations for well-typed terms. data _⊢ⁿ_∈_ {m n} (Γ : Ctx m n) : ∀ {k} → Vec (Term m n) k → Vec (Type n) k → Set where [] : Γ ⊢ⁿ [] ∈ [] _∷_ : ∀ {t a k} {ts : Vec (Term m n) k} {as : Vec (Type n) k} → Γ ⊢ t ∈ a → Γ ⊢ⁿ ts ∈ as → Γ ⊢ⁿ t ∷ ts ∈ a ∷ as -- Lookup a well-typed term in a collection thereof. lookup-⊢ : ∀ {m n k} {Γ : Ctx m n} {ts : Vec (Term m n) k} {as : Vec (Type n) k} → (x : Fin k) → Γ ⊢ⁿ ts ∈ as → Γ ⊢ lookup ts x ∈ lookup as x lookup-⊢ zero (⊢t ∷ ⊢ts) = ⊢t lookup-⊢ (suc x) (⊢t ∷ ⊢ts) = lookup-⊢ x ⊢ts ------------------------------------------------------------------------ -- Lemmas about type and variable substitutions (renaming) lifted to -- typing contexts module CtxLemmas where open CtxSubst public private module Tp = TypeLemmas private module Var = VarSubst -- Term variable substitution (renaming) commutes with type -- substitution. /Var-/ : ∀ {m n k l} (ρ : Sub Fin m k) (Γ : Ctx k n) (σ : Sub Type n l) → (ρ /Var Γ) / σ ≡ ρ /Var (Γ / σ) /Var-/ ρ Γ σ = begin (ρ /Var Γ) / σ ≡⟨ sym (map-∘ _ _ ρ) ⟩ map (λ x → (lookup Γ x) Tp./ σ) ρ ≡⟨ map-cong (λ x → sym (Tp.lookup-⊙ x {ρ₁ = Γ})) ρ ⟩ map (λ x → lookup (Γ / σ) x) ρ ∎ -- Term variable substitution (renaming) commutes with weakening of -- typing contexts with an additional type variable. /Var-weaken : ∀ {m n k} (ρ : Sub Fin m k) (Γ : Ctx k n) → weaken (ρ /Var Γ) ≡ ρ /Var (weaken Γ) /Var-weaken ρ Γ = begin weaken (ρ /Var Γ) ≡⟨ Tp.map-weaken ⟩ (ρ /Var Γ) / Tp.wk ≡⟨ /Var-/ ρ Γ Tp.wk ⟩ ρ /Var (Γ / Tp.wk) ≡⟨ sym (cong (_/Var_ ρ) (Tp.map-weaken {ρ = Γ})) ⟩ ρ /Var (weaken Γ) ∎ -- Term variable substitution (renaming) commutes with term variable -- lookup in typing context. /Var-lookup : ∀ {m n k} (x : Fin m) (ρ : Sub Fin m k) (Γ : Ctx k n) → lookup (ρ /Var Γ) x ≡ lookup Γ (lookup ρ x) /Var-lookup x ρ Γ = op-<$> (lookup-functor-morphism x) (λ x → lookup Γ x) ρ -- Term variable substitution (renaming) commutes with weakening of -- typing contexts with an additional term variable. /Var-∷ : ∀ {m n k} (a : Type n) (ρ : Sub Fin m k) (Γ : Ctx k n) → a ∷ (ρ /Var Γ) ≡ (ρ Var.↑) /Var (a ∷ Γ) /Var-∷ a [] Γ = refl /Var-∷ a (x ∷ ρ) Γ = cong (_∷_ a) (cong (_∷_ (lookup Γ x)) (begin map (λ x → lookup Γ x) ρ ≡⟨ refl ⟩ map (λ x → lookup (a ∷ Γ) (suc x)) ρ ≡⟨ map-∘ _ _ ρ ⟩ map (λ x → lookup (a ∷ Γ) x) (map suc ρ) ∎)) -- Invariants of term variable substitution (renaming) idVar-/Var : ∀ {m n} (Γ : Ctx m n) → Γ ≡ (Var.id /Var Γ) wkVar-/Var-∷ : ∀ {m n} (Γ : Ctx m n) (a : Type n) → Γ ≡ (Var.wk /Var (a ∷ Γ)) idVar-/Var [] = refl idVar-/Var (a ∷ Γ) = cong (_∷_ a) (wkVar-/Var-∷ Γ a) wkVar-/Var-∷ Γ a = begin Γ ≡⟨ idVar-/Var Γ ⟩ Var.id /Var Γ ≡⟨ map-∘ _ _ VarSubst.id ⟩ Var.wk /Var (a ∷ Γ) ∎ ------------------------------------------------------------------------ -- Substitutions in well-typed terms -- Helper lemmas for applying type and term equalities in typing -- derivations ⊢subst : ∀ {m n} {Γ₁ Γ₂ : Ctx m n} {t₁ t₂ : Term m n} {a₁ a₂ : Type n} → Γ₁ ≡ Γ₂ → t₁ ≡ t₂ → a₁ ≡ a₂ → Γ₁ ⊢ t₁ ∈ a₁ → Γ₂ ⊢ t₂ ∈ a₂ ⊢subst refl refl refl hyp = hyp ⊢substCtx : ∀ {m n} {Γ₁ Γ₂ : Ctx m n} {t : Term m n} {a : Type n} → Γ₁ ≡ Γ₂ → Γ₁ ⊢ t ∈ a → Γ₂ ⊢ t ∈ a ⊢substCtx refl hyp = hyp ⊢substTp : ∀ {m n} {Γ : Ctx m n} {t : Term m n} {a₁ a₂ : Type n} → a₁ ≡ a₂ → Γ ⊢ t ∈ a₁ → Γ ⊢ t ∈ a₂ ⊢substTp refl hyp = hyp -- Type substitutions lifted to well-typed terms module WtTermTypeSubst where open TypeLemmas hiding (_/_; _[/_]; weaken) private module Tp = TypeLemmas module Tm = TermTypeLemmas module C = CtxSubst infixl 8 _/_ -- Type substitutions lifted to well-typed terms _/_ : ∀ {m n k} {Γ : Ctx m n} {t : Term m n} {a : Type n} → Γ ⊢ t ∈ a → (σ : Sub Type n k) → Γ C./ σ ⊢ t Tm./ σ ∈ a Tp./ σ _/_ {Γ = Γ} (var x) σ = ⊢substTp (lookup-⊙ x {ρ₁ = Γ}) (var x) _/_ {Γ = Γ} (Λ ⊢t) σ = Λ (⊢substCtx (sym (map-weaken-⊙ Γ σ)) (⊢t / σ ↑)) λ' a ⊢t / σ = λ' (a Tp./ σ) (⊢t / σ) μ a ⊢t / σ = μ (a Tp./ σ) (⊢t / σ) _[_] {a = a} ⊢t b / σ = ⊢substTp (sym (sub-commutes a)) ((⊢t / σ) [ b Tp./ σ ]) ⊢s · ⊢t / σ = (⊢s / σ) · (⊢t / σ) fold a ⊢t / σ = fold (a Tp./ σ ↑) (⊢substTp (sub-commutes a) (⊢t / σ)) unfold a ⊢t / σ = ⊢substTp (sym (sub-commutes a)) (unfold (a Tp./ σ ↑) (⊢t / σ)) -- Weakening of terms with additional type variables lifted to -- well-typed terms. weaken : ∀ {m n} {Γ : Ctx m n} {t : Term m n} {a : Type n} → Γ ⊢ t ∈ a → C.weaken Γ ⊢ Tm.weaken t ∈ Tp.weaken a weaken {t = t} {a = a} ⊢t = ⊢subst (sym map-weaken) (Tm./-wk t) (/-wk {t = a}) (⊢t / wk) -- Weakening of terms with additional type variables lifted to -- collections of well-typed terms. weakenAll : ∀ {m n k} {Γ : Ctx m n} {ts : Vec (Term m n) k} {as : Vec (Type n) k} → Γ ⊢ⁿ ts ∈ as → C.weaken Γ ⊢ⁿ map Tm.weaken ts ∈ map Tp.weaken as weakenAll {ts = []} {[]} [] = [] weakenAll {ts = _ ∷ _} {_ ∷ _} (⊢t ∷ ⊢ts) = weaken ⊢t ∷ weakenAll ⊢ts -- Shorthand for single-variable type substitutions in well-typed -- terms. _[/_] : ∀ {m n} {Γ : Ctx m (1 + n)} {t a} → Γ ⊢ t ∈ a → (b : Type n) → Γ C./ sub b ⊢ t Tm./ sub b ∈ a Tp./ sub b ⊢t [/ b ] = ⊢t / sub b -- A weakened version of the shorthand for single-variable type -- substitutions that fits well with well-typed type application. _[/_]′ : ∀ {m n} {Γ : Ctx m n} {t a} → C.weaken Γ ⊢ t ∈ a → (b : Type n) → Γ ⊢ t Tm./ sub b ∈ a Tp./ sub b ⊢t [/ b ]′ = ⊢substCtx Tp.map-weaken-⊙-sub (⊢t / sub b) -- Term substitutions lifted to well-typed terms module WtTermTermSubst where private module Tp = TermTypeSubst module Tm = TermTermSubst module Var = VarSubst module C = CtxLemmas TmSub = Tm.TermSub Term infix 4 _⇒_⊢_ -- Well-typed term substitutions are collections of well-typed terms. _⇒_⊢_ : ∀ {m n k} → Ctx m n → Ctx k n → TmSub m n k → Set Γ ⇒ Δ ⊢ ρ = Δ ⊢ⁿ ρ ∈ Γ infixl 8 _/_ _/Var_ infix 10 _↑ -- Application of term variable substitutions (renaming) lifted to -- well-typed terms. _/Var_ : ∀ {m n k} {Γ : Ctx k n} {t : Term m n} {a : Type n} (ρ : Sub Fin m k) → ρ C./Var Γ ⊢ t ∈ a → Γ ⊢ t Tm./Var ρ ∈ a _/Var_ {Γ = Γ} ρ (var x) = ⊢substTp (sym (C./Var-lookup x ρ Γ)) (var (lookup ρ x)) _/Var_ {Γ = Γ} ρ (Λ ⊢t) = Λ (ρ /Var ⊢substCtx (C./Var-weaken ρ Γ) ⊢t) _/Var_ {Γ = Γ} ρ (λ' a ⊢t) = λ' a (ρ Var.↑ /Var ⊢substCtx (C./Var-∷ a ρ Γ) ⊢t) _/Var_ {Γ = Γ} ρ (μ a ⊢t) = μ a (ρ Var.↑ /Var ⊢substCtx (C./Var-∷ a ρ Γ) ⊢t) ρ /Var (⊢t [ b ]) = (ρ /Var ⊢t) [ b ] ρ /Var (⊢s · ⊢t) = (ρ /Var ⊢s) · (ρ /Var ⊢t) ρ /Var (fold a ⊢t) = fold a (ρ /Var ⊢t) ρ /Var (unfold a ⊢t) = unfold a (ρ /Var ⊢t) -- Weakening of terms with additional term variables lifted to -- well-typed terms. weaken : ∀ {m n} {Γ : Ctx m n} {t : Term m n} {a b : Type n} → Γ ⊢ t ∈ a → b ∷ Γ ⊢ Tm.weaken t ∈ a weaken {Γ = Γ} {b = b} ⊢t = Var.wk /Var ⊢substCtx (C.wkVar-/Var-∷ Γ b) ⊢t -- Weakening of terms with additional term variables lifted to -- collections of well-typed terms. weakenAll : ∀ {m n k} {Γ : Ctx m n} {ts : Vec (Term m n) k} {as : Vec (Type n) k} {b : Type n} → Γ ⊢ⁿ ts ∈ as → b ∷ Γ ⊢ⁿ map Tm.weaken ts ∈ as weakenAll {ts = []} {[]} [] = [] weakenAll {ts = _ ∷ _} {_ ∷ _} (⊢t ∷ ⊢ts) = weaken ⊢t ∷ weakenAll ⊢ts -- Lifting of well-typed term substitutions. _↑ : ∀ {m n k} {Γ : Ctx m n} {Δ : Ctx k n} {ρ b} → Γ ⇒ Δ ⊢ ρ → b ∷ Γ ⇒ b ∷ Δ ⊢ ρ Tm.↑ ⊢ρ ↑ = var zero ∷ weakenAll ⊢ρ -- The well-typed identity substitution. id : ∀ {m n} {Γ : Ctx m n} → Γ ⇒ Γ ⊢ Tm.id id {zero} {Γ = []} = [] id {suc m} {Γ = a ∷ Γ} = id ↑ -- Well-typed weakening (as a substitution). wk : ∀ {m n} {Γ : Ctx m n} {a} → Γ ⇒ a ∷ Γ ⊢ Tm.wk wk = weakenAll id -- A well-typed substitution which only replaces the first variable. sub : ∀ {m n} {Γ : Ctx m n} {t a} → Γ ⊢ t ∈ a → a ∷ Γ ⇒ Γ ⊢ Tm.sub t sub ⊢t = ⊢t ∷ id -- Application of term substitutions lifted to well-typed terms _/_ : ∀ {m n k} {Γ : Ctx m n} {Δ : Ctx k n} {t a ρ} → Γ ⊢ t ∈ a → Γ ⇒ Δ ⊢ ρ → Δ ⊢ t Tm./ ρ ∈ a var x / ⊢ρ = lookup-⊢ x ⊢ρ Λ ⊢t / ⊢ρ = Λ (⊢t / (WtTermTypeSubst.weakenAll ⊢ρ)) λ' a ⊢t / ⊢ρ = λ' a (⊢t / ⊢ρ ↑) μ a ⊢t / ⊢ρ = μ a (⊢t / ⊢ρ ↑) (⊢t [ a ]) / ⊢ρ = (⊢t / ⊢ρ) [ a ] (⊢s · ⊢t) / ⊢ρ = (⊢s / ⊢ρ) · (⊢t / ⊢ρ) fold a ⊢t / ⊢ρ = fold a (⊢t / ⊢ρ) unfold a ⊢t / ⊢ρ = unfold a (⊢t / ⊢ρ) -- Shorthand for well-typed single-variable term substitutions. _[/_] : ∀ {m n} {Γ : Ctx m n} {s t a b} → b ∷ Γ ⊢ s ∈ a → Γ ⊢ t ∈ b → Γ ⊢ s Tm./ Tm.sub t ∈ a ⊢s [/ ⊢t ] = ⊢s / sub ⊢t ------------------------------------------------------------------------ -- Encoding of additional well-typed term operators -- -- These correspond to admissible typing rules for the asscociated -- term operators. module WtTermOperators where open TypeOperators renaming (id to idTp) open TypeOperatorLemmas open TypeLemmas hiding (id) private module Ut = TermOperators module ⊢Tp = WtTermTypeSubst module ⊢Tm = WtTermTermSubst -- Polymorphic identity function id : ∀ {m n} {Γ : Ctx m n} → Γ ⊢ Ut.id ∈ idTp id = Λ (λ' (var (zero)) (var zero)) -- Bottom elimination/univeral property of the initial type ⊥-elim : ∀ {m n} {Γ : Ctx m n} (a : Type n) → Γ ⊢ Ut.⊥-elim a ∈ ⊥ →' a ⊥-elim a = λ' ⊥ ((var zero) [ a ]) -- Unit value tt : ∀ {m n} {Γ : Ctx m n} → Γ ⊢ Ut.tt ∈ ⊤ tt = id -- Top introduction/universal property of the terminal type ⊤-intro : ∀ {m n} {Γ : Ctx m n} → (a : Type n) → Γ ⊢ Ut.⊤-intro a ∈ a →' ⊤ ⊤-intro {n = n} a = λ' a (id {n = n}) -- Packing existential types as-∃_pack_,_ : ∀ {m n} {Γ : Ctx m n} (a : Type (1 + n)) (b : Type n) {t : Term m n} → Γ ⊢ t ∈ a [/tp b ] → Γ ⊢ Ut.as-∃ a pack b , t ∈ ∃ a as-∃ a pack b , ⊢t = Λ (λ' (∀' (weaken↑ a →' var (suc zero))) ((var zero [ weaken b ]) · ⊢t′)) where ⊢t′ = ⊢Tm.weaken (⊢substTp (weaken-sub a b) (⊢Tp.weaken ⊢t)) -- Unpacking existential types unpack_in'_ : ∀ {m n} {Γ : Ctx m n} {s : Term m n} {t : Term (1 + m) (1 + n)} {a : Type (1 + n)} {b : Type n} → Γ ⊢ s ∈ ∃ a → a ∷ weakenCtx Γ ⊢ t ∈ weaken b → Γ ⊢ Ut.unpack_in'_ s t {a} {b} ∈ b unpack_in'_ {a = a} {b = b} ⊢s ⊢t = (⊢s [ b ]) · Λ (⊢substTp a≡ (λ' a ⊢t)) where a≡ : a →' weaken b ≡ weaken↑ a / (sub b) ↑ →' weaken b a≡ = cong (λ a → a →' weaken b) (begin a ≡⟨ sym (id-vanishes a) ⟩ a / TypeLemmas.id ≡⟨ cong (λ σ → a / σ) (sym (id-↑⋆ 1)) ⟩ a / (TypeLemmas.id) ↑ ≡⟨ cong (λ σ → a / σ ↑) (sym wk-⊙-sub) ⟩ a / (wk ⊙ sub b) ↑ ≡⟨ cong (λ σ → a / σ) (↑⋆-distrib 1) ⟩ a / wk ↑ ⊙ (sub b) ↑ ≡⟨ /-⊙ a ⟩ a / wk ↑ / (sub b) ↑ ∎) -- n-ary term abstraction λⁿ : ∀ {m n k} {Γ : Ctx m n} (as : Vec (Type n) k) {b : Type n} {t : Term (k + m) n} → as ++ Γ ⊢ t ∈ b → Γ ⊢ Ut.λⁿ as t ∈ as →ⁿ b λⁿ [] ⊢t = ⊢t λⁿ (a ∷ as) ⊢t = λⁿ as (λ' a ⊢t) infixl 9 _·ⁿ_ -- n-ary term application _·ⁿ_ : ∀ {m n k} {Γ : Ctx m n} {s : Term m n} {ts : Vec (Term m n) k} {as : Vec (Type n) k} {b : Type n} → Γ ⊢ s ∈ as →ⁿ b → Γ ⊢ⁿ ts ∈ as → Γ ⊢ s Ut.·ⁿ ts ∈ b _·ⁿ_ {ts = []} {[]} ⊢s [] = ⊢s _·ⁿ_ {ts = _ ∷ _} {_ ∷ _} ⊢s (⊢t ∷ ⊢ts) = ⊢s ·ⁿ ⊢ts · ⊢t -- Record/tuple constructor new : ∀ {m n k} {Γ : Ctx m n} {ts : Vec (Term m n) k} {as : Vec (Type n) k} → Γ ⊢ⁿ ts ∈ as → Γ ⊢ Ut.new ts {as} ∈ rec as new {ts = []} {[]} [] = tt new {ts = _ ∷ _} {a ∷ as} (⊢t ∷ ⊢ts) = Λ (λ' (map weaken (a ∷ as) →ⁿ var zero) (var zero ·ⁿ ⊢Tm.weakenAll (⊢Tp.weakenAll (⊢t ∷ ⊢ts)))) -- Field access/projection π : ∀ {m n k} {Γ : Ctx m n} (x : Fin k) {t : Term m n} {as : Vec (Type n) k} → Γ ⊢ t ∈ rec as → Γ ⊢ Ut.π x t {as} ∈ lookup as x π () {as = []} ⊢t π {m} {Γ = Γ} x {as = a ∷ as} ⊢t = (⊢t [ b ]) · ⊢substTp as′→ⁿb′≡ (λⁿ as′ (var x′)) where as′ = a ∷ as x′ = inject+ m x b = lookup as′ x b′ = lookup (as′ ++ Γ) x′ as′→ⁿb′≡ : as′ →ⁿ b′ ≡ (map weaken as′ →ⁿ var zero) [/tp b ] as′→ⁿb′≡ = begin as′ →ⁿ b′ ≡⟨ cong (λ b → as′ →ⁿ b) (lookup-++-inject+ as′ Γ x) ⟩ as′ →ⁿ b ≡⟨ cong (λ as′ → as′ →ⁿ b) (sym (map-weaken-⊙-sub {ρ = as′})) ⟩ map weaken as′ ⊙ sub b →ⁿ b ≡⟨ sym (/-→ⁿ (map weaken as′) (var zero) (sub b)) ⟩ (map weaken as′ →ⁿ var zero) [/tp b ] ∎
Task/Sorting-algorithms-Cocktail-sort/Ada/sorting-algorithms-cocktail-sort.ada
LaudateCorpus1/RosettaCodeData
1
16182
<filename>Task/Sorting-algorithms-Cocktail-sort/Ada/sorting-algorithms-cocktail-sort.ada with Ada.Text_Io; use Ada.Text_Io; procedure Cocktail_Sort_Test is procedure Cocktail_Sort (Item : in out String) is procedure Swap(Left, Right : in out Character) is Temp : Character := Left; begin Left := Right; Right := Temp; end Swap; Swapped : Boolean := False; begin loop for I in 1..Item'Last - 1 loop if Item(I) > Item(I + 1) then Swap(Item(I), Item(I + 1)); Swapped := True; end if; end loop; if not Swapped then for I in reverse 1..Item'Last - 1 loop if Item(I) > Item(I + 1) then Swap(Item(I), Item(I + 1)); Swapped := True; end if; end loop; end if; exit when not Swapped; Swapped := False; end loop; end Cocktail_Sort; Data : String := "big fjords vex quick waltz nymph"; begin Put_Line(Data); Cocktail_Sort(Data); Put_Line(Data); end Cocktail_Sort_Test;
alloy4fun_models/trashltl/models/15/gNRtijYdPuTNSHrHW.als
Kaixi26/org.alloytools.alloy
0
4986
<filename>alloy4fun_models/trashltl/models/15/gNRtijYdPuTNSHrHW.als open main pred idgNRtijYdPuTNSHrHW_prop16 { historically Protected = Protected } pred __repair { idgNRtijYdPuTNSHrHW_prop16 } check __repair { idgNRtijYdPuTNSHrHW_prop16 <=> prop16o }
oeis/153/A153218.asm
neoneye/loda-programs
11
26210
; A153218: Numbers n such that 6n + 7 is prime. ; Submitted by <NAME> ; 0,1,2,4,5,6,9,10,11,12,15,16,17,20,22,24,25,26,29,31,32,34,36,37,39,44,45,46,50,51,54,55,57,60,61,62,65,67,69,71,72,75,76,80,82,86,89,90,94,95,99,100,101,102,104,106,109,111,114,117,120,121,122,124,125,127,130,134,136,137,141,142,145,146,150,152,155,160,164,165,167,169,171,172,174,176,177,180,181,185,186,187,191,194,199,201,204,205,207,212 mov $2,$0 pow $2,2 lpb $2 add $4,6 mov $3,$4 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $1,$0 max $1,0 cmp $1,$0 mul $2,$1 sub $2,1 lpe mov $0,$4 div $0,6
test/asm_exe/complete.asm
nigelperks/BasicAssembler
0
22303
IDEAL SEGMENT image ASSUME CS:image, DS:image, SS:image, ES:image start: ;*************** OPCODES WITH NO EXPLICIT OPERANDS *************** aaa aad aam aas cbw clc cld cli cmc cmpsb cmpsw cwd daa das hlt iret lahf lodsb lodsw movsb movsw nop popf pushf sahf scasb scasw stc std sti stosb stosw wait xlatb FREDDY equ 1234h mov ax, bx ;*************** ADC WITH FULL ADDRESSING MODE COVERAGE *************** ; 1. ADC r/m8, r8 ; 1a. ADC r/m8, AL ; 1a0. ADC r/m8 mod 0, AL adc [bx+si], al adc [bx+di], al adc [bp+si], al adc [bp+di], al adc [si], al adc [di], al adc [7788h], al adc [bx], al ; 1a1. ADC r/m8 disp8, AL adc [bx+si+7fh], al adc [bx+di+7fh], al adc [bp+si+7fh], al adc [bp+di+7fh], al adc [si+7fh], al adc [di+7fh], al adc [bp+7fh], al adc [bx+7fh], al adc [bx+si-80h], al adc [bx+di-80h], al adc [bp+si-80h], al adc [bp+di-80h], al adc [si-80h], al adc [di-80h], al adc [bp-80h], al adc [bx-80h], al ; 1a2. ADC r/m8 disp16, AL adc [bx+si+80h], al adc [bx+di+81h], al adc [bp+si+7fffh], al adc [bp+di+7ffeh], al adc [si+80h], al adc [di+81h], al adc [bp+7fffh], al adc [bx+7ffeh], al adc [bx+si-81h], al adc [bx+di-0ffh], al adc [bp+si-100h], al adc [bp+di-8000h], al adc [si-81h], al adc [di-0ffh], al adc [bp-100h], al adc [bx-8000h], al ; 1a3. ADC r/m8 mod 3, AL adc al, al adc cl, al adc dl, al adc bl, al adc ah, al adc ch, al adc dh, al adc bh, al ; 1b. ADC r/m8, other r8 ; 1b0. ADC r/m8 mod 0, other r8 adc [bx+si], cl adc [bx+di], dl adc [bp+si], bl adc [bp+di], ah adc [si], ch adc [di], dh adc [7788h], bh adc [bx], cl ; 1b1. ADC r/m8 disp8, other r8 adc [bx+si+7fh], dl adc [bx+di+7fh], bl adc [bp+si+7fh], ah adc [bp+di+7fh], ch adc [si+7fh], dh adc [di+7fh], bh adc [bp+7fh], cl adc [bx+7fh], dl adc [bx+si-80h], bl adc [bx+di-80h], ah adc [bp+si-80h], ch adc [bp+di-80h], dh adc [si-80h], bh adc [di-80h], cl adc [bp-80h], dl adc [bx-80h], bl ; 1b2. ADC r/m8 disp16, other r8 adc [bx+si+80h], ah adc [bx+di+81h], ch adc [bp+si+7fffh], dh adc [bp+di+7ffeh], bh adc [si+80h], cl adc [di+81h], dl adc [bp+7fffh], bl adc [bx+7ffeh], ah adc [bx+si-81h], ch adc [bx+di-0ffh], dh adc [bp+si-100h], bh adc [bp+di-8000h], cl adc [si-81h], dl adc [di-0ffh], bl adc [bp-100h], ah adc [bx-8000h], ch ; 1b3. ADC r/m8 mod 3, other r8 adc al, dh adc cl, bh adc dl, dl adc bl, cl adc ah, bl adc ch, ch adc dh, dh adc bh, ah ; 2. ADC r/m16, r16 ; 2a. ADC r/m16, AX ; 2a0. ADC r/m16 mod 0, AX adc [bx+si], ax adc [bx+di], ax adc [bp+si], ax adc [bp+di], ax adc [si], ax adc [di], ax adc [7788h], ax adc [bx], ax ; 2a1. ADC r/m16 disp8, AX adc [bx+si+7fh], ax adc [bx+di+7fh], ax adc [bp+si+7fh], ax adc [bp+di+7fh], ax adc [si+7fh], ax adc [di+7fh], ax adc [bp+7fh], ax adc [bx+7fh], ax adc [bx+si-80h], ax adc [bx+di-80h], ax adc [bp+si-80h], ax adc [bp+di-80h], ax adc [si-80h], ax adc [di-80h], ax adc [bp-80h], ax adc [bx-80h], ax ; 2a2. ADC r/m16 disp16, AX adc [bx+si+80h], ax adc [bx+di+81h], ax adc [bp+si+7fffh], ax adc [bp+di+7ffeh], ax adc [si+80h], ax adc [di+81h], ax adc [bp+7fffh], ax adc [bx+7ffeh], ax adc [bx+si-81h], ax adc [bx+di-0ffh], ax adc [bp+si-100h], ax adc [bp+di-8000h], ax adc [si-81h], ax adc [di-0ffh], ax adc [bp-100h], ax adc [bx-8000h], ax ; 2a3. ADC r/m16 mod 3, AX adc ax, ax adc cx, ax adc dx, ax adc bx, ax adc sp, ax adc bp, ax adc si, ax adc di, ax ; 2b. ADC r/m16, other r16 ; 2b0. ADC r/m16 mod 0, other r16 adc [bx+si], cx adc [bx+di], dx adc [bp+si], bx adc [bp+di], sp adc [si], bp adc [di], si adc [7788h], di adc [bx], cx ; 2b1. ADC r/m16 disp8, other r16 adc [bx+si+7fh], dx adc [bx+di+7fh], bx adc [bp+si+7fh], sp adc [bp+di+7fh], bp adc [si+7fh], si adc [di+7fh], di adc [bp+7fh], cx adc [bx+7fh], dx adc [bx+si-80h], bx adc [bx+di-80h], sp adc [bp+si-80h], bp adc [bp+di-80h], si adc [si-80h], di adc [di-80h], cx adc [bp-80h], dx adc [bx-80h], bx ; 2b2. ADC r/m16 disp16, other r16 adc [bx+si+80h], sp adc [bx+di+81h], bp adc [bp+si+7fffh], si adc [bp+di+7ffeh], di adc [si+80h], cx adc [di+81h], dx adc [bp+7fffh], bx adc [bx+7ffeh], sp adc [bx+si-81h], bp adc [bx+di-0ffh], si adc [bp+si-100h], di adc [bp+di-8000h], cx adc [si-81h], dx adc [di-0ffh], bx adc [bp-100h], sp adc [bx-8000h], bp ; 2b3. ADC r/m16 mod 3, other r16 adc ax, cx adc cx, bx adc dx, dx adc bx, sp adc sp, bp adc bp, si adc si, di adc di, di ; 3. ADC r8, r/m8 ; 3a. ADC AL, r/m8 ; 3a0. ADC AL, r/m8 mod 0 adc al, [bx+si] adc al, [bx+di] adc al, [bp+si] adc al, [bp+di] adc al, [si] adc al, [di] adc al, [7788h] adc al, [bx] ; 3a1. ADC AL, r/m8 disp8 adc al, [bx+si+7fh] adc al, [bx+di+7fh] adc al, [bp+si+7fh] adc al, [bp+di+7fh] adc al, [si+7fh] adc al, [di+7fh] adc al, [bp+7fh] adc al, [bx+7fh] adc al, [bx+si-80h] adc al, [bx+di-80h] adc al, [bp+si-80h] adc al, [bp+di-80h] adc al, [si-80h] adc al, [di-80h] adc al, [bp-80h] adc al, [bx-80h] ; 3a2. ADC AL, r/m8 disp16 adc al, [bx+si+80h] adc al, [bx+di+81h] adc al, [bp+si+7fffh] adc al, [bp+di+7ffeh] adc al, [si+80h] adc al, [di+81h] adc al, [bp+7fffh] adc al, [bx+7ffeh] adc al, [bx+si-81h] adc al, [bx+di-0ffh] adc al, [bp+si-100h] adc al, [bp+di-8000h] adc al, [si-81h] adc al, [di-0ffh] adc al, [bp-100h] adc al, [bx-8000h] ; 3a3. ADC AL, r/m8 mod 3 adc al, al adc al, cl adc al, dl adc al, bl adc al, ah adc al, ch adc al, dh adc al, bh ; 3b. ADC other r8, r/m8 ; 3b0. ADC other r8, r/m8 mod 0 adc cl, [bx+si] adc dl, [bx+di] adc bl, [bp+si] adc ah, [bp+di] adc ch, [si] adc dh, [di] adc bh, [7788h] adc cl, [bx] ; 3b1. ADC other r8, r/m8 disp8 adc dl, [bx+si+7fh] adc bl, [bx+di+7fh] adc ah, [bp+si+7fh] adc ch, [bp+di+7fh] adc dh, [si+7fh] adc bh, [di+7fh] adc cl, [bp+7fh] adc dl, [bx+7fh] adc bl, [bx+si-80h] adc ah, [bx+di-80h] adc ch, [bp+si-80h] adc dh, [bp+di-80h] adc bh, [si-80h] adc cl, [di-80h] adc dl, [bp-80h] adc bl, [bx-80h] ; 3b2. ADC other r8, r/m8 disp16 adc ah, [bx+si+80h] adc ch, [bx+di+81h] adc dh, [bp+si+7fffh] adc bh, [bp+di+7ffeh] adc cl, [si+80h] adc dl, [di+81h] adc bl, [bp+7fffh] adc ah, [bx+7ffeh] adc ch, [bx+si-81h] adc dh, [bx+di-0ffh] adc bh, [bp+si-100h] adc cl, [bp+di-8000h] adc dl, [si-81h] adc bl, [di-0ffh] adc ah, [bp-100h] adc ch, [bx-8000h] ; 3b3. ADC other r8, r/m8 mod 3 adc dh, al adc bh, cl adc dl, dl adc cl, bl adc bl, ah adc ch, dh adc dh, ah adc ah, ah ; 4. ADC r16, r/m16 ; 4a. ADC AX, r/m16 ; 4a0. ADC AX, r/m16 mod 0 adc ax, [bx+si] adc ax, [bx+di] adc ax, [bp+si] adc ax, [bp+di] adc ax, [si] adc ax, [di] adc ax, [7788h] adc ax, [bx] ; 4a1. ADC AX, r/m16 disp8 adc ax, [bx+si+7fh] adc ax, [bx+di+7fh] adc ax, [bp+si+7fh] adc ax, [bp+di+7fh] adc ax, [si+7fh] adc ax, [di+7fh] adc ax, [bp+7fh] adc ax, [bx+7fh] adc ax, [bx+si-80h] adc ax, [bx+di-80h] adc ax, [bp+si-80h] adc ax, [bp+di-80h] adc ax, [si-80h] adc ax, [di-80h] adc ax, [bp-80h] adc ax, [bx-80h] ; 4a2. ADC AX, r/m16 disp16 adc ax, [bx+si+80h] adc ax, [bx+di+81h] adc ax, [bp+si+7fffh] adc ax, [bp+di+7ffeh] adc ax, [si+80h] adc ax, [di+81h] adc ax, [bp+7fffh] adc ax, [bx+7ffeh] adc ax, [bx+si-81h] adc ax, [bx+di-0ffh] adc ax, [bp+si-100h] adc ax, [bp+di-8000h] adc ax, [si-81h] adc ax, [di-0ffh] adc ax, [bp-100h] adc ax, [bx-8000h] ; 4a3. ADC AX, r/m16 mod 3 adc ax, ax adc ax, cx adc ax, dx adc ax, bx adc ax, sp adc ax, bp adc ax, si adc ax, di ; 4b. ADC other r16, r/m16 ; 4b0. ADC other r16, r/m16 mod 0 adc cx, [bx+si] adc dx, [bx+di] adc bx, [bp+si] adc sp, [bp+di] adc bp, [si] adc si, [di] adc di, [7788h] adc cx, [bx] ; 4b1. ADC other r16, r/m16 disp8 adc dx, [bx+si+7fh] adc bx, [bx+di+7fh] adc sp, [bp+si+7fh] adc bp, [bp+di+7fh] adc si, [si+7fh] adc di, [di+7fh] adc cx, [bp+7fh] adc dx, [bx+7fh] adc bx, [bx+si-80h] adc sp, [bx+di-80h] adc bp, [bp+si-80h] adc si, [bp+di-80h] adc di, [si-80h] adc cx, [di-80h] adc dx, [bp-80h] adc bx, [bx-80h] ; 4b2. ADC other r16, r/m16 disp16 adc sp, [bx+si+80h] adc bp, [bx+di+81h] adc si, [bp+si+7fffh] adc di, [bp+di+7ffeh] adc cx, [si+80h] adc dx, [di+81h] adc bx, [bp+7fffh] adc sp, [bx+7ffeh] adc bp, [bx+si-81h] adc si, [bx+di-0ffh] adc di, [bp+si-100h] adc cx, [bp+di-8000h] adc dx, [si-81h] adc bx, [di-0ffh] adc sp, [bp-100h] adc bp, [bx-8000h] ; 4b3. ADC other r16, r/m16 mod 3 adc cx, ax adc dx, cx adc bx, dx adc sp, bx adc bp, sp adc di, bp adc si, si adc si, di ; 5. ADC AL, imm8 adc al, '0' ; 6. ADC AX, imm16 adc ax, 1234h ; 7. ADC r/m8, imm8 ; 7a0. ADC r/m8 mod 0, imm8 adc [byte ptr bx+si], 7fh adc [byte ptr bx+di], 7fh adc [byte ptr bp+si], 7fh adc [byte ptr bp+di], 7fh adc [byte ptr si], 7fh adc [byte ptr di], 0ffh adc [byte ptr 7788h], 80h adc [byte ptr bx], -80h ; 7a1. ADC r/m8 disp8, imm8 adc [byte ptr bx+si+7fh], 7fh adc [byte ptr bx+di+7fh], 7fh adc [byte ptr bp+si+7fh], 7fh adc [byte ptr bp+di+7fh], 7fh adc [byte ptr si+7fh], 7fh adc [byte ptr di+7fh], 7fh adc [byte ptr bp+7fh], 7fh adc [byte ptr bx+7fh], 7fh adc [byte ptr bx+si-80h], 7fh adc [byte ptr bx+di-80h], 7fh adc [byte ptr bp+si-80h], 7fh adc [byte ptr bp+di-80h], 7fh adc [byte ptr si-80h], 7fh adc [byte ptr di-80h], 0ffh adc [byte ptr bp-80h], 80h adc [byte ptr bx-80h], -80h ; 7a2. ADC r/m8 disp16, imm8 adc [byte ptr bx+si+80h], 7fh adc [byte ptr bx+di+81h], 7fh adc [byte ptr bp+si+7fffh], 7fh adc [byte ptr bp+di+7ffeh], 7fh adc [byte ptr si+80h], 7fh adc [byte ptr di+81h], 7fh adc [byte ptr bp+7fffh], 7fh adc [byte ptr bx+7ffeh], 7fh adc [byte ptr bx+si-81h], 7fh adc [byte ptr bx+di-0ffh], 7fh adc [byte ptr bp+si-100h], 7fh adc [byte ptr bp+di-8000h], 7fh adc [byte ptr si-81h], 7fh adc [byte ptr di-0ffh], 0ffh adc [byte ptr bp-100h], 80h adc [byte ptr bx-8000h], -80h ; 7a3. ADC r/m8 mod 3, imm8 adc al, 7fh adc cl, 7fh adc dl, 7fh adc bl, 7fh adc ah, 7fh adc ch, 0ffh adc dh, 80h adc bh, -80h ; 8. ADC r/m16, imm16 ; 8a0. ADC r/m16 mod 0, imm16 adc [word ptr bx+si], 100h adc [word ptr bx+di], 7fffh adc [word ptr bp+si], 8000h adc [word ptr bp+di], 1234h adc [word ptr si], -100h adc [word ptr di], -7fffh adc [word ptr 7788h], -8000h adc [word ptr bx], 1234h ; 8a1. ADC r/m16 disp8, imm16 adc [word ptr bx+si+7fh], 100h adc [word ptr bx+di+7fh], 7fffh adc [word ptr bp+si+7fh], 8000h adc [word ptr bp+di+7fh], 1234h adc [word ptr si+7fh], -100h adc [word ptr di+7fh], -7fffh adc [word ptr bp+7fh], -8000h adc [word ptr bx+7fh], 1234h adc [word ptr bx+si-80h], 100h adc [word ptr bx+di-80h], 7fffh adc [word ptr bp+si-80h], 8000h adc [word ptr bp+di-80h], 1234h adc [word ptr si-80h], -100h adc [word ptr di-80h], -7fffh adc [word ptr bp-80h], -8000h adc [word ptr bx-80h], 1234h ; 8a2. ADC r/m16 disp16, imm16 adc [word ptr bx+si+80h], 100h adc [word ptr bx+di+81h], 7fffh adc [word ptr bp+si+7fffh], 8000h adc [word ptr bp+di+7ffeh], 1234h adc [word ptr si+80h], -100h adc [word ptr di+81h], -7fffh adc [word ptr bp+7fffh], -8000h adc [word ptr bx+7ffeh], 1234h adc [word ptr bx+si-81h], 100h adc [word ptr bx+di-0ffh], 7fffh adc [word ptr bp+si-100h], 8000h adc [word ptr bp+di-8000h], 1234h adc [word ptr si-81h], -100h adc [word ptr di-0ffh], -7fffh adc [word ptr bp-100h], -8000h adc [word ptr bx-8000h], 1234h ; 8a3. ADC r/m16 mod 3, imm16 adc ax, 100h adc cx, 7fffh adc dx, 8000h adc bx, 1234h adc sp, -100h adc bp, -7fffh adc si, -8000h adc di, 1234h ; 9. ADC r/m16, imm8 ; 9a. ADC DX, imm8: 83 D2 xx adc dx, 0 adc dx, 7fh adc dx, -1 adc dx, -7fh adc dx, -80h ; 9b. ADC DX, imm16: 81 D2 xx xx adc dx, 80h adc dx, 0ffh adc dx, 100h adc dx, -81h ; 9c. Symbols ; 9c1. Define before use CR equ 0dh adc dx, CR ;*********** OPERATORS WITH SELECTED ADDRESSING MODE COVERAGE *********** ;******** ADD: SELECTED MODES ; 1. ADD r/m8, r8 ; 1a. ADD r/m8, AL add [bx+si], al add [bx+di-80h], al add [bp+7fffh], al add al, al add bh, al ; 1b. ADD r/m8, other r8 add [bx+si], dl add [bx+di-80h], cl add [bp+7fffh], bl add al, dh add bh, bh ; 2. ADD r/m16, r16 ; 2a. ADD r/m16, AX add [bp+di], ax add [7788h], ax add [bx+7fh], ax add [bp+si+7fffh], ax add ax, ax add sp, ax ; 2b. ADD r/m16, other r16 add [bp+di], dx add [7788h], cx add [bx+7fh], bx add [bp+si+7fffh], si add ax, dx add sp, sp ; 3. ADD r8, r/m8 ; 3a. ADD AL, r/m8 add al, [bx+si] add al, [bx+di-80h] add al, [bp+7fffh] add al, al add al, bh ; 3b. ADD other r8, r/m8 add dl, [bx+si] add cl, [bx+di-80h] add bl, [bp+7fffh] add dh, al add dh, dh ; 4. ADD r16, r/m16 ; 4a. ADD AX, r/m16 add ax, [bp+di] add ax, [7788h] add ax, [bx+7fh] add ax, [bp+si+7fffh] add ax, sp ; 4b. ADD other r16, r/m16 add dx, [bp+di] add cx, [7788h] add bx, [bx+7fh] add si, [bp+si+7fffh] add dx, sp ; 5. ADD AL, imm8 add al, 20h ; 6. ADD AX, imm16 add ax, 9922h ; 7. ADD r/m8, imm8 add [byte ptr bx+si], 7fh add [byte ptr bx+di-80h], 7fh add [byte ptr bp+7fffh], 7fh add al, 7fh add bh, 7fh ; 8. ADD r/m16, imm16 add [word ptr bp+di], 100h add [word ptr 7788h], 100h add [word ptr bx+7fh], 100h add [word ptr bp+si+7fffh], 100h add ax, 100h add sp, 100h ; 9. ADD r/m16, imm8 add dx, 0 add dx, 7fh ;******** XCHG ; 1. XCHG AX, r16 xchg ax, ax xchg ax, cx xchg ax, dx xchg ax, bx xchg ax, sp xchg ax, bp xchg ax, si xchg ax, di ; 2. XCHG r16, AX xchg ax, ax xchg cx, ax xchg dx, ax xchg bx, ax xchg sp, ax xchg bp, ax xchg si, ax xchg di, ax ; 3. XCHG r/m8, r8 = XCHG r8, r/m8 xchg al, al xchg al, cl xchg cl, al xchg [1234h], al xchg [1234h], cl xchg al, [1234h] xchg cl, [1234h] ; 4. XCHG r/m16, r16 = XCHG r16, r/m16 xchg [1234h], ax xchg [1234h], cx xchg ax, [1234h] xchg cx, [1234h] xchg dx, [bp+di+07fh] xchg [bp+di+07fh], dx xchg dx, sp xchg si, bp ;******** CALL ; 1. CALL rel16 call gap0 gap0: call gap1 nop gap1: call gap0 ; 2. CALL r/m16 ; 2a0. CALL r/m16 mod 0 call [word ptr bx+si] call [word ptr bx+di] call [word ptr bp+si] call [word ptr bp+di] call [word ptr si] call [word ptr di] call [word ptr 7788h] call [word ptr bx] ; 2a1. CALL r/m16 disp8 call [word ptr bx+si+7fh] call [word ptr bx+di+7fh] call [word ptr bp+si+7fh] call [word ptr bp+di+7fh] call [word ptr si+7fh] call [word ptr di+7fh] call [word ptr bp+7fh] call [word ptr bx+7fh] call [word ptr bx+si-80h] call [word ptr bx+di-80h] call [word ptr bp+si-80h] call [word ptr bp+di-80h] call [word ptr si-80h] call [word ptr di-80h] call [word ptr bp-80h] call [word ptr bx-80h] ; 2a2. CALL r/m16 disp16 call [word ptr bx+si+80h] call [word ptr bx+di+81h] call [word ptr bp+si+7fffh] call [word ptr bp+di+7ffeh] call [word ptr si+80h] call [word ptr di+81h] call [word ptr bp+7fffh] call [word ptr bx+7ffeh] call [word ptr bx+si-81h] call [word ptr bx+di-0ffh] call [word ptr bp+si-100h] call [word ptr bp+di-8000h] call [word ptr si-81h] call [word ptr di-0ffh] call [word ptr bp-100h] call [word ptr bx-8000h] ; 2a3. CALL r/m16 mod 3 call ax call cx call dx call bx call sp call bp call si call di ;******** CMP cmp al, 3 cmp ax, 3 cmp [byte ptr bp], 78h cmp [word ptr bp], 7812h cmp [word ptr bp], 78h cmp [bx+si+7fh], ch cmp [bx+si+7fh], cx cmp bh, [di-80h] cmp bx, [di-80h] cmp dx, 78h cmp dl, 78h cmp dx, 7812h cmp bl, bl cmp bx, cx ;******** DEC ; 1. DEC r16 dec ax dec cx dec dx dec bx dec sp dec bp dec si dec di ; 2. DEC r/m8 dec [byte bp+di] dec [byte bp+di-80h] dec [byte bp+di+80h] dec al dec cl ; 3. DEC r/m16 dec [word 1234h] dec [word bx] dec [word bp+si+7fh] dec [word bp+si+7f00h] ;******** INC ; 1. INC r16 inc ax inc cx inc dx inc bx inc sp inc bp inc si inc di ; 2. INC r/m8 inc [byte bp+di] inc [byte bp+di-80h] inc [byte bp+di+80h] inc al inc cl ; 3. INC r/m16 inc [word 1234h] inc [word bx] inc [word bp+si+7fh] inc [word bp+si+7f00h] ;******** RET ret retn ret 1234 retn 1234 ;******** POP ; 1. POP r16 pop ax pop cx pop dx pop bx pop sp pop bp pop si pop di ; 2. POP sreg ; 3. POP m16 pop [word 1234h] pop [word bx] pop [word bp+si] pop [word bp] pop [word si+7fh] pop [word bx+80h] pop [word bp+di-1000h] ;******** PUSH ; 1. PUSH r16 push ax push cx push dx push bx push sp push bp push si push di ; 2. PUSH sreg ; 3. PUSH m16 push [word 1234h] push [word bx] push [word bp+si] push [word bp] push [word si+7fh] push [word bx+80h] push [word bp+di-1000h] ;******** DIV ; 1. DIV r/m8 div [byte ptr bx] div [byte ptr 1234h] div [byte bp] div [byte bp+di-1000h] div al div ch ; 2. DIV r/m16 div [word ptr bx] div [word ptr 1234h] div [word bp] div [word bp+di-1000h] div ax div sp ;******** IDIV ; 1. IDIV r/m8 idiv [byte ptr bx] idiv [byte ptr 1234h] idiv [byte bp] idiv [byte bp+di-1000h] idiv al idiv ch ; 2. IDIV r/m16 idiv [word ptr bx] idiv [word ptr 1234h] idiv [word bp] idiv [word bp+di-1000h] idiv ax idiv sp ;******** IMUL ; 1. IMUL r/m8 imul [byte ptr bx] imul [byte ptr 1234h] imul [byte bp] imul [byte bp+di-1000h] imul al imul ch ; 2. IMUL r/m16 imul [word ptr bx] imul [word ptr 1234h] imul [word bp] imul [word bp+di-1000h] imul ax imul sp ;******** MUL ; 1. MUL r/m8 mul [byte ptr bx] mul [byte ptr 1234h] mul [byte bp] mul [byte bp+di-1000h] mul al mul ch ; 2. MUL r/m16 mul [word ptr bx] mul [word ptr 1234h] mul [word bp] mul [word bp+di-1000h] mul ax mul sp ;******** IN in al, 0ffh in ax, 0ffh in al, dx in ax, dx ;******** OUT out 0ffh, al out 0ffh, ax out dx, al out dx, ax ;******** INT int 0 int 3 int 4 int 0ffh into ;******** Jcc jumps1: JA jumps1 JAE jumps1 JB jumps1 JBE jumps1 JC jumps1 JCXZ jumps1 JE jumps1 JZ jumps1 JG jumps1 JGE jumps1 JL jumps1 JLE jumps1 JNA jumps1 JNAE jumps1 JNB jumps1 JNBE jumps1 JNC jumps1 JNE jumps1 JNG jumps1 JNGE jumps1 JNL jumps1 JNLE jumps1 JNO jumps1 JNP jumps1 JNS jumps1 JNZ jumps1 JO jumps1 JP jumps1 JPE jumps1 JPO jumps1 JS jumps1 JZ jumps1 ;******** JMP ; 1. JMP rel8 jmp short jumps1 ; 2. JMP rel16 jmp start ; 3. JMP r/m16 ; 3a0. JMP r/m16 mod 0 jmp [word ptr 7788h] jmp [word ptr bx] ; 2a1. JMP r/m16 disp8 jmp [word ptr bp+di+7fh] ; 2a2. JMP r/m16 disp16 jmp [word ptr bx+si+80h] ; 2a3. JMP r/m16 mod 3 jmp ax jmp bx jmp sp ;******** LEA r16, m ; 1. LEA r16, [direct] lea ax, [1234h] lea cx, [0] lea dx, [7fffh] lea bx, [8000h] lea sp, [0ffffh] lea bp, [1] lea si, [-1] lea di, [-8000h] ; 2. LEA AX, m lea ax, [bx+si] lea ax, [bx+di] lea ax, [bp+di+7fh] lea ax, [bx+si-8000h] ; 3. LEA other r16, m lea bx, [bx+si] lea sp, [bp+di+7fh] lea bp, [bx+si-8000h] ;******** LDS, LES ; 1. LDS r16, m16:16 ; 2. LES r16, m16:16 ;******** LOOP loop1: loop loop1 loope loop1 loopz loop1 loopne loop1 loopnz loop1 ;******** MOV ; 1. MOV reg8, imm8 mov al, 0ffh mov cl, 080h mov dl, 07fh mov bl, 0 mov ah, -0 mov ch, -80h mov dh, -7fh mov bh, 1 ; 2. MOV reg16, imm16 mov ax, 0 mov cx, 1 mov dx, 100h mov bx, 1234h mov sp, 7fffh mov bp, 8000h mov si, 0ffffh mov di, -8000h ; 3. MOV r/m8, r8 ; 3a. MOV r/m8, AL ; 3a0. MOV r/m8 mod 0, AL mov [bx+si], al mov [bx+di], al mov [bp+si], al mov [bp+di], al mov [si], al mov [di], al mov [7788h], al mov [bx], al ; 3a1. MOV r/m8 disp8, AL mov [bx+si+7fh], al mov [bx+di-80h], al mov [bp+si-80h], al mov [bp+di+7fh], al mov [si+7fh], al mov [di-80h], al mov [bp-80h], al mov [bx+7fh], al ; 3a2. MOV r/m8 disp16, AL mov [bx+si+80h], al mov [bx+di-0ffh], al mov [bp+si+7fffh], al mov [bp+di-8000h], al mov [si+80h], al mov [di-0ffh], al mov [bp-100h], al mov [bx-8000h], al ; 3a3. MOV r/m8 mod 3, AL mov al, al mov cl, al mov dl, al mov bl, al mov ah, al mov ch, al mov dh, al mov bh, al ; 3b. MOV r/m8, other r8 ; 3b0. MOV r/m8 mod 0, other r8 mov [bx+si], cl mov [bx+di], dl mov [bp+si], bl mov [bp+di], ah mov [si], ch mov [di], dh mov [7788h], bh mov [bx], cl ; 3b1. MOV r/m8 disp8, other r8 mov [bx+si+7fh], dl mov [bx+di+7fh], bl mov [bp+si+7fh], ah mov [bp+di+7fh], ch mov [si+7fh], dh mov [di+7fh], bh mov [bp+7fh], cl mov [bx+7fh], dl ; 3b2. MOV r/m8 disp16, other r8 mov [bx+si-81h], ch mov [bx+di-0ffh], dh mov [bp+si-100h], bh mov [bp+di-8000h], cl mov [si-81h], dl mov [di-0ffh], bl mov [bp-100h], ah mov [bx-8000h], ch ; 3b3. MOV r/m8 mod 3, other r8 mov al, dh mov cl, bh mov dl, dl mov bl, cl mov ah, bl mov ch, ch mov dh, dh mov bh, ah ; 4. MOV r/m16, r16 ; 4a. MOV r/m16, AX ; 4a0. MOV r/m16 mod 0, AX mov [bx+si], ax mov [bx+di], ax mov [bp+si], ax mov [bp+di], ax mov [si], ax mov [di], ax mov [7788h], ax mov [bx], ax ; 4a1. MOV r/m16 disp8, AX mov [bx+si-80h], ax mov [bx+di-80h], ax mov [bp+si-80h], ax mov [bp+di-80h], ax mov [si-80h], ax mov [di-80h], ax mov [bp-80h], ax mov [bx-80h], ax ; 4a2. MOV r/m16 disp16, AX mov [bx+si+80h], ax mov [bx+di+81h], ax mov [bp+si+7fffh], ax mov [bp+di+7ffeh], ax mov [si+80h], ax mov [di+81h], ax mov [bp+7fffh], ax mov [bx+7ffeh], ax ; 4a3. MOV r/m16 mod 3, AX mov ax, ax mov cx, ax mov dx, ax mov bx, ax mov sp, ax mov bp, ax mov si, ax mov di, ax ; 4b. MOV r/m16, other r16 ; 4b0. MOV r/m16 mod 0, other r16 mov [bx+si], cx mov [bx+di], dx mov [bp+si], bx mov [bp+di], sp mov [si], bp mov [di], si mov [7788h], di mov [bx], cx ; 4b1. MOV r/m16 disp8, other r16 mov [bx+si-80h], bx mov [bx+di-80h], sp mov [bp+si-80h], bp mov [bp+di-80h], si mov [si-80h], di mov [di-80h], cx mov [bp-80h], dx mov [bx-80h], bx ; 4b2. MOV r/m16 disp16, other r16 mov [bx+si+80h], sp mov [bx+di+81h], bp mov [bp+si+7fffh], si mov [bp+di+7ffeh], di mov [si+80h], cx mov [di+81h], dx mov [bp+7fffh], bx mov [bx+7ffeh], sp ; 4b3. MOV r/m16 mod 3, other r16 mov ax, cx mov cx, bx mov dx, dx mov bx, sp mov sp, bp mov bp, si mov si, di mov di, di ; 5. MOV r8, r/m8 ; 5a. MOV AL, r/m8 ; 5a0. MOV AL, r/m8 mod 0 mov al, [bx+si] mov al, [bx+di] mov al, [bp+si] mov al, [bp+di] mov al, [si] mov al, [di] mov al, [7788h] mov al, [bx] ; 5a1. MOV AL, r/m8 disp8 mov al, [bx+si+7fh] mov al, [bx+di+7fh] mov al, [bp+si+7fh] mov al, [bp+di+7fh] mov al, [si+7fh] mov al, [di+7fh] mov al, [bp+7fh] mov al, [bx+7fh] ; 5a2. MOV AL, r/m8 disp16 mov al, [bx+si+80h] mov al, [bx+di+81h] mov al, [bp+si+7fffh] mov al, [bp+di+7ffeh] mov al, [si+80h] mov al, [di+81h] mov al, [bp+7fffh] mov al, [bx+7ffeh] ; 5a3. MOV AL, r/m8 mod 3 mov al, al mov al, cl mov al, dl mov al, bl mov al, ah mov al, ch mov al, dh mov al, bh ; 5b. MOV other r8, r/m8 ; 5b0. MOV other r8, r/m8 mod 0 mov cl, [bx+si] mov dl, [bx+di] mov bl, [bp+si] mov ah, [bp+di] mov ch, [si] mov dh, [di] mov bh, [7788h] mov cl, [bx] ; 5b1. MOV other r8, r/m8 disp8 mov bl, [bx+si-80h] mov ah, [bx+di-80h] mov ch, [bp+si-80h] mov dh, [bp+di-80h] mov bh, [si-80h] mov cl, [di-80h] mov dl, [bp-80h] mov bl, [bx-80h] ; 5b2. MOV other r8, r/m8 disp16 mov ch, [bx+si-81h] mov dh, [bx+di-0ffh] mov bh, [bp+si-100h] mov cl, [bp+di-8000h] mov dl, [si-81h] mov bl, [di-0ffh] mov ah, [bp-100h] mov ch, [bx-8000h] ; 5b3. MOV other r8, r/m8 mod 3 mov dh, al mov bh, cl mov dl, dl mov cl, bl mov bl, ah mov ch, dh mov dh, ah mov ah, ah ; 6. MOV r16, r/m16 ; 6a. MOV AX, r/m16 ; 6a0. MOV AX, r/m16 mod 0 mov ax, [bx+si] mov ax, [bx+di] mov ax, [bp+si] mov ax, [bp+di] mov ax, [si] mov ax, [di] mov ax, [7788h] mov ax, [bx] ; 6a1. MOV AX, r/m16 disp8 mov ax, [bx+si+7fh] mov ax, [bx+di+7fh] mov ax, [bp+si+7fh] mov ax, [bp+di+7fh] mov ax, [si+7fh] mov ax, [di+7fh] mov ax, [bp+7fh] mov ax, [bx+7fh] ; 6a2. MOV AX, r/m16 disp16 mov ax, [bx+si+80h] mov ax, [bx+di+81h] mov ax, [bp+si+7fffh] mov ax, [bp+di+7ffeh] mov ax, [si+80h] mov ax, [di+81h] mov ax, [bp+7fffh] mov ax, [bx+7ffeh] ; 6a3. MOV AX, r/m16 mod 3 mov ax, ax mov ax, cx mov ax, dx mov ax, bx mov ax, sp mov ax, bp mov ax, si mov ax, di ; 6b. MOV other r16, r/m16 ; 6b0. MOV other r16, r/m16 mod 0 mov cx, [bx+si] mov dx, [bx+di] mov bx, [bp+si] mov sp, [bp+di] mov bp, [si] mov si, [di] mov di, [7788h] mov cx, [bx] ; 6b1. MOV other r16, r/m16 disp8 mov dx, [bx+si+7fh] mov bx, [bx+di+7fh] mov sp, [bp+si+7fh] mov bp, [bp+di+7fh] mov si, [si+7fh] mov di, [di+7fh] mov cx, [bp+7fh] mov dx, [bx+7fh] ; 6b2. MOV other r16, r/m16 disp16 mov sp, [bx+si+80h] mov bp, [bx+di+81h] mov si, [bp+si+7fffh] mov di, [bp+di+7ffeh] mov cx, [si+80h] mov dx, [di+81h] mov bx, [bp+7fffh] mov sp, [bx+7ffeh] ; 6b3. MOV other r16, r/m16 mod 3 mov cx, ax mov dx, cx mov bx, dx mov sp, bx mov bp, sp mov di, bp mov si, si mov si, di ; 7. MOV r/m16, Sreg ; 7a. MOV r/m16, DS ; 7a0. MOV r/m16 mod 0, DS mov [bx+si], ds mov [bx+di], ds mov [bp+si], ds mov [bp+di], ds mov [si], ds mov [di], ds mov [7788h], ds mov [bx], ds ; 7a1. MOV r/m16 disp8, DS mov [bx+si-80h], ds mov [bx+di-80h], ds mov [bp+si-80h], ds mov [bp+di-80h], ds mov [si-80h], ds mov [di-80h], ds mov [bp-80h], ds mov [bx-80h], ds ; 7a2. MOV r/m16 disp16, DS mov [bx+si+80h], ds mov [bx+di+81h], ds mov [bp+si+7fffh], ds mov [bp+di+7ffeh], ds mov [si+80h], ds mov [di+81h], ds mov [bp+7fffh], ds mov [bx+7ffeh], ds ; 7a3. MOV r/m16 mod 3, DS mov ax, ds mov cx, ds mov dx, ds mov bx, ds mov sp, ds mov bp, ds mov si, ds mov di, ds ; 7b. MOV r/m16, other sreg ; 7b0. MOV r/m16 mod 0, other sreg mov [bx+si], cs mov [7788h], ss mov [bx], es ; 7b1. MOV r/m16 disp8, other sreg mov [bx+di-80h], cs mov [bp-80h], ss ; 7b2. MOV r/m16 disp16, other sreg mov [bp+si+7fffh], es mov [bx+7ffeh], cs ; 7b3. MOV r/m16 mod 3, other sreg mov ax, ss mov cx, cs mov bx, es mov bp, cs ; 8. MOV sreg, r/m16 -- CS is an invalid destination mov ds, [bx+si] mov ss, [7788h] mov es, [bx] mov ds, [bx+di-80h] mov ss, [bp-80h] mov es, [bp+si+7fffh] mov ds, [bx+7ffeh] mov ss, ax mov es, cx mov ds, bx ; 9. MOV AL, moffs8 mov al, [1234h] ; 10. MOV AX, moffs16 mov ax, [0deadh] ; 11. MOV moffs8, AL mov [1234h], al ; 12. MOV moffs16, AX mov [0deadh], ax ; 13. MOV r/m8, imm8 ; 13a0. MOV r/m8 mod 0, imm8 mov [byte ptr bx+si], 0 mov [byte ptr bx+di], 1 mov [byte ptr bp+si], 7fh mov [byte ptr bp+di], 80h mov [byte ptr si], 0ffh mov [byte ptr di], -1 mov [byte ptr 7788h], -80h mov [byte ptr bx], 0 ; 13a1. MOV r/m8 disp8, imm8 mov [byte bx+si+7fh], 0 mov [byte bx+di-80h], 1 mov [byte bp+si-80h], 7fh mov [byte bp+di+7fh], 80h mov [byte si+7fh], 0ffh mov [byte di-80h], -1 mov [byte bp-80h], -80h mov [byte bx+7fh], 0 ; 13a2. MOV r/m8 disp16, imm8 mov [byte bx+si+80h], 1 mov [byte bx+di-0ffh], -80h mov [byte bp+si+7fffh], -1 mov [byte bp+di-8000h], 0ffh mov [byte si+80h], 80h mov [byte di-0ffh], 7fh mov [byte bp-100h], 1 mov [byte bx-8000h], 0 ; 13a3. MOV r/m8 mod 3, imm8 -- uses different encoding mov ch, 12h ; 14. MOV r/m16, imm16 mov [word ptr bx+si], 0 mov [word ptr bp+di], 8000h mov [word ptr 7788h], -80h mov [word di-80h], -1 mov [word bx+7fh], 0 mov [word bx+si+80h], 1 mov [word bp-100h], 1234h mov sp, 900h ;******** NEG ; 1. NEG r/m8 neg [byte bx+si] neg [byte 1000h] neg [byte bp+di-7fh] neg [byte si-80h] neg cl ; 2. NEG r/m16 neg [word bx+si] neg [word 1000h] neg [word bp+di-7fh] neg [word si-80h] neg cx ;******** NOT ; 1. NOT r/m8 not [byte bx+si] not [byte 1000h] not [byte bp+di-7fh] not [byte si-80h] not cl ; 2. NOT r/m16 not [word bx+si] not [word 1000h] not [word bp+di-7fh] not [word si-80h] not cx ;******** AND ; 1. AND r/m8, r8 and [bx+si+7fh], ch ; 2. AND r/m16, r16 and [bx+si+7fh], cx ; 3. AND r8, r/m8 and bh, [di-80h] and bl, bl ; 4. AND r16, r/m16 and bx, [di-80h] and bx, cx ; 5. AND AL, imm8 and al, 3 ; 6. AND AX, imm16 and ax, 3 ; 7. AND r/m8, imm8 and [byte ptr bp], 78h and dl, 78h ; 8. AND r/m16, imm16 and [word ptr bp], 7812h and dx, 7812h ; 9. AND r/m16, imm8 and [word ptr bp], 78h and dx, 78h ;******** OR ; 1. OR r/m8, r8 or [bx+si+7fh], ch ; 2. OR r/m16, r16 or [bx+si+7fh], cx ; 3. OR r8, r/m8 or bh, [di-80h] or bl, bl ; 4. OR r16, r/m16 or bx, [di-80h] or bx, cx ; 5. OR AL, imm8 or al, 3 ; 6. OR AX, imm16 or ax, 3 ; 7. OR r/m8, imm8 or [byte ptr bp], 78h or dl, 78h ; 8. OR r/m16, imm16 or [word ptr bp], 7812h or dx, 7812h ; 9. OR r/m16, imm8 or [word ptr bp], 78h or dx, 78h ;******** XOR ; 1. XOR r/m8, r8 xor [bx+si+7fh], ch ; 2. XOR r/m16, r16 xor [bx+si+7fh], cx ; 3. XOR r8, r/m8 xor bh, [di-80h] xor bl, bl ; 4. XOR r16, r/m16 xor bx, [di-80h] xor bx, cx ; 5. XOR AL, imm8 xor al, 3 ; 6. XOR AX, imm16 xor ax, 3 ; 7. XOR r/m8, imm8 xor [byte ptr bp], 78h xor dl, 78h ; 8. XOR r/m16, imm16 xor [word ptr bp], 7812h xor dx, 7812h ; 9. XOR r/m16, imm8 xor [word ptr bp], 78h xor dx, 78h ;******** RCL ; 1. RCL r/m8, 1 rcl [byte bx+si], 1 rcl [byte 1234h], 1 rcl [byte bp], 1 rcl [byte bp-100h], 1 rcl al, 1 ; 2. RCL r/m8, CL rcl [byte bx+si], cl rcl [byte 1234h], cl rcl [byte bp], cl rcl [byte bp-100h], cl rcl al, cl ; 3. RCL r/m16, 1 rcl [word bx+si], 1 rcl [word 1234h], 1 rcl [word bp], 1 rcl [word bp-100h], 1 rcl ax, 1 ; 4. RCL r/m16, CL rcl [word bx+si], cl rcl [word 1234h], cl rcl [word bp], cl rcl [word bp-100h], cl rcl ax, cl ;******** RCR ; 1. RCR r/m8, 1 rcr [byte bx+si], 1 rcr [byte 1234h], 1 rcr [byte bp], 1 rcr [byte bp-100h], 1 rcr al, 1 ; 2. RCR r/m8, CL rcr [byte bx+si], cl rcr [byte 1234h], cl rcr [byte bp], cl rcr [byte bp-100h], cl rcr al, cl ; 3. RCR r/m16, 1 rcr [word bx+si], 1 rcr [word 1234h], 1 rcr [word bp], 1 rcr [word bp-100h], 1 rcr ax, 1 ; 4. RCR r/m16, CL rcr [word bx+si], cl rcr [word 1234h], cl rcr [word bp], cl rcr [word bp-100h], cl rcr ax, cl ;******** ROL ; 1. ROL r/m8, 1 rol [byte bx+si], 1 rol [byte 1234h], 1 rol [byte bp], 1 rol [byte bp-100h], 1 rol al, 1 ; 2. ROL r/m8, CL rol [byte bx+si], cl rol [byte 1234h], cl rol [byte bp], cl rol [byte bp-100h], cl rol al, cl ; 3. ROL r/m16, 1 rol [word bx+si], 1 rol [word 1234h], 1 rol [word bp], 1 rol [word bp-100h], 1 rol ax, 1 ; 4. ROL r/m16, CL rol [word bx+si], cl rol [word 1234h], cl rol [word bp], cl rol [word bp-100h], cl rol ax, cl ;******** ROR ; 1. ROR r/m8, 1 ror [byte bx+si], 1 ror [byte 1234h], 1 ror [byte bp], 1 ror [byte bp-100h], 1 ror al, 1 ; 2. ROR r/m8, CL ror [byte bx+si], cl ror [byte 1234h], cl ror [byte bp], cl ror [byte bp-100h], cl ror al, cl ror cl, cl ; 3. ROR r/m16, 1 ror [word bx+si], 1 ror [word 1234h], 1 ror [word bp], 1 ror [word bp-100h], 1 ror ax, 1 ; 4. ROR r/m16, CL ror [word bx+si], cl ror [word 1234h], cl ror [word bp], cl ror [word bp-100h], cl ror ax, cl ;******** SAL ; 1. SAL r/m8, 1 sal [byte bx+si], 1 sal [byte 1234h], 1 sal [byte bp], 1 sal [byte bp-100h], 1 sal al, 1 ; 2. SAL r/m8, CL sal [byte bx+si], cl sal [byte 1234h], cl sal [byte bp], cl sal [byte bp-100h], cl sal al, cl sal cl, cl ; 3. SAL r/m16, 1 sal [word bx+si], 1 sal [word 1234h], 1 sal [word bp], 1 sal [word bp-100h], 1 sal ax, 1 ; 4. SAL r/m16, CL sal [word bx+si], cl sal [word 1234h], cl sal [word bp], cl sal [word bp-100h], cl sal ax, cl ;******** SAR ; 1. SAR r/m8, 1 sar [byte bx+si], 1 sar [byte 1234h], 1 sar [byte bp], 1 sar [byte bp-100h], 1 sar al, 1 ; 2. SAR r/m8, CL sar [byte bx+si], cl sar [byte 1234h], cl sar [byte bp], cl sar [byte bp-100h], cl sar al, cl sar cl, cl ; 3. SAR r/m16, 1 sar [word bx+si], 1 sar [word 1234h], 1 sar [word bp], 1 sar [word bp-100h], 1 sar ax, 1 ; 4. SAR r/m16, CL sar [word bx+si], cl sar [word 1234h], cl sar [word bp], cl sar [word bp-100h], cl sar ax, cl ;******** SHL ; 1. SHL r/m8, 1 shl [byte bx+si], 1 shl [byte 1234h], 1 shl [byte bp], 1 shl [byte bp-100h], 1 shl al, 1 ; 2. SHL r/m8, CL shl [byte bx+si], cl shl [byte 1234h], cl shl [byte bp], cl shl [byte bp-100h], cl shl al, cl shl cl, cl ; 3. SHL r/m16, 1 shl [word bx+si], 1 shl [word 1234h], 1 shl [word bp], 1 shl [word bp-100h], 1 shl ax, 1 ; 4. SHL r/m16, CL shl [word bx+si], cl shl [word 1234h], cl shl [word bp], cl shl [word bp-100h], cl shl ax, cl ;******** SHR ; 1. SHR r/m8, 1 shr [byte bx+si], 1 shr [byte 1234h], 1 shr [byte bp], 1 shr [byte bp-100h], 1 shr al, 1 ; 2. SHR r/m8, CL shr [byte bx+si], cl shr [byte 1234h], cl shr [byte bp], cl shr [byte bp-100h], cl shr al, cl shr cl, cl ; 3. SHR r/m16, 1 shr [word bx+si], 1 shr [word 1234h], 1 shr [word bp], 1 shr [word bp-100h], 1 shr ax, 1 ; 4. SHR r/m16, CL shr [word bx+si], cl shr [word 1234h], cl shr [word bp], cl shr [word bp-100h], cl shr ax, cl ;******** SBB ; 1. SBB AL, imm8 sbb al, 81h ; 2. SBB AX, imm16 sbb ax, 81h ; 3. SBB r/m8, imm8 sbb [byte bx+si], 22h sbb [byte 1234h], 0ffh sbb [byte bp], -18h sbb [byte bp+100h], 0 sbb ah, 81h ; 4. SBB r/m16, imm16 sbb [word bx+si], 100h sbb [word 1234h], 8000h sbb [word bp], 0fe00h sbb [word bp+100h], -8000h sbb bp, 80h ; 5. SBB r/m16, imm8 sbb [word bx+si], 0 sbb [word 1234h], 7fh sbb [word bp], -1 sbb [word bp+100h], -80h sbb bp, 7fh ; 6. SBB r/m8, r8 sbb [bx+di], al sbb [1234h], al sbb [di-10h], al sbb [si+100h], al sbb ah, al sbb [bx+di], ah sbb [1234h], bl sbb [bp+si-10h], ch sbb [di+100h], dh sbb dl, dl ; 7. SBB r/m16, r16 sbb [bx+di], ax sbb [1234h], ax sbb [di-10h], ax sbb [si+100h], ax sbb bx, ax sbb [bx+di], cx sbb [1234h], dx sbb [bp+si-10h], bx sbb [di+100h], bp sbb sp, sp ; 8. SBB r8, r/m8 sbb al, [bx+di] sbb al, [1234h] sbb al, [di-10h] sbb al, [si+100h] sbb al, bl sbb cl, [bx+di] sbb dl, [1234h] sbb bl, [bp+si-10h] sbb ah, [di+100h] sbb ch, dh ; 9. SBB r16, r/m16 sbb ax, [bx+di] sbb ax, [1234h] sbb ax, [di-10h] sbb ax, [si+100h] sbb ax, bx sbb cx, [bx+di] sbb dx, [1234h] sbb bx, [bp+si-10h] sbb sp, [di+100h] sbb bp, bp ;******** SUB ; 1. SUB AL, imm8 sub al, 81h ; 2. SUB AX, imm16 sub ax, 81h ; 3. SUB r/m8, imm8 sub [byte bx+si], 22h sub [byte 1234h], 0ffh sub [byte bp], -18h sub [byte bp+100h], 0 sub ah, 81h ; 4. SUB r/m16, imm16 sub [word bx+si], 100h sub [word 1234h], 8000h sub [word bp], 0fe00h sub [word bp+100h], -8000h sub bp, 80h ; 5. SUB r/m16, imm8 sub [word bx+si], 0 sub [word 1234h], 7fh sub [word bp], -1 sub [word bp+100h], -80h sub bp, 7fh ; 6. SUB r/m8, r8 sub [bx+di], al sub [1234h], al sub [di-10h], al sub [si+100h], al sub ah, al sub [bx+di], ah sub [1234h], bl sub [bp+si-10h], ch sub [di+100h], dh sub dl, dl ; 7. SUB r/m16, r16 sub [bx+di], ax sub [1234h], ax sub [di-10h], ax sub [si+100h], ax sub bx, ax sub [bx+di], cx sub [1234h], dx sub [bp+si-10h], bx sub [di+100h], bp sub sp, sp ; 8. SUB r8, r/m8 sub al, [bx+di] sub al, [1234h] sub al, [di-10h] sub al, [si+100h] sub al, bl sub cl, [bx+di] sub dl, [1234h] sub bl, [bp+si-10h] sub ah, [di+100h] sub ch, dh ; 9. SUB r16, r/m16 sub ax, [bx+di] sub ax, [1234h] sub ax, [di-10h] sub ax, [si+100h] sub ax, bx sub cx, [bx+di] sub dx, [1234h] sub bx, [bp+si-10h] sub sp, [di+100h] sub bp, bp ;******** TEST ; 1. TEST AL, imm8 test al, 81h ; 2. TEST AX, imm16 test ax, 81h ; 3. TEST r/m8, imm8 test [byte bx+si], 0 test [byte bx+si], 7fh test [byte 1234h], 0ffh test [byte bp], -18h test [byte bp+100h], 0 test ah, 81h ; 4. TEST r/m16, imm16 test [word bx+si], 100h test [word 1234h], 8000h test [word bp], 0fe00h test [word bp+100h], -8000h test bp, 80h ; 5. TEST r/m8, r8 test [bx+di], al test [1234h], al test [di-10h], al test [si+100h], al test ah, al test [bx+di], ah test [1234h], bl test [bp+si-10h], ch test [di+100h], dh test dl, dl ; 6. TEST r/m16, r16 test [bx+di], ax test [1234h], ax test [di-10h], ax test [si+100h], ax test bx, ax test [bx+di], cx test [1234h], dx test [bp+si-10h], bx test [di+100h], bp test sp, sp ; 7. TEST r8, r/m8 test al, [bx+di] test al, [1234h] test al, [di-10h] test al, [si+100h] test al, bl test cl, [bx+di] test dl, [1234h] test bl, [bp+si-10h] test ah, [di+100h] test ch, dh ; 8. TEST r16, r/m16 test ax, [bx+di] test ax, [1234h] test ax, [di-10h] test ax, [si+100h] test ax, bx test cx, [bx+di] test dx, [1234h] test bx, [bp+si-10h] test sp, [di+100h] test bp, bp ;******** PREFIXES lock nop rep movsb rep movsw rep stosb rep stosw repe cmpsb repe cmpsw repe scasb repe scasw repne cmpsb repne cmpsw repne scasb repne scasw ;******** LOW ; add al, LOW 1234h ; add al, LOW (-1234h) ; add al, LOW 2080h ; add ax, LOW 1234h ; add ax, LOW (-1234h) ; add ax, LOW 2080h ; extra/regression test cases FFFF equ 0ffffh PAGE0 equ 060h ; mov ax, [bx+si+80h] ; mov ax, [bx+si-80h] ; mov ax, [bx+si+0ffffh] ; 8-bit displacement, -1 ; mov ax, [bx+si-0ffffh] ; 8-bit displacement, +1 ; mov ax, [bx+si+0ff80h] ; 8-bit displacement, -1 ; mov ax, [bx+si-0ff80h] ; 8-bit displacement, +1 ; mov ax, [bx+si+0ff7fh] ; 8-bit displacement, -1 ; mov ax, [bx+si-0ff7fh] ; 8-bit displacement, +1 ; mov ax, [bx+si+FFFF] ; mov ax, [bx+si-FFFF] ; mov ax, [si+PAGE0] ENDS END start
tools/scitools/conf/understand/ada/ada05/s-tasdeb.ads
brucegua/moocos
1
15636
<gh_stars>1-10 ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K I N G . D E B U G -- -- -- -- S p e c -- -- -- -- Copyright (C) 1997-2005, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT 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 distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This package encapsulates all direct interfaces to task debugging services -- that are needed by gdb with gnat mode. with System.Tasking; with System.OS_Interface; package System.Tasking.Debug is pragma Preelaborate; ------------------------------------------ -- Application-level debugging routines -- ------------------------------------------ procedure List_Tasks; -- Print a list of all the known Ada tasks with abbreviated state -- information, one-per-line, to the standard error file. procedure Print_Current_Task; -- Write information about current task, in hexadecimal, as one line, to -- the standard error file. procedure Print_Task_Info (T : Task_Id); -- Similar to Print_Current_Task, for a given task. procedure Set_User_State (Value : Long_Integer); -- Set user state value in the current task. -- This state will be displayed when calling List_Tasks or -- Print_Current_Task. It is useful for setting task specific state. function Get_User_State return Long_Integer; -- Return the user state for the current task. ------------------------- -- General GDB support -- ------------------------- Known_Tasks : array (0 .. 999) of Task_Id := (others => null); -- Global array of tasks read by gdb, and updated by -- Create_Task and Finalize_TCB ---------------------------------- -- VxWorks specific GDB support -- ---------------------------------- -- Although the following routines are implemented in a target independent -- manner, only VxWorks currently uses them. procedure Task_Creation_Hook (Thread : OS_Interface.Thread_Id); -- This procedure is used to notify GDB of task's creation. -- It must be called by the task's creator. procedure Task_Termination_Hook; -- This procedure is used to notify GDB of task's termination. procedure Suspend_All_Tasks (Thread_Self : OS_Interface.Thread_Id); -- Suspend all the tasks except the one whose associated thread is -- Thread_Self by traversing All_Tasks_Lists and calling -- System.Task_Primitives.Operations.Suspend_Task. procedure Resume_All_Tasks (Thread_Self : OS_Interface.Thread_Id); -- Resume all the tasks except the one whose associated thread is -- Thread_Self by traversing All_Tasks_Lists and calling -- System.Task_Primitives.Operations.Continue_Task. ------------------------------- -- Run-time tracing routines -- ------------------------------- procedure Trace (Self_Id : Task_Id; Msg : String; Flag : Character; Other_Id : Task_Id := null); -- If traces for Flag are enabled, display on Standard_Error a given -- message for the current task. Other_Id is an optional second task id -- to display. procedure Set_Trace (Flag : Character; Value : Boolean := True); -- Enable or disable tracing for Flag. -- By default, flags in the range 'A' .. 'Z' are disabled, others are -- enabled. end System.Tasking.Debug;
programs/oeis/124/A124297.asm
neoneye/loda
22
24082
<gh_stars>10-100 ; A124297: a(n) = 5*F(n)^2 + 5*F(n) + 1, where F(n) = Fibonacci(n). ; 1,11,11,31,61,151,361,911,2311,5951,15401,40051,104401,272611,712531,1863551,4875781,12760031,33398201,87424711,228859951,599129311,1568486161,4106261531,10750188961,28144128251,73681909211,192901135711,505020747661,1322159893351,3461456968201,9062207833151,23725161388951,62113268013311,162614629188281,425730597768451,1114577128871281,2918000731816531,7639424974303651,20000274041790911,52361396909490901,137083916295800111,358890351345449561,939587136717207031,2459871057150370111,6440026032054760351,16860207034678966561,44140595064968052011,115561578148876157761,302544139363297302251,792070839911303598251,2073668380322538222751,5428934300978523649501,14213134522487170035511,37210469266279336346281,97418273276021326202351,255044350561251479349031,667714778406870436132031,1748099984657963990422601,4576585175564763020798611,11981655542032670719011601,31368381450527336268937411,82123488809539770867540211,215002084978076496246124031,562882766124664670563012261,1473646213395876988047533951,3858055874062900718876391161,10100521408792719066483062311,26443508352315084803771020111,69230003648152257565929645151,181246502592141238438315786801,474509504128270730514415233851,1242282009792669776414625304801,3252336525249736694804553589211,8514727565956537227383823761531,22291846172619870002806798902751,58360810951903064715881242452781,152790586683089311095141479169031,400010949097364847454692415273801,1047242260609005197104389537585311,2741715832729650688579079188634551,7177905237579946779188904790403711,18791999880010189504264294935814361,49198094402450621499436696532362531,128802283327341674615155170929834161,337208755579574401732970909041024051,882823983411381529591809025245683011 seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1. add $0,1 bin $0,2 mul $0,10 add $0,1
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_440.asm
ljhsiun2/medusa
9
23694
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r15 push %r9 push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0xbd4e, %r9 nop nop and %r13, %r13 movb $0x61, (%r9) nop nop nop nop nop xor %rbx, %rbx lea addresses_WT_ht+0x19a6c, %rsi lea addresses_UC_ht+0x4476, %rdi clflush (%rdi) nop nop nop add %r15, %r15 mov $15, %rcx rep movsb nop add %r13, %r13 lea addresses_D_ht+0x1bc0e, %rsi nop nop nop nop and %r9, %r9 mov $0x6162636465666768, %rbx movq %rbx, (%rsi) nop cmp $18574, %rbx lea addresses_D_ht+0x1314e, %rsi lea addresses_normal_ht+0x182b9, %rdi nop and %r11, %r11 mov $20, %rcx rep movsl sub $29663, %r13 lea addresses_normal_ht+0xf54e, %rdi sub %rbx, %rbx vmovups (%rdi), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %r11 add $4410, %rbx lea addresses_WC_ht+0x14e, %r11 nop nop nop nop nop sub $19502, %rbx mov (%r11), %r15d nop nop inc %r13 lea addresses_D_ht+0x814e, %rcx nop sub $56643, %r15 movw $0x6162, (%rcx) nop nop nop nop add %rsi, %rsi lea addresses_WT_ht+0x70ce, %rsi lea addresses_D_ht+0x1c326, %rdi nop nop nop nop nop add $3099, %rbx mov $120, %rcx rep movsl sub %rbx, %rbx lea addresses_D_ht+0x7b4e, %rdi cmp %r13, %r13 mov $0x6162636465666768, %rcx movq %rcx, %xmm6 vmovups %ymm6, (%rdi) nop nop nop nop sub $49212, %rdi lea addresses_WC_ht+0x517e, %rsi lea addresses_D_ht+0xe74e, %rdi nop nop nop nop xor $20000, %rbx mov $83, %rcx rep movsl nop nop nop nop dec %rcx lea addresses_UC_ht+0x1704e, %rcx nop nop nop xor $60697, %r13 movw $0x6162, (%rcx) nop nop nop inc %r13 lea addresses_D_ht+0x1e5ce, %r15 nop nop nop sub %rdi, %rdi movw $0x6162, (%r15) nop nop and %r9, %r9 lea addresses_normal_ht+0x13d6c, %rsi lea addresses_normal_ht+0x3e06, %rdi nop nop cmp $436, %r15 mov $44, %rcx rep movsl nop nop nop sub $23760, %r9 lea addresses_D_ht+0x1b8c8, %rdi nop nop nop xor %rcx, %rcx vmovups (%rdi), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %r15 nop nop dec %r9 lea addresses_A_ht+0x15e4e, %rsi lea addresses_normal_ht+0x1974e, %rdi nop nop nop xor %r9, %r9 mov $46, %rcx rep movsb nop nop add %rdi, %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r13 push %r15 push %r8 push %rax push %rbx push %rdi push %rsi // Store lea addresses_RW+0x1c49e, %r15 sub $18311, %rbx mov $0x5152535455565758, %rdi movq %rdi, (%r15) nop nop nop nop add %r8, %r8 // Store lea addresses_WC+0x7d4e, %r8 nop nop nop nop nop add $26586, %r15 mov $0x5152535455565758, %rdi movq %rdi, %xmm7 vmovntdq %ymm7, (%r8) nop nop nop cmp $18707, %r15 // Load lea addresses_A+0x1414e, %r8 nop nop and %r13, %r13 mov (%r8), %si nop nop nop inc %r15 // Faulty Load lea addresses_RW+0x1954e, %r15 nop nop nop nop cmp $15231, %rax movb (%r15), %bl lea oracles, %r13 and $0xff, %rbx shlq $12, %rbx mov (%r13,%rbx,1), %rbx pop %rsi pop %rdi pop %rbx pop %rax pop %r8 pop %r15 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': True, 'type': 'addresses_RW', 'size': 8, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': True, 'type': 'addresses_WC', 'size': 32, 'AVXalign': False}} {'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_A', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': True, 'congruent': 10, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False}} {'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}} {'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}} {'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 8, 'NT': True, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False}} {'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}} {'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
Definition/LogicalRelation/Substitution/Reducibility.agda
Vtec234/logrel-mltt
0
11940
<filename>Definition/LogicalRelation/Substitution/Reducibility.agda {-# OPTIONS --without-K --safe #-} open import Definition.Typed.EqualityRelation module Definition.LogicalRelation.Substitution.Reducibility {{eqrel : EqRelSet}} where open EqRelSet {{...}} open import Definition.Untyped open import Definition.Untyped.Properties open import Definition.Typed open import Definition.LogicalRelation open import Definition.LogicalRelation.Irrelevance open import Definition.LogicalRelation.Substitution open import Definition.LogicalRelation.Substitution.Properties open import Tools.Product -- Valid types are reducible. reducibleᵛ : ∀ {A Γ l} ([Γ] : ⊩ᵛ Γ) → Γ ⊩ᵛ⟨ l ⟩ A / [Γ] → Γ ⊩⟨ l ⟩ A reducibleᵛ [Γ] [A] = let ⊢Γ = soundContext [Γ] [id] = idSubstS [Γ] in irrelevance′ (subst-id _) (proj₁ ([A] ⊢Γ [id])) -- Valid type equality is reducible. reducibleEqᵛ : ∀ {A B Γ l} ([Γ] : ⊩ᵛ Γ) ([A] : Γ ⊩ᵛ⟨ l ⟩ A / [Γ]) → Γ ⊩ᵛ⟨ l ⟩ A ≡ B / [Γ] / [A] → Γ ⊩⟨ l ⟩ A ≡ B / reducibleᵛ [Γ] [A] reducibleEqᵛ {A = A} [Γ] [A] [A≡B] = let [σA] = reducibleᵛ {A = A} [Γ] [A] ⊢Γ = soundContext [Γ] [id] = idSubstS [Γ] in irrelevanceEq″ (subst-id _) (subst-id _) (proj₁ ([A] ⊢Γ [id])) [σA] ([A≡B] ⊢Γ [id]) -- Valid terms are reducible. reducibleTermᵛ : ∀ {t A Γ l} ([Γ] : ⊩ᵛ Γ) ([A] : Γ ⊩ᵛ⟨ l ⟩ A / [Γ]) → Γ ⊩ᵛ⟨ l ⟩ t ∷ A / [Γ] / [A] → Γ ⊩⟨ l ⟩ t ∷ A / reducibleᵛ [Γ] [A] reducibleTermᵛ {A = A} [Γ] [A] [t] = let [σA] = reducibleᵛ {A = A} [Γ] [A] ⊢Γ = soundContext [Γ] [id] = idSubstS [Γ] in irrelevanceTerm″ (subst-id _) (subst-id _) (proj₁ ([A] ⊢Γ [id])) [σA] (proj₁ ([t] ⊢Γ [id])) -- Valid term equality is reducible. reducibleEqTermᵛ : ∀ {t u A Γ l} ([Γ] : ⊩ᵛ Γ) ([A] : Γ ⊩ᵛ⟨ l ⟩ A / [Γ]) → Γ ⊩ᵛ⟨ l ⟩ t ≡ u ∷ A / [Γ] / [A] → Γ ⊩⟨ l ⟩ t ≡ u ∷ A / reducibleᵛ [Γ] [A] reducibleEqTermᵛ {A = A} [Γ] [A] [t≡u] = let [σA] = reducibleᵛ {A = A} [Γ] [A] ⊢Γ = soundContext [Γ] [id] = idSubstS [Γ] in irrelevanceEqTerm″ (subst-id _) (subst-id _) (subst-id _) (proj₁ ([A] ⊢Γ [id])) [σA] ([t≡u] ⊢Γ [id])
vendor/stdlib/src/Category/Monad.agda
isabella232/Lemmachine
56
379
------------------------------------------------------------------------ -- Monads ------------------------------------------------------------------------ -- Note that currently the monad laws are not included here. module Category.Monad where open import Data.Function open import Category.Monad.Indexed open import Data.Unit RawMonad : (Set → Set) → Set₁ RawMonad M = RawIMonad {⊤} (λ _ _ → M) RawMonadZero : (Set → Set) → Set₁ RawMonadZero M = RawIMonadZero {⊤} (λ _ _ → M) RawMonadPlus : (Set → Set) → Set₁ RawMonadPlus M = RawIMonadPlus {⊤} (λ _ _ → M) module RawMonad {M : Set → Set} (Mon : RawMonad M) where open RawIMonad Mon public module RawMonadZero {M : Set → Set} (Mon : RawMonadZero M) where open RawIMonadZero Mon public module RawMonadPlus {M : Set → Set} (Mon : RawMonadPlus M) where open RawIMonadPlus Mon public
scaled.applescript
SeungwooChoe/macOS-display-scale-option-modifier
0
2617
tell application "System Preferences" reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays" end tell tell application "System Events" to tell process "System Preferences" click radio button "Scaled" of tab group 1 of window "<Input target display name here>" select row <Input option number here> of table 1 of scroll area 1 of tab group 1 of window "<Input target display name here>" end tell quit application "System Preferences"
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0_notsx.log_21829_211.asm
ljhsiun2/medusa
9
103886
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r15 push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0xddd4, %rsi lea addresses_UC_ht+0x8b50, %rdi nop nop nop add $46414, %rdx mov $123, %rcx rep movsw nop nop dec %r15 lea addresses_D_ht+0x411c, %rcx nop and %rdi, %rdi movb (%rcx), %r15b nop nop nop nop and %rdx, %rdx lea addresses_UC_ht+0x1274c, %r15 nop nop sub %rcx, %rcx movb (%r15), %r11b nop nop nop and $62728, %rdx lea addresses_WC_ht+0x15d5c, %rcx nop dec %r10 movw $0x6162, (%rcx) nop sub $55075, %rdi lea addresses_normal_ht+0x4ffc, %rdi nop and $305, %r11 mov (%rdi), %ecx nop nop nop nop sub $29418, %r15 lea addresses_UC_ht+0x46dc, %rsi nop nop nop dec %r15 mov (%rsi), %r10d nop nop sub $8999, %rsi lea addresses_D_ht+0x9fdc, %rsi lea addresses_WT_ht+0x1af64, %rdi nop nop add $41168, %r12 mov $84, %rcx rep movsb xor %r10, %r10 lea addresses_UC_ht+0x1d61c, %rdx and %rdi, %rdi vmovups (%rdx), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %r10 nop sub $4153, %rcx lea addresses_UC_ht+0x1d39c, %r15 clflush (%r15) nop nop nop nop nop cmp %rsi, %rsi mov $0x6162636465666768, %r12 movq %r12, %xmm4 and $0xffffffffffffffc0, %r15 vmovntdq %ymm4, (%r15) nop nop nop sub %r12, %r12 lea addresses_WC_ht+0x1db84, %rsi lea addresses_D_ht+0xc79c, %rdi nop nop add $42655, %r11 mov $56, %rcx rep movsl nop sub %rcx, %rcx lea addresses_D_ht+0x1809c, %rsi nop nop nop xor %rdx, %rdx movups (%rsi), %xmm1 vpextrq $1, %xmm1, %r11 nop nop nop nop nop xor %r11, %r11 pop %rsi pop %rdx pop %rdi pop %rcx pop %r15 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %rax push %rbx push %rdi push %rsi // Store lea addresses_RW+0x19764, %rax nop nop nop nop nop sub $49547, %r14 movb $0x51, (%rax) nop nop nop nop nop and $52874, %r14 // Faulty Load mov $0x521ca8000000051c, %rdi nop nop inc %r11 movups (%rdi), %xmm5 vpextrq $0, %xmm5, %rbx lea oracles, %r14 and $0xff, %rbx shlq $12, %rbx mov (%r14,%rbx,1), %rbx pop %rsi pop %rdi pop %rbx pop %rax pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 3}} [Faulty Load] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': True}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 6}} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 4}} {'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
Cycle_computations.ads
Louis-Aime/Milesian_calendar_Ada
0
7324
-- Cycle computations -- A variant to the integer division, where the number of cycles and the phase -- within the cycle are computed and returned by single function. -- In these functions, the remainder (the phase) is always non-negative. -- Decompose_cycle is the standard operation; -- Decompose_cycle_ceiled is appropriate when the phase is authorised to be -- equal to the divisor. -- First variant for integer types, -- second variant for fixed types. ---------------------------------------------------------------------------- -- Copyright Miletus 2015 -- 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: -- 1. The above copyright notice and this permission notice shall be included -- in all copies or substantial portions of the Software. -- 2. Changes with respect to any former version shall be documented. -- -- The software is provided "as is", without warranty of any kind, -- express of implied, including but not limited to the warranties of -- merchantability, fitness for a particular purpose and noninfringement. -- In no event shall the authors of 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. -- Inquiries: www.calendriermilesien.org ------------------------------------------------------------------------------- package Cycle_computations is generic type Num is range <>; package Integer_cycle_computations is subtype Positive_num is Num range 1..Num'Last; type Cycle_coordinates is record Cycle : Integer; Phase : Num; end record; function Decompose_cycle (Dividend : Num; Divisor : Positive_num) return Cycle_coordinates; -- Dividend = Cycle * Divisor + Phase, 0 <= Phase < Divisor function Decompose_cycle_ceiled (Dividend : Num; Divisor : Positive_num; Ceiling : Positive) return Cycle_coordinates; -- 0 <= Dividend <= Ceiling * Divisor -- Dividend = Cycle * Divisor + Phase, 0 <= Phase <= Divisor, -- Phase = Divisor only for last value of Dividend, Cycle < Ceiling. end Integer_cycle_computations; generic type Fixed_num is delta <>; package Fixed_Cycle_Computations is subtype Positive_num is Fixed_num range Fixed_num'Delta..Fixed_num'Last; type Cycle_coordinates is record Cycle : Integer; Phase : Fixed_num; end record; function Decompose_cycle (Dividend : Fixed_num; Divisor : Positive_num) return Cycle_coordinates; -- Dividend = Cycle * Divisor + Phase, 0 <= Phase < Divisor function Decompose_cycle_ceiled (Dividend : Fixed_num; Divisor : Positive_num; Ceiling : Positive) return Cycle_coordinates; -- 0 <= Dividend <= Ceiling * Divisor -- Dividend = Cycle * Divisor + Phase, 0 <= Phase <= Divisor, -- Phase = Divisor only for last value of Dividend, Cycle < Ceiling. end Fixed_cycle_computations; end Cycle_computations;
homework/Mult.asm
hanhha/Nand2Tetris
0
4349
// Nand2Tetris course // Multiples R0 and R1, store result in R2 // Multipling by adding R0 to itself R2 times @ R2 M = 0 // R2 = 0 @ R1 D = M @ END D; JEQ // Finish if R1 = 0 ( multiples R0 to 0 ) (CONT) @ R0 D = M // D = R0 @ R2 M = D + M // R2 = R2 + D (<=> R2 = R2 + R0) @ R1 MD = M - 1 // D = R1 = R1 - 1 @ CONT D; JGT // continue loop if R1 > 0 (END) @END 0; JMP // infinite loop ends a hack program
alloy4fun_models/trashltl/models/4/AgNAD3pvnYQmLp654.als
Kaixi26/org.alloytools.alloy
0
3391
<reponame>Kaixi26/org.alloytools.alloy open main pred idAgNAD3pvnYQmLp654_prop5 { eventually some File & Trash } pred __repair { idAgNAD3pvnYQmLp654_prop5 } check __repair { idAgNAD3pvnYQmLp654_prop5 <=> prop5o }
experiments/test-suite/farmer.als
saiema/ARepair
5
3760
open util/ordering [State] as ord -- Manually created tests. pred test1001 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Farmer0 + Grain0,none,Fox0 + Chicken0,Farmer0 + Fox0 + Chicken0 + Grain0] }}}}}} } run test1001 for 4 expect 1 pred test1002 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Farmer0 + Fox0 + Chicken0 + Grain0,Chicken0,none,Farmer0 + Fox0] }}}}}} } run test1002 for 4 expect 1 pred test1003 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Farmer0 + Fox0 + Chicken0 + Grain0,Fox0 + Grain0,none,Farmer0 + Chicken0] }}}}}} } run test1003 for 4 expect 1 pred test1004 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Farmer0 + Fox0 + Chicken0 + Grain0,Fox0,none,Farmer0 + Grain] }}}}}} } run test1004 for 4 expect 1 pred test1005 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Farmer0 + Fox0 + Chicken0 + Grain0,Fox0 + Grain0,none,Farmer0] }}}}}} } run test1005 for 4 expect 1 pred test1006 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State3->Farmer0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Grain0,Fox0,none,Farmer0 + Grain0] }}}}}} } run test1006 for 4 expect 0 pred test1007 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Farmer0 + Fox0 + Chicken0 + Grain0,none,none,Farmer0 + Grain0] }}}}}} } run test1007 for 4 expect 0 pred test1008 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Farmer0 + Fox0 + Chicken0 + Grain0,none,none,Farmer0 + Chicken0] }}}}}} } run test1008 for 4 expect 0 pred test1009 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State3->Farmer0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Farmer0 + Fox0 + Chicken0,none,none,Farmer0 + Fox0] }}}}}} } run test1009 for 4 expect 0 pred test1010 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Fox0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0,Grain0,none,Farmer0 + Fox0] }}}}}} } run test1010 for 4 expect 0 pred test1011 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Chicken0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State3->Fox0 far = State1->Farmer0 + State1->Fox0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0,Fox0,none,Farmer0] }}}}}} } run test1011 for 4 expect 1 pred test1012 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State3->Fox0 far = State1->Farmer0 + State1->Grain0 + State2->Grain0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0,Fox0,Fox0 + Chicken0 + Grain0,Farmer0 + Grain0] }}}}}} } run test1012 for 4 expect 0 pred test1013 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State3->Fox0 far = State1->Farmer0 + State1->Grain0 + State2->Grain0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,Fox0 + Grain0,Fox0 + Chicken0 + Grain0,Farmer0] }}}}}} } run test1013 for 4 expect 0 pred test1014 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Farmer0 + Fox0 + Chicken0 + Grain0,Farmer0,none,Farmer0] }}}}}} } run test1014 for 4 expect 0 pred test1015 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State3->Fox0 far = State1->Farmer0 + State1->Grain0 + State2->Grain0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[none,Farmer0,none,Farmer0] }}}}}} } run test1015 for 4 expect 0 pred test1016 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State3->Fox0 far = State1->Farmer0 + State1->Grain0 + State2->Grain0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,Fox0 + Grain0,Chicken0,Farmer0] }}}}}} } run test1016 for 4 expect 0 pred test1017 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,Fox0 + Grain0,Fox0,Farmer0 + Fox0 + Chicken0] }}}}}} } run test1017 for 4 expect 0 pred test1018 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State3->Fox0 far = State1->Farmer0 + State1->Grain0 + State2->Grain0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0,Fox0,none,none] }}}}}} } run test1018 for 4 expect 0 pred test1019 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State3->Farmer0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,none,none,Farmer0 + Fox0] }}}}}} } run test1019 for 4 expect 0 pred test1020 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Chicken0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State3->Fox0 far = State1->Farmer0 + State1->Fox0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0,Fox0,Fox0 + Chicken0,Farmer0 + Fox0] }}}}}} } run test1020 for 4 expect 0 -- Automatically generated tests. pred test27 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Chicken0 + Grain0,Grain0,Chicken0 + Grain0,Farmer0 + Chicken0 + Grain0] }}}}}} } run test27 for 4 expect 1 pred test16 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Chicken0 + Grain0,Chicken0,none,Farmer0] }}}}}} } run test16 for 4 expect 1 pred test42 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Fox0 + Grain0,Fox0 + Grain0,Farmer0 + Fox0] }}}}}} } run test42 for 4 expect 0 pred test39 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Chicken0 + State2->Farmer0 + State2->Chicken0 + State3->Chicken0 far = State1->Farmer0 + State1->Fox0 + State2->Fox0 + State3->Farmer0 + State3->Fox0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Fox0,Fox0 + Chicken0 + Grain0,Farmer0 + Fox0 + Chicken0 + Grain0] }}}}}} } run test39 for 4 expect 1 pred test46 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 solvePuzzle[] }}}}}} } run test46 for 4 expect 0 pred test2 { some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { no Farmer Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Chicken0 far = State1->Fox0 + State2->Fox0 + State2->Chicken0 + State3->Fox0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}} } run test2 for 4 expect 0 pred test40 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Chicken0,none,Farmer0 + Fox0] }}}}}} } run test40 for 4 expect 1 pred test21 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Chicken0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State3->Fox0 far = State1->Farmer0 + State1->Fox0 + State3->Farmer0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,Fox0 + Grain0,none,Farmer0] }}}}}} } run test21 for 4 expect 1 pred test17 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Chicken0,Chicken0,none,Farmer0] }}}}}} } run test17 for 4 expect 1 pred test8 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Farmer0,Grain0,Fox0 + Chicken0] }}}}}} } run test8 for 4 expect 0 pred test26 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Chicken0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State3->Fox0 far = State1->Farmer0 + State1->Fox0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Chicken0 + Grain0,Grain0,Fox0 + Chicken0 + Grain0,Farmer0 + Fox0 + Chicken0 + Grain0] }}}}}} } run test26 for 4 expect 1 pred test35 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State1->Chicken0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,Fox0,none,Farmer0 + Grain0] }}}}}} } run test35 for 4 expect 1 pred test43 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0,Fox0,none,Farmer0 + Chicken0] }}}}}} } run test43 for 4 expect 1 pred test1 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test1 for 4 expect 1 pred test10 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,Fox0 + Grain0,none,Farmer0] }}}}}} } run test10 for 4 expect 1 pred test20 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Chicken0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State3->Chicken0 far = State1->Farmer0 + State1->Fox0 + State3->Farmer0 + State3->Fox0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0,Fox0,none,Farmer0] }}}}}} } run test20 for 4 expect 1 pred test14 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,Fox0 + Grain0,Grain0,Fox0 + Chicken0] }}}}}} } run test14 for 4 expect 0 pred test30 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Chicken0,Fox0 + Chicken0 + Grain0,Farmer0 + Fox0 + Chicken0 + Grain0] }}}}}} } run test30 for 4 expect 1 pred test31 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Chicken0 + Grain0,Chicken0,none,Farmer0 + Grain0] }}}}}} } run test31 for 4 expect 1 pred test12 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Farmer0,none,Farmer0] }}}}}} } run test12 for 4 expect 0 pred test6 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Chicken0 + State2->Farmer0 + State2->Chicken0 far = State1->Farmer0 + State1->Fox0 + State2->Fox0 + State3->Farmer0 + State3->Fox0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test6 for 4 expect 1 pred test41 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Fox0 + Grain0,none,Farmer0 + Chicken0] }}}}}} } run test41 for 4 expect 1 pred test45 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Chicken0,Fox0,Farmer0 + Fox0] }}}}}} } run test45 for 4 expect 1 pred test19 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Farmer0 + Fox0 + Grain0,Fox0 + Grain0,none,Farmer0] }}}}}} } run test19 for 4 expect 1 pred test29 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,Fox0,none,Farmer0 + Grain0] }}}}}} } run test29 for 4 expect 1 pred test25 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State1->Chicken0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Farmer0,Grain0,Fox0 + Chicken0] }}}}}} } run test25 for 4 expect 0 pred test48 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Chicken0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State2->Grain0 + State3->Fox0 + State3->Chicken0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test48 for 4 expect 0 pred test54 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Chicken0 + State2->Grain0 + State3->Fox0 + State3->Chicken0 far = State1->Farmer0 + State2->Fox0 + State2->Chicken0 + State2->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test54 for 4 expect 0 pred test50 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State1->Farmer0 + State3->Farmer0 + State3->Fox0 far = State0->Fox0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test50 for 4 expect 0 pred test24 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Chicken0,none,none,Farmer0 + Grain0] }}}}}} } run test24 for 4 expect 0 pred test49 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test49 for 4 expect 1 pred test34 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Chicken0 + State2->Farmer0 + State2->Chicken0 far = State1->Farmer0 + State1->Fox0 + State2->Fox0 + State3->Farmer0 + State3->Fox0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Fox0 + Grain0,Fox0 + Grain0,Farmer0 + Fox0 + Chicken0 + Grain0] }}}}}} } run test34 for 4 expect 1 pred test47 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Chicken0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State2->Grain0 + State3->Fox0 + State3->Chicken0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test47 for 4 expect 0 pred test28 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State1->Chicken0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Chicken0,Fox0 + Grain0,Chicken0] }}}}}} } run test28 for 4 expect 0 pred test9 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,Fox0 + Grain0,none,Farmer0] }}}}}} } run test9 for 4 expect 1 pred test51 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Farmer0 + State1->Fox0 + State1->Chicken0 + State1->Grain0 + State2->Fox0 + State2->Grain0 + State3->Farmer0 + State3->Fox0 + State3->Grain0 far = State2->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test51 for 4 expect 0 pred test7 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test7 for 4 expect 1 pred test37 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Farmer0 + Fox0 + Grain0,Fox0,none,Farmer0 + Grain0] }}}}}} } run test37 for 4 expect 1 pred test33 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0,Chicken0,none,Farmer0 + Fox0] }}}}}} } run test33 for 4 expect 1 pred test18 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Chicken0,Chicken0,none,Farmer0] }}}}}} } run test18 for 4 expect 1 pred test44 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Grain0,none,none,Farmer0 + Grain0] }}}}}} } run test44 for 4 expect 1 pred test22 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,Fox0 + Grain0,Fox0 + Chicken0 + Grain0,none] }}}}}} } run test22 for 4 expect 0 pred test23 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Chicken0,none,Farmer0 + Fox0] }}}}}} } run test23 for 4 expect 1 pred test5 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Farmer0, Fox0, Chicken0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 no Grain Object = Farmer0 + Fox0 + Chicken0 eats = Fox0->Chicken0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State3->Fox0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}} } run test5 for 4 expect 0 pred test53 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State0->Fox0 + State1->Farmer0 + State1->Fox0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test53 for 4 expect 0 pred test13 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Farmer0,none,Farmer0] }}}}}} } run test13 for 4 expect 0 pred test4 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Grain0: Grain {some disj Farmer0, Fox0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 no Chicken Grain = Grain0 Object = Farmer0 + Fox0 + Grain0 no eats State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State3->Fox0 far = State1->Farmer0 + State1->Grain0 + State2->Grain0 + State3->Farmer0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}} } run test4 for 4 expect 0 pred test15 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0 + Grain0,Grain0,none,Farmer0] }}}}}} } run test15 for 4 expect 0 pred test3 { some disj Farmer0: Farmer {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 no Fox Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Chicken0 + Grain0 eats = Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Chicken0 + State0->Grain0 + State1->Grain0 + State2->Farmer0 + State2->Grain0 + State3->Grain0 far = State1->Farmer0 + State1->Chicken0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}} } run test3 for 4 expect 0 pred test56 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Chicken0 + State2->Farmer0 + State2->Chicken0 + State3->Chicken0 far = State1->Farmer0 + State1->Fox0 + State2->Fox0 + State3->Farmer0 + State3->Fox0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test56 for 4 expect 1 pred test11 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,Fox0,none,Farmer0 + Grain0] }}}}}} } run test11 for 4 expect 1 pred test36 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Chicken0,Fox0,Fox0,Farmer0 + Fox0 + Chicken0] }}}}}} } run test36 for 4 expect 1 pred test32 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Chicken0 + Grain0,Chicken0,none,Farmer0 + Grain0] }}}}}} } run test32 for 4 expect 1 pred test38 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 + State3->Grain0 far = State1->Farmer0 + State1->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 crossRiver[Fox0 + Grain0,Grain0,Fox0 + Grain0,Farmer0 + Fox0 + Grain0] }}}}}} } run test38 for 4 expect 1 pred test55 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Farmer0 + State1->Grain0 + State2->Grain0 + State3->Fox0 + State3->Chicken0 far = State1->Fox0 + State1->Chicken0 + State1->Grain0 + State2->Farmer0 + State2->Fox0 + State2->Chicken0 + State2->Grain0 + State3->Farmer0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test55 for 4 expect 0 pred test52 { some disj Farmer0: Farmer {some disj Fox0: Fox {some disj Chicken0: Chicken {some disj Grain0: Grain {some disj Farmer0, Fox0, Chicken0, Grain0: Object {some disj State0, State1, State2, State3: State { Farmer = Farmer0 Fox = Fox0 Chicken = Chicken0 Grain = Grain0 Object = Farmer0 + Fox0 + Chicken0 + Grain0 eats = Fox0->Chicken0 + Chicken0->Grain0 State = State0 + State1 + State2 + State3 near = State0->Farmer0 + State0->Fox0 + State0->Chicken0 + State0->Grain0 + State1->Fox0 + State2->Farmer0 + State2->Fox0 + State2->Grain0 + State3->Fox0 far = State0->Chicken0 + State0->Grain0 + State1->Farmer0 + State1->Chicken0 + State1->Grain0 + State2->Chicken0 + State3->Farmer0 + State3->Chicken0 + State3->Grain0 ord/first = State0 ord/next = State0->State1 + State1->State2 + State2->State3 }}}}}} } run test52 for 4 expect 0
Cubical/Core/Glue.agda
cj-xu/cubical
0
8223
<reponame>cj-xu/cubical<filename>Cubical/Core/Glue.agda {- This file contains: - Definitions equivalences - Glue types -} {-# OPTIONS --cubical --safe #-} module Cubical.Core.Glue where open import Cubical.Core.Primitives open import Agda.Builtin.Cubical.Glue public using ( isEquiv -- ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} (f : A → B) → Type (ℓ ⊔ ℓ') ; equiv-proof -- ∀ (y : B) → isContr (fiber f y) ; _≃_ -- ∀ {ℓ ℓ'} (A : Type ℓ) (B : Type ℓ') → Type (ℓ ⊔ ℓ') ; equivFun -- ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} → A ≃ B → A → B ; equivProof -- ∀ {ℓ ℓ'} (T : Type ℓ) (A : Type ℓ') (w : T ≃ A) (a : A) φ → -- Partial φ (fiber (equivFun w) a) → fiber (equivFun w) a ; primGlue -- ∀ {ℓ ℓ'} (A : Type ℓ) {φ : I} (T : Partial φ (Type ℓ')) -- → (e : PartialP φ (λ o → T o ≃ A)) → Type ℓ' ; prim^unglue -- ∀ {ℓ ℓ'} {A : Type ℓ} {φ : I} {T : Partial φ (Type ℓ')} -- → {e : PartialP φ (λ o → T o ≃ A)} → primGlue A T e → A -- The ∀ operation on I. This is commented out as it is not currently used for anything -- ; primFaceForall -- (I → I) → I ) renaming ( prim^glue to glue -- ∀ {ℓ ℓ'} {A : Type ℓ} {φ : I} {T : Partial φ (Type ℓ')} -- → {e : PartialP φ (λ o → T o ≃ A)} -- → PartialP φ T → A → primGlue A T e ; pathToEquiv to lineToEquiv -- ∀ {ℓ : I → Level} (P : (i : I) → Type (ℓ i)) → P i0 ≃ P i1 ) private variable ℓ ℓ' : Level -- Uncurry Glue to make it more pleasant to use Glue : (A : Type ℓ) {φ : I} → (Te : Partial φ (Σ[ T ∈ Type ℓ' ] T ≃ A)) → Type ℓ' Glue A Te = primGlue A (λ x → Te x .fst) (λ x → Te x .snd) -- Make the φ argument of prim^unglue explicit unglue : {A : Type ℓ} (φ : I) {T : Partial φ (Type ℓ')} {e : PartialP φ (λ o → T o ≃ A)} → primGlue A T e → A unglue φ = prim^unglue {φ = φ}
source/rom10/r10_maps_ul.asm
evanbowman/Red
5
241800
;; generated by encode_room_layouts.py r10_room_data_ul:: ;;0.json DB $0e, $0e, $0e, $0e, $0e, $08, $39, $39, $39, $39, $02, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0a, $0a, $08, $39, $39, $39, $39, $39, $39, $06, $0e, $0e, $0e, $0e, $0e, $0c, $39, $11, $11, $11, $11, $11, $3a, $3a, $11, $11, $11, $11, $11, $11, $0e, $0c, $11, $12, $12, $12, $12, $12, $3a, $3a, $12, $12, $12, $12, $12, $12, $0e, $0c, $12, $13, $3b, $3b, $38, $3b, $39, $39, $3b, $3b, $3b, $05, $0d, $0d, $0a, $08, $13, $13, $39, $39, $39, $39, $39, $39, $39, $39, $39, $02, $0e, $0e, $39, $39, $3a, $3a, $39, $39, $39, $39, $39, $38, $39, $39, $39, $39, $06, $0e, $39, $39, $3a, $3a, $39, $39, $39, $39, $39, $39, $39, $39, $39, $39, $06, $0e, $39, $39, $14, $14, $39, $39, $39, $39, $39, $39, $39, $39, $39, $39, $06, $0e, $39, $39, $13, $13, $39, $39, $38, $39, $39, $39, $39, $39, $39, $39, $06, $0e, $0d, $0b, $13, $13, $03, $39, $39, $39, $39, $39, $39, $39, $05, $0d, $0e, $0e, $0e, $0c, $13, $13, $04, $39, $39, $39, $39, $39, $39, $39, $06, $0e, $0e, $0e, $0e, $0c, $13, $13, $06, $0b, $05, $0d, $0d, $0d, $0d, $0d, $0e, $0e, $0e, $0e, $0e, $0c, $13, $13, $06, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0c, $13, $13, $06, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0c, $13, $13, $06, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, ;;1.json DB $11, $02, $0e, $0e, $0e, $08, $39, $39, $39, $39, $02, $0e, $0e, $0e, $0e, $0e, $12, $11, $02, $0a, $08, $39, $39, $39, $39, $39, $39, $02, $0a, $0a, $0a, $0a, $13, $13, $11, $11, $11, $11, $3a, $3a, $3a, $3a, $3a, $11, $11, $11, $11, $11, $13, $13, $12, $12, $12, $12, $3a, $3a, $3a, $3a, $3a, $12, $12, $12, $12, $12, $13, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $14, $14, $14, $14, $14, $14, $14, $14, $14, $14, $14, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, r10_room_data_ul_end::
source/oasis/program-elements-delta_constraints.ads
optikos/oasis
0
11279
<gh_stars>0 -- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Constraints; with Program.Lexical_Elements; with Program.Elements.Expressions; package Program.Elements.Delta_Constraints is pragma Pure (Program.Elements.Delta_Constraints); type Delta_Constraint is limited interface and Program.Elements.Constraints.Constraint; type Delta_Constraint_Access is access all Delta_Constraint'Class with Storage_Size => 0; not overriding function Delta_Expression (Self : Delta_Constraint) return not null Program.Elements.Expressions.Expression_Access is abstract; not overriding function Real_Range_Constraint (Self : Delta_Constraint) return Program.Elements.Constraints.Constraint_Access is abstract; type Delta_Constraint_Text is limited interface; type Delta_Constraint_Text_Access is access all Delta_Constraint_Text'Class with Storage_Size => 0; not overriding function To_Delta_Constraint_Text (Self : aliased in out Delta_Constraint) return Delta_Constraint_Text_Access is abstract; not overriding function Delta_Token (Self : Delta_Constraint_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Range_Token (Self : Delta_Constraint_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Delta_Constraints;
tools-src/gnu/gcc/gcc/ada/gnatfind.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
10384
<reponame>enfoTek/tomato.linksys.e2000.nvram-mod<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T F I N D -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1998-2001 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT 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 distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- ------------------------------------------------------------------------------ with Xr_Tabls; with Xref_Lib; use Xref_Lib; with Ada.Text_IO; with GNAT.Command_Line; with Gnatvsn; with Osint; with Ada.Strings.Fixed; use Ada.Strings.Fixed; --------------- -- Gnatfind -- --------------- procedure Gnatfind is Output_Ref : Boolean := False; Pattern : Xref_Lib.Search_Pattern; Local_Symbols : Boolean := True; Prj_File : File_Name_String; Prj_File_Length : Natural := 0; Nb_File : Natural := 0; Usage_Error : exception; Full_Path_Name : Boolean := False; Have_Entity : Boolean := False; Wide_Search : Boolean := True; Glob_Mode : Boolean := True; Der_Info : Boolean := False; Type_Tree : Boolean := False; Read_Only : Boolean := False; Source_Lines : Boolean := False; Has_File_In_Entity : Boolean := False; -- Will be true if a file name was specified in the entity procedure Parse_Cmd_Line; -- Parse every switch on the command line procedure Write_Usage; -- Print a small help page for program usage -------------------- -- Parse_Cmd_Line -- -------------------- procedure Parse_Cmd_Line is begin loop case GNAT.Command_Line.Getopt ("a aI: aO: d e f g h I: p: r s t") is when ASCII.NUL => exit; when 'a' => if GNAT.Command_Line.Full_Switch = "a" then Read_Only := True; elsif GNAT.Command_Line.Full_Switch = "aI" then Osint.Add_Src_Search_Dir (GNAT.Command_Line.Parameter); else Osint.Add_Lib_Search_Dir (GNAT.Command_Line.Parameter); end if; when 'd' => Der_Info := True; when 'e' => Glob_Mode := False; when 'f' => Full_Path_Name := True; when 'g' => Local_Symbols := False; when 'h' => Write_Usage; when 'I' => Osint.Add_Src_Search_Dir (GNAT.Command_Line.Parameter); Osint.Add_Lib_Search_Dir (GNAT.Command_Line.Parameter); when 'p' => declare S : constant String := GNAT.Command_Line.Parameter; begin Prj_File_Length := S'Length; Prj_File (1 .. Prj_File_Length) := S; end; when 'r' => Output_Ref := True; when 's' => Source_Lines := True; when 't' => Type_Tree := True; when others => Write_Usage; end case; end loop; -- Get the other arguments loop declare S : constant String := GNAT.Command_Line.Get_Argument; begin exit when S'Length = 0; -- First argument is the pattern if not Have_Entity then Add_Entity (Pattern, S, Glob_Mode); Have_Entity := True; if not Has_File_In_Entity and then Index (S, ":") /= 0 then Has_File_In_Entity := True; end if; -- Next arguments are the files to search else Add_File (S); Wide_Search := False; Nb_File := Nb_File + 1; end if; end; end loop; exception when GNAT.Command_Line.Invalid_Switch => Ada.Text_IO.Put_Line ("Invalid switch : " & GNAT.Command_Line.Full_Switch); Write_Usage; when GNAT.Command_Line.Invalid_Parameter => Ada.Text_IO.Put_Line ("Parameter missing for : " & GNAT.Command_Line.Parameter); Write_Usage; when Xref_Lib.Invalid_Argument => Ada.Text_IO.Put_Line ("Invalid line or column in the pattern"); Write_Usage; end Parse_Cmd_Line; ----------------- -- Write_Usage -- ----------------- procedure Write_Usage is use Ada.Text_IO; begin Put_Line ("GNATFIND " & Gnatvsn.Gnat_Version_String & " Copyright 1998-2001, Ada Core Technologies Inc."); Put_Line ("Usage: gnatfind pattern[:sourcefile[:line[:column]]] " & "[file1 file2 ...]"); New_Line; Put_Line (" pattern Name of the entity to look for (can have " & "wildcards)"); Put_Line (" sourcefile Only find entities referenced from this " & "file"); Put_Line (" line Only find entities referenced from this line " & "of file"); Put_Line (" column Only find entities referenced from this columns" & " of file"); Put_Line (" file ... Set of Ada source files to search for " & "references. This parameters are optional"); New_Line; Put_Line ("gnatfind switches:"); Put_Line (" -a Consider all files, even when the ali file is " & "readonly"); Put_Line (" -aIdir Specify source files search path"); Put_Line (" -aOdir Specify library/object files search path"); Put_Line (" -d Output derived type information"); Put_Line (" -e Use the full regular expression set for pattern"); Put_Line (" -f Output full path name"); Put_Line (" -g Output information only for global symbols"); Put_Line (" -Idir Like -aIdir -aOdir"); Put_Line (" -p file Use file as the default project file"); Put_Line (" -r Find all references (default to find declaration" & " only)"); Put_Line (" -s Print source line"); Put_Line (" -t Print type hierarchy"); New_Line; raise Usage_Error; end Write_Usage; begin Osint.Initialize (Osint.Compiler); Parse_Cmd_Line; if not Have_Entity then Write_Usage; end if; -- Special case to speed things up: if the user has a command line of the -- form 'gnatfind entity:file', ie has specified a file and only wants the -- bodies and specs, then we can restrict the search to the .ali file -- associated with 'file'. if Has_File_In_Entity and then not Output_Ref then Wide_Search := False; end if; -- Find the project file if Prj_File_Length = 0 then Xr_Tabls.Create_Project_File (Default_Project_File (".")); else Xr_Tabls.Create_Project_File (Prj_File (1 .. Prj_File_Length)); end if; -- Fill up the table if Type_Tree and then Nb_File > 1 then Ada.Text_IO.Put_Line ("Error: for type hierarchy output you must " & "specify only one file."); Ada.Text_IO.New_Line; Write_Usage; end if; Search (Pattern, Local_Symbols, Wide_Search, Read_Only, Der_Info, Type_Tree); if Source_Lines then Xr_Tabls.Grep_Source_Files; end if; Print_Gnatfind (Output_Ref, Full_Path_Name); exception when Usage_Error => null; end Gnatfind;
data/maps/objects/SSAnneCaptainsRoom.asm
opiter09/ASM-Machina
1
170916
SSAnneCaptainsRoom_Object: db $c ; border block def_warps warp 0, 7, 8, SS_ANNE_2F def_signs sign 4, 1, 2 ; SSAnne7Text2 sign 1, 2, 3 ; SSAnne7Text3 def_objects object SPRITE_CAPTAIN, 4, 2, STAY, UP, 1 ; person def_warps_to SS_ANNE_CAPTAINS_ROOM
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver2/sfc/ys_w55.asm
prismotizm/gigaleak
0
5177
Name: ys_w55.asm Type: file Size: 24553 Last-Modified: '2016-05-13T04:51:43Z' SHA-1: 478CAC0F032C4EA8BFFE9BCABFC3683C8B1C52AE Description: null
_build/dispatcher/jmp_ippsSHA256MessageDigest_51189a3d.asm
zyktrcn/ippcp
1
246502
<filename>_build/dispatcher/jmp_ippsSHA256MessageDigest_51189a3d.asm extern m7_ippsSHA256MessageDigest:function extern n8_ippsSHA256MessageDigest:function extern y8_ippsSHA256MessageDigest:function extern e9_ippsSHA256MessageDigest:function extern l9_ippsSHA256MessageDigest:function extern n0_ippsSHA256MessageDigest:function extern k0_ippsSHA256MessageDigest:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsSHA256MessageDigest .Larraddr_ippsSHA256MessageDigest: dq m7_ippsSHA256MessageDigest dq n8_ippsSHA256MessageDigest dq y8_ippsSHA256MessageDigest dq e9_ippsSHA256MessageDigest dq l9_ippsSHA256MessageDigest dq n0_ippsSHA256MessageDigest dq k0_ippsSHA256MessageDigest segment .text global ippsSHA256MessageDigest:function (ippsSHA256MessageDigest.LEndippsSHA256MessageDigest - ippsSHA256MessageDigest) .Lin_ippsSHA256MessageDigest: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsSHA256MessageDigest: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsSHA256MessageDigest] mov r11, qword [r11+rax*8] jmp r11 .LEndippsSHA256MessageDigest:
ffight/lcs/boss/30.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
164843
copyright zengfr site:http://github.com/zengfr/romhack 003AFA move.w ($6,A1), ($30,A6) [1p+2A, 1p+2C, boss+2A, boss+2C, container+2A, container+2C, enemy+2A, enemy+2C, weapon+2A, weapon+2C] 003B00 rts [1p+30, boss+30, container+30, enemy+30, weapon+30] 003B34 move.w ($6,A1), ($30,A6) [1p+2A, 1p+2C, boss+2A, boss+2C, container+2A, container+2C, enemy+2A, enemy+2C, weapon+2A, weapon+2C] 003B3A rts [1p+30, boss+30, container+30, enemy+30, weapon+30] 003B6E move.w ($6,A1), ($30,A6) [boss+2A, boss+2C, enemy+2A, enemy+2C] 003B74 rts [boss+30, enemy+30] 03E03C tst.b ($29,A6) [boss+30] copyright zengfr site:http://github.com/zengfr/romhack
lab3_test_harness/test/state_data_in/2.asm
Zaydax/PipelineProcessor
2
29717
.ORIG x1234 AND R1, R1, R1 AND R2, R2, R2 AND R3, R3, R3 AND R4, R4, R4 AND R5, R5, R5 .END
oeis/093/A093821.asm
neoneye/loda-programs
11
163291
<reponame>neoneye/loda-programs ; A093821: Decimal expansion of (2*(3 - sqrt(3)))/3. ; Submitted by <NAME> ; 8,4,5,2,9,9,4,6,1,6,2,0,7,4,8,4,7,0,9,8,1,7,0,2,4,3,8,9,9,6,0,8,5,0,8,8,7,0,4,7,9,6,4,9,7,4,5,9,7,4,6,2,4,7,9,6,2,7,9,5,3,4,7,0,3,2,0,4,4,6,5,5,3,9,4,1,3,3,3,0,8,6,1,2,5,6,9,2,0,8,8,2,8,5,0,0,9,4,9,5 seq $0,246724 ; Decimal expansion of r_2, the second smallest radius for which a compact packing of the plane exists, with disks of radius 1 and r_2. sub $0,205 sub $2,$0 mov $0,$2 sub $0,196
unittests/ASM/SecondaryModRM/Reg_7_4.asm
fengjixuchui/FEX
0
24459
<filename>unittests/ASM/SecondaryModRM/Reg_7_4.asm %ifdef CONFIG { "RegData": { "RBX": "0x0" } } %endif ; Starting address to store to mov rax, 0xe8000000 ; Set up the cacheline with garbage mov rbx, 0x4142434445464748 mov [rax + 8 * 0], rbx mov [rax + 8 * 1], rbx mov [rax + 8 * 2], rbx mov [rax + 8 * 3], rbx mov [rax + 8 * 4], rbx mov [rax + 8 * 5], rbx mov [rax + 8 * 6], rbx mov [rax + 8 * 7], rbx clzero mov rbx, 0 add rbx, [rax + 8 * 0] add rbx, [rax + 8 * 1] add rbx, [rax + 8 * 2] add rbx, [rax + 8 * 3] add rbx, [rax + 8 * 4] add rbx, [rax + 8 * 5] add rbx, [rax + 8 * 6] add rbx, [rax + 8 * 7] hlt
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_248.asm
ljhsiun2/medusa
9
104916
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r8 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x11b03, %rsi lea addresses_WC_ht+0x5fb3, %rdi nop nop nop dec %r8 mov $9, %rcx rep movsb nop nop and $61662, %r10 lea addresses_A_ht+0x14583, %r8 nop nop sub %r12, %r12 mov $0x6162636465666768, %rsi movq %rsi, %xmm0 movups %xmm0, (%r8) xor %rcx, %rcx lea addresses_WT_ht+0x5403, %r10 cmp %rdi, %rdi movb (%r10), %r8b nop nop nop nop cmp $9048, %rsi lea addresses_D_ht+0xc1c3, %rcx add %r8, %r8 movb (%rcx), %r10b nop nop nop sub $52311, %rdi lea addresses_A_ht+0x1403, %rcx xor %rbp, %rbp mov $0x6162636465666768, %r12 movq %r12, %xmm6 and $0xffffffffffffffc0, %rcx vmovntdq %ymm6, (%rcx) nop nop cmp %rsi, %rsi lea addresses_D_ht+0xea03, %rcx clflush (%rcx) nop nop sub %rbp, %rbp mov $0x6162636465666768, %r12 movq %r12, %xmm2 movups %xmm2, (%rcx) nop xor $57772, %rsi lea addresses_A_ht+0x17edb, %rsi lea addresses_normal_ht+0x1af83, %rdi nop dec %rdx mov $19, %rcx rep movsw nop add %rcx, %rcx lea addresses_normal_ht+0x1ad3f, %rcx clflush (%rcx) add $57088, %r10 vmovups (%rcx), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %rdi and $24830, %rbp lea addresses_WC_ht+0x1d883, %rsi lea addresses_normal_ht+0x4f83, %rdi nop nop nop nop xor $54226, %r12 mov $120, %rcx rep movsw nop dec %rdx lea addresses_WC_ht+0x7d83, %rsi lea addresses_D_ht+0x820f, %rdi nop nop sub $13561, %rbp mov $101, %rcx rep movsl nop sub %r10, %r10 lea addresses_UC_ht+0x14f03, %r10 clflush (%r10) nop nop nop nop nop and %rcx, %rcx movb (%r10), %r8b nop nop nop nop inc %rdi lea addresses_WT_ht+0xeb63, %rsi lea addresses_D_ht+0x1d7d7, %rdi nop nop nop nop nop inc %rbp mov $90, %rcx rep movsw nop nop nop inc %rsi lea addresses_normal_ht+0x14fc3, %r12 nop nop nop nop nop dec %rdi movb (%r12), %dl nop nop nop nop xor %r8, %r8 lea addresses_A_ht+0x17263, %rsi nop add $26467, %rdi mov $0x6162636465666768, %rbp movq %rbp, %xmm0 movups %xmm0, (%rsi) nop nop nop nop inc %rbp pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r8 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %r8 push %rax push %rbp push %rbx push %rcx // Load lea addresses_WC+0x1cb83, %r8 nop nop nop sub $51788, %rax movb (%r8), %r15b nop nop nop nop nop add %rcx, %rcx // Store lea addresses_RW+0x14243, %r8 nop nop nop and $61390, %rbx mov $0x5152535455565758, %r15 movq %r15, %xmm6 vmovups %ymm6, (%r8) nop add $55556, %r15 // Faulty Load lea addresses_D+0xbd83, %rax nop nop nop dec %rbp mov (%rax), %r15w lea oracles, %r12 and $0xff, %r15 shlq $12, %r15 mov (%r12,%r15,1), %r15 pop %rcx pop %rbx pop %rbp pop %rax pop %r8 pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_D', 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WC', 'congruent': 8}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_RW', 'congruent': 5}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_A_ht', 'congruent': 11}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 7}} {'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 6}} {'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 6}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 7}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 1}} {'dst': {'same': True, 'congruent': 9, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}} {'dst': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC_ht', 'congruent': 5}} {'dst': {'same': True, 'congruent': 1, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_normal_ht', 'congruent': 4}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_A_ht', 'congruent': 5}, 'OP': 'STOR'} {'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 */
Cubical/Algebra/Group/Instances/Unit.agda
thomas-lamiaux/cubical
1
2071
{-# OPTIONS --safe #-} module Cubical.Algebra.Group.Instances.Unit where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Structure open import Cubical.Foundations.HLevels open import Cubical.Foundations.Equiv open import Cubical.Data.Unit open import Cubical.Algebra.Group.Base open import Cubical.Algebra.Group.DirProd open import Cubical.Algebra.Group.Morphisms open import Cubical.Algebra.Group.MorphismProperties open import Cubical.Algebra.Group.GroupPath open GroupStr open IsGroupHom private variable ℓ : Level UnitGroup₀ : Group₀ fst UnitGroup₀ = Unit 1g (snd UnitGroup₀) = tt _·_ (snd UnitGroup₀) = λ _ _ → tt inv (snd UnitGroup₀) = λ _ → tt isGroup (snd UnitGroup₀) = makeIsGroup isSetUnit (λ _ _ _ → refl) (λ _ → refl) (λ _ → refl) (λ _ → refl) (λ _ → refl) UnitGroup : Group ℓ fst UnitGroup = Unit* 1g (snd UnitGroup) = tt* _·_ (snd UnitGroup) = λ _ _ → tt* inv (snd UnitGroup) = λ _ → tt* isGroup (snd UnitGroup) = makeIsGroup (isOfHLevelUnit* 2) (λ _ _ _ → refl) (λ _ → refl) (λ _ → refl) (λ _ → refl) (λ _ → refl) open Iso -- The trivial group is a unit. lUnitGroupIso : {G : Group ℓ} → GroupIso (DirProd UnitGroup₀ G) G fun (fst lUnitGroupIso) = snd inv (fst lUnitGroupIso) g = tt , g rightInv (fst lUnitGroupIso) _ = refl leftInv (fst lUnitGroupIso) _ = refl snd lUnitGroupIso = makeIsGroupHom λ _ _ → refl rUnitGroupIso : {G : Group ℓ} → GroupIso (DirProd G UnitGroup₀) G fun (fst rUnitGroupIso) = fst inv (fst rUnitGroupIso) g = g , tt rightInv (fst rUnitGroupIso) _ = refl leftInv (fst rUnitGroupIso) _ = refl snd rUnitGroupIso = makeIsGroupHom λ _ _ → refl lUnitGroupEquiv : {G : Group ℓ} → GroupEquiv (DirProd UnitGroup₀ G) G lUnitGroupEquiv = GroupIso→GroupEquiv lUnitGroupIso rUnitGroupEquiv : ∀ {ℓ} {G : Group ℓ} → GroupEquiv (DirProd G UnitGroup₀) G rUnitGroupEquiv = GroupIso→GroupEquiv rUnitGroupIso contrGroupIsoUnit : {G : Group ℓ} → isContr ⟨ G ⟩ → GroupIso G UnitGroup₀ fun (fst (contrGroupIsoUnit contr)) _ = tt inv (fst (contrGroupIsoUnit contr)) _ = fst contr rightInv (fst (contrGroupIsoUnit contr)) _ = refl leftInv (fst (contrGroupIsoUnit contr)) x = snd contr x snd (contrGroupIsoUnit contr) = makeIsGroupHom λ _ _ → refl contrGroupEquivUnit : {G : Group ℓ} → isContr ⟨ G ⟩ → GroupEquiv G UnitGroup₀ contrGroupEquivUnit contr = GroupIso→GroupEquiv (contrGroupIsoUnit contr) isContr→≡UnitGroup : {G : Group ℓ-zero} → isContr (fst G) → UnitGroup₀ ≡ G isContr→≡UnitGroup c = fst (GroupPath _ _) (invGroupEquiv ((isContr→≃Unit c) , (makeIsGroupHom (λ _ _ → refl)))) GroupIsoUnitGroup→isContr : {G : Group ℓ-zero} → GroupIso UnitGroup₀ G → isContr (fst G) GroupIsoUnitGroup→isContr is = isOfHLevelRetractFromIso 0 (invIso (fst is)) isContrUnit →UnitHom : ∀ {ℓ} (G : Group ℓ) → GroupHom G UnitGroup₀ fst (→UnitHom G) _ = tt snd (→UnitHom G) = makeIsGroupHom λ _ _ → refl
libsrc/_DEVELOPMENT/arch/ts2068/display/c/sccz80/tshc_pxy2aaddr.asm
Frodevan/z88dk
640
83301
; void *tshc_pxy2aaddr(uchar x, uchar y) SECTION code_clib SECTION code_arch PUBLIC tshc_pxy2aaddr EXTERN asm_tshc_pxy2aaddr tshc_pxy2aaddr: pop af pop hl push hl push af jp asm_tshc_pxy2aaddr ; SDCC bridge for Classic IF __CLASSIC PUBLIC _tshc_pxy2aaddr defc _tshc_pxy2aaddr = tshc_pxy2aaddr ENDIF
zsnes.asm
youngkingtut/z3randomizer
1
170234
;-------------------------------------------------------------------------------- CheckZSNES: SEP #$28 LDA #$FF CLC ADC #$FF CMP #$64 CLD BEQ .zsnes REP #$20 LDA #$01FF : TCS ; thing we wrote over - initialize stack JML.l ReturnCheckZSNES .zsnes ; Set up video mode SEP #$30 ; X,Y,A are 8 bit numbers LDA #$80 ; screen off STA $2100 ; brightness + screen enable register LDA #$03 STA $2105 ; video mode 3, 8x8 tiles, 256 color BG1, 16 color BG2 STZ $2106 ; noplanes, no mosaic, = Mosaic register LDA #$01 STA $210B ; Set BG1 tile data offset to $2000 STZ $210D ; Plane 0 scroll x (first 8 bits) STZ $210D ; Plane 0 scroll x (last 3 bits) #$0 - #$07ff LDA #$01 STA $212C ; Enable BG1 LDA #$FF STA $210E ; Set BG1 scroll register STA $210E STZ $212E ; Window mask for Main Screen STZ $212F ; Window mask for Sub Screen LDA #$30 STA $2130 ; Color addition & screen addition init setting STZ $2131 ; Add/Sub sub designation for screen, sprite, color LDA #$E0 STA $2132 ; color data for addition/subtraction STZ $2133 ; Screen setting (interlace x,y/enable SFX data) STZ $4200 ; Disable V-blank, interrupt, Joypad register REP #$10 ; Load tilemap and tile data STZ $2116 LDA #$0C STA $2107 ; Set BG1 tilemap offset to $1800 and size to 32x32 STA $2117 ; VRAM write address $1800 LDA #$80 STA $2115 ; VRAM single word transfer, word increment LDX #$1801 STX $4300 ; DMA destination: VMDATAL/VMDATAH, fixed source LDX.w #ZSNES_TileMap STX $4302 ; Low DMA source address LDA.b #ZSNES_TileMap>>16 STA $4304 ; High DMA source address LDX.w #$800 STX $4305 ; Transfer 2048 bytes LDA #$01 STA $420B ; Start DMA transfer LDX.w #ZSNES_Tiles STX $4302 ; Low DMA source address LDA.b #ZSNES_Tiles>>16 STA $4304 ; High DMA source address LDX.w #$8000 STX $4305 ; Transfer 32768 bytes LDA #$01 STA $420B ; Start DMA transfer LDX.w #$8000 STX $4302 ; Low DMA source address LDA.b #$38 ; (ZSNES_Tiles>>16)+1 STA $4304 ; High DMA source address LDX.w #$6040 STX $4305 ; Transfer 24640 bytes LDA #$01 STA $420B ; Start DMA transfer ; Load CGRAM via DMA transfer STZ $2121 ; Start at color 0 LDX #$2200 STX $4300 ; DMA destination: CGDATA, byte increment LDX.w #ZSNES_Palette STX $4302 ; Low DMA source address LDA.b #ZSNES_Palette>>16 STA $4304 ; High DMA source address LDX #$0200 STX $4305 ; Transfer 512 bytes LDA #$01 STA $420B ; Start DMA transfer LDA #$0F ; screen on, full brightness STA $2100 ; brightness + screen enable register STP ; ! ;-------------------------------------------------------------------------------- org $378000 ZSNES_Tiles: incbin zsnes_tiles.bin ZSNES_TileMap: incbin zsnes_tilemap.bin ZSNES_Palette: incbin zsnes_pal.bin
libsrc/_DEVELOPMENT/arch/sms/SMSlib/c/sccz80/SMS_resetPauseRequest.asm
jpoikela/z88dk
640
247310
; void SMS_resetPauseRequest(void) SECTION code_clib SECTION code_SMSlib PUBLIC SMS_resetPauseRequest EXTERN asm_SMSlib_resetPauseRequest defc SMS_resetPauseRequest = asm_SMSlib_resetPauseRequest
tests/remote_node_test.adb
jonashaggstrom/ada-canopen
6
8714
with AUnit.Assertions; use AUnit.Assertions; with Ada.Real_Time; with ACO.Drivers.Dummy; with ACO.CANopen; with ACO.Nodes.Locals; with ACO.Nodes.Remotes; with ACO.OD.Example; with ACO.OD_Types; with ACO.OD_Types.Entries; with ACO.Messages; with ACO.States; with ACO.SDO_Sessions; with ACO.Configuration; package body Remote_Node_Test is procedure Bus_Propagate (Driver_1 : in out ACO.Drivers.Dummy.Dummy_Driver; Driver_2 : in out ACO.Drivers.Dummy.Dummy_Driver) is N1 : constant Natural := Driver_1.Nof_Sent; Msg : ACO.Messages.Message; begin while Driver_2.Is_Message_Pending loop Driver_2.Get_First_Sent (Msg); Driver_1.Send_Message (Msg); end loop; for I in 1 .. N1 loop Driver_1.Get_First_Sent (Msg); Driver_2.Send_Message (Msg); end loop; end Bus_Propagate; function Name (T : Test) return AUnit.Message_String is pragma Unreferenced (T); begin return AUnit.Format ("Remote Node Test"); end Name; procedure Run_Test (T : in out Test) is pragma Unreferenced (T); use type ACO.States.State; T_Now : Ada.Real_Time.Time; procedure Let_Time_Pass (H1, H2 : in out ACO.CANopen.Handler; D1, D2 : in out ACO.Drivers.Dummy.Dummy_Driver; Time_Ms : in Natural) is use Ada.Real_Time; begin for DT in 1 .. Time_Ms loop T_Now := T_Now + Milliseconds (1); D1.Set_Time (T_Now); D2.Set_Time (T_Now); H1.Periodic_Actions (T_Now); Bus_Propagate (D1, D2); H2.Periodic_Actions (T_Now); Bus_Propagate (D1, D2); end loop; end Let_Time_Pass; OLoc : aliased ACO.OD.Example.Dictionary; ORem : aliased ACO.OD.Example.Dictionary; DL : aliased ACO.Drivers.Dummy.Dummy_Driver; DR : aliased ACO.Drivers.Dummy.Dummy_Driver; HL : aliased ACO.CANopen.Handler (Driver => DL'Access); HR : aliased ACO.CANopen.Handler (Driver => DR'Access); L : ACO.Nodes.Locals.Local (Id => 1, Handler => HL'Access, Od => OLoc'Access); R : aliased ACO.Nodes.Remotes.Remote (Id => 1, Handler => HR'Access, Od => ORem'Access); Heartbeat_Period : constant := 10; begin T_Now := Ada.Real_Time.Clock; OLoc.Set_Heartbeat_Producer_Period (Period => Heartbeat_Period); ------------------------------------------------------------------------- -- Startup Test ------------------------------------------------------------------------- L.Start; R.Start; Let_Time_Pass (HL, HR, DL, DR, Time_Ms => 1); Assert (L.Get_State = ACO.States.Pre_Operational, "Expected Local to report Pre-Operational"); Assert (R.Get_State = ACO.States.Pre_Operational, "Expected Remote to report Pre-Operational"); ------------------------------------------------------------------------- -- Change the state of the local node through the remote node object ------------------------------------------------------------------------- R.Set_State (ACO.States.Operational); -- Wait for heartbeat local -> remote Let_Time_Pass (HL, HR, DL, DR, Time_Ms => Heartbeat_Period + 1); Assert (L.Get_State = ACO.States.Operational, "Expected Local to report Operational"); Assert (R.Get_State = ACO.States.Operational, "Expected Remote to report Operational"); ------------------------------------------------------------------------- -- Change the state of the local node ------------------------------------------------------------------------- L.Set_State (ACO.States.Stopped); Assert (L.Get_State = ACO.States.Stopped, "Expected Local to report Stopped"); Let_Time_Pass (HL, HR, DL, DR, Time_Ms => Heartbeat_Period); Assert (L.Get_State = ACO.States.Stopped, "Expected Local to report Stopped"); Assert (R.Get_State = ACO.States.Stopped, "Expected Remote to report Stopped"); ------------------------------------------------------------------------- -- Write (Download) entry to local node via remote node object ------------------------------------------------------------------------- declare use ACO.OD_Types.Entries; use ACO.OD_Types; use type ACO.Nodes.Remotes.SDO_Status; Value : constant := 1000; E : constant Entry_Base'Class := Entry_U16'(Create (RW, Value)); Request : ACO.Nodes.Remotes.SDO_Write_Request (R'Access); begin -- Test normal case that should succeed L.Set_State (ACO.States.Pre_Operational); Let_Time_Pass (HL, HR, DL, DR, Time_Ms => Heartbeat_Period); R.Write (Request => Request, Index => ACO.OD.Heartbeat_Producer_Index, Subindex => 0, An_Entry => E); Assert (Request.Status = ACO.SDO_Sessions.Pending, "Expected request status to be Pending initially"); Let_Time_Pass (HL, HR, DL, DR, Time_Ms => 2); Assert (Request.Status = ACO.SDO_Sessions.Complete, "Expected request status to be Completed"); -- Test write to an entry that is not in the OD R.Write (Request => Request, Index => 16#5555#, Subindex => 0, An_Entry => E); Assert (Request.Status = ACO.SDO_Sessions.Pending, "Expected request status to be Pending initially"); Let_Time_Pass (HL, HR, DL, DR, Time_Ms => 2); Assert (Request.Status = ACO.SDO_Sessions.Error, "Expected status to be Error, since the entry does not exist"); -- Test write to node that is stopped, will time-out L.Set_State (ACO.States.Stopped); Let_Time_Pass (HL, HR, DL, DR, Time_Ms => Heartbeat_Period); R.Write (Request => Request, Index => ACO.OD.Heartbeat_Producer_Index, Subindex => 0, An_Entry => E); Assert (Request.Status = ACO.SDO_Sessions.Pending, "Expected request status to be Pending initially"); Let_Time_Pass (HL, HR, DL, DR, Time_Ms => ACO.Configuration.SDO_Session_Timeout_Ms); Assert (Request.Status = ACO.SDO_Sessions.Error, "Expected status to be Error, since the request timed out"); end; ------------------------------------------------------------------------- -- Read (Upload) entry from local node via remote node object ------------------------------------------------------------------------- declare use ACO.OD_Types.Entries; use ACO.OD_Types; use type ACO.Nodes.Remotes.SDO_Status; Value : constant := 1337; E : aliased Entry_U16; Request : ACO.Nodes.Remotes.SDO_Read_Request (R'Access, E'Access); begin OLoc.Set_Heartbeat_Producer_Period (Period => Value); Let_Time_Pass (HL, HR, DL, DR, Time_Ms => Value); L.Set_State (ACO.States.Pre_Operational); Let_Time_Pass (HL, HR, DL, DR, Time_Ms => Value); R.Read (Request => Request, Index => ACO.OD.Heartbeat_Producer_Index, Subindex => 0); Assert (Request.Status = ACO.SDO_Sessions.Pending, "Expected request status to be Pending initially"); Let_Time_Pass (HL, HR, DL, DR, Time_Ms => 2); Assert (Request.Status = ACO.SDO_Sessions.Complete, "Expected request status to be Completed"); Request.Get_Entry; Assert (E.Read = Value, "Expected read value to be as written:" & Value'Img); end; end Run_Test; end Remote_Node_Test;
oeis/000/A000911.asm
neoneye/loda-programs
11
10708
; A000911: a(n) = (2n+3)! /( n! * (n+1)! ). ; 6,60,420,2520,13860,72072,360360,1750320,8314020,38798760,178474296,811246800,3650610600,16287339600,72129646800,317370445920,1388495700900,6044040109800,26190840475800,113034153632400,486046860619320,2083057974082800,8900338616535600,37923181931325600,161173523208133800,683375738402487312,2891205047087446320,12207310198813662240,51445092980714719440,216424184263696405920,908981573907524904864,3811858213160588310720,15962156267609963551140,66750835300914393032040,278782900374407170898520 add $0,2 mov $1,$0 mul $0,2 bin $0,$1 bin $1,2 mul $1,$0 mov $0,$1
stage4/graphics_circle_algorithm.asm
amrwc/8086-graphics
5
97854
<gh_stars>1-10 ; Circle drawing implementation of Bresenham's line drawing algorithm. ; ; void plotCircle(int xm, int ym, int r) ; { ; int x = -r, y = 0, err = 2-2*r; /* II. Quadrant */ ; do { ; setPixel(xm-x, ym+y); /* I. Quadrant */ ; setPixel(xm-y, ym-x); /* II. Quadrant */ ; setPixel(xm+x, ym-y); /* III. Quadrant */ ; setPixel(xm+y, ym+x); /* IV. Quadrant */ ; r = err; ; if (r <= y) err += ++y*2+1; /* e_xy+e_y < 0 */ ; if (r > x || err > y) err += ++x*2+1; /* e_xy+e_x > 0 or no 2nd y-step */ ; } while (x < 0); ; } ; ; Offset on screen: ; es = A000h ; di = 320*y + x -> di = 256*y + 64*y + x ; ; Input: ; xm: [bp + 10] -> [bp + circ_xm] ; ym: [bp + 8] -> [bp + circ_ym] ; r: [bp + 6] -> [bp + circ_r] ; px: [bp + 4] -> [bp + px_set] %assign circ_xm 10 %assign circ_ym 8 %assign circ_r 6 %assign px_set 4 %assign x 2 %assign y 4 %assign err 6 %include "graphics_circle_tests.asm" Graphics_Circle_Algorithm: push bp mov bp, sp sub sp, 6 push es push di push si push ax push cx push dx ;____________________ ; Setup call Graphics_Circle_Tests mov si, word [bp + circ_r] ; x = -r neg si mov [bp - x], si mov [bp - y], word 0d ; y = 0 neg si ; err = 2 - 2*r add si, word [bp + circ_r] mov [bp - err], word 2d sub [bp - err], si mov si, 0A000h ; Segment of display memory mov es, si mov ax, word [bp + px_set] ; Set colour ;____________________ Draw_Circle_Repeat: mov si, word [bp + circ_ym] ;y ; 1st quadrant add si, word [bp - y] mov di, si shl di, 8 ; di *= 2**8 -> di *= 256 shl si, 6 ; si *= 2**6 -> si *= 64 add di, si ; di = 256y + 64y mov si, word [bp + circ_xm] ;x sub si, word [bp - x] add di, si ; di += x mov byte [es:di], al ; Plot pixel to the calculated location. mov si, word [bp + circ_ym] ; 2nd quadrant sub si, word [bp - x] mov di, si shl di, 8 shl si, 6 add di, si mov si, word [bp + circ_xm] sub si, word [bp - y] add di, si mov byte [es:di], al mov si, word [bp + circ_ym] ; 3rd quadrant sub si, word [bp - y] mov di, si shl di, 8 shl si, 6 add di, si mov si, word [bp + circ_xm] add si, word [bp - x] add di, si mov byte [es:di], al mov si, word [bp + circ_ym] ; 4th quadrant add si, word [bp - x] mov di, si shl di, 8 shl si, 6 add di, si mov si, word [bp + circ_xm] add si, word [bp - y] add di, si mov byte [es:di], al ;____________________ mov si, word [bp - err] ; r = err mov [bp + circ_r], si mov si, word [bp + circ_r] ; if (r <= y) err += ++y*2+1; cmp si, word [bp - y] jg circle_test2 inc word [bp - y] mov si, word [bp - y] add si, si inc si add [bp - err], si circle_test2: mov si, word [bp + circ_r] ; if (r > x || err > y) err += ++x*2+1; cmp si, word [bp - x] jg circle_test2_execute mov si, word [bp - err] cmp si, word [bp - y] jg circle_test2_execute jmp circle_test_exit circle_test2_execute: inc word [bp - x] ; err += ++x*2+1 mov si, word [bp - x] add si, si inc si add [bp - err], si ;____________________ circle_test_exit: cmp [bp - x], word 0 ; if (x < 0) break; jl Draw_Circle_Repeat pop dx pop cx pop ax pop si pop di pop es leave ret 8
src/x86/itx_ssse3.asm
xrmx/rav1e
1
160997
; Copyright © 2018, VideoLAN and dav1d authors ; Copyright © 2018, Two Orioles, LLC ; All rights reserved. ; ; 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 OWNER OR CONTRIBUTORS BE LIABLE FOR ; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. %include "ext/x86/x86inc.asm" SECTION_RODATA 16 deint_shuf: db 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15 deint_shuf1: db 0, 1, 8, 9, 2, 3, 10, 11, 4, 5, 12, 13, 6, 7, 14, 15 deint_shuf2: db 8, 9, 0, 1, 10, 11, 2, 3, 12, 13, 4, 5, 14, 15, 6, 7 %macro COEF_PAIR 2-3 0 ; !0 = m%1_m%2, 2 = no %2_%1 pw_%1_m%2: times 4 dw %1, -%2 %if %3 != 2 pw_%2_%1: times 4 dw %2, %1 %endif %if %3 pw_m%1_m%2: times 4 dw -%1, -%2 %endif %endmacro ;adst4 pw_1321_3803: times 4 dw 1321, 3803 pw_2482_m1321: times 4 dw 2482, -1321 pw_3344_2482: times 4 dw 3344, 2482 pw_3344_m3803: times 4 dw 3344, -3803 pw_3344_m3344: times 4 dw 3344, -3344 pw_0_3344 times 4 dw 0, 3344 pw_m6688_m3803: times 4 dw -6688, -3803 COEF_PAIR 2896, 2896 COEF_PAIR 1567, 3784 COEF_PAIR 799, 4017 COEF_PAIR 3406, 2276 COEF_PAIR 401, 4076 COEF_PAIR 1931, 3612 COEF_PAIR 3166, 2598 COEF_PAIR 3920, 1189 COEF_PAIR 3784, 1567, 1 COEF_PAIR 995, 3973 COEF_PAIR 1751, 3703 COEF_PAIR 3513, 2106 COEF_PAIR 3857, 1380 COEF_PAIR 4017, 799, 1 COEF_PAIR 201, 4091 COEF_PAIR 2440, 3290 COEF_PAIR 3035, 2751 COEF_PAIR 4052, 601 COEF_PAIR 2276, 3406, 1 COEF_PAIR 4076, 401, 2 COEF_PAIR 2598, 3166, 2 COEF_PAIR 3612, 1931, 2 COEF_PAIR 1189, 3920, 2 pd_2048: times 4 dd 2048 pw_2048: times 8 dw 2048 pw_m2048: times 8 dw -2048 pw_4096: times 8 dw 4096 pw_16384: times 8 dw 16384 pw_m16384: times 8 dw -16384 pw_1697x16: times 8 dw 1697*16 pw_1697x8: times 8 dw 1697*8 pw_2896x8: times 8 dw 2896*8 pw_3344x8: times 8 dw 3344*8 pw_8192: times 8 dw 8192 pw_m8192: times 8 dw -8192 pw_5: times 8 dw 5 pw_201x8: times 8 dw 201*8 pw_4091x8: times 8 dw 4091*8 pw_m2751x8: times 8 dw -2751*8 pw_3035x8: times 8 dw 3035*8 pw_1751x8: times 8 dw 1751*8 pw_3703x8: times 8 dw 3703*8 pw_m1380x8: times 8 dw -1380*8 pw_3857x8: times 8 dw 3857*8 pw_995x8: times 8 dw 995*8 pw_3973x8: times 8 dw 3973*8 pw_m2106x8: times 8 dw -2106*8 pw_3513x8: times 8 dw 3513*8 pw_2440x8: times 8 dw 2440*8 pw_3290x8: times 8 dw 3290*8 pw_m601x8: times 8 dw -601*8 pw_4052x8: times 8 dw 4052*8 pw_4095x8: times 8 dw 4095*8 pw_101x8: times 8 dw 101*8 pw_2967x8: times 8 dw 2967*8 pw_m2824x8: times 8 dw -2824*8 pw_3745x8: times 8 dw 3745*8 pw_1660x8: times 8 dw 1660*8 pw_3822x8: times 8 dw 3822*8 pw_m1474x8: times 8 dw -1474*8 pw_3996x8: times 8 dw 3996*8 pw_897x8: times 8 dw 897*8 pw_3461x8: times 8 dw 3461*8 pw_m2191x8: times 8 dw -2191*8 pw_3349x8: times 8 dw 3349*8 pw_2359x8: times 8 dw 2359*8 pw_4036x8: times 8 dw 4036*8 pw_m700x8: times 8 dw -700*8 pw_4065x8: times 8 dw 4065*8 pw_501x8: times 8 dw 501*8 pw_3229x8: times 8 dw 3229*8 pw_m2520x8: times 8 dw -2520*8 pw_3564x8: times 8 dw 3564*8 pw_2019x8: times 8 dw 2019*8 pw_3948x8: times 8 dw 3948*8 pw_m1092x8: times 8 dw -1092*8 pw_3889x8: times 8 dw 3889*8 pw_1285x8: times 8 dw 1285*8 pw_3659x8: times 8 dw 3659*8 pw_m1842x8: times 8 dw -1842*8 pw_3102x8: times 8 dw 3102*8 pw_2675x8: times 8 dw 2675*8 pw_4085x8: times 8 dw 4085*8 pw_m301x8: times 8 dw -301*8 SECTION .text %macro REPX 2-* %xdefine %%f(x) %1 %rep %0 - 1 %rotate 1 %%f(%1) %endrep %endmacro %define m(x) mangle(private_prefix %+ _ %+ x %+ SUFFIX) %if ARCH_X86_64 %define o(x) x %else %define o(x) r5-$$+x ; PIC %endif %macro WRITE_4X4 9 ;src[1-2], tmp[1-3], row[1-4] lea r2, [dstq+strideq*2] %assign %%i 1 %rotate 5 %rep 4 %if %1 & 2 CAT_XDEFINE %%row_adr, %%i, r2 + strideq*(%1&1) %else CAT_XDEFINE %%row_adr, %%i, dstq + strideq*(%1&1) %endif %assign %%i %%i + 1 %rotate 1 %endrep movd m%3, [%%row_adr1] ;dst0 movd m%5, [%%row_adr2] ;dst1 punpckldq m%3, m%5 ;high: dst1 :low: dst0 movd m%4, [%%row_adr3] ;dst2 movd m%5, [%%row_adr4] ;dst3 punpckldq m%4, m%5 ;high: dst3 :low: dst2 pxor m%5, m%5 punpcklbw m%3, m%5 ;extend byte to word punpcklbw m%4, m%5 ;extend byte to word paddw m%3, m%1 ;high: dst1 + out1 ;low: dst0 + out0 paddw m%4, m%2 ;high: dst3 + out3 ;low: dst2 + out2 packuswb m%3, m%4 ;high->low: dst3 + out3, dst2 + out2, dst1 + out1, dst0 + out0 movd [%%row_adr1], m%3 ;store dst0 + out0 pshuflw m%4, m%3, q1032 movd [%%row_adr2], m%4 ;store dst1 + out1 punpckhqdq m%3, m%3 movd [%%row_adr3], m%3 ;store dst2 + out2 psrlq m%3, 32 movd [%%row_adr4], m%3 ;store dst3 + out3 %endmacro %macro ITX4_END 4-5 2048 ; row[1-4], rnd %if %5 mova m2, [o(pw_%5)] pmulhrsw m0, m2 pmulhrsw m1, m2 %endif WRITE_4X4 0, 1, 2, 3, 4, %1, %2, %3, %4 ret %endmacro ; flags: 1 = swap, 2: coef_regs, 4: no_pack %macro ITX_MUL2X_PACK 5-6 0 ; dst/src, tmp[1], rnd, coef[1-2], flags %if %6 & 2 pmaddwd m%2, m%4, m%1 pmaddwd m%1, m%5 %elif %6 & 1 pmaddwd m%2, m%1, [o(pw_%5_%4)] pmaddwd m%1, [o(pw_%4_m%5)] %else pmaddwd m%2, m%1, [o(pw_%4_m%5)] pmaddwd m%1, [o(pw_%5_%4)] %endif paddd m%2, m%3 paddd m%1, m%3 psrad m%2, 12 psrad m%1, 12 %if %6 & 4 == 0 packssdw m%1, m%2 %endif %endmacro %macro IDCT4_1D_PACKED 0-1 ;pw_2896x8 mova m3, [o(pd_2048)] punpckhwd m2, m0, m1 ;unpacked in1 in3 punpcklwd m0, m1 ;unpacked in0 in2 ITX_MUL2X_PACK 2, 1, 3, 1567, 3784 ITX_MUL2X_PACK 0, 1, 3, 2896, 2896 psubsw m1, m0, m2 ;high: out2 ;low: out3 paddsw m0, m2 ;high: out1 ;low: out0 %endmacro %macro INV_TXFM_FN 4+ ; type1, type2, size, xmm/stack cglobal inv_txfm_add_%1_%2_%3, 4, 6, %4, dst, stride, coeff, eob, tx2 %define %%p1 m(i%1_%3_internal) %if ARCH_X86_32 LEA r5, $$ %endif %if has_epilogue %ifidn %1_%2, dct_dct test eobd, eobd jz %%end %endif lea tx2q, [o(m(i%2_%3_internal).pass2)] call %%p1 RET %%end: %else lea tx2q, [o(m(i%2_%3_internal).pass2)] %ifidn %1_%2, dct_dct test eobd, eobd jnz %%p1 %else times ((%%end - %%p1) >> 31) & 1 jmp %%p1 ALIGN function_align %%end: %endif %endif %endmacro %macro INV_TXFM_4X4_FN 2 ; type1, type2 INV_TXFM_FN %1, %2, 4x4, 6 %ifidn %1_%2, dct_dct pshuflw m0, [coeffq], q0000 punpcklqdq m0, m0 mova m1, [o(pw_2896x8)] pmulhrsw m0, m1 mov [coeffq], eobd ;0 pmulhrsw m0, m1 mova m1, m0 TAIL_CALL m(iadst_4x4_internal).end2 %endif %endmacro INIT_XMM ssse3 INV_TXFM_4X4_FN dct, dct INV_TXFM_4X4_FN dct, adst INV_TXFM_4X4_FN dct, flipadst INV_TXFM_4X4_FN dct, identity cglobal idct_4x4_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m0, [coeffq+16*0] ;high: in1 ;low: in0 mova m1, [coeffq+16*1] ;high: in3 ;low in2 IDCT4_1D_PACKED mova m2, [o(deint_shuf)] shufps m3, m0, m1, q1331 shufps m0, m1, q0220 pshufb m0, m2 ;high: in1 ;low: in0 pshufb m1, m3, m2 ;high: in3 ;low :in2 jmp tx2q .pass2: IDCT4_1D_PACKED pxor m2, m2 mova [coeffq+16*0], m2 mova [coeffq+16*1], m2 ;memset(coeff, 0, sizeof(*coeff) * sh * sw); ITX4_END 0, 1, 3, 2 INV_TXFM_4X4_FN adst, dct INV_TXFM_4X4_FN adst, adst INV_TXFM_4X4_FN adst, flipadst INV_TXFM_4X4_FN adst, identity cglobal iadst_4x4_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m0, [coeffq+16*0] mova m1, [coeffq+16*1] call .main punpckhwd m2, m0, m1 punpcklwd m0, m1 punpckhwd m1, m0, m2 ;high: in3 ;low :in2 punpcklwd m0, m2 ;high: in1 ;low: in0 jmp tx2q .pass2: call .main .end: pxor m2, m2 mova [coeffq+16*0], m2 mova [coeffq+16*1], m2 .end2: ITX4_END 0, 1, 2, 3 ALIGN function_align .main: punpcklwd m2, m0, m1 ;unpacked in0 in2 punpckhwd m0, m1 ;unpacked in1 in3 mova m3, m0 pmaddwd m1, m2, [o(pw_3344_m3344)];3344 * in0 - 3344 * in2 pmaddwd m0, [o(pw_0_3344)] ;3344 * in3 paddd m1, m0 ;t2 pmaddwd m0, m2, [o(pw_1321_3803)] ;1321 * in0 + 3803 * in2 pmaddwd m2, [o(pw_2482_m1321)] ;2482 * in0 - 1321 * in2 pmaddwd m4, m3, [o(pw_3344_2482)] ;3344 * in1 + 2482 * in3 pmaddwd m5, m3, [o(pw_3344_m3803)];3344 * in1 - 3803 * in3 paddd m4, m0 ;t0 + t3 pmaddwd m3, [o(pw_m6688_m3803)] ;-2 * 3344 * in1 - 3803 * in3 mova m0, [o(pd_2048)] paddd m1, m0 ;t2 + 2048 paddd m2, m0 paddd m0, m4 ;t0 + t3 + 2048 paddd m5, m2 ;t1 + t3 + 2048 paddd m2, m4 paddd m2, m3 ;t0 + t1 - t3 + 2048 REPX {psrad x, 12}, m1, m0, m5, m2 packssdw m0, m5 ;high: out1 ;low: out0 packssdw m1, m2 ;high: out3 ;low: out3 ret INV_TXFM_4X4_FN flipadst, dct INV_TXFM_4X4_FN flipadst, adst INV_TXFM_4X4_FN flipadst, flipadst INV_TXFM_4X4_FN flipadst, identity cglobal iflipadst_4x4_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m0, [coeffq+16*0] mova m1, [coeffq+16*1] call m(iadst_4x4_internal).main punpcklwd m2, m1, m0 punpckhwd m1, m0 punpcklwd m0, m1, m2 ;high: in3 ;low :in2 punpckhwd m1, m2 ;high: in1 ;low: in0 jmp tx2q .pass2: call m(iadst_4x4_internal).main .end: pxor m2, m2 mova [coeffq+16*0], m2 mova [coeffq+16*1], m2 .end2: ITX4_END 3, 2, 1, 0 INV_TXFM_4X4_FN identity, dct INV_TXFM_4X4_FN identity, adst INV_TXFM_4X4_FN identity, flipadst INV_TXFM_4X4_FN identity, identity cglobal iidentity_4x4_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m0, [coeffq+16*0] mova m1, [coeffq+16*1] mova m3, [o(pw_1697x8)] pmulhrsw m2, m0, m3 pmulhrsw m3, m1 paddsw m0, m2 paddsw m1, m3 punpckhwd m2, m0, m1 punpcklwd m0, m1 punpckhwd m1, m0, m2 ;high: in3 ;low :in2 punpcklwd m0, m2 ;high: in1 ;low: in0 jmp tx2q .pass2: mova m3, [o(pw_1697x8)] pmulhrsw m2, m3, m0 pmulhrsw m3, m1 paddsw m0, m2 paddsw m1, m3 jmp m(iadst_4x4_internal).end %macro IWHT4_1D_PACKED 0 punpckhqdq m3, m0, m1 ;low: in1 high: in3 punpcklqdq m0, m1 ;low: in0 high: in2 psubw m2, m0, m3 ;low: in0 - in1 high: in2 - in3 paddw m0, m3 ;low: in0 + in1 high: in2 + in3 punpckhqdq m2, m2 ;t2 t2 punpcklqdq m0, m0 ;t0 t0 psubw m1, m0, m2 psraw m1, 1 ;t4 t4 psubw m1, m3 ;low: t1/out2 high: t3/out1 psubw m0, m1 ;high: out0 paddw m2, m1 ;low: out3 %endmacro cglobal inv_txfm_add_wht_wht_4x4, 3, 3, 4, dst, stride, coeff mova m0, [coeffq+16*0] mova m1, [coeffq+16*1] pxor m2, m2 mova [coeffq+16*0], m2 mova [coeffq+16*1], m2 psraw m0, 2 psraw m1, 2 IWHT4_1D_PACKED punpckhwd m0, m1 punpcklwd m3, m1, m2 punpckhdq m1, m0, m3 punpckldq m0, m3 IWHT4_1D_PACKED shufpd m0, m2, 0x01 ITX4_END 0, 3, 2, 1, 0 %macro IDCT8_1D_PACKED 0 mova m6, [o(pd_2048)] punpckhwd m4, m0, m3 ;unpacked in1 in7 punpcklwd m0, m2 ;unpacked in0 in4 punpckhwd m2, m1 ;unpacked in5 in3 punpcklwd m1, m3 ;unpacked in2 in6 ITX_MUL2X_PACK 4, 3, 6, 799, 4017 ;low: t7a high: t4a ITX_MUL2X_PACK 2, 3, 6, 3406, 2276 ;low: t6a high: t5a ITX_MUL2X_PACK 1, 3, 6, 1567, 3784 ;low: t3 high: t2 psubsw m3, m4, m2 ;low: t6a high: t5a paddsw m4, m2 ;low: t7 high: t4 pshufb m3, [o(deint_shuf1)] ITX_MUL2X_PACK 0, 2, 6, 2896, 2896 ;low: t0 high: t1 ITX_MUL2X_PACK 3, 2, 6, 2896, 2896 ;low: t6 high: t5 psubsw m2, m0, m1 ;low: tmp3 high: tmp2 paddsw m0, m1 ;low: tmp0 high: tmp1 punpcklqdq m1, m4, m3 ;low: t7 high: t6 punpckhqdq m4, m3 ;low: t4 high: t5 psubsw m3, m0, m1 ;low: out7 high: out6 paddsw m0, m1 ;low: out0 high: out1 paddsw m1, m2, m4 ;low: out3 high: out2 psubsw m2, m4 ;low: out4 high: out5 %endmacro ;dst1 = (src1 * coef1 - src2 * coef2 + rnd) >> 12 ;dst2 = (src1 * coef2 + src2 * coef1 + rnd) >> 12 %macro ITX_MULSUB_2W 7-8 0 ; dst/src[1-2], tmp[1-2], rnd, coef[1-2], dst2_in_tmp1 punpckhwd m%4, m%1, m%2 punpcklwd m%1, m%2 %if %7 < 8 pmaddwd m%2, m%7, m%1 pmaddwd m%3, m%7, m%4 %else mova m%2, [o(pw_%7_%6)] %if %8 pmaddwd m%3, m%1, m%2 pmaddwd m%2, m%4 %else pmaddwd m%3, m%4, m%2 pmaddwd m%2, m%1 %endif %endif paddd m%3, m%5 paddd m%2, m%5 psrad m%3, 12 psrad m%2, 12 %if %8 packssdw m%3, m%2 %else packssdw m%2, m%3 ;dst2 %endif %if %7 < 8 pmaddwd m%4, m%6 pmaddwd m%1, m%6 %elif %8 mova m%2, [o(pw_%6_m%7)] pmaddwd m%4, m%2 pmaddwd m%1, m%2 %else mova m%3, [o(pw_%6_m%7)] pmaddwd m%4, m%3 pmaddwd m%1, m%3 %endif paddd m%4, m%5 paddd m%1, m%5 psrad m%4, 12 psrad m%1, 12 packssdw m%1, m%4 ;dst1 %endmacro %macro IDCT4_1D 7 ; src[1-4], tmp[1-2], pd_2048 ITX_MULSUB_2W %2, %4, %5, %6, %7, 1567, 3784, 1 ;t2, t3 ITX_MULSUB_2W %1, %3, %4, %6, %7, 2896, 2896, 1 ;t1, t0 psubsw m%3, m%1, m%2 ;out2 paddsw m%2, m%1 ;out1 paddsw m%1, m%5, m%4 ;out0 psubsw m%4, m%5 ;out3 %endmacro %macro WRITE_4X8 4 ;row[1-4] WRITE_4X4 0, 1, 4, 5, 6, %1, %2, %3, %4 lea dstq, [dstq+strideq*4] WRITE_4X4 2, 3, 4, 5, 6, %1, %2, %3, %4 %endmacro %macro INV_4X8 0 punpckhwd m4, m2, m3 punpcklwd m2, m3 punpckhwd m3, m0, m1 punpcklwd m0, m1 punpckhdq m1, m0, m2 ;low: in2 high: in3 punpckldq m0, m2 ;low: in0 high: in1 punpckldq m2, m3, m4 ;low: in4 high: in5 punpckhdq m3, m4 ;low: in6 high: in7 %endmacro %macro INV_TXFM_4X8_FN 2 ; type1, type2 INV_TXFM_FN %1, %2, 4x8, 8 %ifidn %1_%2, dct_dct pshuflw m0, [coeffq], q0000 punpcklqdq m0, m0 mova m1, [o(pw_2896x8)] pmulhrsw m0, m1 mov [coeffq], eobd pmulhrsw m0, m1 pmulhrsw m0, m1 pmulhrsw m0, [o(pw_2048)] mova m1, m0 mova m2, m0 mova m3, m0 TAIL_CALL m(iadst_4x8_internal).end3 %endif %endmacro INV_TXFM_4X8_FN dct, dct INV_TXFM_4X8_FN dct, adst INV_TXFM_4X8_FN dct, flipadst INV_TXFM_4X8_FN dct, identity cglobal idct_4x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m3, [o(pw_2896x8)] pmulhrsw m0, m3, [coeffq+16*0] pmulhrsw m1, m3, [coeffq+16*1] pmulhrsw m2, m3, [coeffq+16*2] pmulhrsw m3, [coeffq+16*3] .pass1: call m(idct_8x4_internal).main jmp m(iadst_4x8_internal).pass1_end .pass2: call .main shufps m1, m1, q1032 shufps m3, m3, q1032 mova m4, [o(pw_2048)] jmp m(iadst_4x8_internal).end2 ALIGN function_align .main: IDCT8_1D_PACKED ret INV_TXFM_4X8_FN adst, dct INV_TXFM_4X8_FN adst, adst INV_TXFM_4X8_FN adst, flipadst INV_TXFM_4X8_FN adst, identity cglobal iadst_4x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m3, [o(pw_2896x8)] pmulhrsw m0, m3, [coeffq+16*0] pmulhrsw m1, m3, [coeffq+16*1] pmulhrsw m2, m3, [coeffq+16*2] pmulhrsw m3, [coeffq+16*3] .pass1: call m(iadst_8x4_internal).main .pass1_end: INV_4X8 jmp tx2q .pass2: shufps m0, m0, q1032 shufps m1, m1, q1032 call .main mova m4, [o(pw_2048)] pxor m5, m5 psubw m5, m4 .end: punpcklqdq m4, m5 .end2: pmulhrsw m0, m4 pmulhrsw m1, m4 pmulhrsw m2, m4 pmulhrsw m3, m4 pxor m5, m5 mova [coeffq+16*0], m5 mova [coeffq+16*1], m5 mova [coeffq+16*2], m5 mova [coeffq+16*3], m5 .end3: WRITE_4X8 0, 1, 2, 3 RET ALIGN function_align .main: mova m6, [o(pd_2048)] punpckhwd m4, m3, m0 ;unpacked in7 in0 punpckhwd m5, m2, m1 ;unpacked in5 in2 punpcklwd m1, m2 ;unpacked in3 in4 punpcklwd m0, m3 ;unpacked in1 in6 ITX_MUL2X_PACK 4, 2, 6, 401, 4076 ;low: t0a high: t1a ITX_MUL2X_PACK 5, 2, 6, 1931, 3612 ;low: t2a high: t3a ITX_MUL2X_PACK 1, 2, 6, 3166, 2598 ;low: t4a high: t5a ITX_MUL2X_PACK 0, 2, 6, 3920, 1189 ;low: t6a high: t7a psubsw m3, m4, m1 ;low: t4 high: t5 paddsw m4, m1 ;low: t0 high: t1 psubsw m2, m5, m0 ;low: t6 high: t7 paddsw m5, m0 ;low: t2 high: t3 shufps m1, m3, m2, q1032 punpckhwd m2, m1 punpcklwd m3, m1 ITX_MUL2X_PACK 3, 0, 6, 1567, 3784, 1 ;low: t5a high: t4a ITX_MUL2X_PACK 2, 0, 6, 3784, 1567 ;low: t7a high: t6a psubsw m1, m4, m5 ;low: t2 high: t3 paddsw m4, m5 ;low: out0 high: -out7 psubsw m5, m3, m2 ;low: t7 high: t6 paddsw m3, m2 ;low: out6 high: -out1 shufps m0, m4, m3, q3210 ;low: out0 high: -out1 shufps m3, m4, q3210 ;low: out6 high: -out7 mova m2, [o(pw_2896_m2896)] mova m7, [o(pw_2896_2896)] shufps m4, m1, m5, q1032 ;low: t3 high: t7 shufps m1, m5, q3210 ;low: t2 high: t6 punpcklwd m5, m1, m4 punpckhwd m1, m4 pmaddwd m4, m2, m1 ;-out5 pmaddwd m2, m5 ; out4 pmaddwd m1, m7 ; out2 pmaddwd m5, m7 ;-out3 REPX {paddd x, m6}, m4, m2, m1, m5 REPX {psrad x, 12}, m4, m2, m1, m5 packssdw m1, m5 ;low: out2 high: -out3 packssdw m2, m4 ;low: out4 high: -out5 ret INV_TXFM_4X8_FN flipadst, dct INV_TXFM_4X8_FN flipadst, adst INV_TXFM_4X8_FN flipadst, flipadst INV_TXFM_4X8_FN flipadst, identity cglobal iflipadst_4x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m3, [o(pw_2896x8)] pmulhrsw m0, m3, [coeffq+16*0] pmulhrsw m1, m3, [coeffq+16*1] pmulhrsw m2, m3, [coeffq+16*2] pmulhrsw m3, [coeffq+16*3] .pass1: call m(iadst_8x4_internal).main punpcklwd m4, m3, m2 punpckhwd m3, m2 punpcklwd m5, m1, m0 punpckhwd m1, m0 punpckldq m2, m3, m1 ;low: in4 high: in5 punpckhdq m3, m1 ;low: in6 high: in7 punpckldq m0, m4, m5 ;low: in0 high: in1 punpckhdq m1, m4, m5 ;low: in2 high: in3 jmp tx2q .pass2: shufps m0, m0, q1032 shufps m1, m1, q1032 call m(iadst_4x8_internal).main mova m4, m0 mova m5, m1 pshufd m0, m3, q1032 pshufd m1, m2, q1032 pshufd m2, m5, q1032 pshufd m3, m4, q1032 mova m5, [o(pw_2048)] pxor m4, m4 psubw m4, m5 jmp m(iadst_4x8_internal).end INV_TXFM_4X8_FN identity, dct INV_TXFM_4X8_FN identity, adst INV_TXFM_4X8_FN identity, flipadst INV_TXFM_4X8_FN identity, identity cglobal iidentity_4x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m3, [o(pw_2896x8)] pmulhrsw m0, m3, [coeffq+16*0] pmulhrsw m1, m3, [coeffq+16*1] pmulhrsw m2, m3, [coeffq+16*2] pmulhrsw m3, [coeffq+16*3] .pass1: mova m7, [o(pw_1697x8)] pmulhrsw m4, m7, m0 pmulhrsw m5, m7, m1 pmulhrsw m6, m7, m2 pmulhrsw m7, m3 paddsw m0, m4 paddsw m1, m5 paddsw m2, m6 paddsw m3, m7 jmp m(iadst_4x8_internal).pass1_end .pass2: mova m4, [o(pw_4096)] jmp m(iadst_4x8_internal).end2 %macro WRITE_8X2 5 ;coefs[1-2], tmp[1-3] movq m%3, [dstq ] movq m%4, [dstq+strideq] pxor m%5, m%5 punpcklbw m%3, m%5 ;extend byte to word punpcklbw m%4, m%5 ;extend byte to word %ifnum %1 paddw m%3, m%1 %else paddw m%3, %1 %endif %ifnum %2 paddw m%4, m%2 %else paddw m%4, %2 %endif packuswb m%3, m%4 movq [dstq ], m%3 punpckhqdq m%3, m%3 movq [dstq+strideq], m%3 %endmacro %macro WRITE_8X4 7 ;coefs[1-4], tmp[1-3] WRITE_8X2 %1, %2, %5, %6, %7 lea dstq, [dstq+strideq*2] WRITE_8X2 %3, %4, %5, %6, %7 %endmacro %macro INV_TXFM_8X4_FN 2 ; type1, type2 INV_TXFM_FN %1, %2, 8x4, 8 %ifidn %1_%2, dct_dct pshuflw m0, [coeffq], q0000 punpcklqdq m0, m0 mova m1, [o(pw_2896x8)] pmulhrsw m0, m1 pmulhrsw m0, m1 mova m2, [o(pw_2048)] pmulhrsw m0, m1 pmulhrsw m0, m2 mova m1, m0 mova m2, m0 mova m3, m0 TAIL_CALL m(iadst_8x4_internal).end2 %endif %endmacro INV_TXFM_8X4_FN dct, dct INV_TXFM_8X4_FN dct, adst INV_TXFM_8X4_FN dct, flipadst INV_TXFM_8X4_FN dct, identity cglobal idct_8x4_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m3, [o(pw_2896x8)] pmulhrsw m0, m3, [coeffq+16*0] pmulhrsw m1, m3, [coeffq+16*1] pmulhrsw m2, m3, [coeffq+16*2] pmulhrsw m3, [coeffq+16*3] call m(idct_4x8_internal).main mova m4, [o(deint_shuf1)] mova m5, [o(deint_shuf2)] pshufb m0, m4 pshufb m1, m5 pshufb m2, m4 pshufb m3, m5 punpckhdq m4, m0, m1 punpckldq m0, m1 punpckhdq m5, m2, m3 punpckldq m2, m3 punpckhqdq m1, m0, m2 ;in1 punpcklqdq m0, m2 ;in0 punpckhqdq m3, m4, m5 ;in3 punpcklqdq m2 ,m4, m5 ;in2 jmp tx2q .pass2: call .main jmp m(iadst_8x4_internal).end ALIGN function_align .main: mova m6, [o(pd_2048)] IDCT4_1D 0, 1, 2, 3, 4, 5, 6 ret INV_TXFM_8X4_FN adst, dct INV_TXFM_8X4_FN adst, adst INV_TXFM_8X4_FN adst, flipadst INV_TXFM_8X4_FN adst, identity cglobal iadst_8x4_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m3, [o(pw_2896x8)] pmulhrsw m0, m3, [coeffq+16*0] pmulhrsw m1, m3, [coeffq+16*1] pmulhrsw m2, m3, [coeffq+16*2] pmulhrsw m3, [coeffq+16*3] shufps m0, m0, q1032 shufps m1, m1, q1032 call m(iadst_4x8_internal).main punpckhwd m4, m0, m1 punpcklwd m0, m1 punpckhwd m1, m2, m3 punpcklwd m2, m3 pxor m5, m5 psubsw m3, m5, m1 psubsw m5, m4 punpckhdq m4, m5, m3 punpckldq m5, m3 punpckhdq m3, m0, m2 punpckldq m0, m2 punpckhwd m1, m0, m5 ;in1 punpcklwd m0, m5 ;in0 punpcklwd m2, m3, m4 ;in2 punpckhwd m3, m4 ;in3 jmp tx2q .pass2: call .main .end: mova m4, [o(pw_2048)] pmulhrsw m0, m4 pmulhrsw m1, m4 pmulhrsw m2, m4 pmulhrsw m3, m4 .end2: pxor m6, m6 mova [coeffq+16*0], m6 mova [coeffq+16*1], m6 mova [coeffq+16*2], m6 mova [coeffq+16*3], m6 .end3: WRITE_8X4 0, 1, 2, 3, 4, 5, 6 RET ALIGN function_align .main: punpckhwd m6, m0, m2 ;unpacked in0 in2 punpcklwd m0, m2 ;unpacked in0 in2 punpckhwd m7, m1, m3 ;unpacked in1 in3 punpcklwd m1, m3 ;unpacked in1 in3 mova m2, [o(pw_3344_m3344)] mova m4, [o(pw_0_3344)] pmaddwd m3, m2, m6 ;3344 * in0 - 3344 * in2 pmaddwd m5, m4, m7 ;3344 * in3 pmaddwd m2, m0 pmaddwd m4, m1 paddd m3, m5 paddd m2, m4 mova m4, [o(pd_2048)] paddd m3, m4 ;t2 + 2048 paddd m2, m4 psrad m3, 12 psrad m2, 12 packssdw m2, m3 ;out2 pmaddwd m4, m0, [o(pw_1321_3803)] ;1321 * in0 + 3803 * in2 pmaddwd m0, [o(pw_2482_m1321)] ;2482 * in0 - 1321 * in2 pmaddwd m3, m1, [o(pw_3344_2482)] ;3344 * in1 + 2482 * in3 pmaddwd m5, m1, [o(pw_3344_m3803)] ;3344 * in1 - 3803 * in3 paddd m3, m4 ;t0 + t3 pmaddwd m1, [o(pw_m6688_m3803)] ;-2 * 3344 * in1 - 3803 * in3 mova m4, [o(pd_2048)] paddd m0, m4 paddd m4, m3 ;t0 + t3 + 2048 paddd m5, m0 ;t1 + t3 + 2048 paddd m3, m0 paddd m3, m1 ;t0 + t1 - t3 + 2048 psrad m4, 12 ;out0 psrad m5, 12 ;out1 psrad m3, 12 ;out3 packssdw m0, m4, m5 ;low: out0 high: out1 pmaddwd m4, m6, [o(pw_1321_3803)] ;1321 * in0 + 3803 * in2 pmaddwd m6, [o(pw_2482_m1321)] ;2482 * in0 - 1321 * in2 pmaddwd m1, m7, [o(pw_3344_2482)] ;3344 * in1 + 2482 * in3 pmaddwd m5, m7, [o(pw_3344_m3803)] ;3344 * in1 - 3803 * in3 paddd m1, m4 ;t0 + t3 pmaddwd m7, [o(pw_m6688_m3803)] ;-2 * 3344 * in1 - 3803 * in3 mova m4, [o(pd_2048)] paddd m6, m4 paddd m4, m1 ;t0 + t3 + 2048 paddd m5, m6 ;t1 + t3 + 2048 paddd m1, m6 paddd m1, m7 ;t0 + t1 - t3 + 2048 psrad m4, 12 ;out0 psrad m5, 12 ;out1 psrad m1, 12 ;out3 packssdw m3, m1 ;out3 packssdw m4, m5 ;low: out0 high: out1 punpckhqdq m1, m0, m4 ;out1 punpcklqdq m0, m4 ;out0 ret INV_TXFM_8X4_FN flipadst, dct INV_TXFM_8X4_FN flipadst, adst INV_TXFM_8X4_FN flipadst, flipadst INV_TXFM_8X4_FN flipadst, identity cglobal iflipadst_8x4_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m3, [o(pw_2896x8)] pmulhrsw m0, m3, [coeffq+16*0] pmulhrsw m1, m3, [coeffq+16*1] pmulhrsw m2, m3, [coeffq+16*2] pmulhrsw m3, [coeffq+16*3] shufps m0, m0, q1032 shufps m1, m1, q1032 call m(iadst_4x8_internal).main punpckhwd m5, m3, m2 punpcklwd m3, m2 punpckhwd m2, m1, m0 punpcklwd m1, m0 pxor m0, m0 psubsw m4, m0, m2 psubsw m0, m5 punpckhdq m2, m0, m4 punpckldq m0, m4 punpckhdq m4, m3, m1 punpckldq m3, m1 punpckhwd m1, m0, m3 ;in1 punpcklwd m0, m3 ;in0 punpckhwd m3, m2, m4 ;in3 punpcklwd m2, m4 ;in2 jmp tx2q .pass2: call m(iadst_8x4_internal).main mova m4, m0 mova m5, m1 mova m0, m3 mova m1, m2 mova m2, m5 mova m3, m4 jmp m(iadst_8x4_internal).end INV_TXFM_8X4_FN identity, dct INV_TXFM_8X4_FN identity, adst INV_TXFM_8X4_FN identity, flipadst INV_TXFM_8X4_FN identity, identity cglobal iidentity_8x4_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m3, [o(pw_2896x8)] pmulhrsw m0, m3, [coeffq+16*0] pmulhrsw m1, m3, [coeffq+16*1] pmulhrsw m2, m3, [coeffq+16*2] pmulhrsw m3, [coeffq+16*3] paddsw m0, m0 paddsw m1, m1 paddsw m2, m2 paddsw m3, m3 punpckhwd m4, m0, m1 punpcklwd m0, m1 punpckhwd m1, m2, m3 punpcklwd m2, m3 punpckhdq m5, m4, m1 punpckldq m4, m1 punpckhdq m3, m0, m2 punpckldq m0, m2 punpckhwd m1, m0, m4 ;in1 punpcklwd m0, m4 ;in0 punpcklwd m2, m3, m5 ;in2 punpckhwd m3, m5 ;in3 jmp tx2q .pass2: mova m7, [o(pw_1697x8)] pmulhrsw m4, m7, m0 pmulhrsw m5, m7, m1 pmulhrsw m6, m7, m2 pmulhrsw m7, m3 paddsw m0, m4 paddsw m1, m5 paddsw m2, m6 paddsw m3, m7 jmp m(iadst_8x4_internal).end %macro INV_TXFM_8X8_FN 2 ; type1, type2 INV_TXFM_FN %1, %2, 8x8, 8, 16*4 %ifidn %1_%2, dct_dct pshuflw m0, [coeffq], q0000 punpcklwd m0, m0 mova m1, [o(pw_2896x8)] pmulhrsw m0, m1 mova m2, [o(pw_16384)] mov [coeffq], eobd pmulhrsw m0, m2 psrlw m2, 3 pmulhrsw m0, m1 pmulhrsw m0, m2 .end: mov r3d, 2 lea tx2q, [o(m(inv_txfm_add_dct_dct_8x8).end3)] .loop: WRITE_8X4 0, 0, 0, 0, 1, 2, 3 lea dstq, [dstq+strideq*2] dec r3d jg .loop jmp tx2q .end3: RET %endif %endmacro %macro LOAD_8ROWS 2-3 0 ; src, stride, is_rect2 %if %3 mova m7, [o(pw_2896x8)] pmulhrsw m0, m7, [%1+%2*0] pmulhrsw m1, m7, [%1+%2*1] pmulhrsw m2, m7, [%1+%2*2] pmulhrsw m3, m7, [%1+%2*3] pmulhrsw m4, m7, [%1+%2*4] pmulhrsw m5, m7, [%1+%2*5] pmulhrsw m6, m7, [%1+%2*6] pmulhrsw m7, [%1+%2*7] %else mova m0, [%1+%2*0] mova m1, [%1+%2*1] mova m2, [%1+%2*2] mova m3, [%1+%2*3] mova m4, [%1+%2*4] mova m5, [%1+%2*5] mova m6, [%1+%2*6] mova m7, [%1+%2*7] %endif %endmacro %macro IDCT8_1D_ODDHALF 7 ; src[1-4], tmp[1-2], pd_2048 ITX_MULSUB_2W %1, %4, %5, %6, %7, 799, 4017 ;t4a, t7a ITX_MULSUB_2W %3, %2, %5, %6, %7, 3406, 2276, 1 ;t5a, t6a psubsw m%2, m%4, m%5 ;t6a paddsw m%4, m%5 ;t7 psubsw m%5, m%1, m%3 ;t5a paddsw m%1, m%3 ;t4 ITX_MULSUB_2W %2, %5, %3, %6, %7, 2896, 2896, 1 ;t5, t6 %endmacro INV_TXFM_8X8_FN dct, dct INV_TXFM_8X8_FN dct, adst INV_TXFM_8X8_FN dct, flipadst INV_TXFM_8X8_FN dct, identity cglobal idct_8x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 LOAD_8ROWS coeffq, 16 .pass1: call .main .pass1_end: mova m7, [o(pw_16384)] .pass1_end1: REPX {pmulhrsw x, m7}, m0, m2, m4, m6 mova [rsp+gprsize+16*1], m6 .pass1_end2: REPX {pmulhrsw x, m7}, m1, m3, m5 pmulhrsw m7, [rsp+gprsize+16*0] .pass1_end3: punpcklwd m6, m1, m5 ;10 50 11 51 12 52 13 53 punpckhwd m1, m5 ;14 54 15 55 16 56 17 57 punpckhwd m5, m0, m4 ;04 44 05 45 06 46 07 47 punpcklwd m0, m4 ;00 40 01 41 02 42 03 43 punpckhwd m4, m3, m7 ;34 74 35 75 36 76 37 77 punpcklwd m3, m7 ;30 70 31 71 32 72 33 73 punpckhwd m7, m1, m4 ;16 36 56 76 17 37 57 77 punpcklwd m1, m4 ;14 34 54 74 15 35 55 75 punpckhwd m4, m6, m3 ;12 32 52 72 13 33 53 73 punpcklwd m6, m3 ;10 30 50 70 11 31 51 71 mova [rsp+gprsize+16*2], m6 mova m6, [rsp+gprsize+16*1] punpckhwd m3, m2, m6 ;24 64 25 65 26 66 27 67 punpcklwd m2, m6 ;20 60 21 61 22 62 23 63 punpckhwd m6, m5, m3 ;06 26 46 66 07 27 47 67 punpcklwd m5, m3 ;04 24 44 64 05 25 45 65 punpckhwd m3, m0, m2 ;02 22 42 62 03 23 43 63 punpcklwd m0, m2 ;00 20 40 60 01 21 41 61 punpckhwd m2, m6, m7 ;07 17 27 37 47 57 67 77 punpcklwd m6, m7 ;06 16 26 36 46 56 66 76 mova [rsp+gprsize+16*0], m2 punpcklwd m2, m3, m4 ;02 12 22 32 42 52 62 72 punpckhwd m3, m4 ;03 13 23 33 43 53 63 73 punpcklwd m4, m5, m1 ;04 14 24 34 44 54 64 74 punpckhwd m5, m1 ;05 15 25 35 45 55 65 75 mova m7, [rsp+gprsize+16*2] punpckhwd m1, m0, m7 ;01 11 21 31 41 51 61 71 punpcklwd m0, m7 ;00 10 20 30 40 50 60 70 mova m7, [rsp+gprsize+16*0] jmp tx2q .pass2: lea tx2q, [o(m(idct_8x8_internal).end4)] .pass2_main: call .main .end: mova m7, [o(pw_2048)] REPX {pmulhrsw x, m7}, m0, m2, m4, m6 mova [rsp+gprsize+16*1], m6 .end2: REPX {pmulhrsw x, m7}, m1, m3, m5 pmulhrsw m7, [rsp+gprsize+16*0] mova [rsp+gprsize+16*2], m5 mova [rsp+gprsize+16*0], m7 .end3: WRITE_8X4 0, 1, 2, 3, 5, 6, 7 lea dstq, [dstq+strideq*2] WRITE_8X4 4, [rsp+gprsize+16*2], [rsp+gprsize+16*1], [rsp+gprsize+16*0], 5, 6, 7 jmp tx2q .end4: pxor m7, m7 REPX {mova [coeffq+16*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7 ret ALIGN function_align .main: mova [rsp+gprsize*2+16*0], m7 mova [rsp+gprsize*2+16*1], m3 mova [rsp+gprsize*2+16*2], m1 mova m7, [o(pd_2048)] IDCT4_1D 0, 2, 4, 6, 1, 3, 7 mova m3, [rsp+gprsize*2+16*2] mova [rsp+gprsize*2+16*2], m2 mova m2, [rsp+gprsize*2+16*1] mova [rsp+gprsize*2+16*1], m4 mova m4, [rsp+gprsize*2+16*0] mova [rsp+gprsize*2+16*0], m6 IDCT8_1D_ODDHALF 3, 2, 5, 4, 1, 6, 7 mova m6, [rsp+gprsize*2+16*0] psubsw m7, m0, m4 ;out7 paddsw m0, m4 ;out0 mova [rsp+gprsize*2+16*0], m7 mova m1, [rsp+gprsize*2+16*2] psubsw m4, m6, m3 ;out4 paddsw m3, m6 ;out3 mova m7, [rsp+gprsize*2+16*1] psubsw m6, m1, m5 ;out6 paddsw m1, m5 ;out1 psubsw m5, m7, m2 ;out5 paddsw m2, m7 ;out2 ret INV_TXFM_8X8_FN adst, dct INV_TXFM_8X8_FN adst, adst INV_TXFM_8X8_FN adst, flipadst INV_TXFM_8X8_FN adst, identity cglobal iadst_8x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 LOAD_8ROWS coeffq, 16 .pass1: call .main call .main_pass1_end .pass1_end: mova m7, [o(pw_16384)] .pass1_end1: REPX {pmulhrsw x, m7}, m0, m2, m4, m6 mova [rsp+gprsize+16*1], m6 pxor m6, m6 psubw m6, m7 mova m7, m6 jmp m(idct_8x8_internal).pass1_end2 ALIGN function_align .pass2: lea tx2q, [o(m(idct_8x8_internal).end4)] .pass2_main: call .main call .main_pass2_end .end: mova m7, [o(pw_2048)] REPX {pmulhrsw x, m7}, m0, m2, m4, m6 mova [rsp+gprsize+16*1], m6 pxor m6, m6 psubw m6, m7 mova m7, m6 jmp m(idct_8x8_internal).end2 ALIGN function_align .main: mova [rsp+gprsize*2+16*0], m7 mova [rsp+gprsize*2+16*1], m3 mova [rsp+gprsize*2+16*2], m4 mova m7, [o(pd_2048)] ITX_MULSUB_2W 5, 2, 3, 4, 7, 1931, 3612 ;t3a, t2a ITX_MULSUB_2W 1, 6, 3, 4, 7, 3920, 1189 ;t7a, t6a paddsw m3, m2, m6 ;t2 psubsw m2, m6 ;t6 paddsw m4, m5, m1 ;t3 psubsw m5, m1 ;t7 ITX_MULSUB_2W 5, 2, 1, 6, 7, 3784, 1567 ;t6a, t7a mova m6, [rsp+gprsize*2+16*2] mova [rsp+gprsize*2+16*2], m5 mova m1, [rsp+gprsize*2+16*1] mova [rsp+gprsize*2+16*1], m2 mova m5, [rsp+gprsize*2+16*0] mova [rsp+gprsize*2+16*0], m3 ITX_MULSUB_2W 5, 0, 2, 3, 7, 401, 4076 ;t1a, t0a ITX_MULSUB_2W 1, 6, 2, 3, 7, 3166, 2598 ;t5a, t4a psubsw m2, m0, m6 ;t4 paddsw m0, m6 ;t0 paddsw m3, m5, m1 ;t1 psubsw m5, m1 ;t5 ITX_MULSUB_2W 2, 5, 1, 6, 7, 1567, 3784 ;t5a, t4a mova m7, [rsp+gprsize*2+16*0] paddsw m1, m3, m4 ;-out7 psubsw m3, m4 ;t3 mova [rsp+gprsize*2+16*0], m1 psubsw m4, m0, m7 ;t2 paddsw m0, m7 ;out0 mova m6, [rsp+gprsize*2+16*2] mova m7, [rsp+gprsize*2+16*1] paddsw m1, m5, m6 ;-out1 psubsw m5, m6 ;t6 paddsw m6, m2, m7 ;out6 psubsw m2, m7 ;t7 ret ALIGN function_align .main_pass1_end: mova [rsp+gprsize*2+16*1], m1 mova [rsp+gprsize*2+16*2], m6 punpckhwd m1, m4, m3 punpcklwd m4, m3 punpckhwd m7, m5, m2 punpcklwd m5, m2 mova m2, [o(pw_2896_2896)] mova m6, [o(pd_2048)] pmaddwd m3, m2, m7 pmaddwd m2, m5 paddd m3, m6 paddd m2, m6 psrad m3, 12 psrad m2, 12 packssdw m2, m3 ;out2 mova m3, [o(pw_2896_m2896)] pmaddwd m7, m3 pmaddwd m5, m3 paddd m7, m6 paddd m5, m6 psrad m7, 12 psrad m5, 12 packssdw m5, m7 ;-out5 mova m3, [o(pw_2896_2896)] pmaddwd m7, m3, m1 pmaddwd m3, m4 paddd m7, m6 paddd m3, m6 psrad m7, 12 psrad m3, 12 packssdw m3, m7 ;-out3 mova m7, [o(pw_2896_m2896)] pmaddwd m1, m7 pmaddwd m4, m7 paddd m1, m6 paddd m4, m6 psrad m1, 12 psrad m4, 12 packssdw m4, m1 ;-out5 mova m1, [rsp+gprsize*2+16*1] mova m6, [rsp+gprsize*2+16*2] ret ALIGN function_align .main_pass2_end: paddsw m7, m4, m3 ;t2 + t3 psubsw m4, m3 ;t2 - t3 paddsw m3, m5, m2 ;t6 + t7 psubsw m5, m2 ;t6 - t7 mova m2, [o(pw_2896x8)] pmulhrsw m4, m2 ;out4 pmulhrsw m5, m2 ;-out5 pmulhrsw m7, m2 ;-out3 pmulhrsw m2, m3 ;out2 mova m3, m7 ret INV_TXFM_8X8_FN flipadst, dct INV_TXFM_8X8_FN flipadst, adst INV_TXFM_8X8_FN flipadst, flipadst INV_TXFM_8X8_FN flipadst, identity cglobal iflipadst_8x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 LOAD_8ROWS coeffq, 16 .pass1: call m(iadst_8x8_internal).main call m(iadst_8x8_internal).main_pass1_end .pass1_end: mova m7, [o(pw_m16384)] .pass1_end1: pmulhrsw m1, m7 mova [rsp+gprsize+16*1], m1 mova m1, m6 mova m6, m2 pmulhrsw m2, m5, m7 mova m5, m6 mova m6, m4 pmulhrsw m4, m3, m7 mova m3, m6 mova m6, m0 mova m0, m7 pxor m7, m7 psubw m7, m0 pmulhrsw m0, [rsp+gprsize+16*0] REPX {pmulhrsw x, m7}, m1, m3, m5 pmulhrsw m7, m6 jmp m(idct_8x8_internal).pass1_end3 ALIGN function_align .pass2: lea tx2q, [o(m(idct_8x8_internal).end4)] .pass2_main: call m(iadst_8x8_internal).main call m(iadst_8x8_internal).main_pass2_end .end: mova m7, [o(pw_2048)] REPX {pmulhrsw x, m7}, m0, m2, m4, m6 mova [rsp+gprsize+16*2], m2 mova m2, m0 pxor m0, m0 psubw m0, m7 mova m7, m2 pmulhrsw m1, m0 pmulhrsw m2, m5, m0 mova [rsp+gprsize+16*1], m1 mova m5, m4 mova m1, m6 pmulhrsw m4, m3, m0 pmulhrsw m0, [rsp+gprsize+16*0] mova m3, m5 mova [rsp+gprsize+16*0], m7 jmp m(idct_8x8_internal).end3 INV_TXFM_8X8_FN identity, dct INV_TXFM_8X8_FN identity, adst INV_TXFM_8X8_FN identity, flipadst INV_TXFM_8X8_FN identity, identity cglobal iidentity_8x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 LOAD_8ROWS coeffq, 16 mova [rsp+gprsize+16*1], m6 jmp m(idct_8x8_internal).pass1_end3 ALIGN function_align .pass2: lea tx2q, [o(m(idct_8x8_internal).end4)] .end: pmulhrsw m7, [o(pw_4096)] mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_4096)] REPX {pmulhrsw x, m7}, m0, m1, m2, m3, m4, m5, m6 mova [rsp+gprsize+16*2], m5 mova [rsp+gprsize+16*1], m6 jmp m(idct_8x8_internal).end3 %macro INV_TXFM_4X16_FN 2 ; type1, type2 INV_TXFM_FN %1, %2, 4x16, 8 %ifidn %1_%2, dct_dct pshuflw m0, [coeffq], q0000 punpcklwd m0, m0 mova m1, [o(pw_2896x8)] pmulhrsw m0, m1 mov [coeffq], eobd pmulhrsw m0, [o(pw_16384)] pmulhrsw m0, m1 pmulhrsw m0, [o(pw_2048)] .end: WRITE_4X4 0, 0, 1, 2, 3, 0, 1, 2, 3 lea dstq, [dstq+strideq*4] WRITE_4X4 0, 0, 1, 2, 3, 0, 1, 2, 3 lea dstq, [dstq+strideq*4] WRITE_4X4 0, 0, 1, 2, 3, 0, 1, 2, 3 lea dstq, [dstq+strideq*4] WRITE_4X4 0, 0, 1, 2, 3, 0, 1, 2, 3 RET %endif %endmacro INV_TXFM_4X16_FN dct, dct INV_TXFM_4X16_FN dct, adst INV_TXFM_4X16_FN dct, flipadst INV_TXFM_4X16_FN dct, identity cglobal idct_4x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 lea r3, [o(m(idct_4x8_internal).pass1)] .pass1: mova m0, [coeffq+16*1] mova m1, [coeffq+16*3] mova m2, [coeffq+16*5] mova m3, [coeffq+16*7] push tx2q lea tx2q, [o(m(idct_4x16_internal).pass1_2)] jmp r3 .pass1_2: mova [coeffq+16*1], m0 mova [coeffq+16*3], m1 mova [coeffq+16*5], m2 mova [coeffq+16*7], m3 mova m0, [coeffq+16*0] mova m1, [coeffq+16*2] mova m2, [coeffq+16*4] mova m3, [coeffq+16*6] lea tx2q, [o(m(idct_4x16_internal).pass1_end)] jmp r3 .pass1_end: pop tx2q mova m4, [coeffq+16*1] mova m5, [coeffq+16*3] mova m6, [coeffq+16*5] mova m7, [o(pw_16384)] REPX {pmulhrsw x, m7}, m0, m1, m2, m3, m4, m5, m6 pmulhrsw m7, [coeffq+16*7] mova [coeffq+16*7], m7 jmp tx2q .pass2: call m(idct_16x4_internal).main .end: mova m7, [o(pw_2048)] REPX {pmulhrsw x, m7}, m0, m1, m2, m3, m4, m5, m6 pmulhrsw m7, [coeffq+16*7] mova [coeffq+16*4], m4 .end1: mova [coeffq+16*5], m5 mova [coeffq+16*6], m6 mov r3, coeffq WRITE_4X8 0, 1, 3, 2 mova m0, [r3+16*4] mova m1, [r3+16*5] mova m2, [r3+16*6] mova m3, m7 lea dstq, [dstq+strideq*4] WRITE_4X8 0, 1, 3, 2 .end2: pxor m7, m7 REPX {mova [r3+16*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7 ret INV_TXFM_4X16_FN adst, dct INV_TXFM_4X16_FN adst, adst INV_TXFM_4X16_FN adst, flipadst INV_TXFM_4X16_FN adst, identity cglobal iadst_4x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 lea r3, [o(m(iadst_4x8_internal).pass1)] jmp m(idct_4x16_internal).pass1 .pass2: call m(iadst_16x4_internal).main call m(iadst_16x4_internal).main_pass2_end punpcklqdq m6, m5, m4 ;low: -out5 high: -out7 punpckhqdq m4, m5 ;low: out8 high: out10 punpcklqdq m5, m7, m2 ;low: out4 high: out6 punpckhqdq m2, m7 ;low: -out9 high: -out11 mova [coeffq+16*4], m2 mova [coeffq+16*5], m6 mova m2, [coeffq+16*6] mova m6, [coeffq+16*7] punpckhqdq m1, m6, m0 ;low: -out13 high: -out15 punpcklqdq m0, m6 ;low: out0 high: out2 punpckhqdq m6, m3, m2 ;low: out12 high: out14 punpcklqdq m2, m3 ;low: -out1 high: -out3 mova m7, [o(pw_2048)] .end1: REPX {pmulhrsw x, m7}, m0, m5, m4, m6 pxor m3, m3 psubw m3, m7 mova m7, [coeffq+16*4] REPX {pmulhrsw x, m3}, m2, m7, m1 pmulhrsw m3, [coeffq+16*5] mova [coeffq+16*7], m5 punpckhqdq m5, m4, m7 ;low: out10 high: out11 punpcklqdq m4, m7 ;low: out8 high: out9 punpckhqdq m7, m6, m1 ;low: out14 high: out15 punpcklqdq m6, m1 ;low: out12 high: out13 punpckhqdq m1, m0, m2 ;low: out2 high: out3 punpcklqdq m0, m2 ;low: out0 high: out1 mova [coeffq+16*4], m4 mova m4, [coeffq+16*7] punpcklqdq m2, m4, m3 ;low: out4 high: out5 punpckhqdq m4, m3 ;low: out6 high: out7 mova m3, m4 .end2: mova [coeffq+16*5], m5 mova [coeffq+16*6], m6 mov r3, coeffq WRITE_4X8 0, 1, 2, 3 mova m0, [r3+16*4] mova m1, [r3+16*5] mova m2, [r3+16*6] mova m3, m7 lea dstq, [dstq+strideq*4] WRITE_4X8 0, 1, 2, 3 .end3: pxor m7, m7 REPX {mova [r3+16*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7 ret INV_TXFM_4X16_FN flipadst, dct INV_TXFM_4X16_FN flipadst, adst INV_TXFM_4X16_FN flipadst, flipadst INV_TXFM_4X16_FN flipadst, identity cglobal iflipadst_4x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 lea r3, [o(m(iflipadst_4x8_internal).pass1)] jmp m(idct_4x16_internal).pass1 .pass2: call m(iadst_16x4_internal).main call m(iadst_16x4_internal).main_pass2_end punpckhqdq m6, m5, m4 ;low: out5 high: out7 punpcklqdq m4, m5 ;low: -out8 high: -out10 punpckhqdq m5, m7, m2 ;low: -out4 high: -out6 punpcklqdq m2, m7 ;low: out9 high: out11 mova [coeffq+16*4], m2 mova [coeffq+16*5], m6 mova m2, [coeffq+16*6] mova m6, [coeffq+16*7] punpcklqdq m1, m6, m0 ;low: out13 high: out15 punpckhqdq m0, m6 ;low: -out0 high: -out2 punpcklqdq m6, m3, m2 ;low: -out12 high: -out14 punpckhqdq m2, m3 ;low: out1 high: out3 mova m7, [o(pw_m2048)] jmp m(iadst_4x16_internal).end1 INV_TXFM_4X16_FN identity, dct INV_TXFM_4X16_FN identity, adst INV_TXFM_4X16_FN identity, flipadst INV_TXFM_4X16_FN identity, identity %macro IDTX16 3-4 ; src/dst, tmp, pw_1697x16, [pw_16394] pmulhrsw m%2, m%3, m%1 %if %0 == 4 ; if downshifting by 1 pmulhrsw m%2, m%4 %else paddsw m%1, m%1 %endif paddsw m%1, m%2 %endmacro cglobal iidentity_4x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m0, [coeffq+16*1] mova m6, [o(pw_1697x8)] mova m1, [coeffq+16*3] mova m2, [coeffq+16*5] mova m3, [coeffq+16*7] pcmpeqw m7, m7 mov r3, tx2q lea tx2q, [o(.pass1_2)] .pass1: pmulhrsw m4, m6, m0 pmulhrsw m5, m6, m1 pavgw m4, m0 pcmpeqw m0, m7 pavgw m5, m1 pcmpeqw m1, m7 pandn m0, m4 pmulhrsw m4, m6, m2 pandn m1, m5 pmulhrsw m5, m6, m3 pavgw m4, m2 pcmpeqw m2, m7 pavgw m5, m3 pcmpeqw m3, m7 pandn m2, m4 pandn m3, m5 jmp m(iadst_4x8_internal).pass1_end .pass1_2: mova [coeffq+16*1], m0 mova [coeffq+16*3], m1 mova [coeffq+16*5], m2 mova [coeffq+16*7], m3 mova m0, [coeffq+16*0] mova m1, [coeffq+16*2] mova m2, [coeffq+16*4] mova m3, [coeffq+16*6] lea tx2q, [o(.pass1_end)] jmp .pass1 .pass1_end: mova m4, [coeffq+16*1] mova m5, [coeffq+16*3] mova m6, [coeffq+16*5] jmp r3 .pass2: mova m7, [o(pw_1697x16)] mova [coeffq+16*6], m6 REPX {IDTX16 x, 6, 7}, 0, 1, 2, 3, 4, 5 mova m6, [coeffq+16*7] IDTX16 6, 7, 7 mova [coeffq+16*7], m6 mova m6, [coeffq+16*6] pmulhrsw m7, m6, [o(pw_1697x16)] paddsw m6, m6 paddsw m6, m7 mova m7, [o(pw_2048)] REPX {pmulhrsw x, m7}, m0, m1, m2, m3, m4, m5, m6 pmulhrsw m7, [coeffq+16*7] mova [coeffq+16*4], m4 jmp m(iadst_4x16_internal).end2 %macro INV_TXFM_16X4_FN 2 ; type1, type2 INV_TXFM_FN %1, %2, 16x4, 8 %ifidn %1_%2, dct_dct movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_16384)] mov [coeffq], eobd mov r2d, 2 lea tx2q, [o(m(inv_txfm_add_dct_dct_16x4).end)] .dconly: pmulhrsw m0, m2 movd m2, [o(pw_2048)] ;intentionally rip-relative pmulhrsw m0, m1 pmulhrsw m0, m2 pshuflw m0, m0, q0000 punpcklwd m0, m0 pxor m5, m5 .dconly_loop: mova m1, [dstq] mova m3, [dstq+strideq] punpckhbw m2, m1, m5 punpcklbw m1, m5 punpckhbw m4, m3, m5 punpcklbw m3, m5 paddw m2, m0 paddw m1, m0 paddw m4, m0 paddw m3, m0 packuswb m1, m2 packuswb m3, m4 mova [dstq], m1 mova [dstq+strideq], m3 lea dstq, [dstq+strideq*2] dec r2d jg .dconly_loop jmp tx2q .end: RET %endif %endmacro %macro LOAD_7ROWS 2 ;src, stride mova m0, [%1+%2*0] mova m1, [%1+%2*1] mova m2, [%1+%2*2] mova m3, [%1+%2*3] mova m4, [%1+%2*4] mova m5, [%1+%2*5] mova m6, [%1+%2*6] %endmacro %macro SAVE_7ROWS 2 ;src, stride mova [%1+%2*0], m0 mova [%1+%2*1], m1 mova [%1+%2*2], m2 mova [%1+%2*3], m3 mova [%1+%2*4], m4 mova [%1+%2*5], m5 mova [%1+%2*6], m6 %endmacro %macro IDCT16_1D_PACKED_ODDHALF 7 ;src[1-4], tmp[1-3] punpckhwd m%5, m%4, m%1 ;packed in13 in3 punpcklwd m%1, m%4 ;packed in1 in15 punpcklwd m%4, m%3, m%2 ;packed in9 in7 punpckhwd m%2, m%3 ;packed in5 in11 mova m%7, [o(pd_2048)] ITX_MUL2X_PACK %1, %6, %7, 401, 4076, 1 ;low: t8a high: t15a ITX_MUL2X_PACK %4, %6, %7, 3166, 2598, 1 ;low: t9a high: t14a ITX_MUL2X_PACK %2, %6, %7, 1931, 3612, 1 ;low: t10a high: t13a ITX_MUL2X_PACK %5, %6, %7, 3920, 1189, 1 ;low: t11a high: t12a psubsw m%6, m%1, m%4 ;low: t9 high: t14 paddsw m%1, m%4 ;low: t8 high: t15 psubsw m%4, m%5, m%2 ;low: t10 high: t13 paddsw m%5, m%2 ;low: t11 high: t12 mova m%2, [o(deint_shuf2)] pshufb m%6, m%2 pshufb m%4, m%2 ITX_MUL2X_PACK %6, %3, %7, 1567, 3784, 1 ;low: t9a high: t14a ITX_MUL2X_PACK %4, %3, %7, m3784, 1567, 1 ;low: t10a high: t13a psubsw m%3, m%1, m%5 ;low: t11a high: t12a paddsw m%1, m%5 ;low: t8a high: t15a psubsw m%5, m%6, m%4 ;low: t10 high: t13 paddsw m%6, m%4 ;low: t9 high: t14 pshufb m%3, m%2 pshufb m%5, m%2 ITX_MUL2X_PACK %3, %2, %7, 2896, 2896, 4 ;t12, t11 ITX_MUL2X_PACK %5, %4, %7, 2896, 2896, 4 ;t13a, t10a packssdw m%2, m%4 ;low: t11 high: t10a packssdw m%3, m%5 ;low: t12 high: t13a punpckhqdq m%4, m%1, m%6 ;low: t15a high: t14 punpcklqdq m%1, m%6 ;low: t8a high: t9 %endmacro INV_TXFM_16X4_FN dct, dct INV_TXFM_16X4_FN dct, adst INV_TXFM_16X4_FN dct, flipadst INV_TXFM_16X4_FN dct, identity cglobal idct_16x4_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 LOAD_7ROWS coeffq, 16 call .main .pass1_end: punpckhwd m7, m0, m2 ;packed out1, out5 punpcklwd m0, m2 ;packed out0, out4 punpcklwd m2, m1, m3 ;packed out3, out7 punpckhwd m1, m3 ;packed out2, out6 mova [coeffq+16*6], m7 mova m7, [coeffq+16*7] punpckhwd m3, m4, m6 ;packed out9, out13 punpcklwd m4, m6 ;packed out8, out12 punpcklwd m6, m5, m7 ;packed out11, out15 punpckhwd m5, m7 ;packed out10, out14 .pass1_end2: mova m7, [o(pw_16384)] REPX {pmulhrsw x, m7}, m0, m1, m2, m3, m4, m5, m6 pmulhrsw m7, [coeffq+16*6] mova [coeffq+16*6], m7 .pass1_end3: punpckhwd m7, m3, m6 ;packed 9, 11, 13, 15 high punpcklwd m3, m6 ;packed 9, 10, 13, 15 low punpckhwd m6, m4, m5 ;packed 8, 10, 12, 14 high punpcklwd m4, m5 ;packed 8, 10, 12, 14 low punpckhwd m5, m4, m3 ;8, 9, 10, 11, 12, 13, 14, 15(1) punpcklwd m4, m3 ;8, 9, 10, 11, 12, 13, 14, 15(0) punpckhwd m3, m6, m7 ;8, 9, 10, 11, 12, 13, 14, 15(3) punpcklwd m6, m7 ;8, 9, 10, 11, 12, 13, 14, 15(2) mova [coeffq+16*7], m3 mova m3, [coeffq+16*6] punpckhwd m7, m3, m2 ;packed 1, 3, 5, 7 high punpcklwd m3, m2 ;packed 1, 3, 5, 7 low punpckhwd m2, m0, m1 ;packed 0, 2, 4, 6 high punpcklwd m0, m1 ;packed 0, 2, 4, 6 low punpckhwd m1, m0, m3 ;0, 1, 2, 3, 4, 5, 6, 7(1) punpcklwd m0, m3 ;0, 1, 2, 3, 4, 5, 6, 7(0) punpckhwd m3, m2, m7 ;0, 1, 2, 3, 4, 5, 6, 7(3) punpcklwd m2, m7 ;0, 1, 2, 3, 4, 5, 6, 7(2) jmp tx2q .pass2: lea tx2q, [o(m(idct_8x4_internal).pass2)] .pass2_end: mova [coeffq+16*4], m4 mova [coeffq+16*5], m5 mova [coeffq+16*6], m6 lea r3, [dstq+8] call tx2q add coeffq, 16*4 mova m0, [coeffq+16*0] mova m1, [coeffq+16*1] mova m2, [coeffq+16*2] mova m3, [coeffq+16*3] mov dstq, r3 jmp tx2q ALIGN function_align .main: punpckhqdq m7, m0, m1 ;low:in1 high:in3 punpcklqdq m0, m1 punpcklqdq m1, m2, m3 punpckhqdq m3, m2 ;low:in7 high:in5 mova [coeffq+16*4], m7 mova [coeffq+16*5], m3 mova m7, [coeffq+16*7] punpcklqdq m2, m4, m5 punpckhqdq m4, m5 ;low:in9 high:in11 punpcklqdq m3, m6, m7 punpckhqdq m7, m6 ;low:in15 high:in13 mova [coeffq+16*6], m4 IDCT8_1D_PACKED mova m6, [coeffq+16*4] mova m4, [coeffq+16*5] mova m5, [coeffq+16*6] mova [coeffq+16*4], m1 mova [coeffq+16*5], m2 mova [coeffq+16*6], m3 IDCT16_1D_PACKED_ODDHALF 6, 4, 5, 7, 1, 2, 3 mova m1, [coeffq+16*4] psubsw m3, m0, m7 ;low:out15 high:out14 paddsw m0, m7 ;low:out0 high:out1 psubsw m7, m1, m5 ;low:out12 high:out13 paddsw m1, m5 ;low:out3 high:out2 mova [coeffq+16*7], m3 mova m2, [coeffq+16*5] mova m3, [coeffq+16*6] psubsw m5, m2, m4 ;low:out11 high:out10 paddsw m2, m4 ;low:out4 high:out5 psubsw m4, m3, m6 ;low:out8 high:out9 paddsw m3, m6 ;low:out7 high:out6 mova m6, m7 ret INV_TXFM_16X4_FN adst, dct INV_TXFM_16X4_FN adst, adst INV_TXFM_16X4_FN adst, flipadst INV_TXFM_16X4_FN adst, identity cglobal iadst_16x4_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 LOAD_7ROWS coeffq, 16 call .main call .main_pass1_end punpckhwd m6, m7, m0 ;packed -out11, -out15 punpcklwd m0, m7 ;packed out0, out4 punpcklwd m7, m3, m4 ;packed -out3, -out7 punpckhwd m4, m3 ;packed out8, out12 mova m1, [coeffq+16*6] punpcklwd m3, m1, m5 ;packed -out1, -out5 punpckhwd m5, m1 ;packed out10, out14 mova m1, [coeffq+16*7] mova [coeffq+16*6], m3 mova [coeffq+16*7], m7 punpckhwd m3, m2, m1 ;packed -out9, -out13 punpcklwd m1, m2 ;packed out2, out6 mova m7, [o(pw_16384)] .pass1_end: REPX {pmulhrsw x, m7}, m0, m1, m4, m5 pxor m2, m2 psubw m2, m7 mova m7, [coeffq+16*6] REPX {pmulhrsw x, m2}, m7, m3, m6 pmulhrsw m2, [coeffq+16*7] mova [coeffq+16*6], m7 jmp m(idct_16x4_internal).pass1_end3 .pass2: lea tx2q, [o(m(iadst_8x4_internal).pass2)] jmp m(idct_16x4_internal).pass2_end ALIGN function_align .main: mova [coeffq+16*6], m0 pshufd m0, m1, q1032 pshufd m2, m2, q1032 punpckhwd m1, m6, m0 ;packed in13, in2 punpcklwd m0, m6 ;packed in3, in12 punpckhwd m7, m5, m2 ;packed in11, in4 punpcklwd m2, m5 ;packed in5, in10 mova m6, [o(pd_2048)] ITX_MUL2X_PACK 1, 5, 6, 995, 3973 ;low:t2 high:t3 ITX_MUL2X_PACK 7, 5, 6, 1751, 3703 ;low:t4 high:t5 ITX_MUL2X_PACK 2, 5, 6, 3513, 2106 ;low:t10 high:t11 ITX_MUL2X_PACK 0, 5, 6, 3857, 1380 ;low:t12 high:t13 psubsw m5, m1, m2 ;low:t10a high:t11a paddsw m1, m2 ;low:t2a high:t3a psubsw m2, m7, m0 ;low:t12a high:t13a paddsw m7, m0 ;low:t4a high:t5a punpcklqdq m0, m5 punpckhwd m0, m5 ;packed t10a, t11a punpcklqdq m5, m2 punpckhwd m2, m5 ;packed t13a, t12a ITX_MUL2X_PACK 0, 5, 6, 3406, 2276 ;low:t10 high:t11 ITX_MUL2X_PACK 2, 5, 6, 4017, 799, 1 ;low:t12 high:t13 mova [coeffq+16*4], m1 mova [coeffq+16*5], m7 mova m1, [coeffq+16*6] mova m7, [coeffq+16*7] pshufd m1, m1, q1032 pshufd m3, m3, q1032 punpckhwd m5, m7, m1 ;packed in15, in0 punpcklwd m1, m7 ;packed in1, in14 punpckhwd m7, m4, m3 ;packed in9, in6 punpcklwd m3, m4 ;packed in7, in8 ITX_MUL2X_PACK 5, 4, 6, 201, 4091 ;low:t0 high:t1 ITX_MUL2X_PACK 7, 4, 6, 2440, 3290 ;low:t6 high:t7 ITX_MUL2X_PACK 3, 4, 6, 3035, 2751 ;low:t8 high:t9 ITX_MUL2X_PACK 1, 4, 6, 4052, 601 ;low:t14 high:t15 psubsw m4, m5, m3 ;low:t8a high:t9a paddsw m5, m3 ;low:t0a high:t1a psubsw m3, m7, m1 ;low:t14a high:t15a paddsw m7, m1 ;low:t6a high:t7a punpcklqdq m1, m4 punpckhwd m1, m4 ;packed t8a, t9a punpcklqdq m4, m3 punpckhwd m3, m4 ;packed t15a, t14a ITX_MUL2X_PACK 1, 4, 6, 799, 4017 ;low:t8 high:t9 ITX_MUL2X_PACK 3, 4, 6, 2276, 3406, 1 ;low:t14 high:t15 paddsw m4, m1, m2 ;low:t12a high:t13a psubsw m1, m2 ;low:t8a high:t9a psubsw m2, m0, m3 ;low:t14a high:t15a paddsw m0, m3 ;low:t10a high:t11a punpcklqdq m3, m1 punpckhwd m3, m1 ;packed t12a, t13a punpcklqdq m1, m2 punpckhwd m2, m1 ;packed t15a, t14a ITX_MUL2X_PACK 3, 1, 6, 1567, 3784 ;low:t12 high:t13 ITX_MUL2X_PACK 2, 1, 6, 3784, 1567, 1 ;low:t14 high:t15 psubsw m1, m3, m2 ;low:t14a high:t15a paddsw m3, m2 ;low:out2 high:-out13 psubsw m2, m4, m0 ;low:t10 high:t11 paddsw m0, m4 ;low:-out1 high:out14 mova [coeffq+16*6], m0 mova [coeffq+16*7], m3 mova m0, [coeffq+16*4] mova m3, [coeffq+16*5] psubsw m4, m5, m3 ;low:t4 high:t5 paddsw m5, m3 ;low:t0 high:t1 psubsw m3, m0, m7 ;low:t6 high:t7 paddsw m0, m7 ;low:t2 high:t3 punpcklqdq m7, m4 punpckhwd m7, m4 ;packed t4, t5 punpcklqdq m4, m3 punpckhwd m3, m4 ;packed t7, t6 ITX_MUL2X_PACK 7, 4, 6, 1567, 3784 ;low:t4a high:t5a ITX_MUL2X_PACK 3, 4, 6, 3784, 1567, 1 ;low:t6a high:t7a psubsw m4, m5, m0 ;low:t2a high:t3a paddsw m0, m5 ;low:out0 high:-out15 psubsw m5, m7, m3 ;low:t6 high:t7 paddsw m3, m7 ;low:-out3 high:out12 ret ALIGN function_align .main_pass1_end: mova m7, [o(deint_shuf1)] mova [coeffq+16*4], m0 mova [coeffq+16*5], m3 mova m0, [o(pw_2896_m2896)] mova m3, [o(pw_2896_2896)] pshufb m1, m7 ;t14a t15a pshufb m2, m7 ;t10 t11 pshufb m4, m7 ;t2a t3a pshufb m5, m7 ;t6 t7 pmaddwd m7, m0, m2 pmaddwd m2, m3 paddd m7, m6 paddd m2, m6 psrad m7, 12 psrad m2, 12 packssdw m2, m7 ;low:out6 high:-out9 pmaddwd m7, m0, m4 pmaddwd m4, m3 paddd m7, m6 paddd m4, m6 psrad m7, 12 psrad m4, 12 packssdw m4, m7 ;low:-out7 high:out8 pmaddwd m7, m3, m5 pmaddwd m5, m0 paddd m7, m6 paddd m5, m6 psrad m7, 12 psrad m5, 12 packssdw m7, m5 ;low:out4 high:-out11 pmaddwd m5, m3, m1 pmaddwd m1, m0 paddd m5, m6 paddd m1, m6 psrad m5, 12 psrad m1, 12 packssdw m5, m1 ;low:-out5 high:out10 mova m0, [coeffq+16*4] mova m3, [coeffq+16*5] ret ALIGN function_align .main_pass2_end: mova m7, [o(pw_2896x8)] punpckhqdq m6, m2, m1 ;low:t11 high:t15a punpcklqdq m2, m1 ;low:t10 high:t14a psubsw m1, m2, m6 paddsw m2, m6 punpckhqdq m6, m4, m5 ;low:t3a high:t7 punpcklqdq m4, m5 ;low:t2a high:t6 psubsw m5, m4, m6 paddsw m4, m6 pmulhrsw m1, m7 ;low:-out9 high:out10 pmulhrsw m2, m7 ;low:out6 high:-out5 pmulhrsw m5, m7 ;low:out8 high:-out11 pmulhrsw m4, m7 ;low:-out7 high:out4 punpckhqdq m7, m4, m5 ;low:out4 high:-out11 punpcklqdq m4, m5 ;low:-out7 high:out8 punpckhqdq m5, m2, m1 ;low:-out5 high:out10 punpcklqdq m2, m1 ;low:out6 high:-out9 ret INV_TXFM_16X4_FN flipadst, dct INV_TXFM_16X4_FN flipadst, adst INV_TXFM_16X4_FN flipadst, flipadst INV_TXFM_16X4_FN flipadst, identity cglobal iflipadst_16x4_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 LOAD_7ROWS coeffq, 16 call m(iadst_16x4_internal).main call m(iadst_16x4_internal).main_pass1_end punpcklwd m6, m7, m0 ;packed out11, out15 punpckhwd m0, m7 ;packed -out0, -out4 punpckhwd m7, m3, m4 ;packed out3, out7 punpcklwd m4, m3 ;packed -out8, -out12 mova m1, [coeffq+16*6] punpckhwd m3, m1, m5 ;packed out1, out5 punpcklwd m5, m1 ;packed -out10, -out14 mova m1, [coeffq+16*7] mova [coeffq+16*6], m3 mova [coeffq+16*7], m7 punpcklwd m3, m2, m1 ;packed out9, out13 punpckhwd m1, m2 ;packed -out2, -out6 mova m7, [o(pw_m16384)] jmp m(iadst_16x4_internal).pass1_end .pass2: lea tx2q, [o(m(iflipadst_8x4_internal).pass2)] jmp m(idct_16x4_internal).pass2_end INV_TXFM_16X4_FN identity, dct INV_TXFM_16X4_FN identity, adst INV_TXFM_16X4_FN identity, flipadst INV_TXFM_16X4_FN identity, identity cglobal iidentity_16x4_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m1, [coeffq+16*6] mova m0, [coeffq+16*5] mova m2, [coeffq+16*7] mova m6, [o(pw_1697x16)] mova m7, [o(pw_16384)] pmulhrsw m4, m6, m1 pmulhrsw m3, m6, m0 pmulhrsw m5, m6, m2 pmulhrsw m4, m7 pmulhrsw m3, m7 pmulhrsw m5, m7 paddsw m1, m4 paddsw m0, m3 paddsw m5, m2 mova m2, [coeffq+16*2] mova m3, [coeffq+16*3] mova m4, [coeffq+16*4] mova [coeffq+16*6], m1 mova [coeffq+16*5], m0 mova [coeffq+16*7], m5 pmulhrsw m0, m6, m2 pmulhrsw m1, m6, m3 pmulhrsw m5, m6, m4 pmulhrsw m0, m7 pmulhrsw m1, m7 pmulhrsw m5, m7 paddsw m2, m0 paddsw m3, m1 paddsw m4, m5 mova m0, [coeffq+16*0] mova m1, [coeffq+16*1] pmulhrsw m5, m6, m0 pmulhrsw m6, m1 pmulhrsw m5, m7 pmulhrsw m6, m7 paddsw m0, m5 paddsw m1, m6 mova m6, [coeffq+16*6] mova m5, [coeffq+16*5] punpckhwd m7, m0, m2 ;packed out1, out5 punpcklwd m0, m2 ;packed out0, out4 punpckhwd m2, m1, m3 ;packed out3, out7 punpcklwd m1, m3 ;packed out2, out6 mova [coeffq+16*6], m7 mova m7, [coeffq+16*7] punpckhwd m3, m4, m6 ;packed out9, out13 punpcklwd m4, m6 ;packed out8, out12 punpckhwd m6, m5, m7 ;packed out11, out15 punpcklwd m5, m7 ;packed out10, out14 jmp m(idct_16x4_internal).pass1_end3 .pass2: lea tx2q, [o(m(iidentity_8x4_internal).pass2)] jmp m(idct_16x4_internal).pass2_end %macro SAVE_8ROWS 2 ;src, stride mova [%1+%2*0], m0 mova [%1+%2*1], m1 mova [%1+%2*2], m2 mova [%1+%2*3], m3 mova [%1+%2*4], m4 mova [%1+%2*5], m5 mova [%1+%2*6], m6 mova [%1+%2*7], m7 %endmacro %macro INV_TXFM_8X16_FN 2 ; type1, type2 INV_TXFM_FN %1, %2, 8x16, 8, 16*16 %ifidn %1_%2, dct_dct pshuflw m0, [coeffq], q0000 punpcklwd m0, m0 mova m1, [o(pw_2896x8)] pmulhrsw m0, m1 mova m2, [o(pw_16384)] mov [coeffq], eobd pmulhrsw m0, m1 pmulhrsw m0, m2 psrlw m2, 3 ; pw_2048 pmulhrsw m0, m1 pmulhrsw m0, m2 mov r3d, 4 lea tx2q, [o(m(inv_txfm_add_dct_dct_8x16).end)] jmp m(inv_txfm_add_dct_dct_8x8).loop .end: RET %endif %endmacro INV_TXFM_8X16_FN dct, dct INV_TXFM_8X16_FN dct, adst INV_TXFM_8X16_FN dct, flipadst INV_TXFM_8X16_FN dct, identity cglobal idct_8x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 lea r3, [o(m(idct_8x8_internal).pass1)] .pass1: LOAD_8ROWS coeffq+16*1, 32, 1 mov [rsp+gprsize+16*11], tx2q lea tx2q, [o(m(idct_8x16_internal).pass1_end)] jmp r3 .pass1_end: SAVE_8ROWS coeffq+16*1, 32 LOAD_8ROWS coeffq+16*0, 32, 1 mov tx2q, [rsp+gprsize+16*11] jmp r3 .pass2: lea tx2q, [o(m(idct_8x16_internal).end)] .pass2_pre: mova [coeffq+16*2 ], m1 mova [coeffq+16*6 ], m3 mova [coeffq+16*10], m5 mova [coeffq+16*14], m7 mova m1, m2 mova m2, m4 mova m3, m6 mova m4, [coeffq+16*1 ] mova m5, [coeffq+16*5 ] mova m6, [coeffq+16*9 ] mova m7, [coeffq+16*13] .pass2_main: call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 mova m0, [coeffq+16*2 ] mova m1, [coeffq+16*6 ] mova m2, [coeffq+16*10] mova m3, [coeffq+16*14] mova m4, [coeffq+16*3 ] mova m5, [coeffq+16*7 ] mova m6, [coeffq+16*11] mova m7, [coeffq+16*15] call m(idct_16x8_internal).main mov r3, dstq lea dstq, [dstq+strideq*8] jmp m(idct_8x8_internal).end .end: LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_8x16_internal).end1)] mov dstq, r3 jmp m(idct_8x8_internal).end .end1: pxor m7, m7 REPX {mova [coeffq+16*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ret INV_TXFM_8X16_FN adst, dct INV_TXFM_8X16_FN adst, adst INV_TXFM_8X16_FN adst, flipadst INV_TXFM_8X16_FN adst, identity cglobal iadst_8x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 lea r3, [o(m(iadst_8x8_internal).pass1)] jmp m(idct_8x16_internal).pass1 .pass2: lea tx2q, [o(m(iadst_8x16_internal).end)] .pass2_pre: mova [rsp+gprsize+16*7], m0 mova [rsp+gprsize+16*8], m1 mova [rsp+gprsize+16*5], m6 mova [rsp+gprsize+16*6], m7 mova m0, m2 mova m1, m3 mova m2, m4 mova m3, m5 .pass2_main: mova m4, [coeffq+16*1 ] mova m5, [coeffq+16*3 ] mova m6, [coeffq+16*13] mova m7, [coeffq+16*15] mova [rsp+gprsize+16*3], m4 mova [rsp+gprsize+16*4], m5 mova [rsp+gprsize+16*9], m6 mova [rsp+gprsize+32*5], m7 mova m4, [coeffq+16*5 ] mova m5, [coeffq+16*7 ] mova m6, [coeffq+16*9 ] mova m7, [coeffq+16*11] call m(iadst_16x8_internal).main call m(iadst_16x8_internal).main_pass2_end mov r3, dstq lea dstq, [dstq+strideq*8] jmp m(iadst_8x8_internal).end .end: LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_8x16_internal).end1)] mov dstq, r3 jmp m(iadst_8x8_internal).end INV_TXFM_8X16_FN flipadst, dct INV_TXFM_8X16_FN flipadst, adst INV_TXFM_8X16_FN flipadst, flipadst INV_TXFM_8X16_FN flipadst, identity cglobal iflipadst_8x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 lea r3, [o(m(iflipadst_8x8_internal).pass1)] jmp m(idct_8x16_internal).pass1 .pass2: lea tx2q, [o(m(iflipadst_8x16_internal).end)] lea r3, [dstq+strideq*8] .pass2_pre: mova [rsp+gprsize+16*7], m0 mova [rsp+gprsize+16*8], m1 mova [rsp+gprsize+16*5], m6 mova [rsp+gprsize+16*6], m7 mova m0, m2 mova m1, m3 mova m2, m4 mova m3, m5 .pass2_main: mova m4, [coeffq+16*1 ] mova m5, [coeffq+16*3 ] mova m6, [coeffq+16*13] mova m7, [coeffq+16*15] mova [rsp+gprsize+16*3], m4 mova [rsp+gprsize+16*4], m5 mova [rsp+gprsize+16*9], m6 mova [rsp+gprsize+32*5], m7 mova m4, [coeffq+16*5 ] mova m5, [coeffq+16*7 ] mova m6, [coeffq+16*9 ] mova m7, [coeffq+16*11] call m(iadst_16x8_internal).main call m(iadst_16x8_internal).main_pass2_end jmp m(iflipadst_8x8_internal).end .end: LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_8x16_internal).end1)] mov dstq, r3 jmp m(iflipadst_8x8_internal).end INV_TXFM_8X16_FN identity, dct INV_TXFM_8X16_FN identity, adst INV_TXFM_8X16_FN identity, flipadst INV_TXFM_8X16_FN identity, identity cglobal iidentity_8x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 LOAD_8ROWS coeffq+16*1, 32, 1 mov r3, tx2q lea tx2q, [o(m(iidentity_8x16_internal).pass1_end)] mova [rsp+gprsize+16*1], m6 jmp m(idct_8x8_internal).pass1_end3 .pass1_end: SAVE_8ROWS coeffq+16*1, 32 LOAD_8ROWS coeffq+16*0, 32, 1 mov tx2q, r3 mova [rsp+gprsize+16*1], m6 jmp m(idct_8x8_internal).pass1_end3 .pass2: lea tx2q, [o(m(iidentity_8x16_internal).end1)] .end: mova [rsp+gprsize+16*0], m7 mova [rsp+gprsize+16*1], m6 mova m7, [o(pw_1697x16)] REPX {IDTX16 x, 6, 7}, 0, 1, 2, 3, 4, 5 mova m6, [rsp+gprsize+16*1] mova [rsp+gprsize+16*2], m5 IDTX16 6, 5, 7 mova m5, [rsp+gprsize+16*0] IDTX16 5, 7, 7 mova m7, [o(pw_2048)] REPX {pmulhrsw x, m7}, m0, m1, m2, m3, m4, m5, m6 pmulhrsw m7, [rsp+gprsize+16*2] mova [rsp+gprsize+16*0], m5 mova [rsp+gprsize+16*1], m6 mova [rsp+gprsize+16*2], m7 jmp m(idct_8x8_internal).end3 .end1: LOAD_8ROWS coeffq+16*1, 32 lea tx2q, [o(m(idct_8x16_internal).end1)] lea dstq, [dstq+strideq*2] jmp .end %macro INV_TXFM_16X8_FN 2 ; type1, type2 INV_TXFM_FN %1, %2, 16x8, 8, 16*16 %ifidn %1_%2, dct_dct movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_16384)] mov [coeffq], eobd pmulhrsw m0, m1 mov r2d, 4 lea tx2q, [o(m(inv_txfm_add_dct_dct_16x8).end)] jmp m(inv_txfm_add_dct_dct_16x4).dconly .end: RET %endif %endmacro INV_TXFM_16X8_FN dct, dct INV_TXFM_16X8_FN dct, adst INV_TXFM_16X8_FN dct, flipadst INV_TXFM_16X8_FN dct, identity cglobal idct_16x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 LOAD_8ROWS coeffq+16*0, 32, 1 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+16*1, 32, 1 call .main mov r3, tx2q lea tx2q, [o(m(idct_16x8_internal).pass1_end)] jmp m(idct_8x8_internal).pass1_end .pass1_end: SAVE_8ROWS coeffq+16*1, 32 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 mov tx2q, r3 jmp m(idct_8x8_internal).pass1_end .pass2: lea tx2q, [o(m(idct_16x8_internal).end)] lea r3, [dstq+8] jmp m(idct_8x8_internal).pass2_main .end: LOAD_8ROWS coeffq+16*1, 32 lea tx2q, [o(m(idct_8x16_internal).end1)] mov dstq, r3 jmp m(idct_8x8_internal).pass2_main ALIGN function_align .main: mova [rsp+gprsize*2+16*1], m2 mova [rsp+gprsize*2+16*2], m6 mova [rsp+gprsize*2+32*5], m5 mova m6, [o(pd_2048)] ITX_MULSUB_2W 0, 7, 2, 5, 6, 401, 4076 ;t8a, t15a ITX_MULSUB_2W 4, 3, 2, 5, 6, 3166, 2598 ;t9a, t14a psubsw m2, m0, m4 ;t9 paddsw m0, m4 ;t8 psubsw m4, m7, m3 ;t14 paddsw m7, m3 ;t15 ITX_MULSUB_2W 4, 2, 3, 5, 6, 1567, 3784 ;t9a, t14a mova m3, [rsp+gprsize*2+16*1] mova m5, [rsp+gprsize*2+32*5] mova [rsp+gprsize*2+16*1], m2 mova [rsp+gprsize*2+32*5], m4 mova m2, [rsp+gprsize*2+16*2] mova [rsp+gprsize*2+16*2], m7 ITX_MULSUB_2W 3, 5, 7, 4, 6, 1931, 3612 ;t10a, t13a ITX_MULSUB_2W 2, 1, 7, 4, 6, 3920, 1189 ;t11a, t12a psubsw m4, m2, m3 ;t10 paddsw m2, m3 ;t11 psubsw m3, m1, m5 ;t13 paddsw m1, m5 ;t12 ITX_MULSUB_2W 3, 4, 7, 5, 6, m3784, 1567 ;t10a, t13a mova m7, [rsp+gprsize*2+32*5] psubsw m6, m0, m2 ;t11a paddsw m0, m2 ;t8a paddsw m2, m7, m3 ;t9 psubsw m7, m3 ;t10 mova m5, [rsp+gprsize*2+16*0] psubsw m3, m5, m0 ;out8 paddsw m0, m5 ;out7 mova [rsp+gprsize*2+32*5], m0 mova m5, [rsp+gprsize*2+16*9] psubsw m0, m5, m2 ;out9 paddsw m2, m5 ;out6 mova [rsp+gprsize*2+16*0], m0 mova [rsp+gprsize*2+16*9], m2 mova m0, [rsp+gprsize*2+16*1] mova m2, [rsp+gprsize*2+16*2] mova [rsp+gprsize*2+16*1], m3 psubsw m5, m0, m4 ;t13 paddsw m0, m4 ;t14 mova m3, [o(pd_2048)] psubsw m4, m2, m1 ;t12a paddsw m1, m2 ;t15a mova [rsp+gprsize*2+16*2], m1 ITX_MULSUB_2W 5, 7, 1, 2, 3, 2896, 2896 ;t10a, t13a ITX_MULSUB_2W 4, 6, 1, 2, 3, 2896, 2896 ;t11, t12 mova m3, [rsp+gprsize*2+16*8] psubsw m2, m3, m5 ;out10 paddsw m3, m5 ;out5 mova m5, [rsp+gprsize*2+16*7] mova [rsp+gprsize*2+16*8], m3 psubsw m3, m5, m4 ;out11 paddsw m5, m4 ;out4 mova m4, [rsp+gprsize*2+16*6] mova [rsp+gprsize*2+16*7], m5 paddsw m5, m4, m6 ;out3 psubsw m4, m6 ;out12 mova m6, [rsp+gprsize*2+16*5] mova [rsp+gprsize*2+16*6], m5 psubsw m5, m6, m7 ;out13 paddsw m6, m7 ;out2 mova m7, [rsp+gprsize*2+16*4] mova [rsp+gprsize*2+16*5], m6 psubsw m6, m7, m0 ;out14 paddsw m7, m0 ;out1 mova m1, [rsp+gprsize*2+16*2] mova m0, [rsp+gprsize*2+16*3] mova [rsp+gprsize*2+16*4], m7 psubsw m7, m0, m1 ;out15 paddsw m0, m1 ;out0 mova [rsp+gprsize*2+16*3], m0 mova m1, [rsp+gprsize*2+16*0] mova m0, [rsp+gprsize*2+16*1] mova [rsp+gprsize*2+16*0], m7 ret INV_TXFM_16X8_FN adst, dct INV_TXFM_16X8_FN adst, adst INV_TXFM_16X8_FN adst, flipadst INV_TXFM_16X8_FN adst, identity cglobal iadst_16x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m7, [o(pw_2896x8)] pmulhrsw m0, m7, [coeffq+16*0 ] pmulhrsw m1, m7, [coeffq+16*1 ] pmulhrsw m2, m7, [coeffq+16*14] pmulhrsw m3, m7, [coeffq+16*15] mova [rsp+gprsize+16*7], m0 mova [rsp+gprsize+16*8], m1 mova [rsp+gprsize+16*9], m2 mova [rsp+gprsize+32*5], m3 pmulhrsw m0, m7, [coeffq+16*6 ] pmulhrsw m1, m7, [coeffq+16*7 ] pmulhrsw m2, m7, [coeffq+16*8 ] pmulhrsw m3, m7, [coeffq+16*9 ] mova [rsp+gprsize+16*3], m2 mova [rsp+gprsize+16*4], m3 mova [rsp+gprsize+16*5], m0 mova [rsp+gprsize+16*6], m1 pmulhrsw m0, m7, [coeffq+16*2 ] pmulhrsw m1, m7, [coeffq+16*3 ] pmulhrsw m2, m7, [coeffq+16*4 ] pmulhrsw m3, m7, [coeffq+16*5 ] pmulhrsw m4, m7, [coeffq+16*10] pmulhrsw m5, m7, [coeffq+16*11] pmulhrsw m6, m7, [coeffq+16*12] pmulhrsw m7, [coeffq+16*13] call .main call .main_pass1_end mov r3, tx2q lea tx2q, [o(m(iadst_16x8_internal).pass1_end)] jmp m(iadst_8x8_internal).pass1_end .pass1_end: SAVE_8ROWS coeffq+16*1, 32 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 mov tx2q, r3 jmp m(iadst_8x8_internal).pass1_end .pass2: lea tx2q, [o(m(iadst_16x8_internal).end)] lea r3, [dstq+8] jmp m(iadst_8x8_internal).pass2_main .end: LOAD_8ROWS coeffq+16*1, 32 lea tx2q, [o(m(idct_8x16_internal).end1)] mov dstq, r3 jmp m(iadst_8x8_internal).pass2_main ALIGN function_align .main: mova [rsp+gprsize*2+16*0], m1 mova [rsp+gprsize*2+16*1], m2 mova [rsp+gprsize*2+16*2], m6 mova m6, [o(pd_2048)] ITX_MULSUB_2W 7, 0, 1, 2, 6, 995, 3973 ;t3, t2 ITX_MULSUB_2W 3, 4, 1, 2, 6, 3513, 2106 ;t11, t10 psubsw m1, m0, m4 ;t10a paddsw m0, m4 ;t2a psubsw m4, m7, m3 ;t11a paddsw m3, m7 ;t3a ITX_MULSUB_2W 1, 4, 7, 2, 6, 3406, 2276 ;t11, t10 mova m2, [rsp+gprsize*2+16*0] ;in3 mova m7, [rsp+gprsize*2+16*1] ;in4 mova [rsp+gprsize*2+16*0], m1 ;t11 mova [rsp+gprsize*2+16*1], m4 ;t10 mova m1, [rsp+gprsize*2+16*2] ;in12 mova [rsp+gprsize*2+16*2], m0 ;t2a ITX_MULSUB_2W 5, 7, 0, 4, 6, 1751, 3703 ;t5, t4 ITX_MULSUB_2W 2, 1, 0, 4, 6, 3857, 1380 ;t13, t12 psubsw m0, m7, m1 ;t12a paddsw m1, m7 ;t4a psubsw m4, m5, m2 ;t13a paddsw m5, m2 ;t5a ITX_MULSUB_2W 4, 0, 7, 2, 6, 4017, 799 ;t12, t13 mova m2, [rsp+gprsize*2+16*8] ;in1 mova m7, [rsp+gprsize*2+16*9] ;in14 mova [rsp+gprsize*2+16*8], m4 ;t12 mova [rsp+gprsize*2+16*9], m0 ;t13 mova m4, [rsp+gprsize*2+16*4] ;in9 mova m0, [rsp+gprsize*2+16*5] ;in6 mova [rsp+gprsize*2+16*4], m1 ;t4a mova [rsp+gprsize*2+16*5], m5 ;t5a ITX_MULSUB_2W 2, 7, 1, 5, 6, 4052, 601 ;t15, t14 ITX_MULSUB_2W 4, 0, 1, 5, 6, 2440, 3290 ;t7, t6 psubsw m1, m0, m7 ;t14a paddsw m0, m7 ;t6a psubsw m5, m4, m2 ;t15a paddsw m4, m2 ;t7a ITX_MULSUB_2W 5, 1, 7, 2, 6, 2276, 3406 ;t14, t15 mova m2, [rsp+gprsize*2+16*2] ;t2a mova [rsp+gprsize*2+16*2], m5 ;t14 psubsw m7, m2, m0 ;t6 paddsw m2, m0 ;t2 psubsw m0, m3, m4 ;t7 paddsw m3, m4 ;t3 ITX_MULSUB_2W 0, 7, 4, 5, 6, 3784, 1567 ;t6a, t7a mova m4, [rsp+gprsize*2+16*7] ;in0 mova m5, [rsp+gprsize*2+32*5] ;in15 mova [rsp+gprsize*2+16*7], m3 ;t3 mova [rsp+gprsize*2+32*5], m1 ;t15 mova m1, [rsp+gprsize*2+16*6] ;in7 mova m3, [rsp+gprsize*2+16*3] ;in8 mova [rsp+gprsize*2+16*6], m7 ;t7a mova [rsp+gprsize*2+16*3], m0 ;t6a ITX_MULSUB_2W 5, 4, 0, 7, 6, 201, 4091 ;t1, t0 ITX_MULSUB_2W 1, 3, 0, 7, 6, 3035, 2751 ;t9, t8 psubsw m0, m4, m3 ;t8a paddsw m4, m3 ;t0a psubsw m3, m5, m1 ;t9a paddsw m5, m1 ;t1a ITX_MULSUB_2W 0, 3, 1, 7, 6, 799, 4017 ;t9, t8 mova m1, [rsp+gprsize*2+16*4] ;t4a mova m7, [rsp+gprsize*2+16*5] ;t5a mova [rsp+gprsize*2+16*4], m3 ;t8 mova [rsp+gprsize*2+16*5], m0 ;t9 psubsw m0, m4, m1 ;t4 paddsw m4, m1 ;t0 psubsw m3, m5, m7 ;t5 paddsw m5, m7 ;t1 ITX_MULSUB_2W 0, 3, 1, 7, 6, 1567, 3784 ;t5a, t4a mova m7, [rsp+gprsize*2+16*3] ;t6a psubsw m1, m4, m2 ;t2a paddsw m4, m2 ;out0 mova [rsp+gprsize*2+16*3], m4 ;out0 mova m4, [rsp+gprsize*2+16*6] ;t7a psubsw m2, m3, m7 ;t6 paddsw m3, m7 ;-out3 mova [rsp+gprsize*2+16*6], m3 ;-out3 psubsw m3, m0, m4 ;t7 paddsw m0, m4 ;out12 mova [rsp+gprsize*2+16*12], m3 mova m3, [rsp+gprsize*2+16*7] ;t3 mova [rsp+gprsize*2+16* 7], m2 ;out4 psubsw m2, m5, m3 ;t3a paddsw m5, m3 ;-out15 mova [rsp+gprsize*2+16*11], m2 mova m2, [rsp+gprsize*2+32*5] ;t15 mova [rsp+gprsize*2+16*10], m1 ;-out7 mova m1, [rsp+gprsize*2+16*0] ;t11 mova [rsp+gprsize*2+16*0 ], m5 ;-out15 mova m3, [rsp+gprsize*2+16*1] ;t10 mova [rsp+gprsize*2+16*1 ], m4 ;-out11 mova m4, [rsp+gprsize*2+16*2] ;t14 mova [rsp+gprsize*2+16*2 ], m0 ;out12 psubsw m0, m3, m4 ;t14a paddsw m3, m4 ;t10a psubsw m5, m1, m2 ;t15a paddsw m1, m2 ;t11a ITX_MULSUB_2W 5, 0, 2, 4, 6, 3784, 1567 ;t14, t15 mova m2, [rsp+gprsize*2+16*4] ;t8 mova m4, [rsp+gprsize*2+16*5] ;t9 mova [rsp+gprsize*2+16*4], m3 ;t10a mova [rsp+gprsize*2+16*5], m1 ;t11a mova m3, [rsp+gprsize*2+16*8] ;t12 mova m1, [rsp+gprsize*2+16*9] ;t13 mova [rsp+gprsize*2+16*8], m5 ;t14 mova [rsp+gprsize*2+16*9], m0 ;t15 psubsw m5, m2, m3 ;t12a paddsw m2, m3 ;t8a psubsw m0, m4, m1 ;t13a paddsw m4, m1 ;t9a ITX_MULSUB_2W 5, 0, 1, 3, 6, 1567, 3784 ;t13, t12 mova m6, [rsp+gprsize*2+16*4] ;t10a mova m1, [rsp+gprsize*2+16*5] ;t11a psubsw m3, m2, m6 ;t10 paddsw m2, m6 ;-out1 paddsw m6, m4, m1 ;out14 psubsw m4, m1 ;t11 mova [rsp+gprsize*2+16*14], m4 mova [rsp+gprsize*2+16* 4], m2 ;-out1 mova m4, [rsp+gprsize*2+16*8] ;t14 mova m2, [rsp+gprsize*2+16*9] ;t15 mova [rsp+gprsize*2+16* 9], m3 ;out6 psubsw m3, m0, m4 ;t14a paddsw m0, m4 ;out2 psubsw m4, m5, m2 ;t15a paddsw m5, m2 ;-out13 mova [rsp+gprsize*2+16* 5], m0 ;out2 ret ALIGN function_align .main_pass1_end: mova m0, [rsp+gprsize*2+16*14] mova [rsp+gprsize*2+16*14], m5 mova [rsp+gprsize*2+16*15], m6 mova m5, [o(pw_2896_2896)] mova m6, [o(pw_2896_m2896)] mova m7, [o(pd_2048)] punpcklwd m2, m3, m4 punpckhwd m3, m4 pmaddwd m4, m5, m2 pmaddwd m2, m6 pmaddwd m1, m5, m3 pmaddwd m3, m6 REPX {paddd x, m7}, m4, m2, m1, m3 REPX {psrad x, 12}, m4, m1, m2, m3 packssdw m4, m1 ;-out5 packssdw m2, m3 ;out10 mova [rsp+gprsize*2+16* 8], m4 mova m3, [rsp+gprsize*2+16* 9] punpcklwd m1, m3, m0 punpckhwd m3, m0 pmaddwd m0, m5, m1 pmaddwd m1, m6 pmaddwd m4, m5, m3 pmaddwd m3, m6 REPX {paddd x, m7}, m0, m1, m4, m3 REPX {psrad x, 12}, m0, m4, m1, m3 packssdw m0, m4 ;out6 packssdw m1, m3 ;-out9 mova [rsp+gprsize*2+16* 9], m0 mova m0, [rsp+gprsize*2+16* 7] mova m4, [rsp+gprsize*2+16*12] punpcklwd m3, m0, m4 punpckhwd m0, m4 pmaddwd m4, m5, m3 pmaddwd m3, m6 pmaddwd m5, m0 pmaddwd m0, m6 REPX {paddd x, m7}, m4, m3, m5, m0 REPX {psrad x, 12}, m4, m5, m3, m0 packssdw m4, m5 ;out4 packssdw m3, m0 ;-out11 mova [rsp+gprsize*2+16* 7], m4 mova m4, [rsp+gprsize*2+16*10] mova m5, [rsp+gprsize*2+16*11] punpcklwd m0, m4, m5 punpckhwd m4, m5 pmaddwd m5, m0, [o(pw_2896_2896)] pmaddwd m0, m6 pmaddwd m6, m4 pmaddwd m4, [o(pw_2896_2896)] REPX {paddd x, m7}, m5, m0, m6, m4 REPX {psrad x, 12}, m0, m6, m5, m4 packssdw m0, m6 ;out8 packssdw m5, m4 ;-out7 mova [rsp+gprsize*2+16*10], m5 mova m4, [rsp+gprsize*2+16* 2] ;out12 mova m5, [rsp+gprsize*2+16*14] ;-out13 mova m6, [rsp+gprsize*2+16*15] ;out14 ret ALIGN function_align .main_pass2_end: mova m7, [o(pw_2896x8)] mova m1, [rsp+gprsize*2+16* 9] mova m2, [rsp+gprsize*2+16*14] paddsw m0, m1, m2 psubsw m1, m2 pmulhrsw m0, m7 ;out6 pmulhrsw m1, m7 ;-out9 mova [rsp+gprsize*2+16* 9], m0 psubsw m2, m3, m4 paddsw m3, m4 pmulhrsw m2, m7 ;out10 pmulhrsw m3, m7 ;-out5 mova [rsp+gprsize*2+16* 8], m3 mova m3, [rsp+gprsize*2+16* 7] mova m4, [rsp+gprsize*2+16*12] paddsw m0, m3, m4 psubsw m3, m4 pmulhrsw m0, m7 ;out4 pmulhrsw m3, m7 ;-out11 mova [rsp+gprsize*2+16* 7], m0 mova m0, [rsp+gprsize*2+16*10] paddsw m4, m0, [rsp+gprsize*2+16*11] psubsw m0, [rsp+gprsize*2+16*11] pmulhrsw m4, m7 ;-out7 pmulhrsw m0, m7 ;out8 mova [rsp+gprsize*2+16*10], m4 mova m4, [rsp+gprsize*2+16*2 ] ;out12 ret INV_TXFM_16X8_FN flipadst, dct INV_TXFM_16X8_FN flipadst, adst INV_TXFM_16X8_FN flipadst, flipadst INV_TXFM_16X8_FN flipadst, identity cglobal iflipadst_16x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mova m7, [o(pw_2896x8)] pmulhrsw m0, m7, [coeffq+16*0 ] pmulhrsw m1, m7, [coeffq+16*1 ] pmulhrsw m2, m7, [coeffq+16*14] pmulhrsw m3, m7, [coeffq+16*15] mova [rsp+gprsize+16*7], m0 mova [rsp+gprsize+16*8], m1 mova [rsp+gprsize+16*9], m2 mova [rsp+gprsize+32*5], m3 pmulhrsw m0, m7, [coeffq+16*6 ] pmulhrsw m1, m7, [coeffq+16*7 ] pmulhrsw m2, m7, [coeffq+16*8 ] pmulhrsw m3, m7, [coeffq+16*9 ] mova [rsp+gprsize+16*3], m2 mova [rsp+gprsize+16*4], m3 mova [rsp+gprsize+16*5], m0 mova [rsp+gprsize+16*6], m1 pmulhrsw m0, m7, [coeffq+16*2 ] pmulhrsw m1, m7, [coeffq+16*3 ] pmulhrsw m2, m7, [coeffq+16*4 ] pmulhrsw m3, m7, [coeffq+16*5 ] pmulhrsw m4, m7, [coeffq+16*10] pmulhrsw m5, m7, [coeffq+16*11] pmulhrsw m6, m7, [coeffq+16*12] pmulhrsw m7, [coeffq+16*13] call m(iadst_16x8_internal).main call m(iadst_16x8_internal).main_pass1_end mova m7, [rsp+gprsize+16*0] SAVE_8ROWS coeffq+16*0, 32 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 mov r3, tx2q lea tx2q, [o(m(iflipadst_16x8_internal).pass1_end)] jmp m(iflipadst_8x8_internal).pass1_end .pass1_end: SAVE_8ROWS coeffq+16*1, 32 LOAD_8ROWS coeffq+16*0, 32 mova [rsp+gprsize+16*0], m7 mov tx2q, r3 jmp m(iflipadst_8x8_internal).pass1_end .pass2: lea tx2q, [o(m(iflipadst_16x8_internal).end)] lea r3, [dstq+8] jmp m(iflipadst_8x8_internal).pass2_main .end: LOAD_8ROWS coeffq+16*1, 32 lea tx2q, [o(m(idct_8x16_internal).end1)] mov dstq, r3 jmp m(iflipadst_8x8_internal).pass2_main INV_TXFM_16X8_FN identity, dct INV_TXFM_16X8_FN identity, adst INV_TXFM_16X8_FN identity, flipadst INV_TXFM_16X8_FN identity, identity cglobal iidentity_16x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 add coeffq, 16*16 mova m4, [coeffq-16*7] mova m5, [coeffq-16*5] mova m6, [coeffq-16*3] mova m7, [coeffq-16*1] mov r3, tx2q lea tx2q, [o(m(iidentity_16x8_internal).pass1_end)] .pass1: mova m0, [o(pw_2896x8)] mova m2, [o(pw_1697x16)] mova m3, [o(pw_16384)] sub coeffq, 8*16 REPX {pmulhrsw x, m0}, m4, m5, m6, m7 pmulhrsw m1, m2, m4 pmulhrsw m1, m3 paddsw m1, m4 ; 1 pmulhrsw m4, m2, m5 pmulhrsw m4, m3 paddsw m4, m5 ; 3 pmulhrsw m5, m2, m6 pmulhrsw m5, m3 paddsw m5, m6 ; 5 pmulhrsw m6, m2, m7 pmulhrsw m6, m3 paddsw m7, m6 ; 7 pmulhrsw m6, m0, [coeffq+16*6] mova [rsp+gprsize+16*0], m4 pmulhrsw m4, m2, m6 pmulhrsw m4, m3 paddsw m6, m4 ; 6 pmulhrsw m4, m0, [coeffq+16*4] mova [rsp+gprsize+16*1], m6 pmulhrsw m6, m2, m4 pmulhrsw m6, m3 paddsw m4, m6 ; 4 pmulhrsw m6, m0, [coeffq+16*2] pmulhrsw m0, [coeffq+16*0] pmulhrsw m2, m6 pmulhrsw m2, m3 paddsw m2, m6 ; 2 pmulhrsw m6, m0, [o(pw_1697x16)] pmulhrsw m6, m3 mova m3, [rsp+gprsize+16*0] paddsw m0, m6 jmp m(idct_8x8_internal).pass1_end3 .pass1_end: mova [coeffq+16*1], m4 mova [coeffq+16*3], m5 mova [coeffq+16*5], m6 mova [coeffq+16*7], m7 mova m4, [coeffq-16*7] mova m5, [coeffq-16*5] mova m6, [coeffq-16*3] mova m7, [coeffq-16*1] mova [coeffq-16*7], m0 mova [coeffq-16*5], m1 mova [coeffq-16*3], m2 mova [coeffq-16*1], m3 mov tx2q, r3 jmp .pass1 .pass2: lea tx2q, [o(m(iidentity_16x8_internal).end)] lea r3, [dstq+8] jmp m(iidentity_8x8_internal).end .end: LOAD_8ROWS coeffq+16*1, 32 lea tx2q, [o(m(idct_8x16_internal).end1)] mov dstq, r3 jmp m(iidentity_8x8_internal).end %macro INV_TXFM_16X16_FN 2 ; type1, type2 INV_TXFM_FN %1, %2, 16x16, 8, 16*16 %ifidn %1_%2, dct_dct movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_8192)] mov [coeffq], eobd mov r2d, 8 lea tx2q, [o(m(inv_txfm_add_dct_dct_16x16).end)] jmp m(inv_txfm_add_dct_dct_16x4).dconly .end: RET %endif %endmacro INV_TXFM_16X16_FN dct, dct INV_TXFM_16X16_FN dct, adst INV_TXFM_16X16_FN dct, flipadst INV_TXFM_16X16_FN dct, identity cglobal idct_16x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 LOAD_8ROWS coeffq+16*1, 64 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+16*3, 64 call m(idct_16x8_internal).main mov r3, tx2q lea tx2q, [o(m(idct_16x16_internal).pass1_end)] mova m7, [o(pw_8192)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end: SAVE_8ROWS coeffq+16*17, 32 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_16x16_internal).pass1_end1)] mova m7, [o(pw_8192)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end1: SAVE_8ROWS coeffq+16*1, 32 LOAD_8ROWS coeffq+16*0, 64 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+16*2, 64 call m(idct_16x8_internal).main lea tx2q, [o(m(idct_16x16_internal).pass1_end2)] mova m7, [o(pw_8192)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end2: SAVE_8ROWS coeffq+16*16, 32 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 mov tx2q, r3 mova m7, [o(pw_8192)] jmp m(idct_8x8_internal).pass1_end1 .pass2: lea tx2q, [o(m(idct_16x16_internal).end)] jmp m(idct_8x16_internal).pass2_pre .end: LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_16x16_internal).end1)] mov dstq, r3 lea r3, [dstq+8] jmp m(idct_8x8_internal).end .end1: pxor m7, m7 REPX {mova [coeffq+16*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 add coeffq, 32*8 mov dstq, r3 mova m0, [coeffq+16*0 ] mova m1, [coeffq+16*4 ] mova m2, [coeffq+16*8 ] mova m3, [coeffq+16*12] mova m4, [coeffq+16*1 ] mova m5, [coeffq+16*5 ] mova m6, [coeffq+16*9 ] mova m7, [coeffq+16*13] lea tx2q, [o(m(idct_8x16_internal).end)] jmp m(idct_8x16_internal).pass2_main %macro ITX_16X16_ADST_LOAD_ODD_COEFS 0 mova m0, [coeffq+16*1 ] mova m1, [coeffq+16*3 ] mova m2, [coeffq+16*29] mova m3, [coeffq+16*31] mova [rsp+gprsize+16*7], m0 mova [rsp+gprsize+16*8], m1 mova [rsp+gprsize+16*9], m2 mova [rsp+gprsize+32*5], m3 mova m0, [coeffq+16*13] mova m1, [coeffq+16*15] mova m2, [coeffq+16*17] mova m3, [coeffq+16*19] mova [rsp+gprsize+16*3], m2 mova [rsp+gprsize+16*4], m3 mova [rsp+gprsize+16*5], m0 mova [rsp+gprsize+16*6], m1 mova m0, [coeffq+16*5 ] mova m1, [coeffq+16*7 ] mova m2, [coeffq+16*9 ] mova m3, [coeffq+16*11] mova m4, [coeffq+16*21] mova m5, [coeffq+16*23] mova m6, [coeffq+16*25] mova m7, [coeffq+16*27] %endmacro %macro ITX_16X16_ADST_LOAD_EVEN_COEFS 0 mova m0, [coeffq+16*0 ] mova m1, [coeffq+16*2 ] mova m2, [coeffq+16*28] mova m3, [coeffq+16*30] mova [rsp+gprsize+16*7], m0 mova [rsp+gprsize+16*8], m1 mova [rsp+gprsize+16*9], m2 mova [rsp+gprsize+32*5], m3 mova m0, [coeffq+16*12] mova m1, [coeffq+16*14] mova m2, [coeffq+16*16] mova m3, [coeffq+16*18] mova [rsp+gprsize+16*3], m2 mova [rsp+gprsize+16*4], m3 mova [rsp+gprsize+16*5], m0 mova [rsp+gprsize+16*6], m1 mova m0, [coeffq+16*4 ] mova m1, [coeffq+16*6 ] mova m2, [coeffq+16*8 ] mova m3, [coeffq+16*10] mova m4, [coeffq+16*20] mova m5, [coeffq+16*22] mova m6, [coeffq+16*24] mova m7, [coeffq+16*26] %endmacro INV_TXFM_16X16_FN adst, dct INV_TXFM_16X16_FN adst, adst INV_TXFM_16X16_FN adst, flipadst cglobal iadst_16x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 ITX_16X16_ADST_LOAD_ODD_COEFS call m(iadst_16x8_internal).main call m(iadst_16x8_internal).main_pass1_end mov r3, tx2q lea tx2q, [o(m(iadst_16x16_internal).pass1_end)] mova m7, [o(pw_8192)] jmp m(iadst_8x8_internal).pass1_end1 .pass1_end: SAVE_8ROWS coeffq+16*17, 32 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(iadst_16x16_internal).pass1_end1)] mova m7, [o(pw_8192)] jmp m(iadst_8x8_internal).pass1_end1 .pass1_end1: SAVE_8ROWS coeffq+16*1, 32 ITX_16X16_ADST_LOAD_EVEN_COEFS call m(iadst_16x8_internal).main call m(iadst_16x8_internal).main_pass1_end lea tx2q, [o(m(iadst_16x16_internal).pass1_end2)] mova m7, [o(pw_8192)] jmp m(iadst_8x8_internal).pass1_end1 .pass1_end2: SAVE_8ROWS coeffq+16*16, 32 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 mov tx2q, r3 mova m7, [o(pw_8192)] jmp m(iadst_8x8_internal).pass1_end1 .pass2: lea tx2q, [o(m(iadst_16x16_internal).end)] jmp m(iadst_8x16_internal).pass2_pre .end: LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(iadst_16x16_internal).end1)] mov dstq, r3 lea r3, [dstq+8] jmp m(iadst_8x8_internal).end .end1: pxor m7, m7 REPX {mova [coeffq+16*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 add coeffq, 32*8 mov dstq, r3 mova m4, [coeffq+16*0 ] mova m5, [coeffq+16*2 ] mova m0, [coeffq+16*4 ] mova m1, [coeffq+16*6 ] mova m2, [coeffq+16*8 ] mova m3, [coeffq+16*10] mova m6, [coeffq+16*12] mova m7, [coeffq+16*14] mova [rsp+gprsize+16*7], m4 mova [rsp+gprsize+16*8], m5 mova [rsp+gprsize+16*5], m6 mova [rsp+gprsize+16*6], m7 lea tx2q, [o(m(iadst_8x16_internal).end)] jmp m(iadst_8x16_internal).pass2_main INV_TXFM_16X16_FN flipadst, dct INV_TXFM_16X16_FN flipadst, adst INV_TXFM_16X16_FN flipadst, flipadst cglobal iflipadst_16x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 ITX_16X16_ADST_LOAD_ODD_COEFS call m(iadst_16x8_internal).main call m(iadst_16x8_internal).main_pass1_end mov r3, tx2q lea tx2q, [o(m(iflipadst_16x16_internal).pass1_end)] mova m7, [o(pw_m8192)] jmp m(iflipadst_8x8_internal).pass1_end1 .pass1_end: SAVE_8ROWS coeffq+16*1, 32 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(iflipadst_16x16_internal).pass1_end1)] mova m7, [o(pw_m8192)] jmp m(iflipadst_8x8_internal).pass1_end1 .pass1_end1: SAVE_8ROWS coeffq+16*17, 32 ITX_16X16_ADST_LOAD_EVEN_COEFS call m(iadst_16x8_internal).main call m(iadst_16x8_internal).main_pass1_end mova m7, [rsp+gprsize+16*0] SAVE_8ROWS coeffq+16*0, 32 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(iflipadst_16x16_internal).pass1_end2)] mova m7, [o(pw_m8192)] jmp m(iflipadst_8x8_internal).pass1_end1 .pass1_end2: SAVE_8ROWS coeffq+16*16, 32 LOAD_8ROWS coeffq+16* 0, 32 mova [rsp+gprsize+16*0], m7 mov tx2q, r3 mova m7, [o(pw_m8192)] jmp m(iflipadst_8x8_internal).pass1_end1 .pass2: lea tx2q, [o(m(iflipadst_16x16_internal).end)] lea r3, [dstq+8] jmp m(iflipadst_8x16_internal).pass2_pre .end: LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(iflipadst_16x16_internal).end1)] lea dstq, [dstq+strideq*2] jmp m(iflipadst_8x8_internal).end .end1: pxor m7, m7 REPX {mova [coeffq+16*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 add coeffq, 32*8 mova m4, [coeffq+16*0 ] mova m5, [coeffq+16*2 ] mova m0, [coeffq+16*4 ] mova m1, [coeffq+16*6 ] mova m2, [coeffq+16*8 ] mova m3, [coeffq+16*10] mova m6, [coeffq+16*12] mova m7, [coeffq+16*14] mova [rsp+gprsize+16*7], m4 mova [rsp+gprsize+16*8], m5 mova [rsp+gprsize+16*5], m6 mova [rsp+gprsize+16*6], m7 lea tx2q, [o(m(iflipadst_16x16_internal).end2)] mov dstq, r3 jmp m(iflipadst_8x16_internal).pass2_main .end2: LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_8x16_internal).end1)] lea dstq, [dstq+strideq*2] jmp m(iflipadst_8x8_internal).end %macro IDTX16B 3 ; src/dst, tmp, pw_1697x16 pmulhrsw m%2, m%3, m%1 psraw m%2, 1 pavgw m%1, m%2 %endmacro INV_TXFM_16X16_FN identity, dct INV_TXFM_16X16_FN identity, identity cglobal iidentity_16x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 add coeffq, 16*17 mov r3, tx2q lea tx2q, [o(m(iidentity_16x16_internal).pass1_end)] .pass1: mova m6, [o(pw_1697x16)] mova m7, [coeffq+32*6] mova m0, [coeffq+32*0] mova m1, [coeffq+32*1] mova m2, [coeffq+32*2] mova m3, [coeffq+32*3] mova m4, [coeffq+32*4] REPX {IDTX16B x, 5, 6}, 7, 0, 1, 2, 3, 4 mova m5, [coeffq+32*5] mova [rsp+gprsize+16*1], m7 IDTX16B 5, 7, 6 mova m7, [coeffq+32*7] IDTX16B 7, 6, 6 jmp m(idct_8x8_internal).pass1_end3 .pass1_end: SAVE_8ROWS coeffq, 32 sub coeffq, 16 lea tx2q, [o(m(iidentity_16x16_internal).pass1_end1)] jmp .pass1 .pass1_end1: SAVE_8ROWS coeffq, 32 sub coeffq, 15*16 lea tx2q, [o(m(iidentity_16x16_internal).pass1_end2)] jmp .pass1 .pass1_end2: SAVE_8ROWS coeffq, 32 sub coeffq, 16 mov tx2q, r3 jmp .pass1 .pass2: lea r3, [dstq+8] lea tx2q, [o(m(iidentity_16x16_internal).end1)] .end: mova [rsp+gprsize+16*0], m7 mova [rsp+gprsize+16*1], m4 mova m7, [o(pw_1697x16)] REPX {IDTX16 x, 4, 7}, 5, 6, 0, 1, 2, 3 mova m4, [o(pw_2048)] pmulhrsw m5, m4 pmulhrsw m6, m4 mova [rsp+gprsize+16*2], m5 mova m5, [rsp+gprsize+16*1] mova [rsp+gprsize+16*1], m6 IDTX16 5, 6, 7 mova m6, [rsp+gprsize+16*0] IDTX16 6, 7, 7 REPX {pmulhrsw x, m4}, m0, m1, m2, m3, m6 pmulhrsw m4, m5 mova [rsp+gprsize+16*0], m6 jmp m(idct_8x8_internal).end3 .end1: LOAD_8ROWS coeffq+16*1, 32 lea tx2q, [o(m(iidentity_16x16_internal).end2)] lea dstq, [dstq+strideq*2] jmp .end .end2: pxor m7, m7 REPX {mova [coeffq+16*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 add coeffq, 32*8 LOAD_8ROWS coeffq, 32 lea tx2q, [o(m(iidentity_16x16_internal).end3)] mov dstq, r3 jmp .end .end3: LOAD_8ROWS coeffq+16*1, 32 lea tx2q, [o(m(idct_8x16_internal).end1)] lea dstq, [dstq+strideq*2] jmp .end cglobal inv_txfm_add_dct_dct_8x32, 4, 6, 8, 16*36, dst, stride, coeff, eob, tx2 %if ARCH_X86_32 LEA r5, $$ %endif test eobd, eobd jz .dconly call m(idct_8x32_internal) RET .dconly: movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_8192)] mov [coeffq], eobd pmulhrsw m0, m2 psrlw m2, 2 ;pw_2048 pmulhrsw m0, m1 pmulhrsw m0, m2 pshuflw m0, m0, q0000 punpcklwd m0, m0 mov r3d, 8 lea tx2q, [o(m(inv_txfm_add_dct_dct_8x32).end)] jmp m(inv_txfm_add_dct_dct_8x8).loop .end: RET cglobal idct_8x32_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 %undef cmp cmp eobd, 106 jle .fast LOAD_8ROWS coeffq+16*3, 64 call m(idct_8x8_internal).main mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_8x32_internal).pass1)] jmp m(idct_8x8_internal).pass1_end1 .pass1: mova [rsp+gprsize+16*9 ], m0 ;in24 mova [rsp+gprsize+16*10], m4 ;in28 mova [rsp+gprsize+16*17], m2 ;in26 mova [rsp+gprsize+16*18], m6 ;in30 mova [rsp+gprsize+16*31], m1 ;in25 mova [rsp+gprsize+16*30], m3 ;in27 mova [rsp+gprsize+16*27], m5 ;in29 mova [rsp+gprsize+16*34], m7 ;in31 LOAD_8ROWS coeffq+16*2, 64 call m(idct_8x8_internal).main mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_8x32_internal).pass1_1)] jmp m(idct_8x8_internal).pass1_end1 .pass1_1: mova [rsp+gprsize+16*7 ], m0 ;in16 mova [rsp+gprsize+16*8 ], m4 ;in20 mova [rsp+gprsize+16*15], m2 ;in18 mova [rsp+gprsize+16*16], m6 ;in22 mova [rsp+gprsize+16*33], m1 ;in17 mova [rsp+gprsize+16*28], m3 ;in19 mova [rsp+gprsize+16*29], m5 ;in21 mova [rsp+gprsize+16*32], m7 ;in23 .fast: LOAD_8ROWS coeffq+16*1, 64 call m(idct_8x8_internal).main mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_8x32_internal).pass1_end)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end: mova [rsp+gprsize+16*5 ], m0 ;in8 mova [rsp+gprsize+16*6 ], m4 ;in12 mova [rsp+gprsize+16*13], m2 ;in10 mova [rsp+gprsize+16*14], m6 ;in14 mova [rsp+gprsize+16*21], m1 ;in9 mova [rsp+gprsize+16*24], m3 ;in11 mova [rsp+gprsize+16*25], m5 ;in13 mova [rsp+gprsize+16*20], m7 ;in15 LOAD_8ROWS coeffq+16*0, 64 call m(idct_8x8_internal).main mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_8x32_internal).pass1_end1)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end1: mova [rsp+gprsize+16*11], m2 ;in2 mova [rsp+gprsize+16*12], m6 ;in6 mova [rsp+gprsize+16*19], m1 ;in1 mova [rsp+gprsize+16*26], m3 ;in3 mova [rsp+gprsize+16*23], m5 ;in5 mova [rsp+gprsize+16*22], m7 ;in7 mova m1, m4 ;in4 mova m2, [rsp+gprsize+16*5 ] ;in8 mova m3, [rsp+gprsize+16*6 ] ;in12 cmp eobd, 106 jg .full pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3 , 16 mova m0, [rsp+gprsize+16*11] mova m1, [rsp+gprsize+16*12] mova m2, [rsp+gprsize+16*13] mova m3, [rsp+gprsize+16*14] pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 call .main_fast jmp .pass2 .full: mova m4, [rsp+gprsize+16*7 ] ;in16 mova m5, [rsp+gprsize+16*8 ] ;in20 mova m6, [rsp+gprsize+16*9 ] ;in24 mova m7, [rsp+gprsize+16*10] ;in28 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3 , 16 LOAD_8ROWS rsp+gprsize+16*11, 16 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 call .main .pass2: lea r3, [o(m(idct_8x32_internal).end6)] .end: mova [rsp+gprsize+16*0 ], m7 lea tx2q, [o(m(idct_8x32_internal).end2)] .end1: pxor m7, m7 REPX {mova [coeffq+16*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7, \ 8, 9, 10, 11, 12, 13, 14, 15, \ 16, 17, 18, 19, 20, 21, 22, 23, \ 24, 25, 26, 27, 28, 29, 30, 31 jmp tx2q .end2: lea tx2q, [o(m(idct_8x32_internal).end3)] jmp m(idct_8x8_internal).end .end3: LOAD_8ROWS rsp+gprsize+16*11, 16 mova [rsp+gprsize+16*0 ], m7 lea dstq, [dstq+strideq*2] lea tx2q, [o(m(idct_8x32_internal).end4)] jmp m(idct_8x8_internal).end .end4: LOAD_8ROWS rsp+gprsize+16*19, 16 mova [rsp+gprsize+16*0 ], m7 lea dstq, [dstq+strideq*2] lea tx2q, [o(m(idct_8x32_internal).end5)] jmp m(idct_8x8_internal).end .end5: LOAD_8ROWS rsp+gprsize+16*27, 16 mova [rsp+gprsize+16*0 ], m7 lea dstq, [dstq+strideq*2] mov tx2q, r3 jmp m(idct_8x8_internal).end .end6: ret ALIGN function_align .main_veryfast: mova m0, [rsp+gprsize*2+16*19] ;in1 pmulhrsw m3, m0, [o(pw_4091x8)] ;t30,t31 pmulhrsw m0, [o(pw_201x8)] ;t16,t17 mova m7, [o(pd_2048)] mova [rsp+gprsize*2+16*19], m0 ;t16 mova [rsp+gprsize*2+16*34], m3 ;t31 ITX_MULSUB_2W 3, 0, 1, 2, 7, 799, 4017 ;t17a, t30a mova [rsp+gprsize*2+16*20], m3 ;t17a mova [rsp+gprsize*2+16*33], m0 ;t30a mova m1, [rsp+gprsize*2+16*22] ;in7 pmulhrsw m2, m1, [o(pw_3857x8)] ;t28,t29 pmulhrsw m1, [o(pw_m1380x8)] ;t18,t19 mova [rsp+gprsize*2+16*22], m1 ;t19 mova [rsp+gprsize*2+16*31], m2 ;t28 ITX_MULSUB_2W 2, 1, 0, 3, 7, m4017, 799 ;t18a, t29a mova [rsp+gprsize*2+16*21], m2 ;t18a mova [rsp+gprsize*2+16*32], m1 ;t29a mova m0, [rsp+gprsize*2+16*23] ;in5 pmulhrsw m3, m0, [o(pw_3973x8)] ;t26, t27 pmulhrsw m0, [o(pw_995x8)] ;t20, t21 mova [rsp+gprsize*2+16*23], m0 ;t20 mova [rsp+gprsize*2+16*30], m3 ;t27 ITX_MULSUB_2W 3, 0, 1, 2, 7, 3406, 2276 ;t21a, t26a mova [rsp+gprsize*2+16*24], m3 ;t21a mova [rsp+gprsize*2+16*29], m0 ;t26a mova m2, [rsp+gprsize*2+16*26] ;in3 pxor m0, m0 mova m3, m0 pmulhrsw m1, m2, [o(pw_4052x8)] pmulhrsw m2, [o(pw_m601x8)] jmp .main2 ALIGN function_align .main_fast: ;bottom half is zero mova m0, [rsp+gprsize*2+16*19] ;in1 mova m1, [rsp+gprsize*2+16*20] ;in15 pmulhrsw m3, m0, [o(pw_4091x8)] ;t31a pmulhrsw m0, [o(pw_201x8)] ;t16a pmulhrsw m2, m1, [o(pw_3035x8)] ;t30a pmulhrsw m1, [o(pw_m2751x8)] ;t17a mova m7, [o(pd_2048)] psubsw m4, m0, m1 ;t17 paddsw m0, m1 ;t16 psubsw m5, m3, m2 ;t30 paddsw m3, m2 ;t31 ITX_MULSUB_2W 5, 4, 1, 2, 7, 799, 4017 ;t17a, t30a mova [rsp+gprsize*2+16*19], m0 ;t16 mova [rsp+gprsize*2+16*20], m5 ;t17a mova [rsp+gprsize*2+16*33], m4 ;t30a mova [rsp+gprsize*2+16*34], m3 ;t31 mova m0, [rsp+gprsize*2+16*21] ;in9 mova m1, [rsp+gprsize*2+16*22] ;in7 pmulhrsw m3, m0, [o(pw_3703x8)] pmulhrsw m0, [o(pw_1751x8)] pmulhrsw m2, m1, [o(pw_3857x8)] pmulhrsw m1, [o(pw_m1380x8)] psubsw m4, m1, m0 ;t18 paddsw m0, m1 ;t19 psubsw m5, m2, m3 ;t29 paddsw m3, m2 ;t28 ITX_MULSUB_2W 5, 4, 1, 2, 7, m4017, 799 ;t18a, t29a mova [rsp+gprsize*2+16*21], m5 ;t18a mova [rsp+gprsize*2+16*22], m0 ;t19 mova [rsp+gprsize*2+16*31], m3 ;t28 mova [rsp+gprsize*2+16*32], m4 ;t29a mova m0, [rsp+gprsize*2+16*23] ;in5 mova m1, [rsp+gprsize*2+16*24] ;in11 pmulhrsw m3, m0, [o(pw_3973x8)] pmulhrsw m0, [o(pw_995x8)] pmulhrsw m2, m1, [o(pw_3513x8)] pmulhrsw m1, [o(pw_m2106x8)] psubsw m4, m0, m1 ;t21 paddsw m0, m1 ;t20 psubsw m5, m3, m2 ;t26 paddsw m3, m2 ;t27 ITX_MULSUB_2W 5, 4, 1, 2, 7, 3406, 2276 ;t21a, t26a mova [rsp+gprsize*2+16*23], m0 ;t20 mova [rsp+gprsize*2+16*24], m5 ;t21a mova [rsp+gprsize*2+16*29], m4 ;t26a mova [rsp+gprsize*2+16*30], m3 ;t27 mova m0, [rsp+gprsize*2+16*25] ;in13 mova m2, [rsp+gprsize*2+16*26] ;in3 pmulhrsw m3, m0, [o(pw_3290x8)] pmulhrsw m0, [o(pw_2440x8)] pmulhrsw m1, m2, [o(pw_4052x8)] pmulhrsw m2, [o(pw_m601x8)] jmp .main2 ALIGN function_align .main: mova m7, [o(pd_2048)] mova m0, [rsp+gprsize*2+16*19] ;in1 mova m1, [rsp+gprsize*2+16*20] ;in15 mova m2, [rsp+gprsize*2+16*33] ;in17 mova m3, [rsp+gprsize*2+16*34] ;in31 ITX_MULSUB_2W 0, 3, 4, 5, 7, 201, 4091 ;t16a, t31a ITX_MULSUB_2W 2, 1, 4, 5, 7, 3035, 2751 ;t17a, t30a psubsw m4, m0, m2 ;t17 paddsw m0, m2 ;t16 psubsw m5, m3, m1 ;t30 paddsw m3, m1 ;t31 ITX_MULSUB_2W 5, 4, 1, 2, 7, 799, 4017 ;t17a, t30a mova [rsp+gprsize*2+16*19], m0 ;t16 mova [rsp+gprsize*2+16*20], m5 ;t17a mova [rsp+gprsize*2+16*33], m4 ;t30a mova [rsp+gprsize*2+16*34], m3 ;t31 mova m0, [rsp+gprsize*2+16*21] ;in9 mova m1, [rsp+gprsize*2+16*22] ;in7 mova m2, [rsp+gprsize*2+16*31] ;in25 mova m3, [rsp+gprsize*2+16*32] ;in23 ITX_MULSUB_2W 0, 3, 4, 5, 7, 1751, 3703 ;t18a, t29a ITX_MULSUB_2W 2, 1, 4, 5, 7, 3857, 1380 ;t19a, t28a psubsw m4, m2, m0 ;t18 paddsw m0, m2 ;t19 psubsw m5, m1, m3 ;t29 paddsw m3, m1 ;t28 ITX_MULSUB_2W 5, 4, 1, 2, 7, m4017, 799 ;t18a, t29a mova [rsp+gprsize*2+16*21], m5 ;t18a mova [rsp+gprsize*2+16*22], m0 ;t19 mova [rsp+gprsize*2+16*31], m3 ;t28 mova [rsp+gprsize*2+16*32], m4 ;t29a mova m0, [rsp+gprsize*2+16*23] ;in5 mova m1, [rsp+gprsize*2+16*24] ;in11 mova m2, [rsp+gprsize*2+16*29] ;in21 mova m3, [rsp+gprsize*2+16*30] ;in27 ITX_MULSUB_2W 0, 3, 4, 5, 7, 995, 3973 ;t20a, t27a ITX_MULSUB_2W 2, 1, 4, 5, 7, 3513, 2106 ;t21a, t26a psubsw m4, m0, m2 ;t21 paddsw m0, m2 ;t20 psubsw m5, m3, m1 ;t26 paddsw m3, m1 ;t27 ITX_MULSUB_2W 5, 4, 1, 2, 7, 3406, 2276 ;t21a, t26a mova [rsp+gprsize*2+16*23], m0 ;t20 mova [rsp+gprsize*2+16*24], m5 ;t21a mova [rsp+gprsize*2+16*29], m4 ;t26a mova [rsp+gprsize*2+16*30], m3 ;t27 mova m0, [rsp+gprsize*2+16*25] ;in13 mova m1, [rsp+gprsize*2+16*26] ;in3 mova m2, [rsp+gprsize*2+16*27] ;in29 mova m3, [rsp+gprsize*2+16*28] ;in19 ITX_MULSUB_2W 0, 3, 4, 5, 7, 2440, 3290 ;t22a, t25a ITX_MULSUB_2W 2, 1, 4, 5, 7, 4052, 601 ;t23a, t24a .main2: psubsw m4, m2, m0 ;t22 paddsw m0, m2 ;t23 psubsw m5, m1, m3 ;t25 paddsw m3, m1 ;t24 ITX_MULSUB_2W 5, 4, 1, 2, 7, m2276, 3406 ;t22a, t25a mova m2, [rsp+gprsize*2+16*24] ;t21a psubsw m1, m5, m2 ;t21 paddsw m5, m2 ;t22 mova [rsp+gprsize*2+16*25], m5 ;t22 mova m2, [rsp+gprsize*2+16*29] ;t26a psubsw m5, m4, m2 ;t26 paddsw m4, m2 ;t25 mova [rsp+gprsize*2+16*28], m4 ;t25 ITX_MULSUB_2W 5, 1, 2, 4, 7, m3784, 1567 ;t21a, t26a mova [rsp+gprsize*2+16*24], m5 ;t21a mova [rsp+gprsize*2+16*29], m1 ;t26a mova m1, [rsp+gprsize*2+16*23] ;t20 mova m5, [rsp+gprsize*2+16*30] ;t27 psubsw m2, m0, m1 ;t20a paddsw m0, m1 ;t23a psubsw m6, m3, m5 ;t27a paddsw m3, m5 ;t24a ITX_MULSUB_2W 6, 2, 1, 5, 7, m3784, 1567 ;t20, t27 mova [rsp+gprsize*2+16*26], m0 ;t23a mova [rsp+gprsize*2+16*27], m3 ;t24a mova [rsp+gprsize*2+16*30], m2 ;t27 mova m0, [rsp+gprsize*2+16*20] ;t17a mova m1, [rsp+gprsize*2+16*21] ;t18a mova m2, [rsp+gprsize*2+16*32] ;t29a mova m3, [rsp+gprsize*2+16*33] ;t30a psubsw m4, m0, m1 ;t18 paddsw m0, m1 ;t17 psubsw m5, m3, m2 ;t29 paddsw m3, m2 ;t30 ITX_MULSUB_2W 5, 4, 1, 2, 7, 1567, 3784 ;t18a, t29a mova [rsp+gprsize*2+16*20], m0 ;t17 mova [rsp+gprsize*2+16*21], m5 ;t18a mova [rsp+gprsize*2+16*32], m4 ;t29a mova [rsp+gprsize*2+16*33], m3 ;t30 mova m0, [rsp+gprsize*2+16*19] ;t16 mova m1, [rsp+gprsize*2+16*22] ;t19 mova m2, [rsp+gprsize*2+16*31] ;t28 mova m3, [rsp+gprsize*2+16*34] ;t31 psubsw m4, m0, m1 ;t19a paddsw m0, m1 ;t16a psubsw m5, m3, m2 ;t28a paddsw m3, m2 ;t31a ITX_MULSUB_2W 5, 4, 1, 2, 7, 1567, 3784 ;t19, t28 mova m2, [rsp+gprsize*2+16*15] ;tmp12 psubsw m1, m5, m6 ;t20a paddsw m5, m6 ;t19a psubsw m6, m2, m5 ;out19 paddsw m2, m5 ;out12 mova m5, [rsp+gprsize*2+16*30] ;t27 mova [rsp+gprsize*2+16*22], m6 ;out19 mova [rsp+gprsize*2+16*15], m2 ;out12 psubsw m6, m4, m5 ;t27a paddsw m4, m5 ;t28a ITX_MULSUB_2W 6, 1, 2, 5, 7, 2896, 2896 ;t20, t27 mova m2, [rsp+gprsize*2+16*6 ] ;tmp3 psubsw m5, m2, m4 ;out28 paddsw m2, m4 ;out3 mova m4, [rsp+gprsize*2+16*14] ;tmp11 mova [rsp+gprsize*2+16*31], m5 ;out28 mova [rsp+gprsize*2+16*6 ], m2 ;out3 psubsw m5, m4, m6 ;out20 paddsw m4, m6 ;out11 mova m2, [rsp+gprsize*2+16*7 ] ;tmp4 mova [rsp+gprsize*2+16*23], m5 ;out20 mova [rsp+gprsize*2+16*14], m4 ;out11 psubsw m5, m2, m1 ;out27 paddsw m2, m1 ;out4 mova m1, [rsp+gprsize*2+16*26] ;t23a mova m4, [rsp+gprsize*2+16*27] ;t24a mova [rsp+gprsize*2+16*30], m5 ;out27 mova [rsp+gprsize*2+16*7 ], m2 ;out4 psubsw m5, m0, m1 ;t23 paddsw m0, m1 ;t16 psubsw m2, m3, m4 ;t24 paddsw m3, m4 ;t31 ITX_MULSUB_2W 2, 5, 4, 6, 7, 2896, 2896 ;t23a, t24a mova m6, [rsp+gprsize*2+16*18] ;tmp15 psubsw m4, m6, m0 ;out16 paddsw m6, m0 ;out15 mova m0, [rsp+gprsize*2+16*3 ] ;tmp0 mova m1, [rsp+gprsize*2+16*11] ;tmp8 mova [rsp+gprsize*2+16*18], m6 ;out15 mova [rsp+gprsize*2+16*19], m4 ;out16 psubsw m6, m0, m3 ;out31 paddsw m0, m3 ;out0 psubsw m4, m1, m2 ;out23 paddsw m1, m2 ;out8 mova m3, [rsp+gprsize*2+16*10] ;tmp7 mova [rsp+gprsize*2+16*34], m6 ;out31 mova [rsp+gprsize*2+16*11], m1 ;out8 mova [rsp+gprsize*2+16*26], m4 ;out23 paddsw m6, m3, m5 ;out7 psubsw m3, m5 ;out24 mova m1, [rsp+gprsize*2+16*20] ;t17 mova m5, [rsp+gprsize*2+16*25] ;t22 mova m2, [rsp+gprsize*2+16*17] ;tmp14 mova [rsp+gprsize*2+16*27], m3 ;out24 psubsw m4, m1, m5 ;t22a paddsw m1, m5 ;t17a psubsw m3, m2, m1 ;out17 paddsw m2, m1 ;out14 mova m5, [rsp+gprsize*2+16*28] ;t25 mova m1, [rsp+gprsize*2+16*33] ;t30 mova [rsp+gprsize*2+16*17], m2 ;out14 mova [rsp+gprsize*2+16*20], m3 ;out17 psubsw m2, m1, m5 ;t25a paddsw m1, m5 ;t30a ITX_MULSUB_2W 2, 4, 3, 5, 7, 2896, 2896 ;t22, t25 mova m5, [rsp+gprsize*2+16*4 ] ;tmp1 psubsw m3, m5, m1 ;out30 paddsw m5, m1 ;out1 mova m1, [rsp+gprsize*2+16*12] ;tmp9 mova [rsp+gprsize*2+16*33], m3 ;out30 mova [rsp+gprsize*2+16*4 ], m5 ;out1 psubsw m3, m1, m2 ;out22 paddsw m1, m2 ;out9 mova m5, [rsp+gprsize*2+16*9 ] ;tmp6 mova [rsp+gprsize*2+16*25], m3 ;out22 mova [rsp+gprsize*2+16*12], m1 ;out9 psubsw m3, m5, m4 ;out25 paddsw m5, m4 ;out6 mova m4, [rsp+gprsize*2+16*21] ;t18a mova m1, [rsp+gprsize*2+16*24] ;t21a mova m2, [rsp+gprsize*2+16*16] ;tmp13 mova [rsp+gprsize*2+16*28], m3 ;out25 mova [rsp+gprsize*2+16*9 ], m5 ;out6 paddsw m3, m4, m1 ;t18 psubsw m4, m1 ;t21 psubsw m5, m2, m3 ;out18 paddsw m2, m3 ;out13 mova m1, [rsp+gprsize*2+16*29] ;t26a mova m3, [rsp+gprsize*2+16*32] ;t29a mova [rsp+gprsize*2+16*21], m5 ;out18 mova [rsp+gprsize*2+16*16], m2 ;out13 psubsw m5, m3, m1 ;t26 paddsw m3, m1 ;t29 ITX_MULSUB_2W 5, 4, 1, 2, 7, 2896, 2896 ;t21a, t26a mova m2, [rsp+gprsize*2+16*5 ] ;tmp2 psubsw m1, m2, m3 ;out29 paddsw m2, m3 ;out2 mova m3, [rsp+gprsize*2+16*13] ;tmp10 mova [rsp+gprsize*2+16*32], m1 ;out29 psubsw m7, m3, m5 ;out21 paddsw m3, m5 ;out10 mova m5, [rsp+gprsize*2+16*8 ] ;tmp5 mova [rsp+gprsize*2+16*24], m7 ;out21 mova [rsp+gprsize*2+16*13], m3 ;out10 psubsw m1, m5, m4 ;out26 paddsw m5, m4 ;out5 mova m7, m6 ;out7 mova m3, [rsp+gprsize*2+16*6 ] ;out3 mova m4, [rsp+gprsize*2+16*7 ] ;out4 mova [rsp+gprsize*2+16*29], m1 ;out26 mova m6, [rsp+gprsize*2+16*9 ] ;out6 mova m1, [rsp+gprsize*2+16*4 ] ;out1 ret cglobal inv_txfm_add_dct_dct_32x8, 4, 6, 8, 16*36, dst, stride, coeff, eob, tx2 %if ARCH_X86_32 LEA r5, $$ %endif test eobd, eobd jz .dconly call m(idct_32x8_internal) RET .dconly: movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_8192)] mov [coeffq], eobd mov r3d, 8 lea tx2q, [o(m(inv_txfm_add_dct_dct_32x8).end)] .body: pmulhrsw m0, m2 movd m2, [o(pw_2048)] ;intentionally rip-relative pmulhrsw m0, m1 pmulhrsw m0, m2 pshuflw m0, m0, q0000 punpcklwd m0, m0 pxor m5, m5 .loop: mova m1, [dstq+16*0] mova m3, [dstq+16*1] punpckhbw m2, m1, m5 punpcklbw m1, m5 punpckhbw m4, m3, m5 punpcklbw m3, m5 paddw m2, m0 paddw m1, m0 paddw m4, m0 paddw m3, m0 packuswb m1, m2 packuswb m3, m4 mova [dstq+16*0], m1 mova [dstq+16*1], m3 add dstq, strideq dec r3d jg .loop jmp tx2q .end: RET cglobal idct_32x8_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 %undef cmp LOAD_8ROWS coeffq+16*0, 64 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+16*2, 64 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 LOAD_8ROWS coeffq+16*1, 32 mova [rsp+gprsize+16*19], m0 ;in1 mova [rsp+gprsize+16*26], m1 ;in3 mova [rsp+gprsize+16*23], m2 ;in5 mova [rsp+gprsize+16*22], m3 ;in7 mova [rsp+gprsize+16*21], m4 ;in9 mova [rsp+gprsize+16*24], m5 ;in11 mova [rsp+gprsize+16*25], m6 ;in13 mova [rsp+gprsize+16*20], m7 ;in15 cmp eobd, 106 jg .full call m(idct_8x32_internal).main_fast jmp .pass2 .full: LOAD_8ROWS coeffq+16*17, 32 mova [rsp+gprsize+16*33], m0 ;in17 mova [rsp+gprsize+16*28], m1 ;in19 mova [rsp+gprsize+16*29], m2 ;in21 mova [rsp+gprsize+16*32], m3 ;in23 mova [rsp+gprsize+16*31], m4 ;in25 mova [rsp+gprsize+16*30], m5 ;in27 mova [rsp+gprsize+16*27], m6 ;in29 mova [rsp+gprsize+16*34], m7 ;in31 call m(idct_8x32_internal).main .pass2: mova [rsp+gprsize+16*0 ], m7 lea tx2q, [o(m(idct_32x8_internal).end)] jmp m(idct_8x32_internal).end1 .end: mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_32x8_internal).end1)] jmp m(idct_8x8_internal).pass1_end1 .end1: lea r3, [dstq+8] lea tx2q, [o(m(idct_32x8_internal).end2)] jmp m(idct_8x8_internal).pass2_main .end2: LOAD_8ROWS rsp+gprsize+16*11, 16 mova [rsp+gprsize+16*0 ], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_32x8_internal).end3)] jmp m(idct_8x8_internal).pass1_end1 .end3: mov dstq, r3 add r3, 8 lea tx2q, [o(m(idct_32x8_internal).end4)] jmp m(idct_8x8_internal).pass2_main .end4: LOAD_8ROWS rsp+gprsize+16*19, 16 mova [rsp+gprsize+16*0 ], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_32x8_internal).end5)] jmp m(idct_8x8_internal).pass1_end1 .end5: mov dstq, r3 add r3, 8 lea tx2q, [o(m(idct_32x8_internal).end6)] jmp m(idct_8x8_internal).pass2_main .end6: LOAD_8ROWS rsp+gprsize+16*27, 16 mova [rsp+gprsize+16*0 ], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_32x8_internal).end7)] jmp m(idct_8x8_internal).pass1_end1 .end7: mov dstq, r3 lea tx2q, [o(m(idct_32x8_internal).end8)] jmp m(idct_8x8_internal).pass2_main .end8: ret cglobal inv_txfm_add_identity_identity_8x32, 4, 6, 8, 16*4, dst, stride, coeff, eob, tx2 mov r5d, 4 mov tx2d, 2 cmp eobd, 107 cmovns tx2d, r5d mov r3d, tx2d %if ARCH_X86_32 LEA r5, $$ %endif lea tx2q, [o(m(idct_32x8_internal).end8)] .loop: LOAD_8ROWS coeffq+16*0, 64 paddsw m6, [o(pw_5)] mova [rsp+16*1], m6 mova m6, [o(pw_5)] REPX {paddsw x, m6}, m0, m1, m2, m3, m4, m5, m7 call m(idct_8x8_internal).pass1_end3 REPX {psraw x, 3 }, m0, m1, m2, m3, m4, m5, m6, m7 mova [rsp+16*2], m5 mova [rsp+16*1], m6 mova [rsp+16*0], m7 call m(idct_8x8_internal).end3 lea dstq, [dstq+strideq*2] pxor m7, m7 REPX {mova [coeffq+64*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7 add coeffq, 16 dec r3d jg .loop RET cglobal inv_txfm_add_identity_identity_32x8, 4, 6, 8, 16*4, dst, stride, coeff, eob, tx2 mov r5d, 4 mov tx2d, 2 cmp eobd, 107 cmovns tx2d, r5d mov r3d, tx2d %if ARCH_X86_32 LEA r5, $$ %endif .loop: LOAD_8ROWS coeffq+16*0, 16 pmulhrsw m6, [o(pw_4096)] mova [rsp+16*1], m6 mova m6, [o(pw_4096)] REPX {pmulhrsw x, m6}, m0, m1, m2, m3, m4, m5, m7 lea tx2q, [o(m(idct_32x8_internal).end8)] call m(idct_8x8_internal).pass1_end3 mov [rsp+16*3], dstq mova [rsp+16*2], m5 mova [rsp+16*1], m6 mova [rsp+16*0], m7 lea tx2q, [o(m(idct_8x8_internal).end4)] call m(idct_8x8_internal).end3 add coeffq, 16*8 mov dstq, [rsp+16*3] lea dstq, [dstq+8] dec r3d jg .loop jnc .loop RET cglobal inv_txfm_add_dct_dct_16x32, 4, 6, 8, 16*36, dst, stride, coeff, eob, tx2 %if ARCH_X86_32 LEA r5, $$ %endif test eobd, eobd jz .dconly call m(idct_16x32_internal) RET .dconly: movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_16384)] mov [coeffq], eobd pmulhrsw m0, m1 mov r2d, 16 lea tx2q, [o(m(inv_txfm_add_dct_dct_16x32).end)] jmp m(inv_txfm_add_dct_dct_16x4).dconly .end: RET cglobal idct_16x32_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 %undef cmp LOAD_8ROWS coeffq+16*1, 128, 1 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+16*5, 128, 1 call m(idct_16x8_internal).main lea tx2q, [o(m(idct_16x32_internal).pass1_end)] jmp m(idct_8x8_internal).pass1_end .pass1_end: SAVE_8ROWS coeffq+16*33, 64 ;in8~in15 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_16x32_internal).pass1_end1)] jmp m(idct_8x8_internal).pass1_end .pass1_end1: mova [coeffq+16*1 ], m0 ;in8 mova [coeffq+16*5 ], m4 ;in12 mova [rsp+gprsize+16*13], m2 ;in10 mova [rsp+gprsize+16*14], m6 ;in14 mova [rsp+gprsize+16*21], m1 ;in9 mova [rsp+gprsize+16*24], m3 ;in11 mova [rsp+gprsize+16*25], m5 ;in13 mova [rsp+gprsize+16*20], m7 ;in15 LOAD_8ROWS coeffq+16*0, 128, 1 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+16*4, 128, 1 call m(idct_16x8_internal).main lea tx2q, [o(m(idct_16x32_internal).pass1_end2)] jmp m(idct_8x8_internal).pass1_end .pass1_end2: SAVE_8ROWS coeffq+16*32, 64 ;in0~in7 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_16x32_internal).pass1_end3)] jmp m(idct_8x8_internal).pass1_end .pass1_end3: mova [rsp+gprsize+16*11], m2 ;in2 mova [rsp+gprsize+16*12], m6 ;in6 mova [rsp+gprsize+16*19], m1 ;in1 mova [rsp+gprsize+16*26], m3 ;in3 mova [rsp+gprsize+16*23], m5 ;in5 mova [rsp+gprsize+16*22], m7 ;in7 cmp eobd, 150 jg .full mova m1, m4 ;in4 mova m2, [coeffq+16*1 ] ;in8 mova m3, [coeffq+16*5 ] ;in12 pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 mova m0, [rsp+gprsize+16*11] ;in2 mova m1, [rsp+gprsize+16*12] ;in6 mova m2, [rsp+gprsize+16*13] ;in10 mova m3, [rsp+gprsize+16*14] ;in14 pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 call m(idct_8x32_internal).main_fast jmp .pass2 .full: mova [coeffq+16*0 ], m0 ;in0 mova [coeffq+16*4 ], m4 ;in4 LOAD_8ROWS coeffq+16*2, 128, 1 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+16*6, 128, 1 call m(idct_16x8_internal).main lea tx2q, [o(m(idct_16x32_internal).pass1_end4)] jmp m(idct_8x8_internal).pass1_end .pass1_end4: SAVE_8ROWS coeffq+16*34, 64 ;in16~in23 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_16x32_internal).pass1_end5)] jmp m(idct_8x8_internal).pass1_end .pass1_end5: mova [coeffq+16*2 ], m0 ;in16 mova [coeffq+16*6 ], m4 ;in20 mova [rsp+gprsize+16*15], m2 ;in18 mova [rsp+gprsize+16*16], m6 ;in22 mova [rsp+gprsize+16*33], m1 ;in17 mova [rsp+gprsize+16*28], m3 ;in19 mova [rsp+gprsize+16*29], m5 ;in21 mova [rsp+gprsize+16*32], m7 ;in23 LOAD_8ROWS coeffq+16*3, 128, 1 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+16*7, 128, 1 call m(idct_16x8_internal).main lea tx2q, [o(m(idct_16x32_internal).pass1_end6)] jmp m(idct_8x8_internal).pass1_end .pass1_end6: SAVE_8ROWS coeffq+16*35, 64 ;in24~in31 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_16x32_internal).pass1_end7)] jmp m(idct_8x8_internal).pass1_end .pass1_end7: mova [rsp+gprsize+16*17], m2 ;in26 mova [rsp+gprsize+16*18], m6 ;in30 mova [rsp+gprsize+16*31], m1 ;in25 mova [rsp+gprsize+16*30], m3 ;in27 mova [rsp+gprsize+16*27], m5 ;in29 mova [rsp+gprsize+16*34], m7 ;in31 mova m6, m0 ;in24 mova m7, m4 ;in28 mova m0, [coeffq+16*0 ] ;in0 mova m1, [coeffq+16*4 ] ;in4 mova m2, [coeffq+16*1 ] ;in8 mova m3, [coeffq+16*5 ] ;in12 mova m4, [coeffq+16*2 ] ;in16 mova m5, [coeffq+16*6 ] ;in20 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3 , 16 LOAD_8ROWS rsp+gprsize+16*11, 16 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 call m(idct_8x32_internal).main .pass2: mov [rsp+gprsize*1+16*35], eobd lea r3, [dstq+8] mov [rsp+gprsize*2+16*35], r3 lea r3, [o(m(idct_16x32_internal).end)] jmp m(idct_8x32_internal).end .end: mov dstq, [rsp+gprsize*2+16*35] mov eobd, [rsp+gprsize*1+16*35] add coeffq, 16*32 mova m0, [coeffq+16*4 ] ;in1 mova m1, [coeffq+16*12] ;in3 mova m2, [coeffq+16*20] ;in5 mova m3, [coeffq+16*28] ;in7 mova m4, [coeffq+16*5 ] ;in9 mova m5, [coeffq+16*13] ;in11 mova m6, [coeffq+16*21] ;in13 mova m7, [coeffq+16*29] ;in15 mova [rsp+gprsize+16*19], m0 ;in1 mova [rsp+gprsize+16*26], m1 ;in3 mova [rsp+gprsize+16*23], m2 ;in5 mova [rsp+gprsize+16*22], m3 ;in7 mova [rsp+gprsize+16*21], m4 ;in9 mova [rsp+gprsize+16*24], m5 ;in11 mova [rsp+gprsize+16*25], m6 ;in13 mova [rsp+gprsize+16*20], m7 ;in15 mova m0, [coeffq+16*0 ] ;in0 mova m1, [coeffq+16*16] ;in4 mova m2, [coeffq+16*1 ] ;in8 mova m3, [coeffq+16*17] ;in12 cmp eobd, 150 jg .full1 pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 mova m0, [coeffq+16*8 ] ;in2 mova m1, [coeffq+16*24] ;in6 mova m2, [coeffq+16*9 ] ;in10 mova m3, [coeffq+16*25] ;in14 pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 call m(idct_8x32_internal).main_fast jmp .end1 .full1: mova m4, [coeffq+16*2 ] ;in16 mova m5, [coeffq+16*18] ;in20 mova m6, [coeffq+16*3 ] ;in24 mova m7, [coeffq+16*19] ;in26 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 mova m0, [coeffq+16*8 ] ;in2 mova m1, [coeffq+16*24] ;in6 mova m2, [coeffq+16*9 ] ;in10 mova m3, [coeffq+16*25] ;in14 mova m4, [coeffq+16*10] ;in18 mova m5, [coeffq+16*26] ;in22 mova m6, [coeffq+16*11] ;in26 mova m7, [coeffq+16*27] ;in30 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 mova m0, [coeffq+16*6 ] ;in17 mova m1, [coeffq+16*14] ;in19 mova m2, [coeffq+16*22] ;in21 mova m3, [coeffq+16*30] ;in23 mova m4, [coeffq+16*7 ] ;in25 mova m5, [coeffq+16*15] ;in27 mova m6, [coeffq+16*23] ;in29 mova m7, [coeffq+16*31] ;in31 mova [rsp+gprsize+16*33], m0 ;in17 mova [rsp+gprsize+16*28], m1 ;in19 mova [rsp+gprsize+16*29], m2 ;in21 mova [rsp+gprsize+16*32], m3 ;in23 mova [rsp+gprsize+16*31], m4 ;in25 mova [rsp+gprsize+16*30], m5 ;in27 mova [rsp+gprsize+16*27], m6 ;in29 mova [rsp+gprsize+16*34], m7 ;in31 call m(idct_8x32_internal).main .end1: jmp m(idct_8x32_internal).pass2 cglobal inv_txfm_add_dct_dct_32x16, 4, 6, 8, 16*36, dst, stride, coeff, eob, tx2 %if ARCH_X86_32 LEA r5, $$ %endif test eobd, eobd jz .dconly call m(idct_32x16_internal) call m(idct_8x16_internal).pass2 add coeffq, 16*16 lea dstq, [r3+8] LOAD_8ROWS rsp+16*11, 16 mova [rsp+16*0], m7 lea tx2q, [o(m(idct_32x16_internal).end)] call m(idct_8x8_internal).pass1_end call m(idct_8x16_internal).pass2 add coeffq, 16*16 lea dstq, [r3+8] LOAD_8ROWS rsp+16*19, 16 mova [rsp+16*0], m7 lea tx2q, [o(m(idct_32x16_internal).end)] call m(idct_8x8_internal).pass1_end call m(idct_8x16_internal).pass2 add coeffq, 16*16 lea dstq, [r3+8] LOAD_8ROWS rsp+16*27, 16 mova [rsp+16*0], m7 lea tx2q, [o(m(idct_32x16_internal).end)] call m(idct_8x8_internal).pass1_end call m(idct_8x16_internal).pass2 RET .dconly: movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_16384)] mov [coeffq], eobd pmulhrsw m0, m1 mov r3d, 16 lea tx2q, [o(m(inv_txfm_add_dct_dct_32x8).end)] jmp m(inv_txfm_add_dct_dct_32x8).body cglobal idct_32x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 %undef cmp add coeffq, 16 lea r3, [o(m(idct_32x16_internal).pass1_end1)] .pass1: LOAD_8ROWS coeffq+16*0, 128, 1 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+16*4, 128, 1 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 LOAD_8ROWS coeffq+16*2, 64, 1 mova [rsp+gprsize+16*19], m0 ;in1 mova [rsp+gprsize+16*26], m1 ;in3 mova [rsp+gprsize+16*23], m2 ;in5 mova [rsp+gprsize+16*22], m3 ;in7 mova [rsp+gprsize+16*21], m4 ;in9 mova [rsp+gprsize+16*24], m5 ;in11 mova [rsp+gprsize+16*25], m6 ;in13 mova [rsp+gprsize+16*20], m7 ;in15 LOAD_8ROWS coeffq+16*34, 64, 1 mova [rsp+gprsize+16*33], m0 ;in17 mova [rsp+gprsize+16*28], m1 ;in19 mova [rsp+gprsize+16*29], m2 ;in21 mova [rsp+gprsize+16*32], m3 ;in23 mova [rsp+gprsize+16*31], m4 ;in25 mova [rsp+gprsize+16*30], m5 ;in27 mova [rsp+gprsize+16*27], m6 ;in29 mova [rsp+gprsize+16*34], m7 ;in31 call m(idct_8x32_internal).main .pass1_end: mova [rsp+gprsize+16*0 ], m7 mov tx2q, r3 jmp m(idct_8x8_internal).pass1_end .pass1_end1: SAVE_8ROWS coeffq+16*0, 32 LOAD_8ROWS rsp+gprsize+16*11, 16 mova [rsp+gprsize+16*0 ], m7 lea tx2q, [o(m(idct_32x16_internal).pass1_end2)] jmp m(idct_8x8_internal).pass1_end .pass1_end2: SAVE_8ROWS coeffq+16*16, 32 LOAD_8ROWS rsp+gprsize+16*19, 16 mova [rsp+gprsize+16*0 ], m7 lea tx2q, [o(m(idct_32x16_internal).pass1_end3)] jmp m(idct_8x8_internal).pass1_end .pass1_end3: SAVE_8ROWS coeffq+16*32, 32 LOAD_8ROWS rsp+gprsize+16*27, 16 mova [rsp+gprsize+16*0 ], m7 lea tx2q, [o(m(idct_32x16_internal).pass1_end4)] jmp m(idct_8x8_internal).pass1_end .pass1_end4: SAVE_8ROWS coeffq+16*48, 32 sub coeffq, 16 lea r3, [o(m(idct_32x16_internal).end)] jmp .pass1 .end: ret cglobal inv_txfm_add_identity_identity_16x32, 4, 6, 8, 16*4, dst, stride, coeff, eob, tx2 %undef cmp mov r4d, eobd cmp eobd, 43 ;if (eob > 43) sbb r3d, r3d ; iteration_count++ cmp r4d, 150 ;if (eob > 150) sbb r3d, 0 ; iteration_count++ cmp r4d, 278 ;if (eob > 278) sbb r3d, -4 ; iteration_count++ %if ARCH_X86_32 LEA r5, $$ %endif lea r4, [dstq+8] mov [rsp+16*3], r4 mov [rsp+gprsize+16*3], r3d mov [rsp+gprsize*2+16*3], coeffq .loop: LOAD_8ROWS coeffq, 64, 1 mova [rsp+16*1], m6 pxor m6, m6 REPX {mova [coeffq+64*x], m6}, 0, 1, 2, 3, 4, 5, 6, 7 lea tx2q, [o(m(idct_32x16_internal).end)] call m(idct_8x8_internal).pass1_end3 mova [rsp+16*0], m2 mova [rsp+16*1], m3 mova [rsp+16*2], m4 mova m3, [o(pw_1697x16)] mova m4, [o(pw_16384)] REPX {IDTX16 x, 2, 3, 4}, 5, 6, 7, 0, 1 mova m2, [o(pw_8192)] REPX {pmulhrsw x, m2}, m5, m6, m7, m0, m1 mova m2, [rsp+16*0] mova [rsp+16*0], m7 IDTX16 2, 7, 3, 4 mova m7, [rsp+16*2] mova [rsp+16*2], m5 IDTX16 7, 5, 3, 4 mova m5, [rsp+16*1] mova [rsp+16*1], m6 pmulhrsw m3, m5 pmulhrsw m3, m4 psrlw m4, 1 ; pw_8192 paddsw m3, m5 pmulhrsw m2, m4 pmulhrsw m3, m4 pmulhrsw m4, m7 call m(idct_8x8_internal).end3 lea dstq, [dstq+strideq*2] add coeffq, 16 dec r3d jg .loop mov coeffq, [rsp+gprsize*2+16*3] add coeffq, 64*8 mov r3d, [rsp+gprsize+16*3] xor dstq, dstq mov [rsp+gprsize+16*3], dstq mov dstq, [rsp+16*3] test r3d, r3d jnz .loop RET cglobal inv_txfm_add_identity_identity_32x16, 4, 6, 8, 16*4, dst, stride, coeff, eob, tx2 %undef cmp mov r4d, 12 ;0100b mov r5d, 136 ;1000 1000b cmp eobd, 44 ;if (eob > 43) cmovns r4d, r5d ; iteration_count+2 cmp eobd, 151 ;if (eob > 150) mov r3d, 34952 ;1000 1000 1000 1000b cmovs r3d, r4d ; iteration_count += 4 %if ARCH_X86_32 LEA r5, $$ %endif lea r4, [dstq+8] mov [rsp+16*3], r4 .loop: LOAD_8ROWS coeffq, 32, 1 REPX {paddsw x, x}, m0, m1, m2, m3, m4, m5, m6, m7 mova [rsp+16*1], m6 lea tx2q, [o(m(idct_32x16_internal).end)] call m(idct_8x8_internal).pass1_end3 mova [rsp+16*1], m5 mova [rsp+16*2], m6 mova m6, [o(pw_1697x16)] REPX {IDTX16 x, 5, 6}, 7, 0, 1, 2, 3, 4 pmulhrsw m7, [o(pw_2048)] mova m5, [rsp+16*1] mova [rsp+16*0], m7 IDTX16 5, 7, 6 mova m7, [rsp+16*2] IDTX16 7, 6, 6 mova m6, [o(pw_2048)] REPX {pmulhrsw x, m6}, m0, m1, m2, m3, m4, m5, m7 mova [rsp+16*2], m5 mova [rsp+16*1], m7 call m(idct_8x8_internal).end3 lea dstq, [dstq+strideq*2] pxor m7, m7 REPX {mova [coeffq+32*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7 .loop_end: add coeffq, 16 shr r3d, 2 jz .ret test r3d, 2 jnz .loop mov r4d, r3d and r4d, 1 lea coeffq, [coeffq+r4*8+32*7] mov dstq, [rsp+16*3] lea r4, [dstq+8] mov [rsp+16*3], r4 jmp .loop .ret: RET cglobal inv_txfm_add_dct_dct_32x32, 4, 6, 8, 16*36, dst, stride, coeff, eob, tx2 %if ARCH_X86_32 LEA r5, $$ %endif test eobd, eobd jz .dconly call m(idct_32x32_internal) RET .dconly: movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_8192)] mov [coeffq], eobd mov r3d, 32 lea tx2q, [o(m(inv_txfm_add_dct_dct_32x8).end)] jmp m(inv_txfm_add_dct_dct_32x8).body cglobal idct_32x32_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 %undef cmp mov r4d, 2 sub eobd, 136 mov [rsp+gprsize*1+16*35], eobd mov r3d, 4 cmovs r3d, r4d %if ARCH_X86_32 LEA r5, $$ %endif mov [rsp+gprsize*2+16*35], coeffq .pass1_loop: LOAD_8ROWS coeffq+64*1, 64*2 mova [rsp+gprsize+16*19], m0 ;in1 mova [rsp+gprsize+16*26], m1 ;in3 mova [rsp+gprsize+16*23], m2 ;in5 mova [rsp+gprsize+16*22], m3 ;in7 mova [rsp+gprsize+16*21], m4 ;in9 mova [rsp+gprsize+16*24], m5 ;in11 mova [rsp+gprsize+16*25], m6 ;in13 mova [rsp+gprsize+16*20], m7 ;in15 mov tx2d, [rsp+gprsize*1+16*35] test tx2d, tx2d jl .fast .full: LOAD_8ROWS coeffq+64*0, 64*4 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+64*2, 64*4 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 LOAD_8ROWS coeffq+64*17, 64*2 mova [rsp+gprsize+16*33], m0 ;in17 mova [rsp+gprsize+16*28], m1 ;in19 mova [rsp+gprsize+16*29], m2 ;in21 mova [rsp+gprsize+16*32], m3 ;in23 mova [rsp+gprsize+16*31], m4 ;in25 mova [rsp+gprsize+16*30], m5 ;in27 mova [rsp+gprsize+16*27], m6 ;in29 mova [rsp+gprsize+16*34], m7 ;in31 call m(idct_8x32_internal).main jmp .pass1_end .fast: mova m0, [coeffq+256*0] mova m1, [coeffq+256*1] mova m2, [coeffq+256*2] mova m3, [coeffq+256*3] pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 mova m0, [coeffq+128*1] mova m1, [coeffq+128*3] mova m2, [coeffq+128*5] mova m3, [coeffq+128*7] pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 call m(idct_8x32_internal).main_fast .pass1_end: mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_32x32_internal).pass1_end1)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end1: SAVE_8ROWS coeffq+64*0, 64 LOAD_8ROWS rsp+gprsize+16*11, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_32x32_internal).pass1_end2)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end2: SAVE_8ROWS coeffq+64*8, 64 LOAD_8ROWS rsp+gprsize+16*19, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_32x32_internal).pass1_end3)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end3: SAVE_8ROWS coeffq+64*16, 64 LOAD_8ROWS rsp+gprsize+16*27, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_32x32_internal).pass1_end4)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end4: SAVE_8ROWS coeffq+64*24, 64 add coeffq, 16 dec r3d jg .pass1_loop .pass2: mov coeffq, [rsp+gprsize*2+16*35] mov r3d, 4 lea tx2q, [o(m(idct_32x32_internal).pass2_end)] .pass2_loop: mov [rsp+gprsize*3+16*35], r3d lea r3, [dstq+8] mov [rsp+gprsize*2+16*35], r3 mova m0, [coeffq+16*4 ] mova m1, [coeffq+16*12] mova m2, [coeffq+16*20] mova m3, [coeffq+16*28] mova m4, [coeffq+16*5 ] mova m5, [coeffq+16*13] mova m6, [coeffq+16*21] mova m7, [coeffq+16*29] mova [rsp+gprsize+16*19], m0 ;in1 mova [rsp+gprsize+16*26], m1 ;in3 mova [rsp+gprsize+16*23], m2 ;in5 mova [rsp+gprsize+16*22], m3 ;in7 mova [rsp+gprsize+16*21], m4 ;in9 mova [rsp+gprsize+16*24], m5 ;in11 mova [rsp+gprsize+16*25], m6 ;in13 mova [rsp+gprsize+16*20], m7 ;in15 mov eobd, [rsp+gprsize*1+16*35] test eobd, eobd jl .fast1 .full1: mova m0, [coeffq+16*0 ] mova m1, [coeffq+16*16] mova m2, [coeffq+16*1 ] mova m3, [coeffq+16*17] mova m4, [coeffq+16*2 ] mova m5, [coeffq+16*18] mova m6, [coeffq+16*3 ] mova m7, [coeffq+16*19] call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 mova m0, [coeffq+16*8 ] mova m1, [coeffq+16*24] mova m2, [coeffq+16*9 ] mova m3, [coeffq+16*25] mova m4, [coeffq+16*10] mova m5, [coeffq+16*26] mova m6, [coeffq+16*11] mova m7, [coeffq+16*27] call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 mova m0, [coeffq+16*6 ] mova m1, [coeffq+16*14] mova m2, [coeffq+16*22] mova m3, [coeffq+16*30] mova m4, [coeffq+16*7 ] mova m5, [coeffq+16*15] mova m6, [coeffq+16*23] mova m7, [coeffq+16*31] mova [rsp+gprsize+16*33], m0 ;in17 mova [rsp+gprsize+16*28], m1 ;in19 mova [rsp+gprsize+16*29], m2 ;in21 mova [rsp+gprsize+16*32], m3 ;in23 mova [rsp+gprsize+16*31], m4 ;in25 mova [rsp+gprsize+16*30], m5 ;in27 mova [rsp+gprsize+16*27], m6 ;in29 mova [rsp+gprsize+16*34], m7 ;in31 call m(idct_8x32_internal).main jmp tx2q .fast1: mova m0, [coeffq+16*0 ] mova m1, [coeffq+16*16] mova m2, [coeffq+16*1 ] mova m3, [coeffq+16*17] pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 mova m0, [coeffq+16*8 ] mova m1, [coeffq+16*24] mova m2, [coeffq+16*9 ] mova m3, [coeffq+16*25] pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 call m(idct_8x32_internal).main_fast jmp tx2q .pass2_end: lea r3, [o(m(idct_32x32_internal).pass2_end1)] jmp m(idct_8x32_internal).end .pass2_end1: lea tx2q, [o(m(idct_32x32_internal).pass2_end)] add coeffq, 16*32 mov dstq, [rsp+gprsize*2+16*35] mov r3d, [rsp+gprsize*3+16*35] dec r3d jg .pass2_loop ret cglobal inv_txfm_add_identity_identity_32x32, 4, 6, 8, 16*5, dst, stride, coeff, eob, tx2 %undef cmp mov r4d, 2 cmp eobd, 136 mov r3d, 4 cmovs r3d, r4d %if ARCH_X86_32 LEA r5, $$ %endif lea r4, [dstq+8] mov [rsp+gprsize*0+16*3], r4 mov [rsp+gprsize*1+16*3], r3d mov [rsp+gprsize*2+16*3], r3d mov [rsp+gprsize*3+16*3], coeffq .loop: LOAD_8ROWS coeffq, 64 mova [rsp+16*1], m6 lea tx2q, [o(m(idct_32x16_internal).end)] call m(idct_8x8_internal).pass1_end3 pmulhrsw m7, [o(pw_8192)] mova [rsp+16*0], m7 mova m7, [o(pw_8192)] REPX {pmulhrsw x, m7}, m0, m1, m2, m3, m4, m5, m6 mova [rsp+16*1], m6 mova [rsp+16*2], m5 call m(idct_8x8_internal).end3 lea dstq, [dstq+strideq*2] pxor m7, m7 REPX {mova [coeffq+64*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7 add coeffq, 16 dec r3d jg .loop mov r4d, [rsp+gprsize*2+16*3] dec r4d jle .ret mov dstq, [rsp+gprsize*0+16*3] mov coeffq, [rsp+gprsize*3+16*3] mov [rsp+gprsize*2+16*3], r4 lea r3, [dstq+8] add coeffq, 64*8 mov [rsp+gprsize*0+16*3], r3 mov r3d, [rsp+gprsize*1+16*3] mov [rsp+gprsize*3+16*3], coeffq jmp .loop .ret: RET cglobal inv_txfm_add_dct_dct_16x64, 4, 6, 8, 16*68, dst, stride, coeff, eob, tx2 %if ARCH_X86_32 LEA r5, $$ %endif test eobd, eobd jz .dconly call m(idct_16x64_internal) RET .dconly: movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_8192)] mov [coeffq], eobd mov r2d, 32 lea tx2q, [o(m(inv_txfm_add_dct_dct_16x64).end)] jmp m(inv_txfm_add_dct_dct_16x4).dconly .end: RET cglobal idct_16x64_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 %undef cmp mov r4d, 2 sub eobd, 151 mov [rsp+gprsize*1+16*67], eobd mov r3d, 4 cmovs r3d, r4d %if ARCH_X86_32 LEA r5, $$ %endif mov [rsp+gprsize*2+16*67], coeffq .pass1_loop: LOAD_8ROWS coeffq+64*0, 64*2 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+64*1, 64*2 call m(idct_16x8_internal).main mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_16x64_internal).pass1_end)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end: SAVE_8ROWS coeffq+64*8, 64 LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_16x64_internal).pass1_end1)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end1: SAVE_8ROWS coeffq+64*0, 64 add coeffq, 16 dec r3d jg .pass1_loop mov coeffq, [rsp+gprsize*2+16*67] mov r3d, 2 lea r4, [dstq+8] mov [rsp+gprsize*2+16*67], r4 lea r4, [o(m(idct_16x64_internal).end1)] .pass2_loop: mov [rsp+gprsize*3+16*67], r3d mov eobd, [rsp+gprsize*1+16*67] mova m0, [coeffq+16*4 ] ;in1 mova m1, [coeffq+16*12] ;in3 mova m2, [coeffq+16*20] ;in5 mova m3, [coeffq+16*28] ;in7 mova m4, [coeffq+16*5 ] ;in9 mova m5, [coeffq+16*13] ;in11 mova m6, [coeffq+16*21] ;in13 mova m7, [coeffq+16*29] ;in15 mova [rsp+gprsize+16*35], m0 ;in1 mova [rsp+gprsize+16*49], m1 ;in3 mova [rsp+gprsize+16*43], m2 ;in5 mova [rsp+gprsize+16*41], m3 ;in7 mova [rsp+gprsize+16*39], m4 ;in9 mova [rsp+gprsize+16*45], m5 ;in11 mova [rsp+gprsize+16*47], m6 ;in13 mova [rsp+gprsize+16*37], m7 ;in15 pxor m4, m4 mova m0, [coeffq+16*0] mova m1, [coeffq+16*1] test eobd, eobd jl .fast .full: mova m2, [coeffq+16*2] mova m3, [coeffq+16*3] REPX {mova x, m4}, m5, m6, m7 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 pxor m4, m4 mova m0, [coeffq+16*16] mova m1, [coeffq+16*17] mova m2, [coeffq+16*18] mova m3, [coeffq+16*19] REPX {mova x, m4}, m5, m6, m7 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 mova m0, [coeffq+16*8 ] mova m1, [coeffq+16*24] mova m2, [coeffq+16*9 ] mova m3, [coeffq+16*25] mova m4, [coeffq+16*10] mova m5, [coeffq+16*26] mova m6, [coeffq+16*11] mova m7, [coeffq+16*27] mova [rsp+gprsize+16*19], m0 mova [rsp+gprsize+16*26], m1 mova [rsp+gprsize+16*23], m2 mova [rsp+gprsize+16*22], m3 mova [rsp+gprsize+16*21], m4 mova [rsp+gprsize+16*24], m5 mova [rsp+gprsize+16*25], m6 mova [rsp+gprsize+16*20], m7 call m(idct_8x32_internal).main_fast SAVE_8ROWS rsp+gprsize+16*3, 16 mova m0, [coeffq+16*6 ] ;in17 mova m1, [coeffq+16*14] ;in19 mova m2, [coeffq+16*22] ;in21 mova m3, [coeffq+16*30] ;in23 mova m4, [coeffq+16*7 ] ;in25 mova m5, [coeffq+16*15] ;in27 mova m6, [coeffq+16*23] ;in29 mova m7, [coeffq+16*31] ;in31 mova [rsp+gprsize+16*63], m0 ;in17 mova [rsp+gprsize+16*53], m1 ;in19 mova [rsp+gprsize+16*55], m2 ;in21 mova [rsp+gprsize+16*61], m3 ;in23 mova [rsp+gprsize+16*59], m4 ;in25 mova [rsp+gprsize+16*57], m5 ;in27 mova [rsp+gprsize+16*51], m6 ;in29 mova [rsp+gprsize+16*65], m7 ;in31 call .main jmp .end .fast: REPX {mova x, m4}, m2, m3, m5, m6, m7 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 pxor m4, m4 mova m0, [coeffq+16*16] mova m1, [coeffq+16*17] REPX {mova x, m4}, m2, m3, m5, m6, m7 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 mova m0, [coeffq+16*8 ] mova m1, [coeffq+16*24] mova m2, [coeffq+16*9 ] mova m3, [coeffq+16*25] mova [rsp+gprsize+16*19], m0 ;in1 mova [rsp+gprsize+16*26], m1 ;in3 mova [rsp+gprsize+16*23], m2 ;in5 mova [rsp+gprsize+16*22], m3 ;in7 call m(idct_8x32_internal).main_veryfast SAVE_8ROWS rsp+gprsize+16*3, 16 call .main_fast .end: LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 mov r3, r4 jmp m(idct_8x32_internal).end2 .end1: LOAD_8ROWS rsp+gprsize+16*35, 16 lea dstq, [dstq+strideq*2] add rsp, 16*32 lea r3, [o(m(idct_16x64_internal).end2)] jmp m(idct_8x32_internal).end .end2: add coeffq, 16*32 sub rsp, 16*32 mov dstq, [rsp+gprsize*2+16*67] mov r3d, [rsp+gprsize*3+16*67] lea r4, [dstq+8] mov [rsp+gprsize*2+16*67], r4 lea r4, [o(m(idct_16x64_internal).end1)] dec r3d jg .pass2_loop ret ALIGN function_align .main_fast: mova m0, [rsp+gprsize*2+16*35] ;in1 pmulhrsw m3, m0, [o(pw_4095x8)] ;t62,t63 pmulhrsw m0, [o(pw_101x8)] ;t32,t33 mova m7, [o(pd_2048)] mova [rsp+gprsize*2+16*35], m0 ;t32 mova [rsp+gprsize*2+16*66], m3 ;t63 ITX_MULSUB_2W 3, 0, 1, 2, 7, 401, 4076 ;t33a, t62a mova [rsp+gprsize*2+16*36], m3 ;t33a mova [rsp+gprsize*2+16*65], m0 ;t62a mova m1, [rsp+gprsize*2+16*37] ;in15 pmulhrsw m2, m1, [o(pw_3822x8)] ;t60,t61 pmulhrsw m1, [o(pw_m1474x8)] ;t34,t35 mova [rsp+gprsize*2+16*38], m1 ;t35 mova [rsp+gprsize*2+16*63], m2 ;t60 ITX_MULSUB_2W 2, 1, 0, 3, 7, m4076, 401 ;t34a, t61a mova [rsp+gprsize*2+16*37], m2 ;t34a mova [rsp+gprsize*2+16*64], m1 ;t61a mova m0, [rsp+gprsize*2+16*39] ;in9 pmulhrsw m3, m0, [o(pw_3996x8)] ;t58,t59 pmulhrsw m0, [o(pw_897x8)] ;t36,t37 mova [rsp+gprsize*2+16*39], m0 ;t36 mova [rsp+gprsize*2+16*62], m3 ;t59 ITX_MULSUB_2W 3, 0, 1, 2, 7, 3166, 2598 ;t37a, t58a mova [rsp+gprsize*2+16*40], m3 ;t37a mova [rsp+gprsize*2+16*61], m0 ;t58a mova m1, [rsp+gprsize*2+16*41] ;in7 pmulhrsw m2, m1, [o(pw_4036x8)] ;t56,t57 pmulhrsw m1, [o(pw_m700x8)] ;t38,t39 mova [rsp+gprsize*2+16*42], m1 ;t39 mova [rsp+gprsize*2+16*59], m2 ;t56 ITX_MULSUB_2W 2, 1, 0, 3, 7, m2598, 3166 ;t38a, t57a mova [rsp+gprsize*2+16*41], m2 ;t38a mova [rsp+gprsize*2+16*60], m1 ;t57a mova m0, [rsp+gprsize*2+16*43] ;in5 pmulhrsw m3, m0, [o(pw_4065x8)] ;t54,t55 pmulhrsw m0, [o(pw_501x8)] ;t40,t41 mova [rsp+gprsize*2+16*43], m0 ;t40 mova [rsp+gprsize*2+16*58], m3 ;t55 ITX_MULSUB_2W 3, 0, 1, 2, 7, 1931, 3612 ;t41a, t54a mova [rsp+gprsize*2+16*44], m3 ;t41a mova [rsp+gprsize*2+16*57], m0 ;t54a mova m1, [rsp+gprsize*2+16*45] ;in11 pmulhrsw m2, m1, [o(pw_3948x8)] ;t52,t53 pmulhrsw m1, [o(pw_m1092x8)] ;t42,t43 mova [rsp+gprsize*2+16*46], m1 ;t43 mova [rsp+gprsize*2+16*55], m2 ;t52 ITX_MULSUB_2W 2, 1, 0, 3, 7, m3612, 1931 ;t42a, t53a mova [rsp+gprsize*2+16*45], m2 ;t42a mova [rsp+gprsize*2+16*56], m1 ;t53a mova m0, [rsp+gprsize*2+16*47] ;in13 pmulhrsw m3, m0, [o(pw_3889x8)] ;t50,t51 pmulhrsw m0, [o(pw_1285x8)] ;t44,t45 mova m6, m0 mova [rsp+gprsize*2+16*54], m3 ;t51 ITX_MULSUB_2W 3, 0, 1, 2, 7, 3920, 1189 ;t45a, t50a mova [rsp+gprsize*2+16*48], m3 ;t45a mova [rsp+gprsize*2+16*53], m0 ;t50a mova m0, [rsp+gprsize*2+16*49] ;in3 pmulhrsw m3, m0, [o(pw_4085x8)] ;t48,t49 pmulhrsw m0, [o(pw_m301x8)] ;t46,t47 mova m4, m3 mova m5, m0 jmp .main2 ALIGN function_align .main: mova m0, [rsp+gprsize*2+16*35] ;in1 mova m1, [rsp+gprsize*2+16*65] ;in31 pmulhrsw m3, m0, [o(pw_4095x8)] ;t63a pmulhrsw m0, [o(pw_101x8)] ;t32a pmulhrsw m2, m1, [o(pw_2967x8)] ;t62a pmulhrsw m1, [o(pw_m2824x8)] ;t33a mova m7, [o(pd_2048)] psubsw m4, m0, m1 ;t33 paddsw m0, m1 ;t32 psubsw m5, m3, m2 ;t62 paddsw m3, m2 ;t63 ITX_MULSUB_2W 5, 4, 1, 2, 7, 401, 4076 ;t33a, t62a mova [rsp+gprsize*2+16*35], m0 ;t32 mova [rsp+gprsize*2+16*36], m5 ;t33a mova [rsp+gprsize*2+16*65], m4 ;t62a mova [rsp+gprsize*2+16*66], m3 ;t63 mova m0, [rsp+gprsize*2+16*63] ;in17 mova m1, [rsp+gprsize*2+16*37] ;in15 pmulhrsw m3, m0, [o(pw_3745x8)] ;t61a pmulhrsw m0, [o(pw_1660x8)] ;t34a pmulhrsw m2, m1, [o(pw_3822x8)] ;t60a pmulhrsw m1, [o(pw_m1474x8)] ;t35a psubsw m4, m1, m0 ;t34 paddsw m0, m1 ;t35 psubsw m5, m2, m3 ;t61 paddsw m3, m2 ;t60 ITX_MULSUB_2W 5, 4, 1, 2, 7, m4076, 401 ;t34a, t61a mova [rsp+gprsize*2+16*37], m5 ;t34a mova [rsp+gprsize*2+16*38], m0 ;t35 mova [rsp+gprsize*2+16*63], m3 ;t60 mova [rsp+gprsize*2+16*64], m4 ;t61a mova m0, [rsp+gprsize*2+16*39] ;in9 mova m1, [rsp+gprsize*2+16*61] ;in23 pmulhrsw m3, m0, [o(pw_3996x8)] ;t59a pmulhrsw m0, [o(pw_897x8)] ;t36a pmulhrsw m2, m1, [o(pw_3461x8)] ;t58a pmulhrsw m1, [o(pw_m2191x8)] ;t37a psubsw m4, m0, m1 ;t37 paddsw m0, m1 ;t36 psubsw m5, m3, m2 ;t58 paddsw m3, m2 ;t59 ITX_MULSUB_2W 5, 4, 1, 2, 7, 3166, 2598 ;t37a, t58a mova [rsp+gprsize*2+16*39], m0 ;t36 mova [rsp+gprsize*2+16*40], m5 ;t37a mova [rsp+gprsize*2+16*61], m4 ;t58a mova [rsp+gprsize*2+16*62], m3 ;t59 mova m0, [rsp+gprsize*2+16*59] ;in25 mova m1, [rsp+gprsize*2+16*41] ;in7 pmulhrsw m3, m0, [o(pw_3349x8)] ;t57a pmulhrsw m0, [o(pw_2359x8)] ;t38a pmulhrsw m2, m1, [o(pw_4036x8)] ;t56a pmulhrsw m1, [o(pw_m700x8)] ;t39a psubsw m4, m1, m0 ;t38 paddsw m0, m1 ;t39 psubsw m5, m2, m3 ;t57 paddsw m3, m2 ;t56 ITX_MULSUB_2W 5, 4, 1, 2, 7, m2598, 3166 ;t38a, t57a mova [rsp+gprsize*2+16*41], m5 ;t38a mova [rsp+gprsize*2+16*42], m0 ;t39 mova [rsp+gprsize*2+16*59], m3 ;t56 mova [rsp+gprsize*2+16*60], m4 ;t57a mova m0, [rsp+gprsize*2+16*43] ;in5 mova m1, [rsp+gprsize*2+16*57] ;in27 pmulhrsw m3, m0, [o(pw_4065x8)] ;t55a pmulhrsw m0, [o(pw_501x8)] ;t40a pmulhrsw m2, m1, [o(pw_3229x8)] ;t54a pmulhrsw m1, [o(pw_m2520x8)] ;t41a psubsw m4, m0, m1 ;t41 paddsw m0, m1 ;t40 psubsw m5, m3, m2 ;t54 paddsw m3, m2 ;t55 ITX_MULSUB_2W 5, 4, 1, 2, 7, 1931, 3612 ;t41a, t54a mova [rsp+gprsize*2+16*43], m0 ;t40 mova [rsp+gprsize*2+16*44], m5 ;t41a mova [rsp+gprsize*2+16*57], m4 ;t54a mova [rsp+gprsize*2+16*58], m3 ;t55 mova m0, [rsp+gprsize*2+16*55] ;in21 mova m1, [rsp+gprsize*2+16*45] ;in11 pmulhrsw m3, m0, [o(pw_3564x8)] ;t53a pmulhrsw m0, [o(pw_2019x8)] ;t42a pmulhrsw m2, m1, [o(pw_3948x8)] ;t52a pmulhrsw m1, [o(pw_m1092x8)] ;t43a psubsw m4, m1, m0 ;t42 paddsw m0, m1 ;t43 psubsw m5, m2, m3 ;t53 paddsw m3, m2 ;t52 ITX_MULSUB_2W 5, 4, 1, 2, 7, m3612, 1931 ;t42a, t53a mova [rsp+gprsize*2+16*45], m5 ;t42a mova [rsp+gprsize*2+16*46], m0 ;t43 mova [rsp+gprsize*2+16*55], m3 ;t52 mova [rsp+gprsize*2+16*56], m4 ;t53a mova m0, [rsp+gprsize*2+16*47] ;in13 mova m1, [rsp+gprsize*2+16*53] ;in19 pmulhrsw m3, m0, [o(pw_3889x8)] ;t51a pmulhrsw m0, [o(pw_1285x8)] ;t44a pmulhrsw m2, m1, [o(pw_3659x8)] ;t50a pmulhrsw m1, [o(pw_m1842x8)] ;t45a psubsw m4, m0, m1 ;t45 paddsw m0, m1 ;t44 psubsw m5, m3, m2 ;t50 paddsw m3, m2 ;t51 ITX_MULSUB_2W 5, 4, 1, 2, 7, 3920, 1189 ;t45a, t50a mova m6, m0 mova [rsp+gprsize*2+16*48], m5 ;t45a mova [rsp+gprsize*2+16*53], m4 ;t50a mova [rsp+gprsize*2+16*54], m3 ;t51 mova m0, [rsp+gprsize*2+16*51] ;in29 mova m1, [rsp+gprsize*2+16*49] ;in3 pmulhrsw m3, m0, [o(pw_3102x8)] ;t49a pmulhrsw m0, [o(pw_2675x8)] ;t46a pmulhrsw m2, m1, [o(pw_4085x8)] ;t48a pmulhrsw m1, [o(pw_m301x8)] ;t47a psubsw m5, m1, m0 ;t46 paddsw m0, m1 ;t47 psubsw m4, m2, m3 ;t49 paddsw m3, m2 ;t48 ALIGN function_align .main2: ITX_MULSUB_2W 4, 5, 1, 2, 7, m1189, 3920 ;t46a, t49a mova m1, [rsp+gprsize*2+16*54] ;t51 psubsw m2, m0, m6 ;t44a paddsw m0, m6 ;t47a psubsw m6, m3, m1 ;t51a paddsw m3, m1 ;t48a mova [rsp+gprsize*2+16*50], m0 ;t47a mova [rsp+gprsize*2+16*51], m3 ;t48a ITX_MULSUB_2W 6, 2, 0, 3, 7, m2276, 3406 ;t44, t51 mova [rsp+gprsize*2+16*47], m6 ;t44 mova [rsp+gprsize*2+16*54], m2 ;t51 mova m0, [rsp+gprsize*2+16*48] ;t45a mova m3, [rsp+gprsize*2+16*53] ;t50a psubsw m2, m4, m0 ;t45 paddsw m4, m0 ;t46 psubsw m6, m5, m3 ;t50 paddsw m5, m3 ;t49 ITX_MULSUB_2W 6, 2, 0, 3, 7, m2276, 3406 ;t45a, t50a mova [rsp+gprsize*2+16*48], m6 ;t45a mova [rsp+gprsize*2+16*49], m4 ;t46 mova [rsp+gprsize*2+16*52], m5 ;t49 mova [rsp+gprsize*2+16*53], m2 ;t50a mova m0, [rsp+gprsize*2+16*43] ;t40 mova m2, [rsp+gprsize*2+16*46] ;t43 mova m3, [rsp+gprsize*2+16*55] ;t52 mova m1, [rsp+gprsize*2+16*58] ;t55 psubsw m4, m0, m2 ;t43a paddsw m0, m2 ;t40a psubsw m5, m1, m3 ;t52a paddsw m1, m3 ;t55a ITX_MULSUB_2W 5, 4, 2, 3, 7, 3406, 2276 ;t43, t52 mova [rsp+gprsize*2+16*43], m0 ;t40a mova [rsp+gprsize*2+16*46], m5 ;t43 mova [rsp+gprsize*2+16*55], m4 ;t52 mova [rsp+gprsize*2+16*58], m1 ;t55a mova m0, [rsp+gprsize*2+16*44] ;t41a mova m2, [rsp+gprsize*2+16*45] ;t42a mova m3, [rsp+gprsize*2+16*56] ;t53a mova m1, [rsp+gprsize*2+16*57] ;t54a psubsw m4, m0, m2 ;t42 paddsw m0, m2 ;t41 psubsw m5, m1, m3 ;t53 paddsw m1, m3 ;t54 ITX_MULSUB_2W 5, 4, 2, 3, 7, 3406, 2276 ;t42a, t53a mova [rsp+gprsize*2+16*44], m0 ;t41 mova [rsp+gprsize*2+16*45], m5 ;t42a mova [rsp+gprsize*2+16*56], m4 ;t53a mova [rsp+gprsize*2+16*57], m1 ;t54 mova m0, [rsp+gprsize*2+16*41] ;t38a mova m2, [rsp+gprsize*2+16*40] ;t37a mova m3, [rsp+gprsize*2+16*61] ;t58a mova m1, [rsp+gprsize*2+16*60] ;t57a psubsw m4, m0, m2 ;t37 paddsw m0, m2 ;t38 psubsw m5, m1, m3 ;t58 paddsw m1, m3 ;t57 ITX_MULSUB_2W 5, 4, 2, 3, 7, m4017, 799 ;t37a, t58a mova [rsp+gprsize*2+16*41], m0 ;t38 mova [rsp+gprsize*2+16*40], m5 ;t37a mova [rsp+gprsize*2+16*61], m4 ;t58a mova [rsp+gprsize*2+16*60], m1 ;t57 mova m0, [rsp+gprsize*2+16*42] ;t39 mova m2, [rsp+gprsize*2+16*39] ;t36 mova m3, [rsp+gprsize*2+16*62] ;t59 mova m1, [rsp+gprsize*2+16*59] ;t56 psubsw m4, m0, m2 ;t36a paddsw m0, m2 ;t39a psubsw m5, m1, m3 ;t59a paddsw m1, m3 ;t56a ITX_MULSUB_2W 5, 4, 2, 3, 7, m4017, 799 ;t36, t59 mova [rsp+gprsize*2+16*42], m0 ;t39a mova [rsp+gprsize*2+16*39], m5 ;t36 mova [rsp+gprsize*2+16*62], m4 ;t59 mova [rsp+gprsize*2+16*59], m1 ;t56a mova m0, [rsp+gprsize*2+16*35] ;t32 mova m2, [rsp+gprsize*2+16*38] ;t35 mova m3, [rsp+gprsize*2+16*63] ;t60 mova m1, [rsp+gprsize*2+16*66] ;t63 psubsw m4, m0, m2 ;t35a paddsw m0, m2 ;t32a psubsw m5, m1, m3 ;t60a paddsw m1, m3 ;t63a ITX_MULSUB_2W 5, 4, 2, 3, 7, 799, 4017 ;t35, t60 mova [rsp+gprsize*2+16*35], m0 ;t32a mova [rsp+gprsize*2+16*38], m5 ;t35 mova [rsp+gprsize*2+16*63], m4 ;t60 mova [rsp+gprsize*2+16*66], m1 ;t63a mova m0, [rsp+gprsize*2+16*36] ;t33a mova m2, [rsp+gprsize*2+16*37] ;t34a mova m3, [rsp+gprsize*2+16*64] ;t61a mova m1, [rsp+gprsize*2+16*65] ;t62a psubsw m4, m0, m2 ;t34 paddsw m0, m2 ;t33 psubsw m5, m1, m3 ;t61 paddsw m1, m3 ;t62 ITX_MULSUB_2W 5, 4, 2, 3, 7, 799, 4017 ;t34a, t61a mova m2, [rsp+gprsize*2+16*41] ;t38 mova m3, [rsp+gprsize*2+16*60] ;t57 psubsw m6, m0, m2 ;t38a paddsw m0, m2 ;t33a psubsw m2, m1, m3 ;t57a paddsw m1, m3 ;t62a mova [rsp+gprsize*2+16*36], m0 ;t33a mova [rsp+gprsize*2+16*65], m1 ;t62a ITX_MULSUB_2W 2, 6, 0, 3, 7, 1567, 3784 ;t38, t57 mova [rsp+gprsize*2+16*41], m2 ;t38 mova [rsp+gprsize*2+16*60], m6 ;t57 mova m2, [rsp+gprsize*2+16*40] ;t37 mova m3, [rsp+gprsize*2+16*61] ;t58 psubsw m0, m5, m2 ;t37 paddsw m5, m2 ;t34 psubsw m1, m4, m3 ;t58 paddsw m4, m3 ;t61 ITX_MULSUB_2W 1, 0, 2, 3, 7, 1567, 3784 ;t37a, t58a mova [rsp+gprsize*2+16*37], m5 ;t34 mova [rsp+gprsize*2+16*64], m4 ;t61 mova [rsp+gprsize*2+16*40], m1 ;t37a mova [rsp+gprsize*2+16*61], m0 ;t58a mova m0, [rsp+gprsize*2+16*38] ;t35 mova m2, [rsp+gprsize*2+16*39] ;t36 mova m3, [rsp+gprsize*2+16*62] ;t59 mova m1, [rsp+gprsize*2+16*63] ;t60 psubsw m4, m0, m2 ;t36a paddsw m0, m2 ;t35a psubsw m5, m1, m3 ;t59a paddsw m1, m3 ;t60a ITX_MULSUB_2W 5, 4, 2, 3, 7, 1567, 3784 ;t36, t59 mova [rsp+gprsize*2+16*38], m0 ;t35a mova [rsp+gprsize*2+16*39], m5 ;t36 mova [rsp+gprsize*2+16*62], m4 ;t59 mova [rsp+gprsize*2+16*63], m1 ;t60a mova m0, [rsp+gprsize*2+16*35] ;t32a mova m2, [rsp+gprsize*2+16*42] ;t39a mova m3, [rsp+gprsize*2+16*59] ;t56a mova m1, [rsp+gprsize*2+16*66] ;t63a psubsw m4, m0, m2 ;t39 paddsw m0, m2 ;t32 psubsw m5, m1, m3 ;t56 paddsw m1, m3 ;t63 ITX_MULSUB_2W 5, 4, 2, 3, 7, 1567, 3784 ;t39a, t56a mova [rsp+gprsize*2+16*35], m0 ;t32 mova [rsp+gprsize*2+16*42], m5 ;t39a mova [rsp+gprsize*2+16*59], m4 ;t56a mova [rsp+gprsize*2+16*66], m1 ;t63 mova m0, [rsp+gprsize*2+16*50] ;t47a mova m2, [rsp+gprsize*2+16*43] ;t40a mova m3, [rsp+gprsize*2+16*58] ;t55a mova m1, [rsp+gprsize*2+16*51] ;t48a psubsw m4, m0, m2 ;t40 paddsw m0, m2 ;t47 psubsw m5, m1, m3 ;t55 paddsw m1, m3 ;t48 ITX_MULSUB_2W 5, 4, 2, 3, 7, m3784, 1567 ;t40a, t55a mova [rsp+gprsize*2+16*50], m0 ;t47 mova [rsp+gprsize*2+16*43], m5 ;t40a mova [rsp+gprsize*2+16*58], m4 ;t55a mova [rsp+gprsize*2+16*51], m1 ;t48 mova m0, [rsp+gprsize*2+16*49] ;t46 mova m2, [rsp+gprsize*2+16*44] ;t41 mova m3, [rsp+gprsize*2+16*57] ;t54 mova m1, [rsp+gprsize*2+16*52] ;t49 psubsw m4, m0, m2 ;t41a paddsw m0, m2 ;t46a psubsw m5, m1, m3 ;t54a paddsw m1, m3 ;t49a ITX_MULSUB_2W 5, 4, 2, 3, 7, m3784, 1567 ;t41, t54 mova [rsp+gprsize*2+16*49], m0 ;t46a mova [rsp+gprsize*2+16*44], m5 ;t41 mova [rsp+gprsize*2+16*57], m4 ;t54 mova [rsp+gprsize*2+16*52], m1 ;t49a mova m0, [rsp+gprsize*2+16*48] ;t45a mova m2, [rsp+gprsize*2+16*45] ;t42a mova m3, [rsp+gprsize*2+16*56] ;t53a mova m1, [rsp+gprsize*2+16*53] ;t50a psubsw m4, m0, m2 ;t42 paddsw m0, m2 ;t45 psubsw m5, m1, m3 ;t53 paddsw m1, m3 ;t50 ITX_MULSUB_2W 5, 4, 2, 3, 7, m3784, 1567 ;t42a, t53a mova [rsp+gprsize*2+16*48], m0 ;t45 mova [rsp+gprsize*2+16*45], m5 ;t42a mova [rsp+gprsize*2+16*56], m4 ;t53a mova [rsp+gprsize*2+16*53], m1 ;t50 mova m0, [rsp+gprsize*2+16*47] ;t44 mova m2, [rsp+gprsize*2+16*46] ;t43 mova m3, [rsp+gprsize*2+16*55] ;t52 mova m1, [rsp+gprsize*2+16*54] ;t51 psubsw m4, m0, m2 ;t43a paddsw m0, m2 ;t44a psubsw m5, m1, m3 ;t52a paddsw m1, m3 ;t51a ITX_MULSUB_2W 5, 4, 2, 3, 7, m3784, 1567 ;t43, t52 mova m2, [rsp+gprsize*2+16*38] ;t35a mova m3, [rsp+gprsize*2+16*31] ;tmp[28] psubsw m6, m2, m0 ;t44 paddsw m2, m0 ;t35 psubsw m0, m3, m2 ;out35 paddsw m2, m3 ;out28 mova m3, [rsp+gprsize*2+16*63] ;t60a mova [rsp+gprsize*2+16*38], m0 ;out35 mova [rsp+gprsize*2+16*31], m2 ;out28 psubsw m0, m3, m1 ;t51 paddsw m3, m1 ;t60 ITX_MULSUB_2W 0, 6, 1, 2, 7, 2896, 2896 ;t44a, t51a mova m2, [rsp+gprsize*2+16*6 ] ;tmp[3] psubsw m1, m2, m3 ;out60 paddsw m2, m3 ;out3 mova m3, [rsp+gprsize*2+16*22] ;tmp[19] mova [rsp+gprsize*2+16*63], m1 ;out60 mova [rsp+gprsize*2+16*6 ], m2 ;out3 psubsw m1, m3, m0 ;out44 paddsw m3, m0 ;out19 mova m2, [rsp+gprsize*2+16*15] ;tmp[12] mova m0, [rsp+gprsize*2+16*39] ;t36 mova [rsp+gprsize*2+16*47], m1 ;out44 mova [rsp+gprsize*2+16*22], m3 ;out19 mova m1, [rsp+gprsize*2+16*62] ;t59 psubsw m3, m2, m6 ;out51 paddsw m2, m6 ;out12 mova [rsp+gprsize*2+16*54], m3 ;out51 mova [rsp+gprsize*2+16*15], m2 ;out12 psubsw m2, m0, m5 ;t43a paddsw m0, m5 ;t36a mova m5, [rsp+gprsize*2+16*30] ;tmp[27] psubsw m3, m1, m4 ;t52a paddsw m1, m4 ;t59a ITX_MULSUB_2W 3, 2, 4, 6, 7, 2896, 2896 ;t43, t52 mova m4, [rsp+gprsize*2+16*7 ] ;tmp[4 ] psubsw m6, m5, m0 ;out36 paddsw m5, m0 ;out27 psubsw m0, m4, m1 ;out59 paddsw m4, m1 ;out4 mova [rsp+gprsize*2+16*39], m6 ;out36 mova [rsp+gprsize*2+16*30], m5 ;out27 mova [rsp+gprsize*2+16*62], m0 ;out59 mova [rsp+gprsize*2+16*7 ], m4 ;out4 mova m0, [rsp+gprsize*2+16*23] ;tmp[20] mova m5, [rsp+gprsize*2+16*14] ;tmp[11] psubsw m4, m0, m3 ;out43 paddsw m0, m3 ;out20 psubsw m6, m5, m2 ;out52 paddsw m5, m2 ;out11 mova [rsp+gprsize*2+16*46], m4 ;out43 mova [rsp+gprsize*2+16*23], m0 ;out20 mova [rsp+gprsize*2+16*55], m6 ;out52 mova [rsp+gprsize*2+16*14], m5 ;out11 mova m0, [rsp+gprsize*2+16*40] ;t37a mova m5, [rsp+gprsize*2+16*45] ;t42a mova m3, [rsp+gprsize*2+16*56] ;t53a mova m1, [rsp+gprsize*2+16*61] ;t58a mova m2, [rsp+gprsize*2+16*29] ;tmp[26] psubsw m4, m0, m5 ;t42 paddsw m0, m5 ;t37 psubsw m5, m1, m3 ;t53 paddsw m1, m3 ;t58 ITX_MULSUB_2W 5, 4, 3, 6, 7, 2896, 2896 ;t43, t52 mova m3, [rsp+gprsize*2+16*8 ] ;tmp[5 ] psubsw m6, m2, m0 ;out37 paddsw m2, m0 ;out26 psubsw m0, m3, m1 ;out58 paddsw m3, m1 ;out5 mova [rsp+gprsize*2+16*40], m6 ;out37 mova [rsp+gprsize*2+16*29], m2 ;out26 mova [rsp+gprsize*2+16*61], m0 ;out58 mova [rsp+gprsize*2+16*8 ], m3 ;out5 mova m0, [rsp+gprsize*2+16*24] ;tmp[21] mova m1, [rsp+gprsize*2+16*13] ;tmp[10] psubsw m2, m0, m5 ;out42 paddsw m0, m5 ;out21 psubsw m3, m1, m4 ;out53 paddsw m1, m4 ;out10 mova [rsp+gprsize*2+16*45], m2 ;out42 mova [rsp+gprsize*2+16*24], m0 ;out21 mova [rsp+gprsize*2+16*56], m3 ;out53 mova [rsp+gprsize*2+16*13], m1 ;out10 mova m0, [rsp+gprsize*2+16*41] ;t38 mova m5, [rsp+gprsize*2+16*44] ;t41 mova m3, [rsp+gprsize*2+16*57] ;t54 mova m1, [rsp+gprsize*2+16*60] ;t57 mova m2, [rsp+gprsize*2+16*28] ;tmp[25] psubsw m4, m0, m5 ;t41a paddsw m0, m5 ;t38a psubsw m5, m1, m3 ;t54a paddsw m1, m3 ;t57a ITX_MULSUB_2W 5, 4, 3, 6, 7, 2896, 2896 ;t41a, t54a mova m3, [rsp+gprsize*2+16*9 ] ;tmp[6 ] psubsw m6, m2, m0 ;out38 paddsw m2, m0 ;out25 psubsw m0, m3, m1 ;out57 paddsw m3, m1 ;out6 mova [rsp+gprsize*2+16*41], m6 ;out38 mova [rsp+gprsize*2+16*28], m2 ;out25 mova [rsp+gprsize*2+16*60], m0 ;out57 mova [rsp+gprsize*2+16*9 ], m3 ;out6 mova m0, [rsp+gprsize*2+16*25] ;tmp[22] mova m1, [rsp+gprsize*2+16*12] ;tmp[9 ] psubsw m2, m0, m5 ;out41 paddsw m0, m5 ;out22 psubsw m3, m1, m4 ;out54 paddsw m1, m4 ;out9 mova [rsp+gprsize*2+16*44], m2 ;out41 mova [rsp+gprsize*2+16*25], m0 ;out22 mova [rsp+gprsize*2+16*57], m3 ;out54 mova [rsp+gprsize*2+16*12], m1 ;out9 mova m0, [rsp+gprsize*2+16*42] ;t39a mova m5, [rsp+gprsize*2+16*43] ;t40a mova m3, [rsp+gprsize*2+16*58] ;t55a mova m1, [rsp+gprsize*2+16*59] ;t56a mova m2, [rsp+gprsize*2+16*27] ;tmp[24] psubsw m4, m0, m5 ;t40 paddsw m0, m5 ;t39 psubsw m5, m1, m3 ;t55 paddsw m1, m3 ;t56 ITX_MULSUB_2W 5, 4, 3, 6, 7, 2896, 2896 ;t40a, t55a mova m3, [rsp+gprsize*2+16*10] ;tmp[7 ] psubsw m6, m2, m0 ;out39 paddsw m2, m0 ;out24 psubsw m0, m3, m1 ;out56 paddsw m3, m1 ;out7 mova [rsp+gprsize*2+16*42], m6 ;out39 mova [rsp+gprsize*2+16*27], m2 ;out24 mova [rsp+gprsize*2+16*59], m0 ;out56 mova [rsp+gprsize*2+16*10], m3 ;out7 mova m0, [rsp+gprsize*2+16*26] ;tmp[23] mova m1, [rsp+gprsize*2+16*11] ;tmp[8 ] psubsw m2, m0, m5 ;out40 paddsw m0, m5 ;out23 psubsw m3, m1, m4 ;out55 paddsw m1, m4 ;out8 mova [rsp+gprsize*2+16*43], m2 ;out40 mova [rsp+gprsize*2+16*26], m0 ;out23 mova [rsp+gprsize*2+16*58], m3 ;out55 mova [rsp+gprsize*2+16*11], m1 ;out8 mova m0, [rsp+gprsize*2+16*37] ;t34 mova m5, [rsp+gprsize*2+16*48] ;t45 mova m3, [rsp+gprsize*2+16*53] ;t50 mova m1, [rsp+gprsize*2+16*64] ;t61 mova m2, [rsp+gprsize*2+16*32] ;tmp[29] psubsw m4, m0, m5 ;t45a paddsw m0, m5 ;t34a psubsw m5, m1, m3 ;t50a paddsw m1, m3 ;t61a ITX_MULSUB_2W 5, 4, 3, 6, 7, 2896, 2896 ;t45, t50 mova m3, [rsp+gprsize*2+16*5 ] ;tmp[2 ] psubsw m6, m2, m0 ;out34 paddsw m2, m0 ;out29 psubsw m0, m3, m1 ;out61 paddsw m3, m1 ;out2 mova [rsp+gprsize*2+16*37], m6 ;out34 mova [rsp+gprsize*2+16*32], m2 ;out29 mova [rsp+gprsize*2+16*64], m0 ;out61 mova [rsp+gprsize*2+16*5 ], m3 ;out2 mova m0, [rsp+gprsize*2+16*21] ;tmp[18] mova m1, [rsp+gprsize*2+16*16] ;tmp[13] psubsw m2, m0, m5 ;out45 paddsw m0, m5 ;out18 psubsw m3, m1, m4 ;out50 paddsw m1, m4 ;out13 mova [rsp+gprsize*2+16*48], m2 ;out45 mova [rsp+gprsize*2+16*21], m0 ;out18 mova [rsp+gprsize*2+16*53], m3 ;out50 mova [rsp+gprsize*2+16*16], m1 ;out13 mova m0, [rsp+gprsize*2+16*36] ;t33a mova m5, [rsp+gprsize*2+16*49] ;t46a mova m3, [rsp+gprsize*2+16*52] ;t49a mova m1, [rsp+gprsize*2+16*65] ;t62a mova m2, [rsp+gprsize*2+16*33] ;tmp[30] psubsw m4, m0, m5 ;t46 paddsw m0, m5 ;t33 psubsw m5, m1, m3 ;t49 paddsw m1, m3 ;t62 ITX_MULSUB_2W 5, 4, 3, 6, 7, 2896, 2896 ;t45, t50 mova m3, [rsp+gprsize*2+16*4 ] ;tmp[1 ] psubsw m6, m2, m0 ;out33 paddsw m2, m0 ;out30 psubsw m0, m3, m1 ;out62 paddsw m3, m1 ;out1 mova [rsp+gprsize*2+16*36], m6 ;out33 mova [rsp+gprsize*2+16*33], m2 ;out30 mova [rsp+gprsize*2+16*65], m0 ;out62 mova [rsp+gprsize*2+16*4 ], m3 ;out1 mova m0, [rsp+gprsize*2+16*20] ;tmp[17] mova m1, [rsp+gprsize*2+16*17] ;tmp[14] psubsw m2, m0, m5 ;out46 paddsw m0, m5 ;out17 psubsw m3, m1, m4 ;out49 paddsw m1, m4 ;out14 mova [rsp+gprsize*2+16*49], m2 ;out46 mova [rsp+gprsize*2+16*20], m0 ;out17 mova [rsp+gprsize*2+16*52], m3 ;out49 mova [rsp+gprsize*2+16*17], m1 ;out14 mova m0, [rsp+gprsize*2+16*35] ;t32 mova m5, [rsp+gprsize*2+16*50] ;t47 mova m3, [rsp+gprsize*2+16*51] ;t48 mova m1, [rsp+gprsize*2+16*66] ;t63 mova m2, [rsp+gprsize*2+16*34] ;tmp[31] psubsw m4, m0, m5 ;t47a paddsw m0, m5 ;t32a psubsw m5, m1, m3 ;t48a paddsw m1, m3 ;t63a ITX_MULSUB_2W 5, 4, 3, 6, 7, 2896, 2896 ;t47, t48 mova m3, [rsp+gprsize*2+16*3 ] ;tmp[0 ] psubsw m6, m2, m0 ;out32 paddsw m2, m0 ;out31 psubsw m0, m3, m1 ;out63 paddsw m3, m1 ;out0 mova [rsp+gprsize*2+16*35], m6 ;out32 mova [rsp+gprsize*2+16*34], m2 ;out31 mova [rsp+gprsize*2+16*66], m0 ;out63 mova [rsp+gprsize*2+16*3 ], m3 ;out0 mova m0, [rsp+gprsize*2+16*19] ;tmp[16] mova m1, [rsp+gprsize*2+16*18] ;tmp[15] psubsw m2, m0, m5 ;out47 paddsw m0, m5 ;out16 psubsw m3, m1, m4 ;out48 paddsw m1, m4 ;out15 mova [rsp+gprsize*2+16*50], m2 ;out47 mova [rsp+gprsize*2+16*19], m0 ;out16 mova [rsp+gprsize*2+16*51], m3 ;out48 mova [rsp+gprsize*2+16*18], m1 ;out15 ret cglobal inv_txfm_add_dct_dct_64x16, 4, 6, 8, 16*132, dst, stride, coeff, eob, tx2 %if ARCH_X86_32 LEA r5, $$ %endif test eobd, eobd jz .dconly call m(idct_64x16_internal) RET .dconly: movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_8192)] mov [coeffq], eobd mov r3d, 16 lea tx2q, [o(m(inv_txfm_add_dct_dct_64x16).end)] .body: pmulhrsw m0, m2 movd m2, [o(pw_2048)] ;intentionally rip-relative pmulhrsw m0, m1 pmulhrsw m0, m2 pshuflw m0, m0, q0000 punpcklwd m0, m0 pxor m7, m7 .loop: mova m1, [dstq+16*0] mova m3, [dstq+16*1] mova m5, [dstq+16*2] mova m6, [dstq+16*3] punpckhbw m2, m1, m7 punpcklbw m1, m7 punpckhbw m4, m3, m7 punpcklbw m3, m7 paddw m2, m0 paddw m1, m0 paddw m4, m0 paddw m3, m0 packuswb m1, m2 packuswb m3, m4 punpckhbw m2, m5, m7 punpcklbw m5, m7 punpckhbw m4, m6, m7 punpcklbw m6, m7 paddw m2, m0 paddw m5, m0 paddw m4, m0 paddw m6, m0 packuswb m5, m2 packuswb m6, m4 mova [dstq+16*0], m1 mova [dstq+16*1], m3 mova [dstq+16*2], m5 mova [dstq+16*3], m6 add dstq, strideq dec r3d jg .loop jmp tx2q .end: RET %macro LOAD_4ROWS 2-3 0 ;src, stride, is_rect2 %if %3 mova m3, [o(pw_2896x8)] pmulhrsw m0, m3, [%1+%2*0] pmulhrsw m1, m3, [%1+%2*1] pmulhrsw m2, m3, [%1+%2*2] pmulhrsw m3, [%1+%2*3] %else mova m0, [%1+%2*0] mova m1, [%1+%2*1] mova m2, [%1+%2*2] mova m3, [%1+%2*3] %endif %endmacro %macro LOAD_4ROWS_H 2 ;src, stride mova m4, [%1+%2*0] mova m5, [%1+%2*1] mova m6, [%1+%2*2] mova m7, [%1+%2*3] %endmacro cglobal idct_64x16_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 mov r3d, 2 mov [rsp+gprsize*2+16*67], dstq lea dstq, [rsp+gprsize+16*68] .pass1_loop: LOAD_4ROWS coeffq+32*0, 32*8 pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 pxor m4, m4 LOAD_4ROWS coeffq+32*4, 32*8 REPX {mova x, m4}, m5, m6, m7 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 LOAD_8ROWS coeffq+32*2, 32*4 mova [rsp+gprsize+16*19], m0 mova [rsp+gprsize+16*26], m1 mova [rsp+gprsize+16*23], m2 mova [rsp+gprsize+16*22], m3 mova [rsp+gprsize+16*21], m4 mova [rsp+gprsize+16*24], m5 mova [rsp+gprsize+16*25], m6 mova [rsp+gprsize+16*20], m7 call m(idct_8x32_internal).main_fast SAVE_8ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+32*1, 32*2 mova [rsp+gprsize+16*35], m0 ;in1 mova [rsp+gprsize+16*49], m1 ;in3 mova [rsp+gprsize+16*43], m2 ;in5 mova [rsp+gprsize+16*41], m3 ;in7 mova [rsp+gprsize+16*39], m4 ;in9 mova [rsp+gprsize+16*45], m5 ;in11 mova [rsp+gprsize+16*47], m6 ;in13 mova [rsp+gprsize+16*37], m7 ;in15 LOAD_8ROWS coeffq+32*17, 32*2 mova [rsp+gprsize+16*63], m0 ;in17 mova [rsp+gprsize+16*53], m1 ;in19 mova [rsp+gprsize+16*55], m2 ;in21 mova [rsp+gprsize+16*61], m3 ;in23 mova [rsp+gprsize+16*59], m4 ;in25 mova [rsp+gprsize+16*57], m5 ;in27 mova [rsp+gprsize+16*51], m6 ;in29 mova [rsp+gprsize+16*65], m7 ;in31 call m(idct_16x64_internal).main LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x16_internal).pass1_end)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end: SAVE_8ROWS coeffq+32*0, 32 LOAD_8ROWS rsp+gprsize+16*11, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x16_internal).pass1_end1)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end1: SAVE_8ROWS coeffq+32*8, 32 LOAD_8ROWS rsp+gprsize+16*19, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x16_internal).pass1_end2)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end2: SAVE_8ROWS coeffq+32*16, 32 LOAD_8ROWS rsp+gprsize+16*27, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x16_internal).pass1_end3)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end3: SAVE_8ROWS coeffq+32*24, 32 LOAD_8ROWS rsp+gprsize+16*35, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x16_internal).pass1_end4)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end4: SAVE_8ROWS dstq+32*0, 32 LOAD_8ROWS rsp+gprsize+16*43, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x16_internal).pass1_end5)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end5: SAVE_8ROWS dstq+32*8, 32 LOAD_8ROWS rsp+gprsize+16*51, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x16_internal).pass1_end6)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end6: SAVE_8ROWS dstq+32*16, 32 LOAD_8ROWS rsp+gprsize+16*59, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x16_internal).pass1_end7)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end7: SAVE_8ROWS dstq+32*24, 32 add coeffq, 16 add dstq, 16 dec r3d jg .pass1_loop .pass2: mov dstq, [rsp+gprsize*2+16*67] sub coeffq, 32 mov r3d, 4 .pass2_loop: mov [rsp+gprsize*1+16*67], r3d LOAD_4ROWS coeffq+16*0, 32*2 LOAD_4ROWS_H coeffq+16*1, 32*2 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_4ROWS coeffq+16*2, 32*2 LOAD_4ROWS_H coeffq+16*3, 32*2 call m(idct_16x8_internal).main mov r3, dstq lea tx2q, [o(m(idct_64x16_internal).end)] lea dstq, [dstq+strideq*8] jmp m(idct_8x8_internal).end .end: LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_64x16_internal).end1)] mov dstq, r3 jmp m(idct_8x8_internal).end .end1: pxor m7, m7 REPX {mova [coeffq+16*x], m7}, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 add coeffq, 16*16 mov r3d, [rsp+gprsize*1+16*67] mov dstq, [rsp+gprsize*2+16*67] add dstq, 8 mov [rsp+gprsize*2+16*67], dstq dec r3d jg .pass2_loop mov r3d, 4 lea coeffq, [rsp+gprsize+16*68] .pass2_loop2: mov [rsp+gprsize*1+16*67], r3d LOAD_4ROWS coeffq+16*0, 32*2 LOAD_4ROWS_H coeffq+16*1, 32*2 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_4ROWS coeffq+16*2, 32*2 LOAD_4ROWS_H coeffq+16*3, 32*2 call m(idct_16x8_internal).main mov r3, dstq lea tx2q, [o(m(idct_64x16_internal).end2)] lea dstq, [dstq+strideq*8] jmp m(idct_8x8_internal).end .end2: LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_64x16_internal).end3)] mov dstq, r3 jmp m(idct_8x8_internal).end .end3: add coeffq, 16*16 mov r3d, [rsp+gprsize*1+16*67] mov dstq, [rsp+gprsize*2+16*67] add dstq, 8 mov [rsp+gprsize*2+16*67], dstq dec r3d jg .pass2_loop2 ret cglobal inv_txfm_add_dct_dct_32x64, 4, 6, 8, 16*68, dst, stride, coeff, eob, tx2 %if ARCH_X86_32 LEA r5, $$ %endif test eobd, eobd jz .dconly call m(idct_32x64_internal) RET .dconly: movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_16384)] mov [coeffq], eobd pmulhrsw m0, m1 mov r3d, 64 lea tx2q, [o(m(inv_txfm_add_dct_dct_32x64).end)] jmp m(inv_txfm_add_dct_dct_32x8).body .end: RET cglobal idct_32x64_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 %undef cmp mov r4d, 2 sub eobd, 136 mov [rsp+gprsize*1+16*67], eobd mov r3d, 4 cmovs r3d, r4d %if ARCH_X86_32 LEA r5, $$ %endif mov [rsp+gprsize*2+16*67], coeffq .pass1_loop: LOAD_8ROWS coeffq+64*1, 64*2, 1 mova [rsp+gprsize+16*19], m0 ;in1 mova [rsp+gprsize+16*26], m1 ;in3 mova [rsp+gprsize+16*23], m2 ;in5 mova [rsp+gprsize+16*22], m3 ;in7 mova [rsp+gprsize+16*21], m4 ;in9 mova [rsp+gprsize+16*24], m5 ;in11 mova [rsp+gprsize+16*25], m6 ;in13 mova [rsp+gprsize+16*20], m7 ;in15 mov tx2d, [rsp+gprsize*1+16*67] test tx2d, tx2d jl .fast .full: LOAD_8ROWS coeffq+64*0, 64*4, 1 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+64*2, 64*4, 1 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 LOAD_8ROWS coeffq+64*17, 64*2, 1 mova [rsp+gprsize+16*33], m0 ;in17 mova [rsp+gprsize+16*28], m1 ;in19 mova [rsp+gprsize+16*29], m2 ;in21 mova [rsp+gprsize+16*32], m3 ;in23 mova [rsp+gprsize+16*31], m4 ;in25 mova [rsp+gprsize+16*30], m5 ;in27 mova [rsp+gprsize+16*27], m6 ;in29 mova [rsp+gprsize+16*34], m7 ;in31 call m(idct_8x32_internal).main jmp .pass1_end .fast: LOAD_4ROWS coeffq, 256, 1 pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 LOAD_4ROWS coeffq+128*1, 256, 1 pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 call m(idct_8x32_internal).main_fast .pass1_end: mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_32x64_internal).pass1_end1)] jmp m(idct_8x8_internal).pass1_end .pass1_end1: SAVE_8ROWS coeffq+64*0, 64 LOAD_8ROWS rsp+gprsize+16*11, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_32x64_internal).pass1_end2)] jmp m(idct_8x8_internal).pass1_end .pass1_end2: SAVE_8ROWS coeffq+64*8, 64 LOAD_8ROWS rsp+gprsize+16*19, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_32x64_internal).pass1_end3)] jmp m(idct_8x8_internal).pass1_end .pass1_end3: SAVE_8ROWS coeffq+64*16, 64 LOAD_8ROWS rsp+gprsize+16*27, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_32x64_internal).pass1_end4)] jmp m(idct_8x8_internal).pass1_end .pass1_end4: SAVE_8ROWS coeffq+64*24, 64 add coeffq, 16 dec r3d jg .pass1_loop .pass2: mov coeffq, [rsp+gprsize*2+16*67] mov r3d, 4 lea r4, [dstq+8] mov [rsp+gprsize*2+16*67], r4 lea r4, [o(m(idct_16x64_internal).end1)] jmp m(idct_16x64_internal).pass2_loop cglobal inv_txfm_add_dct_dct_64x32, 4, 6, 8, 16*197, dst, stride, coeff, eob, tx2 %if ARCH_X86_32 LEA r5, $$ %endif test eobd, eobd jz .dconly call m(idct_64x32_internal) RET .dconly: movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_16384)] pmulhrsw m0, m1 mov [coeffq], eobd mov r3d, 32 lea tx2q, [o(m(inv_txfm_add_dct_dct_64x32).end)] jmp m(inv_txfm_add_dct_dct_64x16).body .end: RET cglobal idct_64x32_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 %undef cmp mov r4d, 2 sub eobd, 136 mov [rsp+gprsize*1+16*67], eobd mov r3d, 4 cmovs r3d, r4d %if ARCH_X86_32 LEA r5, $$ %endif mov [rsp+gprsize*2+16*67], coeffq mov [rsp+gprsize*3+16*67], dstq lea dstq, [rsp+gprsize+16*69] mov [rsp+gprsize*4+16*67], dstq .pass1_loop: LOAD_4ROWS coeffq+64*0, 64*8, 1 pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 pxor m4, m4 LOAD_4ROWS coeffq+64*4, 64*8, 1 REPX {mova x, m4}, m5, m6, m7 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 LOAD_8ROWS coeffq+64*2, 64*4, 1 mova [rsp+gprsize+16*19], m0 mova [rsp+gprsize+16*26], m1 mova [rsp+gprsize+16*23], m2 mova [rsp+gprsize+16*22], m3 mova [rsp+gprsize+16*21], m4 mova [rsp+gprsize+16*24], m5 mova [rsp+gprsize+16*25], m6 mova [rsp+gprsize+16*20], m7 call m(idct_8x32_internal).main_fast SAVE_8ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+64*1, 64*2, 1 mova [rsp+gprsize+16*35], m0 ;in1 mova [rsp+gprsize+16*49], m1 ;in3 mova [rsp+gprsize+16*43], m2 ;in5 mova [rsp+gprsize+16*41], m3 ;in7 mova [rsp+gprsize+16*39], m4 ;in9 mova [rsp+gprsize+16*45], m5 ;in11 mova [rsp+gprsize+16*47], m6 ;in13 mova [rsp+gprsize+16*37], m7 ;in15 LOAD_8ROWS coeffq+64*17, 64*2, 1 mova [rsp+gprsize+16*63], m0 ;in17 mova [rsp+gprsize+16*53], m1 ;in19 mova [rsp+gprsize+16*55], m2 ;in21 mova [rsp+gprsize+16*61], m3 ;in23 mova [rsp+gprsize+16*59], m4 ;in25 mova [rsp+gprsize+16*57], m5 ;in27 mova [rsp+gprsize+16*51], m6 ;in29 mova [rsp+gprsize+16*65], m7 ;in31 call m(idct_16x64_internal).main LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_64x32_internal).pass1_end)] jmp m(idct_8x8_internal).pass1_end .pass1_end: SAVE_8ROWS coeffq+64*0, 64 LOAD_8ROWS rsp+gprsize+16*11, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_64x32_internal).pass1_end1)] jmp m(idct_8x8_internal).pass1_end .pass1_end1: SAVE_8ROWS coeffq+64*8, 64 LOAD_8ROWS rsp+gprsize+16*19, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_64x32_internal).pass1_end2)] jmp m(idct_8x8_internal).pass1_end .pass1_end2: SAVE_8ROWS coeffq+64*16, 64 LOAD_8ROWS rsp+gprsize+16*27, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_64x32_internal).pass1_end3)] jmp m(idct_8x8_internal).pass1_end .pass1_end3: SAVE_8ROWS coeffq+64*24, 64 LOAD_8ROWS rsp+gprsize+16*35, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_64x32_internal).pass1_end4)] jmp m(idct_8x8_internal).pass1_end .pass1_end4: SAVE_8ROWS dstq+64*0, 64 LOAD_8ROWS rsp+gprsize+16*43, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_64x32_internal).pass1_end5)] jmp m(idct_8x8_internal).pass1_end .pass1_end5: SAVE_8ROWS dstq+64*8, 64 LOAD_8ROWS rsp+gprsize+16*51, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_64x32_internal).pass1_end6)] jmp m(idct_8x8_internal).pass1_end .pass1_end6: SAVE_8ROWS dstq+64*16, 64 LOAD_8ROWS rsp+gprsize+16*59, 16 mova [rsp+gprsize+16*0], m7 lea tx2q, [o(m(idct_64x32_internal).pass1_end7)] jmp m(idct_8x8_internal).pass1_end .pass1_end7: SAVE_8ROWS dstq+64*24, 64 add coeffq, 16 add dstq, 16 dec r3d jg .pass1_loop .pass2: mov coeffq, [rsp+gprsize*4+16*67] mov dstq, [rsp+gprsize*3+16*67] mov eobd, [rsp+gprsize*1+16*67] lea dstq, [dstq+32] mov [rsp+gprsize*1+16*35], eobd lea tx2q, [o(m(idct_64x32_internal).pass2_end)] mov r3d, 4 jmp m(idct_32x32_internal).pass2_loop .pass2_end: mova [rsp+gprsize+16*0], m7 lea r3, [o(m(idct_64x32_internal).pass2_end1)] jmp m(idct_8x32_internal).end2 .pass2_end1: lea tx2q, [o(m(idct_64x32_internal).pass2_end)] add coeffq, 16*32 mov dstq, [rsp+gprsize*2+16*35] mov r3d, [rsp+gprsize*3+16*35] dec r3d jg m(idct_32x32_internal).pass2_loop .pass2_end2: mov dstq, [rsp+gprsize*3+16*67] mov coeffq, [rsp+gprsize*2+16*67] lea tx2q, [o(m(idct_32x32_internal).pass2_end)] mov r3d, 4 jmp m(idct_32x32_internal).pass2_loop cglobal inv_txfm_add_dct_dct_64x64, 4, 6, 8, 16*197, dst, stride, coeff, eob, tx2 %if ARCH_X86_32 LEA r5, $$ %endif test eobd, eobd jz .dconly call m(idct_64x64_internal) RET .dconly: movd m1, [o(pw_2896x8)] pmulhrsw m0, m1, [coeffq] movd m2, [o(pw_8192)] mov [coeffq], eobd mov r3d, 64 lea tx2q, [o(m(inv_txfm_add_dct_dct_64x32).end)] jmp m(inv_txfm_add_dct_dct_64x16).body cglobal idct_64x64_internal, 0, 0, 0, dst, stride, coeff, eob, tx2 %undef cmp mov r5d, 4 mov r4d, 2 sub eobd, 136 cmovns r4d, r5d %if ARCH_X86_32 LEA r5, $$ %endif mov [rsp+gprsize*1+16*67], eobd mov r3d, r4d mov [rsp+gprsize*4+16*67], coeffq mov [rsp+gprsize*3+16*67], dstq lea dstq, [rsp+gprsize+16*69] mov [rsp+gprsize*2+16*67], dstq .pass1_loop: LOAD_4ROWS coeffq+64*0, 64*8 pxor m4, m4 REPX {mova x, m4}, m5, m6, m7 call m(idct_8x8_internal).main SAVE_7ROWS rsp+gprsize+16*3, 16 pxor m4, m4 LOAD_4ROWS coeffq+64*4, 64*8 REPX {mova x, m4}, m5, m6, m7 call m(idct_16x8_internal).main mova m7, [rsp+gprsize+16*0] SAVE_8ROWS rsp+gprsize+16*11, 16 LOAD_8ROWS coeffq+64*2, 64*4 mova [rsp+gprsize+16*19], m0 mova [rsp+gprsize+16*26], m1 mova [rsp+gprsize+16*23], m2 mova [rsp+gprsize+16*22], m3 mova [rsp+gprsize+16*21], m4 mova [rsp+gprsize+16*24], m5 mova [rsp+gprsize+16*25], m6 mova [rsp+gprsize+16*20], m7 call m(idct_8x32_internal).main_fast SAVE_8ROWS rsp+gprsize+16*3, 16 LOAD_8ROWS coeffq+64*1, 64*2 mova [rsp+gprsize+16*35], m0 ;in1 mova [rsp+gprsize+16*49], m1 ;in3 mova [rsp+gprsize+16*43], m2 ;in5 mova [rsp+gprsize+16*41], m3 ;in7 mova [rsp+gprsize+16*39], m4 ;in9 mova [rsp+gprsize+16*45], m5 ;in11 mova [rsp+gprsize+16*47], m6 ;in13 mova [rsp+gprsize+16*37], m7 ;in15 LOAD_8ROWS coeffq+64*17, 64*2 mova [rsp+gprsize+16*63], m0 ;in17 mova [rsp+gprsize+16*53], m1 ;in19 mova [rsp+gprsize+16*55], m2 ;in21 mova [rsp+gprsize+16*61], m3 ;in23 mova [rsp+gprsize+16*59], m4 ;in25 mova [rsp+gprsize+16*57], m5 ;in27 mova [rsp+gprsize+16*51], m6 ;in29 mova [rsp+gprsize+16*65], m7 ;in31 call m(idct_16x64_internal).main LOAD_8ROWS rsp+gprsize+16*3, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x64_internal).pass1_end)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end: SAVE_8ROWS coeffq+64*0, 64 LOAD_8ROWS rsp+gprsize+16*11, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x64_internal).pass1_end1)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end1: SAVE_8ROWS coeffq+64*8, 64 LOAD_8ROWS rsp+gprsize+16*19, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x64_internal).pass1_end2)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end2: SAVE_8ROWS coeffq+64*16, 64 LOAD_8ROWS rsp+gprsize+16*27, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x64_internal).pass1_end3)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end3: SAVE_8ROWS coeffq+64*24, 64 LOAD_8ROWS rsp+gprsize+16*35, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x64_internal).pass1_end4)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end4: SAVE_8ROWS dstq+64*0, 64 LOAD_8ROWS rsp+gprsize+16*43, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x64_internal).pass1_end5)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end5: SAVE_8ROWS dstq+64*8, 64 LOAD_8ROWS rsp+gprsize+16*51, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x64_internal).pass1_end6)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end6: SAVE_8ROWS dstq+64*16, 64 LOAD_8ROWS rsp+gprsize+16*59, 16 mova [rsp+gprsize+16*0], m7 mova m7, [o(pw_8192)] lea tx2q, [o(m(idct_64x64_internal).pass1_end7)] jmp m(idct_8x8_internal).pass1_end1 .pass1_end7: SAVE_8ROWS dstq+64*24, 64 add coeffq, 16 add dstq, 16 dec r3d jg .pass1_loop .pass2: mov dstq, [rsp+gprsize*3+16*67] mov coeffq, [rsp+gprsize*2+16*67] lea dstq, [dstq+32] mov r3d, 4 lea r4, [dstq+8] mov [rsp+gprsize*2+16*67], r4 lea r4, [o(m(idct_64x64_internal).pass2_end)] jmp m(idct_16x64_internal).pass2_loop .pass2_end: LOAD_8ROWS rsp+gprsize+16*35, 16 lea dstq, [dstq+strideq*2] add rsp, 16*32 mova [rsp+gprsize+16*0], m7 lea r3, [o(m(idct_64x64_internal).pass2_end1)] jmp m(idct_8x32_internal).end2 .pass2_end1: add coeffq, 16*32 sub rsp, 16*32 mov dstq, [rsp+gprsize*2+16*67] mov r3d, [rsp+gprsize*3+16*67] lea r4, [dstq+8] mov [rsp+gprsize*2+16*67], r4 lea r4, [o(m(idct_64x64_internal).pass2_end)] dec r3d jg m(idct_16x64_internal).pass2_loop .pass2_end2: mov coeffq, [rsp+gprsize*4+16*67] mov dstq, [rsp+gprsize*2+16*67] mov r3d, 4 sub dstq, 72 lea r4, [dstq+8] mov [rsp+gprsize*2+16*67], r4 lea r4, [o(m(idct_16x64_internal).end1)] jmp m(idct_16x64_internal).pass2_loop
Src/redirector.ads
SMerrony/dashera
23
2251
-- Copyright (C)2021,2022 <NAME> -- 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. package Redirector is -- pragma Elaborate_Body; type Connection_T is (Local, Async, Network); type Handler_T is (Visual, Xmodem_Rx, Xmodem_Tx); task type Router_TT is Entry Set_Destination (Dest : in Connection_T); Entry Get_Destination (Dest : out Connection_T); Entry Send_Data (Data : in String); Entry Set_Handler (Handlr : in Handler_T); Entry Handle_Data (C : in Character); end Router_TT; type Router_Acc is access Router_TT; Router : Router_Acc; private Destination : Connection_T := Local; Handler : Handler_T := Visual; end Redirector;
programs/oeis/043/A043290.asm
karttu/loda
0
23444
; A043290: Maximal run length in base 16 representation of n. ; 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1 mod $0,17 mov $1,$0 div $1,16 add $1,1
src/main/fragment/mos6502-selfmod/_deref_(qbuz1_derefidx_vbuyy)=vbuaa.asm
jbrandwood/kickc
2
10902
pha lda ({z1}),y sta !+ +1 iny lda ({z1}),y sta !+ +2 pla !: sta $ffff
tests/snippets/numeric_addresses.asm
fredmorcos/hackism
1
87506
@123 @5566
src/Schedule.agda
peterthiemann/definitional-session
9
15578
<filename>src/Schedule.agda module Schedule where open import Data.Bool open import Data.Fin open import Data.Empty open import Data.List open import Data.List.All open import Data.Maybe open import Data.Nat open import Data.Product open import Data.Sum open import Data.Unit open import Function using (_$_) open import Relation.Nullary open import Relation.Binary.PropositionalEquality open import Typing open import Syntax open import Global open import Channel open import Values open import Session -- outcomes of step data Event : Set where Terminated Forked Restarted Halted New Closed NotClosed WaitSkipped : Event SendSkipped Received NotReceived : Event Stuck : Event Selected NotSelected : Event NSelected NotNSelected BranchSkipped NBranchSkipped : Event data NextPool : Set where _,_ : ∀ {G} → Event → ThreadPool G → NextPool module Alternative where step : ∀ {Gtop G1 G2} → SSplit Gtop G1 G2 → ThreadPool G1 → ThreadPool G2 → NextPool step ss-top (tnil ina) tp2@(tnil _) = Terminated , tp2 step ss-top (tnil ina) tp2 = Stuck , tp2 step ss-top (tcons ss (Fork{G₁ = G₁}{G₂ = G₂} ss₁ κ₁ κ₂) tp) tp2 with ssplit-compose ss ss₁ ... | Gi , ss₁₃ , ss₂₄ with ssplit-refl-right G₁ | ssplit-refl-right G₂ ... | Gunit , ss-G1GunitG1 | G2unit , ss-G2GuG2 = Forked , (tappend ss-top ((tcons ss₁₃ (apply-cont ss-G1GunitG1 κ₁ (VUnit (ssplit-inactive-right ss-G1GunitG1))) (tcons ss₂₄ (Ready ss-G2GuG2 (VUnit (ssplit-inactive-right ss-G2GuG2)) κ₂) tp))) tp2) step ss-top (tcons ss (Ready ss₁ v κ) tp) tp2 = Restarted , (tappend ss-top (tsnoc ss tp (apply-cont ss₁ κ v)) tp2) step ss-top (tcons ss (Halt inaG x₁ x₂) tp) tp2 rewrite inactive-left-ssplit ss inaG = Halted , (tappend ss-top tp tp2) step ss-top (tcons{G₁} ss (New s κ) tp) tp2 with ssplit-refl-right G₁ ... | Gi , ss-GiG1 with ssplit-inactive-right ss-GiG1 ... | ina-Gi = New , (tappend (ss-left ss-top) ((tcons (ss-left ss) (Ready (ss-left ss-GiG1) (VPair (ss-posneg (inactive-ssplit-trivial ina-Gi)) (VChan POS (here-pos ina-Gi (subF-refl _))) (VChan NEG (here-neg ina-Gi (subF-refl _)))) (lift-cont κ)) (lift-threadpool tp))) (lift-threadpool tp2)) step ss-top (tcons{G₁}{G₂} ss cmd@(Close ss-vκ v κ) tp) tp2 with ssplit-compose ss-top ss ... | Gi , ss-top1 , ss-top2 with ssplit-refl-left-inactive Gi ... | G' , ina-G' , ss-GG' with matchWaitAndGo ss-top1 (ss-vκ , v , κ) ss-GG' (tappend ss-top2 tp tp2) (tnil ina-G') ... | just (Gnext , tpnext) = Closed , tpnext ... | nothing with ssplit-compose5 ss-top ss ... | Gi' , ss-top1' , ss-top2' = step ss-top1' tp (tsnoc ss-top2' tp2 cmd) step ss-top (tcons ss cmd@(Wait ss₁ v κ) tp) tp2 with ssplit-compose5 ss-top ss ... | Gi , ss-top1 , ss-top2 = step ss-top1 tp (tsnoc ss-top2 tp2 cmd) step ss-top (tcons ss cmd@(Send ss₁ ss-args vch v κ) tp) tp2 with ssplit-compose5 ss-top ss ... | Gi , ss-top1 , ss-top2 = step ss-top1 tp (tsnoc ss-top2 tp2 cmd) step ss-top (tcons{G₁}{G₂} ss cmd@(Recv ss-vκ vch κ) tp) tp2 with ssplit-compose ss-top ss ... | Gi , ss-top1 , ss-top2 with ssplit-refl-left-inactive Gi ... | G' , ina-G' , ss-GG' with matchSendAndGo ss-top1 (ss-vκ , vch , κ) ss-GG' (tappend ss-top2 tp tp2) (tnil ina-G') ... | just (G-next , tp-next) = Received , tp-next ... | nothing with ssplit-compose5 ss-top ss ... | Gi' , ss-top1' , ss-top2' = step ss-top1' tp (tsnoc ss-top2' tp2 cmd) step ss-top (tcons{G₁}{G₂} ss cmd@(Select ss-vκ lab vch κ) tp) tp2 with ssplit-compose ss-top ss ... | Gi , ss-top1 , ss-top2 with ssplit-refl-left-inactive Gi ... | G' , ina-G' , ss-GG' with matchBranchAndGo ss-top1 (ss-vκ , lab , vch , κ) ss-GG' (tappend ss-top2 tp tp2) (tnil ina-G') ... | just (G-next , tp-next) = Selected , tp-next ... | nothing with ssplit-compose5 ss-top ss ... | Gi' , ss-top1' , ss-top2' = step ss-top1' tp (tsnoc ss-top2' tp2 cmd) step ss-top (tcons ss cmd@(Branch ss₁ vch dcont) tp) tp2 with ssplit-compose5 ss-top ss ... | Gi , ss-top1 , ss-top2 = step ss-top1 tp (tsnoc ss-top2 tp2 cmd) step ss-top (tcons{G₁}{G₂} ss cmd@(NSelect ss-vκ lab vch κ) tp) tp2 with ssplit-compose ss-top ss ... | Gi , ss-top1 , ss-top2 with ssplit-refl-left-inactive Gi ... | G' , ina-G' , ss-GG' with matchNBranchAndGo ss-top1 (ss-vκ , lab , vch , κ) ss-GG' (tappend ss-top2 tp tp2) (tnil ina-G') ... | just (G-next , tp-next) = NSelected , tp-next ... | nothing with ssplit-compose5 ss-top ss ... | Gi' , ss-top1' , ss-top2' = step ss-top1' tp (tsnoc ss-top2' tp2 cmd) step ss-top (tcons ss cmd@(NBranch ss₁ vch dcont) tp) tp2 with ssplit-compose5 ss-top ss ... | Gi , ss-top1 , ss-top2 = step ss-top1 tp (tsnoc ss-top2 tp2 cmd) module Original where step : ∀ {G} → ThreadPool G → NextPool step (tnil ina) = Terminated , tnil ina step (tcons ss (Fork{G₁ = G₁}{G₂ = G₂} ss₁ κ₁ κ₂) tp) with ssplit-compose ss ss₁ ... | Gi , ss₁₃ , ss₂₄ with ssplit-refl-right G₁ | ssplit-refl-right G₂ ... | Gunit , ss-G1GunitG1 | G2unit , ss-G2GuG2 = Forked , (tcons ss₁₃ (apply-cont ss-G1GunitG1 κ₁ (VUnit (ssplit-inactive-right ss-G1GunitG1))) (tcons ss₂₄ (apply-cont ss-G2GuG2 κ₂ (VUnit (ssplit-inactive-right ss-G2GuG2))) tp)) step (tcons ss (Ready ss₁ v κ) tp) = Restarted , (tsnoc ss tp (apply-cont ss₁ κ v)) step (tcons ss (Halt inaG x₁ x₂) tp) rewrite inactive-left-ssplit ss inaG = Halted , tp step (tcons{G₁} ss (New s κ) tp) with ssplit-refl-right G₁ ... | Gi , ss-GiG1 with ssplit-inactive-right ss-GiG1 ... | ina-Gi = New , (tcons (ss-left ss) (apply-cont (ss-left ss-GiG1) (lift-cont κ) (VPair (ss-posneg (inactive-ssplit-trivial ina-Gi)) (VChan POS (here-pos ina-Gi (subF-refl _))) (VChan NEG (here-neg ina-Gi (subF-refl _))))) (lift-threadpool tp)) step (tcons{G₁}{G₂} ss cmd@(Close ss-vκ v κ) tp) with ssplit-refl-left-inactive G₂ ... | G' , ina-G' , ss-GG' with matchWaitAndGo ss (ss-vκ , v , κ) ss-GG' tp (tnil ina-G') ... | just (Gnext , tpnext) = Closed , tpnext ... | nothing = NotClosed , (tsnoc ss tp cmd) step (tcons ss cmd@(Wait ss₁ v κ) tp) = WaitSkipped , (tsnoc ss tp cmd) step (tcons ss cmd@(Send ss₁ ss-args vch v κ) tp) = SendSkipped , (tsnoc ss tp cmd) step (tcons{G₁}{G₂} ss cmd@(Recv ss-vκ vch κ) tp) with ssplit-refl-left-inactive G₂ ... | G' , ina-G' , ss-GG' with matchSendAndGo ss (ss-vκ , vch , κ) ss-GG' tp (tnil ina-G') ... | just (G-next , tp-next) = Received , tp-next ... | nothing = NotReceived , (tsnoc ss tp cmd) step (tcons{G₁}{G₂} ss cmd@(Select ss-vκ lab vch κ) tp) with ssplit-refl-left-inactive G₂ ... | G' , ina-G' , ss-GG' with matchBranchAndGo ss (ss-vκ , lab , vch , κ) ss-GG' tp (tnil ina-G') ... | just (G-next , tp-next) = Selected , tp-next ... | nothing = NotSelected , (tsnoc ss tp cmd) step (tcons ss cmd@(Branch ss-vκ vch dcont) tp) = BranchSkipped , (tsnoc ss tp cmd) step (tcons{G₁}{G₂} ss cmd@(NSelect ss-vκ lab vch κ) tp) with ssplit-refl-left-inactive G₂ ... | G' , ina-G' , ss-GG' with matchNBranchAndGo ss (ss-vκ , lab , vch , κ) ss-GG' tp (tnil ina-G') ... | just (G-next , tp-next) = NSelected , tp-next ... | nothing = NotNSelected , (tsnoc ss tp cmd) step (tcons ss cmd@(NBranch ss-vκ vch dcont) tp) = NBranchSkipped , (tsnoc ss tp cmd) open Alternative single-step : (∃ λ G → ThreadPool G) → Event × (∃ λ G → ThreadPool G) single-step (G , tp) with ssplit-refl-left-inactive G ... | G' , ina-G' , ss-GG' with step ss-GG' tp (tnil ina-G') ... | ev , tp' = ev , ( _ , tp') -- stuff to run ... data Gas : Set where Empty : Gas More : Gas → Gas -- outcomes of scheduling data Outcome : Set where Terminated : Outcome _,_ : Event → Outcome → Outcome OutOfGas : ∀ {G} → ThreadPool G → Outcome -- thread scheduling schedule : {G : SCtx} → Gas → ThreadPool G → Outcome schedule Empty tp = OutOfGas tp schedule{G} (More gas) tp with single-step (_ , tp) ... | Terminated , _ , tp' = Terminated ... | ev , _ , tp' = ev , (schedule gas tp') -- start main thread start : Gas → Expr [] TUnit → Outcome start f e = schedule f (tcons ss-[] (run [] ss-[] e (vnil []-inactive) (halt []-inactive UUnit)) (tnil []-inactive))
generated/natools-static_maps-web-sites-commands.adb
faelys/natools-web
1
4691
<gh_stars>1-10 with Interfaces; use Interfaces; package body Natools.Static_Maps.Web.Sites.Commands is P : constant array (0 .. 3) of Natural := (1, 8, 12, 14); T1 : constant array (0 .. 3) of Unsigned_8 := (10, 1, 30, 27); T2 : constant array (0 .. 3) of Unsigned_8 := (17, 10, 22, 38); G : constant array (0 .. 39) of Unsigned_8 := (0, 12, 0, 8, 16, 0, 13, 0, 0, 0, 0, 0, 0, 17, 15, 0, 2, 0, 0, 0, 11, 4, 14, 0, 12, 0, 3, 0, 0, 1, 13, 0, 16, 0, 6, 1, 0, 0, 13, 0); function Hash (S : String) return Natural is F : constant Natural := S'First - 1; L : constant Natural := S'Length; F1, F2 : Natural := 0; J : Natural; begin for K in P'Range loop exit when L < P (K); J := Character'Pos (S (P (K) + F)); F1 := (F1 + Natural (T1 (K)) * J) mod 40; F2 := (F2 + Natural (T2 (K)) * J) mod 40; end loop; return (Natural (G (F1)) + Natural (G (F2))) mod 19; end Hash; end Natools.Static_Maps.Web.Sites.Commands;
P6/P6Judger - 100 testpoints/testpoint/testpoint61.asm
flyinglandlord/BUAA-CO-2021
5
100375
ori $1, $0, 0 ori $2, $0, 15 ori $3, $0, 10 ori $4, $0, 0 sw $3, 0($0) sw $2, 4($0) sw $2, 8($0) sw $2, 12($0) sw $3, 16($0) sw $1, 20($0) sw $3, 24($0) sw $2, 28($0) sw $4, 32($0) sw $1, 36($0) sw $3, 40($0) sw $1, 44($0) sw $2, 48($0) sw $4, 52($0) sw $4, 56($0) sw $3, 60($0) sw $1, 64($0) sw $3, 68($0) sw $3, 72($0) sw $3, 76($0) sw $1, 80($0) sw $2, 84($0) sw $1, 88($0) sw $2, 92($0) sw $4, 96($0) sw $4, 100($0) sw $4, 104($0) sw $3, 108($0) sw $4, 112($0) sw $2, 116($0) sw $1, 120($0) sw $3, 124($0) mtlo $2 mfhi $2 sub $3, $2, $2 mtlo $3 TAG1: mthi $3 multu $3, $3 ori $1, $3, 2 sll $3, $1, 3 TAG2: bne $3, $3, TAG3 mthi $3 mfhi $4 sllv $3, $3, $4 TAG3: sll $0, $0, 0 bgtz $3, TAG4 sllv $4, $3, $1 beq $4, $1, TAG4 TAG4: sll $4, $4, 1 div $4, $4 mfhi $3 sw $4, 0($3) TAG5: sltu $3, $3, $3 mfhi $3 sw $3, 0($3) lh $4, 0($3) TAG6: addiu $3, $4, 2 mfhi $2 lui $4, 8 beq $4, $2, TAG7 TAG7: sll $0, $0, 0 bgez $2, TAG8 mtlo $4 slt $2, $2, $4 TAG8: addu $3, $2, $2 mfhi $1 sh $1, 0($1) mtlo $1 TAG9: lhu $2, 0($1) beq $1, $1, TAG10 lui $1, 3 beq $1, $2, TAG10 TAG10: sll $0, $0, 0 mult $1, $1 sll $0, $0, 0 blez $3, TAG11 TAG11: mthi $3 bgez $3, TAG12 mult $3, $3 sll $4, $3, 2 TAG12: mthi $4 beq $4, $4, TAG13 sll $0, $0, 0 bltz $4, TAG13 TAG13: mult $4, $4 bltz $4, TAG14 mtlo $4 bgtz $4, TAG14 TAG14: and $3, $4, $4 mflo $2 sll $0, $0, 0 ori $1, $4, 8 TAG15: blez $1, TAG16 mtlo $1 addu $1, $1, $1 mfhi $3 TAG16: addiu $3, $3, 11 sb $3, 0($3) lui $4, 13 bltz $3, TAG17 TAG17: multu $4, $4 lui $2, 3 beq $2, $2, TAG18 mult $4, $4 TAG18: bgtz $2, TAG19 mflo $3 srlv $1, $3, $3 mtlo $3 TAG19: mfhi $2 blez $2, TAG20 mflo $4 sltu $4, $2, $2 TAG20: sw $4, 0($4) addu $2, $4, $4 lui $1, 11 sub $1, $2, $2 TAG21: lhu $1, 0($1) multu $1, $1 lui $3, 15 beq $1, $3, TAG22 TAG22: xori $1, $3, 2 lui $3, 7 bgez $1, TAG23 mthi $3 TAG23: mthi $3 beq $3, $3, TAG24 addu $1, $3, $3 srl $4, $3, 0 TAG24: sra $4, $4, 8 beq $4, $4, TAG25 lb $4, 0($4) mthi $4 TAG25: mfhi $3 mtlo $4 lw $1, 0($4) mult $4, $3 TAG26: blez $1, TAG27 slti $1, $1, 8 mfhi $3 slti $2, $1, 0 TAG27: lui $1, 4 mult $2, $2 multu $1, $2 mtlo $1 TAG28: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 bne $1, $1, TAG29 TAG29: mthi $4 blez $4, TAG30 srl $4, $4, 0 lhu $2, 0($4) TAG30: mult $2, $2 mfhi $3 bne $3, $2, TAG31 nor $1, $3, $2 TAG31: bgtz $1, TAG32 subu $2, $1, $1 mflo $4 mult $1, $1 TAG32: addi $3, $4, 12 beq $3, $3, TAG33 lh $4, 0($4) bltz $4, TAG33 TAG33: xor $3, $4, $4 bgez $4, TAG34 sb $3, 0($3) mtlo $4 TAG34: srl $1, $3, 7 mult $3, $3 bltz $3, TAG35 mtlo $1 TAG35: mthi $1 slti $3, $1, 5 bltz $1, TAG36 sh $3, 0($1) TAG36: lb $1, 0($3) bne $3, $3, TAG37 mthi $1 srav $3, $1, $1 TAG37: mfhi $1 lui $1, 2 sw $1, 0($3) sll $0, $0, 0 TAG38: beq $4, $4, TAG39 mflo $3 sltu $2, $3, $3 beq $2, $3, TAG39 TAG39: mflo $2 sh $2, 0($2) slt $4, $2, $2 mthi $2 TAG40: beq $4, $4, TAG41 sra $1, $4, 2 lbu $4, 0($4) mflo $2 TAG41: lbu $2, 0($2) srav $3, $2, $2 bgez $2, TAG42 sh $2, 0($3) TAG42: sh $3, 0($3) lb $3, 0($3) beq $3, $3, TAG43 multu $3, $3 TAG43: mthi $3 mflo $4 bgez $4, TAG44 mtlo $4 TAG44: bgez $4, TAG45 lhu $3, 0($4) sh $4, 0($3) xor $1, $3, $3 TAG45: lui $4, 3 sll $0, $0, 0 lhu $3, 0($1) mfhi $1 TAG46: blez $1, TAG47 lb $2, 0($1) divu $2, $1 subu $1, $1, $2 TAG47: beq $1, $1, TAG48 mfhi $3 and $4, $3, $1 slt $3, $3, $1 TAG48: addu $4, $3, $3 bne $4, $4, TAG49 sltiu $2, $4, 15 mtlo $4 TAG49: sb $2, 0($2) lui $1, 9 or $2, $2, $2 lui $4, 2 TAG50: bne $4, $4, TAG51 addu $1, $4, $4 slti $1, $4, 1 mthi $1 TAG51: nor $3, $1, $1 bgtz $3, TAG52 mthi $3 beq $1, $1, TAG52 TAG52: sll $0, $0, 0 div $3, $3 addiu $4, $3, 2 and $1, $4, $3 TAG53: beq $1, $1, TAG54 lui $2, 6 addi $1, $2, 0 mflo $2 TAG54: mtlo $2 blez $2, TAG55 mfhi $1 ori $3, $1, 0 TAG55: addiu $2, $3, 4 mthi $2 mtlo $2 blez $2, TAG56 TAG56: mflo $2 sw $2, 0($2) slt $3, $2, $2 mtlo $2 TAG57: sh $3, 0($3) sllv $3, $3, $3 srav $3, $3, $3 beq $3, $3, TAG58 TAG58: add $2, $3, $3 mflo $3 sh $2, 0($2) lui $4, 15 TAG59: multu $4, $4 sll $0, $0, 0 bgez $4, TAG60 sll $0, $0, 0 TAG60: mtlo $4 beq $4, $4, TAG61 sll $0, $0, 0 sb $4, 0($4) TAG61: subu $2, $4, $4 sb $2, 0($2) sll $0, $0, 0 lui $3, 4 TAG62: sll $0, $0, 0 beq $3, $3, TAG63 and $3, $3, $3 mflo $4 TAG63: mtlo $4 mthi $4 mflo $4 bgez $4, TAG64 TAG64: multu $4, $4 mult $4, $4 bgez $4, TAG65 mtlo $4 TAG65: sll $0, $0, 0 mthi $2 blez $4, TAG66 andi $1, $2, 2 TAG66: lui $2, 8 bgez $2, TAG67 sll $0, $0, 0 addi $1, $2, 11 TAG67: lbu $2, 0($1) ori $4, $1, 13 mfhi $4 multu $2, $4 TAG68: mfhi $3 mthi $3 mfhi $3 mult $3, $3 TAG69: mthi $3 bgtz $3, TAG70 lui $3, 14 lui $2, 13 TAG70: blez $2, TAG71 mult $2, $2 beq $2, $2, TAG71 lui $2, 3 TAG71: mthi $2 lui $4, 15 subu $1, $4, $4 mthi $4 TAG72: bne $1, $1, TAG73 mtlo $1 blez $1, TAG73 xori $4, $1, 10 TAG73: mfhi $2 bgez $4, TAG74 lui $2, 15 mfhi $3 TAG74: sll $0, $0, 0 beq $3, $3, TAG75 sll $0, $0, 0 sltiu $3, $3, 0 TAG75: mtlo $3 addiu $1, $3, 2 bgtz $1, TAG76 mtlo $3 TAG76: div $1, $1 bne $1, $1, TAG77 lui $4, 7 divu $4, $4 TAG77: mfhi $3 multu $4, $3 sll $0, $0, 0 lhu $3, 0($3) TAG78: bne $3, $3, TAG79 sw $3, 0($3) sh $3, 0($3) mfhi $2 TAG79: lui $3, 4 bltz $3, TAG80 mfhi $3 addiu $4, $3, 8 TAG80: addu $4, $4, $4 lui $1, 8 slt $1, $4, $1 mthi $1 TAG81: mtlo $1 lb $4, 0($1) beq $4, $1, TAG82 sh $1, 0($4) TAG82: multu $4, $4 sb $4, 0($4) mthi $4 lw $1, 0($4) TAG83: sw $1, 0($1) beq $1, $1, TAG84 multu $1, $1 lui $4, 0 TAG84: mflo $3 mtlo $3 mtlo $3 sb $3, 0($3) TAG85: mult $3, $3 bne $3, $3, TAG86 mult $3, $3 mthi $3 TAG86: sb $3, 0($3) sw $3, 0($3) lui $1, 12 sll $0, $0, 0 TAG87: mfhi $2 mthi $1 multu $2, $2 lui $2, 7 TAG88: bgtz $2, TAG89 lui $3, 14 mthi $2 bne $2, $3, TAG89 TAG89: xori $1, $3, 12 srlv $1, $1, $3 divu $3, $1 sra $4, $1, 7 TAG90: mthi $4 andi $3, $4, 2 mtlo $4 sub $3, $4, $3 TAG91: divu $3, $3 sb $3, -7168($3) subu $3, $3, $3 sh $3, 0($3) TAG92: add $4, $3, $3 mfhi $2 sb $2, 0($2) sw $2, 0($2) TAG93: bne $2, $2, TAG94 mult $2, $2 beq $2, $2, TAG94 lui $3, 8 TAG94: bne $3, $3, TAG95 mult $3, $3 srl $2, $3, 2 mfhi $2 TAG95: mtlo $2 blez $2, TAG96 mthi $2 mflo $1 TAG96: mthi $1 sw $1, 0($1) srlv $2, $1, $1 mflo $4 TAG97: subu $2, $4, $4 beq $2, $4, TAG98 sw $2, 0($2) lb $4, 0($4) TAG98: div $4, $4 lhu $2, 0($4) mfhi $3 mult $3, $2 TAG99: mthi $3 lh $1, 0($3) nor $3, $1, $3 nor $1, $1, $3 TAG100: lui $2, 6 lui $4, 11 lhu $1, 0($1) sb $4, 0($1) TAG101: lui $1, 7 bne $1, $1, TAG102 sll $0, $0, 0 multu $2, $2 TAG102: bne $2, $2, TAG103 lui $1, 15 sll $0, $0, 0 mflo $3 TAG103: blez $3, TAG104 xor $2, $3, $3 nor $4, $2, $3 beq $3, $3, TAG104 TAG104: sll $0, $0, 0 lui $4, 6 lui $3, 4 mfhi $3 TAG105: bne $3, $3, TAG106 slti $2, $3, 13 sb $3, 0($2) mult $3, $2 TAG106: mflo $2 mthi $2 bgtz $2, TAG107 mthi $2 TAG107: srlv $2, $2, $2 bne $2, $2, TAG108 mult $2, $2 lbu $3, 0($2) TAG108: sll $1, $3, 13 sll $1, $1, 14 mult $1, $1 addu $4, $3, $3 TAG109: mflo $2 lh $1, 0($2) mflo $4 add $1, $4, $2 TAG110: mfhi $3 lui $1, 4 sll $0, $0, 0 mthi $3 TAG111: ori $3, $1, 0 sll $0, $0, 0 mflo $1 sll $0, $0, 0 TAG112: beq $1, $1, TAG113 multu $1, $1 lw $2, 0($1) lbu $1, 0($1) TAG113: mflo $4 lui $4, 9 beq $1, $1, TAG114 mthi $4 TAG114: lui $2, 10 mflo $1 mfhi $3 sll $0, $0, 0 TAG115: multu $3, $3 sll $0, $0, 0 div $3, $3 sll $3, $3, 12 TAG116: mflo $4 blez $3, TAG117 sb $3, 0($4) beq $3, $3, TAG117 TAG117: mult $4, $4 mthi $4 beq $4, $4, TAG118 sll $4, $4, 2 TAG118: addiu $3, $4, 0 bne $3, $4, TAG119 sh $3, 0($3) lh $2, 0($4) TAG119: mult $2, $2 bne $2, $2, TAG120 mflo $1 mthi $2 TAG120: bgez $1, TAG121 mfhi $3 mthi $3 lh $2, 0($3) TAG121: beq $2, $2, TAG122 sw $2, 0($2) sub $3, $2, $2 mtlo $2 TAG122: sllv $4, $3, $3 mflo $4 sltiu $1, $4, 1 lbu $3, 0($4) TAG123: bgez $3, TAG124 addu $4, $3, $3 lui $1, 1 lui $4, 14 TAG124: xori $4, $4, 13 sb $4, 0($4) xor $1, $4, $4 sw $4, 0($1) TAG125: mult $1, $1 mfhi $1 lui $1, 11 mthi $1 TAG126: addiu $2, $1, 6 mthi $1 bltz $2, TAG127 mflo $2 TAG127: lhu $4, 0($2) sllv $2, $2, $2 mthi $2 bne $2, $2, TAG128 TAG128: mfhi $1 mthi $2 bgtz $2, TAG129 lb $4, 0($2) TAG129: mflo $4 srav $4, $4, $4 bgez $4, TAG130 mthi $4 TAG130: bltz $4, TAG131 slt $4, $4, $4 bne $4, $4, TAG131 mult $4, $4 TAG131: beq $4, $4, TAG132 mtlo $4 mtlo $4 addiu $2, $4, 2 TAG132: mtlo $2 andi $1, $2, 13 mtlo $2 lhu $3, 0($2) TAG133: mtlo $3 lb $3, 0($3) lb $3, 0($3) lb $2, 0($3) TAG134: beq $2, $2, TAG135 nor $1, $2, $2 and $2, $2, $1 mflo $4 TAG135: bgtz $4, TAG136 srlv $3, $4, $4 bgez $4, TAG136 and $1, $4, $4 TAG136: mthi $1 mflo $1 sltu $2, $1, $1 mfhi $4 TAG137: andi $2, $4, 4 lui $1, 12 bne $2, $4, TAG138 mfhi $3 TAG138: bgez $3, TAG139 mthi $3 slti $4, $3, 10 mfhi $1 TAG139: sll $0, $0, 0 mfhi $3 mtlo $1 blez $1, TAG140 TAG140: and $3, $3, $3 lui $4, 13 mflo $4 multu $3, $4 TAG141: div $4, $4 mflo $3 sb $4, 0($3) mthi $3 TAG142: div $3, $3 mflo $2 mfhi $4 bne $4, $2, TAG143 TAG143: multu $4, $4 lui $3, 7 sw $4, 0($4) lui $1, 1 TAG144: sll $0, $0, 0 nor $4, $1, $1 lui $4, 7 sll $0, $0, 0 TAG145: bne $4, $4, TAG146 addiu $4, $4, 6 lui $4, 0 mfhi $1 TAG146: lui $1, 13 or $4, $1, $1 srlv $2, $1, $4 sll $0, $0, 0 TAG147: sll $0, $0, 0 bgtz $2, TAG148 mtlo $2 sllv $4, $2, $2 TAG148: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 slt $2, $4, $4 TAG149: lui $3, 10 mtlo $3 beq $3, $3, TAG150 mflo $3 TAG150: mtlo $3 and $4, $3, $3 sltu $2, $3, $4 multu $2, $2 TAG151: sh $2, 0($2) mflo $1 mthi $1 sll $1, $2, 3 TAG152: sltiu $2, $1, 10 bgtz $1, TAG153 mtlo $2 slti $2, $1, 15 TAG153: bltz $2, TAG154 mtlo $2 lbu $4, 0($2) srav $3, $2, $4 TAG154: mthi $3 blez $3, TAG155 mfhi $1 bne $3, $1, TAG155 TAG155: lui $2, 13 mthi $1 mtlo $1 beq $1, $1, TAG156 TAG156: xori $1, $2, 7 lui $1, 7 sll $0, $0, 0 addiu $2, $1, 12 TAG157: beq $2, $2, TAG158 div $2, $2 subu $1, $2, $2 multu $2, $1 TAG158: sll $0, $0, 0 sll $0, $0, 0 lui $4, 15 ori $3, $4, 8 TAG159: multu $3, $3 sll $0, $0, 0 lui $1, 3 lui $3, 0 TAG160: sub $1, $3, $3 multu $3, $1 sb $1, 0($1) mtlo $1 TAG161: sh $1, 0($1) multu $1, $1 bltz $1, TAG162 lui $2, 11 TAG162: sll $0, $0, 0 lui $2, 4 lui $4, 6 mult $2, $2 TAG163: sll $0, $0, 0 sll $0, $0, 0 multu $2, $2 divu $4, $4 TAG164: sll $0, $0, 0 mtlo $2 sll $0, $0, 0 bltz $2, TAG165 TAG165: mflo $4 sll $0, $0, 0 bgtz $4, TAG166 lui $4, 2 TAG166: bne $4, $4, TAG167 mult $4, $4 bne $4, $4, TAG167 lui $4, 7 TAG167: xori $4, $4, 7 sll $0, $0, 0 sll $0, $0, 0 mflo $1 TAG168: bltz $1, TAG169 sb $1, 0($1) multu $1, $1 lbu $3, 0($1) TAG169: mflo $1 multu $3, $3 sh $1, 0($3) mflo $2 TAG170: sh $2, 0($2) mtlo $2 slti $1, $2, 3 beq $2, $2, TAG171 TAG171: andi $1, $1, 6 srl $2, $1, 6 subu $3, $1, $2 lh $2, 0($2) TAG172: mthi $2 multu $2, $2 lw $3, 0($2) srlv $3, $2, $2 TAG173: beq $3, $3, TAG174 lui $4, 14 mflo $4 bgtz $3, TAG174 TAG174: multu $4, $4 sll $0, $0, 0 mtlo $4 srlv $3, $4, $4 TAG175: divu $3, $3 multu $3, $3 divu $3, $3 mtlo $3 TAG176: bne $3, $3, TAG177 divu $3, $3 beq $3, $3, TAG177 multu $3, $3 TAG177: sll $0, $0, 0 bgez $3, TAG178 mflo $1 lw $4, 0($3) TAG178: mflo $1 lui $4, 4 bltz $4, TAG179 divu $1, $4 TAG179: mtlo $4 or $1, $4, $4 sll $0, $0, 0 sll $3, $4, 4 TAG180: mthi $3 sll $0, $0, 0 lui $1, 14 mtlo $3 TAG181: sltiu $1, $1, 8 sll $2, $1, 12 multu $1, $1 bne $2, $1, TAG182 TAG182: andi $4, $2, 9 sra $1, $2, 4 addu $2, $4, $4 sra $1, $2, 5 TAG183: mflo $2 lui $2, 2 mthi $1 bltz $2, TAG184 TAG184: sll $0, $0, 0 sll $4, $2, 7 multu $2, $4 mtlo $4 TAG185: and $2, $4, $4 div $4, $4 sllv $2, $4, $4 beq $2, $4, TAG186 TAG186: addiu $2, $2, 6 andi $3, $2, 10 bgtz $2, TAG187 mflo $4 TAG187: lui $4, 8 bne $4, $4, TAG188 sll $0, $0, 0 sll $0, $0, 0 TAG188: slti $3, $4, 1 mult $3, $4 sw $4, 0($3) srlv $1, $4, $3 TAG189: multu $1, $1 lui $1, 13 sll $0, $0, 0 mthi $1 TAG190: bltz $1, TAG191 sltu $4, $1, $1 mult $1, $4 div $1, $1 TAG191: lhu $2, 0($4) lui $2, 2 lui $2, 1 multu $2, $2 TAG192: mfhi $3 sll $0, $0, 0 multu $1, $1 srlv $2, $2, $3 TAG193: bgez $2, TAG194 mflo $1 lui $4, 10 bgez $2, TAG194 TAG194: addu $2, $4, $4 beq $4, $2, TAG195 multu $4, $2 beq $2, $2, TAG195 TAG195: sra $1, $2, 12 lui $1, 2 sll $0, $0, 0 lui $4, 14 TAG196: mthi $4 sra $1, $4, 7 bgtz $1, TAG197 mthi $4 TAG197: divu $1, $1 mtlo $1 lui $3, 15 lui $2, 5 TAG198: subu $1, $2, $2 bgtz $2, TAG199 mult $2, $2 lh $4, 0($1) TAG199: mthi $4 lui $1, 7 ori $1, $4, 0 bltz $1, TAG200 TAG200: mthi $1 multu $1, $1 sra $3, $1, 13 divu $3, $1 TAG201: bgtz $3, TAG202 slt $3, $3, $3 sw $3, 0($3) slt $3, $3, $3 TAG202: lb $3, 0($3) lb $4, 0($3) bgtz $4, TAG203 lui $2, 11 TAG203: mflo $1 mtlo $1 mfhi $4 sh $4, 0($4) TAG204: mtlo $4 mflo $1 nor $4, $4, $1 beq $4, $1, TAG205 TAG205: mtlo $4 srlv $2, $4, $4 lhu $4, 113($4) blez $4, TAG206 TAG206: sll $2, $4, 0 sb $2, 0($2) bgtz $2, TAG207 lw $2, 0($4) TAG207: lui $1, 8 mflo $4 srav $2, $2, $2 sll $0, $0, 0 TAG208: mtlo $2 sra $4, $2, 14 sll $0, $0, 0 sb $4, 0($4) TAG209: mult $4, $4 lui $4, 15 srl $1, $4, 11 mfhi $4 TAG210: mfhi $2 subu $1, $2, $4 sh $2, 0($2) lui $2, 14 TAG211: lui $4, 4 lui $3, 10 bgez $4, TAG212 mthi $2 TAG212: sll $0, $0, 0 multu $2, $2 divu $3, $3 mtlo $2 TAG213: lui $2, 4 div $2, $2 mfhi $3 sub $2, $2, $3 TAG214: multu $2, $2 lui $1, 0 lb $1, 0($1) mflo $2 TAG215: xori $3, $2, 14 mfhi $2 bne $3, $2, TAG216 mthi $2 TAG216: sll $2, $2, 1 sb $2, 0($2) mflo $1 sh $1, 0($2) TAG217: mfhi $4 lui $2, 15 bgtz $1, TAG218 lw $3, 0($4) TAG218: beq $3, $3, TAG219 sll $3, $3, 10 or $2, $3, $3 mthi $2 TAG219: andi $2, $2, 2 bltz $2, TAG220 srl $4, $2, 11 sllv $2, $2, $4 TAG220: lui $4, 6 bne $2, $2, TAG221 multu $4, $2 bgtz $4, TAG221 TAG221: sll $0, $0, 0 lui $1, 0 bgtz $4, TAG222 lui $1, 1 TAG222: mflo $3 mtlo $1 sll $3, $1, 8 sltiu $2, $3, 2 TAG223: multu $2, $2 bgez $2, TAG224 lui $1, 7 mflo $2 TAG224: and $3, $2, $2 lui $3, 9 mflo $2 bne $2, $2, TAG225 TAG225: lui $3, 10 mflo $4 lui $1, 14 sll $0, $0, 0 TAG226: beq $4, $4, TAG227 multu $4, $4 or $4, $4, $4 bltz $4, TAG227 TAG227: lui $1, 13 andi $3, $1, 3 lh $2, 0($3) bne $4, $2, TAG228 TAG228: lui $3, 13 beq $2, $2, TAG229 lui $4, 12 xori $3, $3, 11 TAG229: sra $2, $3, 2 multu $2, $3 mtlo $2 mthi $2 TAG230: bne $2, $2, TAG231 sltiu $2, $2, 0 beq $2, $2, TAG231 mthi $2 TAG231: sb $2, 0($2) sw $2, 0($2) mfhi $3 subu $4, $3, $2 TAG232: sh $4, 0($4) mfhi $2 mthi $4 sltiu $1, $4, 1 TAG233: sra $1, $1, 2 multu $1, $1 sb $1, 0($1) sltiu $1, $1, 11 TAG234: srlv $1, $1, $1 mult $1, $1 lh $4, 0($1) mult $1, $1 TAG235: mthi $4 multu $4, $4 sb $4, 0($4) lh $3, 0($4) TAG236: lbu $2, 0($3) lw $2, 0($2) lui $1, 10 mthi $1 TAG237: andi $3, $1, 1 ori $2, $3, 9 mflo $1 lui $4, 14 TAG238: divu $4, $4 beq $4, $4, TAG239 sll $0, $0, 0 mtlo $1 TAG239: mtlo $1 lb $4, 0($1) multu $4, $4 lui $2, 3 TAG240: div $2, $2 sll $0, $0, 0 bne $2, $2, TAG241 mult $2, $2 TAG241: lui $4, 3 slti $1, $4, 11 div $1, $2 mult $1, $4 TAG242: or $1, $1, $1 lhu $3, 0($1) mthi $1 beq $1, $3, TAG243 TAG243: multu $3, $3 bgtz $3, TAG244 mfhi $2 bgez $2, TAG244 TAG244: mtlo $2 lui $2, 15 bgez $2, TAG245 lui $1, 4 TAG245: bne $1, $1, TAG246 or $4, $1, $1 mflo $2 mfhi $3 TAG246: mtlo $3 mult $3, $3 xor $4, $3, $3 mflo $1 TAG247: sltiu $1, $1, 8 mthi $1 mtlo $1 lb $2, 0($1) TAG248: xori $2, $2, 2 bgtz $2, TAG249 srav $1, $2, $2 lhu $4, 0($2) TAG249: multu $4, $4 mtlo $4 sh $4, 0($4) lui $3, 3 TAG250: mult $3, $3 sra $4, $3, 6 ori $4, $4, 4 lui $4, 9 TAG251: div $4, $4 mult $4, $4 div $4, $4 sll $0, $0, 0 TAG252: bgtz $4, TAG253 mflo $3 mfhi $1 mfhi $3 TAG253: lui $4, 15 mfhi $3 mult $4, $3 srl $1, $3, 5 TAG254: mult $1, $1 add $1, $1, $1 mult $1, $1 mthi $1 TAG255: multu $1, $1 lui $1, 8 nor $2, $1, $1 sltiu $4, $2, 9 TAG256: lw $2, 0($4) bne $4, $2, TAG257 sh $2, 0($2) add $2, $2, $2 TAG257: sb $2, 0($2) lbu $4, 0($2) sh $2, 0($2) beq $4, $2, TAG258 TAG258: sh $4, 0($4) bgtz $4, TAG259 lui $3, 4 lui $1, 6 TAG259: beq $1, $1, TAG260 lui $4, 14 bgez $4, TAG260 sb $4, 0($4) TAG260: mult $4, $4 sll $0, $0, 0 sll $0, $0, 0 mfhi $3 TAG261: slt $1, $3, $3 lb $2, -196($3) sllv $3, $2, $1 lw $3, 0($3) TAG262: blez $3, TAG263 slti $4, $3, 0 lui $1, 8 bgez $4, TAG263 TAG263: mthi $1 sb $1, 0($1) addiu $1, $1, 4 blez $1, TAG264 TAG264: mfhi $2 mfhi $3 sltiu $2, $3, 4 addiu $3, $2, 1 TAG265: lui $4, 10 sltu $3, $4, $4 multu $3, $3 sh $3, 0($3) TAG266: lbu $2, 0($3) mfhi $3 sw $3, 0($3) lui $4, 12 TAG267: bne $4, $4, TAG268 sll $1, $4, 5 slt $2, $4, $1 mflo $1 TAG268: slti $4, $1, 13 slt $3, $1, $1 lui $1, 0 addi $2, $1, 15 TAG269: lui $2, 9 lui $3, 5 bgtz $3, TAG270 sll $0, $0, 0 TAG270: div $3, $3 mflo $3 sb $3, 0($3) beq $3, $3, TAG271 TAG271: lbu $3, 0($3) blez $3, TAG272 srlv $2, $3, $3 sh $3, 0($2) TAG272: mfhi $4 beq $2, $4, TAG273 sll $1, $4, 1 multu $2, $1 TAG273: sh $1, 0($1) slti $3, $1, 10 mthi $3 slti $1, $1, 1 TAG274: srl $2, $1, 4 lui $4, 11 mflo $4 mflo $1 TAG275: lbu $2, 0($1) lui $3, 10 mflo $2 or $2, $2, $3 TAG276: sll $0, $0, 0 addiu $2, $2, 5 bltz $2, TAG277 addu $4, $2, $2 TAG277: beq $4, $4, TAG278 mult $4, $4 bgez $4, TAG278 div $4, $4 TAG278: mfhi $2 bne $2, $2, TAG279 mflo $2 beq $2, $2, TAG279 TAG279: mtlo $2 or $2, $2, $2 blez $2, TAG280 lui $3, 2 TAG280: sll $0, $0, 0 bgez $3, TAG281 nor $3, $3, $3 add $4, $3, $3 TAG281: bltz $4, TAG282 lui $2, 3 multu $2, $4 slti $2, $2, 4 TAG282: mtlo $2 blez $2, TAG283 slt $4, $2, $2 multu $4, $4 TAG283: addiu $4, $4, 11 lui $2, 8 beq $4, $2, TAG284 lui $2, 1 TAG284: addiu $4, $2, 1 sll $0, $0, 0 lui $1, 5 sll $0, $0, 0 TAG285: sll $0, $0, 0 mfhi $4 mult $4, $1 multu $1, $4 TAG286: mthi $4 mtlo $4 div $4, $4 mflo $3 TAG287: lb $2, 0($3) sh $2, 0($2) sra $2, $3, 12 lui $2, 4 TAG288: ori $2, $2, 6 bne $2, $2, TAG289 lui $1, 6 mflo $4 TAG289: mult $4, $4 lui $2, 1 mtlo $4 mtlo $4 TAG290: bgtz $2, TAG291 xori $4, $2, 8 bltz $4, TAG291 lhu $2, 0($2) TAG291: sll $0, $0, 0 mflo $2 sb $2, 0($2) sb $2, 0($2) TAG292: bgez $2, TAG293 lbu $3, 0($2) blez $2, TAG293 lh $2, 0($3) TAG293: mtlo $2 divu $2, $2 lbu $3, 0($2) mflo $4 TAG294: multu $4, $4 div $4, $4 lui $4, 11 sll $0, $0, 0 TAG295: sltu $4, $3, $3 lbu $1, 0($4) or $1, $4, $3 divu $4, $3 TAG296: ori $1, $1, 4 beq $1, $1, TAG297 mflo $1 multu $1, $1 TAG297: addiu $3, $1, 0 bne $1, $1, TAG298 srlv $3, $3, $1 mflo $2 TAG298: lw $3, 0($2) mtlo $3 mult $3, $2 lhu $4, 0($2) TAG299: sll $0, $0, 0 mtlo $4 blez $4, TAG300 mflo $1 TAG300: bne $1, $1, TAG301 sllv $4, $1, $1 mflo $2 lbu $2, -256($1) TAG301: bgtz $2, TAG302 mult $2, $2 bgez $2, TAG302 sb $2, 0($2) TAG302: srlv $1, $2, $2 bgez $1, TAG303 sh $2, 0($2) bgtz $1, TAG303 TAG303: mtlo $1 multu $1, $1 sb $1, 0($1) mtlo $1 TAG304: bne $1, $1, TAG305 multu $1, $1 bne $1, $1, TAG305 sb $1, 0($1) TAG305: mult $1, $1 lh $3, 0($1) lui $1, 3 sra $1, $1, 11 TAG306: mfhi $4 bne $1, $4, TAG307 sw $1, 0($1) sltu $3, $1, $4 TAG307: mtlo $3 mthi $3 lbu $4, 0($3) lui $2, 13 TAG308: bgez $2, TAG309 mult $2, $2 mult $2, $2 lui $3, 2 TAG309: mthi $3 ori $2, $3, 14 blez $3, TAG310 multu $3, $2 TAG310: lbu $3, 0($2) lh $2, 0($3) lw $3, 0($3) blez $3, TAG311 TAG311: mthi $3 mult $3, $3 mflo $4 slti $2, $4, 7 TAG312: mtlo $2 mtlo $2 bgtz $2, TAG313 sb $2, 0($2) TAG313: lui $4, 1 or $1, $2, $4 addiu $4, $4, 5 mthi $1 TAG314: mflo $2 xor $3, $2, $4 mtlo $2 and $1, $4, $4 TAG315: andi $1, $1, 4 divu $1, $1 lui $1, 14 xor $2, $1, $1 TAG316: lb $4, 0($2) lui $2, 1 addu $3, $4, $2 bne $3, $4, TAG317 TAG317: mfhi $1 bgtz $1, TAG318 mtlo $1 lui $2, 14 TAG318: bne $2, $2, TAG319 mtlo $2 div $2, $2 sltu $4, $2, $2 TAG319: sra $2, $4, 6 xor $2, $4, $4 andi $4, $4, 9 lui $4, 8 TAG320: bne $4, $4, TAG321 addu $2, $4, $4 lui $2, 10 lui $1, 11 TAG321: sll $0, $0, 0 lui $1, 10 mthi $1 mtlo $1 TAG322: mflo $1 mfhi $2 sll $0, $0, 0 blez $1, TAG323 TAG323: divu $2, $2 multu $2, $2 div $2, $2 slt $3, $2, $2 TAG324: lui $1, 2 div $1, $1 mtlo $1 bne $3, $3, TAG325 TAG325: mtlo $1 sll $0, $0, 0 mthi $1 xori $2, $1, 5 TAG326: lui $2, 15 mfhi $4 mflo $2 sll $0, $0, 0 TAG327: mfhi $3 divu $1, $3 bne $1, $1, TAG328 sll $0, $0, 0 TAG328: bne $3, $3, TAG329 sll $0, $0, 0 sll $0, $0, 0 and $1, $3, $3 TAG329: sll $0, $0, 0 mtlo $1 mtlo $1 addiu $4, $1, 1 TAG330: bgez $4, TAG331 slti $2, $4, 13 lui $3, 11 sh $2, 0($2) TAG331: subu $3, $3, $3 lui $4, 13 lb $1, 0($3) bltz $4, TAG332 TAG332: mflo $4 sll $0, $0, 0 mthi $4 mfhi $3 TAG333: mthi $3 andi $4, $3, 3 mflo $2 sh $4, 0($4) TAG334: sll $0, $0, 0 xor $1, $2, $2 sll $0, $0, 0 lui $4, 5 TAG335: addu $4, $4, $4 mult $4, $4 bgez $4, TAG336 sll $0, $0, 0 TAG336: sll $0, $0, 0 bltz $2, TAG337 mthi $2 mflo $4 TAG337: bne $4, $4, TAG338 lbu $4, 0($4) bne $4, $4, TAG338 sra $3, $4, 10 TAG338: lbu $3, 0($3) sw $3, 0($3) beq $3, $3, TAG339 multu $3, $3 TAG339: mult $3, $3 mtlo $3 lui $4, 8 addu $1, $3, $4 TAG340: andi $2, $1, 9 sb $2, 0($2) multu $1, $2 mthi $2 TAG341: blez $2, TAG342 sllv $3, $2, $2 beq $2, $2, TAG342 lui $4, 5 TAG342: multu $4, $4 addiu $1, $4, 7 blez $1, TAG343 sll $0, $0, 0 TAG343: mflo $3 sltiu $1, $4, 3 srav $2, $1, $4 lui $3, 5 TAG344: lui $1, 4 bne $3, $3, TAG345 sll $0, $0, 0 divu $1, $3 TAG345: lui $2, 14 bltz $2, TAG346 lui $4, 12 bgtz $2, TAG346 TAG346: addiu $3, $4, 6 srl $2, $4, 6 bne $2, $2, TAG347 subu $4, $3, $2 TAG347: srl $3, $4, 8 div $4, $3 mflo $1 sltiu $1, $3, 0 TAG348: mflo $3 mfhi $4 sh $1, 0($4) multu $1, $1 TAG349: sra $3, $4, 1 mfhi $1 bgtz $1, TAG350 subu $3, $3, $3 TAG350: xori $1, $3, 11 subu $3, $1, $3 lbu $4, 0($3) lb $3, 0($3) TAG351: bltz $3, TAG352 mtlo $3 sll $3, $3, 10 mult $3, $3 TAG352: sra $4, $3, 15 or $4, $4, $3 multu $4, $3 mflo $1 TAG353: blez $1, TAG354 lb $1, 0($1) blez $1, TAG354 sltiu $2, $1, 8 TAG354: sll $0, $0, 0 addiu $2, $3, 6 lui $1, 1 sh $1, 0($2) TAG355: mthi $1 beq $1, $1, TAG356 lui $3, 13 mthi $3 TAG356: lui $3, 9 mult $3, $3 slt $4, $3, $3 sw $3, 0($4) TAG357: lui $2, 8 bltz $4, TAG358 slti $2, $4, 1 mthi $2 TAG358: bne $2, $2, TAG359 slt $2, $2, $2 lui $1, 13 mthi $2 TAG359: mflo $2 lui $4, 7 sll $0, $0, 0 lh $3, 0($2) TAG360: mtlo $3 beq $3, $3, TAG361 lbu $4, 0($3) mtlo $4 TAG361: mfhi $3 bgez $4, TAG362 lhu $3, 0($4) srlv $1, $3, $3 TAG362: addiu $4, $1, 12 bne $1, $1, TAG363 mflo $3 srl $3, $3, 6 TAG363: mtlo $3 sb $3, 0($3) bne $3, $3, TAG364 slti $3, $3, 14 TAG364: lbu $1, 0($3) multu $1, $1 lui $2, 7 mflo $1 TAG365: multu $1, $1 xor $4, $1, $1 sltiu $3, $4, 5 mult $3, $1 TAG366: bgez $3, TAG367 div $3, $3 mflo $2 bgtz $2, TAG367 TAG367: ori $4, $2, 4 sll $0, $0, 0 sltu $1, $2, $4 addu $1, $1, $1 TAG368: div $1, $1 blez $1, TAG369 lui $4, 15 beq $4, $4, TAG369 TAG369: mtlo $4 sll $0, $0, 0 beq $4, $4, TAG370 sll $0, $0, 0 TAG370: beq $4, $4, TAG371 mfhi $1 mtlo $4 lui $1, 3 TAG371: bgez $1, TAG372 mtlo $1 mfhi $3 multu $3, $3 TAG372: lb $4, 0($3) lui $1, 3 blez $3, TAG373 lw $3, 0($4) TAG373: divu $3, $3 lui $1, 9 sll $0, $0, 0 xori $1, $2, 15 TAG374: sll $0, $0, 0 sll $0, $0, 0 div $3, $3 multu $1, $1 TAG375: sll $0, $0, 0 bne $3, $3, TAG376 subu $4, $3, $3 bltz $4, TAG376 TAG376: multu $4, $4 bne $4, $4, TAG377 mfhi $3 mtlo $4 TAG377: lui $1, 12 sll $0, $0, 0 xori $2, $3, 4 sll $0, $0, 0 TAG378: lw $4, 0($3) sll $1, $3, 13 lbu $1, 0($1) mthi $1 TAG379: beq $1, $1, TAG380 sll $1, $1, 9 mtlo $1 mfhi $3 TAG380: bgtz $3, TAG381 mtlo $3 and $4, $3, $3 bltz $3, TAG381 TAG381: nor $3, $4, $4 xor $1, $3, $3 bltz $4, TAG382 lw $4, 1($3) TAG382: beq $4, $4, TAG383 mfhi $4 sllv $4, $4, $4 lui $3, 6 TAG383: bne $3, $3, TAG384 ori $3, $3, 11 multu $3, $3 mfhi $1 TAG384: sh $1, 2($1) mfhi $3 addu $1, $1, $1 lh $3, 2($3) TAG385: mthi $3 blez $3, TAG386 mtlo $3 mtlo $3 TAG386: beq $3, $3, TAG387 sw $3, 2($3) mflo $1 mthi $1 TAG387: mtlo $1 beq $1, $1, TAG388 mtlo $1 andi $3, $1, 10 TAG388: sltiu $2, $3, 10 lh $2, 2($3) bltz $2, TAG389 sll $1, $2, 12 TAG389: bne $1, $1, TAG390 lb $4, 8192($1) multu $1, $4 mfhi $2 TAG390: mthi $2 bgtz $2, TAG391 multu $2, $2 lui $1, 7 TAG391: slti $1, $1, 12 lui $1, 0 lui $1, 9 bne $1, $1, TAG392 TAG392: lui $1, 3 sll $0, $0, 0 beq $1, $1, TAG393 mflo $3 TAG393: addiu $1, $3, 10 beq $1, $1, TAG394 sll $0, $0, 0 mflo $2 TAG394: multu $2, $2 addiu $2, $2, 14 divu $2, $2 bne $2, $2, TAG395 TAG395: sh $2, 8180($2) lw $3, 8180($2) mtlo $3 sb $3, 8180($3) TAG396: sll $0, $0, 0 divu $2, $2 bgtz $3, TAG397 divu $2, $3 TAG397: sh $2, 8180($2) bne $2, $2, TAG398 mtlo $2 beq $2, $2, TAG398 TAG398: mfhi $1 lbu $4, 0($1) blez $1, TAG399 lhu $3, 0($4) TAG399: srl $4, $3, 0 sb $4, 0($3) bgez $3, TAG400 mflo $2 TAG400: div $2, $2 mflo $2 bgez $2, TAG401 mfhi $2 TAG401: bgez $2, TAG402 sw $2, 0($2) mfhi $4 sra $3, $4, 13 TAG402: div $3, $3 mflo $1 bltz $3, TAG403 lui $3, 9 TAG403: sll $0, $0, 0 blez $3, TAG404 slti $1, $3, 14 sllv $1, $3, $3 TAG404: mthi $1 sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 TAG405: mult $1, $1 sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 TAG406: divu $1, $1 divu $1, $1 blez $1, TAG407 sll $0, $0, 0 TAG407: sll $0, $0, 0 div $3, $1 sltu $3, $1, $1 lb $3, 0($3) TAG408: lh $1, 0($3) mthi $3 beq $1, $3, TAG409 subu $2, $1, $1 TAG409: xori $1, $2, 13 mtlo $1 mtlo $2 bgez $1, TAG410 TAG410: mthi $1 addiu $2, $1, 2 sb $1, 0($2) mtlo $2 TAG411: mtlo $2 mfhi $1 mtlo $1 lbu $4, 0($1) TAG412: mfhi $1 mflo $2 multu $1, $1 bltz $4, TAG413 TAG413: mthi $2 mflo $4 mfhi $4 mtlo $4 TAG414: bne $4, $4, TAG415 xori $1, $4, 1 lbu $2, 0($4) lh $1, 0($2) TAG415: mfhi $3 mthi $1 mfhi $1 lui $3, 15 TAG416: bgez $3, TAG417 mflo $1 bne $1, $3, TAG417 mflo $3 TAG417: bne $3, $3, TAG418 addu $2, $3, $3 bne $3, $2, TAG418 multu $3, $3 TAG418: bgtz $2, TAG419 sll $0, $0, 0 andi $3, $2, 5 beq $3, $2, TAG419 TAG419: mfhi $3 sh $3, -225($3) mfhi $1 multu $3, $3 TAG420: mfhi $2 srav $3, $2, $2 mult $1, $3 mtlo $1 TAG421: ori $3, $3, 15 lb $2, 0($3) multu $3, $3 bne $3, $2, TAG422 TAG422: mult $2, $2 lb $3, 0($2) beq $2, $3, TAG423 lbu $3, 0($2) TAG423: mult $3, $3 multu $3, $3 and $1, $3, $3 sltiu $1, $3, 3 TAG424: mtlo $1 lui $1, 10 or $2, $1, $1 mfhi $4 TAG425: lui $4, 0 mtlo $4 lui $4, 7 divu $4, $4 TAG426: mtlo $4 sll $0, $0, 0 sll $0, $0, 0 mflo $1 TAG427: mflo $2 sra $2, $2, 15 nor $4, $2, $1 mult $1, $4 TAG428: div $4, $4 sll $0, $0, 0 sll $0, $0, 0 div $4, $4 TAG429: sll $0, $0, 0 andi $4, $4, 10 blez $4, TAG430 ori $3, $4, 0 TAG430: bgez $3, TAG431 sh $3, 0($3) bgtz $3, TAG431 sh $3, 0($3) TAG431: sw $3, 0($3) beq $3, $3, TAG432 multu $3, $3 divu $3, $3 TAG432: or $1, $3, $3 mult $3, $3 lui $3, 6 mfhi $2 TAG433: lhu $4, 0($2) andi $4, $4, 11 bltz $4, TAG434 mult $4, $4 TAG434: bgez $4, TAG435 lw $2, 0($4) sra $4, $2, 14 beq $4, $4, TAG435 TAG435: sub $3, $4, $4 bgez $4, TAG436 lhu $3, 0($4) divu $4, $4 TAG436: mthi $3 mfhi $4 bne $3, $3, TAG437 mflo $1 TAG437: mflo $1 sb $1, 0($1) lh $4, 0($1) xori $1, $1, 6 TAG438: srlv $1, $1, $1 addi $1, $1, 0 sb $1, 0($1) mflo $3 TAG439: bltz $3, TAG440 mthi $3 lb $4, 0($3) lui $2, 13 TAG440: srav $1, $2, $2 multu $1, $1 sll $0, $0, 0 mfhi $1 TAG441: beq $1, $1, TAG442 sb $1, -169($1) mflo $2 mtlo $2 TAG442: mtlo $2 div $2, $2 xor $3, $2, $2 lui $3, 11 TAG443: divu $3, $3 bgtz $3, TAG444 mthi $3 slt $4, $3, $3 TAG444: lb $1, 0($4) lui $4, 6 sll $0, $0, 0 bne $4, $1, TAG445 TAG445: nor $3, $2, $2 beq $2, $3, TAG446 sll $0, $0, 0 srlv $3, $2, $2 TAG446: blez $3, TAG447 sll $0, $0, 0 mult $3, $1 mfhi $3 TAG447: lui $1, 4 sltiu $1, $3, 10 sh $1, 1($3) lb $4, 0($1) TAG448: mflo $4 srl $1, $4, 13 mfhi $2 lui $1, 2 TAG449: xori $4, $1, 4 sll $0, $0, 0 sll $0, $0, 0 mtlo $4 TAG450: lui $3, 15 mflo $1 sll $0, $0, 0 andi $3, $3, 0 TAG451: multu $3, $3 sb $3, 0($3) srav $1, $3, $3 beq $3, $3, TAG452 TAG452: lbu $2, 0($1) mtlo $2 mult $2, $1 blez $2, TAG453 TAG453: lui $2, 10 mtlo $2 sll $0, $0, 0 lui $2, 12 TAG454: mfhi $2 bne $2, $2, TAG455 mtlo $2 blez $2, TAG455 TAG455: mflo $3 lui $3, 4 mflo $4 lui $2, 14 TAG456: addu $4, $2, $2 lui $1, 7 lui $1, 4 sll $0, $0, 0 TAG457: sll $0, $0, 0 mfhi $1 bne $1, $3, TAG458 mflo $1 TAG458: bltz $1, TAG459 addiu $4, $1, 5 lh $4, 0($1) nor $1, $1, $1 TAG459: sll $0, $0, 0 bltz $1, TAG460 mthi $1 blez $1, TAG460 TAG460: mfhi $1 mtlo $2 mfhi $1 lui $3, 13 TAG461: bne $3, $3, TAG462 multu $3, $3 mthi $3 beq $3, $3, TAG462 TAG462: mthi $3 lui $3, 7 andi $3, $3, 3 beq $3, $3, TAG463 TAG463: sra $2, $3, 12 addi $2, $2, 2 bne $3, $3, TAG464 lh $3, 0($2) TAG464: mtlo $3 mtlo $3 sb $3, 0($3) bgtz $3, TAG465 TAG465: lui $3, 7 beq $3, $3, TAG466 sll $0, $0, 0 mflo $3 TAG466: subu $2, $3, $3 mfhi $3 bgtz $3, TAG467 addu $2, $2, $3 TAG467: mtlo $2 sll $0, $0, 0 sll $0, $0, 0 bne $2, $2, TAG468 TAG468: divu $2, $2 subu $4, $2, $2 mfhi $4 sll $0, $0, 0 TAG469: sh $4, 0($4) blez $4, TAG470 mtlo $4 sb $4, 0($4) TAG470: lui $4, 9 lui $3, 13 mflo $2 mthi $4 TAG471: multu $2, $2 lb $2, 0($2) lb $4, 0($2) sllv $4, $2, $2 TAG472: beq $4, $4, TAG473 mtlo $4 bltz $4, TAG473 xori $3, $4, 3 TAG473: mthi $3 bne $3, $3, TAG474 mflo $3 mflo $2 TAG474: mtlo $2 lhu $3, 0($2) mflo $2 add $1, $3, $3 TAG475: beq $1, $1, TAG476 mthi $1 bgtz $1, TAG476 xori $2, $1, 7 TAG476: and $4, $2, $2 add $1, $4, $4 sb $1, 0($1) mfhi $3 TAG477: lui $1, 15 mtlo $1 mtlo $1 mflo $1 TAG478: sll $0, $0, 0 and $3, $4, $4 mult $4, $3 sra $1, $3, 2 TAG479: beq $1, $1, TAG480 multu $1, $1 div $1, $1 beq $1, $1, TAG480 TAG480: srlv $3, $1, $1 srl $3, $1, 1 bne $1, $3, TAG481 addiu $1, $3, 1 TAG481: lui $3, 13 sll $0, $0, 0 mtlo $3 beq $3, $1, TAG482 TAG482: mult $3, $3 beq $3, $3, TAG483 mtlo $3 lhu $1, 0($3) TAG483: sb $1, 0($1) sb $1, 0($1) lui $4, 0 beq $1, $4, TAG484 TAG484: lui $4, 13 blez $4, TAG485 div $4, $4 mfhi $1 TAG485: mfhi $3 mtlo $3 or $2, $3, $3 lui $4, 1 TAG486: lui $1, 4 bne $4, $1, TAG487 xor $4, $1, $4 lw $1, 0($4) TAG487: nor $1, $1, $1 sll $0, $0, 0 bltz $1, TAG488 mthi $1 TAG488: sll $0, $0, 0 sll $0, $0, 0 mtlo $1 blez $1, TAG489 TAG489: lw $2, 0($3) sw $2, -256($2) mfhi $2 divu $3, $2 TAG490: beq $2, $2, TAG491 sll $0, $0, 0 mult $2, $3 sh $2, 0($3) TAG491: bne $3, $3, TAG492 lui $4, 13 mult $3, $3 lui $2, 10 TAG492: slti $1, $2, 11 mthi $1 sll $0, $0, 0 sll $4, $1, 0 TAG493: mflo $3 sll $1, $4, 13 nor $3, $4, $1 bltz $4, TAG494 TAG494: srl $2, $3, 10 mfhi $2 sh $2, 1($3) mfhi $1 TAG495: sltiu $1, $1, 10 lbu $1, 0($1) bne $1, $1, TAG496 mthi $1 TAG496: sb $1, 0($1) sb $1, 0($1) lbu $4, 0($1) bltz $4, TAG497 TAG497: sll $4, $4, 8 mtlo $4 subu $1, $4, $4 sh $4, 0($4) TAG498: mtlo $1 mflo $1 addi $4, $1, 8 lui $4, 15 TAG499: ori $2, $4, 9 div $4, $2 bgez $2, TAG500 srav $1, $2, $2 TAG500: mflo $1 lui $4, 8 mflo $2 mtlo $1 TAG501: bne $2, $2, TAG502 mfhi $3 bgez $2, TAG502 slti $1, $2, 15 TAG502: mflo $1 sw $1, 0($1) beq $1, $1, TAG503 or $4, $1, $1 TAG503: lui $1, 13 mfhi $1 sll $0, $0, 0 lui $1, 0 TAG504: ori $1, $1, 12 addu $4, $1, $1 bltz $1, TAG505 sllv $3, $4, $4 TAG505: blez $3, TAG506 srl $2, $3, 2 sltiu $3, $2, 3 mtlo $3 TAG506: sub $3, $3, $3 xori $4, $3, 12 blez $3, TAG507 mfhi $3 TAG507: bltz $3, TAG508 xor $4, $3, $3 lb $1, 0($4) beq $3, $4, TAG508 TAG508: lui $1, 14 blez $1, TAG509 mfhi $3 bne $1, $3, TAG509 TAG509: subu $1, $3, $3 bgez $1, TAG510 lui $4, 4 lui $4, 15 TAG510: mthi $4 sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 TAG511: sll $0, $0, 0 sll $0, $0, 0 mtlo $3 divu $3, $3 TAG512: lui $2, 8 sll $0, $0, 0 mflo $1 bne $2, $2, TAG513 TAG513: mfhi $4 lui $4, 8 sll $0, $0, 0 addiu $4, $4, 3 TAG514: beq $4, $4, TAG515 mfhi $2 mtlo $4 lui $2, 15 TAG515: xor $1, $2, $2 multu $1, $1 lui $1, 12 sll $0, $0, 0 TAG516: sll $0, $0, 0 addu $2, $1, $1 lui $3, 15 sll $0, $0, 0 TAG517: srlv $3, $3, $3 sll $0, $0, 0 ori $1, $3, 11 div $3, $3 TAG518: bne $1, $1, TAG519 addiu $4, $1, 12 blez $4, TAG519 sll $0, $0, 0 TAG519: blez $4, TAG520 slti $3, $4, 9 sw $4, 0($3) bgtz $4, TAG520 TAG520: lw $1, 0($3) mtlo $1 sw $1, 0($3) addu $1, $3, $3 TAG521: mtlo $1 mtlo $1 sh $1, 0($1) blez $1, TAG522 TAG522: multu $1, $1 mtlo $1 lui $4, 0 lhu $4, 0($4) TAG523: lh $4, 0($4) mtlo $4 beq $4, $4, TAG524 sb $4, 0($4) TAG524: bne $4, $4, TAG525 xori $3, $4, 11 lh $1, 0($4) bgez $3, TAG525 TAG525: sub $4, $1, $1 srlv $4, $1, $1 subu $3, $4, $4 mtlo $1 TAG526: multu $3, $3 sh $3, 0($3) add $3, $3, $3 sh $3, 0($3) TAG527: lui $2, 14 bne $2, $2, TAG528 mtlo $2 blez $2, TAG528 TAG528: xori $1, $2, 13 mult $2, $1 sll $0, $0, 0 beq $2, $2, TAG529 TAG529: mfhi $4 blez $1, TAG530 slt $2, $4, $1 multu $2, $4 TAG530: mthi $2 bne $2, $2, TAG531 sltiu $4, $2, 15 lb $4, 0($4) TAG531: multu $4, $4 sw $4, 0($4) sh $4, 0($4) sh $4, 0($4) TAG532: ori $3, $4, 1 mtlo $4 bne $4, $3, TAG533 mthi $4 TAG533: lb $3, 0($3) bgtz $3, TAG534 lb $2, 0($3) mfhi $3 TAG534: xori $2, $3, 10 sllv $2, $3, $2 lbu $2, 0($3) sll $2, $2, 13 TAG535: sb $2, 0($2) addu $1, $2, $2 xor $4, $2, $2 beq $2, $4, TAG536 TAG536: srl $2, $4, 8 multu $4, $4 mthi $4 beq $4, $2, TAG537 TAG537: mfhi $1 bltz $2, TAG538 lui $4, 15 bne $2, $1, TAG538 TAG538: mfhi $4 lui $1, 5 multu $1, $4 multu $1, $4 TAG539: lui $4, 6 ori $1, $4, 1 sll $0, $0, 0 divu $1, $4 TAG540: mthi $4 slt $1, $4, $4 addiu $3, $4, 15 lui $3, 6 TAG541: mult $3, $3 sll $0, $0, 0 sll $0, $0, 0 lui $3, 8 TAG542: div $3, $3 bne $3, $3, TAG543 slt $3, $3, $3 blez $3, TAG543 TAG543: sltu $3, $3, $3 mthi $3 multu $3, $3 lui $3, 1 TAG544: mtlo $3 subu $4, $3, $3 srav $3, $4, $3 srl $4, $4, 1 TAG545: bne $4, $4, TAG546 mfhi $1 bgtz $4, TAG546 sw $4, 0($1) TAG546: mfhi $2 lui $4, 13 beq $1, $2, TAG547 sra $1, $1, 11 TAG547: multu $1, $1 lh $4, 0($1) lui $2, 6 or $2, $2, $4 TAG548: bne $2, $2, TAG549 sra $4, $2, 13 bgtz $4, TAG549 sll $0, $0, 0 TAG549: beq $4, $4, TAG550 sh $4, 0($4) sw $4, 0($4) lui $1, 10 TAG550: multu $1, $1 mult $1, $1 bne $1, $1, TAG551 lui $4, 0 TAG551: sh $4, 0($4) lui $1, 13 sw $1, 0($4) mfhi $4 TAG552: mult $4, $4 sltiu $1, $4, 5 mult $4, $1 mflo $2 TAG553: beq $2, $2, TAG554 sw $2, 0($2) lb $1, 0($2) mfhi $3 TAG554: bgtz $3, TAG555 addiu $1, $3, 6 divu $1, $1 lb $1, 0($3) TAG555: bgtz $1, TAG556 addiu $1, $1, 4 mfhi $3 bgez $1, TAG556 TAG556: sw $3, 0($3) bne $3, $3, TAG557 mult $3, $3 sw $3, 0($3) TAG557: bne $3, $3, TAG558 lui $3, 12 sll $0, $0, 0 div $3, $3 TAG558: beq $1, $1, TAG559 lw $3, 0($1) lui $4, 12 mtlo $3 TAG559: bgez $4, TAG560 mult $4, $4 mtlo $4 lhu $4, 0($4) TAG560: lh $1, 0($4) bltz $1, TAG561 multu $4, $1 mult $4, $1 TAG561: mfhi $2 lbu $1, 0($2) blez $1, TAG562 sub $4, $1, $1 TAG562: mflo $4 mflo $1 mult $1, $4 mflo $4 TAG563: mtlo $4 mtlo $4 sh $4, 0($4) lhu $4, 0($4) TAG564: mult $4, $4 blez $4, TAG565 mult $4, $4 add $1, $4, $4 TAG565: sw $1, 0($1) bne $1, $1, TAG566 ori $1, $1, 8 and $4, $1, $1 TAG566: or $2, $4, $4 lbu $2, 0($2) bne $2, $2, TAG567 mthi $4 TAG567: lui $1, 13 bltz $1, TAG568 lui $3, 10 sll $0, $0, 0 TAG568: bgtz $3, TAG569 srlv $1, $3, $3 sra $1, $3, 4 blez $3, TAG569 TAG569: lui $3, 15 beq $3, $1, TAG570 lui $3, 3 mflo $2 TAG570: sw $2, 0($2) bgtz $2, TAG571 lui $1, 0 lh $2, 0($2) TAG571: sll $1, $2, 6 sltu $2, $2, $2 add $2, $2, $2 mflo $1 TAG572: lhu $1, 0($1) lui $4, 12 mtlo $1 blez $1, TAG573 TAG573: slti $3, $4, 9 sltu $4, $3, $4 lui $4, 5 mtlo $4 TAG574: lui $1, 0 mthi $1 sra $2, $4, 14 bltz $2, TAG575 TAG575: mtlo $2 mult $2, $2 slt $1, $2, $2 mult $2, $1 TAG576: sltu $4, $1, $1 sh $1, 0($1) beq $1, $4, TAG577 lui $2, 4 TAG577: sll $0, $0, 0 sll $0, $0, 0 subu $3, $2, $2 div $2, $2 TAG578: lw $3, 0($3) bgez $3, TAG579 sra $4, $3, 9 sh $4, 0($3) TAG579: lb $2, 0($4) beq $2, $4, TAG580 mflo $1 lh $1, 0($4) TAG580: lui $1, 7 lui $2, 9 nor $4, $2, $1 sll $0, $0, 0 TAG581: multu $3, $3 bne $3, $3, TAG582 lui $2, 11 lui $3, 10 TAG582: bne $3, $3, TAG583 xori $2, $3, 7 nor $3, $3, $3 srav $1, $2, $3 TAG583: lhu $1, 0($1) lui $2, 9 beq $1, $2, TAG584 mthi $2 TAG584: sltu $3, $2, $2 lui $4, 5 lui $2, 11 sllv $4, $2, $2 TAG585: bne $4, $4, TAG586 sll $0, $0, 0 sll $0, $0, 0 bne $4, $4, TAG586 TAG586: subu $2, $4, $4 multu $4, $2 sltiu $2, $2, 6 mfhi $4 TAG587: bne $4, $4, TAG588 sb $4, 0($4) multu $4, $4 lh $3, 0($4) TAG588: sw $3, 0($3) lh $3, 0($3) lhu $2, 0($3) mflo $3 TAG589: sb $3, 0($3) lhu $4, 0($3) lui $3, 12 xori $1, $3, 14 TAG590: mfhi $3 sb $3, 0($3) mflo $3 sb $3, 0($3) TAG591: mult $3, $3 blez $3, TAG592 lui $2, 15 bne $2, $3, TAG592 TAG592: sll $0, $0, 0 mflo $3 beq $3, $3, TAG593 mult $3, $3 TAG593: lw $3, 0($3) lb $1, 0($3) mfhi $1 bne $3, $1, TAG594 TAG594: mflo $3 mtlo $3 lbu $1, 0($3) bne $3, $1, TAG595 TAG595: lhu $3, 0($1) lw $3, 0($1) sh $3, 0($1) mflo $4 TAG596: multu $4, $4 beq $4, $4, TAG597 mthi $4 mthi $4 TAG597: beq $4, $4, TAG598 xori $3, $4, 2 lh $3, 0($3) lhu $3, 0($3) TAG598: bne $3, $3, TAG599 mtlo $3 bne $3, $3, TAG599 mfhi $2 TAG599: mthi $2 mflo $2 bgtz $2, TAG600 sb $2, 0($2) TAG600: lhu $4, 0($2) lui $4, 10 lh $3, 0($2) lui $2, 3 TAG601: sll $0, $0, 0 addiu $2, $2, 9 mtlo $2 beq $2, $2, TAG602 TAG602: slti $3, $2, 12 bgez $2, TAG603 or $2, $3, $2 lh $3, 0($2) TAG603: sh $3, 0($3) mthi $3 mult $3, $3 bltz $3, TAG604 TAG604: or $2, $3, $3 mult $3, $3 bltz $3, TAG605 lw $4, 0($3) TAG605: mflo $1 sltiu $2, $1, 9 ori $3, $1, 13 mtlo $4 TAG606: bgez $3, TAG607 mtlo $3 srav $4, $3, $3 lb $3, 0($4) TAG607: slt $1, $3, $3 mflo $3 lb $3, 0($3) sh $3, 0($3) TAG608: multu $3, $3 sw $3, 0($3) mthi $3 nor $4, $3, $3 TAG609: div $4, $4 sw $4, 1($4) lui $2, 8 multu $4, $2 TAG610: div $2, $2 sll $0, $0, 0 sll $0, $0, 0 addiu $4, $4, 15 TAG611: sb $4, 0($4) sh $4, 0($4) mtlo $4 lui $3, 7 TAG612: mult $3, $3 bne $3, $3, TAG613 lui $4, 11 beq $3, $4, TAG613 TAG613: mflo $4 mtlo $4 ori $4, $4, 9 mfhi $1 TAG614: lb $4, 0($1) add $2, $4, $4 mtlo $2 lbu $4, 0($1) TAG615: multu $4, $4 blez $4, TAG616 nor $3, $4, $4 lui $1, 4 TAG616: sb $1, 0($1) lbu $2, 0($1) mtlo $2 lbu $1, 0($2) TAG617: lb $1, 0($1) mthi $1 bgez $1, TAG618 sb $1, 0($1) TAG618: lb $2, 0($1) mflo $4 mflo $4 addiu $3, $4, 10 TAG619: blez $3, TAG620 divu $3, $3 mfhi $4 sb $3, 0($3) TAG620: bne $4, $4, TAG621 subu $1, $4, $4 mult $4, $1 lb $2, 0($1) TAG621: srav $2, $2, $2 mflo $3 lb $1, 1($2) lhu $4, 1($2) TAG622: bltz $4, TAG623 addiu $2, $4, 2 xori $1, $4, 14 multu $1, $4 TAG623: divu $1, $1 srl $1, $1, 13 divu $1, $1 srl $3, $1, 13 TAG624: blez $3, TAG625 mflo $2 slti $1, $2, 2 mflo $3 TAG625: mtlo $3 lh $3, 0($3) sw $3, 1($3) bne $3, $3, TAG626 TAG626: mtlo $3 sltiu $4, $3, 3 lui $1, 0 sllv $1, $1, $1 TAG627: bne $1, $1, TAG628 mflo $2 lhu $3, 1($2) mfhi $4 TAG628: bltz $4, TAG629 lhu $3, 0($4) mtlo $4 slt $2, $4, $4 TAG629: mtlo $2 sll $3, $2, 9 bne $2, $2, TAG630 mult $2, $3 TAG630: lb $3, 0($3) div $3, $3 mfhi $1 xor $2, $3, $3 TAG631: mthi $2 sw $2, 0($2) beq $2, $2, TAG632 xori $4, $2, 1 TAG632: lb $3, 0($4) xori $2, $4, 6 bgtz $2, TAG633 lbu $2, 0($3) TAG633: nor $4, $2, $2 multu $2, $2 multu $2, $4 slti $4, $4, 5 TAG634: subu $4, $4, $4 slt $4, $4, $4 lw $3, 0($4) sh $3, 0($3) TAG635: mtlo $3 mult $3, $3 lui $1, 4 lui $1, 9 TAG636: div $1, $1 mflo $4 mthi $1 sll $0, $0, 0 TAG637: lui $3, 13 mflo $4 mflo $2 slti $4, $3, 12 TAG638: lui $2, 1 lui $3, 10 mthi $3 andi $4, $4, 2 TAG639: mthi $4 bgez $4, TAG640 lb $1, 0($4) sllv $3, $4, $4 TAG640: bltz $3, TAG641 mtlo $3 sll $0, $0, 0 srl $2, $3, 5 TAG641: mfhi $2 mtlo $2 multu $2, $2 mfhi $3 TAG642: bne $3, $3, TAG643 mthi $3 multu $3, $3 lb $1, 0($3) TAG643: mult $1, $1 multu $1, $1 mult $1, $1 srl $4, $1, 0 TAG644: mfhi $1 sll $3, $1, 6 mflo $4 sw $4, 0($1) TAG645: slt $4, $4, $4 bne $4, $4, TAG646 multu $4, $4 sh $4, 0($4) TAG646: mult $4, $4 beq $4, $4, TAG647 addi $2, $4, 15 mtlo $4 TAG647: sb $2, 0($2) lbu $1, 0($2) lbu $2, 0($2) or $2, $1, $1 TAG648: lb $1, 0($2) lui $2, 12 lui $2, 4 beq $2, $2, TAG649 TAG649: lui $2, 2 sll $0, $0, 0 sll $0, $0, 0 lui $2, 1 TAG650: addu $4, $2, $2 srav $4, $2, $4 lui $4, 1 addiu $1, $4, 2 TAG651: ori $2, $1, 1 mtlo $2 sll $0, $0, 0 multu $2, $1 TAG652: nor $2, $2, $2 blez $2, TAG653 mtlo $2 bne $2, $2, TAG653 TAG653: lui $2, 3 sll $0, $0, 0 mthi $2 bne $2, $2, TAG654 TAG654: mthi $2 sll $0, $0, 0 bne $4, $2, TAG655 sll $2, $4, 4 TAG655: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 TAG656: subu $3, $4, $4 lui $2, 12 mflo $4 blez $2, TAG657 TAG657: sra $1, $4, 0 div $1, $1 divu $1, $4 sll $0, $0, 0 TAG658: sll $0, $0, 0 mtlo $1 sll $0, $0, 0 mflo $3 TAG659: xori $3, $3, 15 sra $3, $3, 12 beq $3, $3, TAG660 lui $1, 3 TAG660: lui $4, 7 lui $4, 4 lui $1, 0 sll $0, $0, 0 TAG661: mfhi $4 sb $4, 0($4) lh $2, 0($4) mfhi $2 TAG662: mflo $1 sltiu $4, $1, 7 blez $1, TAG663 mult $4, $2 TAG663: slti $4, $4, 13 xori $1, $4, 7 addiu $1, $4, 7 subu $1, $1, $4 TAG664: beq $1, $1, TAG665 nor $2, $1, $1 mflo $3 mflo $1 TAG665: sb $1, 0($1) lbu $2, 0($1) sltiu $2, $1, 9 mflo $1 TAG666: bltz $1, TAG667 lh $1, 0($1) xor $4, $1, $1 bgtz $4, TAG667 TAG667: multu $4, $4 blez $4, TAG668 lhu $4, 0($4) sll $1, $4, 9 TAG668: mflo $4 srl $2, $4, 0 lbu $4, 0($1) addi $1, $4, 1 TAG669: beq $1, $1, TAG670 sb $1, 0($1) mfhi $3 slti $1, $1, 12 TAG670: lbu $4, 0($1) or $2, $4, $1 sb $1, 0($1) mflo $2 TAG671: mfhi $2 multu $2, $2 mthi $2 sub $4, $2, $2 TAG672: bltz $4, TAG673 srav $3, $4, $4 sltiu $1, $3, 3 lbu $4, 0($3) TAG673: beq $4, $4, TAG674 mflo $4 sb $4, 0($4) bgez $4, TAG674 TAG674: mthi $4 lbu $4, 0($4) blez $4, TAG675 or $4, $4, $4 TAG675: multu $4, $4 multu $4, $4 sw $4, 0($4) mfhi $3 TAG676: bltz $3, TAG677 lui $2, 5 srl $1, $2, 12 lui $2, 12 TAG677: ori $4, $2, 0 lui $2, 3 mthi $2 bne $2, $2, TAG678 TAG678: mthi $2 sll $0, $0, 0 lw $2, 0($1) add $2, $2, $2 TAG679: addi $1, $2, 14 mflo $2 bne $1, $2, TAG680 sll $4, $2, 12 TAG680: lbu $3, 0($4) bgtz $4, TAG681 xor $4, $3, $4 bne $4, $4, TAG681 TAG681: lui $4, 4 sll $0, $0, 0 srl $3, $4, 13 sb $4, 0($3) TAG682: addu $4, $3, $3 lbu $4, 0($3) sllv $1, $4, $3 lh $3, 0($4) TAG683: mtlo $3 addi $3, $3, 12 slt $2, $3, $3 div $3, $3 TAG684: ori $1, $2, 12 mthi $1 sw $1, 0($2) mtlo $1 TAG685: sh $1, 0($1) ori $1, $1, 3 lb $4, 0($1) sb $1, 0($1) TAG686: sllv $4, $4, $4 sll $0, $0, 0 lui $4, 4 sltu $1, $4, $4 TAG687: nor $4, $1, $1 blez $1, TAG688 subu $2, $4, $4 ori $3, $4, 13 TAG688: sllv $1, $3, $3 nor $1, $3, $1 mflo $3 lui $3, 7 TAG689: div $3, $3 mfhi $2 mult $2, $3 and $3, $2, $3 TAG690: addiu $3, $3, 6 beq $3, $3, TAG691 lui $2, 9 divu $2, $3 TAG691: addiu $3, $2, 10 lui $1, 13 mtlo $1 bgez $3, TAG692 TAG692: lui $3, 9 mult $3, $1 mult $1, $3 mthi $3 TAG693: ori $3, $3, 4 sll $0, $0, 0 sltu $2, $3, $3 mflo $4 TAG694: blez $4, TAG695 lui $1, 13 bne $1, $4, TAG695 lb $1, 0($4) TAG695: ori $3, $1, 0 mtlo $1 sll $0, $0, 0 blez $1, TAG696 TAG696: mfhi $4 sll $0, $0, 0 bne $4, $1, TAG697 mfhi $2 TAG697: divu $2, $2 addiu $3, $2, 3 sltu $2, $3, $2 bgtz $2, TAG698 TAG698: sb $2, 0($2) mtlo $2 bgez $2, TAG699 mtlo $2 TAG699: mult $2, $2 mfhi $4 mflo $3 lui $1, 15 TAG700: sll $0, $0, 0 blez $1, TAG701 andi $4, $1, 4 bltz $4, TAG701 TAG701: sb $4, 0($4) bltz $4, TAG702 andi $2, $4, 5 sw $4, 0($2) TAG702: lh $3, 0($2) lui $2, 15 addu $4, $2, $2 lui $4, 5 TAG703: mtlo $4 addiu $4, $4, 14 divu $4, $4 bltz $4, TAG704 TAG704: sll $0, $0, 0 subu $2, $4, $4 lui $2, 14 sll $0, $0, 0 TAG705: mfhi $2 mflo $2 and $1, $2, $2 bgez $1, TAG706 TAG706: div $1, $1 ori $2, $1, 9 mfhi $2 sb $2, 0($1) TAG707: sw $2, 0($2) lh $1, 0($2) xori $3, $1, 7 lui $1, 3 TAG708: bne $1, $1, TAG709 lui $1, 3 lui $2, 15 divu $1, $1 TAG709: addu $4, $2, $2 bne $2, $2, TAG710 sll $0, $0, 0 mflo $2 TAG710: sb $2, 0($2) beq $2, $2, TAG711 mthi $2 srl $1, $2, 11 TAG711: lui $2, 12 mfhi $3 sllv $3, $2, $2 slt $2, $1, $2 TAG712: divu $2, $2 lui $3, 5 lb $4, 0($2) multu $2, $2 TAG713: beq $4, $4, TAG714 mfhi $3 lui $3, 3 lui $2, 15 TAG714: lb $4, 0($2) lui $2, 12 sra $2, $4, 7 mtlo $2 TAG715: mtlo $2 beq $2, $2, TAG716 lb $4, 0($2) mfhi $1 TAG716: addu $1, $1, $1 sra $1, $1, 5 blez $1, TAG717 sw $1, -12288($1) TAG717: mthi $1 lui $2, 3 beq $2, $2, TAG718 mfhi $4 TAG718: lui $2, 14 mflo $4 bgez $4, TAG719 multu $4, $2 TAG719: beq $4, $4, TAG720 or $3, $4, $4 mtlo $4 bne $4, $4, TAG720 TAG720: mfhi $3 sh $3, 0($3) bne $3, $3, TAG721 mfhi $1 TAG721: addu $4, $1, $1 or $4, $1, $4 sb $1, 0($4) lui $3, 5 TAG722: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 mflo $4 TAG723: mthi $4 bgtz $4, TAG724 mult $4, $4 multu $4, $4 TAG724: blez $4, TAG725 mthi $4 sw $4, 0($4) lui $4, 7 TAG725: mthi $4 lui $2, 15 addu $2, $4, $2 bne $2, $2, TAG726 TAG726: xori $3, $2, 8 mfhi $4 bltz $3, TAG727 mtlo $4 TAG727: sb $4, 0($4) beq $4, $4, TAG728 sh $4, 0($4) lui $3, 6 TAG728: bne $3, $3, TAG729 sll $0, $0, 0 lui $4, 15 bltz $2, TAG729 TAG729: div $4, $4 bltz $4, TAG730 sll $0, $0, 0 mtlo $2 TAG730: sll $0, $0, 0 addu $3, $2, $2 bne $3, $3, TAG731 xor $2, $1, $3 TAG731: slti $3, $2, 11 sra $1, $3, 12 lui $1, 3 sll $0, $0, 0 TAG732: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 beq $4, $4, TAG733 TAG733: sllv $2, $4, $4 sll $0, $0, 0 mult $2, $2 mthi $4 TAG734: addu $3, $2, $2 bne $2, $3, TAG735 mthi $2 nor $3, $3, $2 TAG735: mult $3, $3 divu $3, $3 blez $3, TAG736 sll $0, $0, 0 TAG736: blez $2, TAG737 sll $0, $0, 0 beq $1, $2, TAG737 mtlo $1 TAG737: mtlo $1 addu $2, $1, $1 bne $2, $1, TAG738 addu $4, $1, $1 TAG738: lui $1, 12 multu $4, $1 lui $3, 3 lui $1, 8 TAG739: mthi $1 bltz $1, TAG740 sll $0, $0, 0 ori $2, $1, 3 TAG740: sltiu $3, $2, 12 sra $2, $2, 10 mult $3, $3 bne $3, $3, TAG741 TAG741: sb $2, -512($2) lhu $2, -512($2) sw $2, 0($2) sltiu $3, $2, 7 TAG742: beq $3, $3, TAG743 mfhi $3 lhu $1, 0($3) mult $3, $3 TAG743: nor $1, $1, $1 multu $1, $1 sll $0, $0, 0 sll $0, $0, 0 TAG744: bgez $1, TAG745 sll $0, $0, 0 mflo $4 multu $1, $4 TAG745: sll $0, $0, 0 beq $4, $4, TAG746 sll $0, $0, 0 bltz $4, TAG746 TAG746: lui $2, 8 sll $0, $0, 0 mtlo $4 sll $0, $0, 0 TAG747: sll $0, $0, 0 addu $1, $2, $2 lui $3, 6 mtlo $1 TAG748: andi $4, $3, 1 mflo $4 sllv $2, $4, $3 sll $3, $4, 11 TAG749: divu $3, $3 xori $1, $3, 8 sll $0, $0, 0 sll $0, $0, 0 TAG750: nop nop test_end: beq $0, $0, test_end nop
bddisasm_test/avx/f16c_64.asm
andreaswimmer/bddisasm
675
86328
<filename>bddisasm_test/avx/f16c_64.asm bits 64 vcvtph2ps xmm7,xmm13 vcvtph2ps ymm7,xmm13 vcvtps2ph xmm13,xmm7,10 vcvtps2ph xmm13,ymm7,10 vcvtph2ps xmm7,[rbx] vcvtph2ps ymm7,[rbx] vcvtps2ph [rbx],xmm7,10 vcvtps2ph [rbx],ymm7,10
src/main/antlr4/yaal/yaal.g4
bolilla/yaal
4
5427
<reponame>bolilla/yaal<gh_stars>1-10 /** * YAAL Grammar */ grammar yaal; options { language = Java; } /**There is only one policy, which is composed by one or more rules*/ policy : 'policy' ID ( '(' combining_algo ')' )? 'begin' pol_rule+ 'end' ; /**How to decide which rule to apply*/ combining_algo : 'Deny-overrides' | 'Ordered-deny-overrides' //Default value | 'Permit-overrides' | 'Ordered-permit-overrides' | 'Deny-unless-permit' | 'Permit-unless-deny' | 'First-applicable' | 'Only-one-applicable' | 'Custom-combining-algorithm' ':' ID //In case of using a non-standard algorithm ; /** One rule of the policy. action is PERMIT by default. Target and condition are optional*/ pol_rule : 'rule' ID ( '(' action_id ')' )? 'begin' ( 'target' condition )? ( condition )? 'end' ; /** This applies to target and condition indistinctly. This is valid if you use YAAL as an * understanding tool, but it does not suffice to generate XACML code */ condition : '(' condition ')' | 'not' condition | condition bool_op condition | condition bool_comp condition | arit_val arit_comp arit_val | str_val str_comp str_val | bool_val ; /** Possible actions to be defined */ action_id : 'PERMIT' | 'DENY' ; /** Boolean operations */ bool_op : 'AND' | 'OR' ; /** Boolean comparators */ bool_comp : '=' | '!=' ; /** Arithmetic values */ arit_val : '(' arit_val ')' | NUM | categ_attr | arit_val arit_op arit_val ; /** Arithmetic operator */ arit_op : ( '+' | '-' | '^' | '*' | '/' | '%' ) ; /** Arithmetic comparators */ arit_comp : '=' | '!=' | '<' | '>' | '>=' | '<=' ; /** Boolean values */ bool_val : 'TRUE' | 'FALSE' ; /** Attribute associated to a category */ categ_attr : ID '.' ID ; /** String value */ str_val : categ_attr | STRING ; /** String comparator */ str_comp : '=' | '<>' ; /** Identifier */ ID : LETTER ( LETTER | NUM | '_' )* ; /** Upper or lower case letter */ LETTER : ( [a-z] | [A-Z] ) ; /** Number (base ten) */ NUM : [0-9]+ ; /** White Space */ WS : [ \t\r\n]+ -> skip ; /** String */ STRING : '"' ( ESC | ~[\\"] )* '"' ; /** Scape characters */ ESC : '\\"' | '\\\\' ; /** Sections to ignore */ Comment : '#' ~( '\r' | '\n' )* -> skip ;
assembler/forth/bus.asm
MRebhan/RetroComputers-XC8010
2
19406
dcode BA!,3,,BUS_SETADDR ; ( addr -- ) pla mmu $00 nxt dcode BA@,3,,BUS_GETADDR ; ( -- addr ) mmu $80 pha nxt dcode BW!,3,,BUS_SETWIN ; ( win -- ) pla mmu $01 nxt dcode BW@,3,,BUS_GETWIN ; ( win -- ) mmu $81 pha nxt dword BUS!,4,,BUS_POKE ; ( value addr -- ) .wp BUS_GETWIN .wp ADD .wp POKE .wp EXIT dword BUS@,4,,BUS_PEEK ; ( addr -- value ) .wp BUS_GETWIN .wp ADD .wp PEEK .wp EXIT dword BUSC!,5,,BUS_POKEBYTE ; ( value addr -- ) .wp BUS_GETWIN .wp ADD .wp POKEBYTE .wp EXIT dword BUSC@,5,,BUS_PEEKBYTE ; ( addr -- value ) .wp BUS_GETWIN .wp ADD .wp PEEKBYTE .wp EXIT
libsrc/_DEVELOPMENT/adt/b_array/c/sdcc_iy/b_array_append_block_callee.asm
meesokim/z88dk
0
81553
; void *b_array_append_block_callee(b_array_t *a, size_t n) SECTION code_adt_b_array PUBLIC _b_array_append_block_callee, l0_b_array_append_block_callee EXTERN error_zc _b_array_append_block_callee: pop af pop hl pop de push af l0_b_array_append_block_callee: call asm_b_array_append_block ret nc jp error_zc INCLUDE "adt/b_array/z80/asm_b_array_append_block.asm"
Ada/src/Problem_55.adb
Tim-Tom/project-euler
0
17798
with Ada.Text_IO; with BigInteger; package body Problem_55 is package IO renames Ada.Text_IO; type Lychrel is (Unknown, True, False); Is_Lychrel_Cache : Array (Long_Long_Integer range 1 .. 10_000) of Lychrel := (others => Unknown); function Reverse_String(input : string) return String is result : string(input'Range); begin for i in input'range loop result(result'Last - i + input'First) := input(i); end loop; return result; end Reverse_String; function Is_Lychrel(num : Integer) return Boolean is function "+"(left, right : BigInteger.BigInt) return BigInteger.BigInt renames BigInteger."+"; function Check_Lychrel(num : BigInteger.BigInt; count : Positive) return Lychrel is procedure Reverse_Big_Int(reversed : out BigInteger.BigInt; same : out Boolean) is str : constant String := BigInteger.ToString(num); rev : constant String := Reverse_String(str); begin if str = rev then same := True; else same := False; reversed := BigInteger.Create(rev); end if; end; reversed : BigInteger.BigInt; same : Boolean; begin if count = 50 then return False; else Reverse_Big_Int(reversed, same); if same then return True; else return Check_Lychrel(reversed + num, count + 1); end if; end if; end Check_Lychrel; function Check_Lychrel(num : Long_Long_Integer; count : Natural) return Lychrel is function Reverse_Num return Long_Long_Integer is part : Long_Long_Integer := num; reversed : Long_Long_Integer := 0; begin while part > 0 loop reversed := reversed * 10 + (part mod 10); part := part / 10; end loop; return reversed; end; function Insert_Cache(result : Lychrel) return Lychrel is begin if num <= Is_Lychrel_Cache'Last then Is_Lychrel_Cache(num) := result; end if; return result; end Insert_Cache; begin if num <= Is_Lychrel_Cache'Last and then Is_Lychrel_Cache(num) /= Unknown then return Is_Lychrel_Cache(num); elsif count = 50 then return Insert_Cache(False); else declare reversed : constant Long_Long_Integer := Reverse_Num; begin if count > 1 and reversed = num then return True; elsif Long_Long_Integer'Last - num > reversed then return Insert_Cache(Check_Lychrel(num + reversed, count + 1)); else return Check_Lychrel(BigInteger.Create(num) + BigInteger.Create(reversed), count + 1); end if; end; end if; end Check_Lychrel; begin case(Check_Lychrel(Long_Long_Integer(num), 0)) is when True => return True; when False => return False; when Others => raise Constraint_Error; end case; end Is_Lychrel; procedure Solve is count : Natural := 0; begin for num in 1 .. 10_000 loop if Is_Lychrel(num) then count := count + 1; else null; end if; end loop; IO.Put(Natural'Image(count)); end Solve; end Problem_55;
maps/TVStation4F.asm
AtmaBuster/pokeplat-gen2
6
92778
<reponame>AtmaBuster/pokeplat-gen2 object_const_def ; object_event constants TVStation4F_MapScripts: db 0 ; scene scripts db 0 ; callbacks TVStation4F_MottoWomanScript: jumptextfaceplayer .Text .Text: text "“Participation for" line "all” is our TV" cont "network's motto." done TVStation4F_ThemeWomanScript: jumptextfaceplayer .Text .Text: text "We're promoting the" line "theme “Smiles are" cont "dreamy.”" para "In keeping with" line "that name, we've" cont "added variety" cont "programs to our" cont "schedule." para "Please do tune in!" done TVStation4F_ExploitsGuyScript: jumptextfaceplayer .Text .Text: text "Your exploits are" line "fantastic!" para "With our TV" line "station, we can" cont "tell the whole" cont "world about you!" para "It's one of many" line "possibilities!" para "Harrumph!" done TVStation4F_MapEvents: db 0, 0 ; filler db 2 ; warp events warp_event 5, 0, TV_STATION_3F, 2 warp_event 11, 0, TV_STATION_ELEVATOR, 1 db 0 ; coord events db 0 ; bg events db 3 ; object events object_event 8, 2, SPRITE_RECEPTIONIST, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 1, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, TVStation4F_MottoWomanScript, -1 object_event 11, 7, SPRITE_TEACHER, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, TVStation4F_ThemeWomanScript, -1 object_event 4, 6, SPRITE_POKEFAN_M, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, TVStation4F_ExploitsGuyScript, -1
programs/oeis/320/A320431.asm
neoneye/loda
22
12208
; A320431: The number of tiles inside a regular n-gon created by lines that run from each of the vertices of the n edges orthogonal to these edges. ; 1,1,31,13,71,25,127,41,199,61,287,85,391,113,511,145,647,181,799,221,967,265,1151,313,1351,365,1567,421,1799,481,2047,545,2311,613,2591,685,2887,761,3199,841,3527,925,3871,1013,4231,1105,4607,1201,4999,1301,5407,1405,5831,1513,6271,1625,6727,1741 add $0,2 pow $0,2 sub $0,1 dif $0,4 lpb $0 bin $0,4 lpe mul $0,2 add $0,1
programs/oeis/262/A262302.asm
neoneye/loda
22
96533
<filename>programs/oeis/262/A262302.asm<gh_stars>10-100 ; A262302: Rainbow index for n-th odd prime. ; 3,4,4,5,5,6,6,6,6,6,6,6,6 sub $0,7 mov $1,-1 trn $1,$0 div $1,-2 add $1,6 mov $0,$1
programs/oeis/242/A242602.asm
jmorken/loda
1
172367
; A242602: Integers repeated thrice in a canonical order. ; 0,0,0,1,1,1,-1,-1,-1,2,2,2,-2,-2,-2,3,3,3,-3,-3,-3,4,4,4,-4,-4,-4,5,5,5,-5,-5,-5,6,6,6,-6,-6,-6,7,7,7,-7,-7,-7,8,8,8,-8,-8,-8,9,9,9,-9,-9,-9,10,10,10,-10,-10,-10,11,11,11,-11,-11,-11,12,12,12,-12,-12,-12,13,13,13,-13,-13,-13,14,14,14,-14,-14,-14 mul $0,2 div $0,6 mov $1,$0 add $1,2 mov $2,4 mov $4,2 lpb $1 lpb $4 sub $2,$1 add $2,$4 mov $3,$2 sub $4,$1 mod $4,2 lpe sub $3,2 mov $1,$3 sub $1,1 lpe mul $1,2 sub $1,2 div $1,4
Octavo/Assembler/benchmarks/hailstone-arrays/hailstone-arrays.asm
laforest/Octavo
63
245342
# Assembly code for Hailstone benchmark and initial test # If x is odd, x = (3x+1)/2, else x = x / 2 # Rough syntax: if the first word is not a recognized command, it's a label for # the next word, which is a command, followed by its arguments. # Common library of definitions include ../common/opcodes.asm include ../common/conditions.asm # Shared variables across all threads lsb_mask shared 0xFFFFFFFFE # Counter values must be N-1 for N passes seeds_len shared 2 # name I/O port memory and number seed_out port A 0 # Common private variables (pointer is common, but init creates per-thread data) threads 0 1 2 3 4 5 6 7 seed private 0 newseed private 0 # base_addr increment offset seeds_rd pointer seeds 1 0 seeds_wr pointer seeds 1 0 # Private to each thread as separate data memory copies threads 0 seeds private 41 47 54 threads 1 seeds private 55 62 71 threads 2 seeds private 73 82 83 threads 3 seeds private 91 94 95 threads 4 seeds private 97 103 107 threads 5 seeds private 108 109 110 threads 6 seeds private 121 124 125 threads 7 seeds private 126 129 137 # Code # Runtime code is thread-agnostic, but the assembler needs to know # which thread(s) code will run in to manage the correct list of opcodes # when loading them. threads 0 1 2 3 4 5 6 7 # These are baked into the Opcode Decoder memory preload nop add # These are loaded at runtime start load sub load psr load add*2 load add/2 load add/2u init even # Init branch init output # Init branch init next_seed # Init branch hailstone init seeds_rd # Init read pointer to start of array init seeds_wr # Init write pointer to start of array init hailstone # Init loop counter branch to length of array next_seed add seed seeds_rd 0 # Load x # Odd case: y = (3x+1)/2 add*2 newseed seed 0 # y = (x+0)*2 (2x) bsa not_taken 0 lsb_mask even # Branch and cancel add*2 if loaded x (seed) was an even number (LSB == 0) add newseed seed newseed # y = (x+y) (3x) add/2u newseed 1 newseed # y = (1+y)/2 (3x+1)/2 jmp taken output # Go output the number # Even case: y = x/2 even add/2u newseed seed 0 # y = (x+0)/2 (x/2) nop 0 0 0 # even out cycle count of even/odd cases (to keep thread output in order) output add seeds_wr 0 newseed # x = 0+y add seed_out 0 newseed # output port = 0+x ctz unpredicted seeds_len hailstone # Start over if we've processed whole array jmp unpredicted next_seed # else, process the next array element # Set starting point (PC) for each thread program_counter start start start start start start start start
Practica 03/Planificador_Ciclico_Con_Prioridades/src/planificador_ciclico_con_prioridades.adb
dpr1005/Tiempo-Real-Ejercicios
0
6918
with Ada.Text_IO, Ada.Calendar, System; use Ada.Text_IO, Ada.Calendar, System; procedure Planificador_Ciclico_Con_Prioridades is Comienzo : Time := Clock; -- hora de comienzo -- Tarea principal task Principal is entry Ejecutar (Id: in Integer; Tiempo : in Integer); end Principal; task body Principal is Semaforo : Integer := 1; begin Put_Line("Principal - preparada"); loop select when Semaforo = 1 => accept Ejecutar (Id : in Integer; Tiempo : in Integer) do Semaforo := 0; Put_Line("+++Inicio Tarea" & Integer'Image(Id) & " " & Duration'Image(Clock-Comienzo)); delay Duration(Tiempo); Put_Line("+++Fin Tarea" & Integer'Image(Id) & " " & Duration'Image(Clock-Comienzo)); Semaforo := 1; end Ejecutar; end select; end loop; end Principal; -- Tareas dinamicas periodicas del planificador task type Tarea_Periodica(Id: Integer; T: Integer; D: Integer; C: Integer; Pri: System.Priority) is pragma Priority(Pri); end Tarea_Periodica; type Tarea_Dinamica is access Tarea_Periodica; -- Cuerpo de las Tareas Periodicas task body Tarea_Periodica is Periodo : constant Duration := Duration(T); -- Segundos Proximo_Periodo : Time := Clock; begin Loopgg -- Acciones Tarea Principal.Ejecutar(Id, C); -- Calculo del tiempo de nueva accion Proximo_Periodo := Proximo_Periodo + Periodo; delay until Proximo_Periodo; end loop; end Tarea_Periodica; -- Definicion de las tareas Tarea_1 : Tarea_Dinamica; Tarea_2 : Tarea_Dinamica; Tarea_3 : Tarea_Dinamica; begin Put_Line("Inicio Planificador con prioridades"); -- Inicio de las tareas (Id, Periodo, Plazo, Tiempo de Ejecucion, Prioridad) Tarea_1 := new Tarea_Periodica(1, 4, 4, 1, 6); Tarea_2 := new Tarea_Periodica(2, 5, 5, 2, 9); Tarea_3 := new Tarea_Periodica(3, 10, 10, 1, 12); end Planificador_Ciclico_Con_Prioridades;
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_19193_1363.asm
ljhsiun2/medusa
9
240506
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r8 push %r9 push %rbp push %rdx lea addresses_D_ht+0x1c289, %r10 nop nop and %rdx, %rdx movw $0x6162, (%r10) nop nop nop nop inc %r8 lea addresses_WT_ht+0x8fd1, %r11 nop sub $57677, %rbp movups (%r11), %xmm2 vpextrq $0, %xmm2, %r9 nop xor $27277, %r11 lea addresses_D_ht+0x76a9, %rdx sub $54220, %r11 movb (%rdx), %r10b sub $39595, %r9 pop %rdx pop %rbp pop %r9 pop %r8 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %r8 push %rdi // Faulty Load lea addresses_RW+0x9429, %rdi nop nop nop nop inc %r8 movups (%rdi), %xmm3 vpextrq $0, %xmm3, %r10 lea oracles, %r12 and $0xff, %r10 shlq $12, %r10 mov (%r12,%r10,1), %r10 pop %rdi pop %r8 pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'32': 19193} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
oeis/061/A061253.asm
neoneye/loda-programs
11
19177
; A061253: Let G_n be the elementary Abelian group G_n = (C_3)^n; a(n) is the number of times the number 1 appears in the character table of G_n. ; 5,33,261,2241,19845,177633,1595781,14353281,129153285,1162300833,10460471301,94143533121,847289672325,7625600673633,68630386930821,617673424981761,5559060652648965,50031545357280033,450283906665838341,4052555155343499201,36472996384144355205,328256967415457784033,2954312706613595817861,26588814359145789645441,239299329231182388663045,2153693963077252343529633,19383245667685103628453381,174449211009135430266140481,1570042899082127365225444485,14130386091738871765519540833 add $0,1 mov $1,3 pow $1,$0 add $1,1 pow $1,2 sub $1,16 div $1,3 add $1,5 mov $0,$1
simple_http-rfc_3986.ads
annexi-strayline/ASAP-Simple_HTTP
0
13650
<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- Simple HTTP -- -- -- -- Basic HTTP 1.1 support for API endpoints -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2021, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- This package handles parsing of HTTP-schemed URIs (RFC 3986) with Ada.Strings.Bounded; with Ada.Characters.Handling; package Simple_HTTP.RFC_3986 is -- RFC 3986 1.6 function Is_alpha (Item: in Character) return Boolean renames Ada.Characters.Handling.Is_Letter; -- "ALPHA" function Is_digit (Item: in Character) return Boolean renames Ada.Characters.Handling.Is_Digit; -- "DIGIT" function Is_alphanum (Item: in Character) return Boolean renames Ada.Characters.Handling.Is_Alphanumeric; -- "ALPHA" | "DIGIT" function Is_gen_delim (Item: in Character) return Boolean is (Item in ':' | '/' | '?' | '#' | '[' | ']' | '@'); -- gen-delims function Is_sub_delim (Item: in Character) return Boolean is (Item in '!' | '$' | '&' | ''' | '(' | ')' | '*' | '+' | ',' | ';' | '='); -- sub-delims function Is_reserved (Item: in Character) return Boolean is (Is_gen_delim (Item) or else Is_sub_delim (Item)); function Is_unreserved (Item: in Character) return Boolean is (Is_alphanum (Item) or else (Item in '-' | '.' | '_' | '~')); Escape_Preamble: constant Character := '%'; ---------------- -- URI_Parser -- ---------------- -- The URI_Parser package provides facilities designed for handling URI -- inputs of an external origin, and therefore provide safe checking of -- URI syntax, avoiding the raising of exceptions on invalid input. generic with package URI_Strings is new Ada.Strings.Bounded.Generic_Bounded_Length (<>); package URI_Parser is subtype URI_String is URI_Strings.Bounded_String; type Port_Number is range 0 .. 2**16 - 1; procedure Unescape (Sequence: in out URI_String; Valid : out Boolean); -- Converts any escape codes in Sequence to their encoded Character, in- -- line. If the process is successful, the unescaped sequence is assigned -- to Sequence, and Valid is set to True. If there are any mal-formed -- escape sequences (such as "%%" or invalid hex characters), Sequence is -- not modified, and Valid is set to False procedure Scheme (URI : in URI_String; Scheme: out URI_String; Valid : out Boolean); -- Attempts to retrieve the sceme, and also normalizes it to lower-case. -- The scheme will be everything up to the first ':'. -- -- If no scheme is found, Scheme is set to Null_Bounded_String, and -- Valid is set to True. -- -- If the scheme component violates RFC 3986, Valid is set to False, and -- Scheme is set to a Null_Bounded_String. procedure Parse_Authority (URI : in URI_String; Default_Port: in Port_Number := 80; Valid : out Boolean; userinfo : out URI_String; host : out URI_String; port : out Port_Number); -- Dissects the authority portion of a URI (if present), setting the -- output parameters accordingly. -- -- The authority component is between the scheme and path. In practical -- terms, it typically looks like this: "scheme://authority/path" -- -- Sequence must be the full URI. Dissected_Authority invokes Authority -- on Sequence. -- -- If there is no authority component, userinfo and host will be set to -- Null_Bounded_String. If userinfo and host do not exist in the -- authority, the respective output parameter is set to -- Null_Bounded_String. -- -- If the URI is not valid (according to RFC 3986), Valid is set to -- False, and userinfo, host, and port are set to Null_Bounded_String. -- Parse_Authority does _full_ checking against RFC 3986. -- -- If there is no port component (including the case of "<EMAIL>:"), -- port is set to the value given for Default_Port. The default value of -- Default_Port (80) is as specified by RFC 2616 (HTTP 1.1). function Path (Sequence: URI_String) return URI_String; -- Returns the entire path-abempty part of a URI (RFC 3986-3.3). -- This including the leading '/' (if any), but not including the first -- '?' of the query part, or '#' of the first fragment, if any. -- -- The returned path is not normalized. -- -- if the path violates RFC 3986 (Section 3), Constraint_Error is -- raised. procedure First_Query (URI : in URI_String; Query : out URI_String; Next_Query_Start: out Natural; Valid : out Boolean); -- Sets Query to the first query value, if any. This value is the text -- that follows the first '?', and extends until '&', '#', or the end of -- Sequence (exclusive). -- -- Note that RFC 3986 does not actually provision the '&' separation, -- but this is the common convention on the web, and particularily for -- APIs. -- -- If there is something incorrect about the query structure (such as a -- pattern like "&&", or query text that does not meet the requirements -- of RFC 3986, Query will be set to Null_Bounded_String, -- Next_Query_Start will be set to zero, and Value will be set to False. -- -- If there is an '&' ending the query, Next_Query_Start is the index of -- Sequence that yields the first character immediately following the -- '&', otherwise Next_Query_Start is set to zero. -- -- If there is no query (no '?'), a Null_Bounded_String is returned, -- Next_Query_Start is set to zero, and Valid is set to True. -- -- Note that any empty query (such as the sequence "?&" or "&&") -- is considered to be invalid. procedure Next_Query (URI : in URI_String; Query : out URI_String; Next_Query_Start: in out Natural; Valid : out Boolean); -- Sets Query to the next query that is expected to start at -- Next_Query_Start as set by a previous call to First_Query or -- Next_Query. -- -- If Next_Query_Start = 0, or is not in the rage of URI, Valid is set to -- False. -- -- Otherwise, the mechanics follow those of First_Query. end URI_Parser; end Simple_HTTP.RFC_3986;
notes/FOT/FOTC/TypeClasses/EqualityInstanceArguments.agda
asr/fotc
11
4533
------------------------------------------------------------------------------ -- Note on the equality type class using instance arguments ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} -- Adapted from: On the Bright Side of Type Classes: Instances -- Arguments in Agda (ICFP'11). module FOT.FOTC.TypeClasses.EqualityInstanceArguments where open import FOTC.Base open import FOTC.Data.Bool open import FOTC.Data.Bool.Type open import FOTC.Data.Nat.Type ------------------------------------------------------------------------------ ∃-proj₁ : ∀ {A} → ∃ A → D ∃-proj₁ (x , _) = x record Eq (P : D → Set) : Set₁ where field equal : ∀ {t₁ t₂} → P t₁ → P t₂ → Set equal : {P : D → Set}{t₁ t₂ : D} → {{eqT : Eq P}} → P t₁ → P t₂ → Set equal {{eqT}} = Eq.equal eqT boolEq : ∀ {b₁ b₂} → Bool b₁ → Bool b₂ → Set boolEq btrue btrue = Bool true boolEq bfalse bfalse = Bool true {-# CATCHALL #-} boolEq _ _ = Bool false nEq : ∀ {m n} → N m → N n → Set nEq nzero nzero = Bool true nEq (nsucc Nm) (nsucc Nn) = Bool true {-# CATCHALL #-} nEq _ _ = Bool false instance eqInstanceBool : Eq Bool eqInstanceBool = record { equal = boolEq } eqInstanceN : Eq N eqInstanceN = record { equal = nEq } test₁ : Set test₁ = equal nzero (nsucc nzero) test₂ : Set test₂ = equal bfalse bfalse eqN-sym : ∀ {m n} → (Nm : N m) → (Nn : N n) → equal Nm Nn → equal Nn Nm eqN-sym nzero nzero h = h eqN-sym nzero (nsucc Nn) h = h eqN-sym (nsucc Nm) nzero h = h eqN-sym (nsucc Nm) (nsucc Nn) h = h postulate eqN-sym' : ∀ {m n} → (Nm : N m) → (Nn : N n) → equal Nm Nn → equal Nn Nm -- {-# ATP prove eqN-sym' #-}
agda-stdlib-0.9/src/Data/Star/Decoration.agda
qwe2/try-agda
1
5274
<reponame>qwe2/try-agda<gh_stars>1-10 ------------------------------------------------------------------------ -- The Agda standard library -- -- Decorated star-lists ------------------------------------------------------------------------ module Data.Star.Decoration where open import Data.Star open import Relation.Binary open import Function open import Data.Unit open import Level -- A predicate on relation "edges" (think of the relation as a graph). EdgePred : {I : Set} → Rel I zero → Set₁ EdgePred T = ∀ {i j} → T i j → Set data NonEmptyEdgePred {I : Set} (T : Rel I zero) (P : EdgePred T) : Set where nonEmptyEdgePred : ∀ {i j} {x : T i j} (p : P x) → NonEmptyEdgePred T P -- Decorating an edge with more information. data DecoratedWith {I : Set} {T : Rel I zero} (P : EdgePred T) : Rel (NonEmpty (Star T)) zero where ↦ : ∀ {i j k} {x : T i j} {xs : Star T j k} (p : P x) → DecoratedWith P (nonEmpty (x ◅ xs)) (nonEmpty xs) edge : ∀ {I} {T : Rel I zero} {P : EdgePred T} {i j} → DecoratedWith {T = T} P i j → NonEmpty T edge (↦ {x = x} p) = nonEmpty x decoration : ∀ {I} {T : Rel I zero} {P : EdgePred T} {i j} → (d : DecoratedWith {T = T} P i j) → P (NonEmpty.proof (edge d)) decoration (↦ p) = p -- Star-lists decorated with extra information. All P xs means that -- all edges in xs satisfy P. All : ∀ {I} {T : Rel I zero} → EdgePred T → EdgePred (Star T) All P {j = j} xs = Star (DecoratedWith P) (nonEmpty xs) (nonEmpty {y = j} ε) -- We can map over decorated vectors. gmapAll : ∀ {I} {T : Rel I zero} {P : EdgePred T} {J} {U : Rel J zero} {Q : EdgePred U} {i j} {xs : Star T i j} (f : I → J) (g : T =[ f ]⇒ U) → (∀ {i j} {x : T i j} → P x → Q (g x)) → All P xs → All {T = U} Q (gmap f g xs) gmapAll f g h ε = ε gmapAll f g h (↦ x ◅ xs) = ↦ (h x) ◅ gmapAll f g h xs -- Since we don't automatically have gmap id id xs ≡ xs it is easier -- to implement mapAll in terms of map than in terms of gmapAll. mapAll : ∀ {I} {T : Rel I zero} {P Q : EdgePred T} {i j} {xs : Star T i j} → (∀ {i j} {x : T i j} → P x → Q x) → All P xs → All Q xs mapAll {P = P} {Q} f ps = map F ps where F : DecoratedWith P ⇒ DecoratedWith Q F (↦ x) = ↦ (f x) -- We can decorate star-lists with universally true predicates. decorate : ∀ {I} {T : Rel I zero} {P : EdgePred T} {i j} → (∀ {i j} (x : T i j) → P x) → (xs : Star T i j) → All P xs decorate f ε = ε decorate f (x ◅ xs) = ↦ (f x) ◅ decorate f xs -- We can append Alls. Unfortunately _◅◅_ does not quite work. infixr 5 _◅◅◅_ _▻▻▻_ _◅◅◅_ : ∀ {I} {T : Rel I zero} {P : EdgePred T} {i j k} {xs : Star T i j} {ys : Star T j k} → All P xs → All P ys → All P (xs ◅◅ ys) ε ◅◅◅ ys = ys (↦ x ◅ xs) ◅◅◅ ys = ↦ x ◅ xs ◅◅◅ ys _▻▻▻_ : ∀ {I} {T : Rel I zero} {P : EdgePred T} {i j k} {xs : Star T j k} {ys : Star T i j} → All P xs → All P ys → All P (xs ▻▻ ys) _▻▻▻_ = flip _◅◅◅_
Sopa_Letras.asm
EduardaSRBastos/Assembly-2020
0
12610
<filename>Sopa_Letras.asm<gh_stars>0 name "Sopa_Letras" org 100h ;<NAME> - 70647 ;<NAME> - 70650 ;mostrar sopa de letras mov ah, 9 lea dx, linha1 int 21h mov ah, 9 lea dx, linha2 int 21h mov ah, 9 lea dx, linha3 int 21h mov ah, 9 lea dx, linha4 int 21h mov ah, 9 lea dx, linha5 int 21h mov ah, 9 lea dx, linha6 int 21h mov ah, 9 lea dx, linha7 int 21h mov ah, 9 lea dx, linha8 int 21h mov ah, 9 lea dx, linha9 int 21h mov ah, 9 lea dx, linha10 int 21h inicio: ;verificar se encontrou todas as palavras mov al, total3 cmp al, 48 je acabar ;mostrar quantas palavras faltam encontrar mov ah, 9 lea dx, total int 21h mov ah, 9 lea dx, total3 int 21h mov ah, 9 lea dx, total2 int 21h ;mostrar texto principal mov ah, 9 lea dx, texto1 int 21h ;palavra introduzida pelo user mov cx, 21 mov si, 0 introduzir: mov ah, 1 int 21h cmp al, 13 ;verificar se inseriu [ENTER] je fim mov str[si], al ;inserir letra a letra no vetor inc si loop introduzir fim: mov cx, 15 mov si, 0 ;comparar se palavra introduzida esta correta compara: mov al, str[si] cmp al, assem[si] je sim cmp al, bin[si] je sim2 cmp al, en[si] je sim3 cmp al, reg[si] je sim4 cmp al, mem[si] je sim5 cmp al, log[si] je sim6 cmp al, assem2[si] je sim cmp al, bin2[si] je sim2 cmp al, en2[si] je sim3 cmp al, reg2[si] je sim4 cmp al, mem2[si] je sim5 cmp al, log2[si] je sim6 jne falha ;comparar palavra com tamanho da variavel sim: cmp si, len-1 je assembly jne au sim2: cmp si, len2-1 je binario jne au sim3: cmp si, len3-2 je endereco jne au sim4: cmp si, len4-2 je registo jne au sim5: cmp si, len5-1 je memoria jne au sim6: cmp si, len6-1 je logica jne au au: inc si jne compara ;inserir na sopa de letras palavra encontrada assembly: cmp flag, 0 je repetido dec total3 mov bp,OFFSET linhaA2 mov ah,13h mov al,01h xor bh,bh mov bl,6 ; cor mov cx,15 ; tamanho mov dh,3 ; linha mov dl,22 ; coluna int 10h mov dl, 0 ;posicao x mov dh, 21 ;posicao y mov ah, 2 mov bh, 0 int 10h mov ah, 9 lea dx, texto2 int 21h mov flag, 0 ;esperar 1 segundo MOV CX, 0FH MOV DX, 4240H MOV AH, 86H INT 15H jmp limparLinha binario: cmp flag2, 0 je repetido dec total3 mov bp,OFFSET linhaA5 mov ah,13h mov al,01h xor bh,bh mov bl,6 ; cor mov cx,13 ; tamanho mov dh,9 ; linha mov dl,4 ; coluna int 10h mov dl, 0 ;posicao x mov dh, 21 ;posicao y mov ah, 2 mov bh, 0 int 10h mov ah, 9 lea dx, texto2 int 21h mov flag2, 0 ;esperar 1 segundo MOV CX, 0FH MOV DX, 4240H MOV AH, 86H INT 15H jmp limparLinha endereco: cmp flag3, 0 je repetido dec total3 mov bp,OFFSET linhaA7 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,15 mov dh,13 mov dl,2 int 10h mov dl, 0 ;posicao x mov dh, 21 ;posicao y mov ah, 2 mov bh, 0 int 10h mov ah, 9 lea dx, texto2 int 21h mov flag3, 0 ;esperar 1 segundo MOV CX, 0FH MOV DX, 4240H MOV AH, 86H INT 15H jmp limparLinha registo: cmp flag4, 0 je repetido dec total3 mov bp,OFFSET linhaA9 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,13 mov dh,17 mov dl,20 int 10h mov dl, 0 ;posicao x mov dh, 21 ;posicao y mov ah, 2 mov bh, 0 int 10h mov ah, 9 lea dx, texto2 int 21h mov flag4, 0 ;esperar 1 segundo MOV CX, 0FH MOV DX, 4240H MOV AH, 86H INT 15H jmp limparLinha memoria: cmp flag5, 0 je repetido dec total3 mov bp,OFFSET linhaM1 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,1 mov dl,28 int 10h mov bp,OFFSET linhaM2 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,3 mov dl,28 int 10h mov bp,OFFSET linhaM3 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,5 mov dl,28 int 10h mov bp,OFFSET linhaM4 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,7 mov dl,28 int 10h mov bp,OFFSET linhaM5 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,9 mov dl,28 int 10h mov bp,OFFSET linhaM6 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,11 mov dl,28 int 10h mov bp,OFFSET linhaM7 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,13 mov dl,28 int 10h mov dl, 0 mov dh, 21 mov ah, 2 mov bh, 0 int 10h mov ah, 9 lea dx, texto2 int 21h mov flag5, 0 ;esperar 1 segundo MOV CX, 0FH MOV DX, 4240H MOV AH, 86H INT 15H jmp limparLinha logica: cmp flag6, 0 je repetido dec total3 mov bp,OFFSET linhaL1 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,7 mov dl,18 int 10h mov bp,OFFSET linhaL2 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,9 mov dl,18 int 10h mov bp,OFFSET linhaL3 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,11 mov dl,18 int 10h mov bp,OFFSET linhaL4 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,13 mov dl,18 int 10h mov bp,OFFSET linhaL5 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,15 mov dl,18 int 10h mov bp,OFFSET linhaL6 mov ah,13h mov al,01h xor bh,bh mov bl,6 mov cx,1 mov dh,17 mov dl,18 int 10h mov dl, 0 ;posicao x mov dh, 21 ;posicao y mov ah, 2 mov bh, 0 int 10h mov ah, 9 lea dx, texto2 int 21h mov flag6, 0 ;esperar 1 segundo MOV CX, 0FH MOV DX, 4240H MOV AH, 86H INT 15H jmp limparLinha ;palavra errada falha: mov ah, 9 lea dx, texto3 int 21h ;esperar 1 segundo mov cx, 0fh mov dx, 4240h mov ah, 86h int 15h jmp limparlinha ;limpar linhas e ir para a linha de novo limparLinha: mov dl, 0 ;posicao x mov dh, 19 ;posicao y mov ah, 2 mov bh, 0 int 10h mov ah, 9 lea dx, limpar int 21h mov dl, 0 ;posicao x mov dh, 20 ;posicao y mov ah, 2 mov bh, 0 int 10h mov ah, 9 lea dx, limpar int 21h mov dl, 0 ;posicao x mov dh, 21 ;posicao y mov ah, 2 mov bh, 0 int 10h mov ah, 9 lea dx, limpar int 21h mov dl, 0 ;posicao x mov dh, 22 ;posicao y mov ah, 2 mov bh, 0 int 10h mov ah, 9 lea dx, limpar int 21h mov dl, 0 ;posicao x mov dh, 19 ;posicao y mov ah, 2 mov bh, 0 int 10h mov cx, 15 mov si, 0 branco: mov str[si], ' ' inc si loop branco jmp inicio ;se palavra for repetida, nao pode ser encontrada outra vez repetido: mov ah, 9 lea dx, igual int 21h ;esperar 1 segundo MOV CX, 0FH MOV DX, 4240H MOV AH, 86H INT 15H jmp limparLinha loopne inicio ;sai fora do loop para encontrar a palavra, e acaba acabar: mov ah, 9 lea dx, final int 21h mov ah, 4ch int 21h ret linha1 DB 13,10,'F O E I D K E F N N A L R U M Z A T W L$' linha2 DB 13,10,13,10, "W Q N C T Y H X E Q I A S S E M B L Y L$" linha3 DB 13,10,13,10, "F G C G O P M O O D W E O R M O C C Y K$" linha4 DB 13,10,13,10, "K W G O R I N E T L O W C H O C G W E J$" linha5 DB 13,10,13,10, "W E B I N A R I O O N F Y Y R Z Z O M C$" linha6 DB 13,10,13,10, "Q W M F E J F Z D G E Q V Z I R V J Y V$" linha7 DB 13,10,13,10, "D E N D E R E C O I V V W M A H F B M W$" linha8 DB 13,10,13,10, "K V F A C C N M H C V Y J U K P Z U C U$" linha9 DB 13,10,13,10, "V S W F E A I F Q A R E G I S T O V J D$" linha10 DB 13,10,13,10, "G J V R E M O P Q F D G Q G U W E K Z P$" sair1 db 13,10,13,10, 'Clique em [ESC] para sair.$' texto1 db 0ah, 0dh, 'Escreva a palavra: $' texto2 db 0ah, 0dh,'Parabens!$' texto3 db 0ah, 0dh,'Essa palavra nao existe. Tente outra vez!$' texto4 db 0ah, 0dh,'Sair - Obrigado.$' limpar db 0ah, 0dh,' $' igual db 13,10,13,10, 'Ja encontrou esta palavra antes.$' final db 13,10,13,10, 'Encontrou todas as palavras. Parabens!$' ;lista: binario, memoria, assembly, logica, registo, endereco flag db 1 flag2 db 1 flag3 db 1 flag4 db 1 flag5 db 1 flag6 db 1 total3 db "6$" total db 13,10,"Falta encontrar $" total2 db " palavra(s)$" linhaM1 DB 'M$' linhaM2 DB "E$" linhaM3 DB "M$" linhaM4 DB "O$" linhaM5 DB "R$" linhaM6 DB "I$" linhaM7 DB "A$" linhaA2 DB "A S S E M B L Y$" str db " $" assem db "ASSEMBLY" len equ $ - assem assem2 db "assembly" bin db "BINARIO" len2 equ $ - bin bin2 db "binario" en db "ENDERECO" len3 equ $ - en en2 db "endereco" reg db "REGISTO" len4 equ $ - reg reg2 db "registo" mem db "MEMORIA" len5 equ $ - mem mem2 db "memoria" log db "LOGICA" len6 equ $ - log log2 db "logica" mudarlinha db 13, 10, '$' linhaA5 DB , "B I N A R I O$" linhaA7 DB , "E N D E R E C O$" linhaA9 DB , "R E G I S T O$" linhaL1 DB "L$" linhaL2 DB "O$" linhaL3 DB "G$" linhaL4 DB "I$" linhaL5 DB "C$" linhaL6 DB "A$"
Code/prog1.asm
AdrianSchneble/reaction-game-8051
0
85550
;ABLAUFSTEUERUNG ;--------------------------------------------------------------------------------------------------------------------------------------------------------------------- Init: ;SET STATE=11 State EQU 10 MOV State, #11B left EQU 08.0 MOV left,#0 right EQU 08.1 MOV right,#0 rightr EQU 18 MOV rightr,#0 rightl EQU 20 MOV righl,#0 timer1 EQU 28 MOV timer1,#0 timer2 EQU 30 MOV timer2,#0 timer3 EQU 38 MOV timer3,#0 timer4 EQU 40 MOV timer4,#0 initialized EQU 48.0 MOV initialized,#0 zufallsbit EQU 48.1 hier zufallsbit setzen LJMP Tick ;--------------------------------------------------------------------------------------------------------------------------------------------------------------------- ;SUB ROUTINEN ;Tick: ausgeführt jede ms. Wait: ;warte 1ms LJMP Tick Tick: randbit=!randbit ;jump depending on state JCEQ state,#00B,statevoll JCEQ state,#01B,stateaktiv JCEQ state,#10B,statereagiert JCEQ state,#11B,statefehler EndTick: LJMP Draw Draw: ;zeichne was auch immer grad im register steht MOV P0, DRAW1 MOV P1, DRAW2 LJMP Wait ;--------------------------------------------------------------------------------------------------------------------------------------------------------------------- ;DISPLAYS DisplayFull: ;Register setzen sodass alle an MOV DRAW1, #0H MOV DRAW2, #0H DisplayRight: ;Register setzen sodass alle rechten an MOV DRAW1, #0CH MOV DRAW2, #0H DisplayLeft: ;Register setzen sodass alle linken an MOV DRAW1, #3H MOV DRAW2, #0H DisplayTime: ;Register setzen sodass timer angezeigt DisplayError: ;Register setzen sodass Error sichtbar MOV DRAW1, #0b MOV DRAW2, #10111111b ;--------------------------------------------------------------------------------------------------------------------------------------------------------------------- ;STATES StateVoll: ;volles display warte bis zufallstimer auslaeuft, dann -> StateAktiv ;wenn nutzereingabe -> StateFehler ;CODE: 00 JLT initialized,0,ELSE;if initialized MOV 0.0,left XOL 0.0,right ;if either left or right is pressed CJEQ 0.0,#0,END MOV state,#11B;then state=11 (Fehler) MOV initialize,#0;initialized=0 END: timer-- CJNE timer,#0,endtick ;if timer==0 info: timer=0 bedeutet alle timer variablen müssen 0 sein. TODO! MOV STATE,#01B MOV initialized,#0 LJMP endtick ELSE: MOV initialized,#1B timer=zufallszahl LJMP endtick StateAktiv: ;zeige halbes leeres display ;warte auf richtige nutzereingabe, zähle währenddessen die Ticks (ms), dann ->StateReagiert ;CODE: 01 JLT initialized,0,ELSE2;if initialized timer++ if(left&&!right&&sider&&!sidel || right&&!left&&sidel&&!sider) stoptimer MOV state,#10B MOV initialized,#0B else MOV state,#11B MOV initialized,#0B ELSE2: MOV timer1,0B;timer=0 MOV timer2,0B MOV timer3,0B MOV timer4,0B if(zufallsbit) MOV rightr,#1B MOV rightl,#0B ;Register setzen sodass alle rechten an MOV DRAW1, #0CH MOV DRAW2, #0H else MOV rightr,#0B MOV rightl,#1B ;Register setzen sodass alle linken an MOV DRAW1, #3H MOV DRAW2, #0H MOV initialized,#1B LJMP EndTick StateReagiert: ;warte auf nutzereingabe, zeige timerausgabe, dann -> StateVoll ;CODE: 10 if(initialized) if(left|right) State=00 initialized=0 else left=0 right=0 initialized=1 ->TimerDisplay LJMP EndTick StateFehler: ;warte auf nutzereingabe, zeige fehlerdisplay, dann ->StateVoll ;CODE: 11 if(initialized) if(left|right) State=00 initialized=0 else left=0 right=0 initialized=1 ->FehlerDisplay LJMP EndTick ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- ;USER INPUT ;Interrupts NutzerLinks: ;setztlinksflag left=1 NutzerRechts: ;setzt rechtsflag right=1 END
Definition/Conversion/Lift.agda
Vtec234/logrel-mltt
0
2640
{-# OPTIONS --without-K --safe #-} module Definition.Conversion.Lift where open import Definition.Untyped open import Definition.Untyped.Properties open import Definition.Typed open import Definition.Typed.Weakening open import Definition.Typed.Properties open import Definition.Typed.EqRelInstance open import Definition.Conversion open import Definition.Conversion.Whnf open import Definition.Conversion.Soundness open import Definition.Conversion.Weakening open import Definition.LogicalRelation open import Definition.LogicalRelation.Properties open import Definition.LogicalRelation.Fundamental.Reducibility open import Definition.Typed.Consequences.Syntactic open import Definition.Typed.Consequences.Reduction open import Tools.Product import Tools.PropositionalEquality as PE -- Lifting of algorithmic equality of types from WHNF to generic types. liftConv : ∀ {A B Γ} → Γ ⊢ A [conv↓] B → Γ ⊢ A [conv↑] B liftConv A<>B = let ⊢A , ⊢B = syntacticEq (soundnessConv↓ A<>B) whnfA , whnfB = whnfConv↓ A<>B in [↑] _ _ (id ⊢A) (id ⊢B) whnfA whnfB A<>B -- Lifting of algorithmic equality of terms from WHNF to generic terms. liftConvTerm : ∀ {t u A Γ} → Γ ⊢ t [conv↓] u ∷ A → Γ ⊢ t [conv↑] u ∷ A liftConvTerm t<>u = let ⊢A , ⊢t , ⊢u = syntacticEqTerm (soundnessConv↓Term t<>u) whnfA , whnfT , whnfU = whnfConv↓Term t<>u in [↑]ₜ _ _ _ (id ⊢A) (id ⊢t) (id ⊢u) whnfA whnfT whnfU t<>u mutual -- Helper function for lifting from neutrals to generic terms in WHNF. lift~toConv↓′ : ∀ {t u A A′ Γ l} → Γ ⊩⟨ l ⟩ A′ → Γ ⊢ A′ ⇒* A → Γ ⊢ t ~ u ↓ A → Γ ⊢ t [conv↓] u ∷ A lift~toConv↓′ (Uᵣ′ .⁰ 0<1 ⊢Γ) D ([~] A D₁ whnfB k~l) rewrite PE.sym (whnfRed* D Uₙ) = let _ , ⊢t , ⊢u = syntacticEqTerm (conv (soundness~↑ k~l) (subset* D₁)) in univ ⊢t ⊢u (ne ([~] A D₁ Uₙ k~l)) lift~toConv↓′ (ℕᵣ D) D₁ ([~] A D₂ whnfB k~l) rewrite PE.sym (whrDet* (red D , ℕₙ) (D₁ , whnfB)) = ℕ-ins ([~] A D₂ ℕₙ k~l) lift~toConv↓′ (Emptyᵣ D) D₁ ([~] A D₂ whnfB k~l) rewrite PE.sym (whrDet* (red D , Emptyₙ) (D₁ , whnfB)) = Empty-ins ([~] A D₂ Emptyₙ k~l) lift~toConv↓′ (Unitᵣ D) D₁ ([~] A D₂ whnfB k~l) rewrite PE.sym (whrDet* (red D , Unitₙ) (D₁ , whnfB)) = Unit-ins ([~] A D₂ Unitₙ k~l) lift~toConv↓′ (ne′ K D neK K≡K) D₁ ([~] A D₂ whnfB k~l) rewrite PE.sym (whrDet* (red D , ne neK) (D₁ , whnfB)) = let _ , ⊢t , ⊢u = syntacticEqTerm (soundness~↑ k~l) A≡K = subset* D₂ in ne-ins (conv ⊢t A≡K) (conv ⊢u A≡K) neK ([~] A D₂ (ne neK) k~l) lift~toConv↓′ (Πᵣ′ F G D ⊢F ⊢G A≡A [F] [G] G-ext) D₁ ([~] A D₂ whnfB k~l) rewrite PE.sym (whrDet* (red D , Πₙ) (D₁ , whnfB)) = let ⊢ΠFG , ⊢t , ⊢u = syntacticEqTerm (soundness~↓ ([~] A D₂ Πₙ k~l)) ⊢F , ⊢G = syntacticΠ ⊢ΠFG neT , neU = ne~↑ k~l ⊢Γ = wf ⊢F var0 = neuTerm ([F] (step id) (⊢Γ ∙ ⊢F)) (var 0) (var (⊢Γ ∙ ⊢F) here) (refl (var (⊢Γ ∙ ⊢F) here)) 0≡0 = lift~toConv↑′ ([F] (step id) (⊢Γ ∙ ⊢F)) (var-refl (var (⊢Γ ∙ ⊢F) here) PE.refl) k∘0≡l∘0 = lift~toConv↑′ ([G] (step id) (⊢Γ ∙ ⊢F) var0) (app-cong (wk~↓ (step id) (⊢Γ ∙ ⊢F) ([~] A D₂ Πₙ k~l)) 0≡0) in η-eq ⊢t ⊢u (ne neT) (ne neU) (PE.subst (λ x → _ ⊢ _ [conv↑] _ ∷ x) (wkSingleSubstId _) k∘0≡l∘0) lift~toConv↓′ (Σᵣ′ F G D ⊢F ⊢G Σ≡Σ [F] [G] G-ext) D₁ ([~] A″ D₂ whnfA t~u) rewrite PE.sym (whrDet* (red D , Σₙ) (D₁ , whnfA)) {- Σ F ▹ G ≡ A -} = let neT , neU = ne~↑ t~u t~u↓ = [~] A″ D₂ Σₙ t~u ⊢ΣFG , ⊢t , ⊢u = syntacticEqTerm (soundness~↓ t~u↓) ⊢F , ⊢G = syntacticΣ ⊢ΣFG ⊢Γ = wf ⊢F wkId = wk-id F wkLiftId = PE.cong (λ x → x [ fst _ ]) (wk-lift-id G) wk[F] = [F] id ⊢Γ wk⊢fst = PE.subst (λ x → _ ⊢ _ ∷ x) (PE.sym wkId) (fstⱼ ⊢F ⊢G ⊢t) wkfst≡ = PE.subst (λ x → _ ⊢ _ ≡ _ ∷ x) (PE.sym wkId) (fst-cong ⊢F ⊢G (refl ⊢t)) wk[fst] = neuTerm wk[F] (fstₙ neT) wk⊢fst wkfst≡ wk[Gfst] = [G] id ⊢Γ wk[fst] wkfst~ = PE.subst (λ x → _ ⊢ _ ~ _ ↑ x) (PE.sym wkId) (fst-cong t~u↓) wksnd~ = PE.subst (λ x → _ ⊢ _ ~ _ ↑ x) (PE.sym wkLiftId) (snd-cong t~u↓) in Σ-η ⊢t ⊢u (ne neT) (ne neU) (PE.subst (λ x → _ ⊢ _ [conv↑] _ ∷ x) wkId (lift~toConv↑′ wk[F] wkfst~)) (PE.subst (λ x → _ ⊢ _ [conv↑] _ ∷ x) wkLiftId (lift~toConv↑′ wk[Gfst] wksnd~)) lift~toConv↓′ (emb 0<1 [A]) D t~u = lift~toConv↓′ [A] D t~u -- Helper function for lifting from neutrals to generic terms. lift~toConv↑′ : ∀ {t u A Γ l} → Γ ⊩⟨ l ⟩ A → Γ ⊢ t ~ u ↑ A → Γ ⊢ t [conv↑] u ∷ A lift~toConv↑′ [A] t~u = let B , whnfB , D = whNorm′ [A] t~u↓ = [~] _ (red D) whnfB t~u neT , neU = ne~↑ t~u _ , ⊢t , ⊢u = syntacticEqTerm (soundness~↓ t~u↓) in [↑]ₜ _ _ _ (red D) (id ⊢t) (id ⊢u) whnfB (ne neT) (ne neU) (lift~toConv↓′ [A] (red D) t~u↓) -- Lifting of algorithmic equality of terms from neutrals to generic terms in WHNF. lift~toConv↓ : ∀ {t u A Γ} → Γ ⊢ t ~ u ↓ A → Γ ⊢ t [conv↓] u ∷ A lift~toConv↓ ([~] A₁ D whnfB k~l) = lift~toConv↓′ (reducible (proj₁ (syntacticRed D))) D ([~] A₁ D whnfB k~l) -- Lifting of algorithmic equality of terms from neutrals to generic terms. lift~toConv↑ : ∀ {t u A Γ} → Γ ⊢ t ~ u ↑ A → Γ ⊢ t [conv↑] u ∷ A lift~toConv↑ t~u = lift~toConv↑′ (reducible (proj₁ (syntacticEqTerm (soundness~↑ t~u)))) t~u
programs/oeis/107/A107078.asm
neoneye/loda
22
28140
<gh_stars>10-100 ; A107078: Whether n has non-unitary prime divisors. ; 0,0,0,1,0,0,0,1,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,1,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,1,0,0,1,1,1,0,1,0,1,0,1,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,1,1 seq $0,8833 ; Largest square dividing n. min $0,2 sub $0,1
src/firmware/Platform/Motor/Stop.asm
pete-restall/Cluck2Sesame-Prototype
1
95053
#include "Platform.inc" #include "FarCalls.inc" #include "Adc.inc" #include "Motor.inc" #include "States.inc" radix decimal Motor code global stopMotor stopMotor: ; TODO: IF MOTOR ALREADY STOPPED (IE. PSTRCON & STR{A,B} == 0), DON'T ; BOTHER TRYING TO SOFT-STOP... .safelySetBankFor motorStateAfterStopped movlw MOTOR_STATE_STOPPED movwf motorStateAfterStopped setMotorState MOTOR_STATE_SOFTSTOP return defineMotorStateInSameSection MOTOR_STATE_STOPPED setMotorState MOTOR_STATE_IDLE .setBankFor MOTOR_PORT movlw ~(MOTOR_PWMA_PIN_MASK | MOTOR_PWMB_PIN_MASK) andwf MOTOR_PORT .setBankFor PSTRCON movlw ~MOTOR_PSTRCON_OUTPUT_MASK andwf PSTRCON fcall releaseAdcChannel returnFromMotorState end
experiments/tests/cd.als
kaiyuanw/ASketch
1
990
pred test1 { some disj Object0: Object {some disj Object0, Class0: Class { Object = Object0 Class = Object0 + Class0 no ext Acyclic[] }} } run test1 pred test2 { some disj Object0: Object {some disj Object0: Class { Object = Object0 Class = Object0 no ext Acyclic[] }} } run test2 pred test3 { some disj Object0: Object {some disj Object0, Class0: Class { Object = Object0 Class = Object0 + Class0 ext = Object0->Object0 + Class0->Class0 !AllExtObject[] }} } run test3 pred test4 { some disj Object0: Object {some disj Object0, Class0: Class { Object = Object0 Class = Object0 + Class0 ext = Object0->Object0 + Class0->Class0 !Acyclic[] }} } run test4 pred test5 { some disj Object0: Object {some disj Object0, Class0, Class1: Class { Object = Object0 Class = Object0 + Class0 + Class1 ext = Class0->Class1 + Class1->Object0 AllExtObject[] }} } run test5 pred test6 { some disj Object0: Object {some disj Object0, Class0, Class1: Class { Object = Object0 Class = Object0 + Class0 + Class1 ext = Object0->Class1 + Class0->Class1 + Class1->Class0 !Acyclic[] }} } run test6 pred test7 { some disj Object0: Object {some disj Object0, Class0: Class { Object = Object0 Class = Object0 + Class0 ext = Object0->Class0 + Class0->Class0 !AllExtObject[] }} } run test7 pred test8 { some disj Object0: Object {some disj Object0: Class { Object = Object0 Class = Object0 no ext AllExtObject[] }} } run test8 pred test9 { some disj Object0: Object {some disj Object0, Class0: Class { Object = Object0 Class = Object0 + Class0 no ext !ClassHierarchy[] }} } run test9 pred test10 { some disj Object0: Object {some disj Object0, Class0: Class { Object = Object0 Class = Object0 + Class0 ext = Object0->Class0 + Class0->Class0 !ObjectNoExt[] }} } run test10 pred test11 { some disj Object0: Object {some disj Object0, Class0, Class1: Class { Object = Object0 Class = Object0 + Class0 + Class1 ext = Class0->Object0 + Class1->Object0 AllExtObject[] }} } run test11 pred test12 { some disj Object0: Object {some disj Object0, Class0: Class { Object = Object0 Class = Object0 + Class0 ext = Class0->Class0 ObjectNoExt[] }} } run test12 pred test13 { some disj Object0: Object {some disj Object0, Class0: Class { Object = Object0 Class = Object0 + Class0 ext = Object0->Object0 + Class0->Object0 AllExtObject[] }} } run test13 pred test14 { some disj Object0: Object {some disj Object0, Class0: Class { Object = Object0 Class = Object0 + Class0 ext = Object0->Class0 + Class0->Class0 !ClassHierarchy[] }} } run test14 pred test15 { some disj Object0: Object {some disj Object0, Class0: Class { Object = Object0 Class = Object0 + Class0 ext = Object0->Class0 + Class0->Object0 !Acyclic[] }} } run test15 pred test16 { some disj Object0: Object {some disj Object0, Class0: Class { Object = Object0 Class = Object0 + Class0 ext = Class0->Class0 !ClassHierarchy[] }} } run test16 pred test17 { some disj Object0: Object {some disj Object0, Class0: Class { Object = Object0 Class = Object0 + Class0 ext = Object0->Class0 + Class0->Class0 !Acyclic[] }} } run test17
testsuite/tests/T618-047__Ada_2012/pck_2012.ads
AdaCore/style_checker
2
14602
------------------------------------------------------------------------------ -- Copyright (C) 2003-2006, AdaCore -- package P is type Point is tagged record X, Y : Float := 0.0; end record; function Is_At_Origin (P : Point) return Boolean is (P.X = 0.0 and P.Y = 0.0) with Inline; end P;
libsrc/newbrain/zcall.asm
meesokim/z88dk
0
167798
<filename>libsrc/newbrain/zcall.asm ; ; Grundy Newbrain Specific libraries ; ; <NAME> - 19/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; This function is linked only in the non-CP/M version ; it calls the ROM functions via the standard rst entry ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; Used internally only ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: zcall.asm,v 1.2 2015/01/19 01:33:00 pauloscustodio Exp $ ; PUBLIC ZCALL .ZCALL jp $20 ; ZCALL
source/s-finmas.ads
ytomino/drake
33
14612
<reponame>ytomino/drake pragma License (Unrestricted); -- implementation unit required by compiler with Ada.Finalization; with System.Storage_Elements; with System.Storage_Pools; private with System.Storage_Barriers; package System.Finalization_Masters is pragma Preelaborate; type Finalize_Address_Ptr is access procedure (Obj : Address); type FM_Node is private; type FM_Node_Ptr is access all FM_Node; Header_Size : constant Storage_Elements.Storage_Offset; subtype Any_Storage_Pool_Ptr is Storage_Pools.Storage_Pool_Access; pragma Suppress (Access_Check, Any_Storage_Pool_Ptr); type Finalization_Master is limited new Ada.Finalization.Limited_Controlled with private; procedure Attach_Unprotected (N, L : not null FM_Node_Ptr); procedure Detach_Unprotected (N : not null FM_Node_Ptr); function Objects_Unprotected ( Master : aliased in out Finalization_Master'Class; Fin_Addr_Ptr : Finalize_Address_Ptr) return FM_Node_Ptr; function Finalization_Started (Master : Finalization_Master'Class) return Boolean; pragma Inline (Finalization_Started); procedure Set_Finalize_Address_Unprotected ( Master : in out Finalization_Master'Class; Fin_Addr_Ptr : Finalize_Address_Ptr); -- required by compiler (s-finmas.ads) procedure Set_Finalize_Address ( Master : in out Finalization_Master'Class; Fin_Addr_Ptr : Finalize_Address_Ptr); -- required by compiler (s-finmas.ads) procedure Set_Is_Heterogeneous ( Master : in out Finalization_Master'Class) is null; pragma Inline (Set_Is_Heterogeneous); -- [gcc-7] can not skip calling null procedure -- required by compiler (s-finmas.ads) type Finalization_Master_Ptr is access all Finalization_Master; for Finalization_Master_Ptr'Storage_Size use 0; private use type Storage_Elements.Storage_Offset; type FM_Node is record Prev : FM_Node_Ptr; Next : FM_Node_Ptr; end record; pragma Suppress_Initialization (FM_Node); Header_Size : constant Storage_Elements.Storage_Offset := FM_Node'Size / Standard'Storage_Unit; type FM_List; type FM_List_Access is access all FM_List; type FM_List is limited record Objects : aliased FM_Node; Finalize_Address : Finalize_Address_Ptr; Next : FM_List_Access; end record; pragma Suppress_Initialization (FM_List); type Finalization_Master is limited new Ada.Finalization.Limited_Controlled with record List : aliased FM_List; Base_Pool : Any_Storage_Pool_Ptr := null; Finalization_Started : aliased Storage_Barriers.Flag; end record; overriding procedure Initialize (Object : in out Finalization_Master); overriding procedure Finalize (Object : in out Finalization_Master); -- reraise some exception propagated from its own objects -- required by compiler (s-finmas.ads) function Base_Pool (Master : Finalization_Master'Class) return Any_Storage_Pool_Ptr; procedure Set_Base_Pool ( Master : in out Finalization_Master'Class; Pool_Ptr : Any_Storage_Pool_Ptr); pragma Inline (Base_Pool); -- required by compiler (s-finmas.ads) function Add_Offset_To_Address ( Addr : Address; Offset : Storage_Elements.Storage_Offset) return Address renames Storage_Elements."+"; end System.Finalization_Masters;
test/Succeed/Issue2637.agda
shlevy/agda
2
1541
<filename>test/Succeed/Issue2637.agda -- Andreas, 2017-07-11, issue #2637, reported by nad. -- -- This error was triggered by a meta m in a constraint UnBlock m -- which is solved to infinity by the size solver. -- The constraint printer did not expect such a situation -- and crashed when printing the UnBlock constraint. {-# OPTIONS --allow-unsolved-metas #-} module _ (Z : Set) where open import Common.Size open import Common.Product postulate map : (A B C : Set) → (A → C) → A × B → C × B I : Set P : I → Set Q : Size → I → Set f : I → I lemma₁ : (R : I → Set) → (∀ x → R (f x) → R x) → ∀ x → R x → R (f x) lemma₂ : ∀ i x → Q i (f x) → Q i x works : ∀ i x → Q i (f x) × P x → Q i (f (f x)) × P x works i x = map (Q i (f x)) (P x) (Q i (f (f x))) (lemma₁ (Q i) (λ y → lemma₂ i y) (f x)) -- Replacing any underscore by its solution or parts of its solution -- makes the internal error disappear. lemma₃ : ∀ i x → Q i (f x) × P x → Q i (f (f x)) × P x lemma₃ i x = map (Q _ _) (P x) (Q _ (f (f x))) (lemma₁ _ (λ y → lemma₂ _ _) _)
src/ini_file_manager.adb
kraileth/ravenadm
18
10983
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt with File_Operations; with Ada.Characters.Latin_1; with Ada.Directories; with Ada.Exceptions; with Ada.Text_IO; package body INI_File_Manager is package EX renames Ada.Exceptions; package LAT renames Ada.Characters.Latin_1; package DIR renames Ada.Directories; package TIO renames Ada.Text_IO; package FOP renames File_Operations; -------------------------------------------------------------------------------------------- -- scribe_file -------------------------------------------------------------------------------------------- procedure scribe_file (directory, filename, first_comment : String) is package sorter is new string_crate.Generic_Sorting ("<" => HT.SU."<"); procedure write_section (section_name : HT.Text); procedure write_section (position : string_crate.Cursor); procedure save_section_name (position : list_crate.Cursor); fullpath : String := directory & "/" & filename; ini_file : TIO.File_Type; sections : string_crate.Vector; secitems : string_crate.Vector; procedure write_section (section_name : HT.Text) is procedure write_item (position : string_crate.Cursor); procedure save_item_name (position : nvpair_crate.Cursor); section : String := HT.USS (section_name); procedure write_item (position : string_crate.Cursor) is name : HT.Text renames string_crate.Element (position); value : String := HT.USS (INI_sections.Element (section_name).list.Element (name)); begin TIO.Put_Line (ini_file, HT.USS (name) & "= " & value); end write_item; procedure save_item_name (position : nvpair_crate.Cursor) is begin secitems.Append (nvpair_crate.Key (position)); end save_item_name; begin secitems.Clear; INI_sections.Element (section_name).list.Iterate (save_item_name'Access); sorter.Sort (Container => secitems); TIO.Put_Line (ini_file, LAT.LF & LAT.Left_Square_Bracket & section & LAT.Right_Square_Bracket); secitems.Iterate (write_item'Access); end write_section; procedure save_section_name (position : list_crate.Cursor) is begin sections.Append (list_crate.Element (position).section); end save_section_name; procedure write_section (position : string_crate.Cursor) is section_name : HT.Text := string_crate.Element (position); begin write_section (section_name); end write_section; begin INI_sections.Iterate (save_section_name'Access); sorter.Sort (Container => sections); FOP.mkdirp_from_filename (fullpath); TIO.Create (File => ini_file, Mode => TIO.Out_File, Name => fullpath); TIO.Put_Line (ini_file, "; " & first_comment); TIO.Put_Line (ini_file, "; Take care when hand editing!"); sections.Iterate (write_section'Access); TIO.Close (ini_file); exception when others => if TIO.Is_Open (ini_file) then TIO.Close (ini_file); end if; raise file_operation_failed; end scribe_file; -------------------------------------------------------------------------------------------- -- Delete_Section -------------------------------------------------------------------------------------------- procedure delete_section (section : String) is section_text : HT.Text := HT.SUS (section); begin if INI_sections.Contains (section_text) then INI_sections.Delete (section_text); end if; end delete_section; -------------------------------------------------------------------------------------------- -- delete_nv_pair -------------------------------------------------------------------------------------------- procedure delete_nv_pair (section, name : String) is procedure delete_nvpair (Key : HT.Text; Element : in out group_list); section_text : HT.Text := HT.SUS (section); name_text : HT.Text := HT.SUS (name); procedure delete_nvpair (Key : HT.Text; Element : in out group_list) is begin Element.list.Delete (name_text); end delete_nvpair; begin if INI_sections.Contains (section_text) then if INI_sections.Element (section_text).list.Contains (name_text) then INI_sections.Update_Element (Position => INI_sections.Find (section_text), Process => delete_nvpair'Access); end if; end if; end delete_nv_pair; -------------------------------------------------------------------------------------------- -- Insert_or_Update -------------------------------------------------------------------------------------------- procedure insert_or_update (section, name, value : String) is procedure upsert (Key : HT.Text; Element : in out group_list); procedure update (Key : HT.Text; Element : in out HT.Text); section_text : HT.Text := HT.SUS (section); name_text : HT.Text := HT.SUS (name); value_text : HT.Text := HT.SUS (value); initial_rec : group_list; procedure update (Key : HT.Text; Element : in out HT.Text) is begin Element := value_text; end update; procedure upsert (Key : HT.Text; Element : in out group_list) is begin if Element.list.Contains (name_text) then Element.list.Update_Element (Position => Element.list.Find (name_text), Process => update'Access); else Element.list.Insert (name_text, value_text); end if; end upsert; begin if INI_sections.Contains (section_text) then INI_sections.Update_Element (Position => INI_sections.Find (section_text), Process => upsert'Access); else initial_rec.section := section_text; initial_rec.index := 1; initial_rec.list.Insert (name_text, value_text); initial_rec.cursor := nvpair_crate.First (initial_rec.list); INI_sections.Insert (section_text, initial_rec); end if; end insert_or_update; -------------------------------------------------------------------------------------------- -- section_count -------------------------------------------------------------------------------------------- function section_count return Natural is begin return Natural (INI_sections.Length); end section_count; -------------------------------------------------------------------------------------------- -- field_count -------------------------------------------------------------------------------------------- function field_count (section : String) return Natural is section_text : HT.Text := HT.SUS (section); begin if INI_sections.Contains (section_text) then return Natural (INI_sections.Element (section_text).list.Length); else return 0; end if; end field_count; -------------------------------------------------------------------------------------------- -- section_reset -------------------------------------------------------------------------------------------- procedure section_list_reset (section : String) is procedure reset_cursor (Key : HT.Text; Element : in out group_list); section_text : HT.Text := HT.SUS (section); first_position : nvpair_crate.Cursor; procedure reset_cursor (Key : HT.Text; Element : in out group_list) is begin Element.cursor := first_position; Element.index := 1; end reset_cursor; begin if INI_sections.Contains (section_text) then first_position := nvpair_crate.First (INI_sections.Element (section_text).list); INI_sections.Update_Element (Position => INI_sections.Find (section_text), Process => reset_cursor'Access); end if; end section_list_reset; -------------------------------------------------------------------------------------------- -- show_name -------------------------------------------------------------------------------------------- function show_name (section : String) return String is section_text : HT.Text := HT.SUS (section); position : nvpair_crate.Cursor; begin if INI_sections.Contains (section_text) then position := INI_sections.Element (section_text).cursor; if nvpair_crate.Has_Element (position) then return HT.USS (nvpair_crate.Element (position)); end if; end if; return ""; end show_name; -------------------------------------------------------------------------------------------- -- show_value #1 -------------------------------------------------------------------------------------------- function show_value (section : String) return String is section_text : HT.Text := HT.SUS (section); position : nvpair_crate.Cursor; begin if INI_sections.Contains (section_text) then position := INI_sections.Element (section_text).cursor; if nvpair_crate.Has_Element (position) then return HT.USS (nvpair_crate.Key (position)); end if; end if; return ""; end show_value; -------------------------------------------------------------------------------------------- -- show_value #2 -------------------------------------------------------------------------------------------- function show_value (section, name : String) return String is section_text : HT.Text := HT.SUS (section); name_text : HT.Text := HT.SUS (name); begin if INI_sections.Contains (section_text) then if INI_sections.Element (section_text).list.Contains (name_text) then return HT.USS (INI_sections.Element (section_text).list.Element (name_text)); end if; end if; return ""; end show_value; -------------------------------------------------------------------------------------------- -- advance_section_list -------------------------------------------------------------------------------------------- function advance_section_list (section : String) return Boolean is procedure advance (Key : HT.Text; Element : in out group_list); section_text : HT.Text := HT.SUS (section); procedure advance (Key : HT.Text; Element : in out group_list) is begin nvpair_crate.Next (Element.cursor); Element.index := Element.index + 1; end advance; begin if INI_sections.Contains (section_text) then if INI_sections.Element (section_text).index < field_count (section) then INI_sections.Update_Element (Position => INI_sections.Find (section_text), Process => advance'Access); return True; end if; end if; return False; end advance_section_list; -------------------------------------------------------------------------------------------- -- section_name -------------------------------------------------------------------------------------------- function section_name (index : Positive) return String is position : list_crate.Cursor; tracker : Positive := 1; numsec : constant Natural := Natural (INI_sections.Length); begin if not INI_sections.Is_Empty and then index <= numsec then position := list_crate.First (INI_sections); loop exit when tracker = index; tracker := tracker + 1; list_crate.Next (position); end loop; return HT.USS (list_crate.Element (position).section); end if; return "?"; end section_name; -------------------------------------------------------------------------------------------- -- scan_file -------------------------------------------------------------------------------------------- procedure scan_file (directory, filename : String) is procedure insert (Key : HT.Text; Element : in out group_list); fullpath : String := directory & "/" & filename; name_text : HT.Text; value_text : HT.Text; procedure insert (Key : HT.Text; Element : in out group_list) is begin Element.list.Insert (name_text, value_text); end insert; begin if not DIR.Exists (fullpath) then raise ini_file_nonexistent; end if; declare contents : String := FOP.get_file_contents (fullpath); markers : HT.Line_Markers; last_section : HT.Text := HT.blank; linenum : Natural := 0; begin INI_sections.Clear; HT.initialize_markers (contents, markers); loop exit when not HT.next_line_present (contents, markers); linenum := linenum + 1; declare line : constant String := HT.trim (HT.extract_line (contents, markers)); LN : constant String := "Line" & linenum'Img & ": "; begin if not (line = "") and then line (line'First) /= LAT.Semicolon then if line (line'First) = LAT.Left_Square_Bracket then if line (line'Last) = LAT.Right_Square_Bracket then last_section := HT.SUS (HT.partial_search (line, 1, "]")); if HT.SU.Length (last_section) /= line'Length - 2 then raise bad_ini_format with LN & "heading contains ']'"; end if; if INI_sections.Contains (last_section) then raise bad_ini_format with LN & "duplicate heading found"; end if; declare initial_rec : group_list; begin initial_rec.section := last_section; initial_rec.index := 0; INI_sections.Insert (last_section, initial_rec); end; else raise bad_ini_format with LN & "heading not terminated with ']'"; end if; else if not HT.contains (line, "=") then raise bad_ini_format with LN & "missing '=', so not a name-value pair"; end if; if HT.equivalent (last_section, HT.blank) then raise bad_ini_format with LN & "name-value pair found before section set"; end if; name_text := HT.SUS (HT.trim (HT.part_1 (line, "="))); value_text := HT.SUS (HT.trim (HT.part_2 (line, "="))); if INI_sections.Element (last_section).list.Contains (name_text) then raise bad_ini_format with LN & "duplicate key '" & HT.USS (name_text) & "' found in section '" & HT.USS (last_section) & "'"; else INI_sections.Update_Element (Position => INI_sections.Find (last_section), Process => insert'Access); end if; end if; end if; end; end loop; exception when why : bad_ini_format => EX.Reraise_Occurrence (why); when dunno : others => raise file_operation_failed with EX.Exception_Message (dunno); end; end scan_file; -------------------------------------------------------------------------------------------- -- section_exists -------------------------------------------------------------------------------------------- function section_exists (section : String) return Boolean is section_text : HT.Text := HT.SUS (section); begin return INI_sections.Contains (section_text); end section_exists; -------------------------------------------------------------------------------------------- -- clear_section_data -------------------------------------------------------------------------------------------- procedure clear_section_data is begin INI_sections.Clear; end clear_section_data; end INI_File_Manager;
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/s-fore_f.adb
JCGobbi/Nucleo-STM32G474RE
0
8118
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . F O R E _ F -- -- -- -- B o d y -- -- -- -- Copyright (C) 2020-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body System.Fore_F is Maxdigs : constant Natural := Int'Width - 2; -- Maximum number of decimal digits that can be represented in an Int. -- The "-2" accounts for the sign and one extra digit, since we need the -- maximum number of 9's that can be represented, e.g. for the 64-bit case, -- Integer_64'Width is 20 since the maximum value is approximately 9.2E+18 -- and has 19 digits, but the maximum number of 9's that can be represented -- in Integer_64 is only 18. -- The first prerequisite of the implementation is that the scaled divide -- does not overflow, which means that the absolute value of the bounds of -- the subtype must be smaller than 10**Maxdigs * 2**(Int'Size - 1). -- Otherwise Constraint_Error is raised by the scaled divide operation. -- The second prerequisite is that the computation of the operands does not -- overflow, which means that, if the small is larger than 1, it is either -- an integer or its numerator and denominator must be both smaller than -- the power 10**(Maxdigs - 1). ---------------- -- Fore_Fixed -- ---------------- function Fore_Fixed (Lo, Hi, Num, Den : Int; Scale : Integer) return Natural is pragma Assert (Num < 0 and then Den < 0); -- Accept only negative numbers to allow -2**(Int'Size - 1) function Negative_Abs (Val : Int) return Int is (if Val <= 0 then Val else -Val); -- Return the opposite of the absolute value of Val T : Int := Int'Min (Negative_Abs (Lo), Negative_Abs (Hi)); F : Natural; Q, R : Int; begin -- Initial value of 2 allows for sign and mandatory single digit F := 2; -- The easy case is when Num is not larger than Den in magnitude, -- i.e. if S = Num / Den, then S <= 1, in which case we can just -- compute the product Q = T * S. if Num >= Den then Scaled_Divide (T, Num, Den, Q, R, Round => False); T := Q; -- Otherwise S > 1 and thus Scale <= 0, compute Q and R such that -- T * Num = Q * (Den * 10**(-D)) + R -- with -- D = Integer'Max (-Maxdigs, Scale - 1) -- then reason on Q if it is non-zero or else on R / Den. -- This works only if Den * 10**(-D) does not overflow, which is true -- if Den = 1. Suppose that Num corresponds to the maximum value of -D, -- i.e. Maxdigs and 10**(-D) = 10**Maxdigs. If you change Den into 10, -- then S becomes 10 times smaller and, therefore, Scale is incremented -- by 1, which means that -D is decremented by 1 provided that Scale was -- initially not smaller than 1 - Maxdigs, so the multiplication still -- does not overflow. But you need to reach 10 to trigger this effect, -- which means that a leeway of 10 is required, so let's restrict this -- to a Num for which 10**(-D) <= 10**(Maxdigs - 1). To sum up, if S is -- the ratio of two integers with -- 1 < Den < Num <= B -- where B is a fixed limit, then the multiplication does not overflow. -- B can be taken as the largest integer Small such that D = 1 - Maxdigs -- i.e. such that Scale = 2 - Maxdigs, which is 10**(Maxdigs - 1) - 1. else declare D : constant Integer := Integer'Max (-Maxdigs, Scale - 1); begin Scaled_Divide (T, Num, Den * 10**(-D), Q, R, Round => False); if Q /= 0 then T := Q; F := F - D; else T := R / Den; end if; end; end if; -- Loop to increase Fore as needed to include full range of values while T <= -10 or else T >= 10 loop T := T / 10; F := F + 1; end loop; return F; end Fore_Fixed; end System.Fore_F;
src/regex.agda
shinji-kono/automaton-in-agda
0
7227
module regex where data Regex ( Σ : Set) : Set where ε : Regex Σ -- empty φ : Regex Σ -- fail _* : Regex Σ → Regex Σ _&_ : Regex Σ → Regex Σ → Regex Σ _||_ : Regex Σ → Regex Σ → Regex Σ <_> : Σ → Regex Σ infixr 40 _&_ _||_
oeis/017/A017358.asm
neoneye/loda-programs
11
90906
<reponame>neoneye/loda-programs<filename>oeis/017/A017358.asm ; A017358: a(n) = (10*n + 7)^6. ; 117649,24137569,387420489,2565726409,10779215329,34296447249,90458382169,208422380089,433626201009,832972004929,1500730351849,2565164201769,4195872914689,6611856250609,10090298369529,14976071831449,21691961596369,30749609024289,42761175875209,58451728309129,78672340886049,104413920565969,136821750708889,177210755074809,227081481823729,288136807515649,362299361110569,451729667968489,558845013849409,686339028913329,837201991720249,1014741853230169,1222605980803089,1464803622199009 mul $0,10 add $0,7 pow $0,6
oeis/313/A313024.asm
neoneye/loda-programs
11
84385
<reponame>neoneye/loda-programs ; A313024: Coordination sequence Gal.6.119.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by <NAME>(s3) ; 1,4,9,14,18,22,26,30,34,39,44,48,52,57,62,66,70,74,78,82,87,92,96,100,105,110,114,118,122,126,130,135,140,144,148,153,158,162,166,170,174,178,183,188,192,196,201,206,210,214 mul $0,6 mov $2,$0 lpb $0 mul $2,4 mov $0,$2 add $0,1 add $2,10 mul $2,$0 mul $2,2 add $2,$0 mod $2,11 add $2,3 sub $2,$0 sub $0,$2 div $0,11 lpe add $0,1
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
azexcy/shardingsphere
0
883
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ parser grammar DDLStatement; import DMLStatement; options {tokenVocab = ModeLexer;} createTable : CREATE createTableSpecification TABLE notExistClause? tableName (createDefinitionClause | (OF anyName (LP_ typedTableElementList RP_)?) | (PARTITION OF qualifiedName (LP_ typedTableElementList RP_)? partitionBoundSpec)) inheritClause partitionSpec? tableAccessMethodClause? withOption? onCommitOption? tableSpace? (AS select withData?)? (EXECUTE name executeParamClause withData?)? ; executeParamClause : LP_ exprList RP_ ; partitionBoundSpec : FOR VALUES WITH LP_ hashPartbound RP_ | FOR VALUES IN LP_ exprList RP_ | FOR VALUES FROM LP_ exprList RP_ TO LP_ exprList RP_ | DEFAULT ; hashPartbound : hashPartboundElem (COMMA_ hashPartboundElem)* ; hashPartboundElem : nonReservedWord NUMBER_ ; typedTableElementList : typedTableElement (COMMA_ typedTableElement)* ; typedTableElement : columnOptions | tableConstraint ; columnOptions : colId (WITH OPTIONS)? colQualList ; colQualList : columnConstraint* ; withData : WITH DATA | WITH NO DATA ; tableSpace : TABLESPACE name ; onCommitOption : ON COMMIT (DROP | DELETE ROWS | PRESERVE ROWS) ; withOption : WITH reloptions | WITHOUT OIDS ; tableAccessMethodClause : USING accessMethod ; accessMethod : identifier | unreservedWord | colNameKeyword ; createIndex : CREATE createIndexSpecification INDEX concurrentlyClause (notExistClause? indexName)? ON onlyClause tableName accessMethodClause? LP_ indexParams RP_ include? (WITH reloptions)? tableSpace? whereClause? ; include : INCLUDE LP_ indexIncludingParams RP_ ; indexIncludingParams : indexElem (COMMA_ indexElem)* ; accessMethodClause : USING accessMethod ; createDatabase : CREATE DATABASE name WITH? createDatabaseSpecification* ; createView : CREATE (OR REPLACE)? (TEMP | TEMPORARY)? RECURSIVE? VIEW qualifiedName (LP_ (columnList (COMMA_ columnList)*)? RP_)? (WITH reloptions)? AS select (WITH (CASCADE | LOCAL)? CHECK OPTION)? ; columnList : columnElem (COMMA_ columnElem)* ; columnElem : colId ; dropDatabase : DROP DATABASE existClause? name ; dropGroup : DROP GROUP existClause? name (COMMA_ name)* ; createDatabaseSpecification : createdbOptName EQ_? (signedIconst | booleanOrString | DEFAULT) ; createdbOptName : identifier | CONNECTION LIMIT | ENCODING | LOCATION | OWNER | TABLESPACE | TEMPLATE ; alterTable : ALTER TABLE ( existClause? onlyClause tableNameClause alterDefinitionClause | ALL IN TABLESPACE tableNameClause (OWNED BY roleList)? SET TABLESPACE name NOWAIT?) ; alterIndex : ALTER INDEX (existClause? | ALL IN TABLESPACE) qualifiedName alterIndexDefinitionClause ; dropTable : DROP TABLE existClause? tableNames dropTableOpt? ; dropTableOpt : CASCADE | RESTRICT ; dropIndex : DROP INDEX concurrentlyClause existClause? qualifiedNameList dropIndexOpt? ; dropIndexOpt : CASCADE | RESTRICT ; truncateTable : TRUNCATE TABLE? onlyClause tableNamesClause restartSeqs? dropTableOpt? ; restartSeqs : CONTINUE IDENTITY | RESTART IDENTITY ; createTableSpecification : ((GLOBAL | LOCAL)? (TEMPORARY | TEMP) | UNLOGGED)? ; createDefinitionClause : LP_ (createDefinition (COMMA_ createDefinition)*)? RP_ ; createDefinition : columnDefinition | tableConstraint | LIKE tableName likeOption* ; columnDefinition : columnName dataType collateClause? columnConstraint* ; columnConstraint : constraintClause? columnConstraintOption constraintOptionalParam ; constraintClause : CONSTRAINT constraintName ; columnConstraintOption : NOT? NULL | checkOption | DEFAULT defaultExpr | GENERATED ALWAYS AS LP_ aExpr RP_ STORED | GENERATED (ALWAYS | BY DEFAULT) AS IDENTITY (LP_ sequenceOptions RP_)? | UNIQUE indexParameters | primaryKey indexParameters | REFERENCES tableName columnNames? (MATCH FULL | MATCH PARTIAL | MATCH SIMPLE)? (ON (DELETE | UPDATE) action)* ; checkOption : CHECK aExpr (NO INHERIT)? ; defaultExpr : CURRENT_TIMESTAMP | aExpr ; sequenceOptions : sequenceOption+ ; sequenceOption : START WITH? NUMBER_ | INCREMENT BY? NUMBER_ | MAXVALUE NUMBER_ | NO MAXVALUE | MINVALUE NUMBER_ | NO MINVALUE | CYCLE | NO CYCLE | CACHE NUMBER_ | OWNED BY ; indexParameters : (USING INDEX TABLESPACE ignoredIdentifier)? | INCLUDE columnNames | WITH definition ; action : NO ACTION | RESTRICT | CASCADE | SET (NULL | DEFAULT) ; constraintOptionalParam : (NOT? DEFERRABLE)? (INITIALLY (DEFERRED | IMMEDIATE))? ; likeOption : (INCLUDING | EXCLUDING) (COMMENTS | CONSTRAINTS | DEFAULTS | IDENTITY | INDEXES | STATISTICS | STORAGE | ALL) ; tableConstraint : constraintClause? tableConstraintOption constraintOptionalParam ; tableConstraintOption : checkOption | UNIQUE columnNames indexParameters | primaryKey columnNames indexParameters | EXCLUDE (USING ignoredIdentifier)? LP_ exclusionConstraintList RP_ indexParameters exclusionWhereClause? | FOREIGN KEY columnNames REFERENCES tableName columnNames? (MATCH FULL | MATCH PARTIAL | MATCH SIMPLE)? (ON (DELETE | UPDATE) action)* ; exclusionWhereClause : WHERE LP_ aExpr RP_ ; exclusionConstraintList : exclusionConstraintElem (COMMA_ exclusionConstraintElem)* ; exclusionConstraintElem : indexElem WITH anyOperator | indexElem WITH OPERATOR LP_ anyOperator RP_ ; inheritClause : (INHERITS tableNames)? ; partitionSpec : PARTITION BY partStrategy LP_ partParams RP_ ; partParams : partElem (COMMA_ partElem)* ; partElem : colId (COLLATE anyName)? anyName? | LP_ aExpr RP_ (COLLATE anyName)? anyName? | funcExprWindowless (COLLATE anyName)? anyName? ; funcExprWindowless : funcApplication | functionExprCommonSubexpr ; partStrategy : identifier | unreservedWord ; createIndexSpecification : UNIQUE? ; concurrentlyClause : CONCURRENTLY? ; onlyClause : ONLY? ; asteriskClause : ASTERISK_? ; alterDefinitionClause : alterTableActions | renameColumnSpecification | renameConstraint | renameTableSpecification | SET SCHEMA name | partitionCmd ; partitionCmd : ATTACH PARTITION qualifiedName partitionBoundSpec | DETACH PARTITION qualifiedName ; alterIndexDefinitionClause : renameIndexSpecification | alterIndexDependsOnExtension | alterIndexSetTableSpace | alterTableCmds | indexPartitionCmd ; indexPartitionCmd : ATTACH PARTITION qualifiedName ; renameIndexSpecification : RENAME TO indexName ; alterIndexDependsOnExtension : DEPENDS ON EXTENSION ignoredIdentifier ; alterIndexSetTableSpace : (OWNED BY ignoredIdentifiers)? SET TABLESPACE name (NOWAIT)? ; tableNamesClause : tableNameClause (COMMA_ tableNameClause)* ; tableNameClause : tableName ASTERISK_? ; alterTableActions : alterTableAction (COMMA_ alterTableAction)* ; alterTableAction : addColumnSpecification | dropColumnSpecification | modifyColumnSpecification | addConstraintSpecification | modifyConstraintSpecification | validateConstraintSpecification | dropConstraintSpecification | (DISABLE | ENABLE) TRIGGER (ignoredIdentifier | ALL | USER)? | ENABLE (REPLICA | ALWAYS) TRIGGER ignoredIdentifier | (DISABLE | ENABLE) RULE ignoredIdentifier | ENABLE (REPLICA | ALWAYS) RULE ignoredIdentifier | (DISABLE | ENABLE | (NO? FORCE)) ROW LEVEL SECURITY | CLUSTER ON indexName | SET WITHOUT CLUSTER | SET (WITH | WITHOUT) OIDS | SET TABLESPACE ignoredIdentifier | SET (LOGGED | UNLOGGED) | SET LP_ storageParameterWithValue (COMMA_ storageParameterWithValue)* RP_ | RESET LP_ storageParameter (COMMA_ storageParameter)* RP_ | INHERIT tableName | NO INHERIT tableName | OF dataTypeName | NOT OF | OWNER TO (ignoredIdentifier | CURRENT_USER | SESSION_USER) | REPLICA IDENTITY (DEFAULT | (USING INDEX indexName) | FULL | NOTHING) ; addColumnSpecification : ADD COLUMN? notExistClause? columnDefinition ; dropColumnSpecification : DROP COLUMN? existClause? columnName (RESTRICT | CASCADE)? ; modifyColumnSpecification : modifyColumn (SET DATA)? TYPE dataType collateClause? (USING aExpr)? | modifyColumn SET DEFAULT aExpr | modifyColumn DROP DEFAULT | modifyColumn (SET | DROP) NOT NULL | modifyColumn ADD GENERATED (ALWAYS | (BY DEFAULT)) AS IDENTITY (LP_ sequenceOptions RP_)? | modifyColumn alterColumnSetOption alterColumnSetOption* | modifyColumn DROP IDENTITY existClause? | modifyColumn SET STATISTICS NUMBER_ | modifyColumn SET LP_ attributeOptions RP_ | modifyColumn RESET LP_ attributeOptions RP_ | modifyColumn SET STORAGE (PLAIN | EXTERNAL | EXTENDED | MAIN) ; modifyColumn : ALTER COLUMN? columnName ; alterColumnSetOption : SET (GENERATED (ALWAYS | BY DEFAULT) | sequenceOption) | RESTART (WITH? NUMBER_)? ; attributeOptions : attributeOption (COMMA_ attributeOption)* ; attributeOption : IDENTIFIER_ EQ_ aExpr ; addConstraintSpecification : ADD (tableConstraint (NOT VALID)? | tableConstraintUsingIndex) ; tableConstraintUsingIndex : (CONSTRAINT constraintName)? (UNIQUE | primaryKey) USING INDEX indexName constraintOptionalParam ; modifyConstraintSpecification : ALTER CONSTRAINT constraintName constraintOptionalParam ; validateConstraintSpecification : VALIDATE CONSTRAINT constraintName ; dropConstraintSpecification : DROP CONSTRAINT existClause? constraintName (RESTRICT | CASCADE)? ; storageParameterWithValue : storageParameter EQ_ aExpr ; storageParameter : IDENTIFIER_ ; renameColumnSpecification : RENAME COLUMN? columnName TO columnName ; renameConstraint : RENAME CONSTRAINT ignoredIdentifier TO ignoredIdentifier ; renameTableSpecification : RENAME TO identifier ; indexNames : indexName (COMMA_ indexName)* ; alterDatabase : ALTER DATABASE databaseName alterDatabaseClause ; alterDatabaseClause : WITH? createdbOptItems? | RENAME TO databaseName | OWNER TO roleSpec | SET TABLESPACE name | setResetClause ; createdbOptItems : createdbOptItem+ ; createdbOptItem : createdbOptName EQ_? signedIconst | createdbOptName EQ_? booleanOrString | createdbOptName EQ_? DEFAULT ; alterTableCmds : alterTableCmd (COMMA_ alterTableCmd)* ; alterTableCmd : ADD COLUMN? notExistClause? columnDef | ALTER COLUMN? colId alterColumnDefault | ALTER COLUMN? colId DROP NOT NULL | ALTER COLUMN? colId SET NOT NULL | ALTER COLUMN? colId SET STATISTICS signedIconst | ALTER COLUMN? NUMBER_ SET STATISTICS signedIconst | ALTER COLUMN? colId SET reloptions | ALTER COLUMN? colId RESET reloptions | ALTER COLUMN? colId SET STORAGE colId | ALTER COLUMN? colId SET columnCompression | ALTER COLUMN? colId ADD GENERATED generatedWhen AS IDENTITY parenthesizedSeqOptList? | ALTER COLUMN? colId alterIdentityColumnOptionList | ALTER COLUMN? colId DROP IDENTITY | ALTER COLUMN? colId DROP IDENTITY existClause | DROP COLUMN? existClause colId dropBehavior? | DROP COLUMN? colId dropBehavior? | ALTER COLUMN? colId setData? TYPE typeName collateClause? alterUsing? | ALTER COLUMN? colId alterGenericOptions | ADD tableConstraint (NOT VALID)? | ALTER CONSTRAINT name constraintAttributeSpec | VALIDATE CONSTRAINT name | DROP CONSTRAINT existClause name dropBehavior? | DROP CONSTRAINT name dropBehavior? | SET WITHOUT OIDS | CLUSTER ON name | SET WITHOUT CLUSTER | SET LOGGED | SET UNLOGGED | ENABLE TRIGGER name | ENABLE ALWAYS TRIGGER name | ENABLE REPLICA TRIGGER name | ENABLE TRIGGER ALL | ENABLE TRIGGER USER | DISABLE TRIGGER name | DISABLE TRIGGER ALL | DISABLE TRIGGER USER | ENABLE RULE name | ENABLE ALWAYS RULE name | ENABLE REPLICA RULE name | DISABLE RULE name | INHERIT qualifiedName | NO INHERIT qualifiedName | OF anyName | NOT OF | OWNER TO roleSpec | SET TABLESPACE name | SET reloptions | RESET reloptions | REPLICA IDENTITY replicaIdentity | ENABLE ROW LEVEL SECURITY | DISABLE ROW LEVEL SECURITY | FORCE ROW LEVEL SECURITY | NO FORCE ROW LEVEL SECURITY | alterGenericOptions ; columnCompression : COMPRESSION colId | COMPRESSION DEFAULT ; constraintAttributeSpec : constraintAttributeElem* ; constraintAttributeElem : NOT DEFERRABLE | DEFERRABLE | INITIALLY IMMEDIATE | INITIALLY DEFERRED | NOT VALID | NO INHERIT ; alterGenericOptions : OPTIONS LP_ alterGenericOptionList RP_ ; alterGenericOptionList : alterGenericOptionElem (COMMA_ alterGenericOptionElem)* ; alterGenericOptionElem : genericOptionElem | SET genericOptionElem | ADD genericOptionElem | DROP genericOptionName ; genericOptionName : colLable ; dropBehavior : CASCADE | RESTRICT ; alterUsing : USING aExpr ; setData : SET DATA ; alterIdentityColumnOptionList : alterIdentityColumnOption+ ; alterIdentityColumnOption : RESTART | RESTART WITH? numericOnly | SET seqOptElem | SET GENERATED generatedWhen ; alterColumnDefault : SET DEFAULT aExpr | DROP DEFAULT ; alterOperator : ALTER OPERATOR alterOperatorClauses ; alterOperatorClass : ALTER OPERATOR CLASS anyName USING name alterOperatorClassClauses ; alterOperatorClassClauses : RENAME TO name | SET SCHEMA name | OWNER TO roleSpec ; alterOperatorFamily : ALTER OPERATOR FAMILY anyName USING name alterOperatorFamilyClauses ; alterOperatorFamilyClauses : (ADD | DROP) opclassItemList | alterOperatorClassClauses ; opclassItemList : opclassItem (COMMA_ opclassItem)* ; opclassItem : OPERATOR NUMBER_ anyOperator opclassPurpose? RECHECK? | OPERATOR NUMBER_ operatorWithArgtypes opclassPurpose? RECHECK? | FUNCTION NUMBER_ functionWithArgtypes | FUNCTION NUMBER_ LP_ typeList RP_ functionWithArgtypes | STORAGE typeName ; opclassPurpose : FOR SEARCH | FOR ORDER BY anyName ; alterOperatorClauses : operatorWithArgtypes SET SCHEMA schemaName | operatorWithArgtypes SET LP_ operatorDefList RP_ | operatorWithArgtypes OWNER TO roleSpec ; operatorDefList : operatorDefElem (COMMA_ operatorDefElem)* ; operatorDefElem : (RESTRICT | JOIN) EQ_ (NONE | operatorDefArg) ; operatorDefArg : funcType | reservedKeyword | qualAllOp | numericOnly | STRING_ ; operatorWithArgtypes : anyOperator operArgtypes ; alterAggregate : ALTER AGGREGATE aggregateSignature alterAggregateDefinitionClause ; aggregateSignature : funcName aggrArgs ; aggrArgs : LP_ ASTERISK_ RP_ | LP_ aggrArgsList RP_ | LP_ ORDER BY aggrArgsList RP_ | LP_ aggrArgsList ORDER BY aggrArgsList RP_ ; aggrArgsList : aggrArg (COMMA_ aggrArg)* ; aggrArg : funcArg ; alterAggregateDefinitionClause : RENAME TO name | OWNER TO roleSpec | SET SCHEMA schemaName ; alterCollation : ALTER COLLATION anyName alterCollationClause ; alterCollationClause : REFRESH VERSION | RENAME TO name | OWNER TO roleSpec | SET SCHEMA schemaName ; alterConversion : ALTER CONVERSION anyName alterConversionClause ; alterConversionClause : RENAME TO name | OWNER TO roleSpec | SET SCHEMA schemaName ; alterDefaultPrivileges : ALTER DEFAULT PRIVILEGES defACLOptionList? defACLAction ; defACLAction : GRANT privileges ON defaclPrivilegeTarget TO granteeList grantGrantOption? | REVOKE privileges ON defaclPrivilegeTarget FROM granteeList dropBehavior? | REVOKE GRANT OPTION FOR privileges ON defaclPrivilegeTarget FROM granteeList dropBehavior? ; grantGrantOption : WITH GRANT OPTION ; granteeList : grantee (COMMA_ grantee)* ; grantee : GROUP? roleSpec ; defaclPrivilegeTarget :TABLES | FUNCTIONS | ROUTINES | SEQUENCES | TYPES | SCHEMAS ; privileges : privilegeList | ALL | ALL PRIVILEGES | ALL LP_ columnList RP_ | ALL PRIVILEGES LP_ columnList RP_ ; privilegeList : privilege (COMMA_ privilege)* ; privilege : SELECT optColumnList? | REFERENCES optColumnList? | CREATE optColumnList? | colId optColumnList? ; defACLOptionList : defACLOption+ ; defACLOption : IN SCHEMA schemaNameList | FOR (ROLE | USER) roleList ; schemaNameList : nameList ; alterDomain : ALTER DOMAIN alterDomainClause ; alterDomainClause : anyName (SET | DROP) NOT NULL | anyName ADD tableConstraint (NOT VALID)? | anyName DROP CONSTRAINT existClause? name dropBehavior? | anyName VALIDATE CONSTRAINT name | anyName RENAME CONSTRAINT constraintName TO constraintName | anyName OWNER TO roleSpec | anyName RENAME TO anyName | anyName SET SCHEMA name | anyName alterColumnDefault ; alterEventTrigger : ALTER EVENT TRIGGER tiggerName alterEventTriggerClause ; alterEventTriggerClause : DISABLE | ENABLE (REPLICA | ALWAYS) | OWNER TO roleSpec | RENAME TO tiggerName ; tiggerName : colId ; alterExtension : ALTER EXTENSION name alterExtensionClauses ; alterExtensionClauses : UPDATE alterExtensionOptList | (ADD | DROP) ACCESS METHOD name | (ADD | DROP) AGGREGATE aggregateWithArgtypes | (ADD | DROP) CAST LP_ typeName AS typeName RP_ | (ADD | DROP) COLLATION anyName | (ADD | DROP) CONVERSION anyName | (ADD | DROP) DOMAIN typeName | (ADD | DROP) FUNCTION functionWithArgtypes | (ADD | DROP) PROCEDURAL? LANGUAGE name | (ADD | DROP) OPERATOR operatorWithArgtypes | (ADD | DROP) OPERATOR (CLASS | FAMILY) anyName USING accessMethod | (ADD | DROP) PROCEDURE functionWithArgtypes | (ADD | DROP) ROUTINE functionWithArgtypes | (ADD | DROP) SCHEMA name | (ADD | DROP) EVENT TRIGGER name | (ADD | DROP) TABLE anyName | (ADD | DROP) TEXT SEARCH PARSER anyName | (ADD | DROP) TEXT SEARCH DICTIONARY anyName | (ADD | DROP) TEXT SEARCH TEMPLATE anyName | (ADD | DROP) TEXT SEARCH CONFIGURATION anyName | (ADD | DROP) SEQUENCE anyName | (ADD | DROP) VIEW anyName | (ADD | DROP) MATERIALIZED VIEW anyName | (ADD | DROP) FOREIGN TABLE anyName | (ADD | DROP) FOREIGN DATA WRAPPER name | (ADD | DROP) SERVER name | (ADD | DROP) TRANSFORM FOR typeName LANGUAGE name | (ADD | DROP) TYPE typeName | SET SCHEMA name ; functionWithArgtypes : funcName funcArgs | typeFuncNameKeyword | colId | colId indirection ; funcArgs : LP_ funcArgsList RP_ | LP_ RP_ ; aggregateWithArgtypes : funcName aggrArgs ; alterExtensionOptList : alterExtensionOptItem* ; alterExtensionOptItem : TO (nonReservedWord | STRING_) ; alterForeignDataWrapper : ALTER FOREIGN DATA WRAPPER colId alterForeignDataWrapperClauses ; alterForeignDataWrapperClauses : fdwOptions? alterGenericOptions | fdwOptions | RENAME TO name | OWNER TO roleSpec ; genericOptionElem : genericOptionName genericOptionArg ; genericOptionArg : aexprConst ; fdwOptions : fdwOption+ ; fdwOption : HANDLER handlerName | NO HANDLER | VALIDATOR handlerName | NO VALIDATOR ; handlerName : anyName ; alterGroup : ALTER GROUP alterGroupClauses ; alterGroupClauses : roleSpec (ADD|DROP) USER roleList | roleSpec RENAME TO roleSpec ; alterLanguage : ALTER PROCEDURAL? LANGUAGE colId (RENAME TO colId | OWNER TO (ignoredIdentifier | CURRENT_USER | SESSION_USER)) ; alterLargeObject : ALTER LARGE OBJECT numericOnly OWNER TO (ignoredIdentifier | CURRENT_USER | SESSION_USER) ; alterMaterializedView : ALTER MATERIALIZED VIEW alterMaterializedViewClauses ; alterMaterializedViewClauses : existClause? qualifiedName alterTableCmds | qualifiedName DEPENDS ON EXTENSION name | existClause? qualifiedName RENAME COLUMN? columnName TO columnName | existClause? qualifiedName RENAME TO qualifiedName | existClause? qualifiedName SET SCHEMA schemaName | ALL IN TABLESPACE name (OWNED BY roleList) SET TABLESPACE name NOWAIT? ; executeStmt : EXECUTE name executeParamClause ; createMaterializedView : CREATE UNLOGGED? MATERIALIZED VIEW notExistClause? createMvTarget AS select (WITH DATA | WITH NO DATA)? ; createMvTarget : qualifiedName optColumnList? tableAccessMethodClause (WITH reloptions)? (TABLESPACE name)? ; refreshMatViewStmt : REFRESH MATERIALIZED VIEW CONCURRENTLY? qualifiedName (WITH DATA | WITH NO DATA)? ; alterPolicy : ALTER POLICY name ON tableName alterPolicyClauses ; alterPolicyClauses : (TO roleList)? (USING LP_ aExpr RP_)? (WITH CHECK LP_ aExpr RP_)? | RENAME TO name ; alterProcedure : ALTER PROCEDURE functionWithArgtypes alterProcedureClauses ; alterProcedureClauses : alterfuncOptList RESTRICT? | RENAME TO name | NO? DEPENDS ON EXTENSION name | SET SCHEMA name | OWNER TO roleSpec ; alterfuncOptList : commonFuncOptItem+ ; alterFunction : ALTER FUNCTION functionWithArgtypes alterFunctionClauses ; alterFunctionClauses : alterfuncOptList RESTRICT? | RENAME TO name | NO? DEPENDS ON EXTENSION name | SET SCHEMA name | OWNER TO roleSpec ; alterPublication : ALTER PUBLICATION name ( RENAME TO name | OWNER TO roleSpec | SET definition | (ADD | SET | DROP) TABLE relationExprList) ; alterRoutine : ALTER ROUTINE functionWithArgtypes alterProcedureClauses ; alterRule : ALTER RULE ON qualifiedName RENAME TO name ; alterSequence : ALTER SEQUENCE existClause? qualifiedName alterSequenceClauses ; alterSequenceClauses : alterTableCmds | seqOptList | RENAME TO name | SET SCHEMA name ; alterServer : ALTER SERVER name ( foreignServerVersion alterGenericOptions | foreignServerVersion | alterGenericOptions | RENAME TO name | OWNER TO roleSpec) ; foreignServerVersion : VERSION (STRING_ | NULL) ; alterStatistics : ALTER STATISTICS ( existClause? anyName SET STATISTICS signedIconst | anyName RENAME TO name | anyName SET SCHEMA name | anyName OWNER TO roleSpec) ; alterSubscription : ALTER SUBSCRIPTION name ( RENAME TO name | OWNER TO roleSpec | SET definition | CONNECTION STRING_ | REFRESH PUBLICATION (WITH definition)? | SET PUBLICATION publicationNameList (WITH definition)? | (ENABLE | DISABLE)) ; publicationNameList : publicationNameItem (COMMA_ publicationNameItem)* ; publicationNameItem : colLabel ; alterSystem : ALTER SYSTEM (SET genericSet | RESET genericReset) ; alterTablespace : ALTER TABLESPACE name ( SET|RESET reloptions | RENAME TO name | OWNER TO roleSpec) ; alterTextSearchConfiguration : ALTER TEXT SEARCH CONFIGURATION anyName alterTextSearchConfigurationClauses ; alterTextSearchConfigurationClauses : RENAME TO name | SET SCHEMA name | OWNER TO roleSpec | (ADD | ALTER) MAPPING FOR nameList WITH? anyNameList | ALTER MAPPING (FOR nameList)? REPLACE anyName WITH anyName | DROP MAPPING existClause? FOR nameList ; anyNameList : anyName (COMMA_ anyName)* ; alterTextSearchDictionary : ALTER TEXT SEARCH DICTIONARY anyName ( RENAME TO name | SET SCHEMA name | OWNER TO roleSpec | definition) ; alterTextSearchParser : ALTER TEXT SEARCH PARSER (anyName RENAME TO name | SET SCHEMA name) ; alterTextSearchTemplate : ALTER TEXT SEARCH TEMPLATE (anyName RENAME TO name | SET SCHEMA name) ; alterTrigger : ALTER TRIGGER name ON qualifiedName (RENAME TO name | NO? DEPENDS ON EXTENSION name) ; alterType : ALTER TYPE anyName alterTypeClauses ; alterTypeClauses : alterTypeCmds | ADD VALUE notExistClause? STRING_ ((BEFORE | AFTER) STRING_)? | RENAME VALUE STRING_ TO STRING_ | RENAME TO name | RENAME ATTRIBUTE name TO name dropBehavior? | SET SCHEMA name | SET LP_ operatorDefList RP_ | OWNER TO roleSpec ; alterTypeCmds : alterTypeCmd (COMMA_ alterTypeCmd)? ; alterTypeCmd : ADD ATTRIBUTE tableFuncElement dropBehavior? | DROP ATTRIBUTE existClause colId dropBehavior? | DROP ATTRIBUTE colId dropBehavior? | ALTER ATTRIBUTE colId setData? TYPE typeName collateClause? dropBehavior? ; alterUserMapping : ALTER USER MAPPING FOR authIdent SERVER name alterGenericOptions ; authIdent : roleSpec | USER ; alterView : ALTER VIEW existClause? qualifiedName alterViewClauses ; alterViewClauses : alterTableCmds #alterViewCmds | RENAME TO name #alterRenameView | RENAME COLUMN? name TO name #alterRenameColumn | SET SCHEMA name #alterSetSchema ; close : CLOSE (cursorName | ALL) ; cluster : CLUSTER clusterVerboseSpecification? tableName? clusterIndexSpecification? ; clusterVerboseSpecification : VERBOSE | clusterVerboseOptionList ; clusterIndexSpecification : USING indexName ; clusterVerboseOptionList : LP_ clusterVerboseOption (COMMA_ clusterVerboseOption)* RP_ ; clusterVerboseOption : VERBOSE booleanValue? ; comment : COMMENT ON commentClauses ; commentClauses : objectTypeAnyName anyName IS commentText | COLUMN anyName IS commentText | objectTypeName name IS commentText | TYPE typeName IS commentText | DOMAIN typeName IS commentText | AGGREGATE aggregateWithArgtypes IS commentText | FUNCTION functionWithArgtypes IS commentText | OPERATOR operatorWithArgtypes IS commentText | CONSTRAINT name ON DOMAIN anyName IS commentText | objectTypeNameOnAnyName name ON tableName IS commentText | PROCEDURE functionWithArgtypes IS commentText | ROUTINE functionWithArgtypes IS commentText | TRANSFORM FOR typeName LANGUAGE name IS commentText | OPERATOR CLASS anyName USING name IS commentText | OPERATOR FAMILY anyName USING name IS commentText | LARGE OBJECT numericOnly IS commentText | CAST LP_ typeName AS typeName RP_ IS commentText ; objectTypeNameOnAnyName : POLICY | RULE | TRIGGER | CONSTRAINT ; objectTypeName : dropTypeName | DATABASE | ROLE | SUBSCRIPTION | TABLESPACE ; dropTypeName : ACCESS METHOD | EVENT TRIGGER | EXTENSION | FOREIGN DATA WRAPPER | PROCEDURAL? LANGUAGE | PUBLICATION | SCHEMA | SERVER ; objectTypeAnyName : TABLE | SEQUENCE | VIEW | MATERIALIZED VIEW | INDEX | FOREIGN TABLE | COLLATION | CONVERSION | STATISTICS | TEXT SEARCH PARSER | TEXT SEARCH DICTIONARY | TEXT SEARCH TEMPLATE | TEXT SEARCH CONFIGURATION ; commentText : STRING_ | NULL ; createAccessMethod : CREATE ACCESS METHOD name TYPE (INDEX|TABLE) HANDLER handlerName ; createAggregate : CREATE (OR REPLACE)? AGGREGATE funcName (aggrArgs definition | oldAggrDefinition) ; oldAggrDefinition : LP_ oldAggrList RP_ ; oldAggrList : oldAggrElem (COMMA_ oldAggrElem)* ; oldAggrElem : identifier EQ_ defArg ; createCast : CREATE CAST LP_ typeName AS typeName RP_ ( WITH FUNCTION functionWithArgtypes castContext? | WITHOUT FUNCTION castContext? | WITH INOUT castContext?) ; castContext : AS IMPLICIT | AS ASSIGNMENT ; createCollation : CREATE COLLATION notExistClause? (anyName definition | anyName FROM anyName) ; createConversion : CREATE DEFAULT? CONVERSION anyName FOR STRING_ TO STRING_ FROM anyName ; createDomain : CREATE DOMAIN anyName AS? typeName colQualList ; createEventTrigger : CREATE EVENT TRIGGER name ON colLabel (WHEN eventTriggerWhenList)? EXECUTE (FUNCTION | PROCEDURE) funcName LP_ RP_ ; eventTriggerWhenList : eventTriggerWhenItem (AND eventTriggerWhenItem)* ; eventTriggerWhenItem : colId IN LP_ eventTriggerValueList RP_ ; eventTriggerValueList : STRING_ (COMMA_ STRING_)* ; createExtension : CREATE EXTENSION notExistClause? name WITH? createExtensionOptList ; createExtensionOptList : createExtensionOptItem* ; createExtensionOptItem : SCHEMA name | VERSION nonReservedWordOrSconst | FROM nonReservedWordOrSconst | CASCADE ; createForeignDataWrapper : CREATE FOREIGN DATA WRAPPER name fdwOptions? createGenericOptions? ; createForeignTable : CREATE FOREIGN TABLE createForeignTableClauses ; createForeignTableClauses : notExistClause? qualifiedName LP_ tableElementList? RP_ (INHERITS LP_ qualifiedNameList RP_)? SERVER name createGenericOptions? | notExistClause? qualifiedName PARTITION OF qualifiedName (LP_ typedTableElementList RP_)? partitionBoundSpec SERVER name createGenericOptions? ; tableElementList : tableElement (COMMA_ tableElement)* ; tableElement : columnDef | tableLikeClause | tableConstraint ; tableLikeClause : LIKE qualifiedName tableLikeOptionList ; tableLikeOptionList : tableLikeOptionList (INCLUDING | EXCLUDING) tableLikeOption | ; tableLikeOption : COMMENTS | CONSTRAINTS | DEFAULTS | IDENTITY | GENERATED | INDEXES | STATISTICS | STORAGE | ALL ; createFunction : CREATE (OR REPLACE)? FUNCTION funcName funcArgsWithDefaults ( RETURNS funcReturn createfuncOptList | RETURNS TABLE LP_ tableFuncColumnList RP_ createfuncOptList | createfuncOptList) ; tableFuncColumnList : tableFuncColumn (COMMA_ tableFuncColumn)* ; tableFuncColumn : paramName funcType ; createfuncOptList : createfuncOptItem+ ; createfuncOptItem : AS funcAs | LANGUAGE nonReservedWordOrSconst | TRANSFORM transformTypeList | WINDOW | commonFuncOptItem ; transformTypeList : FOR TYPE typeName (COMMA_ FOR TYPE typeName) ; funcAs : identifier | STRING_ (COMMA_ identifier|STRING_)? ; funcReturn : funcType ; funcArgsWithDefaults : LP_ funcArgsWithDefaultsList? RP_ ; funcArgsWithDefaultsList : funcArgWithDefault (COMMA_ funcArgWithDefault)* ; funcArgWithDefault : funcArg | funcArg DEFAULT aExpr | funcArg EQ_ aExpr ; createLanguage : CREATE (OR REPLACE)? TRUSTED? PROCEDURAL? LANGUAGE name ( HANDLER handlerName (INLINE handlerName)? validatorClause? | LP_ transformElementList RP_)? ; transformElementList : FROM SQL WITH FUNCTION functionWithArgtypes COMMA_ (TO | FROM) SQL WITH FUNCTION functionWithArgtypes | (TO | FROM) SQL WITH FUNCTION functionWithArgtypes ; validatorClause : VALIDATOR handlerName | NO VALIDATOR ; createPolicy : CREATE POLICY name ON qualifiedName (AS identifier)? (FOR rowSecurityCmd)? (TO roleList)? (USING LP_ aExpr RP_)? (WITH CHECK LP_ aExpr RP_)? ; createProcedure : CREATE (OR REPLACE)? PROCEDURE funcName funcArgsWithDefaults createfuncOptList ; createPublication : CREATE PUBLICATION name publicationForTables? (WITH definition)? ; publicationForTables : FOR TABLE relationExprList | FOR ALL TABLES ; createRule : CREATE (OR REPLACE)? RULE name AS ON event TO qualifiedName (WHERE aExpr)? DO (INSTEAD | ALSO)? ruleActionList ; ruleActionList : NOTHING | ruleActionStmt | LP_ ruleActionMulti RP_ ; ruleActionStmt : select | insert | update | delete | notifyStmt ; ruleActionMulti : ruleActionStmt? (SEMI_ ruleActionStmt?)* ; notifyStmt : NOTIFY colId (COMMA_ STRING_)? ; createTrigger : CREATE TRIGGER name triggerActionTime triggerEvents ON qualifiedName triggerReferencing? triggerForSpec? triggerWhen? EXECUTE (FUNCTION | PROCEDURE) funcName LP_ triggerFuncArgs? RP_ | CREATE CONSTRAINT TRIGGER (FROM qualifiedName)? constraintAttributeSpec FOR EACH ROW triggerWhen EXECUTE (FUNCTION | PROCEDURE) funcName LP_ triggerFuncArgs RP_ ; triggerEvents : triggerOneEvent (OR triggerOneEvent)* ; triggerOneEvent : INSERT | DELETE | UPDATE | UPDATE OF columnList | TRUNCATE ; triggerActionTime : BEFORE | AFTER | INSTEAD OF ; triggerFuncArgs : triggerFuncArg (COMMA_ triggerFuncArg)* ; triggerFuncArg : NUMBER_ | STRING_ | colLabel ; triggerWhen : WHEN LP_ aExpr RP_ ; triggerForSpec : FOR EACH? (ROW | STATEMENT) ; triggerReferencing : REFERENCING triggerTransitions ; triggerTransitions : triggerTransition+ ; triggerTransition : transitionOldOrNew transitionRowOrTable AS? transitionRelName ; transitionRelName : colId ; transitionRowOrTable : TABLE | ROW ; transitionOldOrNew : OLD | NEW ; createSequence : CREATE tempOption? SEQUENCE notExistClause? qualifiedName seqOptList? ; tempOption : ((LOCAL | GLOBAL)? (TEMPORARY | TEMP)) | UNLOGGED ; createServer : CREATE SERVER notExistClause? name (TYPE STRING_)? foreignServerVersion? FOREIGN DATA WRAPPER name createGenericOptions ; createStatistics : CREATE STATISTICS notExistClause? anyName optNameList ON exprList FROM fromList ; createSubscription : CREATE SUBSCRIPTION name CONNECTION STRING_ PUBLICATION publicationNameList (WITH definition)? ; createTablespace : CREATE TABLESPACE name (OWNER roleSpec)? LOCATION STRING_ (WITH reloptions)? ; createTextSearch : CREATE TEXT SEARCH (CONFIGURATION | DICTIONARY | PARSER | TEMPLATE) anyName definition ; createTransform : CREATE (OR REPLACE)? TRANSFORM FOR typeName LANGUAGE name LP_ transformElementList RP_ ; createType : CREATE TYPE anyName createTypeClauses ; createTypeClauses : definition? | AS LP_ tableFuncElementList? RP_ | AS ENUM LP_ enumValList? RP_ | AS RANGE definition ; enumValList : STRING_ (COMMA_ STRING_)* ; createUserMapping : CREATE USER MAPPING notExistClause? FOR authIdent SERVER name createGenericOptions ; discard : DISCARD (ALL | PLANS | SEQUENCES | TEMPORARY | TEMP) ; dropAccessMethod : DROP ACCESS METHOD existClause? name dropBehavior? ; dropAggregate : DROP AGGREGATE existClause? aggregateWithArgtypesList dropBehavior? ; aggregateWithArgtypesList : aggregateWithArgtypes (COMMA_ aggregateWithArgtypes)* ; dropCast : DROP CAST existClause? LP_ typeName AS typeName RP_ dropBehavior? ; dropCollation : DROP COLLATION existClause? name dropBehavior? ; dropConversion : DROP CONVERSION existClause? name dropBehavior? ; dropDomain : DROP DOMAIN existClause? nameList dropBehavior? ; dropEventTrigger : DROP EVENT TRIGGER existClause? nameList dropBehavior? ; dropExtension : DROP EXTENSION existClause? nameList dropBehavior? ; dropForeignDataWrapper : DROP FOREIGN DATA WRAPPER existClause? nameList dropBehavior? ; dropForeignTable : DROP FOREIGN TABLE existClause? tableName (COMMA_ tableName)* dropBehavior? ; dropFunction : DROP FUNCTION existClause? functionWithArgtypesList dropBehavior? ; functionWithArgtypesList : functionWithArgtypes (COMMA_ functionWithArgtypes)* ; dropLanguage : DROP PROCEDURAL? LANGUAGE existClause? name dropBehavior? ; dropMaterializedView : DROP MATERIALIZED VIEW existClause? anyNameList dropBehavior? ; dropOperator : DROP OPERATOR existClause? operatorWithArgtypesList dropBehavior? ; operatorWithArgtypesList : operatorWithArgtypes (COMMA_ operatorWithArgtypes)* ; dropOperatorClass : DROP OPERATOR CLASS existClause? anyName USING name dropBehavior? ; dropOperatorFamily : DROP OPERATOR FAMILY existClause? anyName USING name dropBehavior? ; dropOwned : DROP OWNED BY roleList dropBehavior? ; dropPolicy : DROP POLICY existClause? name ON tableName dropBehavior? ; dropProcedure : DROP PROCEDURE existClause? functionWithArgtypesList dropBehavior? ; dropPublication : DROP PUBLICATION existClause? anyNameList dropBehavior? ; dropRoutine : DROP ROUTINE existClause? functionWithArgtypesList dropBehavior? ; dropRule : DROP RULE existClause? name ON tableName dropBehavior? ; dropSequence : DROP SEQUENCE existClause? qualifiedNameList dropBehavior? ; dropServer : DROP SERVER existClause? qualifiedNameList dropBehavior? ; dropStatistics : DROP STATISTICS existClause? qualifiedNameList dropBehavior? ; dropSubscription : DROP SUBSCRIPTION existClause? qualifiedName dropBehavior? ; dropTablespace : DROP TABLESPACE existClause? qualifiedName ; dropTextSearch : DROP TEXT SEARCH (CONFIGURATION | DICTIONARY | PARSER | TEMPLATE) existClause? qualifiedName dropBehavior? ; dropTransform : DROP TRANSFORM existClause? FOR typeName LANGUAGE name dropBehavior? ; dropTrigger : DROP TRIGGER existClause? qualifiedName ON tableName dropBehavior? ; dropType : DROP TYPE existClause? anyNameList dropBehavior? ; dropUserMapping : DROP USER MAPPING existClause? FOR authIdent SERVER name ; dropView : DROP VIEW existClause? qualifiedNameList dropBehavior? ; importForeignSchema : IMPORT FOREIGN SCHEMA name importQualification? FROM SERVER name INTO name createGenericOptions? ; importQualification : importQualificationType LP_ relationExprList RP_ ; importQualificationType : LIMIT TO | EXCEPT ; listen : LISTEN colId ; declare : DECLARE cursorName cursorOptions CURSOR (WITH HOLD | WITHOUT HOLD)? FOR select ; cursorOptions : cursorOption* ; cursorOption : NO SCROLL | SCROLL | BINARY | INSENSITIVE ; move : MOVE direction? (FROM | IN)? cursorName ; fetch : FETCH direction? (FROM | IN)? cursorName ; direction : NEXT #next | PRIOR #prior | FIRST #first | LAST #last | ABSOLUTE signedIconst #absoluteCount | RELATIVE signedIconst #relativeCount | signedIconst #count | ALL #all | FORWARD #forward | FORWARD signedIconst #forwardCount | FORWARD ALL #forwardAll | BACKWARD #backward | BACKWARD signedIconst #backwardCount | BACKWARD ALL #backwardAll ; prepare : PREPARE name prepTypeClause? AS preparableStmt ; deallocate : DEALLOCATE PREPARE? (name | ALL) ; prepTypeClause : LP_ typeList RP_ ; refreshMaterializedView : REFRESH MATERIALIZED VIEW CONCURRENTLY? qualifiedName withData? ; reIndex : REINDEX reIndexClauses ; reIndexClauses : reindexTargetType CONCURRENTLY? qualifiedName | reindexTargetMultitable CONCURRENTLY? name | LP_ reindexOptionList RP_ reindexTargetType CONCURRENTLY? qualifiedName | LP_ reindexOptionList RP_ reindexTargetMultitable CONCURRENTLY? name ; reindexOptionList : reindexOptionElem (COMMA_ reindexOptionElem)* ; reindexOptionElem : VERBOSE ; reindexTargetMultitable : SCHEMA | SYSTEM | DATABASE ; reindexTargetType : INDEX | TABLE ; alterForeignTable : ALTER FOREIGN TABLE existClause? relationExpr alterForeignTableClauses ; alterForeignTableClauses : RENAME TO name | RENAME COLUMN? name TO name | alterTableCmds | SET SCHEMA name ; createOperator : CREATE OPERATOR anyOperator definition ; createOperatorClass : CREATE OPERATOR CLASS anyName DEFAULT? FOR TYPE typeName USING name (FAMILY anyName)? AS opclassItemList ; createOperatorFamily : CREATE OPERATOR FAMILY anyName USING name ; securityLabelStmt : SECURITY LABEL (FOR nonReservedWordOrSconst) ON securityLabelClausces IS securityLabel ; securityLabel : STRING_ | NULL ; securityLabelClausces : objectTypeAnyName anyName | COLUMN anyName | (TYPE | DOMAIN) typeName | (AGGREGATE | FUNCTION) aggregateWithArgtypes | LARGE OBJECT numericOnly | (PROCEDURE | ROUTINE) functionWithArgtypes ; unlisten : UNLISTEN (colId | ASTERISK_) ; createSchema : CREATE SCHEMA notExistClause? createSchemaClauses ; createSchemaClauses : colId? AUTHORIZATION roleSpec schemaEltList | colId schemaEltList ; schemaEltList : schemaStmt* ; schemaStmt : createTable | createIndex | createSequence | createTrigger | grant | createView ; grant : GRANT (privilegeClause | roleClause) ; privilegeClause : privilegeTypes ON onObjectClause (FROM | TO) granteeList (WITH GRANT OPTION)? ; roleClause : privilegeList (FROM | TO) roleList (WITH ADMIN OPTION)? (GRANTED BY roleSpec)? ; privilegeTypes : privilegeType columnNames? (COMMA_ privilegeType columnNames?)* ; onObjectClause : DATABASE nameList | SCHEMA nameList | DOMAIN anyNameList | FUNCTION functionWithArgtypesList | PROCEDURE functionWithArgtypesList | ROUTINE functionWithArgtypesList | LANGUAGE nameList | LARGE OBJECT numericOnlyList | TABLESPACE nameList | TYPE anyNameList | SEQUENCE qualifiedNameList | TABLE? privilegeLevel | FOREIGN DATA WRAPPER nameList | FOREIGN SERVER nameList | ALL TABLES IN SCHEMA nameList | ALL SEQUENCES IN SCHEMA nameList | ALL FUNCTIONS IN SCHEMA nameList | ALL PROCEDURES IN SCHEMA nameList | ALL ROUTINES IN SCHEMA nameList ; numericOnlyList : numericOnly (COMMA_ numericOnly)* ; privilegeLevel : ASTERISK_ | ASTERISK_ DOT_ASTERISK_ | identifier DOT_ASTERISK_ | tableNames | schemaName DOT_ routineName ; routineName : identifier ; privilegeType : SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER | CREATE | CONNECT | TEMPORARY | TEMP | EXECUTE | USAGE | ALL PRIVILEGES? ; alterSchema : ALTER SCHEMA name (RENAME TO name | OWNER TO roleSpec) ; dropSchema : DROP SCHEMA existClause? nameList dropBehavior? ;
oeis/021/A021139.asm
neoneye/loda-programs
11
26757
<gh_stars>10-100 ; A021139: Decimal expansion of 1/135. ; Submitted by <NAME> ; 0,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7,4,0,7 trn $0,1 mod $0,3 add $0,1 mul $0,27 sub $0,7 mod $0,10
src/file_utils.adb
psyomn/ash
11
9794
-- Copyright 2019 <NAME> (psyomn) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Text_IO; with Ada.Directories; with Ada.Direct_IO; with Ada.Exceptions; use Ada.Exceptions; package body File_Utils is package IO renames Ada.Text_IO; function Read (File_Name : String) return String is File_Size : constant Natural := Natural (Ada.Directories.Size (File_Name)); subtype File_String is String (1 .. File_Size); package File_String_IO is new Ada.Direct_IO (File_String); The_File : File_String_IO.File_Type; Contents : File_String; begin File_String_IO.Open (File => The_File, Mode => File_String_IO.In_File, Name => File_Name); File_String_IO.Read (The_File, Item => Contents); File_String_IO.Close (File => The_File); return Contents; exception when File_String_IO.Device_Error => File_String_IO.Close (File => The_File); raise File_String_IO.Device_Error; end Read; function Is_Dir (Path : String) return Boolean is use type Ada.Directories.File_Kind; begin return Ada.Directories.Exists (Path) and then Ada.Directories.Kind (Path) = Ada.Directories.Directory; end Is_Dir; end File_Utils;
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0x48.log_4549_1831.asm
ljhsiun2/medusa
9
82185
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r8 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0xbd18, %rcx nop nop add $36775, %r9 movl $0x61626364, (%rcx) nop nop nop nop nop sub %rcx, %rcx lea addresses_normal_ht+0xad10, %r8 nop nop dec %rcx mov $0x6162636465666768, %rdx movq %rdx, %xmm1 and $0xffffffffffffffc0, %r8 movntdq %xmm1, (%r8) nop add %rdx, %rdx lea addresses_D_ht+0x62b0, %rsi lea addresses_A_ht+0x4eb0, %rdi nop nop nop cmp $40063, %r13 mov $56, %rcx rep movsw nop nop nop nop add $12179, %r13 lea addresses_A_ht+0xfab0, %rdx nop nop nop nop dec %rcx mov (%rdx), %r13 nop nop nop sub %rbx, %rbx lea addresses_WC_ht+0x141f0, %rsi lea addresses_WC_ht+0x11ab0, %rdi nop nop nop nop xor %r9, %r9 mov $6, %rcx rep movsb nop nop nop nop add $21750, %rcx lea addresses_UC_ht+0xa79e, %r8 nop and $56272, %rdi mov $0x6162636465666768, %rdx movq %rdx, (%r8) add $29957, %r8 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r8 pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r15 push %r9 push %rbx push %rdi push %rdx // Store lea addresses_D+0x590, %rdi clflush (%rdi) nop dec %rbx mov $0x5152535455565758, %r9 movq %r9, %xmm2 movups %xmm2, (%rdi) nop nop nop nop nop add %r15, %r15 // Store mov $0x2b0, %rdi nop nop nop xor %r14, %r14 mov $0x5152535455565758, %r9 movq %r9, %xmm3 vmovups %ymm3, (%rdi) nop nop nop nop nop add $44153, %rbx // Store lea addresses_normal+0x5374, %r11 nop nop nop nop and $58073, %rdi mov $0x5152535455565758, %rdx movq %rdx, %xmm3 movups %xmm3, (%r11) nop nop add $24718, %rbx // Store lea addresses_US+0x16f38, %r15 nop nop nop sub $38920, %rdi mov $0x5152535455565758, %rbx movq %rbx, (%r15) nop nop nop nop cmp %r15, %r15 // Store lea addresses_A+0x52b0, %rbx nop nop nop nop and %r14, %r14 movw $0x5152, (%rbx) sub %rdx, %rdx // Faulty Load lea addresses_A+0x52b0, %r9 nop nop xor $26945, %r15 movb (%r9), %dl lea oracles, %rdi and $0xff, %rdx shlq $12, %rdx mov (%rdi,%rdx,1), %rdx pop %rdx pop %rdi pop %rbx pop %r9 pop %r15 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 11, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': True, 'NT': True}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 1, 'size': 8, 'same': False, 'NT': False}} {'52': 4549} 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 */
Cubical/Algebra/Group/Base.agda
ayberkt/cubical
0
14317
<reponame>ayberkt/cubical {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Algebra.Group.Base where open import Cubical.Foundations.Prelude open import Cubical.Foundations.SIP open import Cubical.Data.Sigma open import Cubical.Data.Int renaming (_+_ to _+Int_ ; _-_ to _-Int_) open import Cubical.Data.Unit open import Cubical.Algebra.Monoid open import Cubical.Algebra.Semigroup open import Cubical.Foundations.HLevels private variable ℓ : Level record IsGroup {G : Type ℓ} (0g : G) (_+_ : G → G → G) (-_ : G → G) : Type ℓ where constructor isgroup field isMonoid : IsMonoid 0g _+_ inverse : (x : G) → (x + (- x) ≡ 0g) × ((- x) + x ≡ 0g) open IsMonoid isMonoid public infixl 6 _-_ _-_ : G → G → G x - y = x + (- y) invl : (x : G) → (- x) + x ≡ 0g invl x = inverse x .snd invr : (x : G) → x + (- x) ≡ 0g invr x = inverse x .fst record GroupStr (G : Type ℓ) : Type (ℓ-suc ℓ) where constructor groupstr field 0g : G _+_ : G → G → G -_ : G → G isGroup : IsGroup 0g _+_ -_ infix 8 -_ infixr 7 _+_ open IsGroup isGroup public Group : Type (ℓ-suc ℓ) Group = TypeWithStr _ GroupStr Group₀ : Type₁ Group₀ = Group {ℓ-zero} group : (G : Type ℓ) (0g : G) (_+_ : G → G → G) (-_ : G → G) (h : IsGroup 0g _+_ -_) → Group group G 0g _+_ -_ h = G , groupstr 0g _+_ -_ h isSetGroup : (G : Group {ℓ}) → isSet ⟨ G ⟩ isSetGroup G = GroupStr.isGroup (snd G) .IsGroup.isMonoid .IsMonoid.isSemigroup .IsSemigroup.is-set makeIsGroup : {G : Type ℓ} {0g : G} {_+_ : G → G → G} { -_ : G → G} (is-setG : isSet G) (assoc : (x y z : G) → x + (y + z) ≡ (x + y) + z) (rid : (x : G) → x + 0g ≡ x) (lid : (x : G) → 0g + x ≡ x) (rinv : (x : G) → x + (- x) ≡ 0g) (linv : (x : G) → (- x) + x ≡ 0g) → IsGroup 0g _+_ -_ IsGroup.isMonoid (makeIsGroup is-setG assoc rid lid rinv linv) = makeIsMonoid is-setG assoc rid lid IsGroup.inverse (makeIsGroup is-setG assoc rid lid rinv linv) = λ x → rinv x , linv x makeGroup : {G : Type ℓ} (0g : G) (_+_ : G → G → G) (-_ : G → G) (is-setG : isSet G) (assoc : (x y z : G) → x + (y + z) ≡ (x + y) + z) (rid : (x : G) → x + 0g ≡ x) (lid : (x : G) → 0g + x ≡ x) (rinv : (x : G) → x + (- x) ≡ 0g) (linv : (x : G) → (- x) + x ≡ 0g) → Group makeGroup 0g _+_ -_ is-setG assoc rid lid rinv linv = _ , helper where helper : GroupStr _ GroupStr.0g helper = 0g GroupStr._+_ helper = _+_ GroupStr.- helper = -_ GroupStr.isGroup helper = makeIsGroup is-setG assoc rid lid rinv linv makeGroup-right : ∀ {ℓ} {A : Type ℓ} → (id : A) → (comp : A → A → A) → (inv : A → A) → (set : isSet A) → (assoc : ∀ a b c → comp a (comp b c) ≡ comp (comp a b) c) → (rUnit : ∀ a → comp a id ≡ a) → (rCancel : ∀ a → comp a (inv a) ≡ id) → Group makeGroup-right id comp inv set assoc rUnit rCancel = makeGroup id comp inv set assoc rUnit lUnit rCancel lCancel where _⨀_ = comp abstract lCancel : ∀ a → comp (inv a) a ≡ id lCancel a = inv a ⨀ a ≡⟨ sym (rUnit (comp (inv a) a)) ⟩ (inv a ⨀ a) ⨀ id ≡⟨ cong (comp (comp (inv a) a)) (sym (rCancel (inv a))) ⟩ (inv a ⨀ a) ⨀ (inv a ⨀ (inv (inv a))) ≡⟨ assoc _ _ _ ⟩ ((inv a ⨀ a) ⨀ (inv a)) ⨀ (inv (inv a)) ≡⟨ cong (λ □ → □ ⨀ _) (sym (assoc _ _ _)) ⟩ (inv a ⨀ (a ⨀ inv a)) ⨀ (inv (inv a)) ≡⟨ cong (λ □ → (inv a ⨀ □) ⨀ (inv (inv a))) (rCancel a) ⟩ (inv a ⨀ id) ⨀ (inv (inv a)) ≡⟨ cong (λ □ → □ ⨀ (inv (inv a))) (rUnit (inv a)) ⟩ inv a ⨀ (inv (inv a)) ≡⟨ rCancel (inv a) ⟩ id ∎ lUnit : ∀ a → comp id a ≡ a lUnit a = id ⨀ a ≡⟨ cong (λ b → comp b a) (sym (rCancel a)) ⟩ (a ⨀ inv a) ⨀ a ≡⟨ sym (assoc _ _ _) ⟩ a ⨀ (inv a ⨀ a) ≡⟨ cong (comp a) (lCancel a) ⟩ a ⨀ id ≡⟨ rUnit a ⟩ a ∎ makeGroup-left : ∀ {ℓ} {A : Type ℓ} → (id : A) → (comp : A → A → A) → (inv : A → A) → (set : isSet A) → (assoc : ∀ a b c → comp a (comp b c) ≡ comp (comp a b) c) → (lUnit : ∀ a → comp id a ≡ a) → (lCancel : ∀ a → comp (inv a) a ≡ id) → Group makeGroup-left id comp inv set assoc lUnit lCancel = makeGroup id comp inv set assoc rUnit lUnit rCancel lCancel where abstract rCancel : ∀ a → comp a (inv a) ≡ id rCancel a = comp a (inv a) ≡⟨ sym (lUnit (comp a (inv a))) ⟩ comp id (comp a (inv a)) ≡⟨ cong (λ b → comp b (comp a (inv a))) (sym (lCancel (inv a))) ⟩ comp (comp (inv (inv a)) (inv a)) (comp a (inv a)) ≡⟨ sym (assoc (inv (inv a)) (inv a) (comp a (inv a))) ⟩ comp (inv (inv a)) (comp (inv a) (comp a (inv a))) ≡⟨ cong (comp (inv (inv a))) (assoc (inv a) a (inv a)) ⟩ comp (inv (inv a)) (comp (comp (inv a) a) (inv a)) ≡⟨ cong (λ b → comp (inv (inv a)) (comp b (inv a))) (lCancel a) ⟩ comp (inv (inv a)) (comp id (inv a)) ≡⟨ cong (comp (inv (inv a))) (lUnit (inv a)) ⟩ comp (inv (inv a)) (inv a) ≡⟨ lCancel (inv a) ⟩ id ∎ rUnit : ∀ a → comp a id ≡ a rUnit a = comp a id ≡⟨ cong (comp a) (sym (lCancel a)) ⟩ comp a (comp (inv a) a) ≡⟨ assoc a (inv a) a ⟩ comp (comp a (inv a)) a ≡⟨ cong (λ b → comp b a) (rCancel a) ⟩ comp id a ≡⟨ lUnit a ⟩ a ∎ open GroupStr hiding (0g ; _+_ ; -_) isSetCarrier : ∀ {ℓ} → (G : Group {ℓ}) → isSet ⟨ G ⟩ isSetCarrier G = IsSemigroup.is-set (IsMonoid.isSemigroup (GroupStr.isMonoid (snd G))) open GroupStr dirProd : ∀ {ℓ ℓ'} → Group {ℓ} → Group {ℓ'} → Group dirProd (GC , G) (HC , H) = makeGroup (0g G , 0g H) (λ { (x1 , x2) (y1 , y2) → _+_ G x1 y1 , _+_ H x2 y2 }) (λ { (x1 , x2) → -_ G x1 , -_ H x2 }) (isSet× (isSetCarrier (GC , G)) (isSetCarrier (HC , H))) (λ { (x1 , x2) (y1 , y2) (z1 , z2) i → assoc G x1 y1 z1 i , assoc H x2 y2 z2 i }) (λ { (x1 , x2) i → GroupStr.rid G x1 i , GroupStr.rid H x2 i }) (λ { (x1 , x2) i → GroupStr.lid G x1 i , GroupStr.lid H x2 i }) (λ { (x1 , x2) i → GroupStr.invr G x1 i , GroupStr.invr H x2 i }) (λ { (x1 , x2) i → GroupStr.invl G x1 i , GroupStr.invl H x2 i }) trivialGroup : Group₀ trivialGroup = Unit , groupstr tt (λ _ _ → tt) (λ _ → tt) (makeIsGroup isSetUnit (λ _ _ _ → refl) (λ _ → refl) (λ _ → refl) (λ _ → refl) (λ _ → refl)) intGroup : Group₀ intGroup = Int , groupstr 0 _+Int_ (0 -Int_) (makeIsGroup isSetInt +-assoc (λ x → refl) (λ x → +-comm 0 x) (λ x → +-comm x (pos 0 -Int x) ∙ minusPlus x 0) (λ x → minusPlus x 0))
programs/oeis/311/A311289.asm
jmorken/loda
1
171927
<reponame>jmorken/loda ; A311289: Coordination sequence Gal.5.107.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; 1,4,8,12,16,21,26,30,34,38,42,46,50,54,58,63,68,72,76,80,84,88,92,96,100,105,110,114,118,122,126,130,134,138,142,147,152,156,160,164,168,172,176,180,184,189,194,198,202,206 mov $7,$0 mov $9,$0 add $9,1 lpb $9 clr $0,7 mov $0,$7 sub $9,1 sub $0,$9 add $3,$0 mov $0,3 add $0,$3 add $4,7 mov $5,1 lpb $0 mov $2,$0 mod $2,10 sub $2,5 mov $3,$5 add $3,1 pow $4,2 sub $4,$5 sub $5,$2 sub $4,$5 mov $0,$4 div $0,10 lpe add $0,$3 mul $0,2 mov $1,$0 sub $1,6 div $1,2 add $1,1 add $8,$1 lpe mov $1,$8
sh.asm
AlonYeroushalmi/Assignment_1
0
173930
<reponame>AlonYeroushalmi/Assignment_1 _sh: file format elf32-i386 Disassembly of section .text: 00000000 <main>: } } int main(void) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 57 push %edi e: 56 push %esi f: 53 push %ebx 10: 51 push %ecx 11: 81 ec 18 01 00 00 sub $0x118,%esp static char buf[100]; int fd; // Ensure that three file descriptors are open. while((fd = open("console", O_RDWR)) >= 0){ 17: eb 10 jmp 29 <main+0x29> 19: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(fd >= 3){ 20: 83 f8 02 cmp $0x2,%eax 23: 0f 8f a9 02 00 00 jg 2d2 <main+0x2d2> { static char buf[100]; int fd; // Ensure that three file descriptors are open. while((fd = open("console", O_RDWR)) >= 0){ 29: 83 ec 08 sub $0x8,%esp 2c: 6a 02 push $0x2 2e: 68 be 17 00 00 push $0x17be 33: e8 80 12 00 00 call 12b8 <open> 38: 83 c4 10 add $0x10,%esp 3b: 85 c0 test %eax,%eax 3d: 79 e1 jns 20 <main+0x20> varBeginIndex--; if (varBeginIndex != buf) varBeginIndex++; if (varBeginIndex == equalIndex) break; //command in buf is probably an error strncpy(var, varBeginIndex, equalIndex - varBeginIndex); //copy the var to auxillary array 3f: 8d b5 e8 fe ff ff lea -0x118(%ebp),%esi char* valEndIndex; if ((valEndIndex = strchr(equalIndex, '\n')) == 0) if ((valEndIndex = strchr(equalIndex, 0)) == 0) break; //command in buf is probably an error valEndIndex--; strncpy(val, equalIndex+1, valEndIndex - equalIndex); //copy the val to auxillary array 45: 8d 9d 68 ff ff ff lea -0x98(%ebp),%ebx 4b: 90 nop 4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi break; } } // Read and run input commands. while(getcmd(buf, sizeof(buf)) >= 0){ 50: 83 ec 08 sub $0x8,%esp 53: 6a 64 push $0x64 55: 68 40 1f 00 00 push $0x1f40 5a: e8 41 04 00 00 call 4a0 <getcmd> 5f: 83 c4 10 add $0x10,%esp 62: 85 c0 test %eax,%eax 64: 0f 88 c1 01 00 00 js 22b <main+0x22b> enqueueHistory(buf); 6a: 83 ec 0c sub $0xc,%esp 6d: 68 40 1f 00 00 push $0x1f40 72: e8 99 02 00 00 call 310 <enqueueHistory> transformDollars(buf); 77: c7 04 24 40 1f 00 00 movl $0x1f40,(%esp) 7e: e8 9d 04 00 00 call 520 <transformDollars> char* equalIndex; char* bufIterator = buf; //NOTICE: seems that wanted behavior is different than in bash. There can be only one assignment if ((equalIndex = strchr(bufIterator, '=')) != 0) { //in a command, therefore iterator is redundant. 83: 58 pop %eax 84: 5a pop %edx 85: 6a 3d push $0x3d 87: 68 40 1f 00 00 push $0x1f40 8c: e8 5f 10 00 00 call 10f0 <strchr> 91: 83 c4 10 add $0x10,%esp 94: 85 c0 test %eax,%eax 96: 89 c7 mov %eax,%edi 98: 0f 84 2a 02 00 00 je 2c8 <main+0x2c8> char var[USER_COMMAND_MAX_SIZE]; char val[USER_COMMAND_MAX_SIZE]; char* varBeginIndex = equalIndex - 1; 9e: 8d 50 ff lea -0x1(%eax),%edx while ((varBeginIndex != buf) && (*varBeginIndex != ' ')) //the check that var name is legal is done in the system call a1: 81 fa 40 1f 00 00 cmp $0x1f40,%edx a7: 74 2d je d6 <main+0xd6> a9: 80 78 ff 20 cmpb $0x20,-0x1(%eax) ad: 0f 84 6d 01 00 00 je 220 <main+0x220> b3: 8d 40 fe lea -0x2(%eax),%eax b6: eb 15 jmp cd <main+0xcd> b8: 90 nop b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi c0: 83 e8 01 sub $0x1,%eax c3: 80 78 01 20 cmpb $0x20,0x1(%eax) c7: 0f 84 53 01 00 00 je 220 <main+0x220> cd: 3d 40 1f 00 00 cmp $0x1f40,%eax varBeginIndex--; d2: 89 c2 mov %eax,%edx char* bufIterator = buf; //NOTICE: seems that wanted behavior is different than in bash. There can be only one assignment if ((equalIndex = strchr(bufIterator, '=')) != 0) { //in a command, therefore iterator is redundant. char var[USER_COMMAND_MAX_SIZE]; char val[USER_COMMAND_MAX_SIZE]; char* varBeginIndex = equalIndex - 1; while ((varBeginIndex != buf) && (*varBeginIndex != ' ')) //the check that var name is legal is done in the system call d4: 75 ea jne c0 <main+0xc0> varBeginIndex--; if (varBeginIndex != buf) varBeginIndex++; if (varBeginIndex == equalIndex) d6: 39 fa cmp %edi,%edx d8: 0f 84 4d 01 00 00 je 22b <main+0x22b> de: 66 90 xchg %ax,%ax break; //command in buf is probably an error strncpy(var, varBeginIndex, equalIndex - varBeginIndex); //copy the var to auxillary array e0: 89 f9 mov %edi,%ecx e2: 83 ec 04 sub $0x4,%esp e5: 29 d1 sub %edx,%ecx e7: 51 push %ecx e8: 52 push %edx e9: 56 push %esi ea: 89 8d e4 fe ff ff mov %ecx,-0x11c(%ebp) f0: e8 cb 0e 00 00 call fc0 <strncpy> var[equalIndex - varBeginIndex] = 0; //make sure to make it a legal string f5: 8b 8d e4 fe ff ff mov -0x11c(%ebp),%ecx fb: c6 84 0d e8 fe ff ff movb $0x0,-0x118(%ebp,%ecx,1) 102: 00 //printf(2, "%s\n", var); char* valEndIndex; if ((valEndIndex = strchr(equalIndex, '\n')) == 0) 103: 59 pop %ecx 104: 58 pop %eax 105: 6a 0a push $0xa 107: 57 push %edi 108: e8 e3 0f 00 00 call 10f0 <strchr> 10d: 83 c4 10 add $0x10,%esp 110: 85 c0 test %eax,%eax 112: 0f 84 38 01 00 00 je 250 <main+0x250> if ((valEndIndex = strchr(equalIndex, 0)) == 0) break; //command in buf is probably an error valEndIndex--; strncpy(val, equalIndex+1, valEndIndex - equalIndex); //copy the val to auxillary array 118: 8d 50 ff lea -0x1(%eax),%edx 11b: 83 ec 04 sub $0x4,%esp 11e: 89 d1 mov %edx,%ecx 120: 89 95 e0 fe ff ff mov %edx,-0x120(%ebp) 126: 29 f9 sub %edi,%ecx 128: 83 c7 01 add $0x1,%edi 12b: 51 push %ecx 12c: 57 push %edi 12d: 53 push %ebx 12e: 89 8d e4 fe ff ff mov %ecx,-0x11c(%ebp) 134: e8 87 0e 00 00 call fc0 <strncpy> val[valEndIndex - equalIndex] = 0; //make sure to make it a legal string //printf(2, "%s\n", val); setVariable(var, val); 139: 58 pop %eax 13a: 5a pop %edx if ((valEndIndex = strchr(equalIndex, '\n')) == 0) if ((valEndIndex = strchr(equalIndex, 0)) == 0) break; //command in buf is probably an error valEndIndex--; strncpy(val, equalIndex+1, valEndIndex - equalIndex); //copy the val to auxillary array val[valEndIndex - equalIndex] = 0; //make sure to make it a legal string 13b: 8b 8d e4 fe ff ff mov -0x11c(%ebp),%ecx //printf(2, "%s\n", val); setVariable(var, val); 141: 53 push %ebx 142: 56 push %esi if ((valEndIndex = strchr(equalIndex, '\n')) == 0) if ((valEndIndex = strchr(equalIndex, 0)) == 0) break; //command in buf is probably an error valEndIndex--; strncpy(val, equalIndex+1, valEndIndex - equalIndex); //copy the val to auxillary array val[valEndIndex - equalIndex] = 0; //make sure to make it a legal string 143: c6 84 0d 68 ff ff ff movb $0x0,-0x98(%ebp,%ecx,1) 14a: 00 //printf(2, "%s\n", val); setVariable(var, val); 14b: e8 c8 11 00 00 call 1318 <setVariable> bufIterator += valEndIndex - bufIterator + 1; //start next search after the val of the last found '=' (redundant) 150: 8b 95 e0 fe ff ff mov -0x120(%ebp),%edx 156: 83 c4 10 add $0x10,%esp 159: 8d 42 01 lea 0x1(%edx),%eax } strcpy(buf, bufIterator); //rewrite the buffer content without the variable assignment 15c: 83 ec 08 sub $0x8,%esp 15f: 50 push %eax 160: 68 40 1f 00 00 push $0x1f40 165: e8 26 0e 00 00 call f90 <strcpy> if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ 16a: 83 c4 10 add $0x10,%esp 16d: 80 3d 40 1f 00 00 63 cmpb $0x63,0x1f40 174: 75 0d jne 183 <main+0x183> 176: 80 3d 41 1f 00 00 64 cmpb $0x64,0x1f41 17d: 0f 84 ed 00 00 00 je 270 <main+0x270> if(chdir(buf+3) < 0) printf(2, "cannot cd %s\n", buf+3); continue; } if (strncmp("history", buf, 7) == 0) { 183: 83 ec 04 sub $0x4,%esp 186: 6a 07 push $0x7 188: 68 40 1f 00 00 push $0x1f40 18d: 68 d4 17 00 00 push $0x17d4 192: e8 a9 0e 00 00 call 1040 <strncmp> 197: 83 c4 10 add $0x10,%esp 19a: 85 c0 test %eax,%eax 19c: 75 5a jne 1f8 <main+0x1f8> if (strncmp (" -l ", buf+7, 4) == 0) { 19e: 83 ec 04 sub $0x4,%esp 1a1: 6a 04 push $0x4 1a3: 68 47 1f 00 00 push $0x1f47 1a8: 68 dc 17 00 00 push $0x17dc 1ad: e8 8e 0e 00 00 call 1040 <strncmp> 1b2: 83 c4 10 add $0x10,%esp 1b5: 85 c0 test %eax,%eax 1b7: 75 77 jne 230 <main+0x230> history(atoi(buf+11), buf); 1b9: 83 ec 0c sub $0xc,%esp 1bc: 68 4b 1f 00 00 push $0x1f4b 1c1: e8 2a 10 00 00 call 11f0 <atoi> 1c6: 5a pop %edx 1c7: 59 pop %ecx 1c8: 68 40 1f 00 00 push $0x1f40 1cd: 50 push %eax 1ce: e8 bd 01 00 00 call 390 <history> if (strchr(buf, '$') != 0) 1d3: 5f pop %edi 1d4: 58 pop %eax 1d5: 6a 24 push $0x24 1d7: 68 40 1f 00 00 push $0x1f40 1dc: e8 0f 0f 00 00 call 10f0 <strchr> 1e1: 83 c4 10 add $0x10,%esp 1e4: 85 c0 test %eax,%eax 1e6: 74 10 je 1f8 <main+0x1f8> transformDollars(buf); 1e8: 83 ec 0c sub $0xc,%esp 1eb: 68 40 1f 00 00 push $0x1f40 1f0: e8 2b 03 00 00 call 520 <transformDollars> 1f5: 83 c4 10 add $0x10,%esp int fork1(void) { int pid; pid = fork(); 1f8: e8 73 10 00 00 call 1270 <fork> if(pid == -1) 1fd: 83 f8 ff cmp $0xffffffff,%eax 200: 0f 84 dd 00 00 00 je 2e3 <main+0x2e3> history(-1, buf); continue; } } if(fork1() == 0) 206: 85 c0 test %eax,%eax 208: 0f 84 e2 00 00 00 je 2f0 <main+0x2f0> runcmd(parsecmd(buf)); wait(); 20e: e8 6d 10 00 00 call 1280 <wait> 213: e9 38 fe ff ff jmp 50 <main+0x50> 218: 90 nop 219: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi char val[USER_COMMAND_MAX_SIZE]; char* varBeginIndex = equalIndex - 1; while ((varBeginIndex != buf) && (*varBeginIndex != ' ')) //the check that var name is legal is done in the system call varBeginIndex--; if (varBeginIndex != buf) varBeginIndex++; 220: 83 c2 01 add $0x1,%edx if (varBeginIndex == equalIndex) 223: 39 fa cmp %edi,%edx 225: 0f 85 b5 fe ff ff jne e0 <main+0xe0> if(fork1() == 0) runcmd(parsecmd(buf)); wait(); } exit(); 22b: e8 48 10 00 00 call 1278 <exit> history(atoi(buf+11), buf); if (strchr(buf, '$') != 0) transformDollars(buf); } else { history(-1, buf); 230: 83 ec 08 sub $0x8,%esp 233: 68 40 1f 00 00 push $0x1f40 238: 6a ff push $0xffffffff 23a: e8 51 01 00 00 call 390 <history> continue; 23f: 83 c4 10 add $0x10,%esp 242: e9 09 fe ff ff jmp 50 <main+0x50> 247: 89 f6 mov %esi,%esi 249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi strncpy(var, varBeginIndex, equalIndex - varBeginIndex); //copy the var to auxillary array var[equalIndex - varBeginIndex] = 0; //make sure to make it a legal string //printf(2, "%s\n", var); char* valEndIndex; if ((valEndIndex = strchr(equalIndex, '\n')) == 0) if ((valEndIndex = strchr(equalIndex, 0)) == 0) 250: 83 ec 08 sub $0x8,%esp 253: 6a 00 push $0x0 255: 57 push %edi 256: e8 95 0e 00 00 call 10f0 <strchr> 25b: 83 c4 10 add $0x10,%esp 25e: 85 c0 test %eax,%eax 260: 0f 85 b2 fe ff ff jne 118 <main+0x118> 266: eb c3 jmp 22b <main+0x22b> 268: 90 nop 269: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi setVariable(var, val); bufIterator += valEndIndex - bufIterator + 1; //start next search after the val of the last found '=' (redundant) } strcpy(buf, bufIterator); //rewrite the buffer content without the variable assignment if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ 270: 80 3d 42 1f 00 00 20 cmpb $0x20,0x1f42 277: 0f 85 06 ff ff ff jne 183 <main+0x183> // Chdir must be called by the parent, not the child. buf[strlen(buf)-1] = 0; // chop \n 27d: 83 ec 0c sub $0xc,%esp 280: 68 40 1f 00 00 push $0x1f40 285: e8 16 0e 00 00 call 10a0 <strlen> if(chdir(buf+3) < 0) 28a: c7 04 24 43 1f 00 00 movl $0x1f43,(%esp) } strcpy(buf, bufIterator); //rewrite the buffer content without the variable assignment if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ // Chdir must be called by the parent, not the child. buf[strlen(buf)-1] = 0; // chop \n 291: c6 80 3f 1f 00 00 00 movb $0x0,0x1f3f(%eax) if(chdir(buf+3) < 0) 298: e8 4b 10 00 00 call 12e8 <chdir> 29d: 83 c4 10 add $0x10,%esp 2a0: 85 c0 test %eax,%eax 2a2: 0f 89 a8 fd ff ff jns 50 <main+0x50> printf(2, "cannot cd %s\n", buf+3); 2a8: 50 push %eax 2a9: 68 43 1f 00 00 push $0x1f43 2ae: 68 c6 17 00 00 push $0x17c6 2b3: 6a 02 push $0x2 2b5: e8 26 11 00 00 call 13e0 <printf> 2ba: 83 c4 10 add $0x10,%esp 2bd: e9 8e fd ff ff jmp 50 <main+0x50> 2c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi enqueueHistory(buf); transformDollars(buf); char* equalIndex; char* bufIterator = buf; //NOTICE: seems that wanted behavior is different than in bash. There can be only one assignment 2c8: b8 40 1f 00 00 mov $0x1f40,%eax 2cd: e9 8a fe ff ff jmp 15c <main+0x15c> int fd; // Ensure that three file descriptors are open. while((fd = open("console", O_RDWR)) >= 0){ if(fd >= 3){ close(fd); 2d2: 83 ec 0c sub $0xc,%esp 2d5: 50 push %eax 2d6: e8 c5 0f 00 00 call 12a0 <close> break; 2db: 83 c4 10 add $0x10,%esp 2de: e9 5c fd ff ff jmp 3f <main+0x3f> { int pid; pid = fork(); if(pid == -1) panic("fork"); 2e3: 83 ec 0c sub $0xc,%esp 2e6: 68 47 17 00 00 push $0x1747 2eb: e8 20 03 00 00 call 610 <panic> continue; } } if(fork1() == 0) runcmd(parsecmd(buf)); 2f0: 83 ec 0c sub $0xc,%esp 2f3: 68 40 1f 00 00 push $0x1f40 2f8: e8 23 0c 00 00 call f20 <parsecmd> 2fd: 89 04 24 mov %eax,(%esp) 300: e8 2b 03 00 00 call 630 <runcmd> 305: 66 90 xchg %ax,%ax 307: 66 90 xchg %ax,%ax 309: 66 90 xchg %ax,%ax 30b: 66 90 xchg %ax,%ax 30d: 66 90 xchg %ax,%ax 30f: 90 nop 00000310 <enqueueHistory>: char command_queue[MAX_HISTORY][USER_COMMAND_MAX_SIZE]; int queue_head_index = 0; //index of the oldest command in history (or next history line to fill) int empty_index = 0; //index of the first empty cell in the queue (after 16 commands, there isn't an empty cell) int next_total_index = 1; void enqueueHistory(char* buf) { 310: 55 push %ebp 311: 89 e5 mov %esp,%ebp 313: 53 push %ebx 314: 83 ec 10 sub $0x10,%esp 317: 8b 5d 08 mov 0x8(%ebp),%ebx buf[strlen(buf)-1] = 0; 31a: 53 push %ebx 31b: e8 80 0d 00 00 call 10a0 <strlen> 320: c6 44 03 ff 00 movb $0x0,-0x1(%ebx,%eax,1) strcpy(command_queue[queue_head_index], buf); 325: 58 pop %eax 326: a1 24 1f 00 00 mov 0x1f24,%eax 32b: 5a pop %edx 32c: 53 push %ebx 32d: c1 e0 07 shl $0x7,%eax 330: 05 c0 1f 00 00 add $0x1fc0,%eax 335: 50 push %eax 336: e8 55 0c 00 00 call f90 <strcpy> queue_head_index++; 33b: a1 24 1f 00 00 mov 0x1f24,%eax next_total_index++; if (empty_index < MAX_HISTORY) 340: 8b 15 20 1f 00 00 mov 0x1f20,%edx 346: 83 c4 10 add $0x10,%esp void enqueueHistory(char* buf) { buf[strlen(buf)-1] = 0; strcpy(command_queue[queue_head_index], buf); queue_head_index++; next_total_index++; 349: 83 05 1c 1f 00 00 01 addl $0x1,0x1f1c int next_total_index = 1; void enqueueHistory(char* buf) { buf[strlen(buf)-1] = 0; strcpy(command_queue[queue_head_index], buf); queue_head_index++; 350: 83 c0 01 add $0x1,%eax next_total_index++; if (empty_index < MAX_HISTORY) 353: 83 fa 0f cmp $0xf,%edx int next_total_index = 1; void enqueueHistory(char* buf) { buf[strlen(buf)-1] = 0; strcpy(command_queue[queue_head_index], buf); queue_head_index++; 356: a3 24 1f 00 00 mov %eax,0x1f24 next_total_index++; if (empty_index < MAX_HISTORY) 35b: 7f 09 jg 366 <enqueueHistory+0x56> empty_index++; 35d: 83 c2 01 add $0x1,%edx 360: 89 15 20 1f 00 00 mov %edx,0x1f20 if (queue_head_index >= MAX_HISTORY) 366: 83 f8 0f cmp $0xf,%eax 369: 7e 0a jle 375 <enqueueHistory+0x65> queue_head_index = 0; 36b: c7 05 24 1f 00 00 00 movl $0x0,0x1f24 372: 00 00 00 buf[strlen(buf)] = '\n'; 375: 83 ec 0c sub $0xc,%esp 378: 53 push %ebx 379: e8 22 0d 00 00 call 10a0 <strlen> } 37e: 83 c4 10 add $0x10,%esp next_total_index++; if (empty_index < MAX_HISTORY) empty_index++; if (queue_head_index >= MAX_HISTORY) queue_head_index = 0; buf[strlen(buf)] = '\n'; 381: c6 04 03 0a movb $0xa,(%ebx,%eax,1) } 385: 8b 5d fc mov -0x4(%ebp),%ebx 388: c9 leave 389: c3 ret 38a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00000390 <history>: void history(int commandNum, char* buf) { 390: 55 push %ebp 391: 89 e5 mov %esp,%ebp 393: 57 push %edi 394: 56 push %esi 395: 53 push %ebx 396: 83 ec 0c sub $0xc,%esp 399: 8b 45 08 mov 0x8(%ebp),%eax 39c: 8b 5d 0c mov 0xc(%ebp),%ebx if (commandNum==-1) { 39f: 83 f8 ff cmp $0xffffffff,%eax 3a2: 74 7c je 420 <history+0x90> printf(2, "%d. %s\n", max(next_total_index-16+i, 1+i), command_queue[historyIterator]); historyIterator++; } } else { if (commandNum - 1 < next_total_index - 1 - MAX_HISTORY || 3a4: 8b 15 1c 1f 00 00 mov 0x1f1c,%edx 3aa: 8d 4a f0 lea -0x10(%edx),%ecx 3ad: 39 c8 cmp %ecx,%eax 3af: 7c 4f jl 400 <history+0x70> 3b1: 39 d0 cmp %edx,%eax 3b3: 7d 4b jge 400 <history+0x70> commandNum >= next_total_index) { printf(2, "command index error\n"); return; } strcpy(buf, command_queue[(commandNum - 1) % 16]); 3b5: 83 e8 01 sub $0x1,%eax 3b8: 83 ec 08 sub $0x8,%esp 3bb: 99 cltd 3bc: c1 ea 1c shr $0x1c,%edx 3bf: 01 d0 add %edx,%eax 3c1: 83 e0 0f and $0xf,%eax 3c4: 29 d0 sub %edx,%eax 3c6: c1 e0 07 shl $0x7,%eax 3c9: 05 c0 1f 00 00 add $0x1fc0,%eax 3ce: 50 push %eax 3cf: 53 push %ebx 3d0: e8 bb 0b 00 00 call f90 <strcpy> buf[strlen(buf)+1] = 0; 3d5: 89 1c 24 mov %ebx,(%esp) 3d8: e8 c3 0c 00 00 call 10a0 <strlen> 3dd: c6 44 03 01 00 movb $0x0,0x1(%ebx,%eax,1) buf[strlen(buf)] = '\n'; //put newline in end of command (exec seems to expect that) 3e2: 89 1c 24 mov %ebx,(%esp) 3e5: e8 b6 0c 00 00 call 10a0 <strlen> 3ea: 83 c4 10 add $0x10,%esp 3ed: c6 04 03 0a movb $0xa,(%ebx,%eax,1) } } 3f1: 8d 65 f4 lea -0xc(%ebp),%esp 3f4: 5b pop %ebx 3f5: 5e pop %esi 3f6: 5f pop %edi 3f7: 5d pop %ebp 3f8: c3 ret 3f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } } else { if (commandNum - 1 < next_total_index - 1 - MAX_HISTORY || commandNum >= next_total_index) { printf(2, "command index error\n"); 400: c7 45 0c 08 17 00 00 movl $0x1708,0xc(%ebp) 407: c7 45 08 02 00 00 00 movl $0x2,0x8(%ebp) } strcpy(buf, command_queue[(commandNum - 1) % 16]); buf[strlen(buf)+1] = 0; buf[strlen(buf)] = '\n'; //put newline in end of command (exec seems to expect that) } } 40e: 8d 65 f4 lea -0xc(%ebp),%esp 411: 5b pop %ebx 412: 5e pop %esi 413: 5f pop %edi 414: 5d pop %ebp } } else { if (commandNum - 1 < next_total_index - 1 - MAX_HISTORY || commandNum >= next_total_index) { printf(2, "command index error\n"); 415: e9 c6 0f 00 00 jmp 13e0 <printf> 41a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi } void history(int commandNum, char* buf) { if (commandNum==-1) { int historyIterator; if (empty_index >= MAX_HISTORY) 420: a1 20 1f 00 00 mov 0x1f20,%eax historyIterator = queue_head_index; 425: 8b 3d 24 1f 00 00 mov 0x1f24,%edi } void history(int commandNum, char* buf) { if (commandNum==-1) { int historyIterator; if (empty_index >= MAX_HISTORY) 42b: 83 f8 0f cmp $0xf,%eax 42e: 7e 60 jle 490 <history+0x100> historyIterator = queue_head_index; else historyIterator = 0; 430: 31 c0 xor %eax,%eax 432: eb 48 jmp 47c <history+0xec> 434: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for (int i=0; i<empty_index; i++) { if (historyIterator >= MAX_HISTORY) 438: 89 fb mov %edi,%ebx 43a: 83 c7 01 add $0x1,%edi historyIterator = 0; printf(2, "%d. %s\n", max(next_total_index-16+i, 1+i), command_queue[historyIterator]); 43d: 8b 15 1c 1f 00 00 mov 0x1f1c,%edx 443: 8d 70 01 lea 0x1(%eax),%esi 446: 83 ec 08 sub $0x8,%esp 449: c1 e3 07 shl $0x7,%ebx 44c: 56 push %esi 44d: 81 c3 c0 1f 00 00 add $0x1fc0,%ebx 453: 8d 44 10 f0 lea -0x10(%eax,%edx,1),%eax 457: 50 push %eax 458: e8 03 0e 00 00 call 1260 <max> 45d: 53 push %ebx 45e: 50 push %eax 45f: 68 00 17 00 00 push $0x1700 464: 6a 02 push $0x2 466: e8 75 0f 00 00 call 13e0 <printf> int historyIterator; if (empty_index >= MAX_HISTORY) historyIterator = queue_head_index; else historyIterator = 0; for (int i=0; i<empty_index; i++) { 46b: 83 c4 20 add $0x20,%esp 46e: 39 35 20 1f 00 00 cmp %esi,0x1f20 474: 0f 8e 77 ff ff ff jle 3f1 <history+0x61> 47a: 89 f0 mov %esi,%eax if (historyIterator >= MAX_HISTORY) 47c: 83 ff 0f cmp $0xf,%edi 47f: 7e b7 jle 438 <history+0xa8> 481: bf 01 00 00 00 mov $0x1,%edi historyIterator = 0; 486: 31 db xor %ebx,%ebx 488: eb b3 jmp 43d <history+0xad> 48a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if (commandNum==-1) { int historyIterator; if (empty_index >= MAX_HISTORY) historyIterator = queue_head_index; else historyIterator = 0; 490: 31 ff xor %edi,%edi for (int i=0; i<empty_index; i++) { 492: 85 c0 test %eax,%eax 494: 7f 9a jg 430 <history+0xa0> 496: e9 56 ff ff ff jmp 3f1 <history+0x61> 49b: 90 nop 49c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 000004a0 <getcmd>: exit(); } int getcmd(char *buf, int nbuf) { 4a0: 55 push %ebp 4a1: 89 e5 mov %esp,%ebp 4a3: 56 push %esi 4a4: 53 push %ebx 4a5: 8b 75 0c mov 0xc(%ebp),%esi 4a8: 8b 5d 08 mov 0x8(%ebp),%ebx printf(2, "$ "); 4ab: 83 ec 08 sub $0x8,%esp 4ae: 68 1d 17 00 00 push $0x171d 4b3: 6a 02 push $0x2 4b5: e8 26 0f 00 00 call 13e0 <printf> memset(buf, 0, nbuf); 4ba: 83 c4 0c add $0xc,%esp 4bd: 56 push %esi 4be: 6a 00 push $0x0 4c0: 53 push %ebx 4c1: e8 0a 0c 00 00 call 10d0 <memset> gets(buf, nbuf); 4c6: 58 pop %eax 4c7: 5a pop %edx 4c8: 56 push %esi 4c9: 53 push %ebx 4ca: e8 61 0c 00 00 call 1130 <gets> 4cf: 83 c4 10 add $0x10,%esp 4d2: 31 c0 xor %eax,%eax 4d4: 80 3b 00 cmpb $0x0,(%ebx) 4d7: 0f 94 c0 sete %al if(buf[0] == 0) // EOF return -1; return 0; } 4da: 8d 65 f8 lea -0x8(%ebp),%esp 4dd: f7 d8 neg %eax 4df: 5b pop %ebx 4e0: 5e pop %esi 4e1: 5d pop %ebp 4e2: c3 ret 4e3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 4e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000004f0 <isLetter>: int isLetter(char c) { 4f0: 55 push %ebp 4f1: 89 e5 mov %esp,%ebp 4f3: 8b 55 08 mov 0x8(%ebp),%edx if(c < 'A' || c > 'z' || (c > 'Z' && c < 'a')) return 0; return 1; } 4f6: 5d pop %ebp 4f7: 8d 42 bf lea -0x41(%edx),%eax 4fa: 3c 39 cmp $0x39,%al 4fc: 0f 97 c1 seta %cl 4ff: 83 ea 5b sub $0x5b,%edx 502: 80 fa 05 cmp $0x5,%dl 505: 0f 96 c0 setbe %al 508: 09 c8 or %ecx,%eax 50a: 83 f0 01 xor $0x1,%eax 50d: 0f b6 c0 movzbl %al,%eax 510: c3 ret 511: eb 0d jmp 520 <transformDollars> 513: 90 nop 514: 90 nop 515: 90 nop 516: 90 nop 517: 90 nop 518: 90 nop 519: 90 nop 51a: 90 nop 51b: 90 nop 51c: 90 nop 51d: 90 nop 51e: 90 nop 51f: 90 nop 00000520 <transformDollars>: void transformDollars(char* buf) { 520: 55 push %ebp 521: 89 e5 mov %esp,%ebp 523: 57 push %edi 524: 56 push %esi 525: 53 push %ebx 526: 81 ec 8c 01 00 00 sub $0x18c,%esp 52c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi char* dollarIndex; while ((dollarIndex = strchr(buf, '$')) != 0) { 530: 83 ec 08 sub $0x8,%esp 533: 6a 24 push $0x24 535: ff 75 08 pushl 0x8(%ebp) 538: e8 b3 0b 00 00 call 10f0 <strchr> 53d: 83 c4 10 add $0x10,%esp 540: 85 c0 test %eax,%eax 542: 89 c6 mov %eax,%esi 544: 0f 84 bd 00 00 00 je 607 <transformDollars+0xe7> return -1; return 0; } int isLetter(char c) { if(c < 'A' || c > 'z' || 54a: 0f b6 56 01 movzbl 0x1(%esi),%edx char* dollarIndex; while ((dollarIndex = strchr(buf, '$')) != 0) { char var[USER_COMMAND_MAX_SIZE]; char val[USER_COMMAND_MAX_SIZE]; char restOfCommand[USER_COMMAND_MAX_SIZE]; char* varLastIndex = dollarIndex + 1; 54e: 8d 46 01 lea 0x1(%esi),%eax return -1; return 0; } int isLetter(char c) { if(c < 'A' || c > 'z' || 551: 8d 5a bf lea -0x41(%edx),%ebx 554: 80 fb 39 cmp $0x39,%bl char* dollarIndex; while ((dollarIndex = strchr(buf, '$')) != 0) { char var[USER_COMMAND_MAX_SIZE]; char val[USER_COMMAND_MAX_SIZE]; char restOfCommand[USER_COMMAND_MAX_SIZE]; char* varLastIndex = dollarIndex + 1; 557: 89 c3 mov %eax,%ebx return -1; return 0; } int isLetter(char c) { if(c < 'A' || c > 'z' || 559: 76 13 jbe 56e <transformDollars+0x4e> 55b: eb 19 jmp 576 <transformDollars+0x56> 55d: 8d 76 00 lea 0x0(%esi),%esi char var[USER_COMMAND_MAX_SIZE]; char val[USER_COMMAND_MAX_SIZE]; char restOfCommand[USER_COMMAND_MAX_SIZE]; char* varLastIndex = dollarIndex + 1; while (isLetter(*varLastIndex)) varLastIndex++; 560: 83 c3 01 add $0x1,%ebx return -1; return 0; } int isLetter(char c) { if(c < 'A' || c > 'z' || 563: 0f b6 13 movzbl (%ebx),%edx 566: 8d 4a bf lea -0x41(%edx),%ecx 569: 80 f9 39 cmp $0x39,%cl 56c: 77 08 ja 576 <transformDollars+0x56> 56e: 83 ea 5b sub $0x5b,%edx 571: 80 fa 05 cmp $0x5,%dl 574: 77 ea ja 560 <transformDollars+0x40> char restOfCommand[USER_COMMAND_MAX_SIZE]; char* varLastIndex = dollarIndex + 1; while (isLetter(*varLastIndex)) varLastIndex++; varLastIndex--; strncpy(var, dollarIndex+1, varLastIndex-dollarIndex); //copy the var to auxillary array 576: 8d 7b ff lea -0x1(%ebx),%edi 579: 83 ec 04 sub $0x4,%esp 57c: 29 f7 sub %esi,%edi 57e: 57 push %edi 57f: 50 push %eax 580: 8d 85 68 fe ff ff lea -0x198(%ebp),%eax 586: 50 push %eax 587: e8 34 0a 00 00 call fc0 <strncpy> var[varLastIndex-dollarIndex] = 0; //make sure to make it a legal string if (getVariable(var, val) < 0) { //get the variable value 58c: 58 pop %eax 58d: 8d 85 e8 fe ff ff lea -0x118(%ebp),%eax char* varLastIndex = dollarIndex + 1; while (isLetter(*varLastIndex)) varLastIndex++; varLastIndex--; strncpy(var, dollarIndex+1, varLastIndex-dollarIndex); //copy the var to auxillary array var[varLastIndex-dollarIndex] = 0; //make sure to make it a legal string 593: c6 84 3d 68 fe ff ff movb $0x0,-0x198(%ebp,%edi,1) 59a: 00 if (getVariable(var, val) < 0) { //get the variable value 59b: 5a pop %edx 59c: 50 push %eax 59d: 8d 85 68 fe ff ff lea -0x198(%ebp),%eax 5a3: 50 push %eax 5a4: e8 77 0d 00 00 call 1320 <getVariable> 5a9: 83 c4 10 add $0x10,%esp 5ac: 85 c0 test %eax,%eax 5ae: 78 48 js 5f8 <transformDollars+0xd8> strcpy(dollarIndex, varLastIndex+1); //remove the dollar var from the buffer (ubuntu behavior) } int valLength = strlen(val); //save the value length to use soon in restoring the rest of the command 5b0: 8d 85 e8 fe ff ff lea -0x118(%ebp),%eax 5b6: 83 ec 0c sub $0xc,%esp 5b9: 50 push %eax 5ba: e8 e1 0a 00 00 call 10a0 <strlen> strcpy(restOfCommand, varLastIndex+1); //copy the rest of the command to another auxillay array 5bf: 59 pop %ecx strncpy(var, dollarIndex+1, varLastIndex-dollarIndex); //copy the var to auxillary array var[varLastIndex-dollarIndex] = 0; //make sure to make it a legal string if (getVariable(var, val) < 0) { //get the variable value strcpy(dollarIndex, varLastIndex+1); //remove the dollar var from the buffer (ubuntu behavior) } int valLength = strlen(val); //save the value length to use soon in restoring the rest of the command 5c0: 89 c7 mov %eax,%edi strcpy(restOfCommand, varLastIndex+1); //copy the rest of the command to another auxillay array 5c2: 58 pop %eax 5c3: 53 push %ebx 5c4: 8d 9d 68 ff ff ff lea -0x98(%ebp),%ebx strcpy(dollarIndex, val); //copy the val to the buffer strcpy(dollarIndex+valLength, restOfCommand); //restore the rest of the command to the buffer 5ca: 01 f7 add %esi,%edi var[varLastIndex-dollarIndex] = 0; //make sure to make it a legal string if (getVariable(var, val) < 0) { //get the variable value strcpy(dollarIndex, varLastIndex+1); //remove the dollar var from the buffer (ubuntu behavior) } int valLength = strlen(val); //save the value length to use soon in restoring the rest of the command strcpy(restOfCommand, varLastIndex+1); //copy the rest of the command to another auxillay array 5cc: 53 push %ebx 5cd: e8 be 09 00 00 call f90 <strcpy> strcpy(dollarIndex, val); //copy the val to the buffer 5d2: 58 pop %eax 5d3: 8d 85 e8 fe ff ff lea -0x118(%ebp),%eax 5d9: 5a pop %edx 5da: 50 push %eax 5db: 56 push %esi 5dc: e8 af 09 00 00 call f90 <strcpy> strcpy(dollarIndex+valLength, restOfCommand); //restore the rest of the command to the buffer 5e1: 59 pop %ecx 5e2: 58 pop %eax 5e3: 53 push %ebx 5e4: 57 push %edi 5e5: e8 a6 09 00 00 call f90 <strcpy> 5ea: 83 c4 10 add $0x10,%esp 5ed: e9 3e ff ff ff jmp 530 <transformDollars+0x10> 5f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi varLastIndex++; varLastIndex--; strncpy(var, dollarIndex+1, varLastIndex-dollarIndex); //copy the var to auxillary array var[varLastIndex-dollarIndex] = 0; //make sure to make it a legal string if (getVariable(var, val) < 0) { //get the variable value strcpy(dollarIndex, varLastIndex+1); //remove the dollar var from the buffer (ubuntu behavior) 5f8: 83 ec 08 sub $0x8,%esp 5fb: 53 push %ebx 5fc: 56 push %esi 5fd: e8 8e 09 00 00 call f90 <strcpy> 602: 83 c4 10 add $0x10,%esp 605: eb a9 jmp 5b0 <transformDollars+0x90> int valLength = strlen(val); //save the value length to use soon in restoring the rest of the command strcpy(restOfCommand, varLastIndex+1); //copy the rest of the command to another auxillay array strcpy(dollarIndex, val); //copy the val to the buffer strcpy(dollarIndex+valLength, restOfCommand); //restore the rest of the command to the buffer } } 607: 8d 65 f4 lea -0xc(%ebp),%esp 60a: 5b pop %ebx 60b: 5e pop %esi 60c: 5f pop %edi 60d: 5d pop %ebp 60e: c3 ret 60f: 90 nop 00000610 <panic>: exit(); } void panic(char *s) { 610: 55 push %ebp 611: 89 e5 mov %esp,%ebp 613: 83 ec 0c sub $0xc,%esp printf(2, "%s\n", s); 616: ff 75 08 pushl 0x8(%ebp) 619: 68 04 17 00 00 push $0x1704 61e: 6a 02 push $0x2 620: e8 bb 0d 00 00 call 13e0 <printf> exit(); 625: e8 4e 0c 00 00 call 1278 <exit> 62a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00000630 <runcmd>: struct cmd *parsecmd(char*); // Execute cmd. Never returns. void runcmd(struct cmd *cmd) { 630: 55 push %ebp 631: 89 e5 mov %esp,%ebp 633: 53 push %ebx 634: 83 ec 14 sub $0x14,%esp 637: 8b 5d 08 mov 0x8(%ebp),%ebx struct execcmd *ecmd; struct listcmd *lcmd; struct pipecmd *pcmd; struct redircmd *rcmd; if(cmd == 0) 63a: 85 db test %ebx,%ebx 63c: 74 76 je 6b4 <runcmd+0x84> exit(); switch(cmd->type){ 63e: 83 3b 05 cmpl $0x5,(%ebx) 641: 0f 87 f8 00 00 00 ja 73f <runcmd+0x10f> 647: 8b 03 mov (%ebx),%eax 649: ff 24 85 e4 17 00 00 jmp *0x17e4(,%eax,4) runcmd(lcmd->right); break; case PIPE: pcmd = (struct pipecmd*)cmd; if(pipe(p) < 0) 650: 8d 45 f0 lea -0x10(%ebp),%eax 653: 83 ec 0c sub $0xc,%esp 656: 50 push %eax 657: e8 2c 0c 00 00 call 1288 <pipe> 65c: 83 c4 10 add $0x10,%esp 65f: 85 c0 test %eax,%eax 661: 0f 88 07 01 00 00 js 76e <runcmd+0x13e> int fork1(void) { int pid; pid = fork(); 667: e8 04 0c 00 00 call 1270 <fork> if(pid == -1) 66c: 83 f8 ff cmp $0xffffffff,%eax 66f: 0f 84 d7 00 00 00 je 74c <runcmd+0x11c> case PIPE: pcmd = (struct pipecmd*)cmd; if(pipe(p) < 0) panic("pipe"); if(fork1() == 0){ 675: 85 c0 test %eax,%eax 677: 0f 84 fe 00 00 00 je 77b <runcmd+0x14b> int fork1(void) { int pid; pid = fork(); 67d: e8 ee 0b 00 00 call 1270 <fork> if(pid == -1) 682: 83 f8 ff cmp $0xffffffff,%eax 685: 0f 84 c1 00 00 00 je 74c <runcmd+0x11c> dup(p[1]); close(p[0]); close(p[1]); runcmd(pcmd->left); } if(fork1() == 0){ 68b: 85 c0 test %eax,%eax 68d: 0f 84 16 01 00 00 je 7a9 <runcmd+0x179> dup(p[0]); close(p[0]); close(p[1]); runcmd(pcmd->right); } close(p[0]); 693: 83 ec 0c sub $0xc,%esp 696: ff 75 f0 pushl -0x10(%ebp) 699: e8 02 0c 00 00 call 12a0 <close> close(p[1]); 69e: 58 pop %eax 69f: ff 75 f4 pushl -0xc(%ebp) 6a2: e8 f9 0b 00 00 call 12a0 <close> wait(); 6a7: e8 d4 0b 00 00 call 1280 <wait> wait(); 6ac: e8 cf 0b 00 00 call 1280 <wait> break; 6b1: 83 c4 10 add $0x10,%esp struct listcmd *lcmd; struct pipecmd *pcmd; struct redircmd *rcmd; if(cmd == 0) exit(); 6b4: e8 bf 0b 00 00 call 1278 <exit> int fork1(void) { int pid; pid = fork(); 6b9: e8 b2 0b 00 00 call 1270 <fork> if(pid == -1) 6be: 83 f8 ff cmp $0xffffffff,%eax 6c1: 0f 84 85 00 00 00 je 74c <runcmd+0x11c> wait(); break; case BACK: bcmd = (struct backcmd*)cmd; if(fork1() == 0) 6c7: 85 c0 test %eax,%eax 6c9: 75 e9 jne 6b4 <runcmd+0x84> 6cb: eb 49 jmp 716 <runcmd+0xe6> default: panic("runcmd"); case EXEC: ecmd = (struct execcmd*)cmd; if(ecmd->argv[0] == 0) 6cd: 8b 43 04 mov 0x4(%ebx),%eax 6d0: 85 c0 test %eax,%eax 6d2: 74 e0 je 6b4 <runcmd+0x84> exit(); exec(ecmd->argv[0], ecmd->argv); 6d4: 52 push %edx 6d5: 52 push %edx 6d6: 8d 53 04 lea 0x4(%ebx),%edx 6d9: 52 push %edx 6da: 50 push %eax 6db: e8 d0 0b 00 00 call 12b0 <exec> printf(2, "exec %s failed\n", ecmd->argv[0]); 6e0: 83 c4 0c add $0xc,%esp 6e3: ff 73 04 pushl 0x4(%ebx) 6e6: 68 27 17 00 00 push $0x1727 6eb: 6a 02 push $0x2 6ed: e8 ee 0c 00 00 call 13e0 <printf> break; 6f2: 83 c4 10 add $0x10,%esp 6f5: eb bd jmp 6b4 <runcmd+0x84> case REDIR: rcmd = (struct redircmd*)cmd; close(rcmd->fd); 6f7: 83 ec 0c sub $0xc,%esp 6fa: ff 73 14 pushl 0x14(%ebx) 6fd: e8 9e 0b 00 00 call 12a0 <close> if(open(rcmd->file, rcmd->mode) < 0){ 702: 59 pop %ecx 703: 58 pop %eax 704: ff 73 10 pushl 0x10(%ebx) 707: ff 73 08 pushl 0x8(%ebx) 70a: e8 a9 0b 00 00 call 12b8 <open> 70f: 83 c4 10 add $0x10,%esp 712: 85 c0 test %eax,%eax 714: 78 43 js 759 <runcmd+0x129> break; case BACK: bcmd = (struct backcmd*)cmd; if(fork1() == 0) runcmd(bcmd->cmd); 716: 83 ec 0c sub $0xc,%esp 719: ff 73 04 pushl 0x4(%ebx) 71c: e8 0f ff ff ff call 630 <runcmd> int fork1(void) { int pid; pid = fork(); 721: e8 4a 0b 00 00 call 1270 <fork> if(pid == -1) 726: 83 f8 ff cmp $0xffffffff,%eax 729: 74 21 je 74c <runcmd+0x11c> runcmd(rcmd->cmd); break; case LIST: lcmd = (struct listcmd*)cmd; if(fork1() == 0) 72b: 85 c0 test %eax,%eax 72d: 74 e7 je 716 <runcmd+0xe6> runcmd(lcmd->left); wait(); 72f: e8 4c 0b 00 00 call 1280 <wait> runcmd(lcmd->right); 734: 83 ec 0c sub $0xc,%esp 737: ff 73 08 pushl 0x8(%ebx) 73a: e8 f1 fe ff ff call 630 <runcmd> if(cmd == 0) exit(); switch(cmd->type){ default: panic("runcmd"); 73f: 83 ec 0c sub $0xc,%esp 742: 68 20 17 00 00 push $0x1720 747: e8 c4 fe ff ff call 610 <panic> { int pid; pid = fork(); if(pid == -1) panic("fork"); 74c: 83 ec 0c sub $0xc,%esp 74f: 68 47 17 00 00 push $0x1747 754: e8 b7 fe ff ff call 610 <panic> case REDIR: rcmd = (struct redircmd*)cmd; close(rcmd->fd); if(open(rcmd->file, rcmd->mode) < 0){ printf(2, "open %s failed\n", rcmd->file); 759: 52 push %edx 75a: ff 73 08 pushl 0x8(%ebx) 75d: 68 37 17 00 00 push $0x1737 762: 6a 02 push $0x2 764: e8 77 0c 00 00 call 13e0 <printf> exit(); 769: e8 0a 0b 00 00 call 1278 <exit> break; case PIPE: pcmd = (struct pipecmd*)cmd; if(pipe(p) < 0) panic("pipe"); 76e: 83 ec 0c sub $0xc,%esp 771: 68 4c 17 00 00 push $0x174c 776: e8 95 fe ff ff call 610 <panic> if(fork1() == 0){ close(1); 77b: 83 ec 0c sub $0xc,%esp 77e: 6a 01 push $0x1 780: e8 1b 0b 00 00 call 12a0 <close> dup(p[1]); 785: 58 pop %eax 786: ff 75 f4 pushl -0xc(%ebp) 789: e8 62 0b 00 00 call 12f0 <dup> close(p[0]); 78e: 58 pop %eax 78f: ff 75 f0 pushl -0x10(%ebp) 792: e8 09 0b 00 00 call 12a0 <close> close(p[1]); 797: 58 pop %eax 798: ff 75 f4 pushl -0xc(%ebp) 79b: e8 00 0b 00 00 call 12a0 <close> runcmd(pcmd->left); 7a0: 58 pop %eax 7a1: ff 73 04 pushl 0x4(%ebx) 7a4: e8 87 fe ff ff call 630 <runcmd> } if(fork1() == 0){ close(0); 7a9: 83 ec 0c sub $0xc,%esp 7ac: 6a 00 push $0x0 7ae: e8 ed 0a 00 00 call 12a0 <close> dup(p[0]); 7b3: 5a pop %edx 7b4: ff 75 f0 pushl -0x10(%ebp) 7b7: e8 34 0b 00 00 call 12f0 <dup> close(p[0]); 7bc: 59 pop %ecx 7bd: ff 75 f0 pushl -0x10(%ebp) 7c0: e8 db 0a 00 00 call 12a0 <close> close(p[1]); 7c5: 58 pop %eax 7c6: ff 75 f4 pushl -0xc(%ebp) 7c9: e8 d2 0a 00 00 call 12a0 <close> runcmd(pcmd->right); 7ce: 58 pop %eax 7cf: ff 73 08 pushl 0x8(%ebx) 7d2: e8 59 fe ff ff call 630 <runcmd> 7d7: 89 f6 mov %esi,%esi 7d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000007e0 <fork1>: exit(); } int fork1(void) { 7e0: 55 push %ebp 7e1: 89 e5 mov %esp,%ebp 7e3: 83 ec 08 sub $0x8,%esp int pid; pid = fork(); 7e6: e8 85 0a 00 00 call 1270 <fork> if(pid == -1) 7eb: 83 f8 ff cmp $0xffffffff,%eax 7ee: 74 02 je 7f2 <fork1+0x12> panic("fork"); return pid; } 7f0: c9 leave 7f1: c3 ret { int pid; pid = fork(); if(pid == -1) panic("fork"); 7f2: 83 ec 0c sub $0xc,%esp 7f5: 68 47 17 00 00 push $0x1747 7fa: e8 11 fe ff ff call 610 <panic> 7ff: 90 nop 00000800 <execcmd>: //PAGEBREAK! // Constructors struct cmd* execcmd(void) { 800: 55 push %ebp 801: 89 e5 mov %esp,%ebp 803: 53 push %ebx 804: 83 ec 10 sub $0x10,%esp struct execcmd *cmd; cmd = malloc(sizeof(*cmd)); 807: 6a 54 push $0x54 809: e8 02 0e 00 00 call 1610 <malloc> memset(cmd, 0, sizeof(*cmd)); 80e: 83 c4 0c add $0xc,%esp struct cmd* execcmd(void) { struct execcmd *cmd; cmd = malloc(sizeof(*cmd)); 811: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 813: 6a 54 push $0x54 815: 6a 00 push $0x0 817: 50 push %eax 818: e8 b3 08 00 00 call 10d0 <memset> cmd->type = EXEC; 81d: c7 03 01 00 00 00 movl $0x1,(%ebx) return (struct cmd*)cmd; } 823: 89 d8 mov %ebx,%eax 825: 8b 5d fc mov -0x4(%ebp),%ebx 828: c9 leave 829: c3 ret 82a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00000830 <redircmd>: struct cmd* redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) { 830: 55 push %ebp 831: 89 e5 mov %esp,%ebp 833: 53 push %ebx 834: 83 ec 10 sub $0x10,%esp struct redircmd *cmd; cmd = malloc(sizeof(*cmd)); 837: 6a 18 push $0x18 839: e8 d2 0d 00 00 call 1610 <malloc> memset(cmd, 0, sizeof(*cmd)); 83e: 83 c4 0c add $0xc,%esp struct cmd* redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) { struct redircmd *cmd; cmd = malloc(sizeof(*cmd)); 841: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 843: 6a 18 push $0x18 845: 6a 00 push $0x0 847: 50 push %eax 848: e8 83 08 00 00 call 10d0 <memset> cmd->type = REDIR; cmd->cmd = subcmd; 84d: 8b 45 08 mov 0x8(%ebp),%eax { struct redircmd *cmd; cmd = malloc(sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd)); cmd->type = REDIR; 850: c7 03 02 00 00 00 movl $0x2,(%ebx) cmd->cmd = subcmd; 856: 89 43 04 mov %eax,0x4(%ebx) cmd->file = file; 859: 8b 45 0c mov 0xc(%ebp),%eax 85c: 89 43 08 mov %eax,0x8(%ebx) cmd->efile = efile; 85f: 8b 45 10 mov 0x10(%ebp),%eax 862: 89 43 0c mov %eax,0xc(%ebx) cmd->mode = mode; 865: 8b 45 14 mov 0x14(%ebp),%eax 868: 89 43 10 mov %eax,0x10(%ebx) cmd->fd = fd; 86b: 8b 45 18 mov 0x18(%ebp),%eax 86e: 89 43 14 mov %eax,0x14(%ebx) return (struct cmd*)cmd; } 871: 89 d8 mov %ebx,%eax 873: 8b 5d fc mov -0x4(%ebp),%ebx 876: c9 leave 877: c3 ret 878: 90 nop 879: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000880 <pipecmd>: struct cmd* pipecmd(struct cmd *left, struct cmd *right) { 880: 55 push %ebp 881: 89 e5 mov %esp,%ebp 883: 53 push %ebx 884: 83 ec 10 sub $0x10,%esp struct pipecmd *cmd; cmd = malloc(sizeof(*cmd)); 887: 6a 0c push $0xc 889: e8 82 0d 00 00 call 1610 <malloc> memset(cmd, 0, sizeof(*cmd)); 88e: 83 c4 0c add $0xc,%esp struct cmd* pipecmd(struct cmd *left, struct cmd *right) { struct pipecmd *cmd; cmd = malloc(sizeof(*cmd)); 891: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 893: 6a 0c push $0xc 895: 6a 00 push $0x0 897: 50 push %eax 898: e8 33 08 00 00 call 10d0 <memset> cmd->type = PIPE; cmd->left = left; 89d: 8b 45 08 mov 0x8(%ebp),%eax { struct pipecmd *cmd; cmd = malloc(sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd)); cmd->type = PIPE; 8a0: c7 03 03 00 00 00 movl $0x3,(%ebx) cmd->left = left; 8a6: 89 43 04 mov %eax,0x4(%ebx) cmd->right = right; 8a9: 8b 45 0c mov 0xc(%ebp),%eax 8ac: 89 43 08 mov %eax,0x8(%ebx) return (struct cmd*)cmd; } 8af: 89 d8 mov %ebx,%eax 8b1: 8b 5d fc mov -0x4(%ebp),%ebx 8b4: c9 leave 8b5: c3 ret 8b6: 8d 76 00 lea 0x0(%esi),%esi 8b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000008c0 <listcmd>: struct cmd* listcmd(struct cmd *left, struct cmd *right) { 8c0: 55 push %ebp 8c1: 89 e5 mov %esp,%ebp 8c3: 53 push %ebx 8c4: 83 ec 10 sub $0x10,%esp struct listcmd *cmd; cmd = malloc(sizeof(*cmd)); 8c7: 6a 0c push $0xc 8c9: e8 42 0d 00 00 call 1610 <malloc> memset(cmd, 0, sizeof(*cmd)); 8ce: 83 c4 0c add $0xc,%esp struct cmd* listcmd(struct cmd *left, struct cmd *right) { struct listcmd *cmd; cmd = malloc(sizeof(*cmd)); 8d1: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 8d3: 6a 0c push $0xc 8d5: 6a 00 push $0x0 8d7: 50 push %eax 8d8: e8 f3 07 00 00 call 10d0 <memset> cmd->type = LIST; cmd->left = left; 8dd: 8b 45 08 mov 0x8(%ebp),%eax { struct listcmd *cmd; cmd = malloc(sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd)); cmd->type = LIST; 8e0: c7 03 04 00 00 00 movl $0x4,(%ebx) cmd->left = left; 8e6: 89 43 04 mov %eax,0x4(%ebx) cmd->right = right; 8e9: 8b 45 0c mov 0xc(%ebp),%eax 8ec: 89 43 08 mov %eax,0x8(%ebx) return (struct cmd*)cmd; } 8ef: 89 d8 mov %ebx,%eax 8f1: 8b 5d fc mov -0x4(%ebp),%ebx 8f4: c9 leave 8f5: c3 ret 8f6: 8d 76 00 lea 0x0(%esi),%esi 8f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000900 <backcmd>: struct cmd* backcmd(struct cmd *subcmd) { 900: 55 push %ebp 901: 89 e5 mov %esp,%ebp 903: 53 push %ebx 904: 83 ec 10 sub $0x10,%esp struct backcmd *cmd; cmd = malloc(sizeof(*cmd)); 907: 6a 08 push $0x8 909: e8 02 0d 00 00 call 1610 <malloc> memset(cmd, 0, sizeof(*cmd)); 90e: 83 c4 0c add $0xc,%esp struct cmd* backcmd(struct cmd *subcmd) { struct backcmd *cmd; cmd = malloc(sizeof(*cmd)); 911: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 913: 6a 08 push $0x8 915: 6a 00 push $0x0 917: 50 push %eax 918: e8 b3 07 00 00 call 10d0 <memset> cmd->type = BACK; cmd->cmd = subcmd; 91d: 8b 45 08 mov 0x8(%ebp),%eax { struct backcmd *cmd; cmd = malloc(sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd)); cmd->type = BACK; 920: c7 03 05 00 00 00 movl $0x5,(%ebx) cmd->cmd = subcmd; 926: 89 43 04 mov %eax,0x4(%ebx) return (struct cmd*)cmd; } 929: 89 d8 mov %ebx,%eax 92b: 8b 5d fc mov -0x4(%ebp),%ebx 92e: c9 leave 92f: c3 ret 00000930 <gettoken>: char whitespace[] = " \t\r\n\v"; char symbols[] = "<|>&;()"; int gettoken(char **ps, char *es, char **q, char **eq) { 930: 55 push %ebp 931: 89 e5 mov %esp,%ebp 933: 57 push %edi 934: 56 push %esi 935: 53 push %ebx 936: 83 ec 0c sub $0xc,%esp char *s; int ret; s = *ps; 939: 8b 45 08 mov 0x8(%ebp),%eax char whitespace[] = " \t\r\n\v"; char symbols[] = "<|>&;()"; int gettoken(char **ps, char *es, char **q, char **eq) { 93c: 8b 5d 0c mov 0xc(%ebp),%ebx 93f: 8b 75 10 mov 0x10(%ebp),%esi char *s; int ret; s = *ps; 942: 8b 38 mov (%eax),%edi while(s < es && strchr(whitespace, *s)) 944: 39 df cmp %ebx,%edi 946: 72 13 jb 95b <gettoken+0x2b> 948: eb 29 jmp 973 <gettoken+0x43> 94a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi s++; 950: 83 c7 01 add $0x1,%edi { char *s; int ret; s = *ps; while(s < es && strchr(whitespace, *s)) 953: 39 fb cmp %edi,%ebx 955: 0f 84 ed 00 00 00 je a48 <gettoken+0x118> 95b: 0f be 07 movsbl (%edi),%eax 95e: 83 ec 08 sub $0x8,%esp 961: 50 push %eax 962: 68 14 1f 00 00 push $0x1f14 967: e8 84 07 00 00 call 10f0 <strchr> 96c: 83 c4 10 add $0x10,%esp 96f: 85 c0 test %eax,%eax 971: 75 dd jne 950 <gettoken+0x20> s++; if(q) 973: 85 f6 test %esi,%esi 975: 74 02 je 979 <gettoken+0x49> *q = s; 977: 89 3e mov %edi,(%esi) ret = *s; 979: 0f be 37 movsbl (%edi),%esi 97c: 89 f1 mov %esi,%ecx 97e: 89 f0 mov %esi,%eax switch(*s){ 980: 80 f9 29 cmp $0x29,%cl 983: 7f 5b jg 9e0 <gettoken+0xb0> 985: 80 f9 28 cmp $0x28,%cl 988: 7d 61 jge 9eb <gettoken+0xbb> 98a: 84 c9 test %cl,%cl 98c: 0f 85 de 00 00 00 jne a70 <gettoken+0x140> ret = 'a'; while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) s++; break; } if(eq) 992: 8b 55 14 mov 0x14(%ebp),%edx 995: 85 d2 test %edx,%edx 997: 74 05 je 99e <gettoken+0x6e> *eq = s; 999: 8b 45 14 mov 0x14(%ebp),%eax 99c: 89 38 mov %edi,(%eax) while(s < es && strchr(whitespace, *s)) 99e: 39 fb cmp %edi,%ebx 9a0: 77 0d ja 9af <gettoken+0x7f> 9a2: eb 23 jmp 9c7 <gettoken+0x97> 9a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi s++; 9a8: 83 c7 01 add $0x1,%edi break; } if(eq) *eq = s; while(s < es && strchr(whitespace, *s)) 9ab: 39 fb cmp %edi,%ebx 9ad: 74 18 je 9c7 <gettoken+0x97> 9af: 0f be 07 movsbl (%edi),%eax 9b2: 83 ec 08 sub $0x8,%esp 9b5: 50 push %eax 9b6: 68 14 1f 00 00 push $0x1f14 9bb: e8 30 07 00 00 call 10f0 <strchr> 9c0: 83 c4 10 add $0x10,%esp 9c3: 85 c0 test %eax,%eax 9c5: 75 e1 jne 9a8 <gettoken+0x78> s++; *ps = s; 9c7: 8b 45 08 mov 0x8(%ebp),%eax 9ca: 89 38 mov %edi,(%eax) return ret; } 9cc: 8d 65 f4 lea -0xc(%ebp),%esp 9cf: 89 f0 mov %esi,%eax 9d1: 5b pop %ebx 9d2: 5e pop %esi 9d3: 5f pop %edi 9d4: 5d pop %ebp 9d5: c3 ret 9d6: 8d 76 00 lea 0x0(%esi),%esi 9d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi while(s < es && strchr(whitespace, *s)) s++; if(q) *q = s; ret = *s; switch(*s){ 9e0: 80 f9 3e cmp $0x3e,%cl 9e3: 75 0b jne 9f0 <gettoken+0xc0> case '<': s++; break; case '>': s++; if(*s == '>'){ 9e5: 80 7f 01 3e cmpb $0x3e,0x1(%edi) 9e9: 74 75 je a60 <gettoken+0x130> case '&': case '<': s++; break; case '>': s++; 9eb: 83 c7 01 add $0x1,%edi 9ee: eb a2 jmp 992 <gettoken+0x62> while(s < es && strchr(whitespace, *s)) s++; if(q) *q = s; ret = *s; switch(*s){ 9f0: 7f 5e jg a50 <gettoken+0x120> 9f2: 83 e9 3b sub $0x3b,%ecx 9f5: 80 f9 01 cmp $0x1,%cl 9f8: 76 f1 jbe 9eb <gettoken+0xbb> s++; } break; default: ret = 'a'; while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) 9fa: 39 fb cmp %edi,%ebx 9fc: 77 24 ja a22 <gettoken+0xf2> 9fe: eb 7c jmp a7c <gettoken+0x14c> a00: 0f be 07 movsbl (%edi),%eax a03: 83 ec 08 sub $0x8,%esp a06: 50 push %eax a07: 68 0c 1f 00 00 push $0x1f0c a0c: e8 df 06 00 00 call 10f0 <strchr> a11: 83 c4 10 add $0x10,%esp a14: 85 c0 test %eax,%eax a16: 75 1f jne a37 <gettoken+0x107> s++; a18: 83 c7 01 add $0x1,%edi s++; } break; default: ret = 'a'; while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) a1b: 39 fb cmp %edi,%ebx a1d: 74 5b je a7a <gettoken+0x14a> a1f: 0f be 07 movsbl (%edi),%eax a22: 83 ec 08 sub $0x8,%esp a25: 50 push %eax a26: 68 14 1f 00 00 push $0x1f14 a2b: e8 c0 06 00 00 call 10f0 <strchr> a30: 83 c4 10 add $0x10,%esp a33: 85 c0 test %eax,%eax a35: 74 c9 je a00 <gettoken+0xd0> ret = '+'; s++; } break; default: ret = 'a'; a37: be 61 00 00 00 mov $0x61,%esi a3c: e9 51 ff ff ff jmp 992 <gettoken+0x62> a41: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi a48: 89 df mov %ebx,%edi a4a: e9 24 ff ff ff jmp 973 <gettoken+0x43> a4f: 90 nop while(s < es && strchr(whitespace, *s)) s++; if(q) *q = s; ret = *s; switch(*s){ a50: 80 f9 7c cmp $0x7c,%cl a53: 74 96 je 9eb <gettoken+0xbb> a55: eb a3 jmp 9fa <gettoken+0xca> a57: 89 f6 mov %esi,%esi a59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi break; case '>': s++; if(*s == '>'){ ret = '+'; s++; a60: 83 c7 02 add $0x2,%edi s++; break; case '>': s++; if(*s == '>'){ ret = '+'; a63: be 2b 00 00 00 mov $0x2b,%esi a68: e9 25 ff ff ff jmp 992 <gettoken+0x62> a6d: 8d 76 00 lea 0x0(%esi),%esi while(s < es && strchr(whitespace, *s)) s++; if(q) *q = s; ret = *s; switch(*s){ a70: 80 f9 26 cmp $0x26,%cl a73: 75 85 jne 9fa <gettoken+0xca> a75: e9 71 ff ff ff jmp 9eb <gettoken+0xbb> a7a: 89 df mov %ebx,%edi ret = 'a'; while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) s++; break; } if(eq) a7c: 8b 45 14 mov 0x14(%ebp),%eax a7f: be 61 00 00 00 mov $0x61,%esi a84: 85 c0 test %eax,%eax a86: 0f 85 0d ff ff ff jne 999 <gettoken+0x69> a8c: e9 36 ff ff ff jmp 9c7 <gettoken+0x97> a91: eb 0d jmp aa0 <peek> a93: 90 nop a94: 90 nop a95: 90 nop a96: 90 nop a97: 90 nop a98: 90 nop a99: 90 nop a9a: 90 nop a9b: 90 nop a9c: 90 nop a9d: 90 nop a9e: 90 nop a9f: 90 nop 00000aa0 <peek>: return ret; } int peek(char **ps, char *es, char *toks) { aa0: 55 push %ebp aa1: 89 e5 mov %esp,%ebp aa3: 57 push %edi aa4: 56 push %esi aa5: 53 push %ebx aa6: 83 ec 0c sub $0xc,%esp aa9: 8b 7d 08 mov 0x8(%ebp),%edi aac: 8b 75 0c mov 0xc(%ebp),%esi char *s; s = *ps; aaf: 8b 1f mov (%edi),%ebx while(s < es && strchr(whitespace, *s)) ab1: 39 f3 cmp %esi,%ebx ab3: 72 12 jb ac7 <peek+0x27> ab5: eb 28 jmp adf <peek+0x3f> ab7: 89 f6 mov %esi,%esi ab9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi s++; ac0: 83 c3 01 add $0x1,%ebx peek(char **ps, char *es, char *toks) { char *s; s = *ps; while(s < es && strchr(whitespace, *s)) ac3: 39 de cmp %ebx,%esi ac5: 74 18 je adf <peek+0x3f> ac7: 0f be 03 movsbl (%ebx),%eax aca: 83 ec 08 sub $0x8,%esp acd: 50 push %eax ace: 68 14 1f 00 00 push $0x1f14 ad3: e8 18 06 00 00 call 10f0 <strchr> ad8: 83 c4 10 add $0x10,%esp adb: 85 c0 test %eax,%eax add: 75 e1 jne ac0 <peek+0x20> s++; *ps = s; adf: 89 1f mov %ebx,(%edi) return *s && strchr(toks, *s); ae1: 0f be 13 movsbl (%ebx),%edx ae4: 31 c0 xor %eax,%eax ae6: 84 d2 test %dl,%dl ae8: 74 17 je b01 <peek+0x61> aea: 83 ec 08 sub $0x8,%esp aed: 52 push %edx aee: ff 75 10 pushl 0x10(%ebp) af1: e8 fa 05 00 00 call 10f0 <strchr> af6: 83 c4 10 add $0x10,%esp af9: 85 c0 test %eax,%eax afb: 0f 95 c0 setne %al afe: 0f b6 c0 movzbl %al,%eax } b01: 8d 65 f4 lea -0xc(%ebp),%esp b04: 5b pop %ebx b05: 5e pop %esi b06: 5f pop %edi b07: 5d pop %ebp b08: c3 ret b09: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000b10 <parseredirs>: return cmd; } struct cmd* parseredirs(struct cmd *cmd, char **ps, char *es) { b10: 55 push %ebp b11: 89 e5 mov %esp,%ebp b13: 57 push %edi b14: 56 push %esi b15: 53 push %ebx b16: 83 ec 1c sub $0x1c,%esp b19: 8b 75 0c mov 0xc(%ebp),%esi b1c: 8b 5d 10 mov 0x10(%ebp),%ebx b1f: 90 nop int tok; char *q, *eq; while(peek(ps, es, "<>")){ b20: 83 ec 04 sub $0x4,%esp b23: 68 6e 17 00 00 push $0x176e b28: 53 push %ebx b29: 56 push %esi b2a: e8 71 ff ff ff call aa0 <peek> b2f: 83 c4 10 add $0x10,%esp b32: 85 c0 test %eax,%eax b34: 74 6a je ba0 <parseredirs+0x90> tok = gettoken(ps, es, 0, 0); b36: 6a 00 push $0x0 b38: 6a 00 push $0x0 b3a: 53 push %ebx b3b: 56 push %esi b3c: e8 ef fd ff ff call 930 <gettoken> b41: 89 c7 mov %eax,%edi if(gettoken(ps, es, &q, &eq) != 'a') b43: 8d 45 e4 lea -0x1c(%ebp),%eax b46: 50 push %eax b47: 8d 45 e0 lea -0x20(%ebp),%eax b4a: 50 push %eax b4b: 53 push %ebx b4c: 56 push %esi b4d: e8 de fd ff ff call 930 <gettoken> b52: 83 c4 20 add $0x20,%esp b55: 83 f8 61 cmp $0x61,%eax b58: 75 51 jne bab <parseredirs+0x9b> panic("missing file for redirection"); switch(tok){ b5a: 83 ff 3c cmp $0x3c,%edi b5d: 74 31 je b90 <parseredirs+0x80> b5f: 83 ff 3e cmp $0x3e,%edi b62: 74 05 je b69 <parseredirs+0x59> b64: 83 ff 2b cmp $0x2b,%edi b67: 75 b7 jne b20 <parseredirs+0x10> break; case '>': cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); break; case '+': // >> cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); b69: 83 ec 0c sub $0xc,%esp b6c: 6a 01 push $0x1 b6e: 68 01 02 00 00 push $0x201 b73: ff 75 e4 pushl -0x1c(%ebp) b76: ff 75 e0 pushl -0x20(%ebp) b79: ff 75 08 pushl 0x8(%ebp) b7c: e8 af fc ff ff call 830 <redircmd> break; b81: 83 c4 20 add $0x20,%esp break; case '>': cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); break; case '+': // >> cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); b84: 89 45 08 mov %eax,0x8(%ebp) break; b87: eb 97 jmp b20 <parseredirs+0x10> b89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi tok = gettoken(ps, es, 0, 0); if(gettoken(ps, es, &q, &eq) != 'a') panic("missing file for redirection"); switch(tok){ case '<': cmd = redircmd(cmd, q, eq, O_RDONLY, 0); b90: 83 ec 0c sub $0xc,%esp b93: 6a 00 push $0x0 b95: 6a 00 push $0x0 b97: eb da jmp b73 <parseredirs+0x63> b99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1); break; } } return cmd; } ba0: 8b 45 08 mov 0x8(%ebp),%eax ba3: 8d 65 f4 lea -0xc(%ebp),%esp ba6: 5b pop %ebx ba7: 5e pop %esi ba8: 5f pop %edi ba9: 5d pop %ebp baa: c3 ret char *q, *eq; while(peek(ps, es, "<>")){ tok = gettoken(ps, es, 0, 0); if(gettoken(ps, es, &q, &eq) != 'a') panic("missing file for redirection"); bab: 83 ec 0c sub $0xc,%esp bae: 68 51 17 00 00 push $0x1751 bb3: e8 58 fa ff ff call 610 <panic> bb8: 90 nop bb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000bc0 <parseexec>: return cmd; } struct cmd* parseexec(char **ps, char *es) { bc0: 55 push %ebp bc1: 89 e5 mov %esp,%ebp bc3: 57 push %edi bc4: 56 push %esi bc5: 53 push %ebx bc6: 83 ec 30 sub $0x30,%esp bc9: 8b 75 08 mov 0x8(%ebp),%esi bcc: 8b 7d 0c mov 0xc(%ebp),%edi char *q, *eq; int tok, argc; struct execcmd *cmd; struct cmd *ret; if(peek(ps, es, "(")) bcf: 68 71 17 00 00 push $0x1771 bd4: 57 push %edi bd5: 56 push %esi bd6: e8 c5 fe ff ff call aa0 <peek> bdb: 83 c4 10 add $0x10,%esp bde: 85 c0 test %eax,%eax be0: 0f 85 9a 00 00 00 jne c80 <parseexec+0xc0> return parseblock(ps, es); ret = execcmd(); be6: e8 15 fc ff ff call 800 <execcmd> cmd = (struct execcmd*)ret; argc = 0; ret = parseredirs(ret, ps, es); beb: 83 ec 04 sub $0x4,%esp struct cmd *ret; if(peek(ps, es, "(")) return parseblock(ps, es); ret = execcmd(); bee: 89 c3 mov %eax,%ebx bf0: 89 45 cc mov %eax,-0x34(%ebp) cmd = (struct execcmd*)ret; argc = 0; ret = parseredirs(ret, ps, es); bf3: 57 push %edi bf4: 56 push %esi bf5: 8d 5b 04 lea 0x4(%ebx),%ebx bf8: 50 push %eax bf9: e8 12 ff ff ff call b10 <parseredirs> bfe: 83 c4 10 add $0x10,%esp c01: 89 45 d0 mov %eax,-0x30(%ebp) return parseblock(ps, es); ret = execcmd(); cmd = (struct execcmd*)ret; argc = 0; c04: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) c0b: eb 16 jmp c23 <parseexec+0x63> c0d: 8d 76 00 lea 0x0(%esi),%esi cmd->argv[argc] = q; cmd->eargv[argc] = eq; argc++; if(argc >= MAXARGS) panic("too many args"); ret = parseredirs(ret, ps, es); c10: 83 ec 04 sub $0x4,%esp c13: 57 push %edi c14: 56 push %esi c15: ff 75 d0 pushl -0x30(%ebp) c18: e8 f3 fe ff ff call b10 <parseredirs> c1d: 83 c4 10 add $0x10,%esp c20: 89 45 d0 mov %eax,-0x30(%ebp) ret = execcmd(); cmd = (struct execcmd*)ret; argc = 0; ret = parseredirs(ret, ps, es); while(!peek(ps, es, "|)&;")){ c23: 83 ec 04 sub $0x4,%esp c26: 68 88 17 00 00 push $0x1788 c2b: 57 push %edi c2c: 56 push %esi c2d: e8 6e fe ff ff call aa0 <peek> c32: 83 c4 10 add $0x10,%esp c35: 85 c0 test %eax,%eax c37: 75 5f jne c98 <parseexec+0xd8> if((tok=gettoken(ps, es, &q, &eq)) == 0) c39: 8d 45 e4 lea -0x1c(%ebp),%eax c3c: 50 push %eax c3d: 8d 45 e0 lea -0x20(%ebp),%eax c40: 50 push %eax c41: 57 push %edi c42: 56 push %esi c43: e8 e8 fc ff ff call 930 <gettoken> c48: 83 c4 10 add $0x10,%esp c4b: 85 c0 test %eax,%eax c4d: 74 49 je c98 <parseexec+0xd8> break; if(tok != 'a') c4f: 83 f8 61 cmp $0x61,%eax c52: 75 66 jne cba <parseexec+0xfa> panic("syntax"); cmd->argv[argc] = q; c54: 8b 45 e0 mov -0x20(%ebp),%eax cmd->eargv[argc] = eq; argc++; c57: 83 45 d4 01 addl $0x1,-0x2c(%ebp) c5b: 83 c3 04 add $0x4,%ebx while(!peek(ps, es, "|)&;")){ if((tok=gettoken(ps, es, &q, &eq)) == 0) break; if(tok != 'a') panic("syntax"); cmd->argv[argc] = q; c5e: 89 43 fc mov %eax,-0x4(%ebx) cmd->eargv[argc] = eq; c61: 8b 45 e4 mov -0x1c(%ebp),%eax c64: 89 43 24 mov %eax,0x24(%ebx) argc++; c67: 8b 45 d4 mov -0x2c(%ebp),%eax if(argc >= MAXARGS) c6a: 83 f8 0a cmp $0xa,%eax c6d: 75 a1 jne c10 <parseexec+0x50> panic("too many args"); c6f: 83 ec 0c sub $0xc,%esp c72: 68 7a 17 00 00 push $0x177a c77: e8 94 f9 ff ff call 610 <panic> c7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi int tok, argc; struct execcmd *cmd; struct cmd *ret; if(peek(ps, es, "(")) return parseblock(ps, es); c80: 83 ec 08 sub $0x8,%esp c83: 57 push %edi c84: 56 push %esi c85: e8 56 01 00 00 call de0 <parseblock> c8a: 83 c4 10 add $0x10,%esp ret = parseredirs(ret, ps, es); } cmd->argv[argc] = 0; cmd->eargv[argc] = 0; return ret; } c8d: 8d 65 f4 lea -0xc(%ebp),%esp c90: 5b pop %ebx c91: 5e pop %esi c92: 5f pop %edi c93: 5d pop %ebp c94: c3 ret c95: 8d 76 00 lea 0x0(%esi),%esi c98: 8b 45 cc mov -0x34(%ebp),%eax c9b: 8b 55 d4 mov -0x2c(%ebp),%edx c9e: 8d 04 90 lea (%eax,%edx,4),%eax argc++; if(argc >= MAXARGS) panic("too many args"); ret = parseredirs(ret, ps, es); } cmd->argv[argc] = 0; ca1: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) cmd->eargv[argc] = 0; ca8: c7 40 2c 00 00 00 00 movl $0x0,0x2c(%eax) caf: 8b 45 d0 mov -0x30(%ebp),%eax return ret; } cb2: 8d 65 f4 lea -0xc(%ebp),%esp cb5: 5b pop %ebx cb6: 5e pop %esi cb7: 5f pop %edi cb8: 5d pop %ebp cb9: c3 ret ret = parseredirs(ret, ps, es); while(!peek(ps, es, "|)&;")){ if((tok=gettoken(ps, es, &q, &eq)) == 0) break; if(tok != 'a') panic("syntax"); cba: 83 ec 0c sub $0xc,%esp cbd: 68 73 17 00 00 push $0x1773 cc2: e8 49 f9 ff ff call 610 <panic> cc7: 89 f6 mov %esi,%esi cc9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000cd0 <parsepipe>: return cmd; } struct cmd* parsepipe(char **ps, char *es) { cd0: 55 push %ebp cd1: 89 e5 mov %esp,%ebp cd3: 57 push %edi cd4: 56 push %esi cd5: 53 push %ebx cd6: 83 ec 14 sub $0x14,%esp cd9: 8b 5d 08 mov 0x8(%ebp),%ebx cdc: 8b 75 0c mov 0xc(%ebp),%esi struct cmd *cmd; cmd = parseexec(ps, es); cdf: 56 push %esi ce0: 53 push %ebx ce1: e8 da fe ff ff call bc0 <parseexec> if(peek(ps, es, "|")){ ce6: 83 c4 0c add $0xc,%esp struct cmd* parsepipe(char **ps, char *es) { struct cmd *cmd; cmd = parseexec(ps, es); ce9: 89 c7 mov %eax,%edi if(peek(ps, es, "|")){ ceb: 68 8d 17 00 00 push $0x178d cf0: 56 push %esi cf1: 53 push %ebx cf2: e8 a9 fd ff ff call aa0 <peek> cf7: 83 c4 10 add $0x10,%esp cfa: 85 c0 test %eax,%eax cfc: 75 12 jne d10 <parsepipe+0x40> gettoken(ps, es, 0, 0); cmd = pipecmd(cmd, parsepipe(ps, es)); } return cmd; } cfe: 8d 65 f4 lea -0xc(%ebp),%esp d01: 89 f8 mov %edi,%eax d03: 5b pop %ebx d04: 5e pop %esi d05: 5f pop %edi d06: 5d pop %ebp d07: c3 ret d08: 90 nop d09: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi { struct cmd *cmd; cmd = parseexec(ps, es); if(peek(ps, es, "|")){ gettoken(ps, es, 0, 0); d10: 6a 00 push $0x0 d12: 6a 00 push $0x0 d14: 56 push %esi d15: 53 push %ebx d16: e8 15 fc ff ff call 930 <gettoken> cmd = pipecmd(cmd, parsepipe(ps, es)); d1b: 58 pop %eax d1c: 5a pop %edx d1d: 56 push %esi d1e: 53 push %ebx d1f: e8 ac ff ff ff call cd0 <parsepipe> d24: 89 7d 08 mov %edi,0x8(%ebp) d27: 89 45 0c mov %eax,0xc(%ebp) d2a: 83 c4 10 add $0x10,%esp } return cmd; } d2d: 8d 65 f4 lea -0xc(%ebp),%esp d30: 5b pop %ebx d31: 5e pop %esi d32: 5f pop %edi d33: 5d pop %ebp struct cmd *cmd; cmd = parseexec(ps, es); if(peek(ps, es, "|")){ gettoken(ps, es, 0, 0); cmd = pipecmd(cmd, parsepipe(ps, es)); d34: e9 47 fb ff ff jmp 880 <pipecmd> d39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000d40 <parseline>: return cmd; } struct cmd* parseline(char **ps, char *es) { d40: 55 push %ebp d41: 89 e5 mov %esp,%ebp d43: 57 push %edi d44: 56 push %esi d45: 53 push %ebx d46: 83 ec 14 sub $0x14,%esp d49: 8b 5d 08 mov 0x8(%ebp),%ebx d4c: 8b 75 0c mov 0xc(%ebp),%esi struct cmd *cmd; cmd = parsepipe(ps, es); d4f: 56 push %esi d50: 53 push %ebx d51: e8 7a ff ff ff call cd0 <parsepipe> while(peek(ps, es, "&")){ d56: 83 c4 10 add $0x10,%esp struct cmd* parseline(char **ps, char *es) { struct cmd *cmd; cmd = parsepipe(ps, es); d59: 89 c7 mov %eax,%edi while(peek(ps, es, "&")){ d5b: eb 1b jmp d78 <parseline+0x38> d5d: 8d 76 00 lea 0x0(%esi),%esi gettoken(ps, es, 0, 0); d60: 6a 00 push $0x0 d62: 6a 00 push $0x0 d64: 56 push %esi d65: 53 push %ebx d66: e8 c5 fb ff ff call 930 <gettoken> cmd = backcmd(cmd); d6b: 89 3c 24 mov %edi,(%esp) d6e: e8 8d fb ff ff call 900 <backcmd> d73: 83 c4 10 add $0x10,%esp d76: 89 c7 mov %eax,%edi parseline(char **ps, char *es) { struct cmd *cmd; cmd = parsepipe(ps, es); while(peek(ps, es, "&")){ d78: 83 ec 04 sub $0x4,%esp d7b: 68 8f 17 00 00 push $0x178f d80: 56 push %esi d81: 53 push %ebx d82: e8 19 fd ff ff call aa0 <peek> d87: 83 c4 10 add $0x10,%esp d8a: 85 c0 test %eax,%eax d8c: 75 d2 jne d60 <parseline+0x20> gettoken(ps, es, 0, 0); cmd = backcmd(cmd); } if(peek(ps, es, ";")){ d8e: 83 ec 04 sub $0x4,%esp d91: 68 8b 17 00 00 push $0x178b d96: 56 push %esi d97: 53 push %ebx d98: e8 03 fd ff ff call aa0 <peek> d9d: 83 c4 10 add $0x10,%esp da0: 85 c0 test %eax,%eax da2: 75 0c jne db0 <parseline+0x70> gettoken(ps, es, 0, 0); cmd = listcmd(cmd, parseline(ps, es)); } return cmd; } da4: 8d 65 f4 lea -0xc(%ebp),%esp da7: 89 f8 mov %edi,%eax da9: 5b pop %ebx daa: 5e pop %esi dab: 5f pop %edi dac: 5d pop %ebp dad: c3 ret dae: 66 90 xchg %ax,%ax while(peek(ps, es, "&")){ gettoken(ps, es, 0, 0); cmd = backcmd(cmd); } if(peek(ps, es, ";")){ gettoken(ps, es, 0, 0); db0: 6a 00 push $0x0 db2: 6a 00 push $0x0 db4: 56 push %esi db5: 53 push %ebx db6: e8 75 fb ff ff call 930 <gettoken> cmd = listcmd(cmd, parseline(ps, es)); dbb: 58 pop %eax dbc: 5a pop %edx dbd: 56 push %esi dbe: 53 push %ebx dbf: e8 7c ff ff ff call d40 <parseline> dc4: 89 7d 08 mov %edi,0x8(%ebp) dc7: 89 45 0c mov %eax,0xc(%ebp) dca: 83 c4 10 add $0x10,%esp } return cmd; } dcd: 8d 65 f4 lea -0xc(%ebp),%esp dd0: 5b pop %ebx dd1: 5e pop %esi dd2: 5f pop %edi dd3: 5d pop %ebp gettoken(ps, es, 0, 0); cmd = backcmd(cmd); } if(peek(ps, es, ";")){ gettoken(ps, es, 0, 0); cmd = listcmd(cmd, parseline(ps, es)); dd4: e9 e7 fa ff ff jmp 8c0 <listcmd> dd9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000de0 <parseblock>: return cmd; } struct cmd* parseblock(char **ps, char *es) { de0: 55 push %ebp de1: 89 e5 mov %esp,%ebp de3: 57 push %edi de4: 56 push %esi de5: 53 push %ebx de6: 83 ec 10 sub $0x10,%esp de9: 8b 5d 08 mov 0x8(%ebp),%ebx dec: 8b 75 0c mov 0xc(%ebp),%esi struct cmd *cmd; if(!peek(ps, es, "(")) def: 68 71 17 00 00 push $0x1771 df4: 56 push %esi df5: 53 push %ebx df6: e8 a5 fc ff ff call aa0 <peek> dfb: 83 c4 10 add $0x10,%esp dfe: 85 c0 test %eax,%eax e00: 74 4a je e4c <parseblock+0x6c> panic("parseblock"); gettoken(ps, es, 0, 0); e02: 6a 00 push $0x0 e04: 6a 00 push $0x0 e06: 56 push %esi e07: 53 push %ebx e08: e8 23 fb ff ff call 930 <gettoken> cmd = parseline(ps, es); e0d: 58 pop %eax e0e: 5a pop %edx e0f: 56 push %esi e10: 53 push %ebx e11: e8 2a ff ff ff call d40 <parseline> if(!peek(ps, es, ")")) e16: 83 c4 0c add $0xc,%esp struct cmd *cmd; if(!peek(ps, es, "(")) panic("parseblock"); gettoken(ps, es, 0, 0); cmd = parseline(ps, es); e19: 89 c7 mov %eax,%edi if(!peek(ps, es, ")")) e1b: 68 ad 17 00 00 push $0x17ad e20: 56 push %esi e21: 53 push %ebx e22: e8 79 fc ff ff call aa0 <peek> e27: 83 c4 10 add $0x10,%esp e2a: 85 c0 test %eax,%eax e2c: 74 2b je e59 <parseblock+0x79> panic("syntax - missing )"); gettoken(ps, es, 0, 0); e2e: 6a 00 push $0x0 e30: 6a 00 push $0x0 e32: 56 push %esi e33: 53 push %ebx e34: e8 f7 fa ff ff call 930 <gettoken> cmd = parseredirs(cmd, ps, es); e39: 83 c4 0c add $0xc,%esp e3c: 56 push %esi e3d: 53 push %ebx e3e: 57 push %edi e3f: e8 cc fc ff ff call b10 <parseredirs> return cmd; } e44: 8d 65 f4 lea -0xc(%ebp),%esp e47: 5b pop %ebx e48: 5e pop %esi e49: 5f pop %edi e4a: 5d pop %ebp e4b: c3 ret parseblock(char **ps, char *es) { struct cmd *cmd; if(!peek(ps, es, "(")) panic("parseblock"); e4c: 83 ec 0c sub $0xc,%esp e4f: 68 91 17 00 00 push $0x1791 e54: e8 b7 f7 ff ff call 610 <panic> gettoken(ps, es, 0, 0); cmd = parseline(ps, es); if(!peek(ps, es, ")")) panic("syntax - missing )"); e59: 83 ec 0c sub $0xc,%esp e5c: 68 9c 17 00 00 push $0x179c e61: e8 aa f7 ff ff call 610 <panic> e66: 8d 76 00 lea 0x0(%esi),%esi e69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000e70 <nulterminate>: } // NUL-terminate all the counted strings. struct cmd* nulterminate(struct cmd *cmd) { e70: 55 push %ebp e71: 89 e5 mov %esp,%ebp e73: 53 push %ebx e74: 83 ec 04 sub $0x4,%esp e77: 8b 5d 08 mov 0x8(%ebp),%ebx struct execcmd *ecmd; struct listcmd *lcmd; struct pipecmd *pcmd; struct redircmd *rcmd; if(cmd == 0) e7a: 85 db test %ebx,%ebx e7c: 0f 84 96 00 00 00 je f18 <nulterminate+0xa8> return 0; switch(cmd->type){ e82: 83 3b 05 cmpl $0x5,(%ebx) e85: 77 48 ja ecf <nulterminate+0x5f> e87: 8b 03 mov (%ebx),%eax e89: ff 24 85 fc 17 00 00 jmp *0x17fc(,%eax,4) nulterminate(pcmd->right); break; case LIST: lcmd = (struct listcmd*)cmd; nulterminate(lcmd->left); e90: 83 ec 0c sub $0xc,%esp e93: ff 73 04 pushl 0x4(%ebx) e96: e8 d5 ff ff ff call e70 <nulterminate> nulterminate(lcmd->right); e9b: 58 pop %eax e9c: ff 73 08 pushl 0x8(%ebx) e9f: e8 cc ff ff ff call e70 <nulterminate> break; ea4: 83 c4 10 add $0x10,%esp ea7: 89 d8 mov %ebx,%eax bcmd = (struct backcmd*)cmd; nulterminate(bcmd->cmd); break; } return cmd; } ea9: 8b 5d fc mov -0x4(%ebp),%ebx eac: c9 leave ead: c3 ret eae: 66 90 xchg %ax,%ax return 0; switch(cmd->type){ case EXEC: ecmd = (struct execcmd*)cmd; for(i=0; ecmd->argv[i]; i++) eb0: 8b 4b 04 mov 0x4(%ebx),%ecx eb3: 8d 43 2c lea 0x2c(%ebx),%eax eb6: 85 c9 test %ecx,%ecx eb8: 74 15 je ecf <nulterminate+0x5f> eba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi *ecmd->eargv[i] = 0; ec0: 8b 10 mov (%eax),%edx ec2: 83 c0 04 add $0x4,%eax ec5: c6 02 00 movb $0x0,(%edx) return 0; switch(cmd->type){ case EXEC: ecmd = (struct execcmd*)cmd; for(i=0; ecmd->argv[i]; i++) ec8: 8b 50 d8 mov -0x28(%eax),%edx ecb: 85 d2 test %edx,%edx ecd: 75 f1 jne ec0 <nulterminate+0x50> struct redircmd *rcmd; if(cmd == 0) return 0; switch(cmd->type){ ecf: 89 d8 mov %ebx,%eax bcmd = (struct backcmd*)cmd; nulterminate(bcmd->cmd); break; } return cmd; } ed1: 8b 5d fc mov -0x4(%ebp),%ebx ed4: c9 leave ed5: c3 ret ed6: 8d 76 00 lea 0x0(%esi),%esi ed9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi nulterminate(lcmd->right); break; case BACK: bcmd = (struct backcmd*)cmd; nulterminate(bcmd->cmd); ee0: 83 ec 0c sub $0xc,%esp ee3: ff 73 04 pushl 0x4(%ebx) ee6: e8 85 ff ff ff call e70 <nulterminate> break; eeb: 89 d8 mov %ebx,%eax eed: 83 c4 10 add $0x10,%esp } return cmd; } ef0: 8b 5d fc mov -0x4(%ebp),%ebx ef3: c9 leave ef4: c3 ret ef5: 8d 76 00 lea 0x0(%esi),%esi *ecmd->eargv[i] = 0; break; case REDIR: rcmd = (struct redircmd*)cmd; nulterminate(rcmd->cmd); ef8: 83 ec 0c sub $0xc,%esp efb: ff 73 04 pushl 0x4(%ebx) efe: e8 6d ff ff ff call e70 <nulterminate> *rcmd->efile = 0; f03: 8b 43 0c mov 0xc(%ebx),%eax break; f06: 83 c4 10 add $0x10,%esp break; case REDIR: rcmd = (struct redircmd*)cmd; nulterminate(rcmd->cmd); *rcmd->efile = 0; f09: c6 00 00 movb $0x0,(%eax) break; f0c: 89 d8 mov %ebx,%eax bcmd = (struct backcmd*)cmd; nulterminate(bcmd->cmd); break; } return cmd; } f0e: 8b 5d fc mov -0x4(%ebp),%ebx f11: c9 leave f12: c3 ret f13: 90 nop f14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi struct listcmd *lcmd; struct pipecmd *pcmd; struct redircmd *rcmd; if(cmd == 0) return 0; f18: 31 c0 xor %eax,%eax f1a: eb 8d jmp ea9 <nulterminate+0x39> f1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000f20 <parsecmd>: struct cmd *parseexec(char**, char*); struct cmd *nulterminate(struct cmd*); struct cmd* parsecmd(char *s) { f20: 55 push %ebp f21: 89 e5 mov %esp,%ebp f23: 56 push %esi f24: 53 push %ebx char *es; struct cmd *cmd; es = s + strlen(s); f25: 8b 5d 08 mov 0x8(%ebp),%ebx f28: 83 ec 0c sub $0xc,%esp f2b: 53 push %ebx f2c: e8 6f 01 00 00 call 10a0 <strlen> cmd = parseline(&s, es); f31: 59 pop %ecx parsecmd(char *s) { char *es; struct cmd *cmd; es = s + strlen(s); f32: 01 c3 add %eax,%ebx cmd = parseline(&s, es); f34: 8d 45 08 lea 0x8(%ebp),%eax f37: 5e pop %esi f38: 53 push %ebx f39: 50 push %eax f3a: e8 01 fe ff ff call d40 <parseline> f3f: 89 c6 mov %eax,%esi peek(&s, es, ""); f41: 8d 45 08 lea 0x8(%ebp),%eax f44: 83 c4 0c add $0xc,%esp f47: 68 36 17 00 00 push $0x1736 f4c: 53 push %ebx f4d: 50 push %eax f4e: e8 4d fb ff ff call aa0 <peek> if(s != es){ f53: 8b 45 08 mov 0x8(%ebp),%eax f56: 83 c4 10 add $0x10,%esp f59: 39 c3 cmp %eax,%ebx f5b: 75 12 jne f6f <parsecmd+0x4f> printf(2, "leftovers: %s\n", s); panic("syntax"); } nulterminate(cmd); f5d: 83 ec 0c sub $0xc,%esp f60: 56 push %esi f61: e8 0a ff ff ff call e70 <nulterminate> return cmd; } f66: 8d 65 f8 lea -0x8(%ebp),%esp f69: 89 f0 mov %esi,%eax f6b: 5b pop %ebx f6c: 5e pop %esi f6d: 5d pop %ebp f6e: c3 ret es = s + strlen(s); cmd = parseline(&s, es); peek(&s, es, ""); if(s != es){ printf(2, "leftovers: %s\n", s); f6f: 52 push %edx f70: 50 push %eax f71: 68 af 17 00 00 push $0x17af f76: 6a 02 push $0x2 f78: e8 63 04 00 00 call 13e0 <printf> panic("syntax"); f7d: c7 04 24 73 17 00 00 movl $0x1773,(%esp) f84: e8 87 f6 ff ff call 610 <panic> f89: 66 90 xchg %ax,%ax f8b: 66 90 xchg %ax,%ax f8d: 66 90 xchg %ax,%ax f8f: 90 nop 00000f90 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { f90: 55 push %ebp f91: 89 e5 mov %esp,%ebp f93: 53 push %ebx f94: 8b 45 08 mov 0x8(%ebp),%eax f97: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) f9a: 89 c2 mov %eax,%edx f9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi fa0: 83 c1 01 add $0x1,%ecx fa3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx fa7: 83 c2 01 add $0x1,%edx faa: 84 db test %bl,%bl fac: 88 5a ff mov %bl,-0x1(%edx) faf: 75 ef jne fa0 <strcpy+0x10> ; return os; } fb1: 5b pop %ebx fb2: 5d pop %ebp fb3: c3 ret fb4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi fba: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000fc0 <strncpy>: char* strncpy(char* s, char* t, int n) { fc0: 55 push %ebp int i = 0; fc1: 31 d2 xor %edx,%edx while((*s++ = *t++) != 0) ; return os; } char* strncpy(char* s, char* t, int n) { fc3: 89 e5 mov %esp,%ebp fc5: 56 push %esi fc6: 53 push %ebx fc7: 8b 45 08 mov 0x8(%ebp),%eax fca: 8b 5d 0c mov 0xc(%ebp),%ebx fcd: 8b 75 10 mov 0x10(%ebp),%esi int i = 0; char *os; os = s; while(((*s++ = *t++) != 0) && (++i < n)); fd0: eb 0d jmp fdf <strncpy+0x1f> fd2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi fd8: 83 c2 01 add $0x1,%edx fdb: 39 f2 cmp %esi,%edx fdd: 7d 0b jge fea <strncpy+0x2a> fdf: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx fe3: 84 c9 test %cl,%cl fe5: 88 0c 10 mov %cl,(%eax,%edx,1) fe8: 75 ee jne fd8 <strncpy+0x18> return os; } fea: 5b pop %ebx feb: 5e pop %esi fec: 5d pop %ebp fed: c3 ret fee: 66 90 xchg %ax,%ax 00000ff0 <strcmp>: int strcmp(const char *p, const char *q) { ff0: 55 push %ebp ff1: 89 e5 mov %esp,%ebp ff3: 56 push %esi ff4: 53 push %ebx ff5: 8b 55 08 mov 0x8(%ebp),%edx ff8: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) ffb: 0f b6 02 movzbl (%edx),%eax ffe: 0f b6 19 movzbl (%ecx),%ebx 1001: 84 c0 test %al,%al 1003: 75 1e jne 1023 <strcmp+0x33> 1005: eb 29 jmp 1030 <strcmp+0x40> 1007: 89 f6 mov %esi,%esi 1009: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 1010: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 1013: 0f b6 02 movzbl (%edx),%eax p++, q++; 1016: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 1019: 0f b6 59 01 movzbl 0x1(%ecx),%ebx 101d: 84 c0 test %al,%al 101f: 74 0f je 1030 <strcmp+0x40> 1021: 89 f1 mov %esi,%ecx 1023: 38 d8 cmp %bl,%al 1025: 74 e9 je 1010 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; 1027: 29 d8 sub %ebx,%eax } 1029: 5b pop %ebx 102a: 5e pop %esi 102b: 5d pop %ebp 102c: c3 ret 102d: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 1030: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; 1032: 29 d8 sub %ebx,%eax } 1034: 5b pop %ebx 1035: 5e pop %esi 1036: 5d pop %ebp 1037: c3 ret 1038: 90 nop 1039: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00001040 <strncmp>: int strncmp(const char *p, const char *q, int n) { 1040: 55 push %ebp 1041: 89 e5 mov %esp,%ebp 1043: 57 push %edi 1044: 56 push %esi 1045: 53 push %ebx 1046: 8b 5d 10 mov 0x10(%ebp),%ebx 1049: 8b 75 08 mov 0x8(%ebp),%esi 104c: 8b 7d 0c mov 0xc(%ebp),%edi int i = 0; while(i < n && *p == *q) 104f: 85 db test %ebx,%ebx 1051: 7e 28 jle 107b <strncmp+0x3b> 1053: 0f b6 16 movzbl (%esi),%edx 1056: 0f b6 0f movzbl (%edi),%ecx 1059: 38 d1 cmp %dl,%cl 105b: 75 2b jne 1088 <strncmp+0x48> 105d: 31 c0 xor %eax,%eax 105f: eb 13 jmp 1074 <strncmp+0x34> 1061: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1068: 0f b6 14 06 movzbl (%esi,%eax,1),%edx 106c: 0f b6 0c 07 movzbl (%edi,%eax,1),%ecx 1070: 38 ca cmp %cl,%dl 1072: 75 14 jne 1088 <strncmp+0x48> p++, q++, i++; 1074: 83 c0 01 add $0x1,%eax return (uchar)*p - (uchar)*q; } int strncmp(const char *p, const char *q, int n) { int i = 0; while(i < n && *p == *q) 1077: 39 c3 cmp %eax,%ebx 1079: 75 ed jne 1068 <strncmp+0x28> p++, q++, i++; if (i < n) return (uchar)*p - (uchar)*q; else return 0; } 107b: 5b pop %ebx while(i < n && *p == *q) p++, q++, i++; if (i < n) return (uchar)*p - (uchar)*q; else return 0; 107c: 31 c0 xor %eax,%eax } 107e: 5e pop %esi 107f: 5f pop %edi 1080: 5d pop %ebp 1081: c3 ret 1082: 8d b6 00 00 00 00 lea 0x0(%esi),%esi int strncmp(const char *p, const char *q, int n) { int i = 0; while(i < n && *p == *q) p++, q++, i++; if (i < n) return (uchar)*p - (uchar)*q; 1088: 0f b6 c2 movzbl %dl,%eax else return 0; } 108b: 5b pop %ebx int strncmp(const char *p, const char *q, int n) { int i = 0; while(i < n && *p == *q) p++, q++, i++; if (i < n) return (uchar)*p - (uchar)*q; 108c: 29 c8 sub %ecx,%eax else return 0; } 108e: 5e pop %esi 108f: 5f pop %edi 1090: 5d pop %ebp 1091: c3 ret 1092: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1099: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000010a0 <strlen>: uint strlen(char *s) { 10a0: 55 push %ebp 10a1: 89 e5 mov %esp,%ebp 10a3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 10a6: 80 39 00 cmpb $0x0,(%ecx) 10a9: 74 12 je 10bd <strlen+0x1d> 10ab: 31 d2 xor %edx,%edx 10ad: 8d 76 00 lea 0x0(%esi),%esi 10b0: 83 c2 01 add $0x1,%edx 10b3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 10b7: 89 d0 mov %edx,%eax 10b9: 75 f5 jne 10b0 <strlen+0x10> ; return n; } 10bb: 5d pop %ebp 10bc: c3 ret uint strlen(char *s) { int n; for(n = 0; s[n]; n++) 10bd: 31 c0 xor %eax,%eax ; return n; } 10bf: 5d pop %ebp 10c0: c3 ret 10c1: eb 0d jmp 10d0 <memset> 10c3: 90 nop 10c4: 90 nop 10c5: 90 nop 10c6: 90 nop 10c7: 90 nop 10c8: 90 nop 10c9: 90 nop 10ca: 90 nop 10cb: 90 nop 10cc: 90 nop 10cd: 90 nop 10ce: 90 nop 10cf: 90 nop 000010d0 <memset>: void* memset(void *dst, int c, uint n) { 10d0: 55 push %ebp 10d1: 89 e5 mov %esp,%ebp 10d3: 57 push %edi 10d4: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 10d7: 8b 4d 10 mov 0x10(%ebp),%ecx 10da: 8b 45 0c mov 0xc(%ebp),%eax 10dd: 89 d7 mov %edx,%edi 10df: fc cld 10e0: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 10e2: 89 d0 mov %edx,%eax 10e4: 5f pop %edi 10e5: 5d pop %ebp 10e6: c3 ret 10e7: 89 f6 mov %esi,%esi 10e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000010f0 <strchr>: char* strchr(const char *s, char c) { 10f0: 55 push %ebp 10f1: 89 e5 mov %esp,%ebp 10f3: 53 push %ebx 10f4: 8b 45 08 mov 0x8(%ebp),%eax 10f7: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 10fa: 0f b6 10 movzbl (%eax),%edx 10fd: 84 d2 test %dl,%dl 10ff: 74 1d je 111e <strchr+0x2e> if(*s == c) 1101: 38 d3 cmp %dl,%bl 1103: 89 d9 mov %ebx,%ecx 1105: 75 0d jne 1114 <strchr+0x24> 1107: eb 17 jmp 1120 <strchr+0x30> 1109: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1110: 38 ca cmp %cl,%dl 1112: 74 0c je 1120 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 1114: 83 c0 01 add $0x1,%eax 1117: 0f b6 10 movzbl (%eax),%edx 111a: 84 d2 test %dl,%dl 111c: 75 f2 jne 1110 <strchr+0x20> if(*s == c) return (char*)s; return 0; 111e: 31 c0 xor %eax,%eax } 1120: 5b pop %ebx 1121: 5d pop %ebp 1122: c3 ret 1123: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001130 <gets>: char* gets(char *buf, int max) { 1130: 55 push %ebp 1131: 89 e5 mov %esp,%ebp 1133: 57 push %edi 1134: 56 push %esi 1135: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 1136: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 1138: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 113b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 113e: eb 29 jmp 1169 <gets+0x39> cc = read(0, &c, 1); 1140: 83 ec 04 sub $0x4,%esp 1143: 6a 01 push $0x1 1145: 57 push %edi 1146: 6a 00 push $0x0 1148: e8 43 01 00 00 call 1290 <read> if(cc < 1) 114d: 83 c4 10 add $0x10,%esp 1150: 85 c0 test %eax,%eax 1152: 7e 1d jle 1171 <gets+0x41> break; buf[i++] = c; 1154: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 1158: 8b 55 08 mov 0x8(%ebp),%edx 115b: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 115d: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 115f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 1163: 74 1b je 1180 <gets+0x50> 1165: 3c 0d cmp $0xd,%al 1167: 74 17 je 1180 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1169: 8d 5e 01 lea 0x1(%esi),%ebx 116c: 3b 5d 0c cmp 0xc(%ebp),%ebx 116f: 7c cf jl 1140 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1171: 8b 45 08 mov 0x8(%ebp),%eax 1174: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 1178: 8d 65 f4 lea -0xc(%ebp),%esp 117b: 5b pop %ebx 117c: 5e pop %esi 117d: 5f pop %edi 117e: 5d pop %ebp 117f: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1180: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1183: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1185: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 1189: 8d 65 f4 lea -0xc(%ebp),%esp 118c: 5b pop %ebx 118d: 5e pop %esi 118e: 5f pop %edi 118f: 5d pop %ebp 1190: c3 ret 1191: eb 0d jmp 11a0 <stat> 1193: 90 nop 1194: 90 nop 1195: 90 nop 1196: 90 nop 1197: 90 nop 1198: 90 nop 1199: 90 nop 119a: 90 nop 119b: 90 nop 119c: 90 nop 119d: 90 nop 119e: 90 nop 119f: 90 nop 000011a0 <stat>: int stat(char *n, struct stat *st) { 11a0: 55 push %ebp 11a1: 89 e5 mov %esp,%ebp 11a3: 56 push %esi 11a4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 11a5: 83 ec 08 sub $0x8,%esp 11a8: 6a 00 push $0x0 11aa: ff 75 08 pushl 0x8(%ebp) 11ad: e8 06 01 00 00 call 12b8 <open> if(fd < 0) 11b2: 83 c4 10 add $0x10,%esp 11b5: 85 c0 test %eax,%eax 11b7: 78 27 js 11e0 <stat+0x40> return -1; r = fstat(fd, st); 11b9: 83 ec 08 sub $0x8,%esp 11bc: ff 75 0c pushl 0xc(%ebp) 11bf: 89 c3 mov %eax,%ebx 11c1: 50 push %eax 11c2: e8 09 01 00 00 call 12d0 <fstat> 11c7: 89 c6 mov %eax,%esi close(fd); 11c9: 89 1c 24 mov %ebx,(%esp) 11cc: e8 cf 00 00 00 call 12a0 <close> return r; 11d1: 83 c4 10 add $0x10,%esp 11d4: 89 f0 mov %esi,%eax } 11d6: 8d 65 f8 lea -0x8(%ebp),%esp 11d9: 5b pop %ebx 11da: 5e pop %esi 11db: 5d pop %ebp 11dc: c3 ret 11dd: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 11e0: b8 ff ff ff ff mov $0xffffffff,%eax 11e5: eb ef jmp 11d6 <stat+0x36> 11e7: 89 f6 mov %esi,%esi 11e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000011f0 <atoi>: return r; } int atoi(const char *s) { 11f0: 55 push %ebp 11f1: 89 e5 mov %esp,%ebp 11f3: 53 push %ebx 11f4: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 11f7: 0f be 11 movsbl (%ecx),%edx 11fa: 8d 42 d0 lea -0x30(%edx),%eax 11fd: 3c 09 cmp $0x9,%al 11ff: b8 00 00 00 00 mov $0x0,%eax 1204: 77 1f ja 1225 <atoi+0x35> 1206: 8d 76 00 lea 0x0(%esi),%esi 1209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 1210: 8d 04 80 lea (%eax,%eax,4),%eax 1213: 83 c1 01 add $0x1,%ecx 1216: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 121a: 0f be 11 movsbl (%ecx),%edx 121d: 8d 5a d0 lea -0x30(%edx),%ebx 1220: 80 fb 09 cmp $0x9,%bl 1223: 76 eb jbe 1210 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 1225: 5b pop %ebx 1226: 5d pop %ebp 1227: c3 ret 1228: 90 nop 1229: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00001230 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 1230: 55 push %ebp 1231: 89 e5 mov %esp,%ebp 1233: 56 push %esi 1234: 53 push %ebx 1235: 8b 5d 10 mov 0x10(%ebp),%ebx 1238: 8b 45 08 mov 0x8(%ebp),%eax 123b: 8b 75 0c mov 0xc(%ebp),%esi char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 123e: 85 db test %ebx,%ebx 1240: 7e 14 jle 1256 <memmove+0x26> 1242: 31 d2 xor %edx,%edx 1244: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 1248: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 124c: 88 0c 10 mov %cl,(%eax,%edx,1) 124f: 83 c2 01 add $0x1,%edx { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 1252: 39 da cmp %ebx,%edx 1254: 75 f2 jne 1248 <memmove+0x18> *dst++ = *src++; return vdst; } 1256: 5b pop %ebx 1257: 5e pop %esi 1258: 5d pop %ebp 1259: c3 ret 125a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00001260 <max>: int max(int a, int b) { 1260: 55 push %ebp 1261: 89 e5 mov %esp,%ebp 1263: 8b 55 08 mov 0x8(%ebp),%edx 1266: 8b 45 0c mov 0xc(%ebp),%eax if (b > a) return b; else return a; } 1269: 5d pop %ebp 126a: 39 d0 cmp %edx,%eax 126c: 0f 4c c2 cmovl %edx,%eax 126f: c3 ret 00001270 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 1270: b8 01 00 00 00 mov $0x1,%eax 1275: cd 40 int $0x40 1277: c3 ret 00001278 <exit>: SYSCALL(exit) 1278: b8 02 00 00 00 mov $0x2,%eax 127d: cd 40 int $0x40 127f: c3 ret 00001280 <wait>: SYSCALL(wait) 1280: b8 03 00 00 00 mov $0x3,%eax 1285: cd 40 int $0x40 1287: c3 ret 00001288 <pipe>: SYSCALL(pipe) 1288: b8 04 00 00 00 mov $0x4,%eax 128d: cd 40 int $0x40 128f: c3 ret 00001290 <read>: SYSCALL(read) 1290: b8 05 00 00 00 mov $0x5,%eax 1295: cd 40 int $0x40 1297: c3 ret 00001298 <write>: SYSCALL(write) 1298: b8 10 00 00 00 mov $0x10,%eax 129d: cd 40 int $0x40 129f: c3 ret 000012a0 <close>: SYSCALL(close) 12a0: b8 15 00 00 00 mov $0x15,%eax 12a5: cd 40 int $0x40 12a7: c3 ret 000012a8 <kill>: SYSCALL(kill) 12a8: b8 06 00 00 00 mov $0x6,%eax 12ad: cd 40 int $0x40 12af: c3 ret 000012b0 <exec>: SYSCALL(exec) 12b0: b8 07 00 00 00 mov $0x7,%eax 12b5: cd 40 int $0x40 12b7: c3 ret 000012b8 <open>: SYSCALL(open) 12b8: b8 0f 00 00 00 mov $0xf,%eax 12bd: cd 40 int $0x40 12bf: c3 ret 000012c0 <mknod>: SYSCALL(mknod) 12c0: b8 11 00 00 00 mov $0x11,%eax 12c5: cd 40 int $0x40 12c7: c3 ret 000012c8 <unlink>: SYSCALL(unlink) 12c8: b8 12 00 00 00 mov $0x12,%eax 12cd: cd 40 int $0x40 12cf: c3 ret 000012d0 <fstat>: SYSCALL(fstat) 12d0: b8 08 00 00 00 mov $0x8,%eax 12d5: cd 40 int $0x40 12d7: c3 ret 000012d8 <link>: SYSCALL(link) 12d8: b8 13 00 00 00 mov $0x13,%eax 12dd: cd 40 int $0x40 12df: c3 ret 000012e0 <mkdir>: SYSCALL(mkdir) 12e0: b8 14 00 00 00 mov $0x14,%eax 12e5: cd 40 int $0x40 12e7: c3 ret 000012e8 <chdir>: SYSCALL(chdir) 12e8: b8 09 00 00 00 mov $0x9,%eax 12ed: cd 40 int $0x40 12ef: c3 ret 000012f0 <dup>: SYSCALL(dup) 12f0: b8 0a 00 00 00 mov $0xa,%eax 12f5: cd 40 int $0x40 12f7: c3 ret 000012f8 <getpid>: SYSCALL(getpid) 12f8: b8 0b 00 00 00 mov $0xb,%eax 12fd: cd 40 int $0x40 12ff: c3 ret 00001300 <sbrk>: SYSCALL(sbrk) 1300: b8 0c 00 00 00 mov $0xc,%eax 1305: cd 40 int $0x40 1307: c3 ret 00001308 <sleep>: SYSCALL(sleep) 1308: b8 0d 00 00 00 mov $0xd,%eax 130d: cd 40 int $0x40 130f: c3 ret 00001310 <uptime>: SYSCALL(uptime) 1310: b8 0e 00 00 00 mov $0xe,%eax 1315: cd 40 int $0x40 1317: c3 ret 00001318 <setVariable>: SYSCALL(setVariable) 1318: b8 17 00 00 00 mov $0x17,%eax 131d: cd 40 int $0x40 131f: c3 ret 00001320 <getVariable>: SYSCALL(getVariable) 1320: b8 18 00 00 00 mov $0x18,%eax 1325: cd 40 int $0x40 1327: c3 ret 00001328 <remVariable>: SYSCALL(remVariable) 1328: b8 19 00 00 00 mov $0x19,%eax 132d: cd 40 int $0x40 132f: c3 ret 00001330 <wait2>: SYSCALL(wait2) 1330: b8 1a 00 00 00 mov $0x1a,%eax 1335: cd 40 int $0x40 1337: c3 ret 1338: 66 90 xchg %ax,%ax 133a: 66 90 xchg %ax,%ax 133c: 66 90 xchg %ax,%ax 133e: 66 90 xchg %ax,%ax 00001340 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 1340: 55 push %ebp 1341: 89 e5 mov %esp,%ebp 1343: 57 push %edi 1344: 56 push %esi 1345: 53 push %ebx 1346: 89 c6 mov %eax,%esi 1348: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 134b: 8b 5d 08 mov 0x8(%ebp),%ebx 134e: 85 db test %ebx,%ebx 1350: 74 7e je 13d0 <printint+0x90> 1352: 89 d0 mov %edx,%eax 1354: c1 e8 1f shr $0x1f,%eax 1357: 84 c0 test %al,%al 1359: 74 75 je 13d0 <printint+0x90> neg = 1; x = -xx; 135b: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 135d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 1364: f7 d8 neg %eax 1366: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 1369: 31 ff xor %edi,%edi 136b: 8d 5d d7 lea -0x29(%ebp),%ebx 136e: 89 ce mov %ecx,%esi 1370: eb 08 jmp 137a <printint+0x3a> 1372: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 1378: 89 cf mov %ecx,%edi 137a: 31 d2 xor %edx,%edx 137c: 8d 4f 01 lea 0x1(%edi),%ecx 137f: f7 f6 div %esi 1381: 0f b6 92 1c 18 00 00 movzbl 0x181c(%edx),%edx }while((x /= base) != 0); 1388: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 138a: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 138d: 75 e9 jne 1378 <printint+0x38> if(neg) 138f: 8b 45 c4 mov -0x3c(%ebp),%eax 1392: 8b 75 c0 mov -0x40(%ebp),%esi 1395: 85 c0 test %eax,%eax 1397: 74 08 je 13a1 <printint+0x61> buf[i++] = '-'; 1399: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 139e: 8d 4f 02 lea 0x2(%edi),%ecx 13a1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 13a5: 8d 76 00 lea 0x0(%esi),%esi 13a8: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 13ab: 83 ec 04 sub $0x4,%esp 13ae: 83 ef 01 sub $0x1,%edi 13b1: 6a 01 push $0x1 13b3: 53 push %ebx 13b4: 56 push %esi 13b5: 88 45 d7 mov %al,-0x29(%ebp) 13b8: e8 db fe ff ff call 1298 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 13bd: 83 c4 10 add $0x10,%esp 13c0: 39 df cmp %ebx,%edi 13c2: 75 e4 jne 13a8 <printint+0x68> putc(fd, buf[i]); } 13c4: 8d 65 f4 lea -0xc(%ebp),%esp 13c7: 5b pop %ebx 13c8: 5e pop %esi 13c9: 5f pop %edi 13ca: 5d pop %ebp 13cb: c3 ret 13cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 13d0: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 13d2: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 13d9: eb 8b jmp 1366 <printint+0x26> 13db: 90 nop 13dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 000013e0 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 13e0: 55 push %ebp 13e1: 89 e5 mov %esp,%ebp 13e3: 57 push %edi 13e4: 56 push %esi 13e5: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 13e6: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 13e9: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 13ec: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 13ef: 8b 7d 08 mov 0x8(%ebp),%edi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 13f2: 89 45 d0 mov %eax,-0x30(%ebp) 13f5: 0f b6 1e movzbl (%esi),%ebx 13f8: 83 c6 01 add $0x1,%esi 13fb: 84 db test %bl,%bl 13fd: 0f 84 b0 00 00 00 je 14b3 <printf+0xd3> 1403: 31 d2 xor %edx,%edx 1405: eb 39 jmp 1440 <printf+0x60> 1407: 89 f6 mov %esi,%esi 1409: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 1410: 83 f8 25 cmp $0x25,%eax 1413: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 1416: ba 25 00 00 00 mov $0x25,%edx state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 141b: 74 18 je 1435 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 141d: 8d 45 e2 lea -0x1e(%ebp),%eax 1420: 83 ec 04 sub $0x4,%esp 1423: 88 5d e2 mov %bl,-0x1e(%ebp) 1426: 6a 01 push $0x1 1428: 50 push %eax 1429: 57 push %edi 142a: e8 69 fe ff ff call 1298 <write> 142f: 8b 55 d4 mov -0x2c(%ebp),%edx 1432: 83 c4 10 add $0x10,%esp 1435: 83 c6 01 add $0x1,%esi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 1438: 0f b6 5e ff movzbl -0x1(%esi),%ebx 143c: 84 db test %bl,%bl 143e: 74 73 je 14b3 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 1440: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 1442: 0f be cb movsbl %bl,%ecx 1445: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 1448: 74 c6 je 1410 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 144a: 83 fa 25 cmp $0x25,%edx 144d: 75 e6 jne 1435 <printf+0x55> if(c == 'd'){ 144f: 83 f8 64 cmp $0x64,%eax 1452: 0f 84 f8 00 00 00 je 1550 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 1458: 81 e1 f7 00 00 00 and $0xf7,%ecx 145e: 83 f9 70 cmp $0x70,%ecx 1461: 74 5d je 14c0 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 1463: 83 f8 73 cmp $0x73,%eax 1466: 0f 84 84 00 00 00 je 14f0 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 146c: 83 f8 63 cmp $0x63,%eax 146f: 0f 84 ea 00 00 00 je 155f <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 1475: 83 f8 25 cmp $0x25,%eax 1478: 0f 84 c2 00 00 00 je 1540 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 147e: 8d 45 e7 lea -0x19(%ebp),%eax 1481: 83 ec 04 sub $0x4,%esp 1484: c6 45 e7 25 movb $0x25,-0x19(%ebp) 1488: 6a 01 push $0x1 148a: 50 push %eax 148b: 57 push %edi 148c: e8 07 fe ff ff call 1298 <write> 1491: 83 c4 0c add $0xc,%esp 1494: 8d 45 e6 lea -0x1a(%ebp),%eax 1497: 88 5d e6 mov %bl,-0x1a(%ebp) 149a: 6a 01 push $0x1 149c: 50 push %eax 149d: 57 push %edi 149e: 83 c6 01 add $0x1,%esi 14a1: e8 f2 fd ff ff call 1298 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 14a6: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 14aa: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 14ad: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 14af: 84 db test %bl,%bl 14b1: 75 8d jne 1440 <printf+0x60> putc(fd, c); } state = 0; } } } 14b3: 8d 65 f4 lea -0xc(%ebp),%esp 14b6: 5b pop %ebx 14b7: 5e pop %esi 14b8: 5f pop %edi 14b9: 5d pop %ebp 14ba: c3 ret 14bb: 90 nop 14bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); 14c0: 83 ec 0c sub $0xc,%esp 14c3: b9 10 00 00 00 mov $0x10,%ecx 14c8: 6a 00 push $0x0 14ca: 8b 5d d0 mov -0x30(%ebp),%ebx 14cd: 89 f8 mov %edi,%eax 14cf: 8b 13 mov (%ebx),%edx 14d1: e8 6a fe ff ff call 1340 <printint> ap++; 14d6: 89 d8 mov %ebx,%eax 14d8: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 14db: 31 d2 xor %edx,%edx if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); ap++; 14dd: 83 c0 04 add $0x4,%eax 14e0: 89 45 d0 mov %eax,-0x30(%ebp) 14e3: e9 4d ff ff ff jmp 1435 <printf+0x55> 14e8: 90 nop 14e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 14f0: 8b 45 d0 mov -0x30(%ebp),%eax 14f3: 8b 18 mov (%eax),%ebx ap++; 14f5: 83 c0 04 add $0x4,%eax 14f8: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; 14fb: b8 14 18 00 00 mov $0x1814,%eax 1500: 85 db test %ebx,%ebx 1502: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ 1505: 0f b6 03 movzbl (%ebx),%eax 1508: 84 c0 test %al,%al 150a: 74 23 je 152f <printf+0x14f> 150c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 1510: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 1513: 8d 45 e3 lea -0x1d(%ebp),%eax 1516: 83 ec 04 sub $0x4,%esp 1519: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 151b: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 151e: 50 push %eax 151f: 57 push %edi 1520: e8 73 fd ff ff call 1298 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 1525: 0f b6 03 movzbl (%ebx),%eax 1528: 83 c4 10 add $0x10,%esp 152b: 84 c0 test %al,%al 152d: 75 e1 jne 1510 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 152f: 31 d2 xor %edx,%edx 1531: e9 ff fe ff ff jmp 1435 <printf+0x55> 1536: 8d 76 00 lea 0x0(%esi),%esi 1539: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 1540: 83 ec 04 sub $0x4,%esp 1543: 88 5d e5 mov %bl,-0x1b(%ebp) 1546: 8d 45 e5 lea -0x1b(%ebp),%eax 1549: 6a 01 push $0x1 154b: e9 4c ff ff ff jmp 149c <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 1550: 83 ec 0c sub $0xc,%esp 1553: b9 0a 00 00 00 mov $0xa,%ecx 1558: 6a 01 push $0x1 155a: e9 6b ff ff ff jmp 14ca <printf+0xea> 155f: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 1562: 83 ec 04 sub $0x4,%esp 1565: 8b 03 mov (%ebx),%eax 1567: 6a 01 push $0x1 1569: 88 45 e4 mov %al,-0x1c(%ebp) 156c: 8d 45 e4 lea -0x1c(%ebp),%eax 156f: 50 push %eax 1570: 57 push %edi 1571: e8 22 fd ff ff call 1298 <write> 1576: e9 5b ff ff ff jmp 14d6 <printf+0xf6> 157b: 66 90 xchg %ax,%ax 157d: 66 90 xchg %ax,%ax 157f: 90 nop 00001580 <free>: static Header base; static Header *freep; void free(void *ap) { 1580: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 1581: a1 a4 1f 00 00 mov 0x1fa4,%eax static Header base; static Header *freep; void free(void *ap) { 1586: 89 e5 mov %esp,%ebp 1588: 57 push %edi 1589: 56 push %esi 158a: 53 push %ebx 158b: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 158e: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 1590: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 1593: 39 c8 cmp %ecx,%eax 1595: 73 19 jae 15b0 <free+0x30> 1597: 89 f6 mov %esi,%esi 1599: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 15a0: 39 d1 cmp %edx,%ecx 15a2: 72 1c jb 15c0 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 15a4: 39 d0 cmp %edx,%eax 15a6: 73 18 jae 15c0 <free+0x40> static Header base; static Header *freep; void free(void *ap) { 15a8: 89 d0 mov %edx,%eax Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 15aa: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 15ac: 8b 10 mov (%eax),%edx free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 15ae: 72 f0 jb 15a0 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 15b0: 39 d0 cmp %edx,%eax 15b2: 72 f4 jb 15a8 <free+0x28> 15b4: 39 d1 cmp %edx,%ecx 15b6: 73 f0 jae 15a8 <free+0x28> 15b8: 90 nop 15b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ 15c0: 8b 73 fc mov -0x4(%ebx),%esi 15c3: 8d 3c f1 lea (%ecx,%esi,8),%edi 15c6: 39 d7 cmp %edx,%edi 15c8: 74 19 je 15e3 <free+0x63> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 15ca: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 15cd: 8b 50 04 mov 0x4(%eax),%edx 15d0: 8d 34 d0 lea (%eax,%edx,8),%esi 15d3: 39 f1 cmp %esi,%ecx 15d5: 74 23 je 15fa <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 15d7: 89 08 mov %ecx,(%eax) freep = p; 15d9: a3 a4 1f 00 00 mov %eax,0x1fa4 } 15de: 5b pop %ebx 15df: 5e pop %esi 15e0: 5f pop %edi 15e1: 5d pop %ebp 15e2: c3 ret bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 15e3: 03 72 04 add 0x4(%edx),%esi 15e6: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 15e9: 8b 10 mov (%eax),%edx 15eb: 8b 12 mov (%edx),%edx 15ed: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 15f0: 8b 50 04 mov 0x4(%eax),%edx 15f3: 8d 34 d0 lea (%eax,%edx,8),%esi 15f6: 39 f1 cmp %esi,%ecx 15f8: 75 dd jne 15d7 <free+0x57> p->s.size += bp->s.size; 15fa: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 15fd: a3 a4 1f 00 00 mov %eax,0x1fa4 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 1602: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 1605: 8b 53 f8 mov -0x8(%ebx),%edx 1608: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 160a: 5b pop %ebx 160b: 5e pop %esi 160c: 5f pop %edi 160d: 5d pop %ebp 160e: c3 ret 160f: 90 nop 00001610 <malloc>: return freep; } void* malloc(uint nbytes) { 1610: 55 push %ebp 1611: 89 e5 mov %esp,%ebp 1613: 57 push %edi 1614: 56 push %esi 1615: 53 push %ebx 1616: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 1619: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 161c: 8b 15 a4 1f 00 00 mov 0x1fa4,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 1622: 8d 78 07 lea 0x7(%eax),%edi 1625: c1 ef 03 shr $0x3,%edi 1628: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 162b: 85 d2 test %edx,%edx 162d: 0f 84 a3 00 00 00 je 16d6 <malloc+0xc6> 1633: 8b 02 mov (%edx),%eax 1635: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 1638: 39 cf cmp %ecx,%edi 163a: 76 74 jbe 16b0 <malloc+0xa0> 163c: 81 ff 00 10 00 00 cmp $0x1000,%edi 1642: be 00 10 00 00 mov $0x1000,%esi 1647: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx 164e: 0f 43 f7 cmovae %edi,%esi 1651: ba 00 80 00 00 mov $0x8000,%edx 1656: 81 ff ff 0f 00 00 cmp $0xfff,%edi 165c: 0f 46 da cmovbe %edx,%ebx 165f: eb 10 jmp 1671 <malloc+0x61> 1661: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 1668: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 166a: 8b 48 04 mov 0x4(%eax),%ecx 166d: 39 cf cmp %ecx,%edi 166f: 76 3f jbe 16b0 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 1671: 39 05 a4 1f 00 00 cmp %eax,0x1fa4 1677: 89 c2 mov %eax,%edx 1679: 75 ed jne 1668 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); 167b: 83 ec 0c sub $0xc,%esp 167e: 53 push %ebx 167f: e8 7c fc ff ff call 1300 <sbrk> if(p == (char*)-1) 1684: 83 c4 10 add $0x10,%esp 1687: 83 f8 ff cmp $0xffffffff,%eax 168a: 74 1c je 16a8 <malloc+0x98> return 0; hp = (Header*)p; hp->s.size = nu; 168c: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); 168f: 83 ec 0c sub $0xc,%esp 1692: 83 c0 08 add $0x8,%eax 1695: 50 push %eax 1696: e8 e5 fe ff ff call 1580 <free> return freep; 169b: 8b 15 a4 1f 00 00 mov 0x1fa4,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 16a1: 83 c4 10 add $0x10,%esp 16a4: 85 d2 test %edx,%edx 16a6: 75 c0 jne 1668 <malloc+0x58> return 0; 16a8: 31 c0 xor %eax,%eax 16aa: eb 1c jmp 16c8 <malloc+0xb8> 16ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) 16b0: 39 cf cmp %ecx,%edi 16b2: 74 1c je 16d0 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 16b4: 29 f9 sub %edi,%ecx 16b6: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 16b9: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 16bc: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; 16bf: 89 15 a4 1f 00 00 mov %edx,0x1fa4 return (void*)(p + 1); 16c5: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 16c8: 8d 65 f4 lea -0xc(%ebp),%esp 16cb: 5b pop %ebx 16cc: 5e pop %esi 16cd: 5f pop %edi 16ce: 5d pop %ebp 16cf: c3 ret base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) prevp->s.ptr = p->s.ptr; 16d0: 8b 08 mov (%eax),%ecx 16d2: 89 0a mov %ecx,(%edx) 16d4: eb e9 jmp 16bf <malloc+0xaf> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 16d6: c7 05 a4 1f 00 00 a8 movl $0x1fa8,0x1fa4 16dd: 1f 00 00 16e0: c7 05 a8 1f 00 00 a8 movl $0x1fa8,0x1fa8 16e7: 1f 00 00 base.s.size = 0; 16ea: b8 a8 1f 00 00 mov $0x1fa8,%eax 16ef: c7 05 ac 1f 00 00 00 movl $0x0,0x1fac 16f6: 00 00 00 16f9: e9 3e ff ff ff jmp 163c <malloc+0x2c>
libsrc/gfx/narrow/getsprite.asm
ahjelm/z88dk
640
84900
<reponame>ahjelm/z88dk ; ; Getsprite - Picks up a sprite from display with the given size ; by <NAME> - Jan 2001 ; Apr 2002 - Fixed. (Long time, I know...) ; ; The original putsprite code is by <NAME> (TI 85) ; ; Generic version (just a bit slow) ; ; ; $Id: getsprite.asm $ ; IF !__CPU_INTEL__ & !__CPU_GBZ80__ SECTION smc_clib PUBLIC getsprite PUBLIC _getsprite PUBLIC getsprite_sub EXTERN pixeladdress EXTERN swapgfxbk EXTERN __graphics_end INCLUDE "graphics/grafix.inc" ; __gfx_coords: d,e (vert-horz) ; sprite: (ix) .getsprite ._getsprite push ix ld hl,4 add hl,sp ld e,(hl) inc hl ld d,(hl) ; sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y __gfx_coords .getsprite_sub ld h,d ld l,e ld (actcoord),hl ; save current coordinates IF NEED_swapgfxbk = 1 call swapgfxbk ENDIF call pixeladdress xor 7 ld (_smc+1),a ld h,d ld l,e ld e,(ix+0) ld b,(ix+1) dec e srl e srl e srl e inc e ; INT ((width-1)/8+1) ._oloop push bc ;Save # of rows push de ;Save # of bytes per row ._iloop2 ld a,(hl) inc hl ld d,(hl) ._smc ld b,1 ;Load pixel position inc b dec b jr z,zpos ._iloop rl d rl a djnz _iloop .zpos ld (ix+2),a inc ix dec e jr nz,_iloop2 ; --------- push de ld hl,(actcoord) inc l ld (actcoord),hl call pixeladdress ld h,d ld l,e pop de ; --------- pop de pop bc ;Restore data djnz _oloop IF NEED_swapgfxbk jp __graphics_end ELSE IF !__CPU_INTEL__ & !__CPU_GBZ80__ pop ix ENDIF ret ENDIF SECTION bss_graphics .actcoord defw 0 ENDIF
3-mid/opengl/source/lean/model/opengl-model-any.adb
charlie5/lace
20
14030
<reponame>charlie5/lace with openGL.Primitive.short_indexed, openGL.Primitive. indexed, openGL.Primitive. long_indexed, openGL.Geometry.lit_textured, openGL.Geometry.lit_colored_textured_skinned, openGL.Texture, openGL.Palette, openGL.IO.wavefront, openGL.IO.collada, openGL.IO.lat_long_Radius, ada.Strings.fixed, ada.Containers.hashed_Maps, ada.unchecked_Deallocation; package body openGL.Model.any is type lit_textured_Geometry_view is access all openGL.Geometry.lit_textured .item'Class; type lit_textured_skinned_Geometry_view is access all openGL.Geometry.lit_colored_textured_skinned.item'Class; --------- --- Forge -- function to_Model (Scale : in Vector_3; Model : in asset_Name; Texture : in asset_Name; Texture_is_lucid : in Boolean) return openGL.Model.any.item is begin return Self : openGL.Model.any.item := (openGL.Model.item with Model, Texture, Texture_is_lucid, Geometry => null) do Self.define (Scale); Self.Bounds.Ball := 1.0; end return; end to_Model; function new_Model (Scale : in Vector_3; Model : in asset_Name; Texture : in asset_Name; Texture_is_lucid : in Boolean) return openGL.Model.any.view is begin return new openGL.Model.any.item' (to_Model (Scale, Model, Texture, Texture_is_lucid)); end new_Model; -------------- --- Attributes -- use openGL.IO; function Hash (Self : in io.Vertex) return ada.Containers.Hash_type is begin return ada.Containers.Hash_type (Self.site_Id + 3 * Self.coord_Id + 5 * Self.normal_Id + 7 * Self.weights_Id); end Hash; package io_vertex_Maps_of_gl_vertex_id is new ada.containers.Hashed_Maps (io.Vertex, long_Index_t, Hash, "="); subtype io_vertex_Map_of_gl_vertex_id is io_vertex_Maps_of_gl_vertex_id.Map; type any_Vertex is record Site : Vector_3; Normal : Vector_3; Coords : Coordinate_2D; Bones : bone_Weights (1 .. 4); end record; type any_Vertex_array is array (long_Index_t range <>) of aliased any_Vertex; type any_Vertex_array_view is access all any_Vertex_array; procedure deallocate is new ada.unchecked_Deallocation (any_Vertex_array, any_Vertex_array_view); function to_lit_textured_Vertices (Self : in any_Vertex_array) return Geometry.lit_textured.Vertex_array is Result : Geometry.lit_textured.Vertex_array (Self'Range); begin for i in Self'Range loop Result (i) := (site => Self (i).Site, normal => Self (i).Normal, coords => Self (i).Coords); end loop; return Result; end to_lit_textured_Vertices; function to_lit_textured_skinned_Vertices (Self : in any_Vertex_array) return Geometry.lit_colored_textured_skinned.Vertex_array is use Palette; Result : Geometry.lit_colored_textured_skinned.Vertex_array (Self'Range); begin for i in Self'Range loop Result (i) := (site => Self (i).Site, normal => Self (i).Normal, coords => Self (i).Coords, color => (White, Opaque), bone_Ids => (1 => Real (Self (i).Bones (1).Bone), 2 => Real (Self (i).Bones (2).Bone), 3 => Real (Self (i).Bones (3).Bone), 4 => Real (Self (i).Bones (4).Bone)), bone_Weights => (1 => Self (i).Bones (1).Weight, 2 => Self (i).Bones (2).Weight, 3 => Self (i).Bones (3).Weight, 4 => Self (i).Bones (4).Weight)); end loop; return Result; end to_lit_textured_skinned_Vertices; overriding function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class; Fonts : in Font.font_id_Map_of_font) return Geometry.views is pragma unreferenced (Textures, Fonts); begin Self.build_GL_Geometries; return (1 => Self.Geometry); end to_GL_Geometries; procedure build_GL_Geometries (Self : in out Item) is use Geometry; model_Name : constant String := to_String (Self.Model); function load_Model return io.Model is use ada.Strings.fixed; begin if Tail (model_Name, 4) = ".obj" then return wavefront .to_Model (model_Name); elsif Tail (model_Name, 4) = ".dae" then return collada .to_Model (model_Name); elsif Tail (model_Name, 4) = ".tab" then return lat_long_Radius.to_Model (model_Name); else raise unsupported_model_Format with "Model => '" & model_Name & "'"; end if; end load_Model; the_Model : openGL.io.Model := load_Model; the_Map : io_vertex_Map_of_gl_vertex_id; the_Vertices : any_Vertex_array_view := new any_Vertex_array' (1 .. 100_000 => <>); vertex_Count : openGL.long_Index_t := 0; tri_Count : Index_t := 0; Normals_known : Boolean := False; -- TODO: Use one set of gl face vertices and 2 sets of indices (1 for tris and 1 for quads). begin Self.Bounds := null_Bounds; -- 1st pass: - Set our openGL face vertices. -- - Build 'io vertex' to 'openGL face vertex_Id' map. -- for f in the_Model.Faces'Range loop declare use io_vertex_Maps_of_gl_vertex_id; the_model_Face : io.Face renames the_Model.Faces (f); begin if the_model_Face.Kind = Triangle or the_model_Face.Kind = Quad then declare the_io_Vertices : constant io.Vertices := Vertices_of (the_model_Face); Cursor : io_vertex_Maps_of_gl_vertex_id.Cursor; begin case the_model_Face.Kind is when Triangle => tri_Count := tri_Count + 1; when Quad => tri_Count := tri_Count + 2; when Polygon => null; end case; for v in the_io_Vertices'Range loop Cursor := the_Map.find (the_io_Vertices (v)); if not has_Element (Cursor) then -- We do not know about this vertex yet, so add it. vertex_Count := vertex_Count + 1; declare the_io_Vertex : io.Vertex renames the_io_Vertices (v); the_gl_Vertex : any_Vertex renames the_Vertices (vertex_Count); begin the_gl_Vertex.Site := Scaled (the_Model.Sites (the_io_Vertex.site_Id), by => Self.Scale); -- TODO: Shouldn't scale here, since the vertex shaders do scaling. Self.Bounds.Box := Self.Bounds.Box or the_gl_Vertex.Site; Self.Bounds.Ball := Real'Max (Self.Bounds.Ball, abs (the_gl_Vertex.Site)); if the_io_Vertex.coord_Id /= null_Id then the_gl_Vertex.Coords := the_Model.Coords (the_io_Vertex.coord_Id); else the_gl_Vertex.Coords := (0.0, 0.0); end if; if the_io_Vertex.normal_Id /= null_Id then the_gl_Vertex.Normal := the_Model.Normals (the_io_Vertex.normal_Id); normals_Known := True; else the_gl_Vertex.Normal := (0.0, 0.0, 0.0); end if; if the_Model.Weights /= null and the_io_Vertex.weights_Id /= null_Id then declare the_Weights : bone_Weights renames the_Model.Weights (the_io_Vertex.weights_Id).all; begin if the_Weights'Length > 0 then the_gl_Vertex.Bones (1) := the_Weights (1); -- -- nb: Only using the first 4 bones atm. if the_Weights'Length >= 2 then the_gl_Vertex.Bones (2) := the_Weights (2); else the_gl_Vertex.Bones (2) := (0, 0.0); end if; if the_Weights'Length >= 3 then the_gl_Vertex.Bones (3) := the_Weights (3); else the_gl_Vertex.Bones (3) := (0, 0.0); end if; if the_Weights'Length >= 4 then the_gl_Vertex.Bones (4) := the_Weights (4); else the_gl_Vertex.Bones (4) := (0, 0.0); end if; else the_gl_Vertex.Bones := (1 => (0, 0.0), 2 => (0, 0.0), 3 => (0, 0.0), 4 => (0, 0.0)); end if; end; else the_gl_Vertex.Bones := (1 => (0, 0.0), 2 => (0, 0.0), 3 => (0, 0.0), 4 => (0, 0.0)); end if; the_Map.insert (the_io_Vertex, vertex_Count); -- 'vertex_Count' provides the index of the current vertex. end; end if; end loop; end; end if; end; end loop; -- We now have our gl face vertices built and mapped to each model vertex. -- 2nd pass: - Set the triangle faceted indices. -- - Set the quad faceted indices. -- declare tri_indices_Count : long_Index_t := 0; tri_indices_Last : constant long_Index_t := long_Index_t (tri_Count) * 3; tri_Indices : aliased long_Indices (1 .. tri_indices_Last); procedure add_to_Tri (the_Vertex : in io.Vertex) is begin tri_indices_Count := tri_indices_Count + 1; tri_Indices (tri_indices_Count) := the_Map.Element (the_Vertex); end add_to_Tri; begin for f in the_Model.Faces'Range loop declare the_model_Face : io.Face renames the_Model.Faces (f); the_io_Vertices : constant io.Vertices := Vertices_of (the_model_Face); begin case the_model_Face.Kind is when Triangle => for v in the_io_Vertices'Range loop add_to_Tri (the_io_Vertices (v)); end loop; when Quad => add_to_Tri (the_io_Vertices (1)); add_to_Tri (the_io_Vertices (2)); add_to_Tri (the_io_Vertices (3)); add_to_Tri (the_io_Vertices (3)); add_to_Tri (the_io_Vertices (4)); add_to_Tri (the_io_Vertices (1)); when Polygon => null; end case; end; end loop; pragma assert (tri_indices_Count = tri_indices_Last); -- Determine which geometry class is required and create the geometry. -- if the_Model.Weights = null then declare use Geometry.lit_textured; my_Vertices : aliased lit_textured.Vertex_array := to_lit_textured_Vertices (the_Vertices (1 .. vertex_Count)); my_Geometry : constant lit_textured_Geometry_view := lit_textured.new_Geometry; begin if not normals_Known then set_Normals: declare type Normals_view is access all Normals; function get_Sites return Sites is Result : Sites := (1 .. my_Vertices'Length => <>); begin for i in Result'Range loop Result (i) := my_Vertices (long_Index_t (i)).Site; end loop; return Result; end get_Sites; the_Sites : constant openGL.Sites := get_Sites; the_Normals : Normals_view := Geometry.Normals_of (Primitive.Triangles, tri_Indices, the_Sites); procedure deallocate is new ada.unchecked_Deallocation (Normals, Normals_view); begin for i in my_Vertices'Range loop my_Vertices (i).Normal := the_Normals (Index_t (i)); end loop; deallocate (the_Normals); end set_Normals; end if; my_Geometry.Vertices_are (now => my_Vertices); Self.Geometry := Geometry.view (my_Geometry); end; else -- Is skinned. declare use Geometry.lit_colored_textured_skinned; my_Vertices : aliased constant lit_colored_textured_skinned.Vertex_array := to_lit_textured_skinned_Vertices (the_Vertices (1 .. vertex_Count)); my_Geometry : constant lit_textured_skinned_Geometry_view := lit_colored_textured_skinned.new_Geometry; begin my_Geometry.Vertices_are (now => my_Vertices); Self.Geometry := Geometry.view (my_Geometry); end; end if; deallocate (the_Vertices); destroy (the_Model); -- Set the geometry texture. -- if Self.Texture /= null_Asset then if Self.has_lucid_Texture then declare use Texture; the_Image : constant lucid_Image := io.to_lucid_Image (Self.Texture); the_Texture : constant Texture.object := Forge.to_Texture (the_Image); begin Self.Geometry.Texture_is (the_Texture); end; else declare use Texture; the_Image : constant Image := io.to_Image (Self.Texture); the_Texture : constant Texture.object := Forge.to_Texture (the_Image); begin Self.Geometry.Texture_is (the_Texture); end; end if; end if; -- Add any facia to the geometry. -- if tri_Indices'Length > 0 then if vertex_Count <= long_Index_t (short_Index_t'Last) then declare the_Primitive : constant Primitive.short_indexed.view := Primitive.short_indexed.new_Primitive (Primitive.Triangles, tri_Indices); begin Self.Geometry.add (Primitive.view (the_Primitive)); end; elsif vertex_Count <= long_Index_t (Index_t'Last) then declare the_Primitive : constant Primitive.indexed.view := Primitive.indexed.new_Primitive (primitive.Triangles, tri_Indices); begin Self.Geometry.add (Primitive.view (the_Primitive)); end; else if openGL.Profile /= Desk then raise Model_too_complex with "Only the 'Desk' openGL profile allows models with more than 2**16 - 1 vertices."; end if; declare the_Primitive : constant Primitive.long_indexed.view := Primitive.long_indexed.new_Primitive (primitive.Triangles, tri_Indices); begin Self.Geometry.add (Primitive.view (the_Primitive)); end; end if; end if; if Geometry_3d.Extent (Self.Bounds.Box, 3) = 0.0 then Self.Bounds.Box.Lower (3) := Self.Bounds.Box.Lower (3) - 0.2; -- TODO: This is dubious at best. end if; Self.Geometry.is_Transparent (now => False); Self.Geometry.Label_is (to_String (Self.Model) & "-" & to_String (Self.Texture)); end; end build_GL_Geometries; end openGL.Model.any;
data/pokemon/dex_entries/kakuna.asm
Dev727/ancientplatinum
28
1136
<gh_stars>10-100 db "COCOON@" ; species name dw 200, 220 ; height, weight db "Nearly incapable" next "of movement, it" next "leans against" page "stout trees while" next "waiting for its" next "evolution.@"
repositories-cache.ads
annexi-strayline/AURA
13
8968
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- Reference Implementation -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package Repositories.Cache is procedure Cache_Repositories; Caching_Progress: aliased Progress.Progress_Tracker; -- Attempts to cache all repositories that are marked with a Cache_Status -- of Requested. -- -- For Git repositories, any invalid state (wrong commit or branch) causes -- any existing cache to be expunged and restored from -- the original (Location). -- -- For Local repositories, this is not possible, and instead the user is -- queried if they wish to accept the new repository, updating the checkout -- hash -- -- The unit of Caching_Progress is a repository procedure Update_Cache (Index: Repository_Index) is null; Update_Progress: aliased Progress.Progress_Tracker; -- Submit a work order to the worker pool to update the indicated -- repository. This applies only to git repositories with a Tracking_Branch. -- -- First, the Tracking branch is checked-out, and then a fetch is executed -- on origin (the Repo's Location),followed by a pull operation is executed -- -- If a failure occurs, the repository package is not modified, and -- the existing cache is expunged. The status is reverted to Uncached. -- -- The unit of Update_Progress is one Update_Progress request -- ** Not implemented ** procedure Destroy_Cache (Index: Repository_Index) is null; -- Deletes the directory containing the identified repository and sets -- Cache_Status to Uncached -- ** Not implemented ** end Repositories.Cache;
libsrc/_DEVELOPMENT/time/c/sccz80/compare_dostm_callee.asm
jpoikela/z88dk
38
18167
<reponame>jpoikela/z88dk<filename>libsrc/_DEVELOPMENT/time/c/sccz80/compare_dostm_callee.asm ; int compare_dostm(struct dos_tm *a, struct dos_tm *b) SECTION code_time PUBLIC compare_dostm_callee EXTERN asm_compare_dostm compare_dostm_callee: pop hl pop bc ex (sp),hl jp asm_compare_dostm
libkbd.asm
silentenemy/asmbrain
6
98273
<reponame>silentenemy/asmbrain check_for_keystroke: mov ah, 01h int 16h ret flush_kbd_buffer: mov ah, 0 int 16h ret handle_code_input: push ax call check_for_keystroke jz .end mov bl, 0Fh cmp al, 08h ; is this a backspace jz .backspace cmp al, 0Dh ; is this enter jz .enter call add_symbol .flush: call flush_kbd_buffer .end: pop ax ret .backspace: call del_symbol jmp .flush .enter: call newline call parse_code mov bl, 0Bh mov al, '~' call write_char jmp .flush handle_bf_input: .start: call check_for_keystroke jz .start call flush_kbd_buffer cmp al, 0Dh jne .end mov al, 0Ah .end: ret
src/lib/Readable_Sequences/Backup-2022-04-13/readable_sequences-generic_sequences.adb
fintatarta/protypo
0
23638
<filename>src/lib/Readable_Sequences/Backup-2022-04-13/readable_sequences-generic_sequences.adb pragma Ada_2012; package body Readable_Sequences.Generic_Sequences is ------------------ -- Set_Position -- ------------------ procedure Set_Position (Seq : in out Sequence; Pos : Cursor) is begin Seq.Position := Pos; end Set_Position; ---------- -- Next -- ---------- function Next (Seq : in out Sequence) return Element_Type is Result : constant Element_Type := Seq.Read; begin Seq.Next; return Result; end Next; ---------- -- Dump -- ---------- function Dump (Seq : Sequence; From : Cursor := Beginning) return Element_Array is Result : Element_Array (Integer (From) .. Integer (Seq.Vector.Last_Index)); begin for K in Result'Range loop Result (K) := Seq.Vector (Cursor (K)); end loop; return Result; end Dump; ----------- -- Clear -- ----------- procedure Clear (Seq : in out Sequence) is begin Seq.Vector.Clear; Seq.Position := Beginning; Seq.Position_Saved := False; end Clear; ------------ -- Create -- ------------ function Create (End_Of_Sequence_Marker : Element_Type) return Sequence is begin return Sequence'(Vector => Element_Vectors.Empty_Vector, Position => Cursor'First, Old_Position => <>, Position_Saved => False, Has_End_Marker => True, End_Marker => End_Of_Sequence_Marker); end Create; ------------ -- Create -- ------------ function Create (Init : Element_Array; End_Of_Sequence_Marker : Element_Type) return Sequence is Result : Sequence := Sequence'(Vector => Element_Vectors.Empty_Vector, Position => Cursor'First, Old_Position => <>, Position_Saved => False, Has_End_Marker => True, End_Marker => End_Of_Sequence_Marker); begin Result.Append (Init); return Result; end Create; ------------ -- Create -- ------------ function Create (Init : Element_Array) return Sequence is Result : Sequence := Sequence'(Vector => Element_Vectors.Empty_Vector, Position => Cursor'First, Old_Position => <>, Position_Saved => False, Has_End_Marker => False, End_Marker => <>); begin Result.Append (Init); return Result; end Create; ------------ -- Append -- ------------ procedure Append (Seq : in out Sequence; Elements : Element_Array) is begin for C of Elements loop Seq.Append (C); end loop; end Append; ------------ -- Append -- ------------ procedure Append (To : in out Sequence; What : Element_Type) is begin To.Vector.Append (What); end Append; ------------ -- Append -- ------------ procedure Append (To : in out Sequence; What : Sequence) is begin To.Vector.Append (What.Vector); end Append; ------------ -- Rewind -- ------------ procedure Rewind (Seq : in out Sequence; To : Cursor := Beginning) is begin if To > Seq.Vector.Last_Index then raise Constraint_Error; end if; Seq.Position := To; end Rewind; ------------------- -- Save_Position -- ------------------- procedure Save_Position (Seq : in out Sequence) is begin if Seq.Position_Saved then raise Constraint_Error; end if; Seq.Old_Position := Seq.Position; Seq.Position_Saved := True; end Save_Position; ---------------------- -- Restore_Position -- ---------------------- procedure Restore_Position (Seq : in out Sequence) is begin if not Seq.Position_Saved then raise Constraint_Error; end if; Seq.Position := Seq.Old_Position; Seq.Position_Saved := False; end Restore_Position; -------------------- -- Clear_Position -- -------------------- procedure Clear_Position (Seq : in out Sequence) is begin if not Seq.Position_Saved then raise Constraint_Error; end if; Seq.Position_Saved := False; end Clear_Position; ---------- -- Next -- ---------- procedure Next (Seq : in out Sequence; Step : Positive := 1) is begin if Seq.Remaining < Step then Seq.Position := Seq.Vector.Last_Index + 1; return; end if; Seq.Position := Seq.Position + Cursor (Step); end Next; ---------- -- Back -- ---------- procedure Back (Seq : in out Sequence; Step : Positive := 1) is begin if Seq.Position < Seq.Vector.First_Index + Cursor (Step) then Seq.Position := Seq.Vector.First_Index; return; end if; Seq.Position := Seq.Position - Cursor (Step); end Back; ------------- -- Process -- ------------- procedure Process (Seq : Sequence; Callback : access procedure (Item : Element_Type)) is begin for El of Seq.Vector loop Callback (El); end loop; end Process; end Readable_Sequences.Generic_Sequences;
linear_algebra/banded_lu_demo_1.adb
jscparker/math_packages
30
21206
<reponame>jscparker/math_packages -- Tests LU decomposition on a real valued banded matrix. -- -- Shows how interative refinement can clean up the mess when no -- pivoting is used in LU decomposition. Also shows that iterative -- refinement is ineffective if the problem is ill-conditioned. -- (Pivoting doesn't solve the problem of ill-conditioning either.) with Banded_LU; With Text_IO; use Text_IO; procedure banded_lu_demo_1 is type Real is digits 15; -- Create a data structure for making banded matrices. No_Of_Off_Diagonals : constant Integer := 20; -- if 1, it's tri-diagonal Max_Size_Of_Matrix : constant Integer := 150; package lu is new Banded_LU (Real, Max_Size_Of_Matrix, No_Of_Off_Diagonals); use lu; package rio is new Float_IO(Real); use rio; package iio is new Integer_IO(Integer); use iio; type Matrix is array(Index) of Column; -- not type Banded_Matrix Starting_Index : constant Index := Index'First + 10; Max_Index : constant Index := Index'Last - 10; C_band : Banded_Matrix := (others => (others => 0.0)); -- exported by LU C_full : Matrix := (others => (others => 0.0)); C_Inverse : Matrix := (others => (others => 0.0)); No_Of_Iterations : Integer := 0; Off_Factor : Real; Sum, Del, Error_Off_Diag, Error_Diag, Max_Error : Real; ----------- -- Pause -- ----------- procedure Pause (s1,s2,s3,s4,s5,s6,s7,s8,s9 : string := "") is Continue : Character := ' '; begin new_line; if S1 /= "" then put_line (S1); end if; if S2 /= "" then put_line (S2); end if; if S3 /= "" then put_line (S3); end if; if S4 /= "" then put_line (S4); end if; if S5 /= "" then put_line (S5); end if; if S6 /= "" then put_line (S6); end if; if S7 /= "" then put_line (S7); end if; if S8 /= "" then put_line (S8); end if; if S9 /= "" then put_line (S9); end if; new_line(1); begin put ("Type a character to continue: "); get_Immediate (Continue); new_line(1); exception when others => null; end; end pause; ------------ -- Invert -- ------------ -- Get Inverse of the Matrix: procedure Invert (M : in Banded_Matrix; M_Inv : out Matrix; Max_Index : in Index; Starting_Index : in Index; Max_Error : out Real; No_Of_Iterations : in Integer) is Unit_Vector, Solution_Vector, Error, Diag_Inverse : Column; Zero_Vector : constant Column := (others => 0.0); M_LU : Banded_Matrix := M; begin Max_Error := 0.0; LU_decompose (M_LU, Diag_Inverse, Max_Index, Starting_Index); for I in Starting_Index..Max_Index loop Unit_Vector := Zero_Vector; Unit_Vector(I) := 1.0; --Solve(Solution_Vector, Unit_Vector, M_LU, Diag_Inverse, M, -- Max_Index, Starting_Index); Refine_Solution (Solution_Vector, Unit_Vector, M_LU, Diag_Inverse, M, No_Of_Iterations, Max_Index, Starting_Index); Error := Product (M, Solution_Vector, Max_Index, Starting_Index); for J in Starting_Index .. Max_Index loop Error (J) := Error(J) - Unit_Vector(J); end loop; for I in Starting_Index .. Max_Index loop if Abs(Error(I)) > Max_Error then Max_Error := Abs(Error(I)); end if; end loop; -- Solution vector is the I-th column of M_Inverse: for J in Starting_Index .. Max_Index loop M_Inv (J)(I) := Solution_Vector(J); end loop; end loop; end Invert; ------------------------------------- -- Test_Inversion_On_Banded_Matrix -- ------------------------------------- procedure Test_Inversion_On_Banded_Matrix (Off_Factor : in Real; No_Of_Iterations : in Integer) is begin -- construct matrix. C_band := (others => (others => 0.0)); C_full := (others => (others => 0.0)); for I in Index loop C_band(I)(0) := 1.01010101010; C_full(I)(I) := C_band(I)(0); end loop; for Diagonal in Diag_Index'First .. -1 loop for Row in Index'First - Diagonal .. Index'Last loop C_full(Row)(Diagonal + Row) := 0.033 * Real(Row) / Real(Index'Last) + Off_Factor / Abs Real(Diagonal); C_band(Row)(Diagonal) := 0.033 * Real(Row) / Real(Index'Last) + Off_Factor / Abs Real(Diagonal); end loop; end loop; for Diagonal in 1 .. Diag_Index'Last loop for Row in Index'First .. Index'Last - Diagonal loop C_full(Row)(Diagonal + Row) := 0.013 * Real(Row) / Real(Index'Last) + Off_Factor / Abs Real(Diagonal) + 0.3; C_band(Row)(Diagonal) := 0.013 * Real(Row) / Real(Index'Last) + Off_Factor / Abs Real(Diagonal) + 0.3; end loop; end loop; -- Test Matrix_Val procedure: for Row in Index loop for Col in Index loop if Abs (C_full(Row)(Col) - Matrix_Val (C_band, Row, Col)) > 1.0e14 then put_line("Some error in procedure Matrix_Val or ... "); end if; end loop; end loop; -- Construct inverse of C_band: Invert (C_band, C_Inverse, Max_Index, Starting_Index, Max_Error, No_Of_Iterations); pause("We just took the matrix inverse. Error estimate follows."); new_line(2); put ("Max Error according to Residual function is: "); put (Max_Error); new_line; -- Multiply Original C_band and C_Inverse as test. Get Max error: Error_Off_Diag := 0.0; Error_Diag := 0.0; for I in Starting_Index..Max_Index loop for J in Starting_Index..Max_Index loop Sum := 0.0; for K in Starting_Index..Max_Index loop Sum := Sum + C_Inverse(I)(k) * C_full(k)(J); end loop; -- Product(I,J) := Sum; -- The product should be the unit matrix. Calculate the error: if I = J then Del := Abs (Sum - 1.0); if Del > Error_Diag then Error_Diag := Del; end if; else Del := Abs (Sum); if Del > Error_Off_Diag then Error_Off_Diag := Del; end if; end if; end loop; end loop; pause ("We just took the product the inverse matrix with the original,", "matrix and then calculated the difference between this product", "and the unit matrix. The error is printed below."); new_line; put("Max error along diagonals of product: "); put(Error_Diag); new_line; put("Max error along off-diagonals of product: "); put(Error_Off_Diag); new_line; -- Multiply Original C and C_Inverse as test. Get Max error: Error_Off_Diag := 0.0; Error_Diag := 0.0; for I in Starting_Index..Max_Index loop for J in Starting_Index..Max_Index loop Sum := 0.0; for K in Starting_Index..Max_Index loop Sum := Sum + C_full(I)(K) * C_Inverse(K)(J); end loop; -- Product(I,J) := Sum; -- The product should be the unit matrix. Calculate the error: if I = J then Del := Abs (Sum - 1.0); if Del > Error_Diag then Error_Diag := Del; end if; ELSE Del := Abs (Sum); if Del > Error_Off_Diag then Error_Off_Diag := Del; end if; end if; end loop; end loop; pause ("We just took the product the original matrix with the inverse matrix,", "and then calculated the difference between this product and", "the unit matrix. The error is printed below."); new_line; put("Max error along diagonals of product: "); put(Error_Diag); new_line; put("Max error along off-diagonals of product: "); put(Error_Off_Diag); new_line; end Test_Inversion_On_Banded_Matrix; begin --put("Input Size Of Matrix To Invert (enter an Integer)"); new_line; --get(IO_Max_Index); --Max_Index := Index'First + Index (IO_Max_Index-1); pause ("The first example demonstrates LU decomposition and inversion of", "of a diagonally dominant matrix. The off-diagonals of the matrix", "are all multiplied by 0.5 to make them fall off fast enough for", "diagonal dominance (i.e. Off_Factor = 0.5). No iterative refinement", "is done. (i.e. No_Of_Iterations = 0)."); Off_Factor := 0.5; No_Of_Iterations := 0; Test_Inversion_On_Banded_Matrix (Off_Factor, No_Of_Iterations); pause ("The 2nd example demonstrates LU decomposition and inversion of", "a non-diagonally dominant matrix. The off-diagonals of the matrix", "are all multiplied by 10_000_000_000.0 to make them far greater in value", "than the diagonal (i.e. Off_Factor = 1.0e10). No iterative refinement", "is done. (i.e. No_Of_Iterations = 0). A large amount of error should", "be evident."); Off_Factor := 10_000_000_000.0; No_Of_Iterations := 0; Test_Inversion_On_Banded_Matrix (Off_Factor, No_Of_Iterations); pause ("The 3rd example demonstrates LU decomposition and inversion of", "a non-diagonally dominant matrix along with iterative refinement. The", "off-diagonals of the matrix are again multiplied by 1.0e10 to make", "them far greater in value than the diagonal.", "Two iterations of the iterative refinement procedure are performed. ", "(i.e. No_Of_Iterations = 2). Error should be greatly reduced."); Off_Factor := 10_000_000_000.0; No_Of_Iterations := 2; Test_Inversion_On_Banded_Matrix (Off_Factor, No_Of_Iterations); pause ("The 4rth example demonstrates LU decomposition and inversion of", "of a non-diagonally dominant matrix which is mildly ill-conditioned.", "The off-diagonals of the matrix are multiplied by 0.8.", "No iterative refinement is performed. (i.e. No_Of_Iterations = 0).", "Large error should be evident."); Off_Factor := 0.8; No_Of_Iterations := 0; Test_Inversion_On_Banded_Matrix (Off_Factor, No_Of_Iterations); pause ("The final example demonstrates LU decomposition and inversion of", "of a mildly ill-conditioned matrix along with iterative refinement.", "The off-diagonals of the matrix are again multiplied by 0.8.", "Iterative refinement is performed. (i.e. No_Of_Iterations = 1).", "No amount of iterative refinement helps much here."); Off_Factor := 0.8; No_Of_Iterations := 1; Test_Inversion_On_Banded_Matrix (Off_Factor, No_Of_Iterations); new_line(2); put ("Choose your own values for Off_Factor and No_Of_Iterations."); new_line(2); put ("Input factor for scaling the off diagonals (e.g. 1.0e13):"); get(Off_Factor); new_line; put("Input number of iterative refinements of the solution (e.g. 4):"); get(No_Of_Iterations); new_line; Test_Inversion_On_Banded_Matrix (Off_Factor, No_Of_Iterations); end;