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 |
|---|---|---|---|---|
metamath.g4 | BlackHC/dart_metamath_naive | 0 | 1510 | <reponame>BlackHC/dart_metamath_naive
grammar metamath;
library: statement* EOF;
scope: '${' statement* '$}';
statement : const_decls
| var_decls
| disjoint_restriction
| floating_hypothesis
| essential_hypothesis
| axiomatic_assertion
| provable_assertion
| scope;
proof : ({$open_p.text == "("}? open_p=IDENTIFIER labels+=symbol+ close_p=IDENTIFIER {$close_p.text == ")"}? indices+=index+) | labels+=symbol+;
const_decls: '$c' constants+=symbol+ '$.';
var_decls: '$v' vars+=symbol+ '$.';
disjoint_restriction: '$d' vars+=symbol+ '$.';
floating_hypothesis: label=symbol '$f' constant=symbol var=symbol '$.';
essential_hypothesis: label=symbol '$e' constant=symbol def=symbol+ '$.';
axiomatic_assertion: label=symbol '$a' constant=symbol def+=symbol+ '$.';
provable_assertion: label=symbol '$p' constant=symbol def+=symbol+ '$=' proof '$.';
index returns [int result]: val=IDENTIFIER { $result = $val.int; };
symbol: IDENTIFIER;
IDENTIFIER: [\u0021-\u007E]+;
COMMENT: '$(' .+? '$)' -> channel(HIDDEN);
WS : [ \t\r\n]+ -> channel(HIDDEN);
|
programs/oeis/259/A259319.asm | karttu/loda | 0 | 161455 | ; A259319: a(n) = 2*A002309(n).
; 2,164,1414,6216,19338,48620,105742,206992,374034,634676,1023638,1583320,2364570,3427452,4842014,6689056,9060898,12062148,15810470,20437352,26088874,32926476,41127726,50887088,62416690,75947092,91728054,110029304,131141306,155376028,183067710,214573632,250274882,290577124,335911366,386734728,443531210,506812460,577118542,655018704,741112146,836028788,940430038,1055009560,1180494042,1317643964,1467254366,1630155616,1807214178,1999333380,2207454182,2432555944,2675657194,2937816396,3220132718,3523746800,3849841522,4199642772,4574420214,4975488056,5404205818,5861979100,6350260350,6870549632,7424395394,8013395236,8639196678,9303497928,10008048650,10754650732,11545159054,12381482256,13265583506,14199481268,15185250070,16225021272,17320983834,18475385084,19690531486,20968789408,22312585890,23724409412,25206810662,26762403304,28393864746,30103936908,31895426990,33771208240,35734220722,37787472084,39934038326,42177064568,44519765818,46965427740,49517407422,52179134144,54954110146,57845911396,60858188358,63994666760,67259148362,70655511724,74187712974,77859786576,81675846098,85640084980,89756777302,94030278552,98465026394,103065541436,107836427998,112782374880,117908156130,123218631812,128718748774,134413541416,140308132458,146407733708,152717646830,159243264112,165990069234,172963638036,180169639286,187613835448,195302083450,203240335452,211434639614,219891140864,228616081666,237615802788,246896744070,256465445192,266328546442,276492789484,286965018126,297752179088,308861322770,320299604020,332074282902,344192725464,356662404506,369490900348,382685901598,396255205920,410206720802,424548464324,439288565926,454435267176,469996922538,485982000140,502399082542,519256867504,536564168754,554329916756,572563159478,591273063160,610468913082,630160114332,650356192574,671066794816,692301690178,714070770660,736384051910,759251673992,782683902154,806691127596,831283868238,856472769488,882268605010,908682277492,935724819414,963407393816,991741295066,1020737949628,1050408916830,1080765889632,1111820695394,1143585296644,1176071791846,1209292416168,1243259542250,1277985680972,1313483482222,1349765735664,1386845371506,1424735461268,1463449218550,1502999999800,1543401305082,1584666778844,1626810210686,1669845536128,1713786837378,1758648344100,1804444434182,1851189634504,1898898621706,1947586222956,1997267416718,2047957333520,2099671256722,2152424623284,2206233024534,2261112206936,2317078072858,2374146681340,2432334248862,2491657150112,2552131918754,2613775248196,2676603992358,2740635166440,2805885947690,2872373676172,2940115855534,3009130153776,3079434404018,3151046605268,3223984923190,3298267690872,3373913409594,3450940749596,3529368550846,3609215823808,3690501750210,3773245683812,3857467151174,3943185852424,4030421662026,4119194629548,4209524980430,4301433116752,4394939618002,4490065241844,4586830924886,4685257783448,4785367114330,4887180395580,4990719287262,5096005632224,5203061456866,5311908971908,5422570573158,5535068842280,5649426547562,5765666644684,5883812277486,6003886778736,6125913670898,6249916666900
lpb $0,1
mov $2,$0
add $2,$0
sub $0,1
add $2,1
pow $2,4
add $1,$2
lpe
mul $1,2
add $1,2
|
examples/SPARK2005/packages/polypaver-long_floats.adb | michalkonecny/polypaver | 1 | 26951 | with Ada.Numerics,
Ada.Numerics.Generic_Elementary_Functions;
package body PolyPaver.Long_Floats is
package Long_Float_Functions is new Ada.Numerics.Generic_Elementary_Functions (Long_Float);
function Eps_Abs return Long_Float is
begin
return 0.5**126;
end Eps_Abs;
function Eps_Rel return Long_Float is
begin
return 0.5**22;
end Eps_Rel;
function Pi return Long_Float is
begin
return Ada.Numerics.Pi;
end Pi;
function Add (X,Y : Long_Float) return Long_Float is
begin
return X+Y;
end Add;
function Subtract (X,Y : Long_Float) return Long_Float is
begin
return X-Y;
end Subtract;
function Multiply (X,Y : Long_Float) return Long_Float is
begin
return X*Y;
end Multiply;
function Divide (X,Y : Long_Float) return Long_Float is
begin
return X/Y;
end Divide;
function Square (X : Long_Float) return Long_Float is
begin
return X*X;
end Square;
function Sqrt (X : Long_Float) return Long_Float is
begin
return Long_Float_Functions.Sqrt(X);
end Sqrt;
function Exp (X : Long_Float) return Long_Float is
begin
return Long_Float_Functions.Exp(X);
end Exp;
function Sin (X : Long_Float) return Long_Float is
begin
return Long_Float_Functions.Sin(X);
end Sin;
function Cos (X : Long_Float) return Long_Float is
begin
return Long_Float_Functions.Cos(X);
end Cos;
end PolyPaver.Long_Floats;
|
src/main/fragment/mos6502-common/_deref_pvoc1=pvoc2_derefidx_vbuyy_memcpy_vbuc3.asm | jbrandwood/kickc | 2 | 2909 | <reponame>jbrandwood/kickc<filename>src/main/fragment/mos6502-common/_deref_pvoc1=pvoc2_derefidx_vbuyy_memcpy_vbuc3.asm
ldx #0
!:
lda {c2},y
sta {c1},x
iny
inx
cpx #{c3}
bne !-
|
extern/gnat_sdl/gnat_sdl2/src/sdl_keycode_h.ads | AdaCore/training_material | 15 | 24103 | <reponame>AdaCore/training_material
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with SDL_stdinc_h;
package SDL_keycode_h is
SDLK_SCANCODE_MASK : constant := (2**30); -- ..\SDL2_tmp\SDL_keycode.h:47
-- arg-macro: function SDL_SCANCODE_TO_KEYCODE (X)
-- return X or SDLK_SCANCODE_MASK;
-- unsupported macro: KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
-- unsupported macro: KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
-- unsupported macro: KMOD_ALT (KMOD_LALT|KMOD_RALT)
-- unsupported macro: KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
-- Simple DirectMedia Layer
-- Copyright (C) 1997-2018 <NAME> <<EMAIL>>
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
-- 3. This notice may not be removed or altered from any source distribution.
--
--*
-- * \file SDL_keycode.h
-- *
-- * Defines constants which identify keyboard keys and modifiers.
--
--*
-- * \brief The SDL virtual key representation.
-- *
-- * Values of this type are used to represent keyboard keys using the current
-- * layout of the keyboard. These values include Unicode values representing
-- * the unmodified character that would be generated by pressing the key, or
-- * an SDLK_* constant for those keys that do not generate characters.
-- *
-- * A special exception is the number keys at the top of the keyboard which
-- * always map to SDLK_0...SDLK_9, regardless of layout.
--
subtype SDL_Keycode is SDL_stdinc_h.Sint32; -- ..\SDL2_tmp\SDL_keycode.h:45
-- Skip uppercase letters
--
--*
-- * \brief Enumeration of valid key mods (possibly OR'd together).
--
subtype SDL_Keymod is unsigned;
KMOD_NONE : constant unsigned := 0;
KMOD_LSHIFT : constant unsigned := 1;
KMOD_RSHIFT : constant unsigned := 2;
KMOD_LCTRL : constant unsigned := 64;
KMOD_RCTRL : constant unsigned := 128;
KMOD_LALT : constant unsigned := 256;
KMOD_RALT : constant unsigned := 512;
KMOD_LGUI : constant unsigned := 1024;
KMOD_RGUI : constant unsigned := 2048;
KMOD_NUM : constant unsigned := 4096;
KMOD_CAPS : constant unsigned := 8192;
KMOD_MODE : constant unsigned := 16384;
KMOD_RESERVED : constant unsigned := 32768; -- ..\SDL2_tmp\SDL_keycode.h:340
-- vi: set ts=4 sw=4 expandtab:
end SDL_keycode_h;
|
programs/oeis/239/A239278.asm | karttu/loda | 0 | 24728 | ; A239278: Smallest k > 1 such that n*(n+1)*...*(n+k-1) / (n+(n+1)+...+(n+k-1)) is an integer.
; 3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,9,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3
mov $4,$0
mov $3,$4
mov $5,$4
mov $2,$5
clr $4,$3
mov $0,17
mul $2,2
add $2,1
add $5,1
lpb $0,1
add $0,$5
gcd $5,$2
sub $0,$5
sub $0,3
add $5,2
lpe
sub $5,3
mov $1,$5
div $1,2
mul $1,2
add $1,3
|
scripts/scpt/AddLoginItem.scpt | walkingmask/WiFiToggler | 1 | 2932 | tell application "System Events"
make login item at end with properties {path:"%@", name:"%@"}
end tell |
extern/game_support/stm32f4/src/memory_barriers.ads | AdaCore/training_material | 15 | 23311 | ------------------------------------------------------------------------------
-- --
-- Hardware Abstraction Layer for STM32 Targets --
-- --
-- Copyright (C) 2014, 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- This file provides utility functions for the STM32F4 (ARM Cortex M4F)
-- microcontrollers from ST Microelectronics.
package Memory_Barriers is
procedure Data_Synchronization_Barrier with Inline;
-- Injects instruction "DSB Sy" i.e., a "full system" domain barrier
procedure DSB renames Data_Synchronization_Barrier;
end Memory_Barriers;
|
engine/HoF_room_pc.asm | adhi-thirumala/EvoYellow | 16 | 13437 | <reponame>adhi-thirumala/EvoYellow<gh_stars>10-100
HallOfFamePC:
callab FallingStarEnd
call ClearScreen
ld c, 100
call DelayFrames
call DisableLCD
ld a, $a7
ld [rWX], a
xor a
ld [rSCX], a
ld [rSCY], a
ld [hSCX], a
ld [hSCY], a
ld [hWY], a
ld [rWY], a
call CreditsLoadFont
coord hl, 0, 0
call FillFourRowsWithBlack
coord hl, 0, 14
call FillFourRowsWithBlack
ld a, %11000000
ld [rBGP], a
call UpdateGBCPal_BGP
call EnableLCD
call StopAllMusic
ld hl, vBGMap1
call CreditsCopyTileMapToVRAM
ld hl, vBGMap0
call CreditsCopyTileMapToVRAM
ld c, BANK(Music_Credits)
ld a, MUSIC_CREDITS
call PlayMusic
ld c, 128
call DelayFrames
xor a
ld [wHoFMonSpecies], a
ld [wNumCreditsMonsDisplayed], a
jp Credits
FadeInCreditsText:
ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
ld hl, HoFGBPalettes
ld b, 4
.loop
ld a, [hli]
ld [rBGP], a
call UpdateGBCPal_BGP
ld c, 5
call DelayFrames
dec b
jr nz, .loop
ret
HoFGBPalettes:
db %11000000
db %11010000
db %11100000
db %11110000
DisplayCreditsMon:
ld hl, vBGMap1
call CreditsCopyTileMapToVRAM
xor a
ld [H_AUTOBGTRANSFERENABLED], a
ld hl, rLCDC
set 3, [hl]
call SaveScreenTilesToBuffer2
call FillMiddleOfScreenWithWhite
call GetNextCreditsMon
ld hl, vBGMap0 + 12
call CreditsCopyTileMapToVRAM
xor a
ld [H_AUTOBGTRANSFERENABLED], a
call LoadScreenTilesFromBuffer2DisableBGTransfer
ld hl, vBGMap0
call CreditsCopyTileMapToVRAM
ld a, %11111100 ; make the mon a black silhouette
ld [rBGP], a
call UpdateGBCPal_BGP
ld hl, rLCDC
res 3, [hl]
ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
ld b, 0
ld c, 10
call ScrollCreditsMonLeft
call FillLeftHalfOfScreenWithWhite
ld c, 10
call ScrollCreditsMonLeft
call FillRightHalfOfScreenWithWhite
ld c, 8
call ScrollCreditsMonLeft
ld a, %11000000
ld [rBGP], a
call UpdateGBCPal_BGP
xor a
ld [hSCX], a
ret
ScrollCreditsMonLeft:
ld a, b
ld [hSCX], a
add 8
ld b, a
call DelayFrame
dec c
jr nz, ScrollCreditsMonLeft
ret
GetNextCreditsMon:
ld hl, wNumCreditsMonsDisplayed
ld c, [hl]
inc [hl]
ld b, 0
ld hl, CreditsMons
add hl, bc
ld a, [hl]
ld [wcf91], a
ld [wd0b5], a
coord hl, 8, 6
call GetMonHeader
call LoadFrontSpriteByMonIndex
ret
INCLUDE "data/credit_mons.asm"
CreditsCopyTileMapToVRAM:
ld a, l
ld [H_AUTOBGTRANSFERDEST], a
ld a, h
ld [H_AUTOBGTRANSFERDEST + 1], a
ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
jp Delay3
CreditsLoadFont:
call LoadFontTilePatterns
ld hl, vChars1
ld bc, $40 * $10
call ZeroMemory
call LoadTextBoxTilePatterns
ld hl, vChars2 + $60 * $10
ld bc, $10 * $10
call ZeroMemory
ld hl, vChars2 + $7e * $10
ld bc, $1 * $10
ld a, $ff
call FillMemory
ret
ZeroMemory:
; zero bc bytes at hl
ld [hl], 0
inc hl
inc hl
dec bc
ld a, b
or c
jr nz, ZeroMemory
ret
FillFourRowsWithBlack:
ld bc, SCREEN_WIDTH * 4
ld a, $7e
jp FillMemory
FillMiddleOfScreenWithWhite:
coord hl, 0, 4
ld bc, SCREEN_WIDTH * 10
ld a, " "
jp FillMemory
FillLeftHalfOfScreenWithWhite:
coord hl, 0, 4
push bc
call FillHalfOfScreenWithWhite
pop bc
ret
FillRightHalfOfScreenWithWhite:
coord hl, 10, 4
push bc
call FillHalfOfScreenWithWhite
pop bc
ret
FillHalfOfScreenWithWhite:
ld b, 10
ld c, 10
ld a, " "
.loop
push bc
push hl
.innerLoop
ld [hli], a
dec c
jr nz, .innerLoop
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
jr nz, .loop
ret
Credits: ; Roll credits
ld de, CreditsOrder
push de
.nextCreditsScreen
pop de
coord hl, 9, 6
push hl
call FillMiddleOfScreenWithWhite
pop hl
.nextCreditsCommand
ld a, [de]
inc de
push de
cp $ff
jr z, .fadeInTextAndShowMon
cp $fe
jr z, .showTextAndShowMon
cp $fd
jr z, .fadeInText
cp $fc
jr z, .showText
cp $fb
jr z, .showCopyrightText
cp $fa
jr z, .showTheEnd
call PlaceCreditsText
pop de
jr .nextCreditsCommand
.showCopyrightText
callba LoadCopyrightTiles
pop de
jr .nextCreditsCommand
.fadeInTextAndShowMon
call FadeInCreditsText
ld c, 102
jr .next1
.showTextAndShowMon
ld c, 122
.next1
call DelayFrames
call DisplayCreditsMon
jr .nextCreditsScreen
.fadeInText
call FadeInCreditsText
ld c, 132
jr .next2
.showText
ld c, 152
.next2
call DelayFrames
jr .nextCreditsScreen
.showTheEnd
call ShowTheEndGFX
pop de
ret
ShowTheEndGFX:
ld c, 24
call DelayFrames
call FillMiddleOfScreenWithWhite
ld de, TheEndGfx
ld hl, vChars2 + $600
lb bc, BANK(TheEndGfx), (TheEndGfxEnd - TheEndGfx) / $10
call CopyVideoData
coord hl, 4, 8
ld de, TheEndTextString
call PlaceString
coord hl, 4, 9
inc de
call PlaceString
jp FadeInCreditsText
TheEndTextString:
; "T H E E N D"
db $60, " ", $62, " ", $64, " ", $64, " ", $66, " ", $68, "@"
db $61, " ", $63, " ", $65, " ", $65, " ", $67, " ", $69, "@"
PlaceCreditsText:
push hl
push hl
ld hl, CreditsTextPointers
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
pop hl
ld a, [de]
inc de
ld c, a
ld b, $ff
add hl, bc
call PlaceString
pop hl
ld bc, SCREEN_WIDTH * 2
add hl, bc
ret
INCLUDE "data/credits_order.asm"
INCLUDE "text/credits_text.asm"
TheEndGfx: ; 7473e (1d:473e) (7473f on blue)
INCBIN "gfx/theend.interleave.2bpp"
TheEndGfxEnd:
|
hello-world/hello.asm | newbies-step/asm-stuff | 0 | 88279 | <filename>hello-world/hello.asm
section .text ;section declaration
;we must export the entry point to the ELF linker or
global _start ;loader.
;entry point. Use ld -e foo to override the default.
_start:
;write our string to stdout
mov edx,len ;third argument: message length
mov ecx,msg ;second argument: pointer to message to write
mov ebx,1 ;first argument: file handle (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
;and exit
mov ebx,0 ;first syscall argument: exit code
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data ;section declaration
msg db "Hello, world!",0xa ;our dear string
len equ $ - msg ;length of our dear string
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca_notsx.log_21829_455.asm | ljhsiun2/medusa | 9 | 246132 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r15
push %r9
push %rbx
push %rsi
lea addresses_UC_ht+0x3979, %rbx
nop
nop
sub $9440, %r12
mov $0x6162636465666768, %r15
movq %r15, (%rbx)
nop
nop
sub %r9, %r9
lea addresses_UC_ht+0x8859, %r13
nop
nop
nop
nop
add %rsi, %rsi
movb (%r13), %r9b
nop
nop
add %rbx, %rbx
lea addresses_UC_ht+0x76b9, %r9
nop
and $40377, %r10
mov (%r9), %r12
nop
xor $49602, %rsi
lea addresses_D_ht+0xf879, %rsi
nop
nop
nop
xor %r9, %r9
vmovups (%rsi), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %r10
nop
xor %r13, %r13
lea addresses_D_ht+0x15ee7, %rbx
nop
and $1612, %rsi
mov (%rbx), %r12
nop
nop
nop
cmp %r10, %r10
lea addresses_A_ht+0xb6b9, %rbx
clflush (%rbx)
nop
nop
nop
nop
nop
inc %rsi
movl $0x61626364, (%rbx)
add %r13, %r13
lea addresses_WT_ht+0xab99, %r13
nop
sub %r15, %r15
mov $0x6162636465666768, %rbx
movq %rbx, %xmm6
movups %xmm6, (%r13)
nop
and $42701, %r15
pop %rsi
pop %rbx
pop %r9
pop %r15
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r15
push %rbp
push %rbx
push %rdi
// Load
lea addresses_WT+0x2e79, %r13
clflush (%r13)
nop
nop
nop
nop
nop
inc %rbp
mov (%r13), %rbx
nop
sub %r14, %r14
// Store
lea addresses_D+0x18279, %r10
and $8471, %r15
mov $0x5152535455565758, %r14
movq %r14, (%r10)
nop
nop
nop
nop
nop
inc %r13
// Faulty Load
lea addresses_D+0x18279, %rbp
xor $60345, %rdi
vmovups (%rbp), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %r13
lea oracles, %r14
and $0xff, %r13
shlq $12, %r13
mov (%r14,%r13,1), %r13
pop %rdi
pop %rbx
pop %rbp
pop %r15
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'LOAD'}
{'src': {'NT': True, 'AVXalign': True, 'size': 8, 'congruent': 10, 'same': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
programs/oeis/343/A343842.asm | neoneye/loda | 22 | 3613 | ; A343842: Series expansion of 1/sqrt(8*x^2 + 1), even powers only.
; 1,-4,24,-160,1120,-8064,59136,-439296,3294720,-24893440,189190144,-1444724736,11076222976,-85201715200,657270374400,-5082890895360,39392404439040,-305870434467840,2378992268083200,-18531097667174400,144542561803960320,-1128808577897594880
mov $1,-2
pow $1,$0
mov $2,$0
add $2,$0
bin $2,$0
mul $1,$2
mov $0,$1
|
test/interaction/Impossible.agda | cruhland/agda | 1,989 | 12449 | <gh_stars>1000+
module Impossible where
{-# IMPOSSIBLE #-}
|
Working Disassembly/Levels/MHZ/Misc Object Data/Map - Big Leaves.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 5 | 94780 | Map_3DC74: dc.w word_3DC7C-Map_3DC74
dc.w word_3DC84-Map_3DC74
dc.w word_3DC8C-Map_3DC74
dc.w word_3DC94-Map_3DC74
word_3DC7C: dc.w 1
dc.b $FC, 4, 0, 1, $FF, $F8
word_3DC84: dc.w 1
dc.b $FC, 4, 0, 3, $FF, $F8
word_3DC8C: dc.w 1
dc.b $FC, 4, 8, 1, $FF, $F8
word_3DC94: dc.w 1
dc.b $FC, 4, 8, 3, $FF, $F8
|
tests/tsasm-0000.asm | mras0/sasm | 26 | 4782 | ;; Calling convention (unless otherwise mentioned):
;;
;; Callee-saved: DS, BP, SI, DI
;; Scratch: AX, BX, CX, DX, ES
;; Return value: (DX:)AX or BX for pointer values,
;; boolean values via the carry flag
;;
; TODO: Investigate whether stack potentially overlaps with allocations
;; SS:SP is intialized at the top of the 64K started at CS:0
TOKEN_MAX equ 16 ; Maximum length of token (adjust token buffer if increasing)
INST_MAX equ 5 ; Maximum length of directive/instruction
OUTPUT_MAX equ 0x2000 ; Maximum output size
LABEL_MAX equ 200 ; Maximum number of labels
FIXUP_MAX equ 400 ; Maximum number of fixups
EQU_MAX equ 100 ; Maximum number of equavates
DISPATCH_SIZE equ 8 ; Size of DispatchListEntry
LABEL_SIZE equ 22 ; Size of Label (TOKEN_MAX+2+2*sizeof(WORD))
LABEL_ADDR equ 18 ; Offset of label address
LABEL_FIXUP equ 20 ; Offset of label fixup
FIXUP_SIZE equ 4 ; Size of Fixup
FIXUP_ADDR equ 0 ; Offset of fixup address (into the output buffer)
FIXUP_LINK equ 2 ; Offset of fixup link pointer (INVALID_ADDR terminates list)
EQU_SIZE equ 20 ; Size of equate (TOKEN_MAX+2+sizeof(WORD))
EQU_VAL equ 18 ; Offset of value in equate
HEX_ADJUST equ 7 ; 'A'-'0'-10
QUOTE_CHAR equ 39 ; '\''
INVALID_ADDR equ 0xFFFF
; Value of Operand(L)Type:
; Less than 0xC0: Memory access with ModRM = OperandType
OP_REG equ 0xC0
OP_LIT equ 0xC1
; Register indices (OperandValue when OperandType = OP_REG)
; Lower 3 bits matches index, bits 4&5 give class (r8, r16, sreg)
R_AL equ 0
R_CL equ 1
R_DL equ 2
R_BL equ 3
R_AH equ 4
R_CH equ 5
R_DH equ 6
R_BH equ 7
R_AX equ 8
R_CX equ 9
R_DX equ 10
R_BX equ 11
R_SP equ 12
R_BP equ 13
R_SI equ 14
R_DI equ 15
R_ES equ 16
R_CS equ 17
R_SS equ 18
R_DS equ 19
R_INVALID equ 21
; Condition Codes
CC_O equ 0x0
CC_NO equ 0x1
CC_C equ 0x2
CC_NC equ 0x3
CC_Z equ 0x4
CC_NZ equ 0x5
CC_NA equ 0x6
CC_A equ 0x7
CC_S equ 0x8
CC_NS equ 0x9
CC_PE equ 0xa
CC_PO equ 0xb
CC_L equ 0xc
CC_NL equ 0xd
CC_NG equ 0xe
CC_G equ 0xf
org 0x100
ProgramEntry:
call Init
call MainLoop
call Fini
xor al, al
jmp Exit
Init:
; First free paragraph is at the end of the program
; COM files get the largest available block
mov ax, ProgramEnd
add ax, 15
shr ax, 4
mov bx, cs
add ax, bx
mov [FirstFreeSeg], ax
mov ax, OUTPUT_MAX
mov bx, 1
call Malloc
mov [OutputSeg], ax
mov ax, LABEL_MAX
mov bx, LABEL_SIZE
call Malloc
mov [LabelSeg], ax
mov ax, FIXUP_MAX
mov bx, FIXUP_SIZE
call Malloc
mov [FixupSeg], ax
; Initial fixup list
mov es, ax
xor bx, bx
mov cx, FIXUP_MAX
.FixupInit:
mov ax, bx
add ax, FIXUP_SIZE
mov [es:bx+FIXUP_LINK], ax
mov bx, ax
dec cx
jnz .FixupInit
sub bx, FIXUP_SIZE
mov word [es:bx+FIXUP_LINK], INVALID_ADDR ; Terminate free list
mov ax, EQU_MAX
mov bx, EQU_SIZE
call Malloc
mov [EquSeg], ax
call ParserInit
ret
Fini:
call ParserFini
call WriteOutput
ret
NotImplemented:
mov bx, MsgErrNotImpl
; Fall through
; Exit and print error message in BX
Error:
; Error in line ...
push bx
call PutCrLf
mov bx, MsgErrInLine
call PutString
mov ax, [CurrentLine]
call PutDec
mov al, ':'
call PutChar
mov al, ' '
call PutChar
pop bx
call PutString
call PutCrLf
; Print curren token
cmp byte [TokenLen], 0
jz .NoTok
mov bx, MsgCurToken
call PutString
mov bx, Token
call PutString
mov al, '"'
call PutChar
call PutCrLf
.NoTok:
mov al, 0xff
; Fall through
; Exit with error code in AL
Exit:
mov ah, 0x4c
int 0x21
MainLoop:
; Update line counter
mov ax, [NumNewLines]
add [CurrentLine], ax
mov word [NumNewLines], 0
; Grab next token
call GetToken
cmp byte [TokenLen], 0
je .Done
; Dispatch
call Dispatch
jmp MainLoop
.Done:
cmp byte [CurrentChar], 0
je .Ret
mov bx, MsgErrNotDone
call Error
.Ret:
ret
Dispatch:
push si
mov al, ':'
call TryConsume
jc .NotLabel
call DefineLabel
jmp .Done
.NotLabel:
mov si, DispatchList
; Is the token too short/long to be a valid instruction/directive?
mov al, [TokenLen]
cmp al, 2
jb .CheckEQU
cmp al, INST_MAX
ja .CheckEQU
; Initialize fixup pointers
mov ax, INVALID_ADDR
mov [CurrentFixup], ax
mov [CurrentLFixup], ax
; And ExplicitSize
mov byte [ExplicitSize], 0
.Compare:
xor bx, bx
.CLoop:
mov al, [Token+bx]
mov ah, [si+bx]
cmp al, ah
jne .Next
and al, al ; at NUL terminator?
jz .Match
inc bl
cmp bl, INST_MAX
jb .CLoop
.Match:
; Found match, dispatch
movzx ax, byte [si+INST_MAX]
mov bx, [si+INST_MAX+1]
call bx
cmp word [CurrentFixup], INVALID_ADDR
jne .FixupUnhandled
cmp word [CurrentLFixup], INVALID_ADDR
jne .FixupUnhandled
jmp .Done
.FixupUnhandled:
mov bx, MsgErrFixupUnh
jmp Error
.Next:
add si, DISPATCH_SIZE
cmp si, DispatchListEnd
jb .Compare
.CheckEQU:
mov al, 'E'
call TryGetU
jc .Invalid
mov al, 'Q'
call TryGetU
jc .Invalid
mov al, 'U'
call TryGetU
jc .Invalid
call SkipWS
call MakeEqu
.Done:
pop si
ret
.Invalid:
mov bx, MsgErrUnknInst
call Error
; Allocate AX*BX bytes, returns segment in AX
Malloc:
; Calculate how many paragraphs are needed
mul bx
and dx, dx
jnz .Err ; Overflow
add ax, 15
shr ax, 4
mov cx, [FirstFreeSeg]
add ax, cx
cmp ax, [2] ; (PSP) Segment of the first byte beyond the memory allocated to the program
jae .Err ; Out of memory
mov [FirstFreeSeg], ax
mov ax, cx
ret
.Err:
mov bx, MsgErrMem
jmp Error
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Screen Output
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Write character in AL
PutChar:
mov dl, al
mov ah, 2
int 0x21
ret
; Write CR and LF
PutCrLf:
mov al, 13
call PutChar
mov al, 10
jmp PutChar
; Write ASCIIZ string in BX
PutString:
mov al, [bx]
and al, al
jz .Done
push bx
call PutChar
pop bx
inc bx
jmp PutString
.Done:
ret
; Write decimal word in AX
PutDec:
push di
mov di, sp ; Assumes DS=SS
sub sp, 6
dec di
mov byte [di], 0
mov bx, 10
.DecLoop:
xor dx, dx
div bx
add dl, '0'
dec di
mov [di], dl
and ax, ax
jnz .DecLoop
mov bx, di
call PutString
add sp, 6
pop di
ret
; Write hexadecimal word in AX
PutHex:
push ax
mov al, ah
call PutHexByte
pop ax
; Fall through
; Write hexadecimal byte in AX
PutHexByte:
push ax
shr al, 4
call PutHexDigit
pop ax
; Fall through
; Write hexadecimal digit in AL
PutHexDigit:
and al, 0x0f
add al, '0'
cmp al, '9'
jbe PutChar
add al, HEX_ADJUST
jmp PutChar
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; File Output
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Write output buffer to file
WriteOutput:
; Create file
mov dx, OutFileName
mov cx, 0x0020 ; Attributes
mov ah, 0x3c
int 0x21
jc .Error
mov si, ax ; Save file handle in SI
; Write
mov ah, 0x40
mov bx, si
mov cx, [NumOutBytes]
; ds:dx -> buffer
mov dx, [OutputSeg]
push ds
mov ds, dx
xor dx, dx
int 0x21
pop ds
jc .Error
cmp cx, [NumOutBytes]
jne .Error
; Close file
mov ax, 0x3e00
mov bx, si
int 0x21
ret
.Error:
mov bx, MsgErrOutput
jmp Error
; Output byte in AL to output buffer
; Doesn't modify any registers
OutputByte:
cmp word [NumOutBytes], OUTPUT_MAX
jb .OK
mov bx, MsgErrOutMax
jmp Error
.OK:
push di
push es
mov di, [OutputSeg]
mov es, di
mov di, [NumOutBytes]
stosb
inc word [NumOutBytes]
inc word [CurrentAddress]
pop es
pop di
ret
; Output word in AX
OutputWord:
call OutputByte
mov al, ah ; Only works because OutputByte is friendly
jmp OutputByte
; Output 8-bit immediate if AL is 0, output 16-bit immediate otherwise
; the immediate is assumed to be in OperandValue
OutputImm:
and al, al
jz OutputImm8
; Fall through
; Output 16-bit immediate from OperandValue
OutputImm16:
cmp word [CurrentFixup], INVALID_ADDR
je .Output
call RegisterFixup
.Output:
mov ax, [OperandValue]
jmp OutputWord
; Output 8-bit immediate from OperandValue
OutputImm8:
mov al, [OperandValue]
jmp OutputByte
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Parser
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ParserInit:
; Open file for reading
mov dx, FileName
mov ax, 0x3d00
int 0x21
jnc .OK
mov bx, MsgErrOpenIn
jmp Error
.OK:
mov [InputFile], ax
call MoveNext
ret
ParserFini:
; Close input file
mov ax, 0x3e00
mov bx, [InputFile]
int 0x21
ret
ReadNext:
mov ah, 0x3f
mov bx, [InputFile]
mov cx, 1
mov dx, CurrentChar
int 0x21
jc .NotOK ; error code in AX
cmp ax, 1
jne .NotOK ; EOF
cmp byte [CurrentChar], 10
jne .Ret
inc word [NumNewLines]
.Ret:
ret
.NotOK:
mov byte [CurrentChar], 0
ret
; Try to get character in AL and ReadNext. Returns carry clear on success.
; I.e. it doesn't skip spaces after consuming the character.
TryGet:
cmp [CurrentChar], al
jne .NoMatch
call ReadNext
clc
ret
.NoMatch:
stc
ret
; Like TryGet but case insensitive
TryGetU:
call TryGet
jc .NoMatch
ret
.NoMatch:
or al, ' ' ; ToUpper
jmp TryGet
SkipWS:
mov al, [CurrentChar]
and al, al
jz .Done
cmp al, ' '
ja .CheckComment
call ReadNext
jmp SkipWS
.CheckComment:
cmp al, ';'
jne .Done
.SkipComment:
call ReadNext
mov al, [CurrentChar]
and al, al
jz .Done
cmp al, 10
je SkipWS
jmp .SkipComment
.Done:
ret
MoveNext:
call ReadNext
call SkipWS
ret
; Consume CurrentChar if it matches AL, move next and
; return carry clear. Carry is set ortherwise.
; AL is left unchanged (for Expect)
TryConsume:
cmp [CurrentChar], al
jne .NoMatch
call MoveNext
clc
ret
.NoMatch:
stc
ret
; Abort if the next character isn't AL
Expect:
call TryConsume
jc .Error
ret
.Error:
mov bx, .Msg
mov [bx], al
jmp Error
.Msg: db '? expected',0
GetToken:
push di
mov di, Token
.Get:
mov al, [CurrentChar]
cmp al, '.'
je .Store
cmp al, '_'
je .Store
; IsDigit
mov ah, al
sub ah, '0'
cmp ah, 9
jbe .Store
and al, 0xDF ; to lower case
mov ah, al
sub ah, 'A'
cmp ah, 26
ja .Done
.Store:
cmp di, TokenEnd
jae .Next ; don't store if beyond limit
mov [di], al
inc di
.Next:
call ReadNext
jmp .Get
.Done:
mov byte [di], 0 ; zero-terminate
sub di, Token
mov ax, di
mov [TokenLen], al
pop di
call SkipWS
call FindEqu
cmp bx, INVALID_ADDR
je .NotEqu
; Found EQU convert it to a hex string (yes a bit lame)
mov ax, [es:bx+EQU_VAL]
mov byte [TokenLen], 6
mov bx, Token
mov word [bx], '0X'
add bx, 2
mov cl, 4
.Cvt:
rol ax, 4
mov ch, al
and ch, 0x0f
add ch, '0'
cmp ch, '9'
jbe .StoreDig
add ch, HEX_ADJUST
.StoreDig:
mov [bx], ch
inc bx
dec cl
jnz .Cvt
mov byte [bx], 0
.NotEqu:
ret
; Get number to AX
GetNumber:
call GetToken
; Fall through
; Get number from Token to AX
GetTokenNumber:
cmp word [Token], '0X'
je .Hex
; Decimal number
xor ax, ax
mov bx, Token
xor ch, ch
.Dec:
mov cl, [bx]
and cl, cl
jnz .NotDone
ret
.NotDone:
inc bx
mov dx, 10
mul dx
and dx, dx
jnz .Error
sub cl, '0'
cmp cl, 9
ja .Error
add ax, cx
jmp .Dec
.Hex:
mov cl, [TokenLen]
sub cl, 2
cmp cl, 4
ja .Error
xor ax, ax
mov bx, Token
add bx, 2
.HexCvt:
shl ax, 4
mov ch, [bx]
inc bx
sub ch, '0'
cmp ch, 9
jbe .Add
sub ch, HEX_ADJUST
.Add:
or al, ch
dec cl
jnz .HexCvt
ret
.Error:
mov bx, MsgErrInvalidNum
jmp Error
; Returns carry clear if token is number
IsTokenNumber:
mov al, [Token]
sub al, '0'
cmp al, 9
ja .NotNumber
clc
ret
.NotNumber:
stc
ret
; Read one or two character literal to OperandValue
; Assumes initial quote character has been consumed
GetCharLit:
movzx ax, [CurrentChar]
mov [OperandValue], ax
call ReadNext
mov al, QUOTE_CHAR
call TryConsume
jnc .Done
mov al, [CurrentChar]
mov [OperandValue+1], al
call ReadNext
mov al, QUOTE_CHAR
call Expect
.Done:
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Operand Handling
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Get token and see if it's a register or number.
; Returns carry clear on success (token handled).
GetRegOrNumber:
call GetToken
; Check if register
cmp byte [TokenLen], 2
jne .CheckNumber
mov ax, [Token]
mov bx, RegNames
mov cl, R_INVALID
.ChecReg:
cmp ax, [bx]
jne .NextReg
sub bx, RegNames
shr bx, 1
mov [OperandValue], bx
mov byte [OperandType], OP_REG
clc
ret
.NextReg:
add bx, 2
dec cl
jnz .ChecReg
; Fall through
.CheckNumber:
call IsTokenNumber
jnc .Number
ret ; Keep carry set
.Number:
call GetTokenNumber
mov [OperandValue], ax
mov byte [OperandType], OP_LIT
clc
ret
; Get operand to OperandType/OperandValue (and possibly CurrentFixup)
GetOperand:
; TODO: Character literal
mov al, QUOTE_CHAR
call TryGet
jc .NotLit
mov byte [OperandType], OP_LIT
jmp GetCharLit
.NotLit:
cmp byte [CurrentChar], '['
je GetOperandMem
call GetRegOrNumber
jc .NotRegOrNumber
ret
.NotRegOrNumber:
; Check for word/byte [mem]
cmp byte [TokenLen], 4
jne .CheckNamedLit
mov ax, [Token]
mov bx, [Token+2]
cmp ax, 'BY'
jne .CheckWord
cmp bx, 'TE'
jne .CheckNamedLit
mov byte [ExplicitSize], 1
jmp GetOperandMem
.CheckWord:
cmp ax, 'WO'
jne .CheckNamedLit
cmp bx, 'RD'
jne .CheckNamedLit
mov byte [ExplicitSize], 2
jmp GetOperandMem
.CheckNamedLit:
; Otherwise do named literal (fall through)
GetNamedLiteral:
mov byte [OperandType], OP_LIT
call FindOrMakeLabel
mov ax, [LabelSeg]
mov es, ax
mov ax, [es:bx+LABEL_ADDR]
cmp ax, INVALID_ADDR
je .NeedFixup
mov [OperandValue], ax
ret
.NeedFixup:
mov word [OperandValue], 0
;
; Add fixup for the label
;
; First grab a free fixup pointer
mov ax, [NextFreeFixup]
cmp ax, INVALID_ADDR
jne .FixupValid
mov bx, MsgErrFixupMax
jmp Error
.FixupValid:
; Store the fixup along the other operand data
mov [CurrentFixup], ax
; And update the linked list
mov cx, [es:bx+LABEL_FIXUP] ; Remember old fixup pointer
mov [es:bx+LABEL_FIXUP], ax ; Store fixup pointer
; Done with the label, switch to pointing to the fixups
mov bx, [FixupSeg]
mov es, bx
mov bx, ax ; es:bx points to the new fixup node
; Update free list
mov ax, [es:bx+FIXUP_LINK]
mov [NextFreeFixup], ax
; And point the link at the old head
mov [es:bx+FIXUP_LINK], cx
ret
GetOperandMem:
push si
push di
mov al, '['
call Expect
; si = MODRM (0xff = displacement only)
; di = DISP
mov si, 0xff
mov di, 0
.Main:
call .DebugM
call GetRegOrNumber
jc .NamedLit
cmp byte [OperandType], OP_REG
jne .Lit
mov al, [OperandValue]
cmp al, R_AX
jb InvalidOperand
cmp al, R_ES
jae .SegOverride
call .CombineModrm
jmp .Next
.SegOverride:
sub al, R_ES
shl al, 3
or al, 0x26
call OutputByte
mov al, ':'
call Expect
jmp .Main
.NamedLit:
call GetNamedLiteral
; Fall through
.Lit:
pusha
mov bx, .MsgL
call PutString
mov ax, [OperandValue]
call PutHex
call PutCrLf
popa
add di, [OperandValue]
jmp .Next
.Next:
mov al, '+'
call TryConsume
jnc .Main
mov al, ']'
call Expect
pusha
mov bx, .M2
call PutString
jmp .X2
.M2: db 'Done with GetOperandMem',13,10,0
.X2:
popa
mov [OperandValue], di
; Can't encode [bp] as MODRM=6
mov ax, si
cmp al, 6
jne .NotBPRaw
and di, di
jnz .NotBPRaw
or al, 0x40 ; Disp8
.NotBPRaw:
cmp al, 0xff
jne .NotDispOnly
mov al, 6
jmp .Done
.NotDispOnly:
cmp word [CurrentFixup], INVALID_ADDR
je .NoFixup
.Disp16:
or al, 0x80 ; Disp16
jmp .Done
.NoFixup:
and di, di
jz .Done
mov bx, di
movsx bx, bl
cmp bx, di
jne .Disp16
or al, 0x40 ; Disp8
; Fall through
.Done:
mov [OperandType], al
;; XXX REMOVE
movzx si, byte [OperandType]
mov di, [OperandValue]
call .DebugM
pop di
pop si
ret
.MsgL: db 'Literal ', 0
.DebugM:
pusha
mov bx, .M
call PutString
popa
pusha
mov ax, si
call PutHex
mov al, ' '
call PutChar
mov ax, di
call PutHex
call PutCrLf
popa
ret
.M: db 'SI/DI: ', 0
; Modify MODRM in si with 16-bit register in al
.CombineModrm:
call .Debug
and al, 7
mov cx, si
mov bx, .TabFF
cmp cl, 0xff
je .Translate
mov bx, .Tab04
cmp cl, 0x04
je .Translate
mov bx, .Tab05
cmp cl, 0x05
je .Translate
mov bx, .Tab06
cmp cl, 0x06
je .Translate
mov bx, .Tab07
cmp cl, 0x07
jne InvalidOperand
; Fall through
.Translate:
movzx cx, al
add bx ,cx
mov al, [bx]
pusha
call PutHexByte
call PutCrLf
popa
cmp al, 0xff
je InvalidOperand
movzx si, al
ret
.Debug:
pusha
mov bx, .Msg
call PutString
popa
pusha
mov ax, si
call PutHexByte
mov al, ' '
call PutChar
popa
pusha
call PutHexByte
call PutCrLf
popa
ret
.Msg: db 'Combine ', 0
;
; Conversion tables from previous modrm value to new
;
; AX CX DX BX SP BP SI DI Current ModR/M meaning
.Tab04: db 0xff, 0xff, 0xff, 0x00, 0xff, 0x02, 0xff, 0xff ; SI
.Tab05: db 0xff, 0xff, 0xff, 0x01, 0xff, 0x03, 0xff, 0xff ; DI
.Tab06: db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x03 ; BP
.Tab07: db 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01 ; BX
.TabFF: db 0xff, 0xff, 0xff, 0x07, 0xff, 0x06, 0x04, 0x05 ; Displacement only
ret
SwapOperands:
mov al, [OperandType]
xchg al, [OperandLType]
mov [OperandType], al
mov ax, [OperandValue]
xchg ax, [OperandLValue]
mov [OperandValue], ax
; Fall through
SwapFixup:
mov ax, [CurrentFixup]
xchg ax, [CurrentLFixup]
mov [CurrentFixup], ax
ret
Get2Operands:
call GetOperand
mov al, ','
call Expect
call SwapOperands
jmp GetOperand
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Label Handling
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Define label (from Token) at current address
DefineLabel:
cmp byte [Token], '.'
je .Local
; Non-local label, retire all previously defined local labels
call RetireLocLabs
.Local:
call FindLabel
cmp bx, INVALID_ADDR
jne .KnownLabel
call MakeLabel
mov ax, [LabelSeg]
mov es, ax
mov ax, [CurrentAddress]
mov [es:bx+LABEL_ADDR], ax
ret
.KnownLabel:
mov ax, [LabelSeg]
mov es, ax
cmp word [es:bx+LABEL_ADDR], INVALID_ADDR
je .NotDup
mov bx, MsgErrDupLabel
jmp Error
.NotDup:
mov ax, [CurrentAddress]
mov [es:bx+LABEL_ADDR], ax ; Set label address
; Resolve fixups
mov cx, [es:bx+LABEL_FIXUP] ; Store last valid fixup in CX
mov word [es:bx+LABEL_FIXUP], INVALID_ADDR
mov bx, cx
push si
push di
mov dx, [FixupSeg]
mov di, [OutputSeg]
.ResolveFixup:
cmp bx, INVALID_ADDR
je .Done
mov cx, bx ; Update last valid fixup node
mov es, dx
mov si, [es:bx+FIXUP_ADDR]
mov bx, [es:bx+FIXUP_LINK]
mov es, di
add [es:si], ax
jmp .ResolveFixup
.Done:
cmp cx, INVALID_ADDR
je .NoFixups
mov es, dx
mov bx, cx
mov ax, [NextFreeFixup]
mov [es:bx+FIXUP_LINK], ax
mov [NextFreeFixup], bx
.NoFixups:
pop di
pop si
ret
; Print Label in BX (assumes ES=LabelSeg). Registers preserved.
PrintLabel:
push ds
pusha
mov ax, es
mov ds, ax
call PutString
mov al, ' '
call PutChar
popa
pop ds
mov ax, [es:bx+LABEL_ADDR]
pusha
call PutHex
mov al, ' '
call PutChar
popa
mov ax, [es:bx+LABEL_FIXUP]
pusha
call PutHex
call PutCrLf
popa
ret
; Print all labels (registers preserved)
PrintLabels:
push es
pusha
mov ax, [LabelSeg]
mov es, ax
xor bx, bx
mov cx, [NumLabels]
and cx, cx
jz .Done
.L:
call PrintLabel
add bx, LABEL_SIZE
dec cx
jnz .L
.Done:
popa
pop es
ret
RetireLocLabs:
mov ax, [LabelSeg]
mov es, ax
xor bx, bx
mov cx, [NumLabels]
and cx, cx
jnz .L
ret
.L:
cmp byte [es:bx], '.'
jne .Next
cmp word [es:bx+LABEL_ADDR], INVALID_ADDR
jne .NotInv
.Inv:
call PrintLabels
call PrintLabel
mov bx, MsgErrUndefLab
jmp Error
.NotInv:
cmp word [es:bx+LABEL_FIXUP], INVALID_ADDR
jne .Inv
mov ax, [NumLabels]
dec ax
mov [NumLabels], ax
jz .Done
mov dx, LABEL_SIZE
mul dx
push ds
push si
push di
push cx
mov si, es
mov ds, si
mov di, bx
mov si, ax
mov cx, LABEL_SIZE
rep movsb
pop cx
pop di
pop si
pop ds
sub bx, LABEL_SIZE ; Re-do current label
.Next:
add bx, LABEL_SIZE
dec cx
jnz .L
.Done:
ret
; Register fixup for CurrentFixup at this exact output location
RegisterFixup:
mov bx, [CurrentFixup]
mov ax, INVALID_ADDR
cmp bx, ax
jne .OK
mov bx, .MsgErrInternalErr
jmp Error
.OK:
mov [CurrentFixup], ax
mov ax, [FixupSeg]
mov es, ax
mov ax, [NumOutBytes]
mov [es:bx+FIXUP_ADDR], ax
ret
.MsgErrInternalErr: db 'No fixup to register?', 0
; Find label matching Token, returns pointer in BX or
; INVALID_ADDR if not found
FindLabel:
push si
push di
mov cx, [NumLabels]
and cx, cx
jz .NotFound
mov ax, [LabelSeg]
mov es, ax
xor bx, bx
.Search:
mov si, Token
mov di, bx
.Compare:
mov al, [si]
cmp [es:di], al
jne .Next
and al, al
jz .Done
inc si
inc di
jmp .Compare
.Next:
add bx, LABEL_SIZE
dec cx
jnz .Search
.NotFound:
mov bx, INVALID_ADDR
.Done:
pop di
pop si
ret
; Returns pointer to label in BX. Label must NOT exist.
MakeLabel:
mov ax, [NumLabels]
cmp ax, LABEL_MAX
jb .OK
mov bx, MsgErrLabelMax
jmp Error
.OK:
inc word [NumLabels]
mov bx, LABEL_SIZE
mul bx
mov bx, ax
mov ax, [LabelSeg]
mov es, ax
mov ax, INVALID_ADDR
mov [es:bx+LABEL_ADDR], ax
mov [es:bx+LABEL_FIXUP], ax
push di
push si
movzx cx, [TokenLen]
inc cx
mov di, bx
mov si, Token
rep movsb
pop si
pop di
ret
; Returns pointer to label (from Token) in BX
FindOrMakeLabel:
call FindLabel
cmp bx, INVALID_ADDR
je MakeLabel
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; EQU Handling
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Find EQU (from Token) in BX, INVALID_ADDR if not found
; Leaves ES pointer to EquSeg
FindEqu:
push si
push di
mov ax, [EquSeg]
mov es, ax
mov cx, [NumEqus]
and cx, cx
jz .NotFound
xor bx, bx
.Main:
mov si, Token
mov di, bx
.Compare:
mov al, [si]
cmp [es:di], al
jne .Next
and al, al
jz .Done
inc si
inc di
jmp .Compare
.Next:
add bx, EQU_SIZE
dec cx
jnz .Main
; Fall through
.NotFound:
mov bx, INVALID_ADDR
.Done:
pop di
pop si
ret
; Create new EQU from Token and the next token(s) (EQU assumed to be parsed)
MakeEqu:
call FindEqu
cmp bx, INVALID_ADDR
je .NewEqu
mov bx, MsgErrDupEqu
jmp Error
.NewEqu:
mov ax, [NumEqus]
cmp ax, EQU_MAX
jb .HasRoom
mov bx, MsgErrEquMax
jmp Error
.HasRoom:
inc word [NumEqus]
mov bx, EQU_SIZE
mul bx
push si
push di
movzx cx, [TokenLen]
inc cx
mov di, ax
mov si, Token
rep movsb
pop di
pop si
push ax
mov al, QUOTE_CHAR
call TryGet
jc .Number
call GetCharLit
mov ax, [OperandValue]
jmp .HasVal
.Number:
call GetNumber
.HasVal:
pop bx
mov [es:bx+EQU_VAL], ax
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Directives
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DirORG:
call GetNumber
mov [CurrentAddress], ax
ret
; AL = 1 if DB 2 if DW
DirDX:
push si
mov si, ax
cmp al, 1
.Main:
mov al, QUOTE_CHAR
call TryGet
jc .NotLit
; Handle character literal
.CharLit:
mov al, QUOTE_CHAR
call TryConsume
jnc .Next
mov al, [CurrentChar]
cmp al, ' '
jae .OK
mov bx, MsgErrChLitErr
jmp Error
.OK:
call OutputByte ; Always output bytes for character liters
call ReadNext
jmp .CharLit
.NotLit:
call GetToken
call IsTokenNumber
jc .NamedLit
call GetTokenNumber
cmp si, 1
jne .OutputWord
call OutputByte
jmp .Next
.OutputWord:
call OutputWord
jmp .Next
.NamedLit:
cmp si, 2
jne NotImplemented
call GetNamedLiteral
mov ax, [OperandValue]
call OutputWord
; Fall thorugh
.Next:
mov al, ','
call TryConsume
jnc .Main
pop si
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Instructions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
InvalidOperand:
mov bx, MsgErrInvalidOpe
jmp Error
HandleRel16:
cmp byte [OperandType], OP_LIT
jne InvalidOperand
cmp word [CurrentFixup], INVALID_ADDR
je .NoFixup
call RegisterFixup
.NoFixup:
mov ax, [OperandValue]
sub ax, [CurrentAddress]
sub ax, 2
jmp OutputWord
; Output instruction byte in AL and Rel8 if OperandValue is a short
; (known) jump. Returns carry clear on success
HandleShortRel:
cmp word [CurrentFixup], INVALID_ADDR
jne .NotShort ; Too advanced for now
mov bx, [OperandValue]
sub bx, [CurrentAddress]
sub bx, 2
movsx cx, bl
cmp cx, bx
jne .NotShort
push bx
call OutputByte
pop bx
mov al, bl
call OutputByte
clc
ret
.NotShort:
stc
ret
; Output instruction byte in AL, ORed with 1 if OperandValue
; is a 16-bit register (R_AX .. R_DI)
OutInst816:
; 16-bit?
mov bl, [OperandValue]
shr bl, 3
cmp bl, 1
jne .Not16
or al, 1
.Not16:
jmp OutputByte
; Outputs MODR/M byte(s) with register in AL
; and memory operand assumed in OperandL*
OutputModRM:
shl al, 3
or al, [OperandLType]
call OutputByte
mov al, [OperandLType]
cmp al, 6
je .Disp16
and al, 0xc0
cmp al, 0x80
je .Disp16
cmp al, 0x40
je .Disp8
ret
.Disp8:
mov al, [OperandLValue]
jmp OutputByte
.Disp16:
cmp word [CurrentLFixup], INVALID_ADDR
je .Out
call SwapFixup
call RegisterFixup
call SwapFixup
.Out:
mov ax, [OperandLValue]
jmp OutputWord
; Output reg, reg instruction with instruction byte in AL
; The low bit of the instruction is set if OperandValue
; signifies a 16-bit (not sreg) register
OutputRR:
call OutInst816
mov al, 0xc0
mov ah, [OperandLValue]
and ah, 7
or al, ah
mov ah, [OperandValue]
and ah, 7
shl ah, 3
or al, ah
jmp OutputByte
; Output mem, reg otherwise see notes for OutputRR
OutputMR:
; TODO: Check if ExplicitSize (it's either redundant or wrong)
call OutInst816
mov al, [OperandValue]
and al, 7
jmp OutputModRM
; Output reg, mem otherwise see notes for OutputMR
OutputRM:
push ax
call SwapOperands
pop ax
jmp OutputMR
; Output mem, imm with base instruction in AH, /r in AL
OutputMImm:
mov bl, [ExplicitSize]
dec bl
jns .HasSize
mov bx, MsgErrNoSize
jmp Error
.HasSize:
push bx
push ax
or bl, ah
mov al, bl
call OutputByte ; Opcode
pop ax
call OutputModRM
pop bx
mov al, bl
jmp OutputImm
InstMOV:
pusha
mov al, '!'
call PutChar
call PutCrLf
popa
call Get2Operands
pusha
mov al, '-'
call PutChar
mov al, '>'
call PutChar
mov ah, [OperandLType]
mov al, [OperandType]
call PutHex
call PutCrLf
popa
cmp byte [OperandLType], OP_REG
je .MOVr
jb .MOVm
jmp InvalidOperand
.MOVr:
cmp byte [OperandType], OP_REG
je .MOVrr
jb .MOVrm
; MOV reg, imm
mov al, 0xb0
add al, [OperandLValue]
call OutputByte
mov al, [OperandLValue]
shr al, 3
jmp OutputImm
.MOVrr:
; MOV reg, reg
cmp byte [OperandLValue], R_ES
jae .MOVs
; LHS isn't s-reg
cmp byte [OperandValue], R_ES
jae .MOVrs
mov al, 0x88
jmp OutputRR
.MOVrs:
mov al, 0x8c
jmp OutputRR
.MOVs:
mov al, [OperandValue]
sub al, R_AX
cmp al, 7
ja InvalidOperand
call SwapOperands
mov al, 0x8e
jmp OutputRR
.MOVrm:
mov al,0x8A
jmp OutputRM
.MOVm:
pusha
mov al, '$'
call PutChar
popa
cmp byte [OperandType], OP_REG
je .MOVmr
jb InvalidOperand
pusha
mov al, [OperandLType]
call PutHexByte
mov ax, [OperandLValue]
call PutHex
mov al, '#'
call PutChar
mov al, [OperandType]
call PutHexByte
mov ax, [OperandValue]
call PutHex
call PutCrLf
popa
mov ax, 0xc600
jmp OutputMImm
.MOVmr:
mov al, 0x88
jmp OutputMR
InstXCHG:
call Get2Operands
cmp byte [OperandLType], OP_REG
je .XCHGr
ja InvalidOperand
cmp byte [OperandType], OP_REG
jne InvalidOperand
.XCHGmr:
mov al, 0x86
call OutInst816
mov al, [OperandValue]
and al, 7
jmp OutputModRM
.XCHGr:
cmp byte [OperandType], OP_REG
je .XCHGrr
ja InvalidOperand
call SwapOperands
jmp .XCHGmr
.XCHGrr:
mov al, 0x86
jmp OutputRR
; AL=second opcode byte
InstMOVXX:
push ax
call Get2Operands
pop ax
cmp byte [OperandLType], OP_REG
jne NotImplemented
mov ah, al
mov al, 0x0f
call OutputWord
cmp byte [OperandType], OP_REG
je .RR
call SwapOperands
mov al, [OperandValue]
and al, 7
jmp OutputModRM
.RR:
mov al, [OperandValue]
and al, 7
mov ah, [OperandLValue]
and ah, 7
shl ah, 3
or al, ah
or al, 0xc0
jmp OutputByte
; AL=0 if INC, AL=1 if DEC
InstIncDec:
push ax
call GetOperand
pop ax
cmp byte [OperandType], OP_REG
je .Reg
ja InvalidOperand
mov ah, [ExplicitSize]
dec ah
jns .HasSize
mov bx, MsgErrNoSize
jmp Error
.HasSize:
or ah, 0xfe
push ax
mov al, ah
call OutputByte
call SwapOperands
pop ax
jmp OutputModRM
.Reg:
shl al, 3
mov ah, [OperandValue]
mov bl, ah
and ah, 7
or al, ah
or al, 0x40 ; AL = 0x40|dec<<3|(OperandValue&7)
shr bl, 3
jnz OutputByte
or al, 0xc0 ; Could just be |0x80 since 0x40 is already or'ed in
mov ah, al
mov al, 0xfe
jmp OutputWord
; Base instruction in AL (e.g. 0x38 for CMP)
InstALU:
push ax
call Get2Operands
pop ax
cmp byte [OperandLType], OP_REG
je .ALUr
ja InvalidOperand
cmp byte [OperandType], OP_REG
je OutputMR
jb InvalidOperand
shr al, 3
mov ah, 0x80
jmp OutputMImm
.ALUr:
cmp byte [OperandType], OP_REG
je OutputRR
ja .ALUrl
add al, 2
jmp OutputRM
.ALUrl:
cmp byte [OperandLValue], R_AL
jne .ALUrl2
add al, 4
call OutputByte
jmp OutputImm8
.ALUrl2:
cmp byte [OperandLValue], R_AX
jne .ALUrl3
add al, 5
call OutputByte
jmp OutputImm16
.ALUrl3:
mov ah, al
or ah, 0xc0
mov al, [OperandLValue]
mov bl, al
shr al, 3
push ax
or al, 0x80
and bl, 7
or ah, bl
call OutputWord
pop ax
jmp OutputImm
; /r in AL (e.g. 6 for DIV)
InstMulDiv:
push ax
call GetOperand
pop ax
cmp byte [OperandType], OP_REG
jne InvalidOperand
; Output 0xF6 | is16bit, 0xC0 | r<<3 | (OperandValue&7)
mov ah, al
shl ah, 3
or ah, 0xC0
mov al, [OperandValue]
cmp al, R_ES
jae InvalidOperand
mov bl, al
and bl, 7
or ah, bl
shr al, 3
or al, 0xF6
jmp OutputWord
; /r in AL (e.g. 4 for SHL)
InstROT:
push ax
call Get2Operands
pop bx
cmp byte [OperandLType], OP_REG
jne NotImplemented
cmp byte [OperandType], OP_LIT
jne NotImplemented
mov ah, [OperandLValue]
; Output 0xc0 | is16bit, 0xC0 | r<<3 | (OperandLValue&7)
mov al, ah
and ah, 7
shl bl, 3
or ah, bl
or ah, 0xc0
shr al, 3
and al, 1
or al, 0xc0
call OutputWord
jmp OutputImm8
InstINT:
mov al, 0xcd
call OutputByte
call GetNumber
jmp OutputByte
InstCALL:
call GetOperand
cmp byte [OperandType], OP_REG
je .CallR
mov al, 0xE8
call OutputByte
jmp HandleRel16
.CallR:
mov al, 0xFF
call OutputByte
mov al, [OperandValue]
and al, 7
or al, 0xD0 ; 0xC0 | (2<<3)
jmp OutputByte
InstPUSH:
call GetOperand
cmp byte [OperandType], OP_REG
je .PushR
jb InvalidOperand
cmp word [CurrentFixup], INVALID_ADDR
jne .PushImm16
mov ax, [OperandValue]
movsx bx, al
cmp ax, bx
jne .PushImm16
mov al, 0x6A
call OutputByte
jmp OutputImm8
.PushImm16:
mov al, 0x68
call OutputByte
jmp OutputImm16
.PushR:
mov al, [OperandValue]
sub al, R_AX
cmp al, 8
jae .PushS
or al, 0x50
jmp OutputByte
.PushS:
sub al, 8
shl al, 3
or al, 0x06
jmp OutputByte
InstPOP:
call GetOperand
cmp byte [OperandType], OP_REG
jne InvalidOperand
mov al, [OperandValue]
sub al, R_AX
js InvalidOperand
cmp al, 8
jae .PopS
or al, 0x58
jmp OutputByte
.PopS:
and al, 7
shl al, 3
or al, 0x07
jmp OutputByte
InstJMP:
call GetOperand
mov al, 0xEB
call HandleShortRel
jc .NotShort
ret
.NotShort:
mov al, 0xE9
call OutputByte
jmp HandleRel16
; AL contains the condition code
InstJCC:
push si
mov si, ax
call GetOperand
mov ax, 0x70
or ax, si
call HandleShortRel
jnc .Done
shl si, 8
mov ax, 0x800F
or ax, si
call OutputWord
call HandleRel16
.Done:
pop si
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FileName: db 'in.asm', 0
OutFileName: db 'a.com', 0
MsgCurToken: db 'Current token: "', 0
MsgErrInLine: db 'Error in line ', 0
MsgErrNotImpl: db 'Not implemented', 0
MsgErrNotDone: db 'File not completely parsed', 0
MsgErrUnknInst: db 'Unknown directive or instruction', 0
MsgErrOpenIn: db 'Error opening input file', 0
MsgErrOutput: db 'Error during output', 0
MsgErrMem: db 'Alloc failed', 0
MsgErrInvalidNum: db 'Error invalid number', 0
MsgErrInvalidOpe: db 'Invalid operand', 0
MsgErrLabelMax: db 'Too many labels', 0
MsgErrFixupMax: db 'Too many fixups', 0
MsgErrDupLabel: db 'Duplicate label', 0
MsgErrFixupUnh: db 'Unhandled fixup', 0
MsgErrChLitErr: db 'Invalid character literal', 0
MsgErrUndefLab: db 'Undefined label', 0
MsgErrNoSize: db 'Size missing for memory operand', 0
MsgErrDupEqu: db 'Duplicate EQU', 0
MsgErrEquMax: db 'Too many EQUs', 0
MsgErrOutMax: db 'Output buffer full', 0
RegNames:
dw 'AL', 'CL', 'DL', 'BL', 'AH', 'CH', 'DH', 'BH'
dw 'AX', 'CX', 'DX', 'BX', 'SP', 'BP', 'SI', 'DI'
dw 'ES', 'CS', 'SS', 'DS'
; Each entry has "DISPATCH_SIZE" and starts with a NUL-padded string
; of size INST_MAX followed by a byte that's passed in AL (AX) to the
; function in the final word.
DispatchList:
; Directives
db 'DB',0,0,0, 0x01
dw DirDX
db 'DW',0,0,0, 0x02
dw DirDX
db 'ORG',0,0, 0x00
dw DirORG
; MOV/XCHG
db 'MOV',0,0, 0x00
dw InstMOV
db 'XCHG',0, 0x00
dw InstXCHG
; MOVSX/MOVZX
db 'MOVZX', 0xB6
dw InstMOVXX
db 'MOVSX', 0xBE
dw InstMOVXX
; INC/DEC
db 'INC',0,0, 0x00
dw InstIncDec
db 'DEC',0,0, 0x01
dw InstIncDec
; ALU instructions (argument is base instruction)
db 'ADD',0,0, 0x00
dw InstALU
db 'OR',0,0,0, 0x08
dw InstALU
db 'ADC',0,0, 0x10
dw InstALU
db 'SBB',0,0, 0x18
dw InstALU
db 'AND',0,0, 0x20
dw InstALU
db 'SUB',0,0, 0x28
dw InstALU
db 'XOR',0,0, 0x30
dw InstALU
db 'CMP',0,0, 0x38
dw InstALU
; Misc
db 'NOP',0,0, 0x90
dw OutputByte
db 'REP',0,0, 0xF3
dw OutputByte
db 'CLC',0,0, 0xF8
dw OutputByte
db 'STC',0,0, 0xF9
dw OutputByte
; Mul/Div instructions (argument is /r)
db 'MUL',0,0, 0x04
dw InstMulDiv
db 'IMUL',0, 0x05
dw InstMulDiv
db 'DIV',0,0, 0x06
dw InstMulDiv
db 'IDIV',0, 0x07
dw InstMulDiv
; Rotate instructions (argument is /r)
db 'ROL',0,0, 0x00
dw InstROT
db 'ROR',0,0, 0x01
dw InstROT
db 'RCL',0,0, 0x02
dw InstROT
db 'RCR',0,0, 0x03
dw InstROT
db 'SHL',0,0, 0x04
dw InstROT
db 'SHR',0,0, 0x05
dw InstROT
db 'SAR',0,0, 0x07
dw InstROT
; Stack instructions
db 'POP',0,0, 0x00
dw InstPOP
db 'POPA',0, 0x61
dw OutputByte
db 'PUSH',0, 0x00
dw InstPUSH
db 'PUSHA', 0x60
dw OutputByte
; String instructions
db 'MOVSB', 0xA4
dw OutputByte
db 'MOVSW', 0xA5
dw OutputByte
db 'STOSB', 0xAA
dw OutputByte
db 'LODSB', 0xAC
dw OutputByte
; Flow control
db 'RET',0,0, 0xC3
dw OutputByte
db 'INT',0,0, 0x00
dw InstINT
db 'CALL',0, 0x00
dw InstCALL
; JMP
db 'JMP',0,0, 0x00
dw InstJMP
; Conditional jump instructions (argument is condition code)
db 'JO',0,0,0, CC_O
dw InstJCC
db 'JNO',0,0, CC_NO
dw InstJCC
db 'JC',0,0,0, CC_C
dw InstJCC
db 'JB',0,0,0, CC_C
dw InstJCC
db 'JNC',0,0, CC_NC
dw InstJCC
db 'JNB',0,0, CC_NC
dw InstJCC
db 'JAE',0,0, CC_NC
dw InstJCC
db 'JZ',0,0,0, CC_Z
dw InstJCC
db 'JE',0,0,0, CC_Z
dw InstJCC
db 'JNZ',0,0, CC_NZ
dw InstJCC
db 'JNE',0,0, CC_NZ
dw InstJCC
db 'JNA',0,0, CC_NA
dw InstJCC
db 'JBE',0,0, CC_NA
dw InstJCC
db 'JA',0,0,0, CC_A
dw InstJCC
db 'JS',0,0,0, CC_S
dw InstJCC
db 'JNS',0,0, CC_NS
dw InstJCC
db 'JPE',0,0, CC_PE
dw InstJCC
db 'JPO',0,0, CC_PO
dw InstJCC
db 'JL',0,0,0, CC_L
dw InstJCC
db 'JNL',0,0, CC_NL
dw InstJCC
db 'JNG',0,0, CC_NG
dw InstJCC
db 'JG',0,0,0, CC_G
dw InstJCC
DispatchListEnd:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Data
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; TODO: To save a few bytes the following should just be 'resb'/'resw'
FirstFreeSeg: dw 0
;;; Parser
InputFile: dw 0 ; Input file handle
CurrentLine: dw 1 ; Current line being processed
NumNewLines: dw 0 ; Number of newlines passed by ReadNext
CurrentChar: db 0 ; Current input character (0 on EOF)
TokenLen: db 0
Token: db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
TokenEnd: db 0 ; NUL-terminator
; The last parsed operand is in OperandType/OperandValue
; Instructions with 2 operands have the left most operand saved in
; OperandLType/OperandLValue. CurrentFixup/CurrentLFixup holds
; any fixups needed for the operands (or INVALID_ADDR)
; See the EQUs at the top of the file for the meaning
OperandType: db 0
OperandValue: dw 0
CurrentFixup: dw 0
OperandLType: db 0
OperandLValue: dw 0
CurrentLFixup: dw 0
ExplicitSize: db 0 ; Explicit size of memory operand (0=none, 1=byte, 2=word)
LabelSeg: dw 0
NumLabels: dw 0
FixupSeg: dw 0
NextFreeFixup: dw 0 ; Points to next free fixup node (or INVALID_ADDR)
EquSeg: dw 0
NumEqus: dw 0
;;; Output
OutputSeg: dw 0
CurrentAddress: dw 0 ; Current memory address of code (e.g. 0x100 first in a COM file)
NumOutBytes: dw 0 ; Number of bytes output
;;; Keep last
ProgramEnd:
|
Epilog/asm/MSVC2015/func-rets-omitfp-stackp.asm | Dovgalyuk/AntiTaint | 1 | 12820 | ; Listing generated by Microsoft (R) Optimizing Compiler Version 19.00.23506.0
TITLE D:\Projects\TaintAnalysis\AntiTaint\Epilog\src\func-rets.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB MSVCRT
INCLUDELIB OLDNAMES
PUBLIC ___local_stdio_printf_options
PUBLIC __vfprintf_l
PUBLIC _printf
PUBLIC _func
PUBLIC _main
EXTRN __imp____acrt_iob_func:PROC
EXTRN __imp____stdio_common_vfprintf:PROC
EXTRN _gets:PROC
EXTRN @__security_check_cookie@4:PROC
EXTRN ___security_cookie:DWORD
_DATA SEGMENT
COMM ?_OptionsStorage@?1??__local_stdio_printf_options@@9@9:QWORD ; `__local_stdio_printf_options'::`2'::_OptionsStorage
_DATA ENDS
; Function compile flags: /Odtpy
; File d:\projects\taintanalysis\antitaint\epilog\src\func-rets.c
_TEXT SEGMENT
$T1 = -128 ; size = 20
$T2 = -108 ; size = 20
$T3 = -88 ; size = 20
_z$ = -68 ; size = 4
_b$ = -64 ; size = 20
_c$ = -44 ; size = 20
_a$ = -24 ; size = 20
__$ArrayPad$ = -4 ; size = 4
_main PROC
; 25 : {
push ebp
mov ebp, esp
sub esp, 128 ; 00000080H
mov eax, DWORD PTR ___security_cookie
xor eax, ebp
mov DWORD PTR __$ArrayPad$[ebp], eax
; 26 : struct S a,b,c;
; 27 : int z = 0;
mov DWORD PTR _z$[ebp], 0
; 28 : a = func();
lea eax, DWORD PTR $T3[ebp]
push eax
call _func
add esp, 4
mov ecx, DWORD PTR [eax]
mov DWORD PTR _a$[ebp], ecx
mov edx, DWORD PTR [eax+4]
mov DWORD PTR _a$[ebp+4], edx
mov ecx, DWORD PTR [eax+8]
mov DWORD PTR _a$[ebp+8], ecx
mov edx, DWORD PTR [eax+12]
mov DWORD PTR _a$[ebp+12], edx
mov eax, DWORD PTR [eax+16]
mov DWORD PTR _a$[ebp+16], eax
; 29 : z += a.a;
mov ecx, DWORD PTR _z$[ebp]
add ecx, DWORD PTR _a$[ebp]
mov DWORD PTR _z$[ebp], ecx
; 30 : b = func();
lea edx, DWORD PTR $T2[ebp]
push edx
call _func
add esp, 4
mov ecx, DWORD PTR [eax]
mov DWORD PTR _b$[ebp], ecx
mov edx, DWORD PTR [eax+4]
mov DWORD PTR _b$[ebp+4], edx
mov ecx, DWORD PTR [eax+8]
mov DWORD PTR _b$[ebp+8], ecx
mov edx, DWORD PTR [eax+12]
mov DWORD PTR _b$[ebp+12], edx
mov eax, DWORD PTR [eax+16]
mov DWORD PTR _b$[ebp+16], eax
; 31 : c = func();
lea ecx, DWORD PTR $T1[ebp]
push ecx
call _func
add esp, 4
mov edx, DWORD PTR [eax]
mov DWORD PTR _c$[ebp], edx
mov ecx, DWORD PTR [eax+4]
mov DWORD PTR _c$[ebp+4], ecx
mov edx, DWORD PTR [eax+8]
mov DWORD PTR _c$[ebp+8], edx
mov ecx, DWORD PTR [eax+12]
mov DWORD PTR _c$[ebp+12], ecx
mov edx, DWORD PTR [eax+16]
mov DWORD PTR _c$[ebp+16], edx
; 32 : z += c.c + b.b;
mov eax, DWORD PTR _c$[ebp+8]
add eax, DWORD PTR _b$[ebp+4]
add eax, DWORD PTR _z$[ebp]
mov DWORD PTR _z$[ebp], eax
; 33 : return z;
mov eax, DWORD PTR _z$[ebp]
; 34 : }
mov ecx, DWORD PTR __$ArrayPad$[ebp]
xor ecx, ebp
call @__security_check_cookie@4
mov esp, ebp
pop ebp
ret 0
_main ENDP
_TEXT ENDS
; Function compile flags: /Odtpy
; File d:\projects\taintanalysis\antitaint\epilog\src\func-rets.c
_TEXT SEGMENT
_s$ = -32 ; size = 20
_buf$ = -12 ; size = 8
__$ArrayPad$ = -4 ; size = 4
$T1 = 8 ; size = 4
_func PROC
; 15 : {
push ebp
mov ebp, esp
sub esp, 32 ; 00000020H
mov eax, DWORD PTR ___security_cookie
xor eax, ebp
mov DWORD PTR __$ArrayPad$[ebp], eax
; 16 : char buf[8];
; 17 : struct S s;
; 18 : s.a = (int)gets(buf) - (int)buf;
lea eax, DWORD PTR _buf$[ebp]
push eax
call _gets
add esp, 4
lea ecx, DWORD PTR _buf$[ebp]
sub eax, ecx
mov DWORD PTR _s$[ebp], eax
; 19 : s.b = printf(buf);
lea edx, DWORD PTR _buf$[ebp]
push edx
call _printf
add esp, 4
mov DWORD PTR _s$[ebp+4], eax
; 20 : s.c = s.a + s.b;
mov eax, DWORD PTR _s$[ebp]
add eax, DWORD PTR _s$[ebp+4]
mov DWORD PTR _s$[ebp+8], eax
; 21 : return s;
mov ecx, DWORD PTR $T1[ebp]
mov edx, DWORD PTR _s$[ebp]
mov DWORD PTR [ecx], edx
mov eax, DWORD PTR _s$[ebp+4]
mov DWORD PTR [ecx+4], eax
mov edx, DWORD PTR _s$[ebp+8]
mov DWORD PTR [ecx+8], edx
mov eax, DWORD PTR _s$[ebp+12]
mov DWORD PTR [ecx+12], eax
mov edx, DWORD PTR _s$[ebp+16]
mov DWORD PTR [ecx+16], edx
mov eax, DWORD PTR $T1[ebp]
; 22 : }
mov ecx, DWORD PTR __$ArrayPad$[ebp]
xor ecx, ebp
call @__security_check_cookie@4
mov esp, ebp
pop ebp
ret 0
_func ENDP
_TEXT ENDS
; Function compile flags: /Odtpy
; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\stdio.h
; COMDAT _printf
_TEXT SEGMENT
__Result$ = -8 ; size = 4
__ArgList$ = -4 ; size = 4
__Format$ = 8 ; size = 4
_printf PROC ; COMDAT
; 950 : {
push ebp
mov ebp, esp
sub esp, 8
; 951 : int _Result;
; 952 : va_list _ArgList;
; 953 : __crt_va_start(_ArgList, _Format);
lea eax, DWORD PTR __Format$[ebp+4]
mov DWORD PTR __ArgList$[ebp], eax
; 954 : _Result = _vfprintf_l(stdout, _Format, NULL, _ArgList);
mov ecx, DWORD PTR __ArgList$[ebp]
push ecx
push 0
mov edx, DWORD PTR __Format$[ebp]
push edx
push 1
call DWORD PTR __imp____acrt_iob_func
add esp, 4
push eax
call __vfprintf_l
add esp, 16 ; 00000010H
mov DWORD PTR __Result$[ebp], eax
; 955 : __crt_va_end(_ArgList);
mov DWORD PTR __ArgList$[ebp], 0
; 956 : return _Result;
mov eax, DWORD PTR __Result$[ebp]
; 957 : }
mov esp, ebp
pop ebp
ret 0
_printf ENDP
_TEXT ENDS
; Function compile flags: /Odtpy
; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\stdio.h
; COMDAT __vfprintf_l
_TEXT SEGMENT
__Stream$ = 8 ; size = 4
__Format$ = 12 ; size = 4
__Locale$ = 16 ; size = 4
__ArgList$ = 20 ; size = 4
__vfprintf_l PROC ; COMDAT
; 638 : {
push ebp
mov ebp, esp
; 639 : return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Stream, _Format, _Locale, _ArgList);
mov eax, DWORD PTR __ArgList$[ebp]
push eax
mov ecx, DWORD PTR __Locale$[ebp]
push ecx
mov edx, DWORD PTR __Format$[ebp]
push edx
mov eax, DWORD PTR __Stream$[ebp]
push eax
call ___local_stdio_printf_options
mov ecx, DWORD PTR [eax+4]
push ecx
mov edx, DWORD PTR [eax]
push edx
call DWORD PTR __imp____stdio_common_vfprintf
add esp, 24 ; 00000018H
; 640 : }
pop ebp
ret 0
__vfprintf_l ENDP
_TEXT ENDS
; Function compile flags: /Odtpy
; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\corecrt_stdio_config.h
; COMDAT ___local_stdio_printf_options
_TEXT SEGMENT
___local_stdio_printf_options PROC ; COMDAT
; 73 : {
push ebp
mov ebp, esp
; 74 : static unsigned __int64 _OptionsStorage;
; 75 : return &_OptionsStorage;
mov eax, OFFSET ?_OptionsStorage@?1??__local_stdio_printf_options@@9@9 ; `__local_stdio_printf_options'::`2'::_OptionsStorage
; 76 : }
pop ebp
ret 0
___local_stdio_printf_options ENDP
_TEXT ENDS
END
|
file_system/temporaryPath.applescript | adriannier/applescript-functions | 7 | 1035 | <filename>file_system/temporaryPath.applescript
(*
Generates a unique path for a file in the current user's temporary items folder.
*)
temporaryPath()
on temporaryPath()
-- Generate pseudorandom numbers
set rand1 to (round (random number from 100 to 999)) as text
set rand2 to (round (random number from 100 to 999)) as text
set randomText to rand1 & "-" & rand2
-- Create file name
set fileName to (("AppleScriptTempFile_" & randomText) as text)
-- Get the path to the parent folder
set parentFolderPath to (path to temporary items folder from user domain) as text
-- Make sure the file does not exist
set rNumber to 1
repeat
if rNumber is 1 then
set tempFilePath to parentFolderPath & fileName
else
set tempFilePath to parentFolderPath & fileName & "_" & (rNumber as text)
end if
tell application "System Events" to if (exists file tempFilePath) is false then exit repeat
set rNumber to rNumber + 1
end repeat
return tempFilePath
end temporaryPath |
Transynther/x86/_processed/US/_st_zr_/i9-9900K_12_0xca_notsx.log_43_1266.asm | ljhsiun2/medusa | 9 | 88869 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0xf6e, %r8
nop
nop
nop
nop
nop
add %rdx, %rdx
mov (%r8), %rcx
nop
nop
nop
nop
nop
inc %r11
lea addresses_WT_ht+0x28ee, %rsi
lea addresses_D_ht+0x122e, %rdi
nop
sub $16200, %r9
mov $70, %rcx
rep movsw
nop
nop
nop
nop
nop
cmp %rsi, %rsi
lea addresses_A_ht+0x19e3c, %rsi
lea addresses_WT_ht+0x191aa, %rdi
nop
nop
and $55470, %r13
mov $2, %rcx
rep movsw
nop
nop
nop
add $45012, %rcx
lea addresses_WT_ht+0x356e, %r8
cmp $2978, %rdi
mov (%r8), %r13
cmp %r8, %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
// Load
lea addresses_D+0x1016e, %rax
nop
nop
nop
nop
nop
and %rsi, %rsi
vmovups (%rax), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %rdi
add $233, %rdi
// Store
lea addresses_A+0x56e, %r9
and %rcx, %rcx
movw $0x5152, (%r9)
nop
nop
nop
nop
nop
sub %rax, %rax
// Load
lea addresses_PSE+0x526e, %r9
sub $47924, %r8
mov (%r9), %edi
nop
nop
nop
nop
nop
sub %rcx, %rcx
// Store
lea addresses_WT+0xb86e, %rbx
nop
nop
nop
nop
cmp %rax, %rax
mov $0x5152535455565758, %r9
movq %r9, (%rbx)
nop
nop
nop
nop
inc %rbx
// Load
lea addresses_normal+0xf57e, %rbx
sub $53547, %rcx
mov (%rbx), %rax
nop
nop
nop
inc %r8
// Store
lea addresses_WT+0x19f6e, %r9
nop
nop
nop
nop
cmp $31645, %rax
mov $0x5152535455565758, %rdi
movq %rdi, (%r9)
nop
nop
nop
nop
add $30548, %rdi
// REPMOV
lea addresses_WT+0xca36, %rsi
lea addresses_D+0xa2ee, %rdi
nop
add %r8, %r8
mov $64, %rcx
rep movsb
nop
add $21367, %rdi
// Faulty Load
lea addresses_US+0x3f6e, %rax
nop
and $59343, %r8
mov (%rax), %r9
lea oracles, %r8
and $0xff, %r9
shlq $12, %r9
mov (%r8,%r9,1), %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_D'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_D_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8}}
{'00': 22, '58': 21}
00 00 58 00 58 00 58 00 58 00 58 00 58 00 58 00 00 58 00 58 00 58 58 00 58 00 58 00 58 00 58 00 58 00 58 00 58 00 58 00 58 00 58
*/
|
lib/target/pps/classic/pps_crt0.asm | dikdom/z88dk | 1 | 90844 | ; Kludgey startup for Peters Plus Sprinter
;
; djm 18/5/99
;
; $Id: pps_crt0.asm $
;
MODULE pps_crt0
defc crt0 = 1
INCLUDE "zcc_opt.def"
EXTERN _main ;main() is always external to crt0 code
PUBLIC cleanup ;jp'd to by exit()
PUBLIC l_dcal ;jp(hl)
;--------
; Set an origin for the application (-zorg=) default to $8100
;--------
IF !DEFINED_CRT_ORG_CODE
defc CRT_ORG_CODE = $8100
ENDIF
defc CONSOLE_ROWS = 32
defc CONSOLE_COLUMNS = 80
defc TAR__no_ansifont = 1
defc TAR__fputc_cons_generic = 1
defc TAR__clib_exit_stack_size = 32
defc TAR__register_sp = -1
defc __CPU_CLOCK = 6000000
INCLUDE "crt/classic/crt_rules.inc"
org CRT_ORG_CODE - 512
defw $5845 ;EXE signature
defb $45 ;Reserved (EXE type)
defb $00 ;Version of EXE file
defq 512 ;Offset to code
defw 0 ;Primary loader size or 0 (no primary loader)
defq 0 ;Reserved
defw 0 ;Reserved
defw start ;Loading address
defw start ;Starting address
defw $bfff ;Stack
defs 490 ;Reserved space
start:
ld (__restore_sp_onexit+1),sp ;Save entry stack
INCLUDE "crt/classic/crt_init_sp.asm"
INCLUDE "crt/classic/crt_init_atexit.asm"
call crt0_init_bss
ld (exitsp),sp
IF DEFINED_USING_amalloc
INCLUDE "crt/classic/crt_init_amalloc.asm"
ENDIF
ld (start_prefix),ix
ld de,0
ld hl,$2350
ld b,7
ld a,' '
ld c,$56 ;CLEAR
rst $10
; Work out argc/argv - same as the CPM version
IF CRT_ENABLE_COMMANDLINE = 1
ld hl,0 ; NULL pointer at the end
push hl
ld b,0 ;arguments
ld hl,(start_prefix)
ld a,(hl) ;length of arguments
and a
jp z,argv_done
ld c,a
add hl,bc ;now points to end of arguments
INCLUDE "crt/classic/crt_command_line.asm"
push hl ;argv
push bc ;argc
ELSE
ld hl,0
push hl ;argv
push hl ;argc
ENDIF
call _main ;Call user code
pop bc ;kill argv
pop bc ;kill argc
cleanup:
push hl ;save return code
call crt0_exit
pop bc
__restore_sp_onexit:
ld sp,0 ;Restore stack to entry value
ld bc,$41 ;exit with - error code
rst $10
ret
l_dcal:
jp (hl) ;Used for function pointer calls
INCLUDE "crt/classic/crt_runtime_selection.asm"
INCLUDE "crt/classic/crt_section.asm"
SECTION bss_crt
start_prefix:
defw 0 ; Entry handle from OS
|
Task/LZW-compression/Ada/lzw-compression-3.ada | LaudateCorpus1/RosettaCodeData | 1 | 10416 | with LZW;
with Ada.Text_IO;
procedure Test is
package Text_IO renames Ada.Text_IO;
package Code_IO is new Ada.Text_IO.Integer_IO (LZW.Codes);
Test_Data : constant LZW.Compressed_Data :=
LZW.Compress ("TOBEORNOTTOBEORTOBEORNOT");
begin
for Index in Test_Data'Range loop
Code_IO.Put (Test_Data (Index), 0);
Text_IO.Put (" ");
end loop;
Text_IO.New_Line;
declare
Cleartext : constant String := LZW.Decompress (Test_Data);
begin
Text_IO.Put_Line (Cleartext);
end;
end Test;
|
test/interaction/Issue2749.agda | cruhland/agda | 1,989 | 16450 | <reponame>cruhland/agda<gh_stars>1000+
{-# OPTIONS --no-unicode #-}
module Issue2749 where
-- testing ascii only lambda and arrow
id : {A : Set} -> A -> A
id = {!!}
-- testing ascii only double braces
it : {A : Set} {{a : A}} → A → A
it = {!!}
data B : Set where
mkB : B → B → B
-- testing ascii only suffixes
left : B → B
left b1 = {!!}
open import Agda.Builtin.Equality
-- testing ascii only forall
allq : (∀ m n → m ≡ n) ≡ {!!}
allq = refl
|
programs/oeis/071/A071030.asm | neoneye/loda | 22 | 97366 | ; A071030: Triangle read by rows giving successive states of cellular automaton generated by "Rule 54".
; 1,1,1,1,1,0,0,0,1,1,1,1,0,1,1,1,1,0,0,0,1,0,0,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1
mov $2,1
add $2,$0
mov $4,2
lpb $4
sub $0,1
div $4,13
lpb $0
mov $7,$0
sub $0,1
add $3,1
add $6,$2
add $5,$6
div $7,$3
add $5,$7
lpe
lpe
sub $1,$5
add $1,1
mod $1,2
add $1,2
mod $1,2
mov $0,$1
|
oeis/045/A045393.asm | neoneye/loda-programs | 11 | 91905 | <filename>oeis/045/A045393.asm
; A045393: Primes congruent to {0, 1, 3, 4, 5, 6} mod 7.
; Submitted by <NAME>
; 3,5,7,11,13,17,19,29,31,41,43,47,53,59,61,67,71,73,83,89,97,101,103,109,113,127,131,137,139,151,157,167,173,179,181,193,197,199,211,223,227,229,239,241,251,257,263,269,271,277,281,283,293,307,311,313,337,347,349,353,367,379,383,389,397,409,419,421,431,433,439,449,461,463,467,479,487,491,503,509,521,523,547,557,563,571,577,587,593,599,601,607,613,617,619,631,641,643,647,659
mov $2,332202
mov $5,-2
lpb $2
mov $3,$6
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,7
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
sub $2,18
add $5,$1
div $5,7
mov $6,$5
lpe
mov $0,$5
add $0,1
|
evernote/get selected note of evernote.applescript | kinshuk4/evernote-automation | 4 | 1171 | <reponame>kinshuk4/evernote-automation<filename>evernote/get selected note of evernote.applescript<gh_stars>1-10
tell application "Evernote"
try
set theNotes to selection
set note1 to first item in theNotes
get title of note1
end try
end tell |
src/db-language/db_language.g4 | e90r/formal_languages_course | 0 | 602 | grammar db_language;
/*
* parser rules
*/
script : (stmt ';')* EOF ;
stmt : CONNECT '"' PATH '"'
| STRING ':' pattern
| SELECT obj FROM graph
;
graph : GRAMMAR
| '[' pattern ']'
| '"' NAME '"'
| '(' SET_START_FINAL vertices vertices graph ')'
| '(' graph AND graph ')'
;
vertices : '{' index_set '}'
| INT ':' INT
| ANY
;
index_set : (INT ',')* INT ;
obj : edges
| COUNT edges
;
edges : EDGES
| FILTER cond ':' edges
;
cond : '(' STRING ',' STRING ',' STRING ')' ARROW '(' bool_expr ')' ;
bool_expr : STRING HAS_LBL STRING
| IS_START STRING
| IS_FINAL STRING
| '(' bool_expr ')'
| NEG bool_expr
| bool_expr AND bool_expr
| bool_expr OR bool_expr
;
pattern : TERM '(' STRING ')'
| NONTERM '(' STRING ')'
| EPS
| '(' pattern ')'
| pattern STAR
| pattern PLUS
| pattern OPT
| pattern pattern
| pattern OR pattern
;
/*
* lexer rules
*/
fragment LOWERCASE : [a-z] ;
fragment UPPERCASE : [A-Z] ;
fragment DIGIT : [0-9] ;
INT : '0' | [1-9] DIGIT* ;
AND : '&' ;
ANY : '_' ;
NEG : '!' ;
OR : '|' ;
STAR : '*' ;
PLUS : '+' ;
OPT : '?' ;
CONNECT : 'connect' ;
SELECT : 'select' ;
FROM : 'from' ;
GRAMMAR : 'grammar' ;
SET_START_FINAL : 'setStartAndFinal' ;
COUNT : 'count' ;
EDGES : 'edges' ;
FILTER : 'filter' ;
ARROW : '->' ;
HAS_LBL : 'hasLbl' ;
IS_START : 'isStart' ;
IS_FINAL : 'isFinal' ;
TERM : 'term' ;
NONTERM : 'var' ;
EPS : 'eps' ;
STRING : (LOWERCASE | UPPERCASE) (LOWERCASE | UPPERCASE | DIGIT | '_')* ;
PATH : (LOWERCASE | UPPERCASE | DIGIT | '_' | '/')+ ;
NAME : (LOWERCASE | UPPERCASE | DIGIT | '_' | '.')+ ;
WHITESPACE : [ \r\n\t]+ -> skip ; |
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr24.adb | best08618/asylo | 7 | 73 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr24.adb
-- { dg-do run }
-- { dg-options "-gnatp" }
procedure Discr24 is
type Family_Type is (Family_Inet, Family_Inet6);
type Port_Type is new Natural;
subtype Inet_Addr_Comp_Type is Natural range 0 .. 255;
type Inet_Addr_VN_Type is array (Natural range <>) of Inet_Addr_Comp_Type;
subtype Inet_Addr_V4_Type is Inet_Addr_VN_Type (1 .. 4);
subtype Inet_Addr_V6_Type is Inet_Addr_VN_Type (1 .. 16);
type Inet_Addr_Type (Family : Family_Type := Family_Inet) is record
case Family is
when Family_Inet =>
Sin_V4 : Inet_Addr_V4_Type := (others => 0);
when Family_Inet6 =>
Sin_V6 : Inet_Addr_V6_Type := (others => 0);
end case;
end record;
type Sock_Addr_Type (Family : Family_Type := Family_Inet) is record
Addr : Inet_Addr_Type (Family);
Port : Port_Type;
end record;
function F return Inet_Addr_Type is
begin
return Inet_Addr_Type'
(Family => Family_Inet, Sin_V4 => (192, 168, 169, 170));
end F;
SA : Sock_Addr_Type;
begin
SA.Addr.Sin_V4 := (172, 16, 17, 18);
SA.Port := 1111;
SA.Addr := F;
if SA.Port /= 1111 then
raise Program_Error;
end if;
end;
|
tlsf/src/proof/model/tlsf-proof-model.ads | vasil-sd/ada-tlsf | 3 | 7872 | package TLSF.Proof.Model with SPARK_Mode, Pure, Preelaborate, Ghost is
end TLSF.Proof.Model;
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_21829_1337.asm | ljhsiun2/medusa | 9 | 241989 | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %r8
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x18309, %rbx
nop
inc %rsi
movb $0x61, (%rbx)
nop
nop
nop
xor $10968, %rsi
lea addresses_UC_ht+0x13449, %r14
nop
nop
dec %r8
movl $0x61626364, (%r14)
nop
nop
and %rdx, %rdx
lea addresses_WT_ht+0x1f49, %rcx
nop
nop
nop
cmp $7281, %r15
vmovups (%rcx), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rbx
nop
nop
nop
dec %r8
lea addresses_WC_ht+0xa149, %rdx
nop
nop
nop
nop
nop
add %rcx, %rcx
mov $0x6162636465666768, %rbx
movq %rbx, (%rdx)
nop
nop
nop
nop
xor $3445, %r8
lea addresses_WT_ht+0x170c9, %r14
nop
nop
dec %rsi
mov (%r14), %rcx
nop
nop
nop
nop
xor $2766, %rsi
lea addresses_normal_ht+0x3449, %rsi
lea addresses_WC_ht+0x17da7, %rdi
nop
xor %rbx, %rbx
mov $72, %rcx
rep movsl
nop
nop
sub %rcx, %rcx
lea addresses_A_ht+0x1d049, %r8
nop
and %rbx, %rbx
mov (%r8), %di
nop
nop
nop
nop
nop
dec %rdx
lea addresses_UC_ht+0x9b49, %rsi
lea addresses_normal_ht+0x3a49, %rdi
nop
nop
cmp $29617, %rbx
mov $74, %rcx
rep movsw
nop
nop
xor %r15, %r15
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r8
push %rbp
push %rcx
push %rsi
// Store
lea addresses_A+0x1d689, %r10
add $40241, %r11
mov $0x5152535455565758, %r12
movq %r12, (%r10)
nop
nop
nop
and $54541, %rbp
// Store
lea addresses_A+0x8e69, %r11
nop
nop
and %rbp, %rbp
mov $0x5152535455565758, %r12
movq %r12, %xmm5
vmovups %ymm5, (%r11)
nop
nop
nop
nop
nop
sub %r10, %r10
// Faulty Load
mov $0x7f32f0000000449, %r8
nop
nop
nop
nop
nop
sub %rsi, %rsi
movb (%r8), %r11b
lea oracles, %r12
and $0xff, %r11
shlq $12, %r11
mov (%r12,%r11,1), %r11
pop %rsi
pop %rcx
pop %rbp
pop %r8
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 4}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': True, 'type': 'addresses_NC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': True, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_UC_ht', 'congruent': 8}, 'dst': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 9}}
{'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
*/
|
oeis/253/A253083.asm | neoneye/loda-programs | 11 | 84976 | ; A253083: Partial sums of A227349.
; Submitted by <NAME>
; 1,2,3,5,6,7,9,12,13,14,15,17,19,21,24,28,29,30,31,33,34,35,37,40,42,44,46,50,53,56,60,65,66,67,68,70,71,72,74,77,78,79,80,82,84,86,89,93,95,97,99,103,105,107,111,117,120,123,126,132,136,140,145,151,152,153,154,156,157,158,160,163,164,165,166,168,170,172,175,179,180,181,182,184,185,186,188,191,193,195,197,201,204,207,211,216,218,220,222,226
lpb $0
mov $2,$0
sub $0,1
seq $2,227349 ; Product of lengths of runs of 1-bits in binary representation of n.
add $1,$2
lpe
add $1,1
mov $0,$1
|
programs/oeis/120/A120689.asm | neoneye/loda | 22 | 3736 | <filename>programs/oeis/120/A120689.asm
; A120689: a(n) = 10*a(n-1) - 16*a(n-2), n>0.
; 0,3,30,252,2040,16368,131040,1048512,8388480,67108608,536870400,4294966272,34359736320,274877902848,2199023247360,17592186028032,140737488322560,1125899906777088,9007199254609920,72057594037665792
mov $1,2
pow $1,$0
add $1,1
bin $1,3
mul $1,3
mov $0,$1
|
code/non1996/7.asm | KongoHuster/assembly-exercise | 1 | 171371 | DATA SEGMENT
ORG 0E000H ;(1)
ARRAY_BYTE LABEL BYTE
ARRAY_WORD LABEL WORD
ARRAY DB 100 DUP(0) ;(2)
DATA ENDS
STACK SEGMENT STACK
ALIGN 16
DW 100H DUP(0)
STACK ENDS
CODE SEGMENT
ASSUME CS:CODE DS:DATA
ORG 1000H
START:
MOV AX, DATA
MOV DS, AX
MOV AX, STACK
MOV SS, AX
MOV AX, 4CH
INT 21H
CODE ENDS
END START |
src/main/antlr/deltix/luminary/grammar/Luminary.g4 | DeltixInc/Luminary-JetBrains-Plugin | 1 | 164 | grammar Luminary;
protocol
: namespace import_or_option* typeDefinition* EOF
;
namespace
: NAMESPACE qualifiedName SEMICOLON
;
import_or_option
: importStatement
| option
;
importStatement
: IMPORT qualifiedName PERIOD IDENTIFIER SEMICOLON # ImportType
| IMPORT qualifiedName PERIOD ASTERISK SEMICOLON # ImportEverything
| IMPORT qualifiedName PERIOD IDENTIFIER AS IDENTIFIER SEMICOLON # ImportTypeWithAlias
;
option
: OPTION IDENTIFIER EQUALS_SIGN constantValue SEMICOLON
;
qualifiedName
: IDENTIFIER ( PERIOD IDENTIFIER )*
;
typeDefinition
: enumerationDefinition
| classDefinition
| interfaceDefinition
| decoratorDefinition
;
// Definition of Decorator
decoratorDefinition
: decorators? DECORATOR IDENTIFIER OPENING_CURLY_BRACKET decoratorEntry* CLOSING_CURLY_BRACKET
;
decoratorEntry
: decoratorProperty
| typeDefinition
;
decoratorProperty
: decorators? type IDENTIFIER (SEMICOLON | ( EQUALS_SIGN constantValue ) SEMICOLON)
;
// Definition of Interface
interfaceDefinition
: decorators? INTERFACE IDENTIFIER ( COLON supertypeList )? OPENING_CURLY_BRACKET interfaceEntry* CLOSING_CURLY_BRACKET
;
supertypeList
: type ( COMMA supertypeList )?
;
interfaceEntry
: interfaceProperty
| interfaceMethod
| typeDefinition
;
interfaceProperty
: decorators? OVERRIDE? type IDENTIFIER GET SET? SEMICOLON
;
interfaceMethod
: decorators? returnType IDENTIFIER OPENING_PARENTHESIS formalParameters? CLOSING_PARENTHESIS SEMICOLON
;
formalParameters
: formalFixedParameter ( COMMA formalFixedParameter)* ( COMMA formalArrayParameter )?
| formalArrayParameter
;
formalFixedParameter
: decorators? type IDENTIFIER
;
formalArrayParameter
: decorators? type ELLIPSIS IDENTIFIER
;
// Definition of Class
classDefinition
: decorators? FINAL? CLASS IDENTIFIER ( COLON supertypeList )? OPENING_CURLY_BRACKET classEntry* CLOSING_CURLY_BRACKET
;
classEntry
: classProperty
| typeDefinition
| constantDefinition
;
classProperty
: decorators? FINAL? OVERRIDE? classPropertyDecl SEMICOLON
;
classPropertyDecl
: type IDENTIFIER
| type IDENTIFIER equalConstant;
equalConstant
: EQUALS_SIGN constantValue
;
constantDefinition
: decorators? CONST type IDENTIFIER EQUALS_SIGN constantValue SEMICOLON
;
// Definition of Enumeration
enumerationDefinition
: decorators? ENUM IDENTIFIER ( COLON IDENTIFIER )? OPENING_CURLY_BRACKET enumerationMember+ CLOSING_CURLY_BRACKET
;
enumerationMember
: decorators? enumerationIdentifier EQUALS_SIGN constantValue SEMICOLON
;
enumerationIdentifier
: IDENTIFIER
;
// Type
returnType
: VOID
| type
;
type
: complexType
// | builtinType
;
//builtinType
// : SIMPLE_TYPE
// | list_type
// ;
// Decorators
decorators
: ( OPENING_SQUARE_BRACKET decorator ( COMMA decorator )* CLOSING_SQUARE_BRACKET )+
;
decorator
: normalDecorator
| markerDecorator
| singleElementDecorator
;
normalDecorator
: qualifiedName OPENING_PARENTHESIS keyValuePair ( COMMA keyValuePair )* CLOSING_PARENTHESIS
| qualifiedName OPENING_PARENTHESIS CLOSING_PARENTHESIS
;
markerDecorator
: qualifiedName
;
singleElementDecorator
: qualifiedName OPENING_PARENTHESIS constantValue CLOSING_PARENTHESIS
;
keyValuePair
: IDENTIFIER EQUALS_SIGN constantValue
;
constantValue
: STRING_LITERAL # String
| CHAR_LITERAL # Char
| INTEGRAL_LITERAL # Integer
| BINARY_FLOATING_POINT_LITERAL # Float
| DECIMAL_FLOATING_POINT_LITERAL # Decimal
| qualifiedName # MemberReference
| TYPEOF OPENING_PARENTHESIS type CLOSING_PARENTHESIS # TypeReference
| TRUE # True
| FALSE # False
| NULL # Null
| OPENING_CURLY_BRACKET constantValueList? CLOSING_CURLY_BRACKET # Array
;
constantValueList
: constantValue ( COMMA constantValue )*
;
primary
: IDENTIFIER
| constantValue
| qualifiedName
;
//list_type
// : LIST_TYPE LESS_THAN_SIGN ( SIMPLE_TYPE | list_type | qualifiedName | IDENTIFIER | complexType) GREATER_THAN_SIGN QUESTION_MARK?;
complexType
: qualifiedName QUESTION_MARK?
| IDENTIFIER LESS_THAN_SIGN type ( COMMA type )* GREATER_THAN_SIGN QUESTION_MARK?
;
ASTERISK: '*';
CLOSING_CURLY_BRACKET: '}';
CLOSING_PARENTHESIS: ')';
CLOSING_SQUARE_BRACKET: ']';
COLON: ':';
COMMA: ',';
EQUALS_SIGN: '=';
GREATER_THAN_SIGN: '>';
LESS_THAN_SIGN: '<';
OPENING_CURLY_BRACKET: '{';
OPENING_PARENTHESIS: '(';
OPENING_SQUARE_BRACKET: '[';
ELLIPSIS: '...';
PERIOD: '.';
QUESTION_MARK: '?';
SEMICOLON: ';';
// Keywords
AS: 'as';
CLASS: 'class';
CONST: 'const';
DECORATOR: 'decorator';
ENUM: 'enum';
FALSE: 'false';
GET: 'get';
IMPORT: 'import';
INTERFACE: 'interface';
NAMESPACE: 'namespace';
NULL: 'null';
OPTION: 'option';
OVERRIDE: 'override';
SET: 'set';
TRUE: 'true';
TYPEOF: 'typeof';
VOID: 'void';
FINAL: 'final';
// types
//SIMPLE_TYPE: (INT_TYPE | BOOLEAN_TYPE | FLOAT_TYPE | TEXT_TYPE |
// BINARY_TYPE | TIMESTAMP_TYPE | DURATION_TYPE | DATE_TYPE |
// TIME_TYPE | DECIMAL_TYPE | TYPE_TYPE | UUID_TYPE)'?'?;
//INT_TYPE: 'U'?'Int'('8'|'16'|'32'|'64');
//BOOLEAN_TYPE: 'Boolean';
//FLOAT_TYPE: 'Float'('32'|'64');
//TEXT_TYPE: 'Text';
//BINARY_TYPE: 'Data';
//TIMESTAMP_TYPE: 'Timestamp';
//DURATION_TYPE: 'Duration';
//DATE_TYPE: 'Date';
//TIME_TYPE: 'Time';
//DECIMAL_TYPE: 'Decimal';
//TYPE_TYPE: 'Type';
//UUID_TYPE: 'UUID';
//LIST_TYPE: 'List';
// Literals
STRING_LITERAL: '"' CHARACTERS? '"';
CHAR_LITERAL: '\'' CHARACTER '\'';
INTEGRAL_LITERAL: '-'? INTEGRAL_LITERAL_DIGITS ( 'i64' | 'i32'? | 'i16' | 'i8' ) |
INTEGRAL_LITERAL_DIGITS ( 'u64' | 'u32' | 'u16' | 'u8' );
BINARY_FLOATING_POINT_LITERAL: '-'? DEC_DIGITS PERIOD DEC_DIGITS? EXPONENT_PART? '-'* FLOATING_TYPE_SUFFIX? |
'-'? PERIOD DEC_DIGITS EXPONENT_PART? '-'* FLOATING_TYPE_SUFFIX? |
'-'? DEC_DIGITS EXPONENT_PART '-'* FLOATING_TYPE_SUFFIX? |
'-'? DEC_DIGITS '-'* FLOATING_TYPE_SUFFIX;
DECIMAL_FLOATING_POINT_LITERAL: '-'? DEC_DIGITS PERIOD DEC_DIGITS? EXPONENT_PART? '-'* DECIMAL_TYPE_SUFFIX |
'-'? PERIOD DEC_DIGITS EXPONENT_PART? '-'* DECIMAL_TYPE_SUFFIX |
'-'? DEC_DIGITS EXPONENT_PART '-'* DECIMAL_TYPE_SUFFIX |
'-'? DEC_DIGITS '-'* DECIMAL_TYPE_SUFFIX;
// Identifier
IDENTIFIER: [a-zA-Z] [_a-zA-Z0-9]*;
// Fragments
fragment EXPONENT_PART: ('e'|'E')? DEC_INTEGER;
fragment FLOATING_TYPE_SUFFIX: ('f64' | 'f32');
fragment DECIMAL_TYPE_SUFFIX: ('d64');
fragment INTEGRAL_LITERAL_DIGITS: HEX_INTEGER | DEC_INTEGER | OCT_INTEGER | BIN_INTEGER;
fragment DEC_DIGITS: [0-9][0-9_]*;
fragment HEX_INTEGER: '0x' [0-9a-fA-F_]+;
fragment DEC_INTEGER: ('0' | [1-9][0-9_]*);
fragment OCT_INTEGER: '0o' [0-7_]+;
fragment BIN_INTEGER: '0b' [0-1_]+;
fragment CHARACTERS: (~[\\\r\n"] | '\\' ['"?abfnrtv\\])*;
fragment CHARACTER: (~[\\\r\n'] | '\\' ['"?abfnrtv\\]);
// Whitespaces and Comments
WHITESPACE: [ \t]+ -> channel(HIDDEN);
NEW_LINE: ('\r' '\n' | '\n') -> channel(HIDDEN);
DOCUMENTATION_COMMENTS: '///' ~[\r\n]* -> channel(HIDDEN);
SINGLE_LINE_COMMENT: '//' .*? ('\n'|EOF) -> channel(HIDDEN);
MULTI_LINE_COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
/** "catch all" rule for any char not matche in a token rule of your
* grammar. Lexers in Intellij must return all tokens good and bad.
* There must be a token to cover all characters, which makes sense, for
* an IDE. The parser however should not see these bad tokens because
* it just confuses the issue. Hence, the hidden channel.
*/
ERRCHAR
: . -> channel(HIDDEN)
;
|
src/SecondOrder/Theory.agda | andrejbauer/formal | 1 | 4244 | <filename>src/SecondOrder/Theory.agda
open import Agda.Primitive using (lzero; lsuc; _⊔_)
import SecondOrder.Arity
import SecondOrder.Signature
import SecondOrder.Metavariable
import SecondOrder.Renaming
import SecondOrder.Term
module SecondOrder.Theory
{ℓ}
{𝔸 : SecondOrder.Arity.Arity}
(Σ : SecondOrder.Signature.Signature ℓ 𝔸)
where
open SecondOrder.Metavariable Σ public
open SecondOrder.Term Σ public
open SecondOrder.Signature.Signature Σ public
open SecondOrder.Renaming Σ
record Axiom : Set ℓ where
constructor make-ax
field
ax-mv-ctx : MContext -- metavariable context of an equation
ax-sort : sort -- sort of an equation
ax-lhs : Term ax-mv-ctx ctx-empty ax-sort -- left-hand side
ax-rhs : Term ax-mv-ctx ctx-empty ax-sort -- right-hand side
record Theory ℓa : Set (lsuc (ℓ ⊔ ℓa)) where
field
ax : Set ℓa -- the axioms
ax-eq : ax → Axiom -- each axiom has a corresponding Axiom
ax-mv-ctx : ax → MContext -- the meta-context of each axiom
ax-mv-ctx ε = Axiom.ax-mv-ctx (ax-eq ε)
ax-sort : ax → sort -- the sort of each axiom
ax-sort ε = Axiom.ax-sort (ax-eq ε)
-- the left- and right-hand side of each axiom s ≈ t, promoted to any context
ax-lhs : ∀ (ε : ax) {Γ} → Term (ax-mv-ctx ε) Γ (ax-sort ε)
ax-lhs ε = [ inʳ ]ʳ Axiom.ax-lhs (ax-eq ε)
ax-rhs : ∀ (ε : ax) {Γ} → Term (ax-mv-ctx ε) Γ (ax-sort ε)
ax-rhs ε = [ inʳ ]ʳ Axiom.ax-rhs (ax-eq ε)
|
libsrc/_DEVELOPMENT/adt/ba_priority_queue/z80/__b_heap_sift_up.asm | jpoikela/z88dk | 640 | 13932 | SECTION code_clib
SECTION code_adt_ba_priority_queue
PUBLIC __b_heap_sift_up
EXTERN l_compare_de_hl, error_znc
__b_heap_sift_up:
; assumes 1-based array
;
; enter : de = start_index in bytes
; hl = & array[start_index]
; bc = array
; ix = compare
;
; exit ; hl = 0
; carry reset
;
; uses : af, bc, de, hl
ld a,e
and $fe
or d
jp z, error_znc ; if start_index <= 1, root reached so return success
srl d
rr e ; de = parent_index(start_index)
push de ; save parent_index
ex de,hl ; de = & array[start_index]
add hl,bc ; hl = & array[parent_index]
call l_compare_de_hl ; (compar)(de = void *child, hl = void *parent)
jp p, error_znc - 1 ; if array[child] >= array[parent], finished so return success
push bc ; save array
; swap(array[child], array[parent])
; de = & array[child]
; hl = & array[parent]
; stack = parent_index, array
ld c,(hl)
ld a,(de)
ld (hl),a
ld a,c
ld (de),a
pop bc ; bc = array
pop de ; de = parent_index
; hl = & array[parent]
; de = parent_index
; bc = array
jr __b_heap_sift_up
|
src/Categories/Diagram/Pushout/Properties.agda | MirceaS/agda-categories | 0 | 13911 | <filename>src/Categories/Diagram/Pushout/Properties.agda
{-# OPTIONS --without-K --safe #-}
open import Categories.Category
-- obtain free properties from duality
module Categories.Diagram.Pushout.Properties {o ℓ e} (C : Category o ℓ e) where
open Category C
open import Data.Product using (∃; _,_)
open import Categories.Category.Cocartesian C
open import Categories.Morphism C
open import Categories.Morphism.Properties C
open import Categories.Morphism.Duality C
open import Categories.Object.Initial C
open import Categories.Object.Terminal op
open import Categories.Object.Coproduct C
open import Categories.Object.Duality C
open import Categories.Diagram.Coequalizer C
open import Categories.Diagram.Pushout C
open import Categories.Diagram.Duality C
open import Categories.Diagram.Pullback op as P′ using (Pullback)
open import Categories.Diagram.Pullback.Properties op
private
variable
A B X Y : Obj
f g h i : A ⇒ B
module _ (p : Pushout f g) where
open Pushout p
private
pullback : Pullback f g
pullback = Pushout⇒coPullback p
open Pullback pullback
using (unique′; id-unique; unique-diagram)
public
swap : Pushout g f
swap = coPullback⇒Pushout (P′.swap pullback)
glue : Pushout h i₁ → Pushout (h ∘ f) g
glue p = coPullback⇒Pushout (P′.glue pullback (Pushout⇒coPullback p))
unglue : Pushout (h ∘ f) g → Pushout h i₁
unglue p = coPullback⇒Pushout (P′.unglue pullback (Pushout⇒coPullback p))
Pushout-resp-Epi : Epi g → Epi i₁
Pushout-resp-Epi epi = P′.Pullback-resp-Mono pullback epi
Pushout-resp-Iso : Iso g h → ∃ λ j → Iso i₁ j
Pushout-resp-Iso iso with P′.Pullback-resp-Iso pullback (Iso⇒op-Iso (Iso-swap iso))
... | j , record { isoˡ = isoˡ ; isoʳ = isoʳ } = j , record { isoˡ = isoʳ ; isoʳ = isoˡ }
Coproduct×Coequalizer⇒Pushout : (cp : Coproduct A B) →
Coequalizer (Coproduct.i₁ cp ∘ f) (Coproduct.i₂ cp ∘ g) →
Pushout f g
Coproduct×Coequalizer⇒Pushout cp coe =
coPullback⇒Pushout (P′.Product×Equalizer⇒Pullback (coproduct→product cp)
(Coequalizer⇒coEqualizer coe))
Coproduct×Pushout⇒Coequalizer : (cp : Coproduct A B) →
Pushout f g →
Coequalizer (Coproduct.i₁ cp ∘ f) (Coproduct.i₂ cp ∘ g)
Coproduct×Pushout⇒Coequalizer cp p =
coEqualizer⇒Coequalizer (P′.Product×Pullback⇒Equalizer (coproduct→product cp)
(Pushout⇒coPullback p))
module _ (i : Initial) where
open Initial i
private
t : Terminal
t = ⊥⇒op⊤ i
pushout-⊥⇒coproduct : Pushout (! {X}) (! {Y}) → Coproduct X Y
pushout-⊥⇒coproduct p = product→coproduct (pullback-⊤⇒product t (Pushout⇒coPullback p))
coproduct⇒pushout-⊥ : Coproduct X Y → Pushout (! {X}) (! {Y})
coproduct⇒pushout-⊥ c = coPullback⇒Pushout (product⇒pullback-⊤ t (coproduct→product c))
pushout-resp-≈ : Pushout f g → f ≈ h → g ≈ i → Pushout h i
pushout-resp-≈ p eq eq′ = coPullback⇒Pushout (pullback-resp-≈ (Pushout⇒coPullback p) eq eq′)
module _ (pushouts : ∀ {X Y Z} (f : X ⇒ Y) (g : X ⇒ Z) → Pushout f g)
(cocartesian : Cocartesian) where
open Cocartesian cocartesian
open Dual
pushout×cocartesian⇒coequalizer : Coequalizer f g
pushout×cocartesian⇒coequalizer = coEqualizer⇒Coequalizer
(pullback×cartesian⇒equalizer (λ f g → Pushout⇒coPullback (pushouts f g)) op-cartesian)
|
TotalParserCombinators/Laws/Derivative.agda | nad/parser-combinators | 1 | 16219 | <filename>TotalParserCombinators/Laws/Derivative.agda
------------------------------------------------------------------------
-- Laws related to D
------------------------------------------------------------------------
module TotalParserCombinators.Laws.Derivative where
open import Algebra
open import Codata.Musical.Notation
open import Data.List
import Data.List.Categorical as List
import Data.List.Relation.Binary.BagAndSetEquality as BSEq
open import Data.Maybe using (Maybe); open Data.Maybe.Maybe
open import Function using (_∘_; _$_)
private
module BagMonoid {k} {A : Set} =
CommutativeMonoid (BSEq.commutativeMonoid k A)
open import TotalParserCombinators.Derivative
open import TotalParserCombinators.Congruence as Eq
hiding (return; fail)
import TotalParserCombinators.Laws.AdditiveMonoid as AdditiveMonoid
open import TotalParserCombinators.Lib
open import TotalParserCombinators.Parser
-- Unfolding lemma for D applied to return⋆.
D-return⋆ : ∀ {Tok R t} (xs : List R) →
D t (return⋆ xs) ≅P fail {Tok = Tok}
D-return⋆ [] = fail ∎
D-return⋆ {t = t} (x ∷ xs) =
fail ∣ D t (return⋆ xs) ≅⟨ AdditiveMonoid.left-identity (D t (return⋆ xs)) ⟩
D t (return⋆ xs) ≅⟨ D-return⋆ xs ⟩
fail ∎
mutual
-- Unfolding lemma for D applied to _⊛_.
D-⊛ : ∀ {Tok R₁ R₂ fs xs t}
(p₁ : ∞⟨ xs ⟩Parser Tok (R₁ → R₂) (flatten fs))
(p₂ : ∞⟨ fs ⟩Parser Tok R₁ (flatten xs)) →
D t (p₁ ⊛ p₂) ≅P
D t (♭? p₁) ⊛ ♭? p₂ ∣ return⋆ (flatten fs) ⊛ D t (♭? p₂)
D-⊛ {fs = nothing} {xs = just _} {t = t} p₁ p₂ =
D t p₁ ⊛ ♭ p₂ ≅⟨ sym $ AdditiveMonoid.right-identity (D t p₁ ⊛ ♭ p₂) ⟩
D t p₁ ⊛ ♭ p₂ ∣ fail ≅⟨ (D t p₁ ⊛ ♭ p₂ ∎) ∣ sym (left-zero-⊛ (D t (♭ p₂))) ⟩
D t p₁ ⊛ ♭ p₂ ∣ fail ⊛ D t (♭ p₂) ∎
D-⊛ {fs = nothing} {xs = nothing} {t = t} p₁ p₂ =
D t (p₁ ⊛ p₂) ≅⟨ [ ◌ - ○ - ○ - ○ ] D t (♭ p₁) ∎ ⊛ (♭ p₂ ∎) ⟩
D t (♭ p₁) ⊛ ♭ p₂ ≅⟨ sym $ AdditiveMonoid.right-identity (D t (♭ p₁) ⊛ ♭ p₂) ⟩
D t (♭ p₁) ⊛ ♭ p₂ ∣ fail ≅⟨ (D t (♭ p₁) ⊛ ♭ p₂ ∎) ∣ sym (left-zero-⊛ (D t (♭ p₂))) ⟩
D t (♭ p₁) ⊛ ♭ p₂ ∣ fail ⊛ D t (♭ p₂) ∎
D-⊛ {fs = just _} {xs = just _} {t = t} p₁ p₂ =
D t (p₁ ⊛ p₂) ∎
D-⊛ {fs = just fs} {xs = nothing} {t = t} p₁ p₂ =
D t (p₁ ⊛ p₂) ≅⟨ [ ◌ - ○ - ○ - ○ ] D t (♭ p₁) ∎ ⊛ (p₂ ∎) ∣
(return⋆ fs ⊛ D t p₂ ∎) ⟩
D t (♭ p₁) ⊛ p₂ ∣ return⋆ fs ⊛ D t p₂ ∎
-- fail is a left zero of ⊛.
left-zero-⊛ : ∀ {Tok R₁ R₂ xs} (p : Parser Tok R₁ xs) →
fail ⊛ p ≅P fail {R = R₂}
left-zero-⊛ {xs = xs} p =
BagMonoid.reflexive (List.Applicative.left-zero xs) ∷ λ t → ♯ (
D t (fail ⊛ p) ≅⟨ D-⊛ fail p ⟩
fail ⊛ p ∣ fail ⊛ D t p ≅⟨ left-zero-⊛ p ∣ left-zero-⊛ (D t p) ⟩
fail ∣ fail ≅⟨ AdditiveMonoid.right-identity fail ⟩
fail ∎)
-- fail is a right zero of ⊛.
right-zero-⊛ : ∀ {Tok R₁ R₂ fs} (p : Parser Tok (R₁ → R₂) fs) →
p ⊛ fail ≅P fail
right-zero-⊛ {fs = fs} p =
BagMonoid.reflexive (List.Applicative.right-zero fs) ∷ λ t → ♯ (
D t (p ⊛ fail) ≅⟨ D-⊛ p fail ⟩
D t p ⊛ fail ∣ return⋆ fs ⊛ fail ≅⟨ right-zero-⊛ (D t p) ∣ right-zero-⊛ (return⋆ fs) ⟩
fail ∣ fail ≅⟨ AdditiveMonoid.left-identity fail ⟩
fail ∎)
-- A simplified instance of D-⊛.
D-return-⊛ : ∀ {Tok R₁ R₂ xs t}
(f : R₁ → R₂) (p : Parser Tok R₁ xs) →
D t (return f ⊛ p) ≅P return f ⊛ D t p
D-return-⊛ {t = t} f p =
D t (return f ⊛ p) ≅⟨ D-⊛ (return f) p ⟩
fail ⊛ p ∣ return⋆ [ f ] ⊛ D t p ≅⟨ left-zero-⊛ p ∣
[ ○ - ○ - ○ - ○ ] AdditiveMonoid.right-identity (return f) ⊛ (D t p ∎) ⟩
fail ∣ return f ⊛ D t p ≅⟨ AdditiveMonoid.left-identity (return f ⊛ D t p) ⟩
return f ⊛ D t p ∎
mutual
-- Unfolding lemma for D applied to _>>=_.
D->>= : ∀ {Tok R₁ R₂ xs t} {f : Maybe (R₁ → List R₂)}
(p₁ : ∞⟨ f ⟩Parser Tok R₁ (flatten xs))
(p₂ : (x : R₁) → ∞⟨ xs ⟩Parser Tok R₂ (apply f x)) →
D t (p₁ >>= p₂) ≅P
D t (♭? p₁) >>= (♭? ∘ p₂) ∣
return⋆ (flatten xs) >>= (λ x → D t (♭? (p₂ x)))
D->>= {xs = nothing} {t = t} {f = just _} p₁ p₂ =
D t p₁ >>= (♭ ∘ p₂) ≅⟨ sym $ AdditiveMonoid.right-identity (D t p₁ >>= (♭ ∘ p₂)) ⟩
D t p₁ >>= (♭ ∘ p₂) ∣ fail ≅⟨ (D t p₁ >>= (♭ ∘ p₂) ∎) ∣
sym (left-zero->>= (λ x → D t (♭ (p₂ x)))) ⟩
D t p₁ >>= (♭ ∘ p₂) ∣ fail >>= (λ x → D t (♭ (p₂ x))) ∎
D->>= {xs = just xs} {t = t} {f = just _} p₁ p₂ =
D t p₁ >>= p₂ ∣ return⋆ xs >>= (λ x → D t (p₂ x)) ∎
D->>= {xs = nothing} {t = t} {f = nothing} p₁ p₂ =
D t (p₁ >>= p₂) ≅⟨ [ ◌ - ○ - ○ - ○ ] _ ∎ >>= (λ _ → _ ∎) ⟩
D t (♭ p₁) >>= (♭ ∘ p₂) ≅⟨ sym $ AdditiveMonoid.right-identity (D t (♭ p₁) >>= (♭ ∘ p₂)) ⟩
D t (♭ p₁) >>= (♭ ∘ p₂) ∣ fail ≅⟨ (D t (♭ p₁) >>= (♭ ∘ p₂) ∎) ∣
sym (left-zero->>= (λ x → D t (♭ (p₂ x)))) ⟩
D t (♭ p₁) >>= (♭ ∘ p₂) ∣ fail >>= (λ x → D t (♭ (p₂ x))) ∎
D->>= {xs = just xs} {t = t} {f = nothing} p₁ p₂ =
D t (p₁ >>= p₂) ≅⟨ [ ◌ - ○ - ○ - ○ ] _ ∎ >>= (λ _ → _ ∎) ∣ (_ ∎) ⟩
D t (♭ p₁) >>= p₂ ∣ return⋆ xs >>= (λ x → D t (p₂ x)) ∎
-- fail is a left zero of _>>=_.
left-zero->>= : ∀ {Tok R₁ R₂} {f : R₁ → List R₂}
(p : (x : R₁) → Parser Tok R₂ (f x)) →
fail >>= p ≅P fail
left-zero->>= {f = f} p =
BagMonoid.reflexive (List.MonadProperties.left-zero f) ∷ λ t → ♯ (
D t (fail >>= p) ≅⟨ D->>= {t = t} fail p ⟩
fail >>= p ∣ fail >>= (λ x → D t (p x)) ≅⟨ left-zero->>= p ∣ left-zero->>= (λ x → D t (p x)) ⟩
fail ∣ fail ≅⟨ AdditiveMonoid.right-identity fail ⟩
fail ∎)
-- fail is a right zero of _>>=_.
right-zero->>= : ∀ {Tok R₁ R₂} {xs : List R₁}
(p : Parser Tok R₁ xs) →
p >>= (λ _ → fail) ≅P fail {Tok = Tok} {R = R₂}
right-zero->>= {xs = xs} p =
BagMonoid.reflexive (List.MonadProperties.right-zero xs) ∷ λ t → ♯ (
D t (p >>= λ _ → fail) ≅⟨ D->>= p (λ _ → fail) ⟩
D t p >>= (λ _ → fail) ∣ return⋆ xs >>= (λ _ → fail) ≅⟨ right-zero->>= (D t p) ∣ right-zero->>= (return⋆ xs) ⟩
fail ∣ fail ≅⟨ AdditiveMonoid.left-identity fail ⟩
fail ∎)
|
Light/Implementation/Data/Product.agda | zamfofex/lightlib | 1 | 6956 | {-# OPTIONS --omega-in-omega --no-termination-check --overlapping-instances #-}
{-# OPTIONS --allow-unsolved-metas #-}
module Light.Implementation.Data.Product where
open import Light.Library.Data.Product using (Library ; Dependencies)
open import Light.Variable.Levels
open import Light.Level using (_⊔_)
open import Light.Library.Relation.Binary.Equality.Decidable using (DecidableEquality)
open import Light.Variable.Sets
open import Light.Library.Relation.Binary.Equality using (wrap)
instance dependencies : Dependencies
dependencies = record {}
instance library : Library dependencies
library = record { Implementation }
where
module Implementation where
record Σ (𝕒 : Set aℓ) (𝕓 : 𝕒 → Set bℓ) : Set (aℓ ⊔ bℓ) where
constructor both
field first : 𝕒
field second : 𝕓 first
open Σ public
equals :
∀ ⦃ a‐c‐equals : DecidableEquality 𝕒 𝕔 ⦄ ⦃ b‐d‐equals : DecidableEquality 𝕓 𝕕 ⦄
→ DecidableEquality (Σ 𝕒 (λ _ → 𝕓)) (Σ 𝕔 (λ _ → 𝕕))
equals = {!!}
|
resources/win64-data.asm | mateuszb/glutenfree | 1 | 101705 | <filename>resources/win64-data.asm
bits 64
section .rdata
global <name>_start
global <name>_end
global <name>_size
<name>_start: incbin "<bin>"
<name>_end:
<name>_size: dd $ - <name>_start
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-coinho.ads | orb-zhuchen/Orb | 0 | 15612 | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . I N D E F I N I T E _ H O L D E R S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2013-2019, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- 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/>. --
------------------------------------------------------------------------------
-- This is an optimized version of Indefinite_Holders using copy-on-write.
-- It is used on platforms that support atomic built-ins.
private with Ada.Finalization;
private with Ada.Streams;
private with System.Atomic_Counters;
generic
type Element_Type (<>) is private;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Indefinite_Holders is
pragma Annotate (CodePeer, Skip_Analysis);
pragma Preelaborate (Indefinite_Holders);
pragma Remote_Types (Indefinite_Holders);
type Holder is tagged private;
pragma Preelaborable_Initialization (Holder);
Empty_Holder : constant Holder;
function "=" (Left, Right : Holder) return Boolean;
function To_Holder (New_Item : Element_Type) return Holder;
function Is_Empty (Container : Holder) return Boolean;
procedure Clear (Container : in out Holder);
function Element (Container : Holder) return Element_Type;
procedure Replace_Element
(Container : in out Holder;
New_Item : Element_Type);
procedure Query_Element
(Container : Holder;
Process : not null access procedure (Element : Element_Type));
procedure Update_Element
(Container : in out Holder;
Process : not null access procedure (Element : in out Element_Type));
type Constant_Reference_Type
(Element : not null access constant Element_Type) is private
with
Implicit_Dereference => Element;
type Reference_Type
(Element : not null access Element_Type) is private
with
Implicit_Dereference => Element;
function Constant_Reference
(Container : aliased Holder) return Constant_Reference_Type;
pragma Inline (Constant_Reference);
function Reference
(Container : aliased in out Holder) return Reference_Type;
pragma Inline (Reference);
procedure Assign (Target : in out Holder; Source : Holder);
function Copy (Source : Holder) return Holder;
procedure Move (Target : in out Holder; Source : in out Holder);
private
use Ada.Finalization;
use Ada.Streams;
type Element_Access is access all Element_Type;
type Holder_Access is access all Holder;
type Shared_Holder is record
Counter : System.Atomic_Counters.Atomic_Counter;
Element : Element_Access;
end record;
type Shared_Holder_Access is access all Shared_Holder;
procedure Reference (Item : not null Shared_Holder_Access);
-- Increment reference counter
procedure Unreference (Item : not null Shared_Holder_Access);
-- Decrement reference counter, deallocate Item when counter goes to zero
procedure Read
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Container : out Holder);
procedure Write
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Container : Holder);
type Holder is new Ada.Finalization.Controlled with record
Reference : Shared_Holder_Access;
Busy : Natural := 0;
end record;
for Holder'Read use Read;
for Holder'Write use Write;
overriding procedure Adjust (Container : in out Holder);
overriding procedure Finalize (Container : in out Holder);
type Reference_Control_Type is new Controlled with record
Container : Holder_Access;
end record;
overriding procedure Adjust (Control : in out Reference_Control_Type);
pragma Inline (Adjust);
overriding procedure Finalize (Control : in out Reference_Control_Type);
pragma Inline (Finalize);
type Constant_Reference_Type
(Element : not null access constant Element_Type) is
record
Control : Reference_Control_Type :=
raise Program_Error with "uninitialized reference";
-- The RM says, "The default initialization of an object of
-- type Constant_Reference_Type or Reference_Type propagates
-- Program_Error."
end record;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Constant_Reference_Type);
for Constant_Reference_Type'Write use Write;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Constant_Reference_Type);
for Constant_Reference_Type'Read use Read;
type Reference_Type (Element : not null access Element_Type) is record
Control : Reference_Control_Type :=
raise Program_Error with "uninitialized reference";
-- The RM says, "The default initialization of an object of
-- type Constant_Reference_Type or Reference_Type propagates
-- Program_Error."
end record;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Reference_Type);
for Reference_Type'Write use Write;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Reference_Type);
for Reference_Type'Read use Read;
Empty_Holder : constant Holder := (Controlled with null, 0);
end Ada.Containers.Indefinite_Holders;
|
util/gut/schp.asm | olifink/smsqe | 0 | 243593 | <reponame>olifink/smsqe<gh_stars>0
; Save file from heap V1.00 Apr 1988 J.R.Oakley QJUMP
section gen_util
xdef gu_schp
xref gu_trap3
xref gu_fclos
include 'dev8_keys_hdr'
include 'dev8_keys_qdos_io'
;+++
; Save a file from the common heap. The bytes of the file and those of the
; 14-byte header are pointed to individually.
;
; a0 c channel ID - closed on exit
; a1 c p pointer to file header
; a2 c p pointer to file data
; error returns standard
; uses $0C bytes of stack + gu_trap3/gu_fclos
;---
gu_schph
regschp reg d1/d2/a1
movem.l regschp,-(sp)
moveq #-hdr.set,d2 ; difference between header end...
sub.l a1,d2
add.l a2,d2 ; ...and data start is this
bra.s ugs_shdr
;+++
; Save a file from the common heap. The bytes of the file should be immediately
; preceded by a 14-byte header in the standard form. The heap is not
; released.
;
; a0 c channel ID - closed on exit
; a1 c p pointer to file header & file data
; error returns standard
; uses $0C bytes of stack + gu_trap3/gu_fclos
;---
gu_schp
movem.l regschp,-(sp)
moveq #0,d2 ; data follows header
ugs_shdr
moveq #iof.shdr,d0 ; set header
jsr gu_trap3(pc)
bne.s ugs_close ; ...oops
move.l hdr_flen-hdr.set(a1),d1 ; length is in the header
add.l d2,a1 ; skip to data
move.l d1,d2 ; length should be here
moveq #iof.save,d0
jsr gu_trap3(pc)
ugs_close
jsr gu_fclos ; close file, set CCR
movem.l (sp)+,regschp
rts
end
|
src/tk/tk-image.ads | thindil/tashy2 | 2 | 4588 | -- Copyright (c) 2021 <NAME> <<EMAIL>>
--
-- 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 Tcl.Lists; use Tcl.Lists;
with Tcl.Strings; use Tcl.Strings;
-- ****d* Tk/Image
-- FUNCTION
-- Provides code for manipulate Tk images
-- SOURCE
package Tk.Image is
-- ****
--## rule off REDUCEABLE_SCOPE
-- ****t* Image/Image.Tk_Image
-- FUNCTION
-- The Tk identifier of the button
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
subtype Tk_Image is String;
-- ****
--## rule off TYPE_INITIAL_VALUES
-- ****s* Image/Image.Image_Options
-- FUNCTION
-- Abstract record to store images options available for all types of images
-- OPTIONS
-- Data - The content of the image as a string. The format of the string
-- must be one of those for which there is an image file format
-- handler that will accept string data. If both the Data and
-- File options are specified, the File option takes precedence.
-- File - The name of the file which will be loaded as an image.
-- HISTORY
-- 8.6.0 - Added
-- SOURCE
type Image_Options is abstract tagged record
Data: Tcl_String := Null_Tcl_String;
File: Tcl_String := Null_Tcl_String;
end record;
-- ****
--## rule on TYPE_INITIAL_VALUES
-- ****f* Image/Image.Delete_(single_image)
-- FUNCTION
-- Delete the selected Tk image
-- PARAMETERS
-- Image_Name - The name of the Tk image to delete
-- Interpreter - Tcl interpreter on which the image will be deleted. Can
-- be empty. Default value is the default Tcl interpreter
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Delete Tk image named mybitmap on default Tcl interpreter
-- Delete("mybitmap");
-- SEE ALSO
-- Image.Delete_(many_images)
-- COMMANDS
-- image delete Image_Name
-- SOURCE
procedure Delete
(Image_Name: Tk_Image;
Interpreter: Tcl_Interpreter := Get_Interpreter) with
Pre => Image_Name'Length in 1 .. Integer'Last - 13 and
Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Image_Delete", Mode => Nominal);
-- ****
-- ****f* Image/Image.Delete_(many_images)
-- FUNCTION
-- Delete the selected Tk images
-- PARAMETERS
-- Images - The list of names of the Tk images to delete
-- Interpreter - Tcl interpreter on which the images will be deleted. Can
-- be empty. Default value is the default Tcl interpreter
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Delete Tk images named mybitmap and mybitmap2 on default Tcl interpreter
-- Delete(Array_List'(To_Tcl_String("mybitmap"), To_Tcl_String("mybitmap2")));
-- SEE ALSO
-- Image.Delete_(single_image)
-- COMMANDS
-- image delete Images
-- SOURCE
procedure Delete
(Images: Array_List; Interpreter: Tcl_Interpreter := Get_Interpreter) with
Pre =>
(Images'Length > 0
and then Merge_List(List => Images)'Length < Integer'Last - 13) and
Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Image_Delete2", Mode => Nominal);
-- ****
-- ****f* Image/Image.Height
-- FUNCTION
-- Get the height in pixels for the selected Tk image
-- PARAMETERS
-- Image_Name - The name of the Tk image which height will be get
-- Interpreter - Tcl interpreter on which the image which height will be
-- get. Can be empty. Default value is the default Tcl
-- interpreter
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the height of the Tk image "myimage" on default Tcl interpreter
-- Image_Height: constant Natural := Height("myimage");
-- SEE ALSO
-- Image.Width
-- COMMANDS
-- image height Image_Name
-- SOURCE
function Height
(Image_Name: Tk_Image; Interpreter: Tcl_Interpreter := Get_Interpreter)
return Natural with
Pre => Image_Name'Length in 1 .. Integer'Last - 13 and
Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Image_Height", Mode => Nominal);
-- ****
-- ****f* Image/Image.In_Use
-- FUNCTION
-- Check if the selected Tk image is used by any widget
-- PARAMETERS
-- Image_Name - The name of the Tk image which will be checked
-- Interpreter - Tcl interpreter on which the image will be check. Can
-- be empty. Default value is the default Tcl interpreter
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Check if the Tk image "myimage" on default Tcl interpreter is used
-- Is_Used: constant Tcl_Boolean_Result := In_Use("myimage");
-- COMMANDS
-- image inuse Image_Name
-- SOURCE
function In_Use
(Image_Name: Tk_Image; Interpreter: Tcl_Interpreter := Get_Interpreter)
return Tcl_Boolean_Result with
Pre => Image_Name'Length in 1 .. Integer'Last - 12 and
Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Image_In_Use", Mode => Nominal);
-- ****
-- ****f* Image/Image.Names
-- FUNCTION
-- Get the names of the all existing Tk images on the selected Tcl
-- interpreter
-- PARAMETERS
-- Interpreter - Tcl interpreter on which the names will be get. Can
-- be empty. Default value is the default Tcl interpreter
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the names of Tk images on the default Tcl interpreter
-- Available_Images: constant Array_List := Names;
-- COMMANDS
-- image names
-- SOURCE
function Names
(Interpreter: Tcl_Interpreter := Get_Interpreter) return Array_List with
Pre => Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Image_Names", Mode => Nominal);
-- ****
-- ****f* Image/Image.Image_Type
-- FUNCTION
-- Get the type of the selected Tk image
-- PARAMETERS
-- Image_Name - The name of the Tk image which type will be get
-- Interpreter - Tcl interpreter on which the image type will be get. Can
-- be empty. Default value is the default Tcl interpreter
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the type of Tk image "myimage" on the default Tcl interpreter
-- My_Image_Type: constant String := Image_Type("myimage");
-- COMMANDS
-- image type Image_Name
-- SOURCE
function Image_Type
(Image_Name: Tk_Image; Interpreter: Tcl_Interpreter := Get_Interpreter)
return String with
Pre => Image_Name'Length in 1 .. Integer'Last - 11 and
Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Image_Type", Mode => Nominal);
-- ****
-- ****f* Image/Image.Types
-- FUNCTION
-- Get all possible types of the Tk images on the selected Tcl
-- interpreter
-- PARAMETERS
-- Interpreter - Tcl interpreter on which the types will be get. Can
-- be empty. Default value is the default Tcl interpreter
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the available types of Tk images on the default Tcl interpreter
-- Available_Types: constant Array_List := Types;
-- COMMANDS
-- image types
-- SOURCE
function Types
(Interpreter: Tcl_Interpreter := Get_Interpreter) return Array_List with
Pre => Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Image_Types", Mode => Nominal);
-- ****
-- ****f* Image/Image.Width
-- FUNCTION
-- Get the width in pixels for the selected Tk image
-- PARAMETERS
-- Image_Name - The name of the Tk image which width will be get
-- Interpreter - Tcl interpreter on which the image which width will be
-- get. Can be empty. Default value is the default Tcl
-- interpreter
-- HISTORY
-- 8.6.0 - Added
-- EXAMPLE
-- -- Get the width of the Tk image "myimage" on default Tcl interpreter
-- Image_Width: constant Natural := Width("myimage");
-- SEE ALSO
-- Image.Height
-- COMMANDS
-- image width Image_Name
-- SOURCE
function Width
(Image_Name: Tk_Image; Interpreter: Tcl_Interpreter := Get_Interpreter)
return Natural with
Pre => Image_Name'Length in 1 .. Integer'Last - 12 and
Interpreter /= Null_Interpreter,
Test_Case => (Name => "Test_Image_Width", Mode => Nominal);
-- ****
--## rule on REDUCEABLE_SCOPE
end Tk.Image;
|
source/web/tools/wsdl2ada/wsdl-iterators-containment.adb | svn2github/matreshka | 24 | 13985 | <reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE 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 --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with WSDL.AST.Bindings;
pragma Unreferenced (WSDL.AST.Bindings);
-- GNAT Pro 7.2.0w (20130423): package is needed to access to type's
-- components.
with WSDL.AST.Descriptions;
pragma Unreferenced (WSDL.AST.Descriptions);
-- GNAT Pro 7.2.0w (20130423): package is needed to access to type's
-- components.
with WSDL.AST.Faults;
pragma Unreferenced (WSDL.AST.Faults);
-- GNAT Pro 7.2.0w (20130423): package is needed to access to type's
-- components.
with WSDL.AST.Interfaces;
pragma Unreferenced (WSDL.AST.Interfaces);
-- GNAT Pro 7.2.0w (20130423): package is needed to access to type's
-- components.
with WSDL.AST.Messages;
pragma Unreferenced (WSDL.AST.Messages);
-- GNAT Pro 7.2.0w (20130423): package is needed to access to type's
-- components.
with WSDL.AST.Operations;
pragma Unreferenced (WSDL.AST.Operations);
-- GNAT Pro 7.2.0w (20130423): package is needed to access to type's
-- components.
package body WSDL.Iterators.Containment is
-------------------
-- Visit_Binding --
-------------------
overriding procedure Visit_Binding
(Self : in out Containment_Iterator;
Visitor : in out WSDL.Visitors.WSDL_Visitor'Class;
Node : not null WSDL.AST.Binding_Access;
Control : in out Traverse_Control) is
begin
for J of Node.Binding_Faults loop
Self.Visit (Visitor, WSDL.AST.Node_Access (J), Control);
end loop;
for J of Node.Binding_Operations loop
Self.Visit (Visitor, WSDL.AST.Node_Access (J), Control);
end loop;
end Visit_Binding;
-----------------------
-- Visit_Description --
-----------------------
overriding procedure Visit_Description
(Self : in out Containment_Iterator;
Visitor : in out WSDL.Visitors.WSDL_Visitor'Class;
Node : not null WSDL.AST.Description_Access;
Control : in out Traverse_Control)
is
use type WSDL.AST.Types.Types_Access;
begin
if Node.Types /= null then
Self.Visit (Visitor, WSDL.AST.Node_Access (Node.Types), Control);
end if;
for J of Node.Interfaces loop
Self.Visit (Visitor, WSDL.AST.Node_Access (J), Control);
end loop;
for J of Node.Bindings loop
Self.Visit (Visitor, WSDL.AST.Node_Access (J), Control);
end loop;
for J of Node.Services loop
Self.Visit (Visitor, WSDL.AST.Node_Access (J), Control);
end loop;
end Visit_Description;
---------------------
-- Visit_Interface --
---------------------
overriding procedure Visit_Interface
(Self : in out Containment_Iterator;
Visitor : in out WSDL.Visitors.WSDL_Visitor'Class;
Node : not null WSDL.AST.Interface_Access;
Control : in out Traverse_Control) is
begin
for J of Node.Interface_Operations loop
Self.Visit (Visitor, WSDL.AST.Node_Access (J), Control);
end loop;
end Visit_Interface;
-------------------------------
-- Visit_Interface_Operation --
-------------------------------
overriding procedure Visit_Interface_Operation
(Self : in out Containment_Iterator;
Visitor : in out WSDL.Visitors.WSDL_Visitor'Class;
Node : not null WSDL.AST.Interface_Operation_Access;
Control : in out Traverse_Control) is
begin
for J of Node.Interface_Message_References loop
Self.Visit (Visitor, WSDL.AST.Node_Access (J), Control);
end loop;
end Visit_Interface_Operation;
-------------------
-- Visit_Service --
-------------------
overriding procedure Visit_Service
(Self : in out Containment_Iterator;
Visitor : in out WSDL.Visitors.WSDL_Visitor'Class;
Node : not null WSDL.AST.Services.Service_Access;
Control : in out Traverse_Control) is
begin
for J of Node.Endpoints loop
Self.Visit (Visitor, WSDL.AST.Node_Access (J), Control);
end loop;
end Visit_Service;
end WSDL.Iterators.Containment;
|
grim.asm | asman2000/grim | 0 | 172890 | ;^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^^%^%^%^%^%^%^%
;
; GRIM
;
;
;^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^^%^%^%^%^%^%^%
SECTION game,CODE_P
;=============================================================================
INCDIR "include:"
INCLUDE "hardware/cia.i"
INCLUDE "hardware/custom.i"
INCLUDE "hardware/dmabits.i"
INCLUDE "hardware/intbits.i"
_custom equ $dff000
_ciaa equ $bfe001
_ciab equ $bfd000
;=============================================================================
;#+=- Screen -=+#
SCR_WIDTH = 320
SCR_HEIGHT = 256
TILE_WIDTH = 8
TILE_HEIGHT = 8
BPL = 1 ;amount of bitlpans (1-8)
BROW = SCR_WIDTH/8 ;bytes per row
MODULO = (BPL-1)*BROW ;modulo rawblit
KEY_ESC = $45 ;rawkey code
KEY_LEFT = $4f
KEY_RIGHT = $4e
KEY_UP = $4c
KEY_DOWN = $4d
KEY_A = $20
HERO_INIT_X = 160
HERO_INIT_Y = 240
KEY_INIT_X = 320-48
KEY_INIT_Y = 16
;=============================================================================
;; M A C R O S
;
WAITVB: MACRO
.1\@ btst #0,(_custom+vposr+1)
beq .1\@
.2\@ btst #0,(_custom+vposr+1)
bne .2\@
ENDM
FUNCT: MACRO
lea (g_pFnc,pc),a0
lea (\1,pc),a1
move.l a1,(a0)
ENDM
;=============================================================================
start:
lea (oldstack,pc),a0
move.l a7,(a0)
bsr TakeOS
lea _custom,a5
bsr Init
move.l #cpList,(cop1lc,a5)
move.w #0,(copjmp1,a5)
move.w #$87f0,(dmacon,a5)
FUNCT TitleInit
mainLoop:
WAITVB
move.l (g_pFnc,pc),a0
jsr (a0)
.mouse btst #6,$bfe001
beq Exit
lea bKeytab,a0
tst.b ($45,a0)
bne Exit
bra mainLoop
Exit:
bra TakeOS\.restore
g_pFnc: dc.l 0
;=============================================================================
TitleInit:
;set empty sprites
bsr SetEmptySprites
;clean screen
bsr ClearScreen
;set colors
move.w #$000,$dff180
move.w #$550,$dff182
;show title
lea .msg,a0
lea screen,a1
bsr showMsg
FUNCT TitleLoop
rts
.msg: dc.b "grim",0
EVEN
;=============================================================================
TitleLoop:
lea (bKeytab,pc),a0
tst.w (KEY_A,a0)
beq .exit
sf (KEY_A,a0)
FUNCT GameInit
.exit rts
;=============================================================================
GameInit:
;reset level
move.w #0,wLevelNumber
;reset hero amount
move.w #3,wHeroLives
;reset amount of tiles
move.w #50,wTilesNumber
;set colors
move.w #0,$dff180
move.w #$0555,$dff182
;set spr colors
move.w #$0,$dff1a0
move.w #$48f,$dff1a2
move.w #$d9,$dff1a4
move.w #$a11,$dff1a6
move.w #$f48,$dff1aa
move.w clxdat(a5),d0 ;without this not works!!!
bsr NextLevel
FUNCT GameLoop
rts
;=============================================================================
GameLoop:
bsr GetInputs
;logic
tst.w (wLeft)
beq .right
sub.w #1,wHeroX
.right tst.w (wRight)
beq .up
add.w #1,wHeroX
.up tst.w (wUp)
beq .down
sub.w #1,wHeroY
.down tst.w (wDown)
beq .other
add.w #1,wHeroY
.other
bsr UpdateHero
move.w clxdat(a5),d0
move.w d0,d1
and.w #$2,d0 ; touch the tile ?
beq .key
;jmp to game over
FUNCT GameOver
.key and.w #$200,d1
beq .exit
bsr SetEmptySprites
WAITVB
bsr NextLevel
.exit rts
;=============================================================================
NextLevel:
add.w #1,wLevelNumber
add.w #5,wTilesNumber
bsr ClearScreen
bsr RenderLevel
;set hero
move.w #HERO_INIT_X,wHeroX
move.w #HERO_INIT_Y,wHeroY
bsr ShowHero
bsr UpdateHero
;set key
move.w #KEY_INIT_X,wKeyX
move.w #KEY_INIT_Y,wKeyY
bsr ShowKey
bsr UpdateKey
;set info
bsr UpdateLivesInfo
bsr UpdateLevelInfo
bsr ShowInfo
bsr UpdateInfo
rts
;=============================================================================
GameOver:
FUNCT TitleInit
bsr SetEmptySprites
; clean screen
bsr ClearScreen
; show game over msg
bsr ShowGameOverMsg
moveq #120,d0
.loop WAITVB
lea bKeytab,a0
tst.b ($45,a0)
bne .wait
btst #6,$bfe001
beq .exit
dbf d0,.loop
rts
.wait tst.b ($45,a0)
beq .exit
bra .wait
.exit rts
;=============================================================================
ClearScreen:
lea screen,a0
move.l #BPL*BROW*SCR_HEIGHT/4,d0
moveq #0,d1
.clear move.l d1,(a0)+
subq.l #1,d0
bne .clear
rts
;=============================================================================
ShowGameOverMsg:
lea .msg,a0
lea screen,a1
bsr showMsg
rts
.msg dc.b "game over",0
EVEN
;=============================================================================
RenderLevel:
move.w wTilesNumber,d2
lea lTileTable,a0
.rloop bsr Rnd
asl.l #2,d0
move.l (a0,d0.w),a1
moveq #8-1,d0
.copy move.b #$ff,(a1)
add.l #BROW,a1
dbf d0,.copy
dbf d2,.rloop
rts
;=============================================================================
ShowHero:
lea cpSprite,a0
move.l #sprHero,d0
move.w d0,(6,a0)
swap d0
move.w d0,(2,a0)
rts
;=============================================================================
UpdateHero
lea sprHero,a0
move.w (wHeroX,pc),d0
move.w (wHeroY,pc),d1
moveq #8,d2
bsr SetSprite
rts
;=============================================================================
ShowKey:
lea cpSprite,a0
move.l #sprKey,d0
move.w d0,(22,a0)
swap d0
move.w d0,(18,a0)
rts
;=============================================================================
UpdateKey
lea sprKey,a0
move.w (wKeyX,pc),d0
move.w (wKeyY,pc),d1
moveq #8,d2
bsr SetSprite
rts
;=============================================================================
ShowInfo:
lea cpSprite,a0
move.l #sprInfo,d0
move.w d0,(30,a0)
swap d0
move.w d0,(26,a0)
rts
;=============================================================================
INFO_X = 304
INFO_Y = 0
INFO_H = 26
UpdateInfo:
lea sprInfo,a0
move.w #INFO_X,d0
move.w #INFO_Y,d1
moveq #INFO_H,d2
bsr SetSprite
rts
;=============================================================================
UpdateLevelInfo:
moveq #0,d0
move.w wLevelNumber,d0
moveq #0,d1
.calc cmp.w #9,d0
ble .do
addq.w #1,d1
sub.w #10,d0
bra .calc
; d0
; d1
.do
lea sprLev,a0
lea digits,a1
asl.w #3,d1
add.l d1,a1
moveq #8-1,d1
.copy1 move.b (a1)+,(a0)
addq.l #4,a0
dbf d1,.copy1
lea sprLev+1,a0
lea digits,a1
asl.w #3,d0
add.l d0,a1
moveq #8-1,d0
.copy2 move.b (a1)+,(a0)
addq.l #4,a0
dbf d0,.copy2
rts
;=============================================================================
UpdateLivesInfo:
lea sprInfo+5,a0
lea digits,a1
moveq #0,d0
move.w wHeroLives,d0
asl.w #3,d0
add.l d0,a1
moveq #8-1,d0
.loop move.b (a1)+,(a0)
addq.l #4,a0
dbf d0,.loop
rts
;=============================================================================
GetInputs:
moveq #0,d0
moveq #0,d1
moveq #0,d2
moveq #0,d3
lea (bKeytab,pc),a0
tst.b (KEY_LEFT,a0)
sne d0
tst.b (KEY_RIGHT,a0)
sne d1
tst.b (KEY_UP,a0)
sne d2
tst.b (KEY_DOWN,a0)
sne d3
lea (wDown+2,pc),a0
movem.w d0-d3,-(a0)
rts
wLeft: dc.w 0
wRight dc.w 0
wUp: dc.w 0
wDown: dc.w 0
;=============================================================================
Init:
;set random seed
move.w (vhposr,a5),d0
move.l d0,lSeed
;set PORTS int
move.l (vectorbase,pc),a0
lea (IntPORTS,pc),a1
move.l a1,($68,a0)
move.b #CIAICRF_SETCLR|CIAICRF_SP,(ciaicr+_ciaa)
tst.b (ciaicr+_ciaa)
and.b #~(CIACRAF_SPMODE),(ciacra+_ciaa)
move.w #INTF_PORTS,(intreq+_custom)
move.w #INTF_SETCLR|INTF_INTEN|INTF_PORTS,(intena+_custom)
;sprites
moveq #16-1,d0
move.w #sprpt,d1
lea cpSprite,a0
move.l #emptySprite,d2
.sprites move.w d1,(a0)+
swap d2
move.w d2,(a0)+
addq.w #2,d1
dbf d0,.sprites
;bitplanes
moveq #BPL*2-1,d0
move.w #bplpt,d1
move.l #screen,d2
lea cpBpl,a0
.planes move.w d1,(a0)+
swap d2
move.w d2,(a0)+
addq.w #2,d1
dbf d0,.planes
;do look up table for tiles
lea lTileTable,a0
move.l #screen,d1
moveq #SCR_HEIGHT/TILE_HEIGHT-1,d3
.line moveq #SCR_WIDTH/TILE_WIDTH-1,d2
move.l d1,d0
.loop move.l d0,(a0)+
addq.l #TILE_WIDTH/8,d0
dbf d2,.loop
add.l #BPL*BROW*TILE_HEIGHT,d1
dbf d3,.line
rts
;=============================================================================
SetEmptySprites:
moveq #16-1,d0
move.l #emptySprite,d1
lea cpSprite,a0
.loop swap d1
move.w d1,(2,a0)
addq.l #4,a0
dbf d0,.loop
rts
;=============================================================================
start_x equ 127
start_y equ 44
; a0 - spr adr
; d0 - x
; d1 - y
; d2 - height of spr
;
SetSprite:
add.w #start_x,d0
add.w #start_y,d1
move.w d1,d4
moveq #0,d3
move.b d1,(a0)
lsl.w #8,d4
addx.b d3,d3
add.w d2,d1
move.b d1,(2,a0)
lsl.w #8,d1
addx.b d3,d3
lsr.w #1,d0
addx.w d3,d3
move.b d0,(1,a0)
move.b d3,(3,a0)
rts
;=============================================================================
;in -
;out d0 - rnd ( 0 - SCR_HEIGHT/TILE*SCR_WIDTH/TILE_WIDTH )
;
;used d0,d1
;
Rnd: bsr Random
and.l #$ffff,d0
move.w #SCR_HEIGHT/TILE_HEIGHT*SCR_WIDTH/TILE_WIDTH,d1 ;max
mulu d1,d0
asr.l #8,d0
asr.l #8,d0
and.l #$ffff,d0
rts
Random
move.l (lSeed,pc),d0
move.l d0,d1
asl.l #3,d1
sub.l d0,d1
asl.l #3,d1
add.l d0,d1
add.l d1,d1
add.l d0,d1
asl.l #4,d1
sub.l d0,d1
add.l d1,d1
sub.l d0,d1
addi.l #$E60,d1
andi.l #$7FFFFFFF,d1
move.l d1,d0
subq.l #1,d0
move.l d1,d0
move.l d0,lSeed
rts
;
; d2 - max
;
Rand:
bsr Random
and.l #$ffff,d0
mulu d2,d0
asr.l #8,d0
asr.l #8,d0
and.l #$ffff,d0
rts
;=============================================================================
IntPORTS: movem.l d0-d1/a0-a2,-(a7)
lea (_custom),a0
lea (_ciaa),a1
;check if keyboard has caused interrupt
btst #INTB_PORTS,(intreqr+1,a0)
beq .end
btst #CIAICRB_SP,(ciaicr,a1)
beq .end
;read key and store him
move.b (ciasdr,a1),d0
or.b #CIACRAF_SPMODE,(ciacra,a1)
not.b d0
ror.b #1,d0
spl d1
and.w #$7f,d0
lea (bKeytab,pc),a2
move.b d1,(a2,d0.w)
.handshake
;wait for handshake
moveq #3-1,d1
.wait1 move.b (vhposr,a0),d0
.wait2 cmp.b (vhposr,a0),d0
beq .wait2
dbf d1,.wait1
;set input mode
and.b #~(CIACRAF_SPMODE),(ciacra,a1)
.end move.w #INTF_PORTS,(intreq,a0)
tst.w (intreqr,a0)
movem.l (a7)+,d0-d1/a0-a2
rte
pressExit: dc.w 0
oldstack: dc.l 0
;=============================================================================
bKeytab dcb.b $80
lSeed: dc.l 0
;--- tiles ---
wTilesNumber: dc.w 0
lTileTable: dcb.l SCR_WIDTH/8*SCR_HEIGHT/8
;--- level ---
wLevelNumber: dc.w 0
;--- hero ---
wHeroX: dc.w 0
wHeroY: dc.w 0
wHeroLives: dc.w 0
;--- key ---
wKeyX: dc.w 0
wKeyY: dc.w 0
wExit: dc.w 0
;=============================================================================
TakeOS:
RSRESET
.osExecBase rs.l 1
.gfxbase rs.l 1
.oldview rs.l 1
.intena rs.w 1
.dmacon rs.w 1
.intvertb rs.l 1
.intports rs.l 1
.SIZEOF rs.b 0
;=== exec ===
.OpenLibrary = -552
.CloseLibrary = -414
.Forbid = -132
.Permit = -138
.Supervisor = -30
;=== graphics ===
.LoadView = -222
.WaitTOF = -270
.WaitBlit = -228
.OwnBlitter = -456
.DisownBlitter = -462
.gb_ActiView = $22
.gb_copinit = $26
.AFB_68010 = 0
.AttnFlags = $128
movem.l d0-a6,-(sp)
lea .store(pc),a4
;store exec base
move.l 4.w,a6
move.l a6,.osExecBase(a4)
;open graphics library
moveq #0,d0
lea .gfxname(pc),a1
jsr .OpenLibrary(a6)
move.l d0,.gfxbase(a4)
beq.w .errexit
move.l d0,a6
;save old view
move.l .gb_ActiView(a6),.oldview(a4)
;wait till blitter finish job
jsr .WaitBlit(a6)
;take blitter
jsr .OwnBlitter(a6)
;reset display
sub.l a1,a1
jsr .LoadView(a6)
jsr .WaitTOF(a6)
jsr .WaitTOF(a6)
;multitaskig off
move.l .osExecBase(a4),a6
jsr .Forbid(a6)
;get vbr
moveq #0,d0
btst.b #.AFB_68010,.AttnFlags+1(a6)
beq .mc68000
lea .movectrap(pc),a5
jsr .Supervisor(a6)
.mc68000 lea vectorbase(pc),a5
move.l d0,(a5)
lea _custom,a5
;store
move.w intenar(a5),d0
or.w #$c000,d0
move.w d0,.intena(a4)
move.w dmaconr(a5),d0
or.w #$8000,d0
move.w d0,.dmacon(a4)
WAITVB
;stop int & dma
move.w #$7fff,d0
move.w d0,intena(a5)
move.w d0,dmacon(a5)
move.w d0,intreq(a5)
;Check AGA
move.w deniseid(a5),d0
cmpi.b #$f8,d0 ;AGA ?
bne.b .no
;Reset to ECS
moveq #0,d0
move.w d0,bplcon3(a5)
move.w d0,fmode(a5)
.no
;store int pointers
move.l vectorbase(pc),a0
move.l $6c(a0),.intvertb(a4)
move.l $68(a0),.intports(a4)
movem.l (sp)+,d0-a6
rts
.restore movem.l d0-a6,-(sp)
lea .store(pc),a4
lea _custom,a5
WAITVB
;stop int & dma
move.w #$7fff,d0
move.w d0,intena(a5)
move.w d0,dmacon(a5)
move.w d0,intreq(a5)
;restore ints pointers
move.l vectorbase(pc),a0
move.l .intvertb(a4),$6c(a0)
move.l .intports(a4),$68(a0)
;restore
move.w .dmacon(a4),dmacon(a5)
move.w .intena(a4),intena(a5)
;multitasking on
move.l .osExecBase(a4),a6
jsr .Permit(a6)
;load old view
move.l .gfxbase(a4),a6
move.l .oldview(a4),a1
jsr .LoadView(a6)
move.l .gb_copinit(a6),cop1lc(a5) ; restore system clist
;disown blitter
jsr .DisownBlitter(a6)
;close graphics library
move.l .osExecBase(a4),a6
move.l .gfxbase(a4),a1
jsr .CloseLibrary(a6)
movem.l (sp)+,d0-a6
rts
.errexit moveq #-1,d0
rts
.movectrap dc.l $4e7a0801 ;movec vbr,d0
rte
.gfxname dc.b "graphics.library",0
EVEN
.store ds.b .SIZEOF
vectorbase ds.l 1
;=============================================================================
;in
;a0 - msg
;a1 - scr
;
showMsg
.loop move.l a1,a2
moveq #0,d0
move.b (a0)+,d0
beq .exit
sub.b #$20,d0
asl.w #3,d0
lea fonts,a3
add.l d0,a3
moveq #8-1,d1
.copy move.b (a3)+,(a2)
add.l #BROW*BPL,a2
dbf d1,.copy
addq.l #1,a1
bra .loop
.exit rts
;=============================================================================
fonts: dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00011000
dc.b %00111100
dc.b %00111100
dc.b %00011000
dc.b %00011000
dc.b %00000000
dc.b %00011000
dc.b %00000000
dc.b %00110110
dc.b %00110110
dc.b %00110110
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %01101100
dc.b %01101100
dc.b %11111110
dc.b %01101100
dc.b %11111110
dc.b %01101100
dc.b %01101100
dc.b %00000000
dc.b %00010000
dc.b %01111110
dc.b %11010000
dc.b %01111100
dc.b %00010110
dc.b %11111100
dc.b %00010000
dc.b %00000000
dc.b %01100010
dc.b %01100110
dc.b %00001100
dc.b %00011000
dc.b %00110000
dc.b %01100110
dc.b %11000110
dc.b %00000000
dc.b %00111000
dc.b %01101100
dc.b %01101000
dc.b %01110110
dc.b %11011100
dc.b %11001100
dc.b %01110110
dc.b %00000000
dc.b %00011000
dc.b %00011000
dc.b %00110000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00011100
dc.b %00110000
dc.b %00110000
dc.b %00110000
dc.b %00110000
dc.b %00110000
dc.b %00011100
dc.b %00000000
dc.b %00111000
dc.b %00001100
dc.b %00001100
dc.b %00001100
dc.b %00001100
dc.b %00001100
dc.b %00111000
dc.b %00000000
dc.b %00000000
dc.b %01101100
dc.b %00111000
dc.b %11111110
dc.b %00111000
dc.b %01101100
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00011000
dc.b %00011000
dc.b %01111110
dc.b %00011000
dc.b %00011000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00011000
dc.b %00011000
dc.b %00110000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %01111110
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00011000
dc.b %00011000
dc.b %00000000
dc.b %00000010
dc.b %00000110
dc.b %00001100
dc.b %00011000
dc.b %00110000
dc.b %01100000
dc.b %01000000
dc.b %00000000
digits: dc.b %00000000
dc.b %01111100
dc.b %11001110
dc.b %11011110
dc.b %11110110
dc.b %11100110
dc.b %01111100
dc.b %00000000
dc.b %00011000
dc.b %00111000
dc.b %00011000
dc.b %00011000
dc.b %00011000
dc.b %00011000
dc.b %00111100
dc.b %00000000
dc.b %01111100
dc.b %00000110
dc.b %01111100
dc.b %11000000
dc.b %11000000
dc.b %11000000
dc.b %11111110
dc.b %00000000
dc.b %01111110
dc.b %00000110
dc.b %00011100
dc.b %00000110
dc.b %00000110
dc.b %11000110
dc.b %01111100
dc.b %00000000
dc.b %00110000
dc.b %00110010
dc.b %01100110
dc.b %11000110
dc.b %11111111
dc.b %00000110
dc.b %00000110
dc.b %00000000
dc.b %11111110
dc.b %11000000
dc.b %11111100
dc.b %00000110
dc.b %00000110
dc.b %11000110
dc.b %01111100
dc.b %00000000
dc.b %01111100
dc.b %11000000
dc.b %11111100
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %01111100
dc.b %00000000
dc.b %11111110
dc.b %00000110
dc.b %00001100
dc.b %00011000
dc.b %00110000
dc.b %00110000
dc.b %00110000
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %01111100
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %01111100
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %01111110
dc.b %00000110
dc.b %01111100
dc.b %00000000
dc.b %00000000
dc.b %00011000
dc.b %00011000
dc.b %00000000
dc.b %00011000
dc.b %00011000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00011000
dc.b %00011000
dc.b %00000000
dc.b %00011000
dc.b %00011000
dc.b %00110000
dc.b %00000000
dc.b %00001100
dc.b %00011000
dc.b %00110000
dc.b %01100000
dc.b %00110000
dc.b %00011000
dc.b %00001100
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %01111110
dc.b %00000000
dc.b %01111110
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00110000
dc.b %00011000
dc.b %00001100
dc.b %00000110
dc.b %00001100
dc.b %00011000
dc.b %00110000
dc.b %00000000
dc.b %00111100
dc.b %01100110
dc.b %00001100
dc.b %00011000
dc.b %00011000
dc.b %00000000
dc.b %00011000
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %11000110
dc.b %11011110
dc.b %11011110
dc.b %11000000
dc.b %01111110
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %11111110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %00000000
dc.b %11111000
dc.b %11001100
dc.b %11111100
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11111100
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %11000000
dc.b %11000000
dc.b %11000000
dc.b %11000110
dc.b %01111100
dc.b %00000000
dc.b %11111000
dc.b %11001100
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11111100
dc.b %00000000
dc.b %11111110
dc.b %11000000
dc.b %11110000
dc.b %11000000
dc.b %11000000
dc.b %11000000
dc.b %11111110
dc.b %00000000
dc.b %11111110
dc.b %11000000
dc.b %11111000
dc.b %11000000
dc.b %11000000
dc.b %11000000
dc.b %11000000
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %11000000
dc.b %11001110
dc.b %11000110
dc.b %11000110
dc.b %01111110
dc.b %00000000
dc.b %11000110
dc.b %11000110
dc.b %11111110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %00000000
dc.b %01111110
dc.b %00011000
dc.b %00011000
dc.b %00011000
dc.b %00011000
dc.b %00011000
dc.b %01111110
dc.b %00000000
dc.b %00011110
dc.b %00000110
dc.b %00000110
dc.b %00000110
dc.b %00000110
dc.b %11000110
dc.b %01111100
dc.b %00000000
dc.b %11000110
dc.b %11001100
dc.b %11011000
dc.b %11110000
dc.b %11011000
dc.b %11001100
dc.b %11000110
dc.b %00000000
dc.b %11000000
dc.b %11000000
dc.b %11000000
dc.b %11000000
dc.b %11000000
dc.b %11000000
dc.b %11111110
dc.b %00000000
dc.b %10000010
dc.b %11000110
dc.b %11101110
dc.b %11111110
dc.b %11010110
dc.b %11000110
dc.b %11000110
dc.b %00000000
dc.b %11000110
dc.b %11100110
dc.b %11110110
dc.b %11011110
dc.b %11001110
dc.b %11000110
dc.b %11000110
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %01111100
dc.b %00000000
dc.b %11111000
dc.b %11001100
dc.b %11000110
dc.b %11000110
dc.b %11111100
dc.b %11000000
dc.b %11000000
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11011010
dc.b %01101100
dc.b %00000110
dc.b %11111100
dc.b %11000110
dc.b %11000110
dc.b %11111100
dc.b %11011000
dc.b %11001100
dc.b %11000110
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %01110000
dc.b %00011100
dc.b %01000110
dc.b %11000110
dc.b %01111100
dc.b %00000000
dc.b %01111110
dc.b %00011000
dc.b %00011000
dc.b %00011000
dc.b %00011000
dc.b %00011000
dc.b %00011000
dc.b %00000000
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %01111100
dc.b %00000000
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11001100
dc.b %11011000
dc.b %01110000
dc.b %00000000
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11010110
dc.b %11111110
dc.b %11101110
dc.b %01000100
dc.b %00000000
dc.b %11000110
dc.b %11000110
dc.b %01101100
dc.b %00111000
dc.b %01101100
dc.b %11000110
dc.b %11000110
dc.b %00000000
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %01111110
dc.b %00000110
dc.b %00000110
dc.b %11111100
dc.b %00000000
dc.b %11111110
dc.b %11000110
dc.b %00001100
dc.b %00011000
dc.b %00110000
dc.b %01100110
dc.b %11111110
dc.b %00000000
dc.b %00111100
dc.b %00110000
dc.b %00110000
dc.b %00110000
dc.b %00110000
dc.b %00110000
dc.b %00111100
dc.b %00000000
dc.b %11000000
dc.b %01100000
dc.b %00110000
dc.b %00011000
dc.b %00001100
dc.b %00000110
dc.b %00000010
dc.b %00000000
dc.b %00111100
dc.b %00001100
dc.b %00001100
dc.b %00001100
dc.b %00001100
dc.b %00001100
dc.b %00111100
dc.b %00000000
dc.b %00010000
dc.b %00111000
dc.b %01101100
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %11111111
dc.b %11111111
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00110000
dc.b %00110000
dc.b %00011000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00111100
dc.b %00000110
dc.b %01111110
dc.b %11000110
dc.b %01111110
dc.b %00000000
dc.b %11000000
dc.b %11000000
dc.b %11111100
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11111100
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %11000000
dc.b %11000110
dc.b %01111100
dc.b %00000000
dc.b %00000110
dc.b %00000110
dc.b %01111110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %01111110
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %11111110
dc.b %11000000
dc.b %01111110
dc.b %00000000
dc.b %00111100
dc.b %01100000
dc.b %01100000
dc.b %01111000
dc.b %01100000
dc.b %01100000
dc.b %01100000
dc.b %01100000
dc.b %00000000
dc.b %00000000
dc.b %01111110
dc.b %11000110
dc.b %11000110
dc.b %01111110
dc.b %00000110
dc.b %11111100
dc.b %11000000
dc.b %11000000
dc.b %11111100
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %00000000
dc.b %00011000
dc.b %00000000
dc.b %00011000
dc.b %00011000
dc.b %00011000
dc.b %00011000
dc.b %00111100
dc.b %00000000
dc.b %00001100
dc.b %00000000
dc.b %00001100
dc.b %00001100
dc.b %00001100
dc.b %00001100
dc.b %11001100
dc.b %01111000
dc.b %11000000
dc.b %11000000
dc.b %11000110
dc.b %11001100
dc.b %11111000
dc.b %11001100
dc.b %11000110
dc.b %00000000
dc.b %01100000
dc.b %01100000
dc.b %01100000
dc.b %01100000
dc.b %01100000
dc.b %01100000
dc.b %00111100
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %11101110
dc.b %11010110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %11111100
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %01111100
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %11111000
dc.b %11001100
dc.b %11000110
dc.b %11000110
dc.b %11111100
dc.b %11000000
dc.b %00000000
dc.b %00000000
dc.b %01111110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %01111110
dc.b %00000110
dc.b %00000000
dc.b %00000000
dc.b %11011100
dc.b %11100110
dc.b %11000000
dc.b %11000000
dc.b %11000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %01111110
dc.b %11000000
dc.b %01111100
dc.b %00000110
dc.b %11111100
dc.b %00000000
dc.b %01100000
dc.b %01100000
dc.b %11111000
dc.b %01100000
dc.b %01100000
dc.b %01100000
dc.b %00111100
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %01111100
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %11000110
dc.b %11000110
dc.b %01101100
dc.b %01101100
dc.b %00111000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %11000110
dc.b %11000110
dc.b %11010110
dc.b %11111110
dc.b %01101100
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %11000110
dc.b %01101100
dc.b %00111000
dc.b %01101100
dc.b %11000110
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %11000110
dc.b %11000110
dc.b %11000110
dc.b %01111110
dc.b %00000110
dc.b %11111100
dc.b %00000000
dc.b %00000000
dc.b %11111100
dc.b %00011000
dc.b %00110000
dc.b %01100000
dc.b %11111110
dc.b %00000000
dc.b %00001110
dc.b %00011000
dc.b %00010000
dc.b %00110000
dc.b %00010000
dc.b %00011000
dc.b %00001110
dc.b %00000000
dc.b %01111100
dc.b %11000110
dc.b %01101100
dc.b %10111010
dc.b %11111110
dc.b %10010010
dc.b %00010000
dc.b %00111000
dc.b %01110000
dc.b %00011000
dc.b %00001000
dc.b %00001100
dc.b %00001000
dc.b %00011000
dc.b %01110000
dc.b %00000000
dc.b %00110110
dc.b %01101100
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %00000000
dc.b %11111110
dc.b %10000010
dc.b %10111010
dc.b %10101010
dc.b %10111010
dc.b %10000010
dc.b %11111110
dc.b %00000000
;=============================================================================
SECTION ChipGfx,DATA_C
cpList: dc.w diwstrt,$2c81
dc.w diwstop,$2cc1
dc.w ddfstrt,$0038
dc.w ddfstop,$00d0
dc.w bplcon0,BPL*$1000+$200
dc.w bplcon1,$0000
dc.w bplcon2,$0024
dc.w bpl1mod,MODULO
dc.w bpl2mod,MODULO
dc.w clxcon,$03c1
cpBpl: ds.l BPL*2
dc.l $1007fffe
cpSprite: ds.l 16
dc.l -2,-2
;----------------------------------------------------------
CNOP 0,4
sprEmpty:
emptySprite: dc.l 0,0,0,0
CNOP 0,4
sprHero:
dc.l 0
dc.w %0001110000000000,0
dc.w %0001110000000000,0
dc.w %0010101000000000,0
dc.w %0101110100000000,0
dc.w %0100100100000000,0
dc.w %0001110000000000,0
dc.w %0010001000000000,0
dc.w %0010001000000000,0
dc.l 0
CNOP 0,4
sprKey:
dc.l 0
dc.w %0111000000000000,0
dc.w %1101100000000000,0
dc.w %1101100000000000,0
dc.w %0111000000000000,0
dc.w %0010000000000000,0
dc.w %0010000000000000,0
dc.w %0010000000000000,0
dc.w %0110000000000000,0
dc.l 0
CNOP 0,4
sprInfo: dc.l 0
dc.w %0000000000000000,0
dc.w %0110110000000000,0
dc.w %1111111000000000,0
dc.w %1111111000000000,0
dc.w %0111110000000000,0
dc.w %0011100000000000,0
dc.w %0001000000000000,0
dc.w %0000000000000000,0
dc.w %1010101010101010,0
dc.w %0101010101010101,0
dc.w 0,0
dc.w %0100110101011010,0
dc.w %0100100101010010,0
dc.w %0100110101011010,0
dc.w %0100100110010010,0
dc.w %0110110100011011,0
dc.w 0,0
sprLev dc.w %0000000000000000,0
dc.w %0000000000000000,0
dc.w %0000000000000000,0
dc.w %0000000000000000,0
dc.w %0000000000000000,0
dc.w %0000000000000000,0
dc.w %0000000000000000,0
dc.w %0000000000000000,0
dc.l 0
;=============================================================================
SECTION CleanGfx,BSS_C
screen: ds.b BROW*SCR_HEIGHT*BPL
|
PRG/levels/Airship/W1AIntro.asm | narfman0/smb3_pp1 | 0 | 102123 | ; Original address was $AC29
; Airship run, jump W1
.word W1AirshipL ; Alternate level layout
.word W1AirshipO ; Alternate object layout
.byte LEVEL1_SIZE_03 | LEVEL1_YSTART_170
.byte LEVEL2_BGPAL_00 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18
.byte LEVEL3_TILESET_10 | LEVEL3_VSCROLL_LOCKED | LEVEL3_PIPENOTEXIT
.byte LEVEL4_BGBANK_INDEX(10) | LEVEL4_INITACT_AIRSHIP
.byte LEVEL5_BGM_AIRSHIP | LEVEL5_TIME_300
.byte $79, $00, $3F, $79, $10, $3F, $40, $10, $0E, $79, $20, $3F, $E1, $31, $70, $FF
|
programs/oeis/016/A016770.asm | neoneye/loda | 22 | 101538 | <reponame>neoneye/loda
; A016770: a(n) = (3*n)^6.
; 0,729,46656,531441,2985984,11390625,34012224,85766121,191102976,387420489,729000000,1291467969,2176782336,3518743761,5489031744,8303765625,12230590464,17596287801,24794911296,34296447249,46656000000,62523502209,82653950016,107918163081,139314069504,177978515625,225199600704,282429536481,351298031616,433626201009,531441000000,646990183449,782757789696,941480149401,1126162419264,1340095640625,1586874322944,1870414552161,2194972623936,2565164201769,2985984000000,3462825991689,4001504141376,4608273662721,5289852801024,6053445140625,6906762437184,7858047974841,8916100448256,10090298369529,11390625000000,12827693806929,14412774445056,16157819263041,18075490334784,20179187015625,22483074023424,25002110044521,27752076864576,30749609024289,34012224000000,37558352909169,41407371740736,45579633110361,50096498540544,54980371265625,60254729561664,65944160601201,72074394832896,78672340886049,85766121000000,93385106978409,101559956668416,110322650964681,119706531338304,129746337890625,140478247931904,151939915084881,164170508913216,177210755074809,191102976000000,205891132094649,221620863468096,238339532186001,256096265048064,274941996890625,294929514414144,316113500535561,338550579265536,362299361110569,387420489000000,413976684737889,442032795979776,471655843734321,502915070389824,535881988265625,570630428688384,607236591593241,645779095649856,686339028913329
pow $0,6
mul $0,729
|
code/include/header.asm | sttng/merken-revision-2020 | 31 | 18361 | <filename>code/include/header.asm
;; NINTENDO LOGO
db $CE,$ED,$66,$66
db $CC,$0D,$00,$0B
db $03,$73,$00,$83
db $00,$0C,$00,$0D
db $00,$08,$11,$1F
db $88,$89,$00,$0E
db $DC,$CC,$6E,$E6
db $DD,$DD,$D9,$99
db $BB,$BB,$67,$63
db $6E,$0E,$EC,$CC
db $DD,$DC,$99,$9F
db $BB,$B9,$33,$3E
;; TITLE
db "B","A","L","I"
db "T", "A",$00,$00
db $00,$00,$00,$00
db $00,$00,$00
; GAMEBOY COLOR
db $00
;; MAKER
db $00,$00
;; MACHINE
db $00
;; CASSETTE TYPE
db $00
;; ROM SIZE
db $00
;; RAM SIZE
db $00
;; COUNTRY
db $01
;; GAMEBOY
db $00
;; ROM VERSION
db $00
;; NEGATIVE CHECK
db $67
;; CHECK SUM
db $00,$00 |
data/wildPokemon/mtsilver.asm | adhi-thirumala/EvoYellow | 16 | 163648 | MtSilverMons:
db $0A
db 7,SNEASEL
db 6,EEVEE
db 2,WOOPER
db 7,TEDDIURSA
db 3,PHANPY
db 6,TYROGUE
db 3,YANMA
db 3,SNEASEL
db 8,HOUNDOUR
db 2,HERACROSS
db $05
db 25,CHINCHOU
db 30,KINGLER
db 20,CHINCHOU
db 30,STARYU
db 35,TENTACOOL
db 30,STARYU
db 20,CHINCHOU
db 30,STARYU
db 30,CHINCHOU
db 30,STARYU
|
llvm-gcc-4.2-2.9/gcc/ada/s-gloloc-mingw.adb | vidkidz/crossbridge | 1 | 15751 | <filename>llvm-gcc-4.2-2.9/gcc/ada/s-gloloc-mingw.adb
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . G L O B A L _ L O C K S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2006, AdaCore --
-- --
-- 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, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This implementation is specific to NT
with GNAT.Task_Lock;
with Interfaces.C.Strings;
with System.OS_Interface;
package body System.Global_Locks is
package TSL renames GNAT.Task_Lock;
package OSI renames System.OS_Interface;
package ICS renames Interfaces.C.Strings;
subtype Lock_File_Entry is OSI.HANDLE;
Last_Lock : Lock_Type := Null_Lock;
Lock_Table : array (Lock_Type range 1 .. 15) of Lock_File_Entry;
-----------------
-- Create_Lock --
-----------------
procedure Create_Lock
(Lock : out Lock_Type;
Name : String)
is
L : Lock_Type;
begin
TSL.Lock;
Last_Lock := Last_Lock + 1;
L := Last_Lock;
TSL.Unlock;
if L > Lock_Table'Last then
raise Lock_Error;
end if;
Lock_Table (L) :=
OSI.CreateMutex (null, OSI.BOOL (False), ICS.New_String (Name));
Lock := L;
end Create_Lock;
------------------
-- Acquire_Lock --
------------------
procedure Acquire_Lock
(Lock : in out Lock_Type)
is
use type OSI.DWORD;
Res : OSI.DWORD;
begin
Res := OSI.WaitForSingleObject (Lock_Table (Lock), OSI.Wait_Infinite);
if Res = OSI.WAIT_FAILED then
raise Lock_Error;
end if;
end Acquire_Lock;
------------------
-- Release_Lock --
------------------
procedure Release_Lock
(Lock : in out Lock_Type)
is
use type OSI.BOOL;
Res : OSI.BOOL;
begin
Res := OSI.ReleaseMutex (Lock_Table (Lock));
if Res = OSI.False then
raise Lock_Error;
end if;
end Release_Lock;
end System.Global_Locks;
|
src/08-multi-func.asm | ARAJAMOMO5/MICE | 0 | 90497 | <reponame>ARAJAMOMO5/MICE<filename>src/08-multi-func.asm<gh_stars>0
; =====================================================
; To assemble and run:
; nasm -felf64 08-multi-func.asm -o 08-multi-func.o
; =====================================================
%include "include/consts.inc"
%include "include/syscalls_x86-64.inc"
global strchr
global strlen
global writeout
section .text
; function strlen returns length of string
; rdi - address of a string
; returns length of string in rax
strlen:
xor rcx, rcx
not rcx
xor rax, rax
cld
repnz scasb
not rcx
dec rcx
mov rax, rcx
ret
; function strchr returns address of character sought for
; returns end of string if character not found
; rdi - address of a string
; rsi - character we are looking for
; returns address of first occurence of character sought for in rax
strchr:
push rdi
push rsi
call strlen
mov rcx, rax
inc rcx
cld
pop rax
pop rdi
repnz scasb
dec rdi
mov rax, rdi
ret
; function prints string to the screen
; rdi - address of string
writeout:
push rdi
call strlen
mov rdx, rax
pop rsi
mov rax, sys_write
mov rdi, STDOUT
syscall
ret
|
asm/x86/aplib_x86_fast.asm | uniabis/apultra | 79 | 18102 | ; aplib_x86_fast.asm - speed-optimized aPLib decompressor for x86 - 188 bytes
;
; Copyright (C) 2019 <NAME>
;
; This software is provided 'as-is', without any express or implied
; warranty. In no event will the authors be held liable for any damages
; arising from the use of this software.
;
; Permission is granted to anyone to use this software for any purpose,
; including commercial applications, and to alter it and redistribute it
; freely, subject to the following restrictions:
;
; 1. The origin of this software must not be misrepresented; you must not
; claim that you wrote the original software. If you use this software
; in a product, an acknowledgment in the product documentation would be
; appreciated but is not required.
; 2. Altered source versions must be plainly marked as such, and must not be
; misrepresented as being the original software.
; 3. This notice may not be removed or altered from any source distribution.
segment .text
bits 32
; ---------------------------------------------------------------------------
; Decompress aPLib data
; inputs:
; * esi: compressed aPLib data
; * edi: output buffer
; output:
; * eax: decompressed size
; ---------------------------------------------------------------------------
%ifndef BIN
global apl_decompress
global _apl_decompress
%endif
; uint32_t apl_decompress(const void *Source, void *Destination);
%macro apl_get_bit 0 ; read bit into carry
add al,al ; shift bit queue, and high bit into carry
jnz %%gotbit ; queue not empty, bits remain
lodsb ; read 8 new bits
adc al,al ; shift bit queue, and high bit into carry
%%gotbit:
%endmacro
apl_decompress:
_apl_decompress:
pushad
%ifdef CDECL
mov esi, [esp+32+4] ; esi = aPLib compressed data
mov edi, [esp+32+8] ; edi = output
%endif
; === register map ===
; al: bit queue
; ah: unused, but value is trashed
; bx: follows_literal
; cx: scratch register for reading gamma2 codes and storing copy length
; dx: match offset (and rep-offset)
; si: input (compressed data) pointer
; di: output (decompressed data) pointer
; bp: temporary value, trashed
mov al,080H ; clear bit queue(al) and set high bit to move into carry
xor edx, edx ; invalidate rep offset
.literal:
movsb ; read and write literal byte
.next_command_after_literal:
mov ebx,03H ; set follows_literal(bx) to 3
.next_command:
apl_get_bit ; read 'literal or match' bit
jnc .literal ; if 0: literal
; 1x: match
apl_get_bit ; read '8+n bits or other type' bit
jc .other ; 11x: other type of match
; 10: 8+n bits match
call .get_gamma2 ; read gamma2-coded high offset bits
sub ecx,ebx ; high offset bits == 2 when follows_literal == 3 ?
; (a gamma2 value is always >= 2, so substracting follows_literal when it
; is == 2 will never result in zero)
jae .not_repmatch ; if not, not a rep-match
call .get_gamma2 ; read match length
jmp .got_len ; go copy
.not_repmatch:
mov edx,ecx ; transfer high offset bits to dh
shl edx, 8
mov dl,[esi] ; read low offset byte in dl
inc esi
call .get_gamma2 ; read match length
cmp edx,07D00H ; offset >= 32000 ?
jae .increase_len_by2 ; if so, increase match len by 2
cmp edx,0500H ; offset >= 1280 ?
jae .increase_len_by1 ; if so, increase match len by 1
cmp edx,0080H ; offset < 128 ?
jae .got_len ; if so, increase match len by 2, otherwise it would be a 7+1 copy
.increase_len_by2:
inc ecx ; increase length
.increase_len_by1:
inc ecx ; increase length
; copy cx bytes from match offset dx
.got_len:
push esi
mov esi,edi ; point to destination in es:di - offset in dx
sub esi,edx
rep movsb ; copy matched bytes
pop esi
mov bl,02H ; set follows_literal to 2 (bx is unmodified by match commands)
jmp .next_command
; read gamma2-coded value into cx
.get_gamma2:
xor ecx,ecx ; initialize to 1 so that value will start at 2
inc ecx ; when shifted left in the adc below
.gamma2_loop:
apl_get_bit ; read data bit
adc ecx,ecx ; shift into cx
apl_get_bit ; read continuation bit
jc .gamma2_loop ; loop until a zero continuation bit is read
ret
; handle 7 bits offset + 1 bit len or 4 bits offset / 1 byte copy
.other:
xor ecx,ecx
apl_get_bit ; read '7+1 match or short literal' bit
jc .short_literal ; 111: 4 bit offset for 1-byte copy
; 110: 7 bits offset + 1 bit length
movzx edx,byte[esi] ; read offset + length in dl
inc esi
inc ecx ; prepare cx for length below
shr dl,1 ; shift len bit into carry, and offset in place
je .done ; if zero offset: EOD
adc ecx,ecx ; len in cx: 1*2 + carry bit = 2 or 3
jmp .got_len
; 4 bits offset / 1 byte copy
.short_literal:
apl_get_bit ; read 4 offset bits
adc ecx,ecx
apl_get_bit
adc ecx,ecx
apl_get_bit
adc ecx,ecx
apl_get_bit
adc ecx,ecx
xchg eax,ecx ; preserve bit queue in cx, put offset in ax
jz .write_zero ; if offset is 0, write a zero byte
; short offset 1-15
mov ebx,edi ; point to destination in es:di - offset in ax
sub ebx,eax ; we trash bx, it will be reset to 3 when we loop
mov al,[ebx] ; read byte from short offset
.write_zero:
stosb ; copy matched byte
mov eax,ecx ; restore bit queue in al
jmp .next_command_after_literal
.done:
sub edi, [esp+32+8] ; compute decompressed size
mov [esp+28], edi
popad
ret
|
programs/oeis/339/A339051.asm | jmorken/loda | 1 | 16942 | <reponame>jmorken/loda<filename>programs/oeis/339/A339051.asm
; A339051: Even bisection of the infinite Fibonacci word A096270.
; 0,0,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,0,1,1,1,0,0,1,1,0
mul $0,2
sub $0,1
cal $0,5614 ; The binary complement of the infinite Fibonacci word A003849. Start with 1, apply 0->1, 1->10, iterate, take limit.
mov $1,$0
|
vcs.asm | TheRealCatherine/MakingGamesForAtari2600-MADS | 0 | 102665 | ; VCS.asm
; MADS compatible version by JAC! 2010-12-15.
; Based on VCS.H version 1.05, 2003-11-13.
; Last update on 2010-11-11.
; The latest version of this file is availble on
; http://www.wudsn.com/productions/atari2600/ide/VCS.asm
VERSION_VCS = 105
; THIS IS A PRELIMINARY RELEASE OF *THE* "STANDARD" VCS.H
; THIS FILE IS EXPLICITLY SUPPORTED AS A DASM-PREFERRED COMPANION FILE
; PLEASE DO *NOT* REDISTRIBUTE THIS FILE!
;
; This file defines hardware registers and memory mapping for the
; Atari 2600. It is distributed as a companion machine-specific support package
; for the DASM compiler. Updates to this file, DASM, and associated tools are
; available at at http://www.atari2600.org/dasm
;
; Many thanks to the original author(s) of this file, and to everyone who has
; contributed to understanding the Atari 2600. If you take issue with the
; contents, or naming of registers, please write to me (<EMAIL>)
; with your views. Please contribute, if you think you can improve this
; file!
;
; Latest Revisions...
; 1.05 13/NOV/2003 - Correction to 1.04 - now functions as requested by MR.
; - Added VERSION_VCS equate (which will reflect 100x version #)
; This will allow conditional code to verify VCS.H being
; used for code assembly.
; 1.04 12/NOV/2003 Added TIA_BASE_WRITE_ADDRESS and TIA_BASE_READ_ADDRESS for
; convenient disassembly/reassembly compatibility for hardware
; mirrored reading/writing differences. This is more a
; readability issue, and binary compatibility with disassembled
; and reassembled sources. Per <NAME> suggestion.
; 1.03 12/MAY/2003 Added SEG segment at end of file to fix old-code compatibility
; which was broken by the use of segments in this file, as
; reported by <NAME> on [stella] 11/MAY/2003
; 1.02 22/MAR/2003 Added TIMINT($285)
; 1.01 Constant offset added to allow use for 3F-style bankswitching
; - define TIA_BASE_ADDRESS as $40 for Tigervision carts, otherwise
; it is safe to leave it undefined, and the base address will
; be set to 0. Thanks to <NAME> for the suggestion.
; Note, may use -DLABEL=EXPRESSION to define TIA_BASE_ADDRESS
; - register definitions are now generated through assignment
; in uninitialised segments. This allows a changeable base
; address architecture.
; 1.0 22/MAR/2003 Initial release
;-------------------------------------------------------------------------------
; TIA_BASE_ADDRESS
; The TIA_BASE_ADDRESS defines the base address of access to TIA registers.
; Normally 0, the base address should (externally, before including this file)
; be set to $40 when creating 3F-bankswitched (and other?) cartridges.
; The reason is that this bankswitching scheme treats any access to locations
; < $40 as a bankswitch.
.if .not .def TIA_BASE_ADDRESS
TIA_BASE_ADDRESS = 0
.endif
; Note: The address may be defined on the command-line using the -D switch, eg:
; dasm.exe code.asm -DTIA_BASE_ADDRESS=$40 -f3 -v5 -ocode.bin
; *OR* by declaring the label before including this file, eg:
; TIA_BASE_ADDRESS = $40
; include "vcs.h"
; Alternate read/write address capability - allows for some disassembly compatibility
; usage ; to allow reassembly to binary perfect copies). This is essentially catering
; for the mirrored ROM hardware registers.
; Usage: As per above, define the TIA_BASE_READ_ADDRESS and/or TIA_BASE_WRITE_ADDRESS
; using the -D command-line switch, as required. If the addresses are not defined,
; they defaut to the TIA_BASE_ADDRESS.
.if .not .def TIA_BASE_READ_ADDRESS
TIA_BASE_READ_ADDRESS = TIA_BASE_ADDRESS
.endif
.if .not .def TIA_BASE_WRITE_ADDRESS
TIA_BASE_WRITE_ADDRESS = TIA_BASE_ADDRESS
.endif
;-------------------------------------------------------------------------------
org TIA_BASE_WRITE_ADDRESS
; DO NOT CHANGE THE RELATIVE ORDERING OF REGISTERS!
vsync .ds 1 ; $00 0000 00x0 Vertical Sync Set-Clear
vblank .ds 1 ; $01 xx00 00x0 Vertical Blank Set-Clear
wsync .ds 1 ; $02 ---- ---- Wait for Horizontal Blank
rsync .ds 1 ; $03 ---- ---- Reset Horizontal Sync Counter
nusiz0 .ds 1 ; $04 00xx 0xxx Number-Size player/missle 0
nusiz1 .ds 1 ; $05 00xx 0xxx Number-Size player/missle 1
colup0 .ds 1 ; $06 xxxx xxx0 Color-Luminance Player 0
colup1 .ds 1 ; $07 xxxx xxx0 Color-Luminance Player 1
colupf .ds 1 ; $08 xxxx xxx0 Color-Luminance Playfield
colubk .ds 1 ; $09 xxxx xxx0 Color-Luminance Background
ctrlpf .ds 1 ; $0A 00xx 0xxx Control Playfield, Ball, Collisions
; D0 = REF (reflect playfield)
; D1 = SCORE (left half of playfield gets color of player 0, right half gets color of player 1
; D2 = PFP (playfield gets priority over players so they can move behind the playfield)
; D4 & D5 = BALL SIZE
refp0 .ds 1 ; $0B 0000 x000 Reflection Player 0
refp1 .ds 1 ; $0C 0000 x000 Reflection Player 1
pf0 .ds 1 ; $0D xxxx 0000 Playfield Register Byte 0
pf1 .ds 1 ; $0E xxxx xxxx Playfield Register Byte 1
pf2 .ds 1 ; $0F xxxx xxxx Playfield Register Byte 2
resp0 .ds 1 ; $10 ---- ---- Reset Player 0
resp1 .ds 1 ; $11 ---- ---- Reset Player 1
resm0 .ds 1 ; $12 ---- ---- Reset Missle 0
resm1 .ds 1 ; $13 ---- ---- Reset Missle 1
resbl .ds 1 ; $14 ---- ---- Reset Ball
audc0 .ds 1 ; $15 0000 xxxx Audio Control 0
audc1 .ds 1 ; $16 0000 xxxx Audio Control 1
audf0 .ds 1 ; $17 000x xxxx Audio Frequency 0
audf1 .ds 1 ; $18 000x xxxx Audio Frequency 1
audv0 .ds 1 ; $19 0000 xxxx Audio Volume 0
audv1 .ds 1 ; $1A 0000 xxxx Audio Volume 1
grp0 .ds 1 ; $1B xxxx xxxx Graphics Register Player 0
grp1 .ds 1 ; $1C xxxx xxxx Graphics Register Player 1
enam0 .ds 1 ; $1D 0000 00x0 Graphics Enable Missle 0
enam1 .ds 1 ; $1E 0000 00x0 Graphics Enable Missle 1
enabl .ds 1 ; $1F 0000 00x0 Graphics Enable Ball
hmp0 .ds 1 ; $20 xxxx 0000 Horizontal Motion Player 0
hmp1 .ds 1 ; $21 xxxx 0000 Horizontal Motion Player 1
hmm0 .ds 1 ; $22 xxxx 0000 Horizontal Motion Missle 0
hmm1 .ds 1 ; $23 xxxx 0000 Horizontal Motion Missle 1
hmbl .ds 1 ; $24 xxxx 0000 Horizontal Motion Ball
vdelp0 .ds 1 ; $25 0000 000x Vertical Delay Player 0
vdelp1 .ds 1 ; $26 0000 000x Vertical Delay Player 1
vdelbl .ds 1 ; $27 0000 000x Vertical Delay Ball
resmp0 .ds 1 ; $28 0000 00x0 Reset Missle 0 to Player 0
resmp1 .ds 1 ; $29 0000 00x0 Reset Missle 1 to Player 1
hmove .ds 1 ; $2A ---- ---- Apply Horizontal Motion
hmclr .ds 1 ; $2B ---- ---- Clear Horizontal Move Registers
cxclr .ds 1 ; $2C ---- ---- Clear Collision Latches
dummy3 = cxclr
dummy4 = cxclr+$100
;-------------------------------------------------------------------------------
org TIA_BASE_READ_ADDRESS
; bit 7 bit 6
cxm0p .ds 1 ; $00 xx00 0000 Read Collision M0-P1 M0-P0
cxm1p .ds 1 ; $01 xx00 0000 M1-P0 M1-P1
cxp0fb .ds 1 ; $02 xx00 0000 P0-PF P0-BL
cxp1fb .ds 1 ; $03 xx00 0000 P1-PF P1-BL
cxm0fb .ds 1 ; $04 xx00 0000 M0-PF M0-BL
cxm1fb .ds 1 ; $05 xx00 0000 M1-PF M1-BL
cxblpf .ds 1 ; $06 x000 0000 BL-PF -----
cxppmm .ds 1 ; $07 xx00 0000 P0-P1 M0-M1
inpt0 .ds 1 ; $08 x000 0000 Read Pot Port 0
inpt1 .ds 1 ; $09 x000 0000 Read Pot Port 1
inpt2 .ds 1 ; $0A x000 0000 Read Pot Port 2
inpt3 .ds 1 ; $0B x000 0000 Read Pot Port 3
inpt4 .ds 1 ; $0C x000 0000 Read Input (Trigger) 0
inpt5 .ds 1 ; $0D x000 0000 Read Input (Trigger) 1
;-------------------------------------------------------------------------------
org $280 ;RIOT
; RIOT MEMORY MAP
swcha .ds 1 ; $280 Port A data register for joysticks:
; Bits 4-7 for player 1. Bits 0-3 for player 2.
swacnt .ds 1 ; $281 Port A data direction register (DDR)
swchb .ds 1 ; $282 Port B data (console switches)
swbcnt .ds 1 ; $283 Port B DDR
intim .ds 1 ; $284 Timer output
timint .ds 1 ; $285
; Unused/undefined registers ($285-$294)
.ds 1 ; $286
.ds 1 ; $287
.ds 1 ; $288
.ds 1 ; $289
.ds 1 ; $28A
.ds 1 ; $28B
.ds 1 ; $28C
.ds 1 ; $28D
.ds 1 ; $28E
.ds 1 ; $28F
.ds 1 ; $290
.ds 1 ; $291
.ds 1 ; $292
.ds 1 ; $293
tim1t .ds 1 ; $294 Set 1 clock interval
tim8t .ds 1 ; $295 Set 8 clock interval
tim64t .ds 1 ; $296 Set 64 clock interval
t1024t .ds 1 ; $297 Set 1024 clock interval
.macro assert_same_page
.if :1 / $100 <> (:1 + .len :1 - 1) / $100
.error ":1 crosses page boundary between ", :1, , " - ", :1 + .len :1 - 1
; .print "ERROR: :1 crosses page boundary between ", :1, , " - ", :1 + .len :1 - 1
.else
.print ":1 within page boundary between ", :1, , " - ", :1 + .len :1 - 1
.endif
.endm |
alloy4fun_models/trashltl/models/4/aGtxXoZPWYM2wqEto.als | Kaixi26/org.alloytools.alloy | 0 | 2837 | open main
pred idaGtxXoZPWYM2wqEto_prop5 {
some f:File | eventually some Trash
}
pred __repair { idaGtxXoZPWYM2wqEto_prop5 }
check __repair { idaGtxXoZPWYM2wqEto_prop5 <=> prop5o } |
Kernel/asm/libasm.asm | camilaDiToro/Kernel-Pure64 | 0 | 20243 | GLOBAL cpuVendor
GLOBAL sys_RTClock
GLOBAL sys_readKey
GLOBAL save_registers
; systemCalls.c
EXTERN store_registers
section .text
sys_RTClock:
push rbp
mov rbp, rsp
mov al, dil
out 70h, al
in al, 71h
mov rsp, rbp
pop rbp
ret
sys_readKey:
push rbp
mov rbp, rsp
xor rax, rax
.loop:
in al, 0x64 ; Read 8042 status register. Can be read at any time.
and al, 0x01 ; Output register 60h should only be read IIF Bit 0 of status port is set to 1.
cmp al, 0
je .loop
in al, 0x60
mov rsp, rbp
pop rbp
ret
cpuVendor:
push rbp
mov rbp, rsp
push rbx
mov rax, 0
cpuid
mov [rdi], ebx
mov [rdi + 4], edx
mov [rdi + 8], ecx
mov byte [rdi+13], 0
mov rax, rdi
pop rbx
mov rsp, rbp
pop rbp
ret
; Save registers for inforeg
save_registers:
push rbp
mov rbp, rsp
mov rdi, rsp
add rdi, 112 ; 14*8 = 112
call store_registers
mov rsp, rbp
pop rbp
ret |
examples/StateSized/StackStateDependent.agda | agda/ooAgda | 23 | 6704 | <filename>examples/StateSized/StackStateDependent.agda
{-# OPTIONS --postfix-projections #-}
module StateSized.StackStateDependent where
open import Data.Product
open import Function
open import Data.String.Base as Str
open import Data.Nat.Base as N
open import Data.Vec as Vec using (Vec; []; _∷_; head; tail)
open import Relation.Binary using (Rel)
open import Relation.Binary.PropositionalEquality
open import Relation.Binary.Product.Pointwise
open import NativeIO
open import SizedIO.Base
open import SizedIO.Console hiding (main)
open import StateSizedIO.GUI.BaseStateDependent
open import StateSizedIO.Object
open import StateSizedIO.IOObject
open import Size
StackStateˢ = ℕ
data StackMethodˢ (A : Set) : StackStateˢ → Set where
push : {n : StackStateˢ} → A → StackMethodˢ A n
pop : {n : StackStateˢ} → StackMethodˢ A (suc n)
StackResultˢ : (A : Set) → (s : StackStateˢ) → StackMethodˢ A s → Set
StackResultˢ A .n (push { n } x₁) = Unit
StackResultˢ A (suc .n) (pop {n} ) = A
nˢ : (A : Set) → (s : StackStateˢ) → (m : StackMethodˢ A s) → (r : StackResultˢ A s m) → StackStateˢ
nˢ A .n (push { n } x) r = suc n
nˢ A (suc .n) (pop { n }) r = n
StackInterfaceˢ : (A : Set) → Interfaceˢ
StackInterfaceˢ A .Stateˢ = StackStateˢ
StackInterfaceˢ A .Methodˢ = StackMethodˢ A
StackInterfaceˢ A .Resultˢ = StackResultˢ A
StackInterfaceˢ A .nextˢ = nˢ A
stackP : ∀{n : ℕ} → (i : Size) → (v : Vec String n) → IOObjectˢ consoleI (StackInterfaceˢ String) i n
method (stackP { n } i es) {j} (push e) = return (_ , stackP j (e ∷ es))
method (stackP {suc n} i (x ∷ xs)){j} pop = return (x , stackP j xs)
-- UNSIZED Version, without IO
stackP' : ∀{n : ℕ} → (v : Vec String n) → Objectˢ (StackInterfaceˢ String) n
stackP' es .objectMethod (push e) = (_ , stackP' (e ∷ es))
stackP' (x ∷ xs) .objectMethod pop = x , stackP' xs
stackO : ∀{E : Set} {n : ℕ} (v : Vec E n) → Objectˢ (StackInterfaceˢ E) n
objectMethod (stackO es) (push e) = _ , stackO (e ∷ es)
objectMethod (stackO (e ∷ es)) pop = e , stackO es
stackF : ∀{E : Set} (n : ℕ) (f : ℕ → E) → Objectˢ (StackInterfaceˢ E) n
objectMethod (stackF n f) (push x) = _ , stackF (suc n)
\{ zero → x
; (suc m) → f m
}
objectMethod (stackF (suc n) f) pop = (f zero) , stackF n (f ∘ suc)
tabulate : ∀{E : Set} (n : ℕ) (f : ℕ → E) → Vec E n
tabulate zero f = []
tabulate (suc n) f = f zero ∷ tabulate n λ m → f (suc m)
module _ {E : Set} where
private
I = StackInterfaceˢ E
S = Stateˢ I
O = Objectˢ I
open Bisim I
_≡×≅'_ : ∀{s} → (o o' : E × O s) → Set
_≡×≅'_ = _≡_ ×-Rel _≅_
Eq×Bisim : ∀ (s : S) → (o o' : E × O s) → Set
Eq×Bisim s = _≡_ ×-Rel _≅_
pop-after-push : ∀{n}{v : Vec E n} (e : E) (let stack = stackO v) →
(objectMethod stack (push e) ▹ λ { (_ , stack₁) →
objectMethod stack₁ pop ▹ λ { (e₁ , stack₂) →
( e₁ , stack₂ ) }})
≡×≅' (e , stack)
pop-after-push e = refl , refl≅ _
push-after-pop : ∀{n}{v : Vec E n} (e : E) (let stack = stackO (e ∷ v)) →
(objectMethod stack pop ▹ λ { (e₁ , stack₁) →
objectMethod stack₁ (push e₁) ▹ λ { (_ , stack₂) →
stack₂ }})
≅ stack
push-after-pop e = refl≅ _
-- The implementations of stacks with either vectors or functions are bisimilar.
impl-bisim : ∀{n : ℕ} {f : ℕ → E} (v : Vec E n) (p : tabulate n f ≡ v)
→ stackF n f ≅ stackO v
bisimMethod (impl-bisim v p) (push e) =
bisim (impl-bisim (e ∷ v) (cong (_∷_ e) p))
bisimMethod (impl-bisim (x ∷ v) p) pop rewrite cong head p =
bisim (impl-bisim v (cong tail p))
program : IOConsole ∞ Unit
program =
exec getLine λ str₀ →
method s₀ (push str₀) >>= λ{ (_ , s₁) → -- empty
exec getLine λ str₁ →
method s₁ (push str₁) >>= λ{ (_ , s₂) → -- full
method s₂ pop >>= λ{ (str₂ , s₃) →
exec (putStrLn ("first pop: " Str.++ str₂) ) λ _ →
exec getLine λ str₃ →
method s₃ (push str₃) >>= λ{ (_ , s₄) →
method s₄ pop >>= λ{ (str₄ , s₅) →
exec (putStrLn ("second pop: " Str.++ str₄) ) λ _ →
method s₅ pop >>= λ{ (str₅ , s₅) →
exec (putStrLn ("third pop: " Str.++ str₅) ) λ _ →
return unit
}}}}}}
where
s₀ = stackP ∞ []
main : NativeIO Unit
main = translateIOConsole program
|
day08/src/day.adb | jwarwick/aoc_2020 | 3 | 26794 | -- AoC 2020, Day 8
with VM; use VM;
with Ada.Text_IO;
with Ada.Containers.Ordered_Sets;
with Ada.Containers; use Ada.Containers;
package body Day is
package TIO renames Ada.Text_IO;
package PC_Sets is new Ada.Containers.Ordered_Sets (Element_Type => Instruction_Index);
use PC_Sets;
function acc_before_repeat(filename : in String) return Integer is
v : VM.VM := load_file(filename);
i : Instruction_Index := pc(v);
seen : PC_Sets.Set;
halt : Boolean;
begin
loop
if seen.contains(i) then
exit;
end if;
seen.insert(i);
halt := step(v);
i := pc(v);
end loop;
TIO.put_line("Halted?: " & Boolean'Image(halt));
return acc(v);
end acc_before_repeat;
function acc_after_terminate(filename : in String) return Integer is
v : VM.VM := load_file(filename);
max : constant Count_Type := instructions(v);
begin
for i in 0..max-1 loop
swap_nop_jmp(Instruction_Index(i), v);
-- backed this value down to find a reasonable cutoff
if eval(v, 250) then
return acc(v);
end if;
swap_nop_jmp(Instruction_Index(i), v);
reset(v);
end loop;
return -1;
end acc_after_terminate;
end Day;
|
alloy4fun_models/trashltl/models/14/AT8sX7EyBNujPoji5.als | Kaixi26/org.alloytools.alloy | 0 | 3571 | <filename>alloy4fun_models/trashltl/models/14/AT8sX7EyBNujPoji5.als<gh_stars>0
open main
pred idAT8sX7EyBNujPoji5_prop15 {
eventually(all f:File-Trash | eventually (f in Trash))
}
pred __repair { idAT8sX7EyBNujPoji5_prop15 }
check __repair { idAT8sX7EyBNujPoji5_prop15 <=> prop15o } |
oeis/144/A144758.asm | neoneye/loda-programs | 11 | 176889 | <reponame>neoneye/loda-programs<filename>oeis/144/A144758.asm
; A144758: Partial products of successive terms of A017197.
; 1,3,36,756,22680,884520,42456960,2420046720,159723083520,11979231264000,1006255426176000,93581754634368000,9545338972705536000,1059532625970314496000,127143915116437739520000,16401565050020468398080000,2263415976902824638935040000,332722148604715221923450880000,51904655182335574620058337280000,8564268105085369812309625651200000,1490182650284854347341874863308800000,272703425002128345563563099985510400000,52359057600408642348204115197217996800000,10524170577682137111989027154640817356800000
mul $0,9
trn $0,6
seq $0,114806 ; Nonuple factorial, 9-factorial, n!9, n!!!!!!!!!.
|
src/caches-simple_caches.ads | HeisenbugLtd/cache-sim | 0 | 4426 | ------------------------------------------------------------------------------
-- Copyright (C) 2012-2020 by Heisenbug Ltd.
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
--------------------------------------------------------------------------------
pragma License (Unrestricted);
--------------------------------------------------------------------------------
-- Provides the implementation of a simple cache.
--
-- All abstract methods from the Cache class are provided, plus a Connect
-- method to connect a cache to a secondary cache, so that a cache-hierarchy
-- can be built and properly simulated.
--
-- Fixed cache parameters like associativity, length of a cache line and the
-- number of available blocks are provided as discriminants.
-- The private methods Fetch_Line as well as address translation services
-- (Get_Block, To_Address) are declared and defined.
--
-- Assumptions made in the implementation:
-- Cache-line lengths are not expected to decrease with several levels
-- (generally spoken, a block of a lower-order cache should always be
-- contained within a block of the higher-order cache).
-- For instance, if the first level has a 64-byte granularity, and the second
-- level has a 32-byte cache-line, it would always require two (much slower)
-- accesses to load the whole cache-line of the first level. Likewise,
-- flushing a cache-line would require two distinct write operations to the
-- higher-order cache.
-- Doing such stupid thing does not make sense in the real world, so I see no
-- point in supporting it in this crappy simulation. The assumption is made
-- that a read or write access always operates on whole cache-lines
-- throughout the hierarchy.
--
-- Cache behaviour:
-- This simple cache simulates a cache similar to those found in any modern
-- micro-processor, yet there are some noteworthy differences:
--
-- 1) The strategy to flush cache-lines is to select a random line from the
-- available slots, most real-world caches employ a least-recently-used
-- strategy. So major differences between the simulated and an actual
-- performance are expected if certain pathological access pattern (like
-- forward/backward runs) are expected.
-- If such pathological cases are to be simulated, it might be better to
-- derive from this class and do a proper implementation for the
-- (protected) method Fetch_Line.
-- 2) The size of a memory access is not taken into account.
-- The cache behaves as if a single byte is requested each time.
-- In the real-word, a memory access could span across cache-lines, which
-- is not simulated here. However, it can be simulated by checking if an
-- unaligned (or large) access is attempted and then doing consecutive
-- reads accordingly.
-- This is how most processors handle unaligned accesses and as this is a
-- cache-, not a processor-simulation, you have to do it on your own if
-- you need it.
--
-- Performance Parameters:
-- The speed differences between multiple layers of caches can be influenced
-- by the Speed_Factor parameter in the Connect method.
-- The default is 8.0, as usual access time differences are in the ordner of
-- a magnitude.
-- To accomodate for the longer time when a cache line is loaded or flushed,
-- such an event is multiplied with the number of bytes in the cache-line
-- before adding it to the performance index. This might not be very precise,
-- because such loads are probably more direct (I'd expect that a cache-line
-- load is a single operation between caches), and writes are often buffered.
-- Yet, considering the much slower speed of the higher-order cache connected
-- it is probably still a good approximation. If all else fails, you can
-- still override the Perf_Index method to implement your own weighting of
-- the cache events.
--------------------------------------------------------------------------------
package Caches.Simple_Caches is
-- The basic cache class.
type Simple_Cache (Cache_Line : Line_Length;
Association : Associativity;
Num_Blocks : Full_Size;
Level_Id : Positive) is new Cache with private;
type Simple_Cache_Ptr is access all Simple_Cache'Class;
-- Overridden primitive operations.
-----------------------------------------------------------------------------
-- Initialize
--
-- Initializes the given cache. Result is a cold, empty cache.
-----------------------------------------------------------------------------
procedure Initialize (This : in out Simple_Cache);
-----------------------------------------------------------------------------
-- Flush
--
-- Flushes the given cache. Collected performance data is not erased. If
-- Recursive is True, any connected sub-level cache will be flushed, too.
-----------------------------------------------------------------------------
procedure Flush (This : in out Simple_Cache;
Recursive : in Boolean := True);
-----------------------------------------------------------------------------
-- Reset
--
-- Resets the performance data of the cache. It has no effect on the current
-- cache's state. If Recursive is True, applies to any connected sub-level
-- cache, too.
-----------------------------------------------------------------------------
procedure Reset (This : in out Simple_Cache;
Recursive : in Boolean := True);
-----------------------------------------------------------------------------
-- Read
--
-- Simulates a read access to the given address.
-----------------------------------------------------------------------------
procedure Read (This : in out Simple_Cache;
Where : in Address);
-----------------------------------------------------------------------------
-- Write
--
-- Simulates a write access to the given address.
-----------------------------------------------------------------------------
procedure Write (This : in out Simple_Cache;
Where : in Address);
-----------------------------------------------------------------------------
-- Perf_Index
--
-- Returns a float value representing the performance of the cache This. If
-- Recursive is True, any connected cache's performance value is added to
-- the performance value after correcting it via the appropriate speed
-- factor.
-----------------------------------------------------------------------------
function Perf_Index (This : in Simple_Cache;
Recursive : in Boolean := True) return Long_Float;
-- New primitive (inheritable) operations.
-----------------------------------------------------------------------------
-- Connect
--
-- Connects the given cache Next as next stage to the This one.
-- Speed_Factor is a multiplicator to be used when calculating cache
-- hierarchy performance.
-----------------------------------------------------------------------------
procedure Connect (This : in out Simple_Cache;
Next : access Cache'Class;
Speed_Factor : in Long_Float := 8.0);
private
-- Cache lines can be invalid (unused, empty), full (i.e. loaded),
-- and dirty (i.e. full, but written to it).
type Line_State is (Invalid, Full, Dirty);
-- Cache lines also store a tag indicating the upper bits of the cached
-- address.
type Cache_Line_Info is
record
State : Line_State;
Tag : Address;
end record;
-- Cache line state information for each line and # of associations.
type Cache_State is array (Full_Size range <>,
Associativity range <>) of Cache_Line_Info;
-- The cache class.
type Simple_Cache (Cache_Line : Line_Length;
Association : Associativity;
Num_Blocks : Full_Size;
Level_Id : Positive) is new Cache with
record
Next_Level : Cache_Ptr;
State : Cache_State (1 .. Num_Blocks, 1 .. Association);
end record;
-- Primitive operations with "protected" visibility.
-----------------------------------------------------------------------------
-- Get_Block
--
-- Returns block an tag number for given address with the current cache's
-- configuration.
-----------------------------------------------------------------------------
procedure Get_Block (This : in Simple_Cache;
Where : in Address;
Block : out Unsigned;
Tag : out Address);
-----------------------------------------------------------------------------
-- To_Address
--
-- Reverse function of Get_Block. Return the address associated with given
-- tag and block.
-----------------------------------------------------------------------------
function To_Address (This : in Simple_Cache;
Tag : in Address;
Block : in Unsigned) return Address;
-----------------------------------------------------------------------------
-- Fetch_Line
--
-- Simulate fetching a new cache line in the block.
-- State is the state of the cache line after being fetched.
-- Block and Tag indicate the address for the line to be fetched.
-----------------------------------------------------------------------------
procedure Fetch_Line (This : in out Simple_Cache;
Block : in Unsigned;
Tag : in Address;
State : in Line_State);
end Caches.Simple_Caches;
|
scripts/OpenIncognitoTab.applescript | liuyng0/awesome-hammerspoon | 0 | 749 | <reponame>liuyng0/awesome-hammerspoon
#!/usr/bin/osascript
on run {input}
do shell script "echo the URL:" & input & ">>/tmp/input.log"
set AppleScript's text item delimiters to ","
set urls to every text item of the input
set AppleScript's text item delimiters to ""
tell application "Google Chrome"
activate
set theWindow to make new window with properties {mode:"incognito"}
repeat with targetUrl in urls
set theUrl to my remove_http(targetUrl)
set found to false
set theTabIndex to -1
repeat with theTab in every tab of theWindow
set theTabIndex to theTabIndex + 1
set theTabUrl to my remove_http(theTab's URL as string)
if (theTabUrl contains theUrl) then
set found to true
exit repeat
end if
end repeat
if found then
tell theTab to reload
set theWindow's active tab index to theTabIndex
set index of theWindow to 1
else
tell window 1 to make new tab with properties {URL:targetUrl}
end if
end repeat
tell theWindow to close (every tab whose URL is equal to "chrome://newtab/")
-- repeat with theTab in every tab of theWindow
-- set theURL to URL of theTab
-- -- do shell script "echo the URL:" & theURL & ">>/tmp/test.log"
-- if theURL as string is equal to "chrome://newtab/" then
-- tell theWindow to close theTab
-- end if
-- end repeat
end tell
end run
on remove_http(input_url)
if (input_url contains "https://") then
return trim_line(input_url, "https://")
else
return trim_line(input_url, "http://")
end if
return input_url
end remove_http
-- Taken from: http://www.macosxautomation.com/applescript/sbrt/sbrt-06.html --
on trim_line(this_text, trim_chars)
set x to the length of the trim_chars
-- TRIM BEGINNING
repeat while this_text begins with the trim_chars
try
set this_text to characters (x + 1) thru -1 of this_text as string
on error
-- the text contains nothing but the trim characters
return ""
end try
end repeat
return this_text
end trim_line
|
_build/dispatcher/jmp_ippsSHA1Update_303bcab5.asm | zyktrcn/ippcp | 1 | 103437 | <reponame>zyktrcn/ippcp<gh_stars>1-10
extern m7_ippsSHA1Update:function
extern n8_ippsSHA1Update:function
extern y8_ippsSHA1Update:function
extern e9_ippsSHA1Update:function
extern l9_ippsSHA1Update:function
extern n0_ippsSHA1Update:function
extern k0_ippsSHA1Update:function
extern ippcpJumpIndexForMergedLibs
extern ippcpSafeInit:function
segment .data
align 8
dq .Lin_ippsSHA1Update
.Larraddr_ippsSHA1Update:
dq m7_ippsSHA1Update
dq n8_ippsSHA1Update
dq y8_ippsSHA1Update
dq e9_ippsSHA1Update
dq l9_ippsSHA1Update
dq n0_ippsSHA1Update
dq k0_ippsSHA1Update
segment .text
global ippsSHA1Update:function (ippsSHA1Update.LEndippsSHA1Update - ippsSHA1Update)
.Lin_ippsSHA1Update:
db 0xf3, 0x0f, 0x1e, 0xfa
call ippcpSafeInit wrt ..plt
align 16
ippsSHA1Update:
db 0xf3, 0x0f, 0x1e, 0xfa
mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc]
movsxd rax, dword [rax]
lea r11, [rel .Larraddr_ippsSHA1Update]
mov r11, qword [r11+rax*8]
jmp r11
.LEndippsSHA1Update:
|
Transynther/x86/_processed/AVXALIGN/_ht_st_zr_un_/i7-7700_9_0xca.log_21829_1491.asm | ljhsiun2/medusa | 9 | 9558 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/AVXALIGN/_ht_st_zr_un_/i7-7700_9_0xca.log_21829_1491.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x198ba, %r12
nop
nop
nop
cmp %rbp, %rbp
and $0xffffffffffffffc0, %r12
movntdqa (%r12), %xmm0
vpextrq $1, %xmm0, %r15
nop
nop
nop
nop
nop
sub $16957, %rdi
lea addresses_D_ht+0x120ca, %rsi
cmp $63202, %r11
movb (%rsi), %r12b
nop
sub $57633, %rsi
lea addresses_WC_ht+0x983a, %rdi
nop
nop
nop
nop
nop
sub $46847, %r11
mov $0x6162636465666768, %rbp
movq %rbp, %xmm2
and $0xffffffffffffffc0, %rdi
vmovntdq %ymm2, (%rdi)
nop
nop
cmp $3517, %r11
lea addresses_WC_ht+0x1605a, %rsi
lea addresses_UC_ht+0x7da, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
xor $15731, %r10
mov $24, %rcx
rep movsb
nop
nop
cmp %rsi, %rsi
lea addresses_WT_ht+0x1d33a, %rsi
nop
add $64395, %rbp
mov $0x6162636465666768, %rdi
movq %rdi, %xmm2
movups %xmm2, (%rsi)
nop
and $28731, %rbp
lea addresses_WC_ht+0x16012, %rdi
cmp %r10, %r10
mov (%rdi), %rbp
nop
nop
nop
nop
nop
xor $26435, %r10
lea addresses_WT_ht+0x107f0, %r10
clflush (%r10)
nop
nop
nop
nop
sub $15922, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
vmovups %ymm3, (%r10)
nop
nop
nop
nop
inc %rbp
lea addresses_A_ht+0x402c, %rsi
lea addresses_A_ht+0xe10e, %rdi
nop
xor $54743, %r11
mov $48, %rcx
rep movsl
nop
sub $54251, %rcx
lea addresses_WC_ht+0x839a, %r15
nop
xor $23581, %r10
movb (%r15), %r12b
cmp $6704, %r11
lea addresses_A_ht+0x17bba, %rsi
lea addresses_UC_ht+0x3bba, %rdi
nop
nop
nop
add %r15, %r15
mov $110, %rcx
rep movsb
nop
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_normal_ht+0x1dc66, %rbp
nop
nop
nop
nop
nop
lfence
movl $0x61626364, (%rbp)
nop
nop
nop
cmp $64134, %r10
lea addresses_UC_ht+0xf73a, %rcx
add $27935, %rsi
vmovups (%rcx), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %r12
nop
nop
nop
nop
and $40738, %r15
lea addresses_WC_ht+0x105ba, %rsi
lea addresses_normal_ht+0x3dda, %rdi
nop
nop
nop
nop
cmp %r10, %r10
mov $96, %rcx
rep movsl
nop
nop
nop
sub %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r9
push %rax
push %rsi
// Store
lea addresses_normal+0x1697a, %rax
nop
inc %r9
movb $0x51, (%rax)
nop
nop
nop
cmp $59021, %rsi
// Store
mov $0x1ba, %r9
nop
dec %r15
mov $0x5152535455565758, %r11
movq %r11, %xmm3
vmovups %ymm3, (%r9)
nop
nop
nop
nop
nop
inc %r14
// Faulty Load
lea addresses_UC+0xd9ba, %r15
clflush (%r15)
nop
nop
nop
nop
nop
sub $47251, %r9
mov (%r15), %r11
lea oracles, %rax
and $0xff, %r11
shlq $12, %r11
mov (%rax,%r11,1), %r11
pop %rsi
pop %rax
pop %r9
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal'}}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_P'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 7, 'AVXalign': False, 'same': True, 'size': 16, 'NT': True, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 32, 'NT': True, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 1, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 4, 'NT': True, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}}
{'46': 54, '48': 469, '45': 1842, '53': 502, '50': 16, 'de': 27, '80': 14, 'ff': 7060, '02': 4, '29': 1132, '00': 10695, '3c': 1, 'e0': 6, '26': 7}
00 00 ff 45 00 ff 00 ff 00 ff 00 00 00 ff 00 45 00 ff 29 00 ff 00 ff 29 00 ff 29 00 ff 29 00 45 00 50 ff 45 00 ff 00 ff 00 ff 00 ff 00 ff 00 45 00 00 ff 29 00 00 ff 00 45 00 48 ff 00 ff 00 ff 00 45 00 00 ff 00 ff 00 ff 00 ff 00 ff 45 00 00 ff 29 00 53 00 45 00 53 00 ff 00 00 ff 00 00 ff 00 48 ff 00 ff 00 ff 00 ff 00 ff 29 00 00 ff 45 00 ff 00 ff 00 48 ff 29 00 ff 00 ff 00 ff 45 00 00 ff 00 ff 00 00 ff 00 45 00 ff 00 45 00 46 ff 00 00 ff 45 00 00 ff 00 ff 00 00 45 00 53 00 45 00 ff 00 ff 00 00 ff 00 ff 00 ff 29 00 ff 00 45 00 53 00 ff 00 ff 00 53 00 ff 00 ff 00 00 ff 00 ff 00 ff 29 00 00 ff 00 ff 00 ff 00 45 00 ff 00 ff 00 ff 45 00 ff 00 00 ff 29 00 ff 00 ff 00 53 00 00 ff 00 ff 00 ff 00 ff 00 ff 00 45 00 ff 29 00 ff 00 ff 29 00 ff 00 ff 00 ff 00 53 00 ff 00 45 00 00 ff 00 ff 00 ff 00 45 00 ff 00 ff 00 ff 00 ff 00 50 ff 00 00 ff 29 00 00 00 00 00 ff 00 ff 00 00 45 00 00 ff 00 45 00 ff 00 ff 00 ff 00 00 ff 29 00 ff 00 48 ff 00 ff 00 ff 45 00 00 ff 29 00 00 ff 00 00 ff 00 45 00 ff 00 ff 29 00 45 00 00 48 ff 00 00 ff 00 00 00 00 ff 45 00 00 ff 00 ff 00 ff 45 00 ff 00 ff 00 00 ff 45 00 ff 00 ff 29 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 53 00 ff 00 ff 45 00 00 ff 00 ff 00 00 ff 00 00 ff 00 ff 29 00 53 00 ff 45 00 00 00 45 00 ff 00 ff 00 ff 29 00 45 00 ff 29 00 ff 00 00 46 ff 00 00 ff 00 45 00 ff 00 ff 00 ff 00 ff 00 ff 45 00 ff 00 ff 00 ff 00 ff 00 00 ff 00 00 48 ff 00 00 ff 00 45 00 ff 00 ff 00 53 00 ff 00 ff 00 ff 00 ff 00 45 00 00 45 00 ff 00 ff 00 ff 45 00 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 00 45 00 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 00 ff 00 00 ff 29 00 48 53 00 ff 00 ff 00 ff 00 ff 45 00 ff 00 ff 00 48 ff 00 ff 00 ff 29 00 48 ff 00 45 00 ff 29 00 48 00 ff 45 00 00 ff 00 45 00 ff 45 00 ff 00 00 ff 00 ff 00 ff 00 ff 00 ff 00 00 48 45 00 ff 00 00 ff 00 ff 00 ff 00 ff 45 00 00 ff 00 ff 00 00 ff 45 00 48 53 45 00 ff 00 00 ff 29 00 ff 00 00 45 00 ff 00 45 00 ff 29 00 ff 29 00 ff 00 ff 29 00 ff 00 ff 29 00 ff 29 00 ff 00 ff 00 45 00 53 00 45 00 ff 45 00 ff 00 ff 00 00 45 00 00 ff 00 ff 00 ff 00 45 00 ff 00 ff 00 ff 29 00 ff 00 00 ff 00 ff 29 00 ff 00 ff 00 53 00 ff 00 45 00 46 ff 00 ff 29 00 53 00 00 45 00 53 00 00 ff 00 ff 45 00 ff 45 00 ff 00 ff 00 ff 29 00 00 00 ff 45 00 00 ff 00 45 00 ff 00 ff 00 48 ff 00 ff 29 45 00 ff 00 ff 00 ff 00 ff 00 00 ff 45 00 00 ff 29 00 00 00 ff 29 00 ff 00 53 00 ff 00 ff 00 ff 00 ff 00 ff 45 00 ff 00 ff 00 00 ff 00 00 00 ff 00 ff 00 53 00 00 ff 00 45 00 00 00 ff 00 ff 29 00 45 00 ff 00 ff 00 00 ff 00 ff 45 00 00 ff 00 45 00 ff 00 45 00 ff 45 00 ff 80 ff 29 00 00 ff 00 45 00 ff 00 45 00 ff 00 48 53 00 ff 00 ff 45 00 ff 46 ff 00 ff 29 00 ff 00 00 29 00 ff 00 ff 00 45 00 ff 00 53 00 ff 29 00 ff 29 00 ff 00 ff 45 00 00 ff 29 ff 00 00 ff 00 ff 00 ff 00 ff 00 ff 00 45 00 ff 29 00 ff 00 ff 00 ff 00 ff 45 45 00 29 00 ff 29 00 45 00 00 53 00 ff 00 ff 45 00 ff 00 ff 00 ff 00 45 00 00 ff 29 00 ff 29 00 48 ff 00 ff 00 ff 45 00 ff 00 00 ff 00 ff 00 ff 00 ff 29 00 00 ff 29 00 ff 00 ff 00 53 00 48 ff 00 00 00
*/
|
LearnAssembly/chap3/memory.asm | wisemountain/wise.learn | 3 | 241693 | segment .data
a dd 4
b dd 4.4
c times 10 dd 0
d dw 1, 2
e db 0xfb
f db "hello world", 0
segment .bss
g resd 1
h resd 10
i resb 100
segment .text
global _start
_start:
mov eax, 60
mov ebx, 0
syscall
|
src/client/examples/example.asm | Mati365/i8086.js | 66 | 173866 | <filename>src/client/examples/example.asm<gh_stars>10-100
; NASM MBR boot loader
[bits 16] ; 16-bit code
[org 0x7c00] ; BIOS loads us at 0x07c0:0000
jmp 0x0000:initialize_bios ; reset code segment to 0x0000 with long jump
initialize_bios:
xor ax, ax
mov ds, ax ; reset data segments to 0x0000
mov es, ax
mov [bootdrive], dl ; store boot drive
mov si, welcome ; print welcome string
call print
;jmp load_kernel_header ; proceed to load kernel
halt:
hlt ; halt CPU to save power
jmp halt ; loop if halt interrupted
print: ; Print string in SI with bios
mov al, [si]
inc si
or al, al
jz exit_function ; end at NUL
mov ah, 0x0e ; op 0x0e
mov bh, 0x00 ; page number
mov bl, 0x07 ; color
int 0x10 ; INT 10 - BIOS print char
jmp print
exit_function:
ret
data:
welcome db 'Hello world!', 0 ; welcome message
error db 'Error', 0 ; error message
bootdrive db 0x00 ; original BIOS boot drive
times 510 - ($ - $$) db 0 ; should fill to 510 bytes. For demo changed to 200 bytes.
dw 0xaa55 ; boot signature (fills to 512 bytes)
|
ga_lib/src/test_mv.adb | rogermc2/GA_Ada | 3 | 26152 | <filename>ga_lib/src/test_mv.adb
with Ada.Text_IO; use Ada.Text_IO;
with Blade;
with C3GA_Utilities;
with GA_Maths;
with Multivector; use Multivector;
with Multivector_Type;
procedure Test_Mv is
no_bv : Multivector.Multivector := Get_Basis_Vector (Blade.no);
e1_bv : Multivector.Multivector := Get_Basis_Vector (Blade.e1);
e2_bv : Multivector.Multivector := Get_Basis_Vector (Blade.e2);
e3_bv : Multivector.Multivector := Get_Basis_Vector (Blade.e3);
ni_bv : Multivector.Multivector := Get_Basis_Vector (Blade.ni);
MV : Multivector.Multivector;
MV1 : Multivector.Multivector;
MV12 : Multivector.Multivector;
MV1p2 : Multivector.Multivector;
MV13 : Multivector.Multivector;
Op23 : Multivector.Multivector;
Op23_1 : Multivector.Multivector;
Add_1_Op23_1 : Multivector.Multivector;
MV_Info : Multivector_Type.MV_Type_Record;
begin
-- MV_Info := Multivector_Type.Init (MV);
-- C3GA_Utilities.Print_Multivector ("New", MV);
-- Multivector_Type.Print_Multivector_Info ("Null MV", MV_Info);
-- New_Line;
--
-- C3GA_Utilities.Print_Multivector ("no", no_bv);
-- MV_Info := Multivector_Type.Init (no_bv);
-- Put_Line ("Bit count: " & GA_Maths.Unsigned_32
-- 'Image (1) &
-- Natural'Image (GA_Maths.Bit_Count (1)));
-- Multivector_Type.Print_Multivector_Info ("no", MV_Info);
--
-- MV_Info := Multivector_Type.Init (e1_bv);
-- C3GA_Utilities.Print_Multivector ("e1", e1_bv);
-- Multivector_Type.Print_Multivector_Info ("e1", MV_Info);
--
-- C3GA_Utilities.Print_Multivector ("e2", e2_bv);
-- MV_Info := Multivector_Type.Init (e2_bv);
-- Multivector_Type.Print_Multivector_Info ("e2", MV_Info);
--
-- MV_Info := Multivector_Type.Init (e3_bv);
-- C3GA_Utilities.Print_Multivector ("e3", e3_bv);
-- Multivector_Type.Print_Multivector_Info ("e3", MV_Info);
--
-- C3GA_Utilities.Print_Multivector ("ni", ni_bv);
-- MV_Info := Multivector_Type.Init (ni_bv);
-- Multivector_Type.Print_Multivector_Info ("ni", MV_Info);
--
MV1 := e1_bv;
C3GA_Utilities.Print_Multivector ("MV = e1", MV1);
MV_Info := Multivector_Type.Init (MV1);
Multivector_Type.Print_Multivector_Info ("MV = e1", MV_Info);
MV1p2 := Add (e1_bv, e2_bv);
C3GA_Utilities.Print_Multivector ("e1 + e2", MV1p2);
MV_Info := Multivector_Type.Init (MV1p2);
Multivector_Type.Print_Multivector_Info ("e1 + e2", MV_Info);
MV12 := Outer_Product (e1_bv, e2_bv);
C3GA_Utilities.Print_Multivector ("e1 ^ e2", MV12);
MV_Info := Multivector_Type.Init (MV12);
Multivector_Type.Print_Multivector_Info ("e1 ^ e2", MV_Info);
MV13 := Outer_Product (e1_bv, e3_bv);
C3GA_Utilities.Print_Multivector ("e1 ^ e3", MV13);
MV_Info := Multivector_Type.Init (MV12);
Multivector_Type.Print_Multivector_Info ("e1 ^ e3", MV_Info);
-- Multivector A = e1.add(e2.op(e3).op(e1));
-- = e1 + (e2^e3)^e1)
Op23 := Outer_Product (e2_bv, e3_bv);
Op23_1 := Outer_Product (Op23, e1_bv);
Add_1_Op23_1 := Add (e1_bv, Op23_1);
C3GA_Utilities.Print_Multivector ("e1 + ((e2 ^ e3) ^ e1", Add_1_Op23_1);
MV_Info := Multivector_Type.Init (Add_1_Op23_1);
Multivector_Type.Print_Multivector_Info ("e1 + ((e2 ^ e3) ^ e1", MV_Info);
end Test_Mv;
|
asm/opcs.asm | pedroreissantos/pepe | 0 | 10144 | <gh_stars>0
SUB r1, r5
ADD r2, 5
|
programs/oeis/081/A081554.asm | jmorken/loda | 1 | 94606 | <filename>programs/oeis/081/A081554.asm<gh_stars>1-10
; A081554: a(n) = sqrt(2)*( (3+2*sqrt(2))^n - (3-2*sqrt(2))^n ).
; 0,8,48,280,1632,9512,55440,323128,1883328,10976840,63977712,372889432,2173358880,12667263848,73830224208,430314081400,2508054264192,14618011503752,85200014758320,496582077046168,2894292447518688
mul $0,2
mov $2,4
lpb $0
sub $0,1
add $3,$2
mov $4,$3
sub $3,4
add $3,$2
mov $1,$3
mov $2,$4
lpe
|
04-cubical-type-theory/material/Part3.agda | tomdjong/EPIT-2020 | 0 | 6024 | <reponame>tomdjong/EPIT-2020
{-
Part 3: Univalence and the SIP
- Univalence from ua and uaβ
- Transporting with ua (examples: ua not : Bool = Bool, ua suc : Z = Z, ...)
- Subst using ua
- The SIP as a consequence of ua
- Examples of using the SIP for math and programming (algebra, data
structures, etc.)
-}
{-# OPTIONS --cubical #-}
module Part3 where
open import Cubical.Foundations.Prelude hiding (refl ; transport ; subst ; sym)
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Univalence
open import Cubical.Data.Int
open import Part2 public
-- Another key concept in HoTT/UF is the Univalence Axiom. In Cubical
-- Agda this is provable, we hence refer to it as the Univalence
-- Theorem.
-- The univalence theorem: equivalences of types give paths of types
ua' : {A B : Type ℓ} → A ≃ B → A ≡ B
ua' = ua
-- Any isomorphism of types gives rise to an equivalence
isoToEquiv' : {A B : Type ℓ} → Iso A B → A ≃ B
isoToEquiv' = isoToEquiv
-- And hence to a path
isoToPath' : {A B : Type ℓ} → Iso A B → A ≡ B
isoToPath' e = ua' (isoToEquiv' e)
-- ua satisfies the following computation rule
-- This suffices to be able to prove the standard formulation of univalence.
uaβ' : {A B : Type ℓ} (e : A ≃ B) (x : A)
→ transport (ua' e) x ≡ fst e x
uaβ' e x = transportRefl (equivFun e x)
-- Time for an example!
-- Booleans
data Bool : Type₀ where
false true : Bool
not : Bool → Bool
not false = true
not true = false
notPath : Bool ≡ Bool
notPath = isoToPath' (iso not not rem rem)
where
rem : (b : Bool) → not (not b) ≡ b
rem false = refl
rem true = refl
_ : transport notPath true ≡ false
_ = refl
-- Another example, integers:
sucPath : Int ≡ Int
sucPath = isoToPath' (iso sucInt predInt sucPred predSuc)
_ : transport sucPath (pos 0) ≡ pos 1
_ = refl
_ : transport (sucPath ∙ sucPath) (pos 0) ≡ pos 2
_ = refl
_ : transport (sym sucPath) (pos 0) ≡ negsuc 0
_ = refl
-------------------------------------------------------------------------
-- The structure identity principle
-- A more efficient version of finite multisets based on association lists
open import Cubical.HITs.AssocList.Base
-- data AssocList (A : Type) : Type where
-- ⟨⟩ : AssocList A
-- ⟨_,_⟩∷_ : (a : A) (n : ℕ) (xs : AssocList A) → AssocList A
-- per : (a b : A) (m n : ℕ) (xs : AssocList A)
-- → ⟨ a , m ⟩∷ ⟨ b , n ⟩∷ xs ≡ ⟨ b , n ⟩∷ ⟨ a , m ⟩∷ xs
-- agg : (a : A) (m n : ℕ) (xs : AssocList A)
-- → ⟨ a , m ⟩∷ ⟨ a , n ⟩∷ xs ≡ ⟨ a , m + n ⟩∷ xs
-- del : (a : A) (xs : AssocList A) → ⟨ a , 0 ⟩∷ xs ≡ xs
-- trunc : (xs ys : AssocList A) (p q : xs ≡ ys) → p ≡ q
-- Programming and proving is more complicated with AssocList compared
-- to FMSet. This kind of example occurs everywhere in programming and
-- mathematics: one representation is easier to work with, but not
-- efficient, while another is efficient but difficult to work with.
-- Solution: substitute using univalence
substIso : {A B : Type ℓ} (P : Type ℓ → Type ℓ') (e : Iso A B) → P A → P B
substIso P e = subst P (isoToPath e)
-- Can transport for example Monoid structure from FMSet to AssocList
-- this way, but the achieved Monoid structure is not very efficient
-- to work with. A better solution is to prove that FMSet and
-- AssocList are equal *as monoids*, but how to do this?
-- Solution: structure identity principle (SIP)
-- This is a very useful consequence of univalence
open import Cubical.Foundations.SIP
{-
sip' : {ℓ : Level} {S : Type ℓ → Type ℓ} {ι : StrEquiv S ℓ}
(θ : UnivalentStr S ι) (A B : TypeWithStr ℓ S) → A ≃[ ι ] B → A ≡ B
sip' = sip
-}
-- The tricky thing is to prove that (S,ι) is a univalent structure.
-- Luckily we provide automation for this in the library, see for example:
-- open import Cubical.Algebra.Monoid.Base
-- Another cool application of the SIP: matrices represented as
-- functions out of pairs of Fin's and vectors are equal as abelian
-- groups:
open import Cubical.Algebra.Matrix
|
Kernel/asm/scheduler.asm | salCas276/OS-pure64 | 0 | 2166 | <filename>Kernel/asm/scheduler.asm
GLOBAL _buildContext , InitFirstProcess
EXTERN irqDispatcher , getCurrentRSP
%macro pushState 0
push rax
push rbx
push rcx
push rdx
push rbp
push rdi
push rsi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
%endmacro
%macro popState 0
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rsi
pop rdi
pop rbp
pop rdx
pop rcx
pop rbx
pop rax
%endmacro
; uint64_t _buildContext(uint64_t baseRSP, uint64_t functionAddress);
_buildContext:
push rbp
mov rbp, rsp
mov rsp, rdi
push 0x0 ; SS
push rdi ; RSP
push 0x206 ; RFLAGS
push 0x8 ; CS
push rsi ; RIP
mov rdi , rdx
mov rsi , rcx
pushState
mov rax, rsp
mov rsp, rbp
pop rbp
ret
InitFirstProcess:
;mov rdi, 0 ; pasaje de parametro
;call irqDispatcher
call getCurrentRSP;
mov rsp , rax ;; cambio de contexto.
popState
sti ;;set interrupts
iretq |
libsrc/_DEVELOPMENT/arch/sms/SMSlib/z80/_SMS_crt0_RST18.asm | jpoikela/z88dk | 640 | 172007 | ; **************************************************
; SMSlib - C programming library for the SMS/GG
; ( part of devkitSMS - github.com/sverx/devkitSMS )
; **************************************************
INCLUDE "SMSlib_private.inc"
SECTION code_clib
SECTION code_SMSlib
PUBLIC _SMS_crt0_RST18
_SMS_crt0_RST18: ; Restart 18h - write HL to VDP Data Port
ld a,l ; (respecting VRAM time costraints)
out (VDPDataPort),a ; 11
ld a,h ; 4
sub 0 ; 7
nop ; 4 = 26 (VRAM SAFE)
out (VDPDataPort),a
ret
|
hack/TrackWalker.applescript | theriex/itsip | 1 | 3922 | property newline : "
"
-- Convert legacy comment format to new style
on fixTrackComment(cmt)
-- not already in converted form and have old style code section
-- display dialog "before: " & cmt
if cmt does not start with "[f" and (offset of "[" in cmt) > 0 then
set fv to "30"
set codes to ""
if (offset of "freq:" in cmt) > 0 then
set startoffset to ((offset of "freq:" in cmt) + 5)
set endoffset to ((offset of "]" in cmt) - 1)
set fqc to (characters startoffset through endoffset of cmt) as text
set fv to fqc as integer
end if
if (offset of "Wakeup" in cmt) > 0 then
set codes to codes & "C"
end if
if (offset of "Travel" in cmt) > 0 then
set codes to codes & "T"
end if
if (offset of "Office" in cmt) > 0 then
set codes to codes & "O"
end if
if (offset of "Workout" in cmt) > 0 then
set codes to codes & "W"
end if
if (offset of "Dance" in cmt) > 0 then
set codes to codes & "D"
end if
if (offset of "Social" in cmt) > 0 then
set codes to codes & "S"
end if
set pcom to (reverse of (characters of cmt)) as text
set endoffset to (offset of "]" in pcom) - 1
if endoffset > 1 then
set pcom to characters 1 through endoffset of pcom
set pcom to ((reverse of pcom) as text)
else
set pcom to ""
end if
if length of pcom > 0 and pcom does not start with " " then
set pcom to " " & pcom
end if
set cmt to "[f" & fv & "k" & codes & "]" & pcom
-- display dialog "converted: " & cmt
end if
-- display dialog "after: " & cmt
return cmt
end fixTrackComment
tell application "iTunes"
repeat with ct in every track
set convtxt to my fixTrackComment(comment of ct)
set (comment of ct) to convtxt
end repeat
end tell
|
oeis/000/A000540.asm | neoneye/loda-programs | 11 | 11999 | <gh_stars>10-100
; A000540: Sum of 6th powers: 0^6 + 1^6 + 2^6 + ... + n^6.
; 0,1,65,794,4890,20515,67171,184820,446964,978405,1978405,3749966,6735950,11562759,19092295,30482920,47260136,71397705,105409929,152455810,216455810,302221931,415601835,563637724,754740700,998881325,1307797101,1695217590,2177107894,2771931215,3500931215,4388434896,5462176720,6753644689,8298449105,10136714730,12313497066,14879223475,17890159859,21408903620,25504903620,30255007861,35744039605,42065402654,49321716510,57625482135,67099779031,77878994360,90109584824,103950872025,119575872025
lpb $0
mov $2,$0
sub $0,1
pow $2,6
add $1,$2
lpe
mov $0,$1
|
src/fot/GroupTheory/AbelianGroup/PropertiesATP.agda | asr/fotc | 11 | 2598 | <filename>src/fot/GroupTheory/AbelianGroup/PropertiesATP.agda
------------------------------------------------------------------------------
-- Abelian group theory properties
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module GroupTheory.AbelianGroup.PropertiesATP where
open import GroupTheory.AbelianGroup.Base
------------------------------------------------------------------------------
postulate xyx⁻¹≡y : ∀ a b → a · b · a ⁻¹ ≡ b
{-# ATP prove xyx⁻¹≡y #-}
postulate x⁻¹y⁻¹≡[xy]⁻¹ : ∀ a b → a ⁻¹ · b ⁻¹ ≡ (a · b) ⁻¹
{-# ATP prove x⁻¹y⁻¹≡[xy]⁻¹ #-}
|
out/Prod/Signature.agda | JoeyEremondi/agda-soas | 39 | 9401 | {-
This second-order signature was created from the following second-order syntax description:
syntax Prod | P
type
_⊗_ : 2-ary | l40
term
pair : α β -> α ⊗ β | ⟨_,_⟩
fst : α ⊗ β -> α
snd : α ⊗ β -> β
theory
(fβ) a : α b : β |> fst (pair(a, b)) = a
(sβ) a : α b : β |> snd (pair(a, b)) = b
(pη) p : α ⊗ β |> pair (fst(p), snd(p)) = p
-}
module Prod.Signature where
open import SOAS.Context
-- Type declaration
data PT : Set where
_⊗_ : PT → PT → PT
infixl 40 _⊗_
open import SOAS.Syntax.Signature PT public
open import SOAS.Syntax.Build PT public
-- Operator symbols
data Pₒ : Set where
pairₒ fstₒ sndₒ : {α β : PT} → Pₒ
-- Term signature
P:Sig : Signature Pₒ
P:Sig = sig λ
{ (pairₒ {α}{β}) → (⊢₀ α) , (⊢₀ β) ⟼₂ α ⊗ β
; (fstₒ {α}{β}) → (⊢₀ α ⊗ β) ⟼₁ α
; (sndₒ {α}{β}) → (⊢₀ α ⊗ β) ⟼₁ β
}
open Signature P:Sig public
|
test/Succeed/Issue2288.agda | cruhland/agda | 1,989 | 13250 |
open import Agda.Builtin.Nat
open import Agda.Builtin.Equality
record Eq (A : Set) : Set₁ where
field
_≈_ : A → A → Set
open Eq {{...}} public
record Setoid : Set₁ where
field
∣_∣ : Set
{{eq}} : Eq ∣_∣
open Setoid public
instance
EqNat : Eq Nat
_≈_ {{EqNat}} = _≡_
NatSetoid : Setoid
∣ NatSetoid ∣ = Nat
thm : (x : ∣ NatSetoid ∣) → x ≈ x
thm x = refl
|
test/languages/ada/src/records.ads | claybrooks/dwarfgen | 0 | 22410 | package Records is
type RecordA is record
a: Character;
b: Integer;
end record;
type RecordB is record
a: String(1..100);
end record;
type RecordC is record
a: String(0..100);
end record;
type RecordD is record
a: String(10..100);
end record;
type RecordE is record
a: String(10..100);
end record;
type RecordF is record
a : Boolean;
b : Integer range 1 .. 120;
end record;
for RecordF use record
a at 0 range 0 .. 0;
b at 0 range 1 .. 7;
end record;
type BaseRecord is tagged record
a: Character;
b: Integer;
end record;
type DerivedRecord is new BaseRecord with record
c: Integer;
d: Integer;
end record;
type NonTaggedBaseRecord is record
a: Integer;
b: Integer;
end record;
type VariantSelect is (One, Two, Three);
-- The_Type is called the discriminant of the type
type VariantRecord(Selector: VariantSelect := One) is record
common: Integer;
case Selector is
when One =>
a: boolean;
when Two =>
b: Positive;
when Three =>
c: String(1..5);
end case;
end record;
type NonTaggedDerivedRecord is new NonTaggedBaseRecord;
a : RecordA;
b : RecordB;
c : RecordC;
d : RecordD;
e : RecordE;
f : RecordF;
--g: BaseRecord;
h: DerivedRecord;
i: NonTaggedDerivedRecord;
--variant: VariantRecord;
end Records; |
example_relationships/src/generic_fifo.adb | cortlandstarrett/mcada | 0 | 17754 | <filename>example_relationships/src/generic_fifo.adb
-- *************************************************************************************
-- The recipient is warned that this code should be handled in accordance
-- with the HM Government Security Classification indicated throughout.
--
-- This code and its contents shall not be used for other than UK Government
-- purposes.
--
-- The copyright in this code is the property of BAE SYSTEMS Electronic Systems Limited.
-- The Code is supplied by BAE SYSTEMS on the express terms that it is to be treated in
-- confidence and that it may not be copied, used or disclosed to others for any
-- purpose except in accordance with DEFCON 91 (Edn 10/92).
--
-- File Name: Generic_FIFO.adb
-- Version: As detailed by ClearCase
-- Version Date: As detailed by ClearCase
-- Creation Date: 03-11-99
-- Security Classification: Unclassified
-- Project: SRLE (Sting Ray Life Extension)
-- Author: <NAME>
-- Section: Tactical Software/ Software Architecture
-- Division: Underwater Systems Division
-- Description: Specification and implementation of application-wide FIFO type
-- Comments:
--
-- MODIFICATION RECORD
-- --------------------
-- NAME DATE ECR No MODIFICATION
--
-- **************************************************************************************
package body Generic_FIFO is
--
-- The free list retains the memory space of deleted items. If it results in unacceptable sizes
-- at run time, the option of deallocating excesses will be addressed
--
Free_List: FIFO_Access_Type;
--
------------------------------------------------------------------------------------------------
--
-- The FIFO is less used than the list structure, so does not as yet have the same diagnostic
-- operations. If they prove desirable, their inclusion will be considered.
--
procedure Push (
Item : in Element_Type;
Target_FIFO : in out FIFO_Type;
Top : in boolean := false) is
New_Cell: FIFO_Access_Type;
begin
-- Log.Put_Line ("Push: 'before' queue size -> "&integer'image (Target_FIFO.Size));
if Free_List = null then
--
-- there are no 'old' entries available for reuse
--
-- log.put_line ("Push called - no 'old' entries");
begin
New_Cell:= new FIFO_Cell_Type;
exception
when Storage_Error => raise FIFO_Overflow_Error ;
end;
else
--
-- there are,.. so take the first one and step on the free list
New_Cell := Free_List;
Free_List := Free_List. Next_Cell;
end if;
--
-- the new cell has been identified, so set the fields up
--
if Top then
--
-- put to FRONT of queue
--
New_Cell.all := (
Element_Pointer => Item,
Next_Cell => null,
Previous_Cell => Target_FIFO.Last_Entry);
--
-- link the new cell into the FIFO
--
if Target_FIFO.First_Entry = null then
Target_FIFO.First_Entry := New_Cell;
else
Target_FIFO.Last_Entry.Next_Cell := New_Cell;
end if;
Target_FIFO.Last_Entry := New_Cell;
else
--
-- (normal) put to back of queue
--
New_Cell.all := (
Element_Pointer => Item,
Next_Cell => Target_FIFO.First_Entry,
Previous_Cell => null);
--
-- link the new cell into the FIFO
--
if Target_FIFO.First_Entry = null then
Target_FIFO.Last_Entry := New_Cell;
else
Target_FIFO.First_Entry.Previous_Cell := New_Cell;
end if;
Target_FIFO.First_Entry := New_Cell;
end if;
--
-- and increment the size of the store
--
Target_FIFO.Size := Target_FIFO. Size + 1;
if Target_FIFO.Size > Target_FIFO.Max_Count then
Target_FIFO.Max_Count := Target_FIFO.Size;
end if;
end Push;
--
---------------------------------------------------------------------
--
procedure Pop (
Item : out Element_Type;
Target_FIFO : in out FIFO_Type) is
Old_Cell: FIFO_Access_Type;
begin
Target_FIFO := Target_FIFO;
if Target_FIFO. Last_Entry = null then raise FIFO_Underflow_Error;
--
-- trying to extract from an already-empty queue
--
else
--
-- set output parameter to be oldest entry (in time)
--
Item := Target_FIFO.Last_Entry.Element_Pointer ;
--
-- and undo and remake the links from the FIFO list
--
Old_Cell := Target_FIFO.Last_Entry;
Target_FIFO.Last_Entry := Target_FIFO.Last_Entry.Previous_Cell;
if Target_FIFO.Last_Entry /= null then
Target_FIFO.Last_Entry.Next_Cell := null;
else
Target_FIFO.First_Entry := null;
end if;
--
-- and decrement the size of the store
--
Target_FIFO.Size := Target_FIFO.Size - 1;
--
-- add deleted cell to the free list available for reuse
--
Old_Cell.Next_Cell := Free_List;
Old_Cell.Previous_Cell := null;
Free_List := Old_Cell;
end if;
end Pop;
--
---------------------------------------------------------------------
--
--
-- This function is provided only as an interface operation
--
function Queue_Length (Queue: FIFO_Type) return Natural is
begin
return Queue.Size;
end Queue_Length;
--
---------------------------------------------------------------------
function Max_Count_Of (Queue: FIFO_Type) return Natural is
begin
return Queue.Max_Count;
end Max_Count_Of;
---------------------------------------------------------------------
--
end Generic_FIFO;
|
src/sound/song336restored.asm | MusicTheorist/Mother2GbaTranslation | 1 | 242557 | <reponame>MusicTheorist/Mother2GbaTranslation
song336restored_pri equ 100
song336restored_rev equ 0
song336restored_mvl equ 127
song336restored_key equ 0
song336restored_tbs equ 1
song336restored_exg equ 0
song336restored_cmp equ 1
.align 4
;**************** Track 1 (Midi-Chn.7) ****************;
@song336restored_1:
.byte KEYSH , song336restored_key+0
; 000 ----------------------------------------
.byte VOICE , 8
.byte MODT , 0
.byte LFOS , 44
.byte PAN , c_v-64
.byte VOL , 0*song336restored_mvl/mxv
.byte BENDR , 12
.byte 12
.byte 12
.byte BEND , c_v-1
.byte W07
.byte VOL , 24*song336restored_mvl/mxv
.byte PAN , c_v-64
.byte BEND , c_v-1
.byte N02 , Cs3 , v088
.byte W04
.byte Gs3
.byte W03
.byte VOL , 44*song336restored_mvl/mxv
.byte W01
.byte N02 , As3
.byte W04
.byte Cn4
.byte W03
.byte VOL , 31*song336restored_mvl/mxv
.byte W01
.byte N02 , Cs3
.byte W04
.byte Gs3
.byte W03
.byte VOL , 24*song336restored_mvl/mxv
.byte W01
.byte N02 , As3
.byte W04
.byte Cn4
.byte W03
.byte VOL , 0*song336restored_mvl/mxv
.byte W01
.byte N02 , Cs3
.byte W04
.byte Gs3
.byte W04
.byte As3
.byte W04
.byte Cn4
.byte W44
.byte W01
; 001 ----------------------------------------
.byte W92
.byte W03
.byte VOICE , 8
.byte W01
; 002 ----------------------------------------
.byte 8
.byte BENDR , 12
.byte 12
.byte BEND , c_v-1
.byte FINE
;**************** Track 2 (Midi-Chn.8) ****************;
@song336restored_2:
.byte KEYSH , song336restored_key+0
; 000 ----------------------------------------
.byte VOICE , 8
.byte MODT , 0
.byte LFOS , 44
.byte PAN , c_v+0
.byte VOL , 100*song336restored_mvl/mxv
.byte BENDR , 12
.byte PAN , c_v+0
.byte VOL , 100*song336restored_mvl/mxv
.byte 100*song336restored_mvl/mxv
.byte PAN , c_v+0
.byte BENDR , 12
.byte PAN , c_v+0
.byte VOL , 100*song336restored_mvl/mxv
.byte 100*song336restored_mvl/mxv
.byte PAN , c_v+0
.byte BENDR , 12
.byte PAN , c_v+0
.byte VOL , 100*song336restored_mvl/mxv
.byte BEND , c_v+0
.byte N02 , Cs3 , v088
.byte W04
.byte Gs3
.byte W03
.byte VOL , 85*song336restored_mvl/mxv
.byte W01
.byte N02 , As3
.byte W04
.byte Cn4
.byte W03
.byte VOL , 65*song336restored_mvl/mxv
.byte W01
.byte N02 , Cs3
.byte W04
.byte Gs3
.byte W04
.byte As3
.byte W04
.byte Cn4
.byte W03
.byte VOL , 59*song336restored_mvl/mxv
.byte W01
.byte N02 , Cs3
.byte W04
.byte Gs3
.byte W03
.byte VOL , 24*song336restored_mvl/mxv
.byte W01
.byte N02 , As3
.byte W04
.byte Cn4
.byte W52
; 001 ----------------------------------------
.byte W92
.byte W03
.byte VOICE , 8
.byte VOL , 100*song336restored_mvl/mxv
.byte PAN , c_v+0
.byte BEND , c_v+0
.byte W01
; 002 ----------------------------------------
.byte VOICE , 8
.byte BENDR , 12
.byte PAN , c_v+0
.byte VOL , 24*song336restored_mvl/mxv
.byte BENDR , 12
.byte PAN , c_v+0
.byte VOL , 24*song336restored_mvl/mxv
.byte BEND , c_v+0
.byte FINE
;******************************************************;
.align 4
song336restored:
.byte 2 ; NumTrks
.byte 0 ; NumBlks
.byte song336restored_pri ; Priority
.byte song336restored_rev ; Reverb.
//emit_clean_voicegroup_offset_for_song 336
.word 0x81071B4 //Voice Table
.word @song336restored_1
.word @song336restored_2
|
adagl/linux/glx.ads | Lucretia/old_nehe_ada95 | 0 | 3165 | --
-- Copyright (c) 2002-2003, <NAME>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are
-- met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice,
-- this list of conditions and the following disclaimer in the
-- documentation
-- and/or other materials provided with the distribution.
-- * The names of its contributors may not 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;
-- 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.
--
with Interfaces.C;
with Interfaces.C.Extensions;
with System;
with GL;
with X_Lib;
package GLX is
package IC renames Interfaces.C;
package ICE renames Interfaces.C.Extensions;
GLX_VERSION_1_1 : constant := 1;
GLX_VERSION_1_2 : constant := 1;
GLX_VERSION_1_3 : constant := 1;
GLX_VERSION_1_4 : constant := 1;
GLX_EXTENSION_NAME : constant String := "GLX";
GLX_USE_GL : constant := 1;
GLX_BUFFER_SIZE : constant := 2;
GLX_LEVEL : constant := 3;
GLX_RGBA : constant := 4;
GLX_DOUBLEBUFFER : constant := 5;
GLX_STEREO : constant := 6;
GLX_AUX_BUFFERS : constant := 7;
GLX_RED_SIZE : constant := 8;
GLX_GREEN_SIZE : constant := 9;
GLX_BLUE_SIZE : constant := 10;
GLX_ALPHA_SIZE : constant := 11;
GLX_DEPTH_SIZE : constant := 12;
GLX_STENCIL_SIZE : constant := 13;
GLX_ACCUM_RED_SIZE : constant := 14;
GLX_ACCUM_GREEN_SIZE : constant := 15;
GLX_ACCUM_BLUE_SIZE : constant := 16#0010#;
GLX_ACCUM_ALPHA_SIZE : constant := 17;
GLX_BAD_SCREEN : constant := 1;
GLX_BAD_ATTRIBUTE : constant := 2;
GLX_NO_EXTENSION : constant := 3;
GLX_BAD_VISUAL : constant := 4;
GLX_BAD_CONTEXT : constant := 5;
GLX_BAD_VALUE : constant := 6;
GLX_BAD_ENUM : constant := 7;
GLX_VENDOR : constant := 1;
GLX_VERSION : constant := 2;
GLX_EXTENSIONS : constant := 3;
GLX_CONFIG_CAVEAT : constant := 16#0020#;
GLX_DONT_CARE : constant := 16#FFFF_FFFF#;
GLX_SLOW_CONFIG : constant := 16#0000_8001#;
GLX_NON_CONFORMANT_CONFIG : constant := 16#0000_800D#;
GLX_X_VISUAL_TYPE : constant := 16#0022#;
GLX_TRANSPARENT_TYPE : constant := 16#0023#;
GLX_TRANSPARENT_INDEX_VALUE : constant := 16#0024#;
GLX_TRANSPARENT_RED_VALUE : constant := 16#0025#;
GLX_TRANSPARENT_GREEN_VALUE : constant := 16#0026#;
GLX_TRANSPARENT_BLUE_VALUE : constant := 16#0027#;
GLX_TRANSPARENT_ALPHA_VALUE : constant := 16#0028#;
GLX_MAX_PBUFFER_WIDTH : constant := 16#0000_8016#;
GLX_MAX_PBUFFER_HEIGHT : constant := 16#0000_8017#;
GLX_MAX_PBUFFER_PIXELS : constant := 16#0000_8018#;
GLX_PRESERVED_CONTENTS : constant := 16#0000_801B#;
GLX_LARGEST_PBUFFER : constant := 16#0000_801C#;
GLX_WIDTH : constant := 16#0000_801D#;
GLX_HEIGHT : constant := 16#0000_801E#;
GLX_EVENT_MASK : constant := 16#0000_801F#;
GLX_DRAWABLE_TYPE : constant := 16#0000_8010#;
GLX_FBCONFIG_ID : constant := 16#0000_8013#;
GLX_VISUAL_ID : constant := 16#0000_800B#;
GLX_WINDOW_BIT : constant := 16#0001#;
GLX_PIXMAP_BIT : constant := 16#0002#;
GLX_PBUFFER_BIT : constant := 16#0004#;
GLX_AUX_BUFFERS_BIT : constant := 16#0010#;
GLX_FRONT_LEFT_BUFFER_BIT : constant := 16#0001#;
GLX_FRONT_RIGHT_BUFFER_BIT : constant := 16#0002#;
GLX_BACK_LEFT_BUFFER_BIT : constant := 16#0004#;
GLX_BACK_RIGHT_BUFFER_BIT : constant := 16#0008#;
GLX_DEPTH_BUFFER_BIT : constant := 16#0020#;
GLX_STENCIL_BUFFER_BIT : constant := 16#0040#;
GLX_ACCUM_BUFFER_BIT : constant := 16#0080#;
GLX_RENDER_TYPE : constant := 16#0000_8011#;
GLX_X_RENDERABLE : constant := 16#0000_8012#;
GLX_NONE : constant := 16#8000#;
GLX_TRUE_COLOR : constant := 16#0000_8002#;
GLX_DIRECT_COLOR : constant := 16#0000_8003#;
GLX_PSEUDO_COLOR : constant := 16#0000_8004#;
GLX_STATIC_COLOR : constant := 16#0000_8005#;
GLX_GRAY_SCALE : constant := 16#0000_8006#;
GLX_STATIC_GRAY : constant := 16#0000_8007#;
GLX_TRANSPARENT_RGB : constant := 16#0000_8008#;
GLX_TRANSPARENT_INDEX : constant := 16#0000_8009#;
GLX_RGBA_TYPE : constant := 16#0000_8014#;
GLX_COLOR_INDEX_TYPE : constant := 16#0000_8015#;
GLX_COLOR_INDEX_BIT : constant := 16#0002#;
GLX_RGBA_BIT : constant := 16#0001#;
GLX_SCREEN : constant := 16#0000_800C#;
GLX_PBUFFER_CLOBBER_MASK : constant := 16#0800_0000#;
GLX_DAMAGED : constant := 16#0000_8020#;
GLX_SAVED : constant := 16#0000_8021#;
GLX_WINDOW : constant := 16#0000_8022#;
GLX_PBUFFER : constant := 16#0000_8023#;
GLX_PBUFFER_HEIGHT : constant := 16#0000_8040#;
GLX_PBUFFER_WIDTH : constant := 16#0000_8041#;
GLX_SAMPLE_BUFFERS : constant := 16#0001_86A0#;
GLX_SAMPLES : constant := 16#0001_86A1#;
GLX_MESA_AGP_OFFSET : constant := 1;
type GLXContextID is new X_Lib.XID;
type GLXPixmap is new X_Lib.XID;
type GLXDrawable is new X_Lib.XID;
type GLXPbuffer is new X_Lib.XID;
type GLXWindow is new X_Lib.XID;
type GLXFBConfigID is new X_Lib.XID;
type GLXcontextRec is
record
null;
end record;
type GLXContext is access all GLXcontextRec;
type GLXFBConfigRec is
record
null;
end record;
type GLXFBConfig is access all GLXFBConfigRec;
type GLXFBConfig_Ptr is access all GLXFBConfig;
function glXChooseVisual(dpy : in X_Lib.Display_Pointer; screen : in X_Lib.Screen_Number; attribList : in GL.GLintPtr) return X_Lib.X_Visual_Info_Ptr;
function glXCreateContext(dpy : in X_Lib.Display_Pointer; vis : in X_Lib.X_Visual_Info_Ptr; shareList : in GLXContext; direct : in Integer) return GLXContext;
procedure glXDestroyContext(dpy : in X_Lib.Display_Pointer; ctx : in GLXContext);
function glXMakeCurrent(dpy : in X_Lib.Display_Pointer; drawable : in GLXDrawable; ctx : in GLXContext) return Integer;
procedure glXCopyContext(dpy : in X_Lib.Display_Pointer; src : in GLXContext; dst : in GLXContext; mask : in IC.unsigned);
procedure glXSwapBuffers(dpy : in X_Lib.Display_Pointer; drawable : in GLXDrawable);
function glXCreateGLXPixmap(dpy : in X_Lib.Display_Pointer; visual : in X_Lib.X_Visual_Info_Ptr; pixmap : in X_Lib.Pixmap_ID) return GLXPixmap;
procedure glXDestroyGLXPixmap(dpy : in X_Lib.Display_Pointer; pixmap : in GLXPixmap);
function glXQueryExtension(dpy : in X_Lib.Display_Pointer; errorb : in GL.GLintPtr; event : in GL.GLintPtr) return Boolean;
function glXQueryVersion(dpy : in X_Lib.Display_Pointer; maj : in GL.GLintPtr; min : in GL.GLintPtr) return Boolean;
function glXIsDirect(dpy : in X_Lib.Display_Pointer; ctx : in GLXContext) return Integer;
function glXGetConfig(dpy : in X_Lib.Display_Pointer; visual : in X_Lib.X_Visual_Info_Ptr; attrib : in Integer; value : in GL.GLintPtr) return Integer;
function glXGetCurrentContext return GLXContext;
function glXGetCurrentDrawable return GLXDrawable;
procedure glXWaitGL;
procedure glXWaitX;
procedure glXUseXFont(font : in X_Lib.Font_ID; first : in Integer; cnt : in Integer; list : in Integer);
function glXQueryExtensionsString(dpy : in X_Lib.Display_Pointer; screen : in Integer) return GL.GLubytePtr;
function glXQueryServerString(dpy : in X_Lib.Display_Pointer; screen : in Integer; name : in Integer) return GL.GLubytePtr;
function glXGetClientString(dpy : in X_Lib.Display_Pointer; name : in Integer) return GL.GLubytePtr;
function glXGetCurrentDisplay return X_Lib.Display_Pointer;
function glXChooseFBConfig(dpy : in X_Lib.Display_Pointer;
screen : in Integer;
attribList : in GL.GLintPtr;
nitems : in GL.GLintPtr) return GLXFBConfig_Ptr;
function glXGetFBConfigAttrib(dpy : in X_Lib.Display_Pointer;
config : in GLXFBConfig;
attribute : in Integer;
value : in GL.GLintPtr) return Integer;
function glXGetFBConfigs(dpy : in X_Lib.Display_Pointer;
screen : in Integer;
nelements : in GL.GLintPtr) return GLXFBConfig_Ptr;
function glXGetVisualFromFBConfig(dpy : in X_Lib.Display_Pointer; config : in GLXFBConfig) return X_Lib.X_Visual_Info_Ptr;
function glXCreateWindow(dpy : in X_Lib.Display_Pointer;
config : in GLXFBConfig;
win : in X_Lib.Window_ID;
attribList : in GL.GLintPtr) return GLXWindow;
procedure glXDestroyWindow(dpy : in X_Lib.Display_Pointer; window : in GLXWindow);
function glXCreatePixmap(dpy : in X_Lib.Display_Pointer;
config : in GLXFBConfig;
pixmap : in X_Lib.Pixmap_ID;
attribList : in GL.GLintPtr) return GLXPixmap;
procedure glXDestroyPixmap(dpy : in X_Lib.Display_Pointer; pixmap : in GLXPixmap);
function glXCreatePbuffer(dpy : in X_Lib.Display_Pointer; config : in GLXFBConfig; attribList : in GL.GLintPtr) return GLXPbuffer;
procedure glXDestroyPbuffer(dpy : in X_Lib.Display_Pointer; pbuf : in GLXPbuffer);
procedure glXQueryDrawable(dpy : in X_Lib.Display_Pointer; draw : in GLXDrawable; attribute : in Integer; value : in GL.GLuintPtr);
function glXCreateNewContext(dpy : in X_Lib.Display_Pointer;
config : in GLXFBConfig;
renderType : in Integer;
shareList : in GLXContext;
direct : in Integer) return GLXContext;
function glXMakeContextCurrent(dpy : in X_Lib.Display_Pointer;
draw : in GLXDrawable;
read : in GLXDrawable;
ctx : in GLXContext) return Integer;
function glXGetCurrentReadDrawable return GLXDrawable;
function glXQueryContext(dpy : in X_Lib.Display_Pointer;
ctx : in GLXContext;
attribute : in Integer;
value : in GL.GLintPtr) return Integer;
procedure glXSelectEvent(dpy : in X_Lib.Display_Pointer; drawable : in GLXDrawable; mask : in IC.unsigned);
procedure glXGetSelectedEvent(dpy : in X_Lib.Display_Pointer; drawable : in GLXDrawable; mask : in GL.GLuintPtr);
function glXBindTexImageARB(dpy : in X_Lib.Display_Pointer; pbuffer : in GLXPbuffer; buffer : in Integer) return Boolean;
function glXReleaseTexImageARB(dpy : in X_Lib.Display_Pointer; pbuffer : in GLXPbuffer; buffer : in Integer) return Boolean;
function glXDrawableAttribARB(dpy : in X_Lib.Display_Pointer; draw : in GLXDrawable; attribList : in GL.GLintPtr) return Boolean;
-- This one is tricky ;
-- function glXGetProcAddress (procname: GL.GLubytePtr)
-- return Interfaces.C.function_pointer;
function glXAllocateMemoryNV(size : in GL.GLsizei;
readfreq : in GL.GLfloat;
writefreq : in GL.GLfloat;
pri : in GL.GLfloat) return System.Address;
procedure glXFreeMemoryNV(pointer : access ICE.void_ptr);
function glXGetAGPOffsetMESA(pointer : access ICE.void_ptr) return GL.GLuint;
private
pragma Import (C, glXChooseVisual, "glXChooseVisual");
pragma Import (C, glXCreateContext, "glXCreateContext");
pragma Import (C, glXDestroyContext, "glXDestroyContext");
pragma Import (C, glXMakeCurrent, "glXMakeCurrent");
pragma Import (C, glXCopyContext, "glXCopyContext");
pragma Import (C, glXSwapBuffers, "glXSwapBuffers");
pragma Import (C, glXCreateGLXPixmap, "glXCreateGLXPixmap");
pragma Import (C, glXDestroyGLXPixmap, "glXDestroyGLXPixmap");
pragma Import (C, glXQueryExtension, "glXQueryExtension");
pragma Import (C, glXQueryVersion, "glXQueryVersion");
pragma Import (C, glXIsDirect, "glXIsDirect");
pragma Import (C, glXGetConfig, "glXGetConfig");
pragma Import (C, glXGetCurrentContext, "glXGetCurrentContext");
pragma Import (C, glXGetCurrentDrawable, "glXGetCurrentDrawable");
pragma Import (C, glXWaitGL, "glXWaitGL");
pragma Import (C, glXWaitX, "glXWaitX");
pragma Import (C, glXUseXFont, "glXUseXFont");
pragma Import (C, glXQueryExtensionsString, "glXQueryExtensionsString");
pragma Import (C, glXQueryServerString, "glXQueryServerString");
pragma Import (C, glXGetClientString, "glXGetClientString");
pragma Import (C, glXGetCurrentDisplay, "glXGetCurrentDisplay");
pragma Import (C, glXChooseFBConfig, "glXChooseFBConfig");
pragma Import (C, glXGetFBConfigAttrib, "glXGetFBConfigAttrib");
pragma Import (C, glXGetFBConfigs, "glXGetFBConfigs");
pragma Import (C, glXGetVisualFromFBConfig, "glXGetVisualFromFBConfig");
pragma Import (C, glXCreateWindow, "glXCreateWindow");
pragma Import (C, glXDestroyWindow, "glXDestroyWindow");
pragma Import (C, glXCreatePixmap, "glXCreatePixmap");
pragma Import (C, glXDestroyPixmap, "glXDestroyPixmap");
pragma Import (C, glXCreatePbuffer, "glXCreatePbuffer");
pragma Import (C, glXDestroyPbuffer, "glXDestroyPbuffer");
pragma Import (C, glXQueryDrawable, "glXQueryDrawable");
pragma Import (C, glXCreateNewContext, "glXCreateNewContext");
pragma Import (C, glXMakeContextCurrent, "glXMakeContextCurrent");
pragma Import (C, glXGetCurrentReadDrawable, "glXGetCurrentReadDrawable");
pragma Import (C, glXQueryContext, "glXQueryContext");
pragma Import (C, glXSelectEvent, "glXSelectEvent");
pragma Import (C, glXGetSelectedEvent, "glXGetSelectedEvent");
pragma Import (C, glXBindTexImageARB, "glXBindTexImageARB");
pragma Import (C, glXReleaseTexImageARB, "glXReleaseTexImageARB");
pragma Import (C, glXDrawableAttribARB, "glXDrawableAttribARB");
pragma Import (C, glXGetProcAddress, "glXGetProcAddress");
pragma Import (C, glXAllocateMemoryNV, "glXAllocateMemoryNV");
pragma Import (C, glXFreeMemoryNV, "glXFreeMemoryNV");
pragma Import (C, glXGetAGPOffsetMESA, "glXGetAGPOffsetMESA");
end GLX;
|
src/Dodo/Binary/Product.agda | sourcedennis/agda-dodo | 0 | 14937 | {-# OPTIONS --without-K --safe #-}
module Dodo.Binary.Product where
-- Stdlib imports
open import Level using (Level; _⊔_)
open import Function using (flip)
open import Data.Product using (_×_; _,_; map₁; map₂)
open import Relation.Unary using (Pred; _∈_)
open import Relation.Binary using (REL; Rel)
-- Local imports
open import Dodo.Unary.Equality
open import Dodo.Binary.Equality
open import Dodo.Binary.Domain
open import Dodo.Binary.Composition
infix 40 _×₂_
_×₂_ : ∀ {a b ℓ₁ ℓ₂} {A : Set a} {B : Set b}
→ Pred A ℓ₁
→ Pred B ℓ₂
-----------------
→ REL A B (ℓ₁ ⊔ ℓ₂)
_×₂_ P Q x y = P x × Q y
-- ## Operations: ×₂ ##
module _ {a b ℓ₁ ℓ₂ : Level} {A : Set a} {B : Set b}
{d : Pred A ℓ₁} {r : Pred B ℓ₂} where
×₂-dom : ∀ {x : A} {y : B} → ( d ×₂ r ) x y → d x
×₂-dom (dx , ry) = dx
×₂-codom : ∀ {x : A} {y : B} → ( d ×₂ r ) x y → r y
×₂-codom (dx , ry) = ry
×₂-flip : ∀ {x : A} {y : B} → ( d ×₂ r ) x y → ( r ×₂ d ) y x
×₂-flip (dx , ry) = (ry , dx)
module _ {a b ℓ₁ ℓ₂ ℓ₃ ℓ₄ : Level} {A : Set a} {B : Set b}
{d₁ : Pred A ℓ₁} {d₂ : Pred A ℓ₂} {r₁ : Pred B ℓ₃} {r₂ : Pred B ℓ₄} where
×₂-lift : ( d₁ ⊆₁ d₂ ) → ( r₁ ⊆₁ r₂ ) → d₁ ×₂ r₁ ⊆₂ d₂ ×₂ r₂
×₂-lift f g = ⊆: lemma
where
lemma : d₁ ×₂ r₁ ⊆₂' d₂ ×₂ r₂
lemma x y (d₁x , r₁y) = (⊆₁-apply f d₁x , ⊆₁-apply g r₁y)
module _ {a b ℓ₁ ℓ₂ ℓ₃ : Level} {A : Set a} {B : Set b} {R : REL A B ℓ₁}
{d : Pred A ℓ₂} {r : Pred B ℓ₃} where
×₂-applyˡ : R ⊆₂ ( d ×₂ r ) → {x : A} {y : B} → R x y → d x
×₂-applyˡ R⊆₂d×r Rxy = ×₂-dom {d = d} {r = r} (⊆₂-apply R⊆₂d×r Rxy)
×₂-apply-dom : R ⊆₂ (d ×₂ r) → {x : A} → x ∈ dom R → d x
×₂-apply-dom R⊆d×r (y , Rxy) = ×₂-applyˡ R⊆d×r Rxy
×₂-applyʳ : R ⊆₂ ( d ×₂ r ) → {x : A} {y : B} → R x y → r y
×₂-applyʳ R⊆₂d×r Rxy = ×₂-codom {d = d} {r = r} (⊆₂-apply R⊆₂d×r Rxy)
×₂-apply-codom : R ⊆₂ (d ×₂ r) → {y : B} → y ∈ codom R → r y
×₂-apply-codom R⊆d×r (x , Rxy) = ×₂-applyʳ R⊆d×r Rxy
module _ {a b ℓ₁ ℓ₂ ℓ₃ : Level} {A : Set a} {B : Set b}
{Q : REL A B ℓ₁} {d : A → Set ℓ₂} {r : B → Set ℓ₃} where
×₂-flip-⊆₂ : Q ⊆₂ d ×₂ r → flip Q ⊆₂ r ×₂ d
×₂-flip-⊆₂ (⊆: Q⊆×) = ⊆: lemma
where
lemma : flip Q ⊆₂' r ×₂ d
lemma x y Qyx with Q⊆× y x Qyx
... | (dy , rx) = (rx , dy)
module _ {a ℓ₁ ℓ₂ : Level} {A : Set a}
{R : Rel A ℓ₁} {P : Pred A ℓ₂} where
×₂-lift-udr :
udr R ⊆₁ P
-----------
→ R ⊆₂ P ×₂ P
×₂-lift-udr udrR⊆P = ⊆: lemma
where
lemma : R ⊆₂' P ×₂ P
lemma x y Rxy = ⊆₁-apply udrR⊆P (take-udrˡ R Rxy) , ⊆₁-apply udrR⊆P (take-udrʳ R Rxy)
module _ {a b ℓ₁ ℓ₂ ℓ₃ : Level} {A : Set a} {B : Set b}
{R : REL A B ℓ₁} {P : Pred A ℓ₂} {Q : Pred B ℓ₃} where
×₂-lift-dom :
dom R ⊆₁ P
→ codom R ⊆₁ Q
------------
→ R ⊆₂ P ×₂ Q
×₂-lift-dom (⊆: dom⊆P) (⊆: codom⊆Q) = ⊆: lemma
where
lemma : R ⊆₂' P ×₂ Q
lemma x y Rxy = (dom⊆P x (take-dom R Rxy) , codom⊆Q y (take-codom R Rxy))
module _ {a b ℓ₁ ℓ₂ ℓ₃ ℓ₄ : Level} {A : Set a} {B : Set b}
{Q : REL A B ℓ₁} {d₁ : Pred A ℓ₂} {d₂ : Pred A ℓ₃} {r : B → Set ℓ₄} where
×₂-⊆ˡ :
d₁ ⊆₁ d₂
------------------
→ d₁ ×₂ r ⊆₂ d₂ ×₂ r
×₂-⊆ˡ d₁⊆d₂ = ⊆: lemma
where
lemma : d₁ ×₂ r ⊆₂' d₂ ×₂ r
lemma x y = map₁ (⊆₁-apply d₁⊆d₂)
module _ {a b ℓ₁ ℓ₂ ℓ₃ ℓ₄ : Level} {A : Set a} {B : Set b}
{Q : REL A B ℓ₁} {d : Pred A ℓ₂} {r₁ : Pred B ℓ₃} {r₂ : Pred B ℓ₄} where
×₂-⊆ʳ :
r₁ ⊆₁ r₂
------------------
→ d ×₂ r₁ ⊆₂ d ×₂ r₂
×₂-⊆ʳ r₁⊆r₂ = ⊆: lemma
where
lemma : d ×₂ r₁ ⊆₂' d ×₂ r₂
lemma x y = map₂ (⊆₁-apply r₁⊆r₂)
module _ {a b c ℓ₁ ℓ₂ ℓ₃ ℓ₄ : Level} {A : Set a} {B : Set b} {C : Set c}
{d₁ : Pred A ℓ₁} {r₁ : Pred B ℓ₂} {d₂ : Pred B ℓ₃} {r₂ : Pred C ℓ₄} where
×₂-combine-⨾ : ( d₁ ×₂ r₁ ) ⨾ ( d₂ ×₂ r₂ ) ⊆₂ d₁ ×₂ r₂
×₂-combine-⨾ = ⊆: lemma
where
lemma : ( d₁ ×₂ r₁ ) ⨾ ( d₂ ×₂ r₂ ) ⊆₂' d₁ ×₂ r₂
lemma x y ((d₁x , r₁z) ⨾[ z ]⨾ (d₂z , r₂y)) = (d₁x , r₂y)
|
mips/14-2_exam.asm | ping58972/Computer-Organization-Architecture | 0 | 100231 | #Ch14-2
.data
x: .word 1
.text
.globl main
main:
lui $8, 0x1001
lw $9, 0($8)
ori $10, $0, 3
ori $11, $0, 7
mult $9, $10
mflo $10
addu $10, $10, $11
sll $11, $9, 1
addiu $11, $11, 8
div $10, $11
mflo $10
|
maps/CeladonGameCornerPrizeRoom.asm | Dev727/ancientplatinum | 1 | 5953 | <reponame>Dev727/ancientplatinum
CELADONGAMECORNERPRIZEROOM_TM32_COINS EQU 1500
CELADONGAMECORNERPRIZEROOM_TM29_COINS EQU 3500
CELADONGAMECORNERPRIZEROOM_TM15_COINS EQU 7500
CELADONGAMECORNERPRIZEROOM_PIKACHU_COINS EQU 2222
CELADONGAMECORNERPRIZEROOM_PORYGON_COINS EQU 5555
CELADONGAMECORNERPRIZEROOM_LARVITAR_COINS EQU 8888
object_const_def ; object_event constants
const CELADONGAMECORNERPRIZEROOM_GENTLEMAN
const CELADONGAMECORNERPRIZEROOM_PHARMACIST
CeladonGameCornerPrizeRoom_MapScripts:
db 0 ; scene scripts
db 0 ; callbacks
CeladonGameCornerPrizeRoomGentlemanScript:
jumptextfaceplayer CeladonGameCornerPrizeRoomGentlemanText
CeladonGameCornerPrizeRoomPharmacistScript:
jumptextfaceplayer CeladonGameCornerPrizeRoomPharmacistText
CeladonGameCornerPrizeRoomTMVendor:
faceplayer
opentext
writetext CeladonPrizeRoom_PrizeVendorIntroText
waitbutton
checkitem COIN_CASE
iffalse CeladonPrizeRoom_NoCoinCase
writetext CeladonPrizeRoom_AskWhichPrizeText
CeladonPrizeRoom_tmcounterloop:
special DisplayCoinCaseBalance
loadmenu CeladonPrizeRoom_TMMenuHeader
verticalmenu
closewindow
ifequal 1, .DoubleTeam
ifequal 2, .Psychic
ifequal 3, .HyperBeam
sjump CeladonPrizeRoom_CancelPurchaseScript
.DoubleTeam:
checkcoins CELADONGAMECORNERPRIZEROOM_TM32_COINS
ifequal HAVE_LESS, CeladonPrizeRoom_notenoughcoins
getitemname STRING_BUFFER_3, TM_DOUBLE_TEAM
scall CeladonPrizeRoom_askbuy
iffalse CeladonPrizeRoom_CancelPurchaseScript
giveitem TM_DOUBLE_TEAM
iffalse CeladonPrizeRoom_notenoughroom
takecoins CELADONGAMECORNERPRIZEROOM_TM32_COINS
sjump CeladonPrizeRoom_purchased
.Psychic:
checkcoins CELADONGAMECORNERPRIZEROOM_TM29_COINS
ifequal HAVE_LESS, CeladonPrizeRoom_notenoughcoins
getitemname STRING_BUFFER_3, TM_PSYCHIC_M
scall CeladonPrizeRoom_askbuy
iffalse CeladonPrizeRoom_CancelPurchaseScript
giveitem TM_PSYCHIC_M
iffalse CeladonPrizeRoom_notenoughroom
takecoins CELADONGAMECORNERPRIZEROOM_TM29_COINS
sjump CeladonPrizeRoom_purchased
.HyperBeam:
checkcoins CELADONGAMECORNERPRIZEROOM_TM15_COINS
ifequal HAVE_LESS, CeladonPrizeRoom_notenoughcoins
getitemname STRING_BUFFER_3, TM_HYPER_BEAM
scall CeladonPrizeRoom_askbuy
iffalse CeladonPrizeRoom_CancelPurchaseScript
giveitem TM_HYPER_BEAM
iffalse CeladonPrizeRoom_notenoughroom
takecoins CELADONGAMECORNERPRIZEROOM_TM15_COINS
sjump CeladonPrizeRoom_purchased
CeladonPrizeRoom_askbuy:
writetext CeladonPrizeRoom_ConfirmPurchaseText
yesorno
end
CeladonPrizeRoom_purchased:
waitsfx
playsound SFX_TRANSACTION
writetext CeladonPrizeRoom_HereYouGoText
waitbutton
sjump CeladonPrizeRoom_tmcounterloop
CeladonPrizeRoom_notenoughcoins:
writetext CeladonPrizeRoom_NotEnoughCoinsText
waitbutton
closetext
end
CeladonPrizeRoom_notenoughroom:
writetext CeladonPrizeRoom_NotEnoughRoomText
waitbutton
closetext
end
CeladonPrizeRoom_CancelPurchaseScript:
writetext CeladonPrizeRoom_ComeAgainText
waitbutton
closetext
end
CeladonPrizeRoom_NoCoinCase:
writetext CeladonPrizeRoom_NoCoinCaseText
waitbutton
closetext
end
CeladonPrizeRoom_TMMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 2, 15, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
.MenuData:
db STATICMENU_CURSOR ; flags
db 4 ; items
db "TM32 1500@"
db "TM29 3500@"
db "TM15 7500@"
db "CANCEL@"
CeladonGameCornerPrizeRoomPokemonVendor:
faceplayer
opentext
writetext CeladonPrizeRoom_PrizeVendorIntroText
waitbutton
checkitem COIN_CASE
iffalse CeladonPrizeRoom_NoCoinCase
.loop
writetext CeladonPrizeRoom_AskWhichPrizeText
special DisplayCoinCaseBalance
loadmenu .MenuHeader
verticalmenu
closewindow
ifequal 1, .Pikachu
ifequal 2, .Porygon
ifequal 3, .Larvitar
sjump CeladonPrizeRoom_CancelPurchaseScript
.Pikachu:
checkcoins CELADONGAMECORNERPRIZEROOM_PIKACHU_COINS
ifequal HAVE_LESS, CeladonPrizeRoom_notenoughcoins
readvar VAR_PARTYCOUNT
ifequal PARTY_LENGTH, CeladonPrizeRoom_notenoughroom
getmonname STRING_BUFFER_3, PIKACHU
scall CeladonPrizeRoom_askbuy
iffalse CeladonPrizeRoom_CancelPurchaseScript
waitsfx
playsound SFX_TRANSACTION
writetext CeladonPrizeRoom_HereYouGoText
waitbutton
loadmonindex 1, PIKACHU
special GameCornerPrizeMonCheckDex
givepoke PIKACHU, 25
takecoins CELADONGAMECORNERPRIZEROOM_PIKACHU_COINS
sjump .loop
.Porygon:
checkcoins CELADONGAMECORNERPRIZEROOM_PORYGON_COINS
ifequal HAVE_LESS, CeladonPrizeRoom_notenoughcoins
readvar VAR_PARTYCOUNT
ifequal PARTY_LENGTH, CeladonPrizeRoom_notenoughroom
getmonname STRING_BUFFER_3, PORYGON
scall CeladonPrizeRoom_askbuy
iffalse CeladonPrizeRoom_CancelPurchaseScript
waitsfx
playsound SFX_TRANSACTION
writetext CeladonPrizeRoom_HereYouGoText
waitbutton
loadmonindex 2, PORYGON
special GameCornerPrizeMonCheckDex
givepoke PORYGON, 15
takecoins CELADONGAMECORNERPRIZEROOM_PORYGON_COINS
sjump .loop
.Larvitar:
checkcoins CELADONGAMECORNERPRIZEROOM_LARVITAR_COINS
ifequal HAVE_LESS, CeladonPrizeRoom_notenoughcoins
readvar VAR_PARTYCOUNT
ifequal PARTY_LENGTH, CeladonPrizeRoom_notenoughroom
getmonname STRING_BUFFER_3, LARVITAR
scall CeladonPrizeRoom_askbuy
iffalse CeladonPrizeRoom_CancelPurchaseScript
waitsfx
playsound SFX_TRANSACTION
writetext CeladonPrizeRoom_HereYouGoText
waitbutton
loadmonindex 3, LARVITAR
special GameCornerPrizeMonCheckDex
givepoke LARVITAR, 40
takecoins CELADONGAMECORNERPRIZEROOM_LARVITAR_COINS
sjump .loop
.MenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 2, 17, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
.MenuData:
db STATICMENU_CURSOR ; flags
db 4 ; items
db "PIKACHU 2222@"
db "PORYGON 5555@"
db "LARVITAR 8888@"
db "CANCEL@"
CeladonGameCornerPrizeRoomGentlemanText:
text "I wanted PORYGON,"
line "but I was short by"
cont "100 coins…"
done
CeladonGameCornerPrizeRoomPharmacistText:
text "Whew…"
para "I've got to stay"
line "calm and cool…"
para "I can't lose my"
line "cool, or I'll lose"
cont "all my money…"
done
CeladonPrizeRoom_PrizeVendorIntroText:
text "Welcome!"
para "We exchange your"
line "coins for fabulous"
cont "prizes!"
done
CeladonPrizeRoom_AskWhichPrizeText:
text "Which prize would"
line "you like?"
done
CeladonPrizeRoom_ConfirmPurchaseText:
text "OK, so you wanted"
line "a @"
text_ram wStringBuffer3
text "?"
done
CeladonPrizeRoom_HereYouGoText:
text "Here you go!"
done
CeladonPrizeRoom_NotEnoughCoinsText:
text "You don't have"
line "enough coins."
done
CeladonPrizeRoom_NotEnoughRoomText:
text "You have no room"
line "for it."
done
CeladonPrizeRoom_ComeAgainText:
text "Oh. Please come"
line "back with coins!"
done
CeladonPrizeRoom_NoCoinCaseText:
text "Oh? You don't have"
line "a COIN CASE."
done
CeladonGameCornerPrizeRoom_MapEvents:
db 0, 0 ; filler
db 2 ; warp events
warp_event 2, 5, CELADON_CITY, 7
warp_event 3, 5, CELADON_CITY, 7
db 0 ; coord events
db 2 ; bg events
bg_event 2, 1, BGEVENT_READ, CeladonGameCornerPrizeRoomTMVendor
bg_event 4, 1, BGEVENT_READ, CeladonGameCornerPrizeRoomPokemonVendor
db 2 ; object events
object_event 0, 2, SPRITE_GENTLEMAN, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, CeladonGameCornerPrizeRoomGentlemanScript, -1
object_event 4, 4, SPRITE_PHARMACIST, SPRITEMOVEDATA_WALK_UP_DOWN, 0, 1, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, CeladonGameCornerPrizeRoomPharmacistScript, -1
|
lib/Backend/arm64/Thunks.asm | Taritsyn/ChakraCore | 8,664 | 95237 | ;-------------------------------------------------------------------------------------------------------
; Copyright (C) Microsoft. All rights reserved.
; Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
;-------------------------------------------------------------------------------------------------------
OPT 2 ; disable listing
#include "ksarm64.h"
OPT 1 ; re-enable listing
TTL Lib\Backend\arm64\Thunks.asm
;Js::Var NativeCodeGenerator::CheckCodeGenThunk(Js::RecyclableObject* function, Js::CallInfo callInfo, ...)
EXPORT |?CheckCodeGenThunk@NativeCodeGenerator@@SAPEAXPEAVRecyclableObject@Js@@UCallInfo@3@ZZ|
;Js::JavascriptMethod NativeCodeGenerator::CheckCodeGen(Js::JavascriptFunction * function)
IMPORT |?CheckCodeGen@NativeCodeGenerator@@SAP6APEAXPEAVRecyclableObject@Js@@UCallInfo@3@ZZPEAVScriptFunction@3@@Z|
#if defined(_CONTROL_FLOW_GUARD)
IMPORT __guard_check_icall_fptr
#endif
TEXTAREA
;;============================================================================================================
; NativeCodeGenerator::CheckCodeGenThunk
;;============================================================================================================
;Js::Var NativeCodeGenerator::CheckCodeGenThunk(Js::RecyclableObject* function, Js::CallInfo callInfo, ...)
NESTED_ENTRY ?CheckCodeGenThunk@NativeCodeGenerator@@SAPEAXPEAVRecyclableObject@Js@@UCallInfo@3@ZZ
PROLOG_SAVE_REG_PAIR fp, lr, #-(2*8+16*8)! ; establish stack frame
stp d0, d1, [sp, #16+0*8]
stp d2, d3, [sp, #16+2*8]
stp d4, d5, [sp, #16+4*8]
stp d6, d7, [sp, #16+6*8]
stp x0, x1, [sp, #16+8*8]
stp x2, x3, [sp, #16+10*8]
stp x4, x5, [sp, #16+12*8]
stp x6, x7, [sp, #16+14*8]
bl |?CheckCodeGen@NativeCodeGenerator@@SAP6APEAXPEAVRecyclableObject@Js@@UCallInfo@3@ZZPEAVScriptFunction@3@@Z| ; call NativeCodeGenerator::CheckCodeGen
mov x15, x0 ; move entry point to x15
#if defined(_CONTROL_FLOW_GUARD)
adrp x17, __guard_check_icall_fptr
ldr x17, [x17, __guard_check_icall_fptr]
blr x17
#endif
ldp d0, d1, [sp, #16+0*8]
ldp d2, d3, [sp, #16+2*8]
ldp d4, d5, [sp, #16+4*8]
ldp d6, d7, [sp, #16+6*8]
ldp x0, x1, [sp, #16+8*8]
ldp x2, x3, [sp, #16+10*8]
ldp x4, x5, [sp, #16+12*8]
ldp x6, x7, [sp, #16+14*8]
EPILOG_RESTORE_REG_PAIR fp, lr, #(2*8+16*8)!
EPILOG_NOP br x15 ; jump (tail call) to new entryPoint
NESTED_END
;;============================================================================================================
END
|
main.adb | Feqzz/film-parser | 0 | 16178 | <filename>main.adb<gh_stars>0
with Ada.Text_IO;
with Ada.Strings.Unbounded;
with Ada.Strings.Fixed;
with Ada.Command_Line;
with Ada.Integer_Text_IO;
with Ada.Task_Identification;
with Parser;
with Json;
procedure Main is
fileType : Ada.Text_IO.File_Type;
fileName : Ada.Strings.Unbounded.Unbounded_String;
counter: Integer;
currentLine : Ada.Strings.Unbounded.Unbounded_String;
currentArgument : Ada.Strings.Unbounded.Unbounded_String;
filmScore : Integer;
imdbId : Ada.Strings.Unbounded.Unbounded_String;
filmTitle : Ada.Strings.Unbounded.Unbounded_String;
filmYear : Ada.Strings.Unbounded.Unbounded_String;
showScore : Boolean := False;
showImdb : Boolean := False;
showOnlyImdb: Boolean := False;
writeToFile: Boolean := False;
procedure PrintUsage is
begin
Ada.Text_IO.Put_Line("Usage: film-parser <file.html> [options]");
Ada.Text_IO.Put_Line(" --score Shows the score for each movie. If there is none, 'Seen' is displayed");
Ada.Text_IO.Put_Line(" --imdb Appends the IMDb tab for each movie. Example: (tt0092550)");
Ada.Text_IO.Put_Line(" --only_imdb Overrides the other arguments and displays only the IMDb tags.");
Ada.Text_IO.Put_Line(" --json Writes to json file.");
end PrintUsage;
begin
if Ada.Command_Line.Argument_Count < 1 then
PrintUsage;
return;
end if;
if Ada.Command_Line.Argument(1) = "--help" or Ada.Command_Line.Argument(1) = "-h" then
PrintUsage;
return;
end if;
for I in 1 .. (Ada.Command_Line.Argument_Count - 1) loop
if Ada.Command_Line.Argument(I + 1) = "--score" then
showScore := True;
elsif Ada.Command_Line.Argument(I + 1) = "--imdb" then
showImdb := True;
elsif Ada.Command_Line.Argument(I + 1) = "--only_imdb" then
showImdb := True;
showOnlyImdb := True;
elsif Ada.Command_Line.Argument(I + 1) = "--json" then
writeToFile := True;
else
Ada.Text_IO.Put_Line("Invalid argument!");
return;
end if;
end loop;
counter := 0;
if writeToFile then
Json.Init;
end if;
fileName := Ada.Strings.Unbounded.To_Unbounded_String(Ada.Command_Line.Argument(1));
Ada.Text_IO.Open(fileType, Ada.Text_IO.In_File, Ada.Strings.Unbounded.To_String(fileName));
loop
exit when Ada.Text_IO.End_Of_File(fileType);
currentLine := Ada.Strings.Unbounded.To_Unbounded_String(Ada.Text_IO.Get_Line(fileType));
if (Ada.Strings.Fixed.Index (Ada.Strings.Unbounded.To_String(currentLine), "<a class=""l_movie""") > 0) then
--Found a movie!
counter := counter + 1;
for J in 1 .. Ada.Strings.Unbounded.Length (currentLine) loop
if Ada.Strings.Unbounded.Element (currentLine, J) = '>' then
for K in (J + 1) .. Ada.Strings.Unbounded.Length (currentLine) loop
if Ada.Strings.Unbounded.Element (currentLine, K) = '<' then
for L in 1 .. 4 loop
Ada.Strings.Unbounded.Append(filmYear, Ada.Strings.Unbounded.Element(currentLine, (K + 5 + L)));
end loop;
exit;
end if;
Ada.Strings.Unbounded.Append(filmTitle, Ada.Strings.Unbounded.Element(currentLine, K));
end loop;
exit;
end if;
end loop;
imdbId := Parser.getImdbMovieId(currentLine);
--Skips 6 lines in the HTML file.
for I in 1 .. 6 loop
currentLine := Ada.Strings.Unbounded.To_Unbounded_String(Ada.Text_IO.Get_Line(fileType));
end loop;
if (Ada.Strings.Fixed.Index (Ada.Strings.Unbounded.To_String(currentLine), "<span id=") > 0) then
filmScore := Parser.getRating(currentLine);
end if;
if writeToFile then
Json.AppendFilm(Ada.Strings.Unbounded.To_String(filmTitle), Ada.Strings.Unbounded.To_String(filmYear), Integer'Image(filmScore), Ada.Strings.Unbounded.To_String(imdbId));
end if;
--------------
-- Printing --
--------------
if showOnlyImdb then
Ada.Text_IO.Put(Ada.Strings.Unbounded.To_String(imdbId));
else
Ada.Text_IO.Put(Ada.Strings.Unbounded.To_String(filmTitle));
Ada.Text_IO.Put(" [");
Ada.Text_IO.Put(Ada.Strings.Unbounded.To_String(filmYear));
Ada.Text_IO.Put("]");
if showScore then
Ada.Text_IO.Put(" ");
if filmScore = -1 then
Ada.Text_IO.Put("Seen");
else
Ada.Integer_Text_IO.Put(filmScore, 2);
end if;
end if;
if showImdb then
Ada.Text_IO.Put(" ");
Ada.Text_IO.Put(Ada.Strings.Unbounded.To_String(imdbId));
end if;
end if;
Ada.Text_IO.New_Line;
Ada.Strings.Unbounded.Delete(filmYear, 1, Ada.Strings.Unbounded.Length(filmYear));
Ada.Strings.Unbounded.Delete(filmTitle, 1, Ada.Strings.Unbounded.Length(filmTitle));
end if;
end loop;
if counter = 0 then
Ada.Text_IO.Put("Sorry! Your file was not accepted.");
return;
end if;
Ada.Text_IO.Put("You have seen a total of ");
Ada.Integer_Text_IO.Put(counter, 4);
Ada.Text_IO.Put(" movies!");
Json.Close;
null;
end Main;
|
Laburi/Lab4/9-extract-from-vect/no_neg_pos.asm | DanBrezeanu/IOCLA | 2 | 4089 | %include "io.inc"
section .data
v db -2, 3, 4, 11, -100, 4, -1, 0
len db 8
section .text
global CMAIN
CMAIN:
;write your code here
xor eax, eax
xor edx, edx
mov ecx, [len]
count:
cmp byte [v + ecx - 1], 0
jl negative
inc eax
jmp end_loop
negative:
inc edx
end_loop:
loop count
PRINT_DEC 4, eax
NEWLINE
PRINT_DEC 4, edx
ret |
TinySimon.X/tinysimon.asm | 74hc595/TinySimon | 4 | 28697 | <filename>TinySimon.X/tinysimon.asm<gh_stars>1-10
;;; TinySimon
;;; <NAME> (<EMAIL>)
;;; August 7, 2016
;;;
;;; The game of Simon* for the PIC10F200: as of August 2016, this is the
;;; smallest, most space-constrained PIC available. The chip has three general-
;;; purpose I/O pins, one input-only pin, no interrupts, a 2-level deep stack,
;;; 256 words of program space, and 16 bytes of RAM.
;;;
;;; The "Charlieplexing" technique is used to drive four LEDS and one piezo
;;; speaker from three pins. Each of the four I/O pins is connected to a
;;; pushbutton with a pull-up resistor.
;;;
;;; The assignment of buttons to LEDs has been chosen very carefully. When one
;;; of GP0-GP2 goes low, the MCU drives one line high, applying voltage to one
;;; of the LED anodes.
;;; GP0 goes low: drive GP2 high, light LED 3
;;; GP1 goes low: drive GP0 high, light LED 1
;;; GP2 goes low: drive GP0 high, light LED 4
;;; Since GP3 is not multiplexed, when it goes low, the MCU can drive whichever
;;; lines it wants, so we illuminate the remaining LED.
;;; GP3 goes low: drive GP0 low and GP1 high, light LED 2
;;;
;;; The speaker can be driven by setting GP1 high and GP2 low, or vice versa.
;;;
;;; The PIC10F200 has a single 8-bit free-running timer, Timer0. With the 1:256
;;; prescaler enabled, this is used for delay loops when generating pauses or
;;; tones. When the program starts, we disable the prescaler, and use two timer
;;; readings (one taken when a button is pressed to start the game, and another
;;; when the button is released) as the seed for a 16-bit linear feedback shift
;;; register (LFSR).
;;;
;;; The LFSR is used to generate color sequences without explicitly storing an
;;; array of values in memory. At the start of a sequence of length n, we reset
;;; the LFSR to the initial seed, extract n 2-bit numbers, and light the
;;; appropriate LEDs.
;;; After the sequence has been played, we reset the LFSR again. After each
;;; button press, we extract a 2-bit number from the LFSR and compare it to the
;;; pressed button. If the two match, the previous steps are repeated until the
;;; end of the sequence is reached. If not, the game is over.
;;; After the player has correctly repeated the sequence, the sequence length
;;; is incremented by 1, the LFSR is reset to the initial seed, and the process
;;; is repeated.
;;; The maximum sequence length is 256. If someone is actually capable of
;;; successfully repeating a 256-element sequence, the sequence length resets
;;; to 1. This is simply a design choice; sequences of infinite length can be
;;; generated, though the pattern will repeat every (I think?) 65535 elements.
;;; (the LFSR has a period of 65535; 2 shifts are performed for each element;
;;; after 65535 shifts the LFSR will wrap around but the output sequence will be
;;; shifted by 1 bit; when the LFSR wraps around a second time, the sequence
;;; will start repeating.)
;;;
;;; * "Simon" is a trademark of Hasbro.
include "p10f200.inc"
__config _WDTE_OFF & _CP_OFF & _MCLRE_OFF
;;; Delay between sequence elements. Lower numbers increase difficulty.
SEQSPEED equ 5
;;; GPIO and TRIS bit definitions for GP0, GP1, GP2
GP0_H equ b'00000001'
GP0_L equ b'00000000'
GP0_Z equ b'00000001'
TR0_H equ b'00000000'
TR0_L equ b'00000000'
TR0_Z equ b'00000001'
GP1_H equ b'00000010'
GP1_L equ b'00000000'
GP1_Z equ b'00000010'
TR1_H equ b'00000000'
TR1_L equ b'00000000'
TR1_Z equ b'00000010'
GP2_H equ b'00000100'
GP2_L equ b'00000000'
GP2_Z equ b'00000100'
TR2_H equ b'00000000'
TR2_L equ b'00000000'
TR2_Z equ b'00000100'
;;; GPIO and TRIS values for turning on each output
UNUSED_PINS equ b'11111000'
LED1ON_TRIS equ UNUSED_PINS | TR0_H | TR1_L | TR2_H
LED1ON_GPIO equ UNUSED_PINS | GP0_H | GP1_L | GP2_H
LED2ON_TRIS equ UNUSED_PINS | TR0_L | TR1_H | TR2_L
LED2ON_GPIO equ UNUSED_PINS | GP0_L | GP1_H | GP2_L
LED3ON_TRIS equ UNUSED_PINS | TR0_L | TR1_L | TR2_H
LED3ON_GPIO equ UNUSED_PINS | GP0_L | GP1_L | GP2_H
LED4ON_TRIS equ UNUSED_PINS | TR0_H | TR1_H | TR2_L
LED4ON_GPIO equ UNUSED_PINS | GP0_H | GP1_H | GP2_L
SPKRON_TRIS equ UNUSED_PINS | TR0_Z | TR1_H | TR2_L
SPKRON_GPIO equ UNUSED_PINS | GP0_Z | GP1_H | GP2_L
;;; RAM locations
SEED_L equ 0x10 ;game random seed, lower byte
SEED_H equ 0x11 ;game random seed, upper byte
LFSR_L equ 0x12 ;current LFSR state, lower byte
LFSR_H equ 0x13 ;current LFSR state, upper byte
SEQLEN equ 0x14 ;current sequence length
LOOPCOUNT equ 0x15 ;temporary, used as a loop counter
TMP equ 0x16 ;temporary
HISCORE equ 0x17 ;high score (longest completed sequence length)
DELAY equ 0x1F ;delay loop counter, lower byte
; OSCCAL value was 0x0C24
;;; Program start
org 0x0000
powerup:
movwf OSCCAL
movlw 22 ;adjusts note tuning so tonedelay4 gives ~987 Hz
addwf OSCCAL,f
movlw ~((1<<NOT_GPWU)|(1<<T0CS)) ;enable GPIO2 and wakeup on pin change
option
; If this isn't a wake up from sleep, clear the high score.
btfss STATUS,GPWUF
clrf HISCORE
init:
; Initialize GPIOs
call ledoff
movfw GPIO
; Go to sleep and wait for a button press.
; Upon wakeup, the MCU will reset, but the GPWUF flag will be set,
; so the sleep instruction will be skipped and the game will start.
waitforstart:
btfss STATUS,GPWUF
sleep
bcf STATUS,GPWUF
; Save the GPIO pin values that triggered the wakeup.
; Later we'll test GP3 to see if we're going to display the current high score,
; but we have wait for the button to be released, and we have to set the timer
; prescaler.
movfw GPIO
movwf TMP
newgame:
; Create lower byte of random seed from a combination of the previous seed,
; the previous LFSR state (both of which have unknown values on powerup), and
; the timer count.
movfw LFSR_L
xorwf SEED_L,f
movfw TMR0
xorwf SEED_L,f
; debounce delay (W=0 gives longest possible delay)
movlw 0
call delay
; wait for the button to be released
call waitforrelease
; same as above, but for upper byte of random seed
movfw LFSR_H
xorwf SEED_H,f
movfw TMR0
xorwf SEED_H,f
; ensure random seed is not all 0s
bsf SEED_H,7
; enable 1:256 Timer0 prescaler
movlw ~((1<<NOT_GPWU)|(1<<T0CS)|(1<<PSA))
option
; If the wakeup was triggered by GP3 going low (the non-multiplexed button)
; display the current high score and go back to sleep.
movfw HISCORE
; ...but don't bother if the high score is 0, since nothing will blink and the
; player won't know why the button did nothing. (Just start a game.)
skpnz
goto startanim
movwf SEQLEN
btfss TMP,3
goto showscore
; do a lil light show
startanim:
movlw 0xF8
movwf TMP
startanimloop:
call led
incfsz TMP,f
goto startanimloop
call longdelay
; initialize game state
clrf SEQLEN
;;; Main game loop
loop:
incf SEQLEN,f
call seqinit
seqloop:
; get next color
call rand2bits
call led
; previous function returns number of delay iterations in W
call delay
; decrement loop count and stop if we're at the end of the sequence
decfsz LOOPCOUNT,f
goto seqloop
; reset the LFSR, loop while the player repeats the sequence
call seqinit
inputloop:
; get next color
call rand2bits
; get player's input
call getbutton
; compare two values, game over if they're different
subwf TMP,w
skpz
goto gameover
; if the button was correct, light it up
call led
; turn LEDs off, wait for the button to be released
call waitforrelease
; check next value in sequence
decfsz LOOPCOUNT,f
goto inputloop
; end of seqence, delay before starting the next one
; (waitforrelease returns the delay count in W)
call delay
goto loop
; Initializes a sequence.
seqinit:
; reset LFSR
movfw SEED_L
movwf LFSR_L
movfw SEED_H
movwf LFSR_H
; reset loop counter
movfw SEQLEN
movwf LOOPCOUNT
retlw 0
; Lights up LED 1, 2, 3, or 4 and plays the matching tone based on the value in
; TMP. (0, 1, 2, or 3).
; The return value of SEQSPEED saves a movlw.
led:
clrf DELAY
movfw TMP
andlw b'00000011'
addwf PCL,f
; jump table
goto led1
goto led2
goto led3
led4:
bsf DELAY,7
led4loop:
call led4on
call tonedelay4
call alloutputslow
call tonedelay4
decfsz DELAY,f
goto led4loop
retlw SEQSPEED
led1:
movlw 0x2c
movwf DELAY
led1loop:
call led1on
call tonedelay1
call alloutputslow
call tonedelay1
decfsz DELAY,f
goto led1loop
retlw SEQSPEED
led2:
bsf DELAY,6
led2loop:
call led2on
call tonedelay2
call alloutputslow
call tonedelay2
decfsz DELAY,f
goto led2loop
retlw SEQSPEED
led3:
movlw 0x56
movwf DELAY
led3loop:
call led3on
call tonedelay3
call alloutputslow
call tonedelay3
decfsz DELAY,f
goto led3loop
retlw SEQSPEED
; Loads a random 2-bit number into TMP.
rand2bits:
clrf TMP
call randbit
; fall through and shift in one more bit
; Left-shifts a random bit into TMP.
randbit:
; logical shift right 1 bit
bcf STATUS,C
rrf LFSR_H,f
rrf LFSR_L,f
; output bit is now in C;
; if it's 1, apply the toggle mask
movlw 0xB0
btfsc STATUS,C
xorwf LFSR_H,f
; shift the output bit into the output byte
rlf TMP,f
retlw 0
; Waits for a button press, and returns 0, 1, 2, or 3 in W.
; If no input is received after approx. 5 seconds, the invalid value 0xFF is
; returned, ending the game.
getbutton:
clrf DELAY
getbuttonloop:
movlw b'11111111'
movwf GPIO
tris GPIO
call inputdelay
btfss GPIO,3
retlw 1
; For GP0-GP2, test each input in isolation. Pressing a switch may drive
; more than one of these inputs low.
movlw b'11111001'
tris GPIO
btfss GPIO,0
retlw 2
movlw b'11111010'
tris GPIO
btfss GPIO,1
retlw 0
movlw b'11111100'
tris GPIO
btfss GPIO,2
retlw 3
decfsz DELAY,f
goto getbuttonloop
retlw 0xFF
; Turns off LEDs and waits for all buttons to be released.
; Returning 16 saves a movlw.
waitforrelease:
call ledoff
call shortdelay
movlw b'00001111'
subwf GPIO,w
skpz
goto waitforrelease
retlw 16
led1on:
movlw LED1ON_TRIS
tris GPIO
movlw LED1ON_GPIO
goto ledcommon
led2on:
movlw LED2ON_TRIS
tris GPIO
movlw LED2ON_GPIO
goto ledcommon
led3on:
movlw LED3ON_TRIS
tris GPIO
movlw LED3ON_GPIO
goto ledcommon
led4on:
movlw LED4ON_TRIS
tris GPIO
movlw LED4ON_GPIO
goto ledcommon
alloutputslow:
clrw
tris GPIO
goto ledcommon
speakeron:
movlw SPKRON_TRIS
tris GPIO
movlw SPKRON_GPIO
ledcommon:
movwf GPIO
; Return 0x7F as it's used by the tonedelayX functions.
retlw 0x7F
ledoff:
movlw 0xFF
tris GPIO
movwf GPIO
retlw 0
longdelay:
movlw 12
; fall through
; W indicates the number of iterations desired.
delay:
movwf DELAY
delayloop:
call shortdelay
decfsz DELAY,f
goto delayloop ;W always 0 after shortdelay returns
retlw 0
shortdelay: ;128 timer periods
movlw 0
shortdelayloop:
movwf TMR0
btfss TMR0,7
goto $-1
retlw 0
tonedelay4: ;note B5, ~987 Hz
movlw 128-2
goto shortdelayloop
tonedelay3: ;note E5, ~659 Hz
movlw 128-3
goto shortdelayloop
tonedelay2: ;note B4, ~494 Hz
movlw 128-4
goto shortdelayloop
tonedelay1: ;note E4, ~330 Hz
movlw 128-6
goto shortdelayloop
tonedelay5:
movlw 111 ;note B2, ~123 Hz
goto shortdelayloop
inputdelay: ;affects input timeout; ~5 sec
movlw 50
goto shortdelayloop
gameover:
call waitforrelease
bsf DELAY,7
gameoversound:
call alloutputslow
call tonedelay5
call speakeron
call tonedelay5
decfsz DELAY,f
goto gameoversound
; Compare the player's score to the high score.
checkhiscore:
; Player's score is the number of successfully repeated sequences,
; so we decrement the length.
decf SEQLEN,f
movfw SEQLEN
subwf HISCORE,w
skpnc
goto showscore
newhiscore:
; Player's score is greater than old high score: play a little fanfare.
movfw SEQLEN
movwf HISCORE
clrf TMP
bsf LOOPCOUNT,4
; Alternately blink LEDs 1 and 4.
fanfareloop:
comf TMP,f
call led
decfsz LOOPCOUNT,f
goto fanfareloop
call longdelay
; Blink out the current sequence length on the LEDs.
; Each blink of LED 4 counts 50 (what kind of superhuman could do this?)
; Each blink of LED 3 counts 10
; Each blink of LED 2 counts 5
; Each blink of LED 1 counts 1
showscore:
count50:
movlw 50
call decscore
addwf PCL,f
count50ledon:
call led4on
goto scoreblink
count50done:
count10:
movlw 10
call decscore
addwf PCL,f
call led3on
goto scoreblink
count5:
movlw 5
call decscore
addwf PCL,f
call led2on
goto scoreblink
count1:
movlw 1
call decscore
addwf PCL,f
call led1on
goto scoreblink
; End of score loop: reset.
goto init
; Subtracts W from the player's score in SEQLEN.
; If overflow occurs, revert SEQLEN to its old value.
; Return value in W is a jump offset.
decscore:
subwf SEQLEN,f
; If an overflow occurs, C flag will be 0.
skpnc
; No overflow: calling function does not need to jump.
retlw 0
; Overflow: restore SEQLEN. Calling function will need to jump ahead to break
; out of its loop.
addwf SEQLEN,f
retlw count50done-count50ledon
; Time out a blink, then jump to the beginning of the score countdown loop.
scoreblink:
call longdelay
call ledoff
call longdelay
goto count50
end
|
oeis/292/A292601.asm | neoneye/loda-programs | 11 | 171762 | <gh_stars>10-100
; A292601: a(n) = n - A292600(n).
; Submitted by <NAME>
; 0,1,1,2,1,2,4,5,1,2,4,5,8,9,9,10,1,2,4,5,8,9,9,10,16,17,17,18,17,18,20,21,1,2,4,5,8,9,9,10,16,17,17,18,17,18,20,21,32,33,33,34,33,34,36,37,33,34,36,37,40,41,41,42,1,2,4,5,8,9,9,10,16,17,17,18,17,18,20,21,32,33,33,34,33,34,36,37,33,34,36,37,40,41,41,42,64,65,65,66
mov $1,$0
seq $1,292600 ; a(n) = A006068(floor(n/2)); A006068 with every term duplicated, where A006068 is the inverse of binary gray code.
sub $0,$1
|
Transynther/x86/_processed/US/_ht_st_zr_un_/i9-9900K_12_0xa0_notsx.log_21829_533.asm | ljhsiun2/medusa | 9 | 176540 | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x18fb7, %r14
nop
nop
nop
nop
nop
dec %rdx
movups (%r14), %xmm7
vpextrq $0, %xmm7, %rcx
cmp $39042, %rbx
lea addresses_normal_ht+0xf977, %rsi
nop
nop
nop
nop
inc %rbx
movl $0x61626364, (%rsi)
nop
nop
cmp $58384, %rcx
lea addresses_D_ht+0x14300, %rsi
lea addresses_WT_ht+0x19f75, %rdi
nop
cmp %r9, %r9
mov $26, %rcx
rep movsl
nop
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_D_ht+0x5097, %rdi
clflush (%rdi)
nop
nop
nop
nop
add %r9, %r9
mov $0x6162636465666768, %rbx
movq %rbx, (%rdi)
add %rbx, %rbx
lea addresses_normal_ht+0xa8d7, %rbx
nop
nop
nop
nop
nop
sub $46109, %r14
movb $0x61, (%rbx)
nop
nop
and $55793, %rdi
lea addresses_A_ht+0x129e7, %rdi
nop
nop
nop
nop
nop
add $24876, %r14
mov $0x6162636465666768, %r9
movq %r9, (%rdi)
nop
nop
nop
nop
nop
dec %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %rbp
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_WC+0xe997, %rsi
lea addresses_WC+0x5b97, %rdi
nop
nop
nop
nop
nop
add $51598, %r10
mov $64, %rcx
rep movsl
nop
xor %rcx, %rcx
// Store
lea addresses_WC+0xd197, %rcx
nop
nop
nop
and $28751, %rbp
mov $0x5152535455565758, %rdi
movq %rdi, %xmm2
vmovaps %ymm2, (%rcx)
nop
nop
add %r10, %r10
// Store
lea addresses_PSE+0xc797, %r11
clflush (%r11)
nop
cmp $46110, %rcx
mov $0x5152535455565758, %rsi
movq %rsi, (%r11)
sub %rdi, %rdi
// Store
lea addresses_WT+0xbb97, %r10
nop
nop
nop
nop
xor $766, %rdi
movw $0x5152, (%r10)
nop
nop
and %r13, %r13
// Store
lea addresses_WT+0xa697, %rsi
nop
nop
nop
cmp $3069, %rcx
movw $0x5152, (%rsi)
nop
sub %r10, %r10
// Store
mov $0x1ef, %rbp
nop
nop
cmp $16766, %r13
movl $0x51525354, (%rbp)
// Exception!!!
nop
mov (0), %rsi
nop
nop
and $60987, %rsi
// Load
lea addresses_A+0xc517, %r11
nop
nop
nop
nop
nop
add $63592, %r13
movups (%r11), %xmm1
vpextrq $1, %xmm1, %r10
nop
nop
sub $23092, %r11
// Load
lea addresses_RW+0x6597, %r13
nop
nop
nop
xor %rsi, %rsi
movups (%r13), %xmm4
vpextrq $0, %xmm4, %r11
nop
nop
xor %rcx, %rcx
// Faulty Load
lea addresses_US+0x1397, %r11
nop
nop
nop
nop
nop
dec %rbp
vmovups (%r11), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %r13
lea oracles, %rdi
and $0xff, %r13
shlq $12, %r13
mov (%rdi,%r13,1), %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': True, 'size': 32, 'NT': False, 'same': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 3}}
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 5}}
{'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 4}}
{'06': 3778, '58': 17931, '8a': 3, '5b': 1, '38': 10, '72': 1, '46': 94, '00': 11}
06 58 06 58 06 58 58 58 06 58 58 58 58 58 58 58 06 58 58 06 58 58 06 58 06 58 06 58 58 06 58 58 06 58 58 06 58 58 06 58 06 58 06 58 46 58 06 58 58 06 58 06 58 58 06 58 06 58 58 58 06 58 58 58 58 58 58 58 58 58 58 58 06 58 58 58 58 58 58 06 58 58 58 58 58 58 58 58 06 58 06 58 06 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 06 06 58 58 06 58 58 58 58 06 58 06 58 58 58 58 06 58 58 58 58 58 58 58 58 46 58 06 58 58 06 58 06 58 58 58 58 58 58 06 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 06 58 58 06 58 58 58 58 58 58 58 06 58 58 06 58 06 58 58 58 58 58 58 58 06 58 06 58 06 58 58 58 58 58 06 58 06 58 58 38 58 58 58 06 58 58 58 58 58 58 06 58 58 06 58 58 06 58 58 58 58 58 58 06 58 06 58 58 58 58 58 58 06 58 58 58 06 58 58 58 58 58 58 58 06 06 58 58 06 58 06 58 58 06 58 06 58 06 58 58 06 58 58 06 58 58 58 58 58 58 58 58 58 06 58 58 06 58 58 58 58 58 06 58 58 58 06 58 06 58 06 58 46 58 58 58 06 58 58 58 58 58 58 58 58 58 58 06 58 58 58 58 58 06 58 06 58 58 58 58 58 58 58 58 58 06 58 58 06 58 58 58 58 58 06 58 06 58 58 58 58 58 06 58 58 58 58 06 58 58 58 06 58 06 58 58 06 58 58 58 58 58 58 58 06 58 58 58 58 06 58 58 06 58 58 58 58 58 58 58 58 58 58 06 58 58 58 58 58 58 06 58 58 06 58 06 58 58 06 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 06 58 58 06 58 58 58 58 58 58 06 58 06 58 58 58 58 06 06 58 58 58 58 58 58 06 58 58 58 58 58 58 06 58 06 58 58 58 06 58 58 06 58 58 06 58 06 58 58 06 58 58 58 06 58 06 58 58 06 58 58 06 46 58 58 58 06 58 58 58 58 58 58 58 06 58 58 58 58 06 58 06 58 58 06 58 06 58 06 58 58 06 58 58 06 06 58 58 58 58 58 06 58 58 58 06 58 58 58 06 06 58 58 58 06 58 58 06 58 58 58 06 58 06 58 58 58 58 06 58 58 58 58 58 06 58 58 58 58 06 58 58 58 06 58 06 58 06 58 58 58 58 06 58 58 58 06 58 58 58 58 06 58 58 06 58 58 06 58 06 58 58 06 58 58 06 58 58 06 58 58 58 58 58 06 58 06 58 58 58 58 58 58 58 58 06 58 58 58 58 58 06 58 58 58 58 58 58 58 58 58 46 06 58 58 58 58 58 58 46 06 58 58 58 58 58 58 58 06 58 06 58 58 06 58 58 58 58 58 58 58 06 58 58 06 58 58 58 58 58 38 58 58 58 58 06 06 58 58 58 58 58 58 58 58 58 58 06 58 58 58 58 58 58 58 06 58 06 58 06 58 58 58 06 58 06 58 58 58 58 06 58 06 58 58 58 58 58 06 58 58 58 58 06 58 06 58 58 06 58 58 58 06 58 58 58 58 58 58 58 58 58 58 58 58 58 06 58 58 06 58 46 06 58 06 58 58 58 06 58 06 58 58 58 06 58 06 58 46 58 58 06 58 58 58 58 58 06 58 58 58 06 58 58 58 58 58 58 58 58 06 58 06 58 06 58 06 06 58 06 58 58 46 58 06 58 58 58 58 58 58 58 58 06 58 58 58 06 58 46 58 06 58 58 06 58 58 58 58 58 06 58 58 58 58 58 06 58 58 58 58 58 06 58 58 58 58 58 58 06 58 58 58 58 58 58 58 58 58 06 58 58 58 58 58 58 58 58 06 58 58 06 58 58 58 06 58 58 06 58 58 06 58 58 58 06 58 06 58 58 06 58 58 58 06 58 58 06 58 06 58 58 58 58 58 58 06 06 58 06 58 58 58 06 58 58 06 58 58 58 58 58 58 58 58 58 06 58 58 58 58 06 58 58 58 58 58 06 58 58 58 06 58 58 58 58 06 58 58 06 58 58 58 06 58 58 58 58 58 58 06 58 58 58 58 58 58 06 58 58 58 06 58 58 58 58 58 58 58 06 58 58 58 58 58 58 06 58 58 58 06 58 58 58 58 58 58 58 58 06 58
*/
|
currypp/.cpm/packages/verify/examples/PROOF-gamelength.agda | phlummox/curry-tools | 0 | 15798 | <filename>currypp/.cpm/packages/verify/examples/PROOF-gamelength.agda
-- Agda program using the Iowa Agda library
{-# OPTIONS --termination-depth=2 #-}
module PROOF-gamelength
where
open import eq
open import bool
open import nat
open import nat-thms
open import list
open import nondet
open import nondet-thms
---------------------------------------------------------------------------
-- Translated Curry operations:
data Move : Set where
L : Move
R : Move
solve2 : ℕ → ℕ → ND (𝕃 Move)
solve2 zero zero = Val []
solve2 (suc x) zero = mapND (_::_ L) (solve2 x zero)
solve2 zero (suc y) = mapND (_::_ R) (solve2 zero y)
solve2 (suc z) (suc u) = (mapND (_::_ L) (solve2 z (suc u)))
?? (mapND (_::_ R) (solve2 (suc z) u))
len : {a : Set} → 𝕃 a → ℕ
len [] = zero
len (x :: y) = suc (len y)
---------------------------------------------------------------------------
-- Theorem: the length of every solution is the sum of the input arguments
gamelength : (x : ℕ) → (y : ℕ)
→ (solve2 x y) satisfy (λ xs → length xs =ℕ x + y) ≡ tt
gamelength zero zero = refl
gamelength zero (suc y)
rewrite
satisfy-mapND (_::_ R) (solve2 zero y) (λ xs → length xs =ℕ zero + suc y)
| gamelength zero y = refl
gamelength (suc x) zero
rewrite
satisfy-mapND (_::_ L) (solve2 x zero) (λ xs → length xs =ℕ suc x + zero)
| gamelength x zero = refl
gamelength (suc x) (suc y)
rewrite
satisfy-mapND (_::_ L) (solve2 x (suc y)) (λ xs → length xs =ℕ suc x + suc y)
| satisfy-mapND (_::_ R) (solve2 (suc x) y) (λ xs → length xs =ℕ suc x + suc y)
| gamelength x (suc y)
| +suc x y
| gamelength (suc x) y
= refl
---------------------------------------------------------------------------
|
boards/OpenMV2/src/openmv-lcd_shield.adb | morbos/Ada_Drivers_Library | 2 | 24887 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- 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. --
-- 3. 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 --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with STM32.GPIO;
with STM32.Device;
with OpenMV;
with ST7735R; use ST7735R;
with ST7735R.RAM_Framebuffer; use ST7735R.RAM_Framebuffer;
with Ravenscar_Time;
package body OpenMV.LCD_Shield is
LCD_RST : STM32.GPIO.GPIO_Point renames Shield_PWM1;
LCD_RS : STM32.GPIO.GPIO_Point renames Shield_PWM2;
LCD_CS : STM32.GPIO.GPIO_Point renames Shield_SEL;
All_Points : constant STM32.GPIO.GPIO_Points := (LCD_RS, LCD_CS, LCD_RST);
LCD_Driver : ST7735R_RAM_Framebuffer_Screen (Shield_SPI'Access,
LCD_CS'Access,
LCD_RS'Access,
LCD_RST'Access,
Ravenscar_Time.Delays);
Is_Initialized : Boolean := False;
-----------------
-- Initialized --
-----------------
function Initialized return Boolean is (Is_Initialized);
----------------
-- Initialize --
----------------
procedure Initialize is
GPIO_Conf : STM32.GPIO.GPIO_Port_Configuration;
begin
-- Initalize shield SPI port
Initialize_Shield_SPI;
STM32.Device.Enable_Clock (All_Points);
GPIO_Conf.Mode := STM32.GPIO.Mode_Out;
GPIO_Conf.Output_Type := STM32.GPIO.Push_Pull;
GPIO_Conf.Speed := STM32.GPIO.Speed_100MHz;
GPIO_Conf.Resistors := STM32.GPIO.Floating;
STM32.GPIO.Configure_IO (All_Points, GPIO_Conf);
Initialize (LCD_Driver);
Set_Memory_Data_Access
(LCD => LCD_Driver,
Color_Order => RGB_Order,
Vertical => Vertical_Refresh_Top_Bottom,
Horizontal => Horizontal_Refresh_Left_Right,
Row_Addr_Order => Row_Address_Bottom_Top,
Column_Addr_Order => Column_Address_Right_Left,
Row_Column_Exchange => False);
Set_Pixel_Format (LCD_Driver, Pixel_16bits);
Set_Frame_Rate_Normal (LCD_Driver,
RTN => 16#01#,
Front_Porch => 16#2C#,
Back_Porch => 16#2D#);
Set_Frame_Rate_Idle (LCD_Driver,
RTN => 16#01#,
Front_Porch => 16#2C#,
Back_Porch => 16#2D#);
Set_Frame_Rate_Partial_Full (LCD_Driver,
RTN_Part => 16#01#,
Front_Porch_Part => 16#2C#,
Back_Porch_Part => 16#2D#,
RTN_Full => 16#01#,
Front_Porch_Full => 16#2C#,
Back_Porch_Full => 16#2D#);
Set_Inversion_Control (LCD_Driver,
Normal => Line_Inversion,
Idle => Line_Inversion,
Full_Partial => Line_Inversion);
Set_Power_Control_1 (LCD_Driver,
AVDD => 2#101#, -- 5
VRHP => 2#0_0010#, -- 4.6
VRHN => 2#0_0010#, -- -4.6
MODE => 2#10#); -- AUTO
Set_Power_Control_2 (LCD_Driver,
VGH25 => 2#11#, -- 2.4
VGSEL => 2#01#, -- 3*AVDD
VGHBT => 2#01#); -- -10
Set_Power_Control_3 (LCD_Driver, 16#0A#, 16#00#);
Set_Power_Control_4 (LCD_Driver, 16#8A#, 16#2A#);
Set_Power_Control_5 (LCD_Driver, 16#8A#, 16#EE#);
Set_Vcom (LCD_Driver, 16#E#);
Set_Address (LCD_Driver,
X_Start => 0,
X_End => 127,
Y_Start => 0,
Y_End => 159);
Turn_On (LCD_Driver);
LCD_Driver.Initialize_Layer (Layer => 1,
Mode => HAL.Bitmap.RGB_565,
X => 0,
Y => 0,
Width => Image_Width,
Height => Image_Height);
Is_Initialized := True;
end Initialize;
----------------
-- Get_Bitmap --
----------------
function Get_Bitmap return not null HAL.Bitmap.Any_Bitmap_Buffer is
begin
return LCD_Driver.Hidden_Buffer (1);
end Get_Bitmap;
----------------------
-- Rotate_Screen_90 --
----------------------
procedure Rotate_Screen_90 is
begin
Set_Memory_Data_Access
(LCD => LCD_Driver,
Color_Order => RGB_Order,
Vertical => Vertical_Refresh_Top_Bottom,
Horizontal => Horizontal_Refresh_Left_Right,
Row_Addr_Order => Row_Address_Top_Bottom,
Column_Addr_Order => Column_Address_Left_Right,
Row_Column_Exchange => False);
end Rotate_Screen_90;
---------------------
-- Rotate_Screen_0 --
---------------------
procedure Rotate_Screen_0 is
begin
Set_Memory_Data_Access
(LCD => LCD_Driver,
Color_Order => RGB_Order,
Vertical => Vertical_Refresh_Top_Bottom,
Horizontal => Horizontal_Refresh_Left_Right,
Row_Addr_Order => Row_Address_Bottom_Top,
Column_Addr_Order => Column_Address_Right_Left,
Row_Column_Exchange => False);
end Rotate_Screen_0;
-------------
-- Display --
-------------
procedure Display is
begin
LCD_Driver.Update_Layer (1);
end Display;
end OpenMV.LCD_Shield;
|
test/Succeed/Issue1523b.agda | shlevy/agda | 3 | 5870 | <reponame>shlevy/agda
-- {-# OPTIONS --copatterns #-}
-- {-# OPTIONS -v tc.lhs:20 #-}
open import Common.Size
record Stream (i : Size) (A : Set) : Set where
coinductive
constructor _::_
field
head : A
tail : ∀ {j : Size< i} → Stream j A
open Stream public
-- size forgetful cons
cons : ∀ i {A} → A → Stream i A → Stream (↑ i) A
cons i a as = a :: as
-- Should work
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca_notsx.log_12_1410.asm | ljhsiun2/medusa | 9 | 28643 | <filename>Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca_notsx.log_12_1410.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0xfa4d, %rdx
nop
sub %rax, %rax
mov $0x6162636465666768, %rcx
movq %rcx, %xmm7
and $0xffffffffffffffc0, %rdx
vmovaps %ymm7, (%rdx)
nop
nop
nop
nop
sub %r14, %r14
lea addresses_WC_ht+0x1244d, %r8
nop
nop
nop
cmp $55982, %rbp
movl $0x61626364, (%r8)
nop
nop
nop
nop
nop
cmp %rax, %rax
lea addresses_D_ht+0xeeb9, %rcx
nop
xor $30569, %rdi
movups (%rcx), %xmm0
vpextrq $1, %xmm0, %rax
nop
nop
nop
xor $28528, %rdx
lea addresses_UC_ht+0x113d, %rsi
lea addresses_normal_ht+0x794d, %rdi
nop
nop
nop
xor %r14, %r14
mov $127, %rcx
rep movsl
nop
nop
add %r14, %r14
lea addresses_D_ht+0x15ddd, %rcx
add %rdi, %rdi
mov (%rcx), %r8d
nop
nop
nop
nop
nop
add %rdx, %rdx
lea addresses_A_ht+0x1cc4d, %rsi
lea addresses_UC_ht+0x38d, %rdi
nop
nop
nop
nop
nop
add $41159, %rax
mov $68, %rcx
rep movsq
nop
nop
xor %rdx, %rdx
lea addresses_D_ht+0x1480d, %rcx
dec %r8
mov (%rcx), %r14d
nop
nop
nop
and $41015, %r8
lea addresses_WC_ht+0x85ad, %rsi
nop
nop
nop
nop
inc %rcx
mov $0x6162636465666768, %r14
movq %r14, %xmm5
and $0xffffffffffffffc0, %rsi
vmovntdq %ymm5, (%rsi)
nop
nop
cmp $18629, %r8
lea addresses_WC_ht+0x1998d, %rdx
cmp $53869, %rcx
movb $0x61, (%rdx)
cmp $15794, %rbp
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %rcx
push %rdi
// Faulty Load
lea addresses_US+0x1444d, %r10
nop
nop
and $35846, %rdi
mov (%r10), %r12
lea oracles, %rcx
and $0xff, %r12
shlq $12, %r12
mov (%rcx,%r12,1), %r12
pop %rdi
pop %rcx
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': True, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 5, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 5, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'00': 12}
00 00 00 00 00 00 00 00 00 00 00 00
*/
|
3rdParties/src/nasm/nasm-2.15.02/travis/test/invlpga.asm | blue3k/StormForge | 1 | 104164 | <filename>3rdParties/src/nasm/nasm-2.15.02/travis/test/invlpga.asm
bits 32
invlpga
invlpga ax,ecx
invlpga eax,ecx
bits 64
invlpga
invlpga eax,ecx
invlpga rax,ecx
|
bin/JWASM/Samples/Math1.asm | Abd-Beltaji/ASMEMU | 3 | 179568 | <reponame>Abd-Beltaji/ASMEMU
;--- sample how to use FPU and CRT math functions.
;--- Win32 binary:
;--- assemble: jwasm -coff Math1.asm crtexe.asm
;--- link: link Math1.obj crtexe.obj msvcrt.lib
;--- Linux binary:
;--- assemble: jwasm -elf -D?CRT=0 -zcw Math1.asm
;--- link: gcc -o Math1 Math1.o -lm
.386
.MODEL FLAT, stdcall
option casemap:none
pow proto c :REAL8, :REAL8
sqrt proto c :REAL8
atof proto c :ptr BYTE
printf proto c :ptr BYTE, :VARARG
;--- CStr(): macro to define a text constant
CStr macro text:VARARG
local x
.const
x db text,0
.code
exitm <offset x>
endm
;--- CDbl(): macro to define a double constant
CDbl macro value
local x
.const
x real8 value
.code
exitm <x>
endm
.CODE
main proc c
local result:REAL8
fld CDbl(1.25)
fadd CDbl(3.75)
fstp result
invoke printf, CStr("1.25 + 3.75 = %f",10), result
fld CDbl(3.1)
fsub CDbl(3.2)
fstp result
invoke printf, CStr("3.1 - 3.2 = %f",10), result
fld CDbl(4.5)
fmul CDbl(3.0)
fstp result
invoke printf, CStr("4.5 * 3 = %f",10), result
fld CDbl(4.2)
fdiv CDbl(3.0)
fstp result
invoke printf, CStr("4.2 / 3 = %f",10), result
;--- for CRT math functions, the result is returned in ST(0)
invoke pow, CDbl(2.0), CDbl(3.0)
fstp result
invoke printf, CStr("2 ^ 3 = %f",10), result
invoke sqrt, CDbl(2.0)
fstp result
invoke printf, CStr("sqrt(2) = %f",10), result
invoke atof, CStr("3.567") ; convert a string into a double
fstp result
invoke printf, CStr('atof("3.567")=%f',10), result
xor eax,eax
ret
main endp
END
|
agda-stdlib/src/Function/Bundles.agda | DreamLinuxer/popl21-artifact | 5 | 8434 | <gh_stars>1-10
------------------------------------------------------------------------
-- The Agda standard library
--
-- Bundles for types of functions
------------------------------------------------------------------------
-- The contents of this file should usually be accessed from `Function`.
-- Note that these bundles differ from those found elsewhere in other
-- library hierarchies as they take Setoids as parameters. This is
-- because a function is of no use without knowing what its domain and
-- codomain is, as well which equalities are being considered over them.
-- One consequence of this is that they are not built from the
-- definitions found in `Function.Structures` as is usually the case in
-- other library hierarchies, as this would duplicate the equality
-- axioms.
{-# OPTIONS --without-K --safe #-}
module Function.Bundles where
import Function.Definitions as FunctionDefinitions
import Function.Structures as FunctionStructures
open import Level using (Level; _⊔_; suc)
open import Data.Product using (proj₁; proj₂)
open import Relation.Binary
open import Relation.Binary.PropositionalEquality as ≡
using (_≡_)
open Setoid using (isEquivalence)
private
variable
a b ℓ₁ ℓ₂ : Level
------------------------------------------------------------------------
-- Setoid bundles
module _ (From : Setoid a ℓ₁) (To : Setoid b ℓ₂) where
open Setoid From using () renaming (Carrier to A; _≈_ to _≈₁_)
open Setoid To using () renaming (Carrier to B; _≈_ to _≈₂_)
open FunctionDefinitions _≈₁_ _≈₂_
open FunctionStructures _≈₁_ _≈₂_
record Injection : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
field
f : A → B
cong : f Preserves _≈₁_ ⟶ _≈₂_
injective : Injective f
isCongruent : IsCongruent f
isCongruent = record
{ cong = cong
; isEquivalence₁ = isEquivalence From
; isEquivalence₂ = isEquivalence To
}
open IsCongruent isCongruent public using (module Eq₁; module Eq₂)
isInjection : IsInjection f
isInjection = record
{ isCongruent = isCongruent
; injective = injective
}
record Surjection : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
field
f : A → B
cong : f Preserves _≈₁_ ⟶ _≈₂_
surjective : Surjective f
isCongruent : IsCongruent f
isCongruent = record
{ cong = cong
; isEquivalence₁ = isEquivalence From
; isEquivalence₂ = isEquivalence To
}
open IsCongruent isCongruent public using (module Eq₁; module Eq₂)
isSurjection : IsSurjection f
isSurjection = record
{ isCongruent = isCongruent
; surjective = surjective
}
record Bijection : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
field
f : A → B
cong : f Preserves _≈₁_ ⟶ _≈₂_
bijective : Bijective f
injective : Injective f
injective = proj₁ bijective
surjective : Surjective f
surjective = proj₂ bijective
injection : Injection
injection = record
{ cong = cong
; injective = injective
}
surjection : Surjection
surjection = record
{ cong = cong
; surjective = surjective
}
open Injection injection public using (isInjection)
open Surjection surjection public using (isSurjection)
isBijection : IsBijection f
isBijection = record
{ isInjection = isInjection
; surjective = surjective
}
open IsBijection isBijection public using (module Eq₁; module Eq₂)
record Equivalence : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
field
f : A → B
g : B → A
cong₁ : f Preserves _≈₁_ ⟶ _≈₂_
cong₂ : g Preserves _≈₂_ ⟶ _≈₁_
record LeftInverse : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
field
f : A → B
g : B → A
cong₁ : f Preserves _≈₁_ ⟶ _≈₂_
cong₂ : g Preserves _≈₂_ ⟶ _≈₁_
inverseˡ : Inverseˡ f g
isCongruent : IsCongruent f
isCongruent = record
{ cong = cong₁
; isEquivalence₁ = isEquivalence From
; isEquivalence₂ = isEquivalence To
}
open IsCongruent isCongruent public using (module Eq₁; module Eq₂)
isLeftInverse : IsLeftInverse f g
isLeftInverse = record
{ isCongruent = isCongruent
; cong₂ = cong₂
; inverseˡ = inverseˡ
}
equivalence : Equivalence
equivalence = record
{ cong₁ = cong₁
; cong₂ = cong₂
}
record RightInverse : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
field
f : A → B
g : B → A
cong₁ : f Preserves _≈₁_ ⟶ _≈₂_
cong₂ : g Preserves _≈₂_ ⟶ _≈₁_
inverseʳ : Inverseʳ f g
isCongruent : IsCongruent f
isCongruent = record
{ cong = cong₁
; isEquivalence₁ = isEquivalence From
; isEquivalence₂ = isEquivalence To
}
isRightInverse : IsRightInverse f g
isRightInverse = record
{ isCongruent = isCongruent
; cong₂ = cong₂
; inverseʳ = inverseʳ
}
equivalence : Equivalence
equivalence = record
{ cong₁ = cong₁
; cong₂ = cong₂
}
record BiEquivalence : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
field
f : A → B
g₁ : B → A
g₂ : B → A
cong₁ : f Preserves _≈₁_ ⟶ _≈₂_
cong₂ : g₁ Preserves _≈₂_ ⟶ _≈₁_
cong₃ : g₂ Preserves _≈₂_ ⟶ _≈₁_
record BiInverse : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
field
f : A → B
g₁ : B → A
g₂ : B → A
cong₁ : f Preserves _≈₁_ ⟶ _≈₂_
cong₂ : g₁ Preserves _≈₂_ ⟶ _≈₁_
cong₃ : g₂ Preserves _≈₂_ ⟶ _≈₁_
inverseˡ : Inverseˡ f g₁
inverseʳ : Inverseʳ f g₂
f-isCongruent : IsCongruent f
f-isCongruent = record
{ cong = cong₁
; isEquivalence₁ = isEquivalence From
; isEquivalence₂ = isEquivalence To
}
isBiInverse : IsBiInverse f g₁ g₂
isBiInverse = record
{ f-isCongruent = f-isCongruent
; cong₂ = cong₂
; inverseˡ = inverseˡ
; cong₃ = cong₃
; inverseʳ = inverseʳ
}
biEquivalence : BiEquivalence
biEquivalence = record
{ cong₁ = cong₁
; cong₂ = cong₂
; cong₃ = cong₃
}
record Inverse : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where
field
f : A → B
f⁻¹ : B → A
cong₁ : f Preserves _≈₁_ ⟶ _≈₂_
cong₂ : f⁻¹ Preserves _≈₂_ ⟶ _≈₁_
inverse : Inverseᵇ f f⁻¹
inverseˡ : Inverseˡ f f⁻¹
inverseˡ = proj₁ inverse
inverseʳ : Inverseʳ f f⁻¹
inverseʳ = proj₂ inverse
leftInverse : LeftInverse
leftInverse = record
{ cong₁ = cong₁
; cong₂ = cong₂
; inverseˡ = inverseˡ
}
rightInverse : RightInverse
rightInverse = record
{ cong₁ = cong₁
; cong₂ = cong₂
; inverseʳ = inverseʳ
}
open LeftInverse leftInverse public using (isLeftInverse)
open RightInverse rightInverse public using (isRightInverse)
isInverse : IsInverse f f⁻¹
isInverse = record
{ isLeftInverse = isLeftInverse
; inverseʳ = inverseʳ
}
open IsInverse isInverse public using (module Eq₁; module Eq₂)
------------------------------------------------------------------------
-- Bundles specialised for propositional equality
infix 3 _↣_ _↠_ _⤖_ _⇔_ _↩_ _↪_ _↩↪_ _↔_
_↣_ : Set a → Set b → Set _
A ↣ B = Injection (≡.setoid A) (≡.setoid B)
_↠_ : Set a → Set b → Set _
A ↠ B = Surjection (≡.setoid A) (≡.setoid B)
_⤖_ : Set a → Set b → Set _
A ⤖ B = Bijection (≡.setoid A) (≡.setoid B)
_⇔_ : Set a → Set b → Set _
A ⇔ B = Equivalence (≡.setoid A) (≡.setoid B)
_↩_ : Set a → Set b → Set _
A ↩ B = LeftInverse (≡.setoid A) (≡.setoid B)
_↪_ : Set a → Set b → Set _
A ↪ B = RightInverse (≡.setoid A) (≡.setoid B)
_↩↪_ : Set a → Set b → Set _
A ↩↪ B = BiInverse (≡.setoid A) (≡.setoid B)
_↔_ : Set a → Set b → Set _
A ↔ B = Inverse (≡.setoid A) (≡.setoid B)
-- We now define some constructors for the above that
-- automatically provide the required congruency proofs.
module _ {A : Set a} {B : Set b} where
open FunctionDefinitions {A = A} {B} _≡_ _≡_
mk↣ : ∀ {f : A → B} → Injective f → A ↣ B
mk↣ {f} inj = record
{ f = f
; cong = ≡.cong f
; injective = inj
}
mk↠ : ∀ {f : A → B} → Surjective f → A ↠ B
mk↠ {f} surj = record
{ f = f
; cong = ≡.cong f
; surjective = surj
}
mk⤖ : ∀ {f : A → B} → Bijective f → A ⤖ B
mk⤖ {f} bij = record
{ f = f
; cong = ≡.cong f
; bijective = bij
}
mk⇔ : ∀ (f : A → B) (g : B → A) → A ⇔ B
mk⇔ f g = record
{ f = f
; g = g
; cong₁ = ≡.cong f
; cong₂ = ≡.cong g
}
mk↩ : ∀ {f : A → B} {g : B → A} → Inverseˡ f g → A ↩ B
mk↩ {f} {g} invˡ = record
{ f = f
; g = g
; cong₁ = ≡.cong f
; cong₂ = ≡.cong g
; inverseˡ = invˡ
}
mk↪ : ∀ {f : A → B} {g : B → A} → Inverseʳ f g → A ↪ B
mk↪ {f} {g} invʳ = record
{ f = f
; g = g
; cong₁ = ≡.cong f
; cong₂ = ≡.cong g
; inverseʳ = invʳ
}
mk↩↪ : ∀ {f : A → B} {g₁ : B → A} {g₂ : B → A}
→ Inverseˡ f g₁ → Inverseʳ f g₂ → A ↩↪ B
mk↩↪ {f} {g₁} {g₂} invˡ invʳ = record
{ f = f
; g₁ = g₁
; g₂ = g₂
; cong₁ = ≡.cong f
; cong₂ = ≡.cong g₁
; cong₃ = ≡.cong g₂
; inverseˡ = invˡ
; inverseʳ = invʳ
}
mk↔ : ∀ {f : A → B} {f⁻¹ : B → A} → Inverseᵇ f f⁻¹ → A ↔ B
mk↔ {f} {f⁻¹} inv = record
{ f = f
; f⁻¹ = f⁻¹
; cong₁ = ≡.cong f
; cong₂ = ≡.cong f⁻¹
; inverse = inv
}
|
source/VIA.g4 | PaulAustin/Vireo | 0 | 2679 | <reponame>PaulAustin/Vireo<filename>source/VIA.g4<gh_stars>0
/*
Copyright (c) 2015 <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.
*/
grammar VIA;
viaStream
: symbol (symbol)*
;
symbol
: NAMED_SYMBOL
| literal
| temaplate
| invoke
| array
| jsonArray
| jsonCluster
;
literal
: STRING
| NUMBER
| BOOLEAN
;
//------------------------------------------------------------
array
: '(' element* ')' ;
jsonArray
: '[' symbol? (',' symbol)* ']' ;
jsonCluster
: '{' (fieldName symbol)? (',' fieldName symbol)* '}' ;
element
: (fieldName? symbol)
;
//------------------------------------------------------------
// Symbols can be used in three forms,
// Simple, templated, and call.
// Simple is a the symbol token followed by WS
NAMED_SYMBOL: SYMBOL_CORE ;
fieldName: FIELD_NAME ;
FIELD_NAME: SYMBOL_CORE ':' ;
// Template is a the symbol token followed by '<' no WS
temaplate: TEMPLATED_SYMBOL symbol* CLOSE;
TEMPLATED_SYMBOL: SYMBOL_CORE OPEN_TEMPLATE ;
fragment OPEN_TEMPLATE: '<';
CLOSE: '>';
// Invoke is a the symbol token followed by '(' no WS
invoke: INVOKE_SYMBOL symbol* CLOSE_INVOKE;
INVOKE_SYMBOL: SYMBOL_CORE OPEN_INVOKE;
fragment OPEN_INVOKE: '(';
CLOSE_INVOKE: ')';
fragment SYMBOL_CORE : ('*' | (PERCENT_ESC | [._a-zA-Z]) (PERCENT_ESC | [._a-zA-Z0-9])*) ;
fragment PERCENT_ESC : '%' HEX HEX;
//------------------------------------------------------------
// Strings come in two formats
STRING: (ESCAPED_STRING | VERBATIM_STRING);
//------------------------------------------------------------
// Escaped strings have C / JSON like back slash escapes
// and must msut be on a sinlge line.
fragment ESCAPED_STRING
: (ESCAPED_SQ | ESCAPED_DQ);
fragment ESCAPED_SQ : '\'' (ESC | ~[\'\\\n\r])* '\'' ;
fragment ESCAPED_DQ : '"' (ESC | ~["\\\n\r])* '"' ;
fragment ESC : ('\\' (["\'\\/bfnrt])) ;
fragment HEX : [0-9a-fA-F] ;
//------------------------------------------------------------
// Verbatim strings continue untile the mathcing delimeter.
// as the name implies its verbatim so there is no way to
// escape the initial delimeter.
fragment VERBATIM_STRING
: '@' (VERBATIM_SQ | VERBATIM_DQ);
fragment VERBATIM_SQ : '\'' (~[\'])* '\'';
fragment VERBATIM_DQ : '"' (~["])* '"';
BOOLEAN
: 'true'
| 'false'
;
//------------------------------------------------------------
// Numbers, both integer and IEEE754
// Adapted from ANTLR's JSON grammar
NUMBER
: '-'? INT '.' [0-9]+ EXP? // 1.35, 1.35E-9, 0.3, -4.5
| '-'? INT EXP // 1e10 -3e4
| '-'? INT // -3, 45
| [+\-]? ('nan' | 'NaN')
| [+\-]? ('inf' | 'Infinity')
;
fragment INT : '0' | [1-9] [0-9]* ; // no leading zeros
fragment EXP : [Ee] [+\-]? INT ; // \- since - means "range" inside [...]
//------------------------------------------------------------
WS : [ \t\n\r]+ -> skip ;
|
oeis/038/A038867.asm | neoneye/loda-programs | 11 | 16057 | ; A038867: (n+5)^3 - n^3.
; Submitted by <NAME>
; 125,215,335,485,665,875,1115,1385,1685,2015,2375,2765,3185,3635,4115,4625,5165,5735,6335,6965,7625,8315,9035,9785,10565,11375,12215,13085,13985,14915,15875,16865,17885,18935,20015,21125,22265,23435,24635,25865,27125,28415,29735,31085,32465,33875,35315,36785,38285,39815,41375,42965,44585,46235,47915,49625,51365,53135,54935,56765,58625,60515,62435,64385,66365,68375,70415,72485,74585,76715,78875,81065,83285,85535,87815,90125,92465,94835,97235,99665,102125,104615,107135,109685,112265,114875,117515
add $0,3
bin $0,2
sub $0,3
mul $0,30
add $0,125
|
programs/oeis/223/A223756.asm | neoneye/loda | 22 | 162250 | ; A223756: Number of n X 2 0..3 arrays with rows, antidiagonals and columns unimodal.
; 16,256,2500,16900,87616,372100,1352569,4338889,12559936,33362176,82373776,190992400,419266576,877225924,1759047481,3396208729,6338070544,11471266816,20192978404,34657779556,58123423744,95427859396,153638129089,242921822641,377703659776,578183827456,872311168576,1298323513600,1907989690000,2770713386116,3978688462225,5653328894929,7953234741904,11083998781696,15310207306276,20970043441636,28492962894400,38420980753156,51434184528169,68381173642681,90315219778624,118537046550784,154645241694736,200595441101584,258769562451856,332056517766724,423945999822601,538637118022249,681163855981456,857539536818176,1074922714008196,1341807156830596,1668238871046400,2066063388760900,2549206877688241,3133994960589025,3839513501860864,4688016011551744,5705382738912256,6921636979533376,8371524603713296,10095163330596100,12138768824518561,14555465278637089,17406188778090256,20760692402546944,24698662737918724,29310958221260356,34700980543488064,40986191183617156,48299786047927129,56792542140035881,66634851195601984,78018956280637696,91161408477634576,106305761971374736,123725527098988816,143727402249160900,166654806886075225,192891739437525241,222866985326410000,257058702043546624,295999409860325284,340281418565294116,390562722482430976,447573397993858756,512122539849390625,585105774702929041,667513392574845184,760439139303571456,865089715522368064,982795030282276864,1115019260143436176,1263372767378067844,1429624933873516081,1615717970396756209,1823781764086926736,2056149830383884544,2315376439082843236,2604254987832221476
seq $0,223659 ; Number of n X 1 [0..3] arrays with row sums unimodal and column sums inverted unimodal.
pow $0,2
|
src/util/strg/dltsp.asm | olifink/qspread | 0 | 174807 | ; delete trailing spaces from a string 18/01-92 O.Fink
section string
include win1_keys_err
xdef st_dltsp ; delete trailing spaces
;+++
; delete trailing spaces from a string
; "abc " -> dltsp -> "abc"
;
; Entry Exit
; a0 ptr to string preserved
;
; error codes: none
; condition codes: none
;---
r reg d1/d0
st_dltsp
movem.l r,-(sp)
move.w (a0),d0
beq.s exit
loop move.b 1(a0,d0.w),d1
cmpi.b #' ',d1
bne.s exit
subq.w #1,d0
bne.s loop
exit move.w d0,(a0)
movem.l (sp)+,r
rts
end
|
src/Projects/eu_projects-nodes-timed_nodes.adb | fintatarta/eugen | 0 | 13868 | <reponame>fintatarta/eugen<gh_stars>0
package body EU_Projects.Nodes.Timed_Nodes is
procedure Due_On (Item : in out Timed_Node;
Time : in String)
is
begin
Item.Expected_Raw := To_Unbounded_String (Time);
-- Times.Time_Expressions.Symbolic (Time);
end Due_On;
procedure Parse_Raw_Expressions (Item : in out Timed_Node;
Vars : Times.Time_Expressions.Parsing.Symbol_Table)
is
use Times.Time_Expressions.Parsing;
To_Parse : constant String :=
(if Item.Expected_Raw = Event_Names.Default_Time
then
After (Timed_Node'Class (Item).Dependency_List,
Timed_Node'Class (Item).Dependency_Ready_Var)
else
To_String (Item.Expected_Raw));
begin
Item.Expected_Symbolic := Parse (Input => To_Parse,
Symbols => Vars);
end Parse_Raw_Expressions;
overriding procedure Fix_Instant
(Item : in out Timed_Node;
Var : Simple_Identifier;
Value : Times.Instant)
is
begin
if Var = Event_Names.Event_Time_Name then
Item.Expected_On := Value;
else
raise Unknown_Instant_Var with To_String (Var);
end if;
Item.Fixed := True;
end Fix_Instant;
--------------
-- Is_Fixed --
--------------
overriding function Is_Fixed (Item : Timed_Node;
Var : Simple_Identifier)
return Boolean
is
begin
if Var = Event_Names.Event_Time_Name then
return Item.Fixed;
else
raise Unknown_Var with To_String (Var);
end if;
end Is_Fixed;
end EU_Projects.Nodes.Timed_Nodes;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.