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
|
---|---|---|---|---|
src/architecture/multiboot_h.asm
|
Owensa/x86_kernel
| 2 |
175469
|
section.multiboot_h
header_start:
dd 0xe85250d6 ; multiboot 2
dd 0 ; architecture 0
dd header_end - header_start ; header length
;checksum
dd 0x100000000 - (0xe8525 + 0 + (header_end - header_start))
; multiboot tags are gonna go here
; end tag requires
dw 0 ;type
dw 0 ;flags
dw 8 ;size
header_end:
|
tests/syntax_test_object_files.asm
|
dougmasten/dougmasten-sublime-assembly-6809
| 5 |
166462
|
# SYNTAX TEST "Packages/Assembly-6809/Assembly-6809.sublime-syntax"
# <- source.mc6809
section
sect
.area
endsection
endsect
sym EXTERN
sym EXTERNAL
sym IMPORT
sym EXPORT
sym .GLOBL
EXPORT sym
.globl sym
sym EXTDEP
|
macros/debug.asm
|
ISSOtm/Aevilia-GB
| 53 |
20466
|
debug_message: MACRO
IF DEF(DebugMode)
ld d, d
jr .debugMessage\@
dw $6464
dw $0000
REPT _NARG
db \1
shift
ENDR
.debugMessage\@
ENDC
ENDM
debug_break: MACRO
IF DEF(DebugMode)
ld b, b
ENDC
ENDM
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48.log_21829_2727.asm
|
ljhsiun2/medusa
| 9 |
24626
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r8
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x13513, %rdi
nop
xor %r11, %r11
mov (%rdi), %r8
nop
nop
nop
nop
xor $58321, %r8
lea addresses_WT_ht+0x16f5b, %rsi
lea addresses_UC_ht+0x975b, %rdi
nop
nop
nop
nop
cmp %r14, %r14
mov $46, %rcx
rep movsq
nop
nop
nop
inc %rdi
lea addresses_UC_ht+0x1115b, %rsi
nop
nop
add %rcx, %rcx
mov (%rsi), %r11d
nop
nop
nop
nop
nop
cmp %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %r8
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r8
push %rax
push %rbp
// Faulty Load
mov $0xe70f6000000075b, %r14
nop
nop
nop
nop
sub $43987, %r8
movb (%r14), %r11b
lea oracles, %rbp
and $0xff, %r11
shlq $12, %r11
mov (%rbp,%r11,1), %r11
pop %rbp
pop %rax
pop %r8
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': True, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 4, 'same': False, 'NT': True}}
{'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
*/
|
programs/oeis/098/A098352.asm
|
karttu/loda
| 0 |
19465
|
; A098352: Multiplication table of the even numbers read by antidiagonals.
; 4,8,8,12,16,12,16,24,24,16,20,32,36,32,20,24,40,48,48,40,24,28,48,60,64,60,48,28,32,56,72,80,80,72,56,32,36,64,84,96,100,96,84,64,36,40,72,96,112,120,120,112,96,72,40,44,80,108,128,140,144,140,128,108,80,44,48,88,120,144,160,168,168,160,144,120,88,48,52,96,132,160,180,192,196,192,180,160,132,96,52,56,104,144,176,200,216,224,224,216,200,176,144,104,56,60,112,156,192,220,240,252,256,252,240,220,192,156,112,60,64,120,168,208,240,264,280,288,288,280,264,240,208,168,120,64,68,128,180,224,260,288,308,320,324,320,308,288,260,224,180,128,68,72,136,192,240,280,312,336,352,360,360,352,336,312,280,240,192,136,72,76,144,204,256,300,336,364,384,396,400,396,384,364,336,300,256,204,144,76,80,152,216,272,320,360,392,416,432,440,440,432,416,392,360,320,272,216,152,80,84,160,228,288,340,384,420,448,468,480,484,480,468,448,420,384,340,288,228,160,84,88,168,240,304,360,408,448,480,504,520,528,528,520,504,480,448,408,360,304
add $0,1
mov $1,1
lpb $0,1
sub $0,$1
lpb $0,1
add $0,1
add $2,$1
sub $1,2
lpe
add $1,$2
add $1,1
lpe
sub $1,2
mul $1,4
add $1,4
|
source/amf/mof/amf-internals-element_collections.ads
|
svn2github/matreshka
| 24 |
4408
|
<reponame>svn2github/matreshka<filename>source/amf/mof/amf-internals-element_collections.ads<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2012, <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$
------------------------------------------------------------------------------
-- Internal table based implementation of collections of elements.
------------------------------------------------------------------------------
with AMF.Internals.Collections.Elements;
package AMF.Internals.Element_Collections is
function Length (Self : AMF_Collection_Of_Element) return Natural;
function Element
(Self : AMF_Collection_Of_Element; Index : Positive) return AMF_Element;
procedure Add (Self : AMF_Collection_Of_Element; Item : AMF_Element);
procedure Internal_Append
(Collection : AMF_Collection_Of_Element;
Element : AMF_Element;
Link : AMF_Link);
-- Appends element to collection. This subprogram doesn't construct link.
function Wrap
(Collection : AMF_Collection_Of_Element)
return AMF.Internals.Collections.Elements.Shared_Element_Collection_Access;
function Allocate_Collections
(Count : Natural) return AMF.Internals.AMF_Collection_Of_Element;
-- Allocates specified number of collections and initialize first
-- allocated collection (this collection is used to handle non-owned link
-- ends by convention).
procedure Initialize_Ordered_Set_Collection
(Element : AMF_Element;
Property : CMOF_Element;
Collection : AMF.Internals.AMF_Collection_Of_Element);
-- Initialize specified collection as ordered set.
procedure Initialize_Set_Collection
(Element : AMF_Element;
Property : CMOF_Element;
Collection : AMF.Internals.AMF_Collection_Of_Element);
-- Initialize specified collection as set.
end AMF.Internals.Element_Collections;
|
LibraBFT/Yasm/Yasm.agda
|
oracle/bft-consensus-agda
| 4 |
8109
|
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2021 Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
open import LibraBFT.Base.PKCS
open import LibraBFT.Base.Types
open import LibraBFT.Prelude
import LibraBFT.Yasm.Base as LYB
import LibraBFT.Yasm.System as LYS
-- This module provides a single import for all Yasm modules
module LibraBFT.Yasm.Yasm
(ℓ-PeerState : Level)
(ℓ-VSFP : Level)
(parms : LYB.SystemTypeParameters ℓ-PeerState)
(iiah : LYB.SystemInitAndHandlers ℓ-PeerState parms)
(ValidSenderForPK : LYS.WithInitAndHandlers.ValidSenderForPK-type ℓ-PeerState ℓ-VSFP parms iiah)
(ValidSenderForPK-stable : LYS.WithInitAndHandlers.ValidSenderForPK-stable-type ℓ-PeerState ℓ-VSFP parms iiah ValidSenderForPK)
where
open LYB.SystemTypeParameters parms
open LYB.SystemInitAndHandlers iiah
open import LibraBFT.Yasm.Base public
open import LibraBFT.Yasm.Types public
open import LibraBFT.Yasm.System ℓ-PeerState ℓ-VSFP parms public
open import LibraBFT.Yasm.Properties ℓ-PeerState ℓ-VSFP parms iiah ValidSenderForPK ValidSenderForPK-stable public
open WithInitAndHandlers iiah public
open import Util.FunctionOverride PeerId _≟PeerId_ public
|
programs/oeis/061/A061803.asm
|
neoneye/loda
| 22 |
9976
|
<filename>programs/oeis/061/A061803.asm
; A061803: Sum of n-th row of triangle of 4th powers: 1; 1 16 1; 1 16 81 16 1; 1 16 81 256 81 16 1; ...
; 1,18,115,452,1333,3254,6951,13448,24105,40666,65307,100684,149981,216958,305999,422160,571217,759714,995011,1285332,1639813,2068550,2582647,3194264,3916665,4764266,5752683,6898780,8220717,9737998,11471519,13443616,15678113,18200370,21037331,24217572,27771349,31730646,36129223,41002664,46388425,52325882,58856379,66023276,73871997,82450078,91807215,101995312,113068529,125083330,138098531,152175348,167377445,183770982,201424663,220409784,240800281,262672778,286106635,311183996,337989837,366612014,397141311,429671488,464299329,501124690,540250547,581783044,625831541,672508662,721930343,774215880,829487977,887872794,949499995,1014502796,1083018013,1155186110,1231151247,1311061328,1395068049,1483326946,1575997443,1673242900,1775230661,1882132102,1994122679,2111381976,2234093753,2362445994,2496630955,2636845212,2783289709,2936169806,3095695327,3262080608,3435544545,3616310642,3804607059,4000666660
lpb $0
mov $2,$0
sub $0,1
seq $2,8514 ; 4-dimensional centered cube numbers.
add $1,$2
lpe
add $1,1
mov $0,$1
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/sso/p12.adb
|
best08618/asylo
| 7 |
10366
|
-- { dg-do run }
with Init12; use Init12;
with Text_IO; use Text_IO;
with Dump;
procedure P12 is
Local_A1 : Arr1;
Local_A11 : Arr11;
Local_A2 : Arr2;
Local_A22 : Arr22;
begin
Put ("My_A1 :");
Dump (My_A1'Address, Arr1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "My_A1 : 12 00 ab 00 34 00 cd 00 56 00 ef 00.*\n" }
Put ("My_A11 :");
Dump (My_A11'Address, Arr11'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "My_A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00.*\n" }
Put ("My_A2 :");
Dump (My_A2'Address, Arr2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "My_A2 : 00 ab 00 12 00 cd 00 34 00 ef 00 56.*\n" }
Put ("My_A22 :");
Dump (My_A22'Address, Arr22'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "My_A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34.*\n" }
Local_A1 := My_A1;
Put ("Local_A1 :");
Dump (Local_A1'Address, Arr1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_A1 : 12 00 ab 00 34 00 cd 00 56 00 ef 00.*\n" }
Local_A11 := My_A11;
Put ("Local_A11 :");
Dump (Local_A11'Address, Arr11'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00.*\n" }
Local_A2 := My_A2;
Put ("Local_A2 :");
Dump (Local_A2'Address, Arr2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_A2 : 00 ab 00 12 00 cd 00 34 00 ef 00 56.*\n" }
Local_A22 := My_A22;
Put ("Local_A22 :");
Dump (Local_A22'Address, Arr22'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34.*\n" }
Local_A1 := (16#AB0012#, 16#CD0034#, 16#EF0056#);
Put ("Local_A1 :");
Dump (Local_A1'Address, Arr1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_A1 : 12 00 ab 00 34 00 cd 00 56 00 ef 00.*\n" }
Local_A11 := (1 => (16#AB0012#, 16#CD0034#),
2 => (16#AB0012#, 16#CD0034#));
Put ("Local_A11 :");
Dump (Local_A11'Address, Arr11'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00.*\n" }
Local_A2 := (16#AB0012#, 16#CD0034#, 16#EF0056#);
Put ("Local_A2 :");
Dump (Local_A2'Address, Arr2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_A2 : 00 ab 00 12 00 cd 00 34 00 ef 00 56.*\n" }
Local_A22 := (1 => (16#AB0012#, 16#CD0034#),
2 => (16#AB0012#, 16#CD0034#));
Put ("Local_A22 :");
Dump (Local_A22'Address, Arr22'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34.*\n" }
Local_A1(1) := Local_A2(1);
Local_A1(2) := Local_A2(2);
Local_A1(3) := Local_A2(3);
Put ("Local_A1 :");
Dump (Local_A1'Address, Arr1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_A1 : 12 00 ab 00 34 00 cd 00 56 00 ef 00.*\n" }
Local_A11(1,1) := Local_A22(1,1);
Local_A11(1,2) := Local_A22(1,2);
Local_A11(2,1) := Local_A22(2,1);
Local_A11(2,2) := Local_A22(2,2);
Put ("Local_A11 :");
Dump (Local_A11'Address, Arr11'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00.*\n" }
Local_A2(1) := Local_A1(1);
Local_A2(2) := Local_A1(2);
Local_A2(3) := Local_A1(3);
Put ("Local_A2 :");
Dump (Local_A2'Address, Arr2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_A2 : 00 ab 00 12 00 cd 00 34 00 ef 00 56.*\n" }
Local_A22(1,1) := Local_A11(1,1);
Local_A22(1,2) := Local_A11(1,2);
Local_A22(2,1) := Local_A11(2,1);
Local_A22(2,2) := Local_A11(2,2);
Put ("Local_A22 :");
Dump (Local_A22'Address, Arr22'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34.*\n" }
end;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_384.asm
|
ljhsiun2/medusa
| 9 |
3283
|
.global s_prepare_buffers
s_prepare_buffers:
push %r15
push %rax
push %rdi
lea addresses_WT_ht+0x24cc, %rdi
xor %rax, %rax
movb $0x61, (%rdi)
nop
nop
cmp %rax, %rax
pop %rdi
pop %rax
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %r9
push %rax
push %rbp
push %rsi
// Faulty Load
lea addresses_A+0x1ce58, %rbp
nop
xor $25737, %r9
movb (%rbp), %r13b
lea oracles, %rax
and $0xff, %r13
shlq $12, %r13
mov (%rax,%r13,1), %r13
pop %rsi
pop %rbp
pop %rax
pop %r9
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_A'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
data/RelocateCount.asm
|
Threetwosevensixseven/ZXRelocate
| 1 |
242818
|
; RelocateCount.asm
; Generated automatically by Relocate.exe
RelocateCount EQU 3 ; Relocation table is 6 byte(s) long
BA_ZX0 EQU $003D ; A bank ID will get patched here
BA_ZX1 EQU $003F ; A bank ID will get patched here
BA_MM0 EQU $0041 ; A bank ID will get patched here
|
Univalence/Pi1Cat.agda
|
JacquesCarette/pi-dual
| 14 |
13933
|
{-# OPTIONS --without-K #-}
module Pi1Cat where
-- Proving that Pi with one level of interesting 2 path structure is a
-- symmetric rig 2-groupoid
open import Level using () renaming (zero to lzero)
open import Data.Unit using (tt)
open import Data.Product using (_,_)
open import Function using (flip)
open import Categories.Category using (Category)
open import Categories.Terminal using (OneC)
open import Categories.Groupoid using (Groupoid)
open import Categories.Monoidal using (Monoidal)
open import Categories.Monoidal.Helpers using (module MonoidalHelperFunctors)
open import Categories.Functor using (Functor)
open import Categories.Bifunctor using (Bifunctor)
open import Categories.NaturalIsomorphism using (NaturalIsomorphism)
open import Categories.Monoidal.Braided using (Braided)
open import Categories.Monoidal.Symmetric using (Symmetric)
open import Categories.RigCategory
using (RigCategory; module BimonoidalHelperFunctors)
open import Categories.Bicategory using (Bicategory)
open import PiU using (U; PLUS; ZERO; TIMES; ONE)
open import PiLevel0
using (_⟷_; id⟷; _◎_;
!; !!;
_⊕_;
unite₊l; uniti₊l; unite₊r; uniti₊r;
swap₊;
assocr₊; assocl₊;
_⊗_;
unite⋆l; uniti⋆l; unite⋆r; uniti⋆r;
swap⋆;
assocr⋆; assocl⋆;
absorbl; absorbr; factorzl; factorzr;
dist; factor; distl; factorl)
open import PiLevel1 using (_⇔_; ⇔Equiv; triv≡; triv≡Equiv; 2!;
id⇔; trans⇔; _⊡_;
assoc◎l; idr◎l; idl◎l; linv◎l; rinv◎l;
id⟷⊕id⟷⇔; hom⊕◎⇔; resp⊕⇔;
unite₊l⇔r; uniti₊l⇔r; unite₊r⇔r; uniti₊r⇔r;
assocr⊕r; assocl⊕l; triangle⊕l; pentagon⊕l;
id⟷⊗id⟷⇔; hom⊗◎⇔; resp⊗⇔;
uniter⋆⇔l; unitir⋆⇔l; uniter⋆⇔r; unitir⋆⇔r;
assocr⊗r; assocl⊗l; triangle⊗l; pentagon⊗l;
swapr₊⇔; unite₊l-coh-l; hexagonr⊕l; hexagonl⊕l;
swapr⋆⇔; unite⋆l-coh-l; hexagonr⊗l; hexagonl⊗l;
absorbl⇔l; factorzr⇔l; absorbr⇔l; factorzl⇔l;
distl⇔l; factorl⇔l; dist⇔l; factor⇔l;
swap₊distl⇔l; dist-swap⋆⇔l; assocl₊-dist-dist⇔l; assocl⋆-distl⇔l;
fully-distribute⇔l; absorbr0-absorbl0⇔; absorbr⇔distl-absorb-unite;
unite⋆r0-absorbr1⇔; absorbl≡swap⋆◎absorbr;
absorbr⇔[assocl⋆◎[absorbr⊗id⟷]]◎absorbr;
[id⟷⊗absorbr]◎absorbl⇔assocl⋆◎[absorbl⊗id⟷]◎absorbr;
elim⊥-A[0⊕B]⇔l; elim⊥-1[A⊕B]⇔l;
-- for bicategory
idr◎r; idl◎r; assoc◎r
)
------------------------------------------------------------------------------
-- Pi1 is a category...
Pi1Cat : Category lzero lzero lzero
Pi1Cat = record
{ Obj = U
; _⇒_ = _⟷_
; _≡_ = _⇔_
; id = id⟷
; _∘_ = λ y⟷z x⟷y → x⟷y ◎ y⟷z
; assoc = assoc◎l
; identityˡ = idr◎l
; identityʳ = idl◎l
; equiv = ⇔Equiv
; ∘-resp-≡ = λ f g → g ⊡ f
}
-- and a groupoid ...
Pi1Groupoid : Groupoid Pi1Cat
Pi1Groupoid = record
{ _⁻¹ = !
; iso = record { isoˡ = linv◎l ; isoʳ = rinv◎l }
}
-- additive bifunctor and monoidal structure
⊕-bifunctor : Bifunctor Pi1Cat Pi1Cat Pi1Cat
⊕-bifunctor = record
{ F₀ = λ {(u , v) → PLUS u v}
; F₁ = λ {(x⟷y , z⟷w) → x⟷y ⊕ z⟷w }
; identity = id⟷⊕id⟷⇔
; homomorphism = hom⊕◎⇔
; F-resp-≡ = λ {(x , y) → resp⊕⇔ x y}
}
module ⊎h = MonoidalHelperFunctors Pi1Cat ⊕-bifunctor ZERO
-- note how powerful linv◎l/rinv◎l are in iso below
0⊕x≡x : NaturalIsomorphism ⊎h.id⊗x ⊎h.x
0⊕x≡x = record
{ F⇒G = record { η = λ X → unite₊l ; commute = λ f → unite₊l⇔r }
; F⇐G = record { η = λ X → uniti₊l ; commute = λ f → uniti₊l⇔r }
; iso = λ X → record { isoˡ = linv◎l; isoʳ = rinv◎l }
}
x⊕0≡x : NaturalIsomorphism ⊎h.x⊗id ⊎h.x
x⊕0≡x = record
{ F⇒G = record { η = λ X → unite₊r ; commute = λ f → unite₊r⇔r }
; F⇐G = record { η = λ X → uniti₊r ; commute = λ f → uniti₊r⇔r }
; iso = λ X → record { isoˡ = linv◎l ; isoʳ = rinv◎l }
}
[x⊕y]⊕z≡x⊕[y⊕z] : NaturalIsomorphism ⊎h.[x⊗y]⊗z ⊎h.x⊗[y⊗z]
[x⊕y]⊕z≡x⊕[y⊕z] = record
{ F⇒G = record
{ η = λ X → assocr₊
; commute = λ f → assocr⊕r
}
; F⇐G = record
{ η = λ X → assocl₊
; commute = λ f → assocl⊕l
}
; iso = λ X → record { isoˡ = linv◎l ; isoʳ = rinv◎l }
}
-- and a monoidal category (additive)
M⊕ : Monoidal Pi1Cat
M⊕ = record
{ ⊗ = ⊕-bifunctor
; id = ZERO
; identityˡ = 0⊕x≡x
; identityʳ = x⊕0≡x
; assoc = [x⊕y]⊕z≡x⊕[y⊕z]
; triangle = triangle⊕l
; pentagon = pentagon⊕l
}
-- multiplicative bifunctor and monoidal structure
⊗-bifunctor : Bifunctor Pi1Cat Pi1Cat Pi1Cat
⊗-bifunctor = record
{ F₀ = λ {(u , v) → TIMES u v}
; F₁ = λ {(x⟷y , z⟷w) → x⟷y ⊗ z⟷w }
; identity = id⟷⊗id⟷⇔
; homomorphism = hom⊗◎⇔
; F-resp-≡ = λ {(x , y) → resp⊗⇔ x y}
}
module ×h = MonoidalHelperFunctors Pi1Cat ⊗-bifunctor ONE
1⊗x≡x : NaturalIsomorphism ×h.id⊗x ×h.x
1⊗x≡x = record
{ F⇒G = record
{ η = λ X → unite⋆l
; commute = λ f → uniter⋆⇔l }
; F⇐G = record
{ η = λ X → uniti⋆l
; commute = λ f → unitir⋆⇔l }
; iso = λ X → record { isoˡ = linv◎l; isoʳ = rinv◎l }
}
x⊗1≡x : NaturalIsomorphism ×h.x⊗id ×h.x
x⊗1≡x = record
{ F⇒G = record
{ η = λ X → unite⋆r
; commute = λ f → uniter⋆⇔r
}
; F⇐G = record
{ η = λ X → uniti⋆r
; commute = λ f → unitir⋆⇔r
}
; iso = λ X → record { isoˡ = linv◎l ; isoʳ = rinv◎l }
}
[x⊗y]⊗z≡x⊗[y⊗z] : NaturalIsomorphism ×h.[x⊗y]⊗z ×h.x⊗[y⊗z]
[x⊗y]⊗z≡x⊗[y⊗z] = record
{ F⇒G = record
{ η = λ X → assocr⋆
; commute = λ f → assocr⊗r
}
; F⇐G = record
{ η = λ X → assocl⋆
; commute = λ f → assocl⊗l
}
; iso = λ X → record { isoˡ = linv◎l ; isoʳ = rinv◎l }
}
-- and a monoidal category (multiplicative)
M⊗ : Monoidal Pi1Cat
M⊗ = record
{ ⊗ = ⊗-bifunctor
; id = ONE
; identityˡ = 1⊗x≡x
; identityʳ = x⊗1≡x
; assoc = [x⊗y]⊗z≡x⊗[y⊗z]
; triangle = triangle⊗l
; pentagon = pentagon⊗l
}
x⊕y≡y⊕x : NaturalIsomorphism ⊎h.x⊗y ⊎h.y⊗x
x⊕y≡y⊕x = record
{ F⇒G = record { η = λ X → swap₊ ; commute = λ f → swapr₊⇔ }
; F⇐G = record { η = λ X → swap₊ ; commute = λ f → swapr₊⇔ }
; iso = λ X → record { isoˡ = linv◎l ; isoʳ = rinv◎l } }
BM⊕ : Braided M⊕
BM⊕ = record
{ braid = x⊕y≡y⊕x
; unit-coh = unite₊l-coh-l
; hexagon₁ = hexagonr⊕l
; hexagon₂ = hexagonl⊕l
}
x⊗y≡y⊗x : NaturalIsomorphism ×h.x⊗y ×h.y⊗x
x⊗y≡y⊗x = record
{ F⇒G = record { η = λ X → swap⋆ ; commute = λ f → swapr⋆⇔ }
; F⇐G = record { η = λ X → swap⋆ ; commute = λ f → swapr⋆⇔ }
; iso = λ X → record { isoˡ = linv◎l ; isoʳ = rinv◎l } }
BM⊗ : Braided M⊗
BM⊗ = record
{ braid = x⊗y≡y⊗x
; unit-coh = unite⋆l-coh-l
; hexagon₁ = hexagonr⊗l
; hexagon₂ = hexagonl⊗l
}
-- with both monoidal structures being symmetric
SBM⊕ : Symmetric BM⊕
SBM⊕ = record { symmetry = linv◎l }
SBM⊗ : Symmetric BM⊗
SBM⊗ = record { symmetry = rinv◎l }
module r = BimonoidalHelperFunctors BM⊕ BM⊗
x⊗0≡0 : NaturalIsomorphism r.x⊗0 r.0↑
x⊗0≡0 = record
{ F⇒G = record
{ η = λ X → absorbl
; commute = λ f → absorbl⇔l
}
; F⇐G = record
{ η = λ X → factorzr
; commute = λ f → factorzr⇔l
}
; iso = λ X → record { isoˡ = linv◎l ; isoʳ = rinv◎l }
}
0⊗x≡0 : NaturalIsomorphism r.0⊗x r.0↑
0⊗x≡0 = record
{ F⇒G = record { η = λ X → absorbr ; commute = λ f → absorbr⇔l }
; F⇐G = record { η = λ X → factorzl ; commute = λ f → factorzl⇔l }
; iso = λ X → record { isoˡ = linv◎l ; isoʳ = rinv◎l }
}
x⊗[y⊕z]≡[x⊗y]⊕[x⊗z] : NaturalIsomorphism r.x⊗[y⊕z] r.[x⊗y]⊕[x⊗z]
x⊗[y⊕z]≡[x⊗y]⊕[x⊗z] = record
{ F⇒G = record { η = λ _ → distl ; commute = λ f → distl⇔l }
; F⇐G = record { η = λ _ → factorl ; commute = λ f → factorl⇔l }
; iso = λ X → record { isoˡ = linv◎l ; isoʳ = rinv◎l }
}
[x⊕y]⊗z≡[x⊗z]⊕[y⊗z] : NaturalIsomorphism r.[x⊕y]⊗z r.[x⊗z]⊕[y⊗z]
[x⊕y]⊗z≡[x⊗z]⊕[y⊗z] = record
{ F⇒G = record { η = λ X → dist ; commute = λ f → dist⇔l }
; F⇐G = record { η = λ X → factor ; commute = λ f → factor⇔l }
; iso = λ X → record { isoˡ = linv◎l ; isoʳ = rinv◎l }
}
-- and the multiplicative structure distributing over the additive one
Pi1Rig : RigCategory SBM⊕ SBM⊗
Pi1Rig = record
{ distribₗ = x⊗[y⊕z]≡[x⊗y]⊕[x⊗z]
; distribᵣ = [x⊕y]⊗z≡[x⊗z]⊕[y⊗z]
; annₗ = 0⊗x≡0
; annᵣ = x⊗0≡0
; laplazaI = swap₊distl⇔l
; laplazaII = dist-swap⋆⇔l
; laplazaIV = assocl₊-dist-dist⇔l
; laplazaVI = assocl⋆-distl⇔l
; laplazaIX = fully-distribute⇔l
; laplazaX = absorbr0-absorbl0⇔
; laplazaXI = absorbr⇔distl-absorb-unite
; laplazaXIII = unite⋆r0-absorbr1⇔
; laplazaXV = absorbl≡swap⋆◎absorbr
; laplazaXVI = absorbr⇔[assocl⋆◎[absorbr⊗id⟷]]◎absorbr
; laplazaXVII = [id⟷⊗absorbr]◎absorbl⇔assocl⋆◎[absorbl⊗id⟷]◎absorbr
; laplazaXIX = elim⊥-A[0⊕B]⇔l
; laplazaXXIII = elim⊥-1[A⊕B]⇔l
}
------------------------------------------------------------------------------
-- The morphisms of the Pi1 category have structure; they form a
-- category, something like another Symmetric Rig Groupoid but more
-- general
⟷Cat : (t₁ t₂ : U) → Category lzero lzero lzero
⟷Cat t₁ t₂ = record
{ Obj = t₁ ⟷ t₂
; _⇒_ = _⇔_
; _≡_ = triv≡
; id = id⇔
; _∘_ = flip trans⇔
; assoc = tt
; identityˡ = tt
; identityʳ = tt
; equiv = triv≡Equiv
; ∘-resp-≡ = λ _ _ → tt
}
⟷Groupoid : (t₁ t₂ : U) → Groupoid (⟷Cat t₁ t₂)
⟷Groupoid t₁ t₂ = record
{ _⁻¹ = 2!
; iso = record { isoˡ = tt ; isoʳ = tt }
}
-- These feel like the right notions of bifunctor but of course they
-- are relating different categories so the rest of the development to
-- RigCategory would need to be generalized if we were to use these
-- definitions of bifunctors.
⊕⟷-bifunctor : (t₁ t₂ t₃ t₄ : U) →
Bifunctor (⟷Cat t₁ t₂) (⟷Cat t₃ t₄) (⟷Cat (PLUS t₁ t₃) (PLUS t₂ t₄))
⊕⟷-bifunctor t₁ t₂ t₃ t₄ = record
{ F₀ = λ {(f , g) → f ⊕ g }
; F₁ = λ {(α , β) → resp⊕⇔ α β }
; identity = tt
; homomorphism = tt
; F-resp-≡ = λ _ → tt
}
⊗⟷-bifunctor : (t₁ t₂ t₃ t₄ : U) →
Bifunctor (⟷Cat t₁ t₂) (⟷Cat t₃ t₄) (⟷Cat (TIMES t₁ t₃) (TIMES t₂ t₄))
⊗⟷-bifunctor t₁ t₂ t₃ t₄ = record
{ F₀ = λ {(f , g) → f ⊗ g }
; F₁ = λ {(α , β) → resp⊗⇔ α β }
; identity = tt
; homomorphism = tt
; F-resp-≡ = λ _ → tt
}
------------------------------------------------------------------------------
-- We have a 2-category but NOT a strict one.
idF : {t : U} → Functor {lzero} {lzero} {lzero} OneC (⟷Cat t t)
idF {t} = record
{ F₀ = λ _ → id⟷ {t}
; F₁ = λ _ → id⇔
; identity = tt
; homomorphism = tt
; F-resp-≡ = λ _ → tt
}
∘-bifunctor : {t₁ t₂ t₃ : U} → Bifunctor (⟷Cat t₂ t₃) (⟷Cat t₁ t₂) (⟷Cat t₁ t₃)
∘-bifunctor = record
{ F₀ = λ {(f , g) → g ◎ f}
; F₁ = λ {(α , β) → β ⊡ α}
; identity = tt
; homomorphism = tt
; F-resp-≡ = λ _ → tt
}
Pi1-Bicat : Bicategory lzero lzero lzero lzero
Pi1-Bicat = record
{ Obj = U
; _⇒_ = ⟷Cat
; id = idF
; —∘— = ∘-bifunctor
; λᵤ = record
{ F⇒G = record { η = λ X → idr◎l ; commute = λ {f → tt} }
; F⇐G = record { η = λ X → idr◎r ; commute = λ {X} {Y} f → tt }
; iso = λ X → record { isoˡ = tt ; isoʳ = tt }
}
; ρᵤ = record
{ F⇒G = record { η = λ X → idl◎l ; commute = λ {X} {Y} f → tt }
; F⇐G = record { η = λ X → idl◎r ; commute = λ {X} {Y} f → tt }
; iso = λ X → record { isoˡ = tt ; isoʳ = tt }
}
; α = record
{ F⇒G = record { η = λ _ → assoc◎r ; commute = λ {X} {Y} f → tt }
; F⇐G = record { η = λ _ → assoc◎l ; commute = λ {X} {Y} f → tt }
; iso = λ X → record { isoˡ = tt ; isoʳ = tt }
}
; triangle = λ {A} {B} {C} f g → tt
; pentagon = λ {A} {B} {C} {D} {E} f g h i → tt
}
{--
Here is why Pi1 is NOT a strict 2-Category:
Pi1-2Cat : 2-Category lzero lzero lzero lzero
Pi1-2Cat = record
{ Obj = U
; _⇒_ = ⟷Cat
; id = idF
; —∘— = ∘-bifunctor
; assoc = {!!}
; identityˡ = {!!} }
The definition of 2-Category is STRICT, which means that for proof of
identityˡ requires the following diagram to commute:
Assume the following 1-paths:
c₁ c₂ : A ⟷ B
id_B : B ⟷ B
and the following 2-paths:
α : c₁ ⇔ c₂
id_id_B : id_B ⇔ id_B
We can construct the 2-path:
α ⊡ id_id_B : c₁ ◎ id_B ⇔ c₂ ◎ id_B
The property identityˡ requires that there is a 3-path between
α and α ⊡ id_id_B
and indeed there are "equivalent" in some sense as:
α ⊡ id_id_B : c₁ ◎ id_B ⇔ c₂ ◎ id_B
can be viewed as having the equivalent type:
α ⊡ id_id_B : c₁ ⇔ c₂
and we identify all 2-paths of the same type.
This reasoning however requires that identityˡ is asserted up to the
2-paths relating c₁ ◎ id_B and c₁ on one hand and c₂ ◎ id_B and c₂ on
the other hand.
Formally the nlab page http://ncatlab.org/nlab/show/2-category
explains this as follows:
For some purposes, strict 2-categories are too strict: one would
like to allow composition of morphisms to be associative and unital
only up to coherent invertible 2-morphisms. A direct generalization
of the above “enriched” definition produces the classical notion of
bicategory.
So to conclude what we really need is a weak version of 2-Category
which is known as 'bicategory'.
--}
------------------------------------------------------------------------------
|
dimension/cell/lib/string/utf8/utf8.asm
|
ekscrypto/Unununium
| 7 |
243123
|
<filename>dimension/cell/lib/string/utf8/utf8.asm
; UTF-8 and UCS-4 String Routines
; Copyright (C) 2002, <NAME> & <NAME>
; Distributed under the X11 License
;
; UTF-8 and UCS-4 string routines
section .c_init
global _start
_start:
;; no initialisation required
;; do nothing
retn
section .c_info
db 0,0,1,'a'
dd str_cellname
dd str_author
dd str_copyrights
str_cellname: dd "common UCS4 & UFT8 string functions"
str_author: dd '<NAME>',0x0A,'<NAME>'
str_copyrights: dd 'Copyright 2002 by <NAME> & <NAME>; distributed under the X11 license'
section .text
globalfunc utf8.strlen
;utf8.strlen:
;-----------------------------------------------------------------------------
; Return number of characters in UTF-8 string, excluding terminating Nil.
; The routine will raise the carry flag if the string is not a valid UTF-8
; string.
;
; This routine is dependant on utf8.decode_ucs4.from_utf8
;
; parameters:
;------------
; ESI = pointer to UTF-8 string
;
; returns:
;---------
; EAX = string length (including 0 length)
; CF = 0, valid UTF-8 string
; EAX = 0
; CF = 0, string is 0 length
; EAX = destroyed
; CF = 1, invalid UTF-8 (sub)string
push esi ; save register that will be modified
push ecx
mov ecx, -1 ; initialize counter
.stringcount:
inc ecx
call utf8.decode_ucs4.from_utf8
jc .done ; carry flag has been set
test eax, eax ; have we reached Nil?
jnz .stringcount
.done:
mov eax, ecx
pop ecx
pop esi
retn
;-----------------------------------------------------------------------------
globalfunc utf8.strsize
;utf8.strsize:
;-----------------------------------------------------------------------------
; Returns size in bytes of UTF-8 encoded string up until terminating Nil
; character.
;
; parameters:
;------------
; ESI = pointer to UTF-8 encoded string
;
; returns:
;---------
; EAX = size of string in bytes
;
push esi ; save registers to be modified
push ecx
xor ecx, ecx ; zero byte counter
.stringsize:
mov al, [esi]
inc ecx ; increment character counter
inc esi ; move to next char to compare
test al, al ; test for Nil terminator
jnz .stringsize
.done:
lea eax, [ecx - 1] ; move result into eax
pop ecx ; restore ecx
pop esi ; restore esi
retn
;-----------------------------------------------------------------------------
globalfunc utf8.strncmp
;utf8.strncmp:
;-----------------------------------------------------------------------------
; Compares two UTF-8 encoded strings for first n characters, or up until
; the Nil terminaters - whichever is reached first
;
; parameters:
;------------
; ESI = UTF-8 encoded string1
; EDI = UTF-8 encoded string2
; ECX = number of characters to compare from beginning of two strings
;
; returns:
;---------
; EAX = 0, CF = 0, strings are equal
; EAX = 1, CF = 0, strings are not equal
; CF = 1, one or more strings are invalid
pushad ; save registers
.strcmp:
xor eax, eax ; clear eax
dec ecx ; decrement character counter
jz .finished ;
call utf8.decode_ucs4.from_utf8
jc .invalid
mov ebx, eax ; save string1 UCS4 char
mov ebp, esi ; save incremented esi pointer for string1
mov esi, edi ; setup utf8.decode_ucs4.from_utf8 for string2
call utf8.decode_ucs4.from_utf8
jc .invalid
cmp eax, ebx ; are the two chars equal?
jnz .finished ; no not equal - zero flag set
mov edi, esi ; setup incremented string2 pointer to edi
mov esi, ebp ; setup incremented string1 pointer to esi
test eax, ebx ; have we reached terminating Nils before count is up?
jnz .strcmp
.finished:
clc ; clear the carry flag
.invalid: ; carry flag already raised
mov [esp + 28], eax
popad
retn
;-----------------------------------------------------------------------------
globalfunc utf8.strcmp
;utf8.strcmp:
;-----------------------------------------------------------------------------
; Determines if two UTF-8 encoded strings are equivalent.
;
; parameters:
;------------
; ESI = UTF-8 encoded string1
; EDI = UTF-8 encoded string2
;
; returns:
;---------
; EAX = 0, CF = 0, strings are equal
; EAX = 1, CF = 0, strings are not equal
; CF = 1, one or more strings are invalid
;
;;; use strncmp with exc=7fffffff
mov ecx, 0x7fffffff
call utf8.strncmp
retn
;-----------------------------------------------------------------------------
globalfunc utf8.strstr
;utf8.strstr:
;-----------------------------------------------------------------------------
; Locate first occurance of a substring in a UTF-8 encoded string.
;
; ** Still needs to be coded **
;-----------------------------------------------------------------------------
; Universal Multiple-Octet Coded Character Set (UCS) Routines
; Copyright (C) 2002, <NAME>
; Distributed under the X11 License
;
; Compliant with ISO/IEC 2022, 4873 and 10646
; See http://www.cl.cam.ac.uk/~mgk25/ucs/ISO-10646-UTF-8.html
;
; If you have any comment/question about this code, feel free to write to
; me at <EMAIL>
globalfunc utf8.decode_ucs4.from_utf8
;utf8.decode_ucs4.from_utf8:
;-----------------------------------------------------------------------------
; Retrieve a UCS-4 character from a UTF-8 encoded string and move the string
; pointer fowards accordingly.
;
; UCS-4 encoded in UTF-8 can be from 1 to 6 bytes in length. The first byte
; indicates how many bytes are required in order to reconstruct the entire
; character.
;
; This function also checks for the validity of the UTF-8 data being retrieved.
; In the event that the string would be out of sync or simply invalid, it would
; raise the Carry Flag and return ESI identical to when it was received. When
; the character is decoded from a valid UTF-8 string, the Carry Flag is cleared,
; the UCS-4 placed in EAX and ESI moved foward past the end of the now decoded
; character.
;
; parameters:
;------------
; esi: pointer to utf8 string
;
; returns:
;---------
; CF = 0, valid character found
; EAX = UCS
; CF = 1, invalid character detected
; EAX = destroyed
; note: ESI is left unmodified
;
; Determine The Encoding Length
;---------------------------------------------
mov eax, [esi] ; tentatively load 4 bytes
test al, byte 0x80 ; bit 7 of 1st byte = 0?
jz short .case_1byte ; 0xxxxxxx ->> range 00-7F
test al, byte 0x40 ; bit 6 of 1st byte = 0?
jz short .case_invalid ; 10xxxxxx .. out of sync!
push ebx ; backup EBX, it will be used
test al, byte 0x20 ; bit 5 of 1st byte = 0?
jz short .case_2bytes ; 110xxxxx ->> range 80-7FF
push ecx ; backup ECX, it will be used
test al, byte 0x10 ; bit 4 of 1st byte = 0?
jz short .case_3bytes ; 1110xxxx ->> range 800-FFFF
push edx ; backup EDX, it will be used
test al, byte 0x08 ; bit 3 of 1st byte = 0?
jz near .case_4bytes ; 11110xxx ->> range 10000-1FFFFF
test al, byte 0x04 ; bit 2 of 1st byte = 0?
jz near .case_5bytes ; 111110xx ->> range 200000-3FFFFFF
test al, byte 0x02 ; bit 1 of 1st byte = 0?
jz near .case_6bytes ; 1111110x ->> range 4000000-7FFFFFFF
;
; 1111111x invalid..
;
.case_invalid_pop3: ;
pop edx ; restore EDX
.case_invalid_pop2: ;
pop ecx ; restore ECX
.case_invalid_pop1: ;
pop ebx ; restore EBX
;
.case_invalid: ;
stc ; set CF = 1 to indicate invalid input
retn ; return to caler with error
;
;
.case_1byte: ; Encoded In a Single Byte
;---------------------------------------------
and eax, byte 0x7F ; set CF to 0, zeroize extra bytes read
inc esi ; doesn't affect CF
retn ; return 00-7F range UCS-4
;
.case_2bytes: ; Encoded In 2 Bytes
;---------------------------------------------
mov ebx, eax ; move 1st byte in bl
mov al, ah ; move 2nd byte in al
and ah, byte 0xC0 ; keep highest 2bits of 2nd byte
cmp ah, byte 0x80 ; check to make sure they are 10
jnz short .case_invalid_pop1 ;
shl ebx, byte 6 ; shift 1st byte by 6bit at the right position
and eax, byte 0x3F ; keep only the meaningful bit of 2nd byte
inc esi ; move string pointer foward once (1st byte)
or eax, ebx ; or 2nd and 1st byte
inc esi ; move string pointer foward once (2nd byte)
and eax, dword 0x7FF ; set CF to 0, zeroize extra bytes read
pop ebx ; restore EBX
retn ; return 80-7FF range UCS-4
;
.case_3bytes: ; Encoded In 3 Bytes
;---------------------------------------------
mov ebx, eax ; move 3rd byte in EBX(23:16)
and eax, dword 0x00C0C000 ; keep 2highest bits of 2nd and 3rd byte
mov ecx, ebx ; move 2nd byte in ECX(15:8)
cmp eax, dword 0x00808000 ; make sure they are 10xxxxxx
mov eax, ecx ; move 1st byte in EAX(7:0)
jnz short .case_invalid_pop2 ;
shr ebx, byte 16 ; shift 3rd byte in final position
and eax, byte 0x0F ; keep low 4bits of 1st byte
shr ecx, byte 2 ; shift 2nd byte in final position
and ebx, byte 0x0000003F ; keep low 6bits of 3rd byte
shl eax, 12 ; shift 1st byte in final position
and ecx, dword 0x00000FC0 ; keep low 6bits of 2nd byte
or eax, ebx ; merge 1st and 3rd bytes
inc esi ; move string pointer foward once (1st byte)
or eax, ecx ; merge in 2nd byte, clear CF
inc esi ; move string pointer foward once (2nd byte)
pop ecx ; restore ECX
inc esi ; move string pointer foward once (3rd byte)
pop ebx ; restore EBX
retn ; return 800-FFFF range UCS-4
;
.case_4bytes: ; Encoded In 4 Bytes
;---------------------------------------------
mov ebx, eax ; move 4th byte in EBX(31:24)
and eax, dword 0xC0C0C000 ; keep highest 2bits of 2nd,3rd and 4th bytes
mov ecx, ebx ; move 3rd byte in ECX(23:16)
cmp eax, dword 0x80808000 ; make sure the pairs of bits are all 10
mov edx, ebx ; move 2nd byte in EDX(15:8)
jnz short .case_invalid_pop3 ;
xor edx, eax ; keep lowest 6bits of 4th byte
shr ecx, byte 10 ; shift 3rd byte into position
mov eax, ebx ; move 1st byte in EAX(7:0)
shr edx, byte 24 ; shift 4th byte into position
and eax, byte 0x07 ; keep lowest 3bits of 1st byte
shl ebx, byte 4 ; shift 2nd byte into position
and ecx, dword 0x00000FC0 ; keep lowest 6bits of 3rd byte
shl eax, byte 18 ; shift 1st byte into position
and ebx, dword 0x0003F000 ; keep lowest 6bits of 2nd byte
or ecx, edx ; merge in 3rd and 4th bytes
or eax, ebx ; merge in 1st and 2nd bytes
add esi, byte 4 ; move string pointer foward 4 bytes
or eax, ecx ; merge in all 4bytes
pop edx ; restore EDX
pop ecx ; restore ECX
pop ebx ; restore EBX
retn ; return 10000-1FFFFF range UCS-4
;
.case_5bytes: ; Encoded In 5 Bytes
;---------------------------------------------
mov ebx, eax ; move 4th byte in EBX(31:24)
and eax, dword 0xC0C0C000 ; keep highest 2bits of 2nd,3rd and 4th bytes
mov ecx, ebx ; move 3rd byte in ECX(23:16)
cmp eax, dword 0x80808000 ; make sure the pairs of bits are all 10
mov edx, ebx ; move 2nd byte in EDX(15:8)
.case_invalid_relay3: ;
jnz near .case_invalid_pop3 ;
xor edx, eax ; keep lowest 6bits of 4th byte
shr ecx, byte 10 ; shift 3rd byte into temporary position
mov eax, ebx ; move 1st byte in EAX(7:0)
shr edx, byte 24 ; shift 4th byte into temporary position
and eax, byte 0x03 ; keep lowest 2bits of 1st byte
shl ebx, byte 4 ; shift 2nd byte into temporary position
and ecx, dword 0x00000FC0 ; keep lowest 6bits of 3rd byte
shl eax, byte 18 ; shift 1st byte into temporary position
and ebx, dword 0x0003F000 ; keep lowest 6bits of 2nd byte
or ecx, edx ; merge in 3rd and 4th bytes
or eax, ebx ; merge in 1st and 2nd bytes
mov dl, byte [esi + 4] ; read in the 5th byte
or ecx, eax ; merge in all first 4 bytes
mov al, dl ; copy 5th byte for validity check
and al, 0xC0 ; keep highest 2 bits of 5th byte
cmp al, 0x80 ; make sure they are 10
jnz short .case_invalid_relay3;
xor dl, al ; keep lowest 6bits of 5th byte
shl ecx, byte 6 ; shift byte 1-4 into final position
mov eax, edx ; move 5th byte into final position
add esi, byte 5 ; move string pointer foward 5 bytes
or eax, ecx ; merge in bytes 1-4 with 5th byte
pop edx ; restore EDX
pop ecx ; restore ECX
pop ebx ; restore EBX
retn ; return 200000-3FFFFFF range UCS-4
;
.case_6bytes: ; Encoded In 6 Bytes
;---------------------------------------------
mov ebx, eax ; move 4th byte in EBX(31:24)
and eax, dword 0xC0C0C000 ; keep highest 2bits of 2nd,3rd and 4th bytes
mov ecx, ebx ; move 3rd byte in ECX(23:16)
cmp eax, dword 0x80808000 ; make sure the pairs of bits are all 10
mov edx, ebx ; move 2nd byte in EDX(15:8)
.case_invalid_relay3_2:
jnz short .case_invalid_relay3;
xor edx, eax ; keep lowest 6bits of 4th byte
shr ecx, byte 10 ; shift 3rd byte into temporary position
mov eax, ebx ; move 1st byte in EAX(7:0)
shr edx, byte 24 ; shift 4th byte into temporary position
and eax, byte 0x01 ; keep lowest bit of 1st byte
shl ebx, byte 4 ; shift 2nd byte into temporary position
and ecx, dword 0x00000FC0 ; keep lowest 6bits of 3rd byte
shl eax, byte 18 ; shift 1st byte into temporary position
and ebx, dword 0x0003F000 ; keep lowest 6bits of 2nd byte
or ecx, edx ; merge in 3rd and 4th bytes
or eax, ebx ; merge in 1st and 2nd bytes
mov edx, dword [esi + 4] ; read in the 5th and 6th bytes
or ecx, eax ; merge in all first 4 bytes
mov eax, edx ; copy bytes 5-6 for validity check
and eax, dword 0x0000C0C0 ; keep highest 2 bits of bytes 5-6
xor edx, eax ; keep lowest 6bits of 5th byte
cmp eax, dword 0x00008080 ; make sure they are 10
mov al, dh ; move 6th byte into EAX(7:0)
jnz short .case_invalid_relay3_2;
and edx, byte 0x3F ; keep lowest 6bits of 6th byte
shl ecx, byte 12 ; shift byte 1-4 into final position
shl edx, byte 6 ; shift 5th byte into final position
and eax, byte 0x3F ; make sure only the 6th byte is present in EBX
or ecx, edx ; merge 5th byte with bytes 1-4
add esi, byte 6 ; move string pointer foward 6 bytes
or eax, ecx ; merge in bytes 1-5 with 6th byte
pop edx ; restore EDX
pop ecx ; restore ECX
pop ebx ; restore EBX
retn ; return 4000000-7FFFFFFF range UCS-4
;-----------------------------------------------------------------------------
globalfunc utf8.encode_ucs4.to_utf8
;utf8.encode_ucs4.to_utf8:
;-----------------------------------------------------------------------------
; Encodes a UCS-4 character into a valid UTF-8 string. Since an encoded
; UCS-4 can take from 1 to 6 bytes, it is required to at least have 6 bytes
; free in the destination string buffer.
;
; UCS-4 with bit 31 set will be flagged as invalid, causing the routine to
; return with the Carry Flag set. When completed successfully, this routine
; return with the Carry Flag cleared.
;
; parameters:
;------------
; EAX = UCS-4
; EDI = pointer to UTF-8 buffer (must have at least 6 bytes free)
;
; returns:
;---------
; CF = 0, encoded properly
; EAX = destroyed
; CF = 1, invalid UCS-4 (bit 31 is not 0)
; EAX = unmodified
;
; Determine The Encoding Length
;---------------------------------------------
cmp eax, byte 0x7F ; range 00-7F ?
jbe .case_1byte ; if so, use 1 byte
push ebx ; backup original EBX
cmp eax, dword 0x000007FF ; range 80-7FF ?
mov ebx, eax ; load EBX with UCS-4 to encode
jbe .case_2bytes ; if within range, use 2 bytes
push ecx ; backup original ECX
cmp eax, dword 0x0000FFFF ; range 800-FFFF ?
mov ecx, eax ; load ECX with UCS-4 to encode
jbe .case_3bytes ; if within range, use 3 bytes
push edx ; backup original EDX
cmp eax, dword 0x001FFFFF ; range 10000-1FFFFF ?
mov edx, eax ; load EDX with UCS-4 to encode
jbe .case_4bytes ; if within range, use 4 bytes
cmp eax, dword 0x03FFFFFF ; range 200000-3FFFFFF ?
jbe near .case_5bytes ; if so, use 5 bytes
cmp eax, dword 0x7FFFFFFF ; range 4000000-7FFFFFFF ?
jbe near .case_6bytes ; if so, use 6 bytes
;
; bit 31 is set, unable to encode in UTF-8
pop edx ; restore original EDX
pop ecx ; restore original ECX
pop ebx ; restore original EBX
;
.invalid: ;
stc ; set the Carry Flag
retn ; return to the caller
;
.case_1byte: ; Encoded In 1 Byte
;---------------------------------------------
mov [edi], byte al ; store the value
clc ; clear the carry flag
inc edi ; move the string pointer foward (1 byte)
retn ; return range 00 - 7F
;
.case_2bytes: ; Encoded In 2 Bytes
;---------------------------------------------
shl ebx, 8 ; Byte2: Move UCS-4(5:0) into EBX(13:8)
shr eax, 6 ; Byte1: Move UCS-4(10:6) into EAX(4:0)
and ebx, dword 0x00003F00 ; Byte2: mask all bits except UCS-4(5:0)
and eax, byte 0x1F ; Byte1: mask all bits except UCS-4(10:6)
lea ebx, [eax + ebx + 0x000080C0]; merge bytes 1 and 2, set encoding bits
mov [edi], ebx ; store the encoded bytes
add edi, byte 2 ; move string pointer forward 2 bytes, clear CF
pop ebx ; restore original EBX
retn ; return range C2 80 - CF BF
;
.case_3bytes: ; Encoded In 3 Bytes
;---------------------------------------------
shr eax, 12 ; Byte1: Move UCS-4(15:12) into EAX(3:0)
shl ebx, 2 ; Byte2: Move UCS-4(11:6) into EBX(13:8)
shl ecx, 16 ; Byte3: Move UCS-4(5:0) into ECX(21:16)
and eax, byte 0x0F ; Byte1: mask all bits except UCS-4(15:12)
and ebx, dword 0x00003F00 ; Byte2: mask all bits except UCS-4(11:6)
and ecx, dword 0x003F0000 ; Byte3: mask all bits except UCS-4(5:0)
lea eax, [eax + ebx + 0x008080E0]; merge bytes 1-2, set the encoding bits
or eax, ecx ; merge byte 3 with bytes 1-2
mov [edi], eax ; store the encoded bytes
add edi, byte 3 ; move string pointer foward 3 bytes, clear CF
pop ecx ; restore original ECX
pop ebx ; restore original EBX
retn ; return range E0 A0 80 - EF BF BF
;
.case_4bytes: ; Encoded In 4 Bytes
;---------------------------------------------
shr eax, 18 ; Byte1: Move UCS-4(20:18) into EAX(2:0)
shr ebx, 4 ; Byte2: Move UCS-4(17:12) into EBX(13:8)
shl ecx, 10 ; Byte3: Move UCS-4(11:6) into ECX(21:16)
shl edx, 24 ; Byte4: Move UCS-4(5:0) into EDX(29:24)
and eax, byte 0x07 ; Byte1: mask all bits except UCS-4(20:18)
and edx, dword 0x3F000000 ; byte4: mask all bits except UCS-4(5:0)
and ecx, dword 0x003F0000 ; Byte3: mask all bits except UCS-4(11:6)
lea eax, [edx + eax + 0x808080F0]; merge bytes 1 and 4, set encoding bits
and ebx, dword 0x00003F00 ; Byte2: mask all bits except UCS-4(17:12)
or eax, ecx ; merge byte 3 with 1 and 4
pop edx ; restore original EDX
or eax, ebx ; merge in byte 2 in final encoding
pop ecx ; restore original ECX
mov [edi], dword eax ; store the encoded bytes
pop ebx ; restore original EBX
add edi, byte 4 ; move string pointer forward, clear CF
retn ; return range F0 90 80 80 - F7 BF BF BF
;
.case_5bytes: ; Encoded In 5 Bytes
;---------------------------------------------
push eax ; backup UCS-4(5:0)
shr eax, 24 ; Byte1: Move UCS-4(25:24) into EAX(1:0)
shr ebx, 10 ; Byte2: Move UCS-4(23:18) into EBX(13:8)
shl ecx, 4 ; Byte3: Move UCS-4(17:12) into ECX(21:16)
shl edx, 18 ; Byte4: Move UCS-4(11:6) into EDX(29:24)
and eax, byte 0x03 ; Byte1: mask all bits except UCS-4(25:24)
and ebx, dword 0x00003F00 ; Byte2: mask all bits except UCS-4(23:18)
and ecx, dword 0x003F0000 ; Byte3: mask all bits except UCS-4(17:12)
lea eax, [eax + ebx + 0x808080F8]; merge bytes 1-2, set encoding bits
and edx, dword 0x3F000000 ; Byte4: mask all bits except UCS-4(11:6)
or ecx, eax ; merge byte 1-2 with byte 3
pop eax ; restore UCS-4(5:0) bits
or ecx, edx ; merge byte 4 with bytes 1-3
mov [edi], ecx ; store encoded bytes 1-4
and eax, byte 0x3F ; Byte5: mask all bits except UCS-4(5:0)
or al, byte 0x80 ; set encoding bits
mov [edi+4], byte al ; store encoded byte 5
pop edx ; restore original EDX
pop ecx ; restore original ECX
add edi, byte 5 ; move string pointer forward, clear CF
pop ebx ; restore original EBX
retn ; return range F8 88 80 80 80 - FB BF BF BF BF
;
.case_6bytes: ; Encoded In 6 Bytes
;---------------------------------------------
push eax ; backup UCS-4(11:0)
shr eax, 30 ; Byte1: Move UCS-4(30:30) into EAX(0:0)
shr ebx, 16 ; Byte2: Move UCS-4(29:24) into EBX(13:8)
shr ecx, 2 ; Byte3: Move UCS-4(23:18) into ECX(21:16)
shl edx, 12 ; Byte4: Move UCS-4(17:12) into EDX(29:24)
and eax, byte 0x01 ; Byte1: mask all bits except UCS-4(30:30)
and ebx, dword 0x00003F00 ; Byte2: mask all bits except UCS-4(29:24)
and ecx, dword 0x003F0000 ; Byte3: mask all bits except UCS-4(23:18)
lea eax, [eax + ebx + 0x808080FC]; merge bytes 1 and 2, set encoding bits
and edx, dword 0x3F000000 ; Byte4: mask all bits except UCS-4(17:12)
or ecx, eax ; merge byte 1-2 with byte 3
pop eax ; restore UCS-4(11:0)
or ecx, edx ; merge byte 4 with bytes 1-3
mov ebx, eax ; copy UCS-4(11:0)
mov [edi], ecx ; store encoded bytes 1-4
shr ebx, byte 6 ; Byte5: Move UCS-4(11:6) into EBX(5:0)
pop edx ; restore original EDX
and ebx, byte 0x3F ; Byte5: mask all bits except UCS-4(5:0)
and eax, byte 0x3F ; Byte6: mask all bits except UCS
or bl, byte 0x80 ; Byte5: set encoding bits
or al, byte 0x80 ; Byte6: set encoding bits
mov [edi+4], byte bl ; store encoded byte 5
mov [edi+5], byte al ; store encoded byte 6
pop ecx ; restore original ECX
add edi, byte 6 ; move string pointer forward, clear CF
pop ebx ; restore original EBX
retn ; return range FC84808080-FDBFBFBFBFBF
;-----------------------------------------------------------------------------
globalfunc utf8.match_to_utf8_pattern
;utf8.match_to_utf8_pattern:
;-----------------------------------------------------------------------------
; Compare if a given string matches the given pattern. The pattern may contain
; the following wildcards:
; * match any number of chars
; ? match any single character
;
; This routine is dependant on utf8.decode_ucs4.from_utf8
;
; parameters:
;------------
; EDI = pointer to UTF-8 string to match
; EDX = pointer to UTF-8 pattern
;
; returns:
;---------
; ECX = 0, pattern matched
; ECX = 1, pattern not matched / invalid UTF-8 string/pattern
;
;-----------------------------------------------------------------------------
xor ecx, ecx ; set return code to failed by default
pushad ; backup all regs
mov ebp, esp ; mark entry TOS
;
.matching: ; check for wildcard '*'
mov esi, edx ;-----------------------
call utf8.decode_ucs4.from_utf8 ; get a single UCS-4 character
jc short .fail ; in case of an invalid UTF-8 pattern
cmp eax, byte '*' ; check if UCS-4 == '*'
mov ebx, eax ; move UCS-4 from pattern into EBX
jnz short .single_comp ; if not '*', match a single UCS-4
;
; catch multiple successive '*'
.catch_wc: ;------------------------------
call utf8.decode_ucs4.from_utf8 ; retrieve another UCS-4
jc short .fail ; in case of an invalid UTF-8 pattern
cmp eax, byte '*' ; check if UCS-4 == '*'
jz short .catch_wc ; yes, save new pattern ptr
mov edx, esi ; save pattern pointer
;
; check if pattern end with '*'
;------------------------------
test eax, eax ; UCS-4 == 0 ?
mov esi, edi ; load UTF-8 string pointer in ESI
jz short .success ; yip, we got a match
;
; find first matching char after '*'
;-----------------------------------
mov ebx, eax ; move UCS-4 from pattern into EBX
.match_wc_all: ;
call utf8.decode_ucs4.from_utf8 ; get a UCS-4 from UTF-8 string
jc short .fail ; check for invalid UTF-8 string
test eax, eax ; end of string to match? (UCS-4==0)
jz short .fail ; if so we fail
;
cmp ebx, byte '?' ; check for '?' right after '*'
jz short .wc_all_matched ; if so, match without checking
cmp ebx, eax ; UCS-4 of pattern == UCS-4 of string?
jnz .match_wc_all ; if not, continue searching
;
.wc_all_matched: ;
mov edi, esi ; save UTF-8 string pointer
push esi ; register UTF-8 string ptr of last '*'
push edx ; register UTF-8 pattern ptr
push ebx ; register pattern UCS-4
jmp short .matching ; continue matching
;
; Single UCS-4 to UCS-4 match
.single_comp: ;----------------------------
mov edx, esi ; save pattern pointer
mov esi, edi ; load UTF-8 string pointer
call utf8.decode_ucs4.from_utf8 ; get UCS-4 of string to match
jc short .fail ; in case of an invalid UTF-8 string
mov edi, esi ; save string pointer
;
test eax, eax ; string UCS-4 == 0 ?
jz short .test_end_of_pattern ; if so, check if pattern is also ended
;
cmp ebx, byte '?' ; pattern is wildcard '?' ?
jz short .matching ; if so, automatically match
cmp ebx, eax ; make sure pattern UCS-4 match
jz short .matching ; if so, continue checking
;
; Wildcard Fallback
;------------------
cmp ebp, esp ; any '*' wildcard registered on stack?
jz short .fail ; if not, match failed
;
; get back to previous '*' found
pop ebx ; restore pattern UCS-4
pop edx ; restore UTF-8 pattern pointer
pop esi ; restore UTF-8 string pointer
jmp short .match_wc_all ; continue wildcard match
;
; Test End Of Pattern
.test_end_of_pattern: ;--------------------
test ebx, ebx ; is pattern UCS-4 == 0 ?
jnz short .fail ; if not, fail
;
; Success, make ECX = 1
.success: ;----------------------
inc byte [ebp + 24] ; increment ECX on stack
;
; Failure or Success: common ending
.fail: ;----------------------------------
mov esp, ebp ; restore original stack pointer
popad ; restore all registers
retn ; return result in ECX
;-----------------------------------------------------------------------------
|
src/ships-saveload.ads
|
thindil/steamsky
| 80 |
24859
|
-- Copyright 2017-2020 <NAME>
--
-- This file is part of Steam Sky.
--
-- Steam Sky is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- Steam Sky is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>.
with DOM.Core; use DOM.Core;
-- ****h* Ships/SSaveLoad
-- FUNCTION
-- Provides code to save and load player ship data to file
-- SOURCE
package Ships.SaveLoad is
-- ****
-- ****f* SSaveLoad/SSaveLoad.SavePlayerShip
-- FUNCTION
-- Save player ship to file
-- PAEAMETERS
-- SaveData - XML structure to which player ship data will be saved
-- MainNode - XML main node to which player ship data will be saved
-- SOURCE
procedure SavePlayerShip(SaveData: Document; MainNode: DOM.Core.Element);
-- ****
-- ****f* SSaveLoad/SSaveLoad.LoadPlayerShip
-- FUNCTION
-- Load saved player ship from file
-- PARAMETERS
-- SaveData - XML structure from which player ship data will be loaded
-- SOURCE
procedure LoadPlayerShip(SaveData: Document);
-- ****
end Ships.SaveLoad;
|
boot.asm
|
HUSKI3/Pyra-OS
| 0 |
242846
|
<filename>boot.asm
;boot.asm:the bootloader to boot are operating system with grub
[bits 32] ;we are in 32 bit
global start ;start's the operating system:we call it in the linker script
extern _kernel_main ;this is in are .cpp file and it is the main function of are kernel
section .mbHeader
ALIGN 4
; setting up the Multiboot header - see GRUB docs for details
MODULEALIGN equ 1<<0 ; align loaded modules on page boundaries
MEMINFO equ 1<<1 ; provide memory map
FLAGS equ MODULEALIGN | MEMINFO ; this is the Multiboot 'flag' field
MAGIC equ 0xe8520d6 ; 'magic number' lets bootloader find the header
CHECKSUM equ -(MAGIC + FLAGS) ; checksum required
section .text
ALIGN 4
MultiBootHeader:
dd MAGIC
dd FLAGS
dd CHECKSUM
;you can modify these
start:
push ebx ;this is optional and load's the grub structure
call _kernel_main
|
Library/Spell/ICS/icsManager.asm
|
steakknife/pcgeos
| 504 |
165916
|
<reponame>steakknife/pcgeos<filename>Library/Spell/ICS/icsManager.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
PROJECT: Spell Library
MODULE: ICS
FILE: icsManager.asm
AUTHOR: <NAME>, Aug 6, 1991
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 8/ 6/91 Initial revision
DESCRIPTION:
Just includes relevant stuff for the ICS asm code.
$Id: icsManager.asm,v 1.1 97/04/07 11:05:42 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
include geos.def
include geode.def
include library.def
include ec.def
include heap.def
include file.def
include sem.def
include system.def
include lmem.def
include initfile.def
;------------------------------------------------------------------------------
; FULL_EXECUTE_IN_PLACE : Indicates that the spell lib is going to
; be used in a system where all geodes (or most, at any rate)
; are to be executed out of ROM.
;------------------------------------------------------------------------------
ifndef FULL_EXECUTE_IN_PLACE
FULL_EXECUTE_IN_PLACE equ FALSE
endif
;------------------------------------------------------------------------------
; The .GP file only understands defined/not defined;
; it can not deal with expression evaluation.
; Thus, for the TRUE/FALSE conditionals, we define
; GP symbols that _only_ get defined when the
; condition is true.
;-----------------------------------------------------------------------------
if FULL_EXECUTE_IN_PLACE
GP_FULL_EXECUTE_IN_PLACE equ TRUE
endif
if FULL_EXECUTE_IN_PLACE
include Internal/xip.def
endif
include resource.def
include thread.def
include Objects/processC.def
UseLib ui.def
UseLib Objects/vTextC.def
include spellConstant.def ;includes product features
INIT segment
ifdef __BORLANDC__
global ICGEOSPLINIT:far
global ICGEOSPLINITICBUFF:far
ICGEOSplInit equ ICGEOSPLINIT
ICGEOSplInitICBuff equ ICGEOSPLINITICBUFF
else
global ICGEOSplInit:far
global ICGEOSplInitICBuff:far
endif
INIT ends
EXIT segment
ifdef __BORLANDC__
global ICGEOSPLEXITICBUFF:far
global ICGEOSPLEXIT:far
ICGEOSplExitICBuff equ ICGEOSPLEXITICBUFF
ICGEOSplExit equ ICGEOSPLEXIT
else
global ICGEOSplExitICBuff:far
global ICGEOSplExit:far
endif
EXIT ends
IPPRINT segment
ifdef __BORLANDC__
global UPDATEUSERDICTIONARY:far
global IPGEOBUILDUSERLIST:far
UpdateUserDictionary equ UPDATEUSERDICTIONARY
IPGEOBuildUserList equ IPGEOBUILDUSERLIST
else
global UpdateUserDictionary:far
global IPGEOBuildUserList:far
endif
IPPRINT ends
CODE segment
ifdef __BORLANDC__
global ICGEOSPL:far
global ICGEOGETALTERNATE:far
ICGEOSpl equ ICGEOSPL
ICGEOGetAlternate equ ICGEOGETALTERNATE
else
global ICGEOSpl:far
global ICGEOGetAlternate:far
endif
CODE ends
IPCODE segment
ifdef __BORLANDC__
global IPGEOUSR:far
global IPGEOADDUSER:far
global IPGEODELETEUSER:far
global ICGEOIGNORESTRING:far
global ICRESETIGNOREUSERDICT:far
IPGEOUsr equ IPGEOUSR
IPGEOAddUser equ IPGEOADDUSER
IPGEODeleteUser equ IPGEODELETEUSER
ICGEOIgnoreString equ ICGEOIGNORESTRING
ICResetIgnoreUserDict equ ICRESETIGNOREUSERDICT
else
global IPGEOUsr:far
global IPGEOAddUser:far
global IPGEODeleteUser:far
global ICGEOIgnoreString:far
global ICResetIgnoreUserDict:far
endif
IPCODE ends
ThesaurusCode segment resource
global ThesaurusOpen:far
global ThesaurusClose:far
ThesaurusCode ends
DefLib Internal/spelllib.def
include Internal/icbuff.def
include icsConstant.def
include icsVariable.def
include spell.asm
include spellC.asm
include spellStrings.asm
include geos_asmcalls.asm
include geos_opts.asm
include icsThread.asm
|
src/game/bird.asm
|
icebreaker/floppybird
| 354 |
166270
|
reset_bird:
mov word [bird_pos+0], 60
mov word [bird_pos+2], 60
ret
center_bird:
mov word [bird_pos+0], 144
mov word [bird_pos+2], 60
ret
update_bird:
mov ax, word [bird_pos + 2] ; sy
cmp ax, 0 ; top
jle .collide ; reached sky?
add ax, word [bird_pos + 6] ; sh
cmp ax, 156 ; bottom (ground)
jg .collide ; reached ground?
call kbhit
test al, al ; no key was ...
jz .fall ; pressed then just fall ...
call animate_bird ; animate bird
.move:
sub word [bird_pos + 2], 6 ; move 4 pixels up on the Y axis
clc
ret
.fall:
add word [bird_pos + 2], 2 ; move 2 pixels down on the Y axis
clc
ret
.collide:
stc
ret
animate_bird:
add word [bird_frm], 32 ; advance fly animation by one frame
cmp word [bird_frm], 64 ; did we reach the last frame yet?
jle .end ; if not, then we can jump right away
mov word [bird_frm], 0 ; reset animation to the first frame
.end:
ret
draw_bird:
push bird
push 96 ; pw
push 24 ; ph
push word [bird_frm] ; sx
push 0 ; sy
push word [bird_pos + 4] ; sw
push word [bird_pos + 6] ; sh
push word [bird_pos + 0] ; dx
push word [bird_pos + 2] ; dy
push 0 ; transparent color
push word [bird_tint] ; tint
call blit_fast
ret
randomize_birdcolor:
call random
add ax, ax
mov word [bird_tint], ax
ret
bird_pos: dw 60, 60, 32, 24 ; x, y, w, h
bird_frm: dw 0 ; current animation frame (X in pixels)
bird_tint: dw 0 ; crazy tint :P
|
libsrc/stdio/vg5k/set_character.asm
|
jpoikela/z88dk
| 38 |
23563
|
MODULE set_character
SECTION code_clib
PUBLIC set_character
PUBLIC set_character8
; Redefine a VG5k character using an 8 high font
;
; Entry: hl = 8 bytes to define
; c = character to redefine
set_character8:
ex de,hl
ld hl,-10
add hl,sp
ld sp,hl
push hl
ld (hl),0
inc hl
ld b,8
loop:
ld a,(de)
ld (hl),a
inc de
inc hl
djnz loop
ld (hl),0
pop hl
call set_character
ld hl,10
add hl,sp
ld sp,hl
ret
; Set a 10 line character
set_character:
push iy
ld iy,0x47fa
ld a,c
call $001b
pop iy
ret
|
HW1/a.asm
|
yuya737/tiny_vm
| 0 |
9600
|
.class Sample:Obj
.method $constructor
const 3
const 4
call Int:plus
|
src/gen-artifacts-distribs-concat.ads
|
My-Colaborations/dynamo
| 15 |
19656
|
-----------------------------------------------------------------------
-- gen-artifacts-distribs-concat -- Concatenate based distribution artifact
-- Copyright (C) 2012 <NAME>
-- Written by <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.
-----------------------------------------------------------------------
-- The <b>Gen.Artifacts.Distribs.Concat</b> package provides distribution rules
-- to concatenate a list of files to the distribution area. The rule is
-- created by using the following XML definition:
--
-- <install mode='copy' file='NOTICE.txt'>
-- <include name="NOTICE.txt"/>
-- </install>
--
private package Gen.Artifacts.Distribs.Concat is
-- Create a distribution rule to concatenate a set of files.
function Create_Rule (Node : in DOM.Core.Node) return Distrib_Rule_Access;
-- ------------------------------
-- Distribution artifact
-- ------------------------------
type Concat_Rule is new Distrib_Rule with private;
type Concat_Rule_Access is access all Concat_Rule'Class;
-- Get a name to qualify the installation rule (used for logs).
overriding
function Get_Install_Name (Rule : in Concat_Rule) return String;
-- Install the file <b>File</b> according to the distribution rule.
-- Concatenate the files listed in <b>Files</b> in the target path specified by <b>Path</b>.
overriding
procedure Install (Rule : in Concat_Rule;
Path : in String;
Files : in File_Vector;
Context : in out Generator'Class);
private
type Concat_Rule is new Distrib_Rule with null record;
end Gen.Artifacts.Distribs.Concat;
|
calc.asm
|
AppLoidx/calc.asm
| 0 |
86105
|
;author - http://github.com/flouthoc
;Contributors - Add your name here
;; ----------------- calc.asm - Minimal arithmetic calculator in x86 assembly -------------------
section .data
FEW_ARGS: db "Too Few Arguments", 0xA
INVALID_OPERATOR: db "Invalid Operator", 0xA
INVALID_OPERAND: db "Invalid Operand", 0XA
BYTE_BUFFER: times 10 db 0 ;It's just a memory to size 10 , each slot holds the value 0
section .text
global _start
_start:
pop rdx ;put argc in rdx from the stack, so we can check number of arguments
cmp rdx, 4 ;compare the number of arguments against 4
jne few_args ; if number of arguments is less than 4 (i.e. [program-name] <operator> <operand1> <operand2>) go to error block - prompt 'FEW_ARGS' and exit
add rsp, 8 ; skip over argv[0], the programme name - rsp is now pointing at argv[1] (4 bytes + 4 bytes = 8)
pop rsi ;let's pop our first argument (i.e argv[1]) from argument stack which is our operand
;This is part is all checking part which switches the block according to our <operand> + - / *
cmp byte[rsi], 0x2A ;If operator is '*' then goto block multiplication , can be used only if escaped manually while giving input
je multiplication
cmp byte[rsi], 0x78 ;If operator is 'x' then goto block multiplication , cause you know some shells or every have '*' as wildcard
je multiplication
cmp byte[rsi], 0x2B ;If operator is '+' then goto block addition
je addition
cmp byte[rsi], 0x2D ;If operator is '-' then goto block subtraction
je subtraction
cmp byte[rsi], 0x2F ;If operator is '/' then goto block division
je division
cmp byte[rsi], 0x25 ;If operator is '%' then goto block modulo
je modulo
;If <operator> does not match to any case then goto block invalid_operator
jmp invalid_operator ; go to error block - prompt 'Invalid Operator' and exit
addition:
pop rsi ;Let's Pop our second argument (i.e argv[2]) from argument stack which is our <operand1>
;Well even if it is a number it is in its ASCII code representation lets convert it to our actual integer
;This is function will take number in its ASCII form (rsi as argument) and return its integer equivalent in rax
call char_to_int
mov r10, rax ;Lets store integer equivalent of <operand1> in r10
pop rsi ;Let's Pop our third argument (i.e argv[3]) from argument stack which is our <operand2>
call char_to_int ;Do same for <operand2>
add rax, r10 ;Let's add them integer equivalent of <operand1> and integer equivalent of <operand2>
jmp print_result ;Throw cursor at block print cursor, which will print the result
;Same thing we are doing in block subtraction , multiplication and division
subtraction:
pop rsi
call char_to_int
mov r10, rax
pop rsi
call char_to_int
sub r10, rax
mov rax, r10
jmp print_result
multiplication:
pop rsi
call char_to_int
mov r10, rax
pop rsi
call char_to_int
mul r10
jmp print_result
division:
pop rsi
call char_to_int
mov r10, rax
pop rsi
call char_to_int
mov r11, rax
mov rax, r10
mov rdx, 0
div r11 ;Divide the value in rax (implied by 'div') by r11
jmp print_result
modulo:
pop rsi
call char_to_int
mov r10, rax
pop rsi
call char_to_int
mov r11, rax
mov rax, r10
mov rdx, 0
div r11
mov rax, rdx ;Move the remainder into rax
jmp print_result
;This block is responsible for printing the content to the screen
;you have to store your content in rax and jump to it , it'll do the rest :)
print_result:
;This function will convert our integer in rax back to ASCII format (character)
; Argument - takes integer to be converted (must be stored in rax)
; Returns pointer to the char string (returns r9 as pointer to the string or char)
call int_to_char
mov rax, 1 ;Store syscall number , 1 is for sys_write
mov rdi, 1 ;Descriptor where we want to write , 1 is for stdout
mov rsi, r9 ;This is pointer to the string which was returned by int_to_char
mov rdx, r11 ;r11 stores the number of chars in our string , read about how to make syscall in asm
syscall ;interrupt , give the wheel to OS it'll handle your systemcall
jmp exit
;Read previous comments, just performing printing in these blocks
;As per convention error messages are printed to stderr(2)
few_args:
mov rdi, FEW_ARGS
call print_error
invalid_operator:
mov rdi, INVALID_OPERATOR
call print_error
invalid_operand:
mov rdi, INVALID_OPERAND
call print_error
print_error:
push rdi
call strlen ;calculate the length of rdi (error message)
mov rdi, 2 ;write to stderr
pop rsi
mov rdx, rax ;result of strlen
mov rax, 1 ;write syscall
syscall
call error_exit
ret
strlen:
xor rax, rax ;store zero in rax
.strlen_loop:
cmp BYTE [rdi + rax], 0xA ;compare byte to a newline
je .strlen_break ;break if the current byte is a newline
inc rax
jmp .strlen_loop ;repeat if the current byte isn't a newline
.strlen_break:
inc rax ;add one to string length to count the newline
ret
;This is the function which will convert our character input to integers
;Argument - pointer to string or char ( takes rsi as argument )
;Returns equivalent integer value (in rax)
char_to_int:
xor ax, ax ;store zero in ax
xor cx, cx ;same
mov bx, 10 ; store 10 in bx - the input string is in base 10, so each place value increases by a factor of 10
.loop_block:
;REMEMBER rsi is base address to the string which we want to convert to integer equivalent
mov cl, [rsi] ;Store value at address (rsi + 0) or (rsi + index) in cl, rsi is incremented below so dont worry about where is index.
cmp cl, byte 0 ;If value at address (rsi + index ) is byte 0 (NULL) , means our string is terminated here
je .return_block
;Each digit must be between 0 (ASCII code 48) and 9 (ASCII code 57)
cmp cl, 0x30 ;If value is lesser than 0 goto invalid operand
jl invalid_operand
cmp cl, 0x39 ;If value is greater than 9 goto invalid operand
jg invalid_operand
sub cl, 48 ;Convert ASCII to integer by subtracting 48 - '0' is ASCII code 48, so subtracting 48 gives us the integer value
;Multiply the value in 'ax' (implied by 'mul') by bx (always 10). This can be thought of as shifting the current value
;to the left by one place (e.g. '123' -> '1230'), which 'makes room' for the current digit to be added onto the end.
;The result is stored in dx:ax.
mul bx
;Add the current digit, stored in cl, to the current intermediate number.
;The resulting sum will be mulitiplied by 10 during the next iteration of the loop, with a new digit being added onto it
add ax, cx
inc rsi ;Increment the rsi's index i.e (rdi + index ) we are incrementing the index
jmp .loop_block ;Keep looping until loop breaks on its own
.return_block:
ret
;This is the function which will convert our integers back to characters
;Argument - Integer Value in rax
;Returns pointer to equivalent string (in r9)
int_to_char:
mov rbx, 10
;We have declared a memory which we will use as buffer to store our result
mov r9, BYTE_BUFFER+10 ;We are are storing the number in backward order like LSB in 10 index and decrementing index as we move to MSB
mov [r9], byte 0 ;Store NULL terminating byte in last slot
dec r9 ;Decrement memory index
mov [r9], byte 0XA ;Store break line
dec r9 ;Decrement memory index
mov r11, 2;r11 will store the size of our string stored in buffer we will use it while printing as argument to sys_write
.loop_block:
mov rdx, 0
div rbx ;Get the LSB by dividing number by 10 , LSB will be remainder (stored in 'dl') like 23 divider 10 will give us 3 as remainder which is LSB here
cmp rax, 0 ;If rax (quotient) becomes 0 our procedure reached to the MSB of the number we should leave now
je .return_block
add dl, 48 ;Convert each digit to its ASCII value
mov [r9], dl ;Store the ASCII value in memory by using r9 as index
dec r9 ;Dont forget to decrement r9 remember we are using memory backwards
inc r11 ;Increment size as soon as you add a digit in memory
jmp .loop_block ;Loop until it breaks on its own
.return_block:
add dl, 48 ;Don't forget to repeat the routine for out last MSB as loop ended early
mov [r9], dl
dec r9
inc r11
ret
;Syscall 60 is exit. Return code normally is 0, on errors set it to 1
error_exit:
mov rax, 60
mov rdi, 1
syscall
exit:
mov rax, 60
mov rdi, 0
syscall
;We are all done :) If you think you can improve this more make a pull request (http://github.com/flouthoc/calc.asm)
|
stm32f0/stm32f072x/svd/stm32_svd-comp.ads
|
ekoeppen/STM32_Generic_Ada_Drivers
| 1 |
19451
|
<gh_stars>1-10
-- This spec has been automatically generated from STM32F072x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.COMP is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CSR_COMP1EN_Field is STM32_SVD.Bit;
subtype CSR_COMP1_INP_DAC_Field is STM32_SVD.Bit;
subtype CSR_COMP1MODE_Field is STM32_SVD.UInt2;
subtype CSR_COMP1INSEL_Field is STM32_SVD.UInt3;
subtype CSR_COMP1OUTSEL_Field is STM32_SVD.UInt3;
subtype CSR_COMP1POL_Field is STM32_SVD.Bit;
subtype CSR_COMP1HYST_Field is STM32_SVD.UInt2;
subtype CSR_COMP1OUT_Field is STM32_SVD.Bit;
subtype CSR_COMP1LOCK_Field is STM32_SVD.Bit;
subtype CSR_COMP2EN_Field is STM32_SVD.Bit;
subtype CSR_COMP2MODE_Field is STM32_SVD.UInt2;
subtype CSR_COMP2INSEL_Field is STM32_SVD.UInt3;
subtype CSR_WNDWEN_Field is STM32_SVD.Bit;
subtype CSR_COMP2OUTSEL_Field is STM32_SVD.UInt3;
subtype CSR_COMP2POL_Field is STM32_SVD.Bit;
subtype CSR_COMP2HYST_Field is STM32_SVD.UInt2;
subtype CSR_COMP2OUT_Field is STM32_SVD.Bit;
subtype CSR_COMP2LOCK_Field is STM32_SVD.Bit;
-- control and status register
type CSR_Register is record
-- Comparator 1 enable
COMP1EN : CSR_COMP1EN_Field := 16#0#;
-- COMP1_INP_DAC
COMP1_INP_DAC : CSR_COMP1_INP_DAC_Field := 16#0#;
-- Comparator 1 mode
COMP1MODE : CSR_COMP1MODE_Field := 16#0#;
-- Comparator 1 inverting input selection
COMP1INSEL : CSR_COMP1INSEL_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- Comparator 1 output selection
COMP1OUTSEL : CSR_COMP1OUTSEL_Field := 16#0#;
-- Comparator 1 output polarity
COMP1POL : CSR_COMP1POL_Field := 16#0#;
-- Comparator 1 hysteresis
COMP1HYST : CSR_COMP1HYST_Field := 16#0#;
-- Read-only. Comparator 1 output
COMP1OUT : CSR_COMP1OUT_Field := 16#0#;
-- Comparator 1 lock
COMP1LOCK : CSR_COMP1LOCK_Field := 16#0#;
-- Comparator 2 enable
COMP2EN : CSR_COMP2EN_Field := 16#0#;
-- unspecified
Reserved_17_17 : STM32_SVD.Bit := 16#0#;
-- Comparator 2 mode
COMP2MODE : CSR_COMP2MODE_Field := 16#0#;
-- Comparator 2 inverting input selection
COMP2INSEL : CSR_COMP2INSEL_Field := 16#0#;
-- Window mode enable
WNDWEN : CSR_WNDWEN_Field := 16#0#;
-- Comparator 2 output selection
COMP2OUTSEL : CSR_COMP2OUTSEL_Field := 16#0#;
-- Comparator 2 output polarity
COMP2POL : CSR_COMP2POL_Field := 16#0#;
-- Comparator 2 hysteresis
COMP2HYST : CSR_COMP2HYST_Field := 16#0#;
-- Read-only. Comparator 2 output
COMP2OUT : CSR_COMP2OUT_Field := 16#0#;
-- Comparator 2 lock
COMP2LOCK : CSR_COMP2LOCK_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CSR_Register use record
COMP1EN at 0 range 0 .. 0;
COMP1_INP_DAC at 0 range 1 .. 1;
COMP1MODE at 0 range 2 .. 3;
COMP1INSEL at 0 range 4 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
COMP1OUTSEL at 0 range 8 .. 10;
COMP1POL at 0 range 11 .. 11;
COMP1HYST at 0 range 12 .. 13;
COMP1OUT at 0 range 14 .. 14;
COMP1LOCK at 0 range 15 .. 15;
COMP2EN at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
COMP2MODE at 0 range 18 .. 19;
COMP2INSEL at 0 range 20 .. 22;
WNDWEN at 0 range 23 .. 23;
COMP2OUTSEL at 0 range 24 .. 26;
COMP2POL at 0 range 27 .. 27;
COMP2HYST at 0 range 28 .. 29;
COMP2OUT at 0 range 30 .. 30;
COMP2LOCK at 0 range 31 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Comparator
type COMP_Peripheral is record
-- control and status register
CSR : aliased CSR_Register;
end record
with Volatile;
for COMP_Peripheral use record
CSR at 0 range 0 .. 31;
end record;
-- Comparator
COMP_Periph : aliased COMP_Peripheral
with Import, Address => System'To_Address (16#4001001C#);
end STM32_SVD.COMP;
|
programs/oeis/063/A063158.asm
|
neoneye/loda
| 22 |
27449
|
; A063158: Dimension of the space of weight 2n cusp forms for Gamma_0( 90 ).
; 11,46,82,118,154,190,226,262,298,334,370,406,442,478,514,550,586,622,658,694,730,766,802,838,874,910,946,982,1018,1054,1090,1126,1162,1198,1234,1270,1306,1342,1378,1414,1450,1486,1522,1558,1594,1630,1666,1702
mul $0,36
trn $0,1
add $0,11
|
src/static/antlr4/grammars/Statements.g4
|
jlenoble/ecmascript-parser
| 0 |
3677
|
<filename>src/static/antlr4/grammars/Statements.g4<gh_stars>0
/* Source: ECMAScript® 2018 Language Specification - Annex A-3 */
// A.3 Statements
grammar Statements;
import
BindingElement,
BindingPattern,
LexicalDeclaration,
Declaration,
TryStatement,
WithStatement,
LabelledStatement,
SwitchStatement,
IterationStatement,
IfStatement,
BreakableStatement,
BlockStatement,
VariableStatement;
// Statement[Yield, Await, Return]:
// BlockStatement[?Yield, ?Await, ?Return]
// VariableStatement[?Yield, ?Await]
// EmptyStatement
// ExpressionStatement[?Yield, ?Await]
// IfStatement[?Yield, ?Await, ?Return]
// BreakableStatement[?Yield, ?Await, ?Return]
// ContinueStatement[?Yield, ?Await]
// BreakStatement[?Yield, ?Await]
// [+Return] ReturnStatement[?Yield, ?Await]
// WithStatement[?Yield, ?Await, ?Return]
// LabelledStatement[?Yield, ?Await, ?Return]
// ThrowStatement[?Yield, ?Await]
// TryStatement[?Yield, ?Await, ?Return]
// DebuggerStatement
statement
: blockStatement
| variableStatement
| emptyStatement
| expressionStatement
| ifStatement
| breakableStatement
| continueStatement
| breakStatement
| {this.canReturn()}? returnStatement
| withStatement
| labelledStatement
| throwStatement
| tryStatement
| debuggerStatement
;
// StatementList[Yield, Await, Return]:
// StatementListItem[?Yield, ?Await, ?Return]
// StatementList[?Yield, ?Await, ?Return] StatementListItem[?Yield, ?Await, ?Return]
statementList
: statementListItem+
;
// StatementListItem[Yield, Await, Return]:
// Statement[?Yield, ?Await, ?Return]
// Declaration[?Yield, ?Await]
statementListItem
: declaration
| statement
;
// EmptyStatement:
// ;
emptyStatement
: SemiColon
;
// ReturnStatement[Yield, Await]:
// return ;
// return [no LineTerminator here] Expression[+In, ?Yield, ?Await] ;
returnStatement
: Return ({this.noLineTerminatorHere()}? expressionList)? eos
;
// DebuggerStatement:
// debugger ;
debuggerStatement
: Debugger eos
;
// ExpressionStatement[Yield, Await]:
// [lookahead ∉ { {, function, async [no LineTerminator here] function,
// class, let [ }] Expression[+In, ?Yield, ?Await] ;
expressionStatement
: {this.isValidExpressionStatement()}? expressionList eos
;
|
src/ada/src/afrl-impact-impactpointsearchtask-spark_boundary.ads
|
pat-rogers/OpenUxAS
| 0 |
5078
|
package afrl.impact.ImpactPointSearchTask.SPARK_Boundary with SPARK_Mode is
pragma Annotate (GNATprove, Terminating, SPARK_Boundary);
-- This wrapper is only introduced for termination
function Get_SearchLocationID (X : ImpactPointSearchTask) return Int64;
end afrl.impact.ImpactPointSearchTask.SPARK_Boundary;
|
programs/oeis/164/A164438.asm
|
jmorken/loda
| 1 |
26419
|
; A164438: Number of binary strings of length n with no substrings equal to 0000 0110 or 0111
; 13,21,32,49,73,109,161,238,350,515,756,1110,1628,2388,3501,5133,7524,11029,16165,23693,34725,50894,74590,109319,160216,234810,344132,504352,739165,1083301,1587656,2326825,3410129,4997789,7324617,10734750,15732542,23057163,33791916,49524462,72581628,106373548,155898013,228479645,334853196,490751213,719230861,1054084061,1544835277,2264066142,3318150206,4862985487,7127051632,10445201842,15308187332,22435238968,32880440813,48188628149,70623867120,103504307937,151692936089,222316803213,325821111153,477514047246,699830850462,1025651961619,1503166008868,2202996859334,3228648820956,4731814829828,6934811689165,10163460510125,14895275339956,21830087029125,31993547539253,46888822879213,68718909908341,100712457447598,147601280326814,216320190235159,317032647682760,464633928009578,680954118244740,997986765927504,1462620693937085,2143574812181829,3141561578109336,4604182272046425,6747757084228257
sub $2,$0
add $0,2
add $2,$0
add $0,2
mul $2,2
add $2,2
add $0,$2
add $0,1
cal $0,306276 ; a(0) = a(1) = a(2) = a(3) = 1; thereafter a(n) = a(n-2) + a(n-3) + a(n-4).
mov $1,$0
sub $1,33
div $1,2
add $1,13
|
src/main/antlr/YokohamaUnitLexer.g4
|
tkob/yokohamaunit
| 1 |
6764
|
<filename>src/main/antlr/YokohamaUnitLexer.g4
lexer grammar YokohamaUnitLexer;
STAR_LBRACKET: '*[' [ \t]* -> mode(ABBREVIATION);
HASHES: Hashes [ \t]* -> mode(UNTIL_EOL) ;
TEST: Hashes [ \t]* 'Test:' [ \t]* -> mode(UNTIL_EOL);
SETUP: Hashes [ \t]* 'Setup:' [ \t]* -> mode(UNTIL_EOL);
EXERCISE: Hashes [ \t]* 'Exercise:' [ \t]* -> mode(UNTIL_EOL);
VERIFY: Hashes [ \t]* 'Verify:' [ \t]* -> mode(UNTIL_EOL);
TEARDOWN: Hashes [ \t]* 'Teardown:' [ \t]* -> mode(UNTIL_EOL);
SETUP_NO_DESC: Hashes [ \t]* 'Setup' -> type(SETUP) ;
EXERCISE_NO_DESC: Hashes [ \t]* 'Exercise' -> type(EXERCISE) ;
VERIFY_NO_DESC: Hashes [ \t]* 'Verify' -> type(VERIFY) ;
TEARDOWN_NO_DESC: Hashes [ \t]* 'Teardown' -> type(TEARDOWN) ;
LBRACKET_DEFAULT_MODE: '[' -> type(LBRACKET), mode(ANCHOR);
AS_BACK_TICK: 'as' SpacesOrComments? '`' -> mode(CLASS) ;
BAR: '|' ;
BAR_EOL: '|' [ \t]* '\r'? '\n' ;
HBAR: '|' [|\-=\:\.\+ \t]* '|' [ \t]* '\r'? '\n' ;
ASSERT: 'Assert' ;
THAT: 'that' ;
STOP: '.' ;
AND: 'and' ;
IS: 'is' ;
NOT: 'not' ;
THROWS: 'throws' ;
FOR: 'for' ;
ALL: 'all' ;
COMMA: ',' ;
IN: 'in' ;
UTABLE: 'Table' ;
CSV_SINGLE_QUOTE: 'CSV' SpacesOrComments? '\'' -> mode(IN_FILE_NAME) ;
TSV_SINGLE_QUOTE: 'TSV' SpacesOrComments? '\''-> mode(IN_FILE_NAME) ;
EXCEL_SINGLE_QUOTE: 'Excel' SpacesOrComments? '\'' -> mode(IN_BOOK_NAME) ;
WHERE: 'where' ;
EQ: '=' ;
LET: 'Let' ;
BE: 'be' ;
ANY_OF: 'any' SpacesOrComments 'of' ;
ANY_DEFINED_BY: 'any' SpacesOrComments ('value' 's'? SpacesOrComments)? 'defined' SpacesOrComments 'by' ;
OR: 'or' ;
DO: 'Do' ;
A_STUB_OF_BACK_TICK: 'a' SpacesOrComments 'stub' SpacesOrComments 'of' SpacesOrComments? '`' -> mode(CLASS) ;
SUCH: 'such' ;
METHOD_BACK_TICK: 'method' SpacesOrComments? '`' -> mode(METHOD_PATTERN) ;
RETURNS: 'returns' ;
AN_INSTANCE_OF_BACK_TICK: 'an' SpacesOrComments 'instance' Spaces 'of' SpacesOrComments? '`' -> mode(CLASS) ;
AN_INSTANCE: 'an' SpacesOrComments 'instance' -> mode(AFTER_AN_INSTANCE) ;
AN_INVOCATION_OF_BACK_TICK: 'an' SpacesOrComments 'invocation' SpacesOrComments 'of' SpacesOrComments? '`' -> mode(METHOD_PATTERN) ;
ON: 'on' ;
WITH: 'with' ;
INVOKE_TICK: 'Invoke' SpacesOrComments? '`' -> mode (METHOD_PATTERN) ;
MATCHES: 'matches' ;
DOES: 'does' ;
MATCH: 'match' ;
RE_TICK: 're' SpacesOrComments? '`' -> mode(REGEXP) ;
RE_TICK2: 're' SpacesOrComments? '``' -> type(RE_TICK), mode(REGEXP2) ;
REGEX_TICK: 'regex' SpacesOrComments? '`' -> mode(REGEXP) ;
REGEX_TICK2: 'regex' SpacesOrComments? '``' -> type(RE_TICK), mode(REGEXP2) ;
REGEXP_TICK: 'regexp' SpacesOrComments? '`' -> mode(REGEXP) ;
REGEXP_TICK2: 'regexp' SpacesOrComments? '``' -> type(RE_TICK), mode(REGEXP2) ;
RESOURCE: 'resource' ;
A_TEMPORARY_FILE: 'a' SpacesOrComments 'temporary' SpacesOrComments 'file' ;
A_TEMP_FILE: 'a' SpacesOrComments 'temp' SpacesOrComments 'file' ;
NULL: 'null' ;
NOTHING: 'nothing' ;
TRUE: 'true' ;
FALSE: 'false' ;
Identifier: IdentStart IdentPart* ;
Integer: IntegerLiteral ;
FloatingPoint: FloatingPointLiteral ;
MINUS: '-' ;
EMPTY_STRING: '""' ;
BACK_TICK: '`' -> mode(IN_BACK_TICK) ;
DOUBLE_QUOTE: '"' -> mode(IN_DOUBLE_QUOTE) ;
SINGLE_QUOTE: '\'' -> mode(IN_SINGLE_QUOTE) ;
BACK_TICKS: '```' -> mode(IN_FENCE_3) ;
BACK_TICKS4: '````' -> mode(IN_FENCE_4), type(BACK_TICKS) ;
BACK_TICKS5: '`````' -> mode(IN_FENCE_5), type(BACK_TICKS) ;
COMMENT : '{>>' .*? '<<}' -> skip ;
WS : Spaces -> skip ;
mode ABBREVIATION;
ShortName: ~[\]\r\n]+ ;
RBRACKET_COLON: ']:' [ \t]* -> mode(UNTIL_EOL) ;
mode UNTIL_EOL;
Line: ~[ \t\r\n]+ ([ \t]+ ~[ \t\r\n]+)* ; //exclude trailing spaces
NEW_LINE: [ \t]* ('\r'? '\n')+ -> skip, mode(DEFAULT_MODE) ;
mode ANCHOR;
Anchor: ~[\]\r\n]+ ;
RBRACKET_ANCHOR: ']' -> type(RBRACKET), mode(DEFAULT_MODE) ;
mode AFTER_AN_INSTANCE;
OF: 'of' ;
Identifier_AFTER_AN_INSTANCE : IdentStart IdentPart* -> type(Identifier) ;
BACK_TICK_AFTER_AN_INSTANCE: '`' -> type(BACK_TICK), mode(CLASS) ;
COMMENT_AFTER_AN_INSTANCE : '{>>' .*? '<<}' -> skip ;
WS_AFTER_AN_INSTANCE: Spaces -> skip ;
mode IN_DOUBLE_QUOTE;
Str: (~["\\\r\n] | UnicodeEscape | EscapeSequence)+ ;
CLOSE_DOUBLE_QUOTE: '"' -> type(DOUBLE_QUOTE), mode(DEFAULT_MODE) ;
mode IN_SINGLE_QUOTE;
Char: (~['\\\r\n] | UnicodeEscape | EscapeSequence)+ ;
CLOSE_SINGLE_QUOTE: '\'' -> type(SINGLE_QUOTE), mode(DEFAULT_MODE) ;
mode IN_BACK_TICK;
Expr: ~[`]+ ;
CLOSE_BACK_TICK: '`' -> type(BACK_TICK), mode(DEFAULT_MODE) ;
mode IN_FENCE_3;
CLOSE_BACK_TICKS_3: '```' [ \t]* ('\r'? '\n' | EOF) -> type(BACK_TICKS), mode(DEFAULT_MODE) ;
CodeLine: ~[\r\n]* '\r'? '\n' ;
mode IN_FENCE_4;
CLOSE_BACK_TICKS_4: '````' [ \t]* ('\r'? '\n' | EOF) -> type(BACK_TICKS), mode(DEFAULT_MODE) ;
CodeLine4: ~[\r\n]* '\r'? '\n' -> type(CodeLine) ;
mode IN_FENCE_5;
CLOSE_BACK_TICKS_5: '`````' [ \t]* ('\r'? '\n' | EOF) -> type(BACK_TICKS), mode(DEFAULT_MODE) ;
CodeLine5: ~[\r\n]* '\r'? '\n' -> type(CodeLine) ;
mode METHOD_PATTERN;
BOOLEAN: 'boolean' ;
BYTE: 'byte' ;
SHORT: 'short' ;
INT: 'int' ;
LONG: 'long' ;
CHAR: 'char' ;
FLOAT: 'float' ;
DOUBLE: 'double' ;
COMMA_METHOD_PATTERN: ',' -> type(COMMA);
THREEDOTS: '...' ;
DOT: '.' ;
LPAREN: '(' ;
RPAREN: ')' ;
LBRACKET: '[' ;
RBRACKET: ']' ;
HASH: '#' ;
Identifier_METHOD_PATTERN : IdentStart IdentPart* -> type(Identifier);
WS_METHOD_PATTERN: Spaces -> skip ;
BACK_TICK_METHOD_PATTERN: '`' -> type(BACK_TICK), mode(DEFAULT_MODE) ;
mode CLASS;
DOT_CLASS: '.' -> type(DOT) ;
Identifier_CLASS : IdentStart IdentPart* -> type(Identifier) ;
WS_CLASS: Spaces -> skip ;
BACK_TICK_CLASS: '`' -> type(BACK_TICK), mode(DEFAULT_MODE) ;
mode IN_FILE_NAME;
FileName: (~['\r\n]|'\'\'')+ ;
CLOSE_SINGLE_QUOTE_IN_FILE_NAME: '\'' -> type(SINGLE_QUOTE), mode(DEFAULT_MODE) ;
mode IN_BOOK_NAME;
BookName: (~['\r\n]|'\'\'')+ ;
CLOSE_SINGLE_QUOTE_IN_BOOK_NAME: '\'' -> type(SINGLE_QUOTE), mode(DEFAULT_MODE) ;
mode REGEXP;
Regexp: (~[`])+ ;
BACK_TICK_REGEXP: '`' -> type(BACK_TICK), mode(DEFAULT_MODE) ;
mode REGEXP2;
Regexp2: (~[`] | '`' ~[`])+ -> type(Regexp) ;
BACK_TICK_REGEXP2: '``' -> type(BACK_TICK), mode(DEFAULT_MODE) ;
fragment
Hashes: '#' | '##' | '###' | '####' | '#####' | '######' ;
fragment
Spaces: [ \t\r\n]+ ;
fragment
SpacesOrComments: ([ \t\r\n] | ('{>>' .*? '<<}') )+ ;
fragment
IdentStart: ~[\uD800-\uDBFF]
{Character.isJavaIdentifierStart(_input.LA(-1))}?
| [\uD800-\uDBFF] [\uDC00-\uDFFF]
{Character.isJavaIdentifierStart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}?
;
fragment
IdentPart: ~[\uD800-\uDBFF]
{Character.isJavaIdentifierPart(_input.LA(-1))}?
| [\uD800-\uDBFF] [\uDC00-\uDFFF]
{Character.isJavaIdentifierPart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}?
;
fragment
IntegerLiteral: DecimalIntegerLiteral
| HexIntegerLiteral
| OctalIntegerLiteral
| BinaryIntegerLiteral
;
fragment
DecimalIntegerLiteral: DecimalNumeral IntegerTypeSuffix? ;
fragment
HexIntegerLiteral: HexNumeral IntegerTypeSuffix? ;
fragment
OctalIntegerLiteral: OctalNumeral IntegerTypeSuffix? ;
fragment
BinaryIntegerLiteral: BinaryNumeral IntegerTypeSuffix? ;
fragment
IntegerTypeSuffix: [lL] ;
fragment
DecimalNumeral: '0' | [1-9] ([_0-9]* [0-9])? ;
fragment
HexNumeral: '0' [xX] HexDigits ;
fragment
HexDigits: [0-9a-fA-F] ([_0-9a-fA-F]* [0-9a-fA-F])? ;
fragment
OctalNumeral: '0' [_0-7]* [0-7] ;
fragment
BinaryNumeral: '0' [bB] [01] ([_01]* [01])? ;
fragment
FloatingPointLiteral: DecimalFloatingPointLiteral
| HexadecimalFloatingPointLiteral
;
fragment
DecimalFloatingPointLiteral: Digits '.' Digits ExponentPart? FloatTypeSuffix?
| Digits '.' ExponentPart FloatTypeSuffix?
| Digits '.' ExponentPart? FloatTypeSuffix
/* the above rules differ from the Java spec:
fp literals which end with dot are not allowd */
| '.' Digits ExponentPart? FloatTypeSuffix?
| Digits ExponentPart FloatTypeSuffix?
| Digits ExponentPart? FloatTypeSuffix
;
fragment
Digits: [0-9] ([_0-9]* [0-9])? ;
fragment
ExponentPart: [eE] SignedInteger ;
fragment
SignedInteger: ('+' | '-')? Digits ;
fragment
FloatTypeSuffix: [fFdD] ;
fragment
HexadecimalFloatingPointLiteral: HexSignificand BinaryExponent FloatTypeSuffix? ;
fragment
HexSignificand: HexNumeral '.'?
| '0' [xX] HexDigits? . HexDigits
;
fragment
BinaryExponent: [pP] SignedInteger ;
fragment
UnicodeEscape: '\\' 'u'+ [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] ;
fragment
EscapeSequence: '\\b' // (backspace BS, Unicode \u0008)
| '\\t' // (horizontal tab HT, Unicode \u0009)
| '\\n' // (linefeed LF, Unicode \u000a)
| '\\f' // (form feed FF, Unicode \u000c)
| '\\r' // (carriage return CR, Unicode \u000d)
| '\\"' // (double quote ", Unicode \u0022)
| '\\\'' // (single quote ', Unicode \u0027)
| '\\\\' // (backslash \, Unicode \u005c)
| OctalEscape // (octal value, Unicode \u0000 to \u00ff)
;
fragment
OctalEscape: '\\' [0-7]
| '\\' [0-7] [0-7]
| '\\' [0-3] [0-7] [0-7]
;
|
calculator.g4
|
ashleyf1996/Calculator_grammar_code_2017
| 0 |
3052
|
/* Assignment 1: Grammar for a calculator
Class: Programming languages
Author: <NAME>
Student ID: 2015118779
Date: 16/09/17
*/
grammar calculator;
start : declaration* assign*;
declaration : 'var' ID (',' ID)* ':' TYPE ';';
assign: ID '=' expr ';' ;
expr : term (('-'| '+') term)*;
term : factor (('*'| '/') factor)*;
factor: '('expr')' |( ID|NUM);
PLUS : '+';
MINUS:'-';
DIV: '/';
MULT: '*';
TYPE: 'integer'|'real';
ID : [a-z];
NUM :[0-9]+ | ( [0-9]+ '.' [0-9]+);
WS : [ \t\r\n]+ -> skip ;
|
oeis/122/A122932.asm
|
neoneye/loda-programs
| 11 |
81426
|
<reponame>neoneye/loda-programs
; A122932: a(n) = A000085(n) - A000079(n-1).
; Submitted by <NAME>
; 0,0,0,2,10,44,168,636,2364,8984,34672,138104,564408,2382288,10333152,46173968,211733776,997182752,4809439296,23758139808,119951644320,618882541760,3257839688320,17492182188992,95680426983360
add $0,1
mov $1,1
mov $2,1
mov $4,-1
mov $5,-1
lpb $0
sub $0,1
sub $3,$1
mul $1,$2
mov $2,2
mul $3,$0
mul $3,$5
sub $4,$3
add $3,$4
add $3,$1
lpe
sub $0,$3
|
programs/oeis/198/A198395.asm
|
neoneye/loda
| 22 |
240625
|
; A198395: Ceiling(n*sqrt(17)).
; 0,5,9,13,17,21,25,29,33,38,42,46,50,54,58,62,66,71,75,79,83,87,91,95,99,104,108,112,116,120,124,128,132,137,141,145,149,153,157,161,165,170,174,178,182,186,190,194,198,203,207,211,215,219,223,227,231,236,240,244,248,252,256,260,264,269,273,277,281,285,289,293,297,301,306,310,314,318,322,326,330,334,339,343,347,351,355,359,363,367,372,376,380,384,388,392,396,400,405,409
mov $1,$0
mul $0,2
pow $1,2
mul $1,16
lpb $1
sub $1,$0
add $0,2
trn $1,1
lpe
div $0,2
|
src/cobs-queue-encoder.adb
|
Fabien-Chouteau/COBS
| 0 |
7639
|
with BBqueue; use BBqueue;
package body COBS.Queue.Encoder is
procedure Ensure_Buffer (This : in out Instance;
Success : out Boolean);
procedure Set (This : in out Instance;
Index : Storage_Offset;
Data : Storage_Element)
with Pre => State (This.WG) = Valid,
Inline;
-------------------
-- Ensure_Buffer --
-------------------
procedure Ensure_Buffer (This : in out Instance;
Success : out Boolean)
is
begin
if State (This.WG) /= Valid then
Grant (This.Queue, This.WG, Min_Buf_Size);
if State (This.WG) /= Valid then
Success := False;
return;
end if;
This.Code_Pointer := This.Buffer'First + Slice (This.WG).From;
This.Encode_Pointer := This.Code_Pointer + 1;
end if;
Success := True;
return;
end Ensure_Buffer;
---------
-- Set --
---------
procedure Set (This : in out Instance;
Index : Storage_Offset;
Data : Storage_Element)
is
begin
if Index not in This.Buffer'First + Slice (This.WG).From ..
This.Buffer'First + Slice (This.WG).To
then
raise Program_Error;
end if;
This.Buffer (Index) := Data;
end Set;
----------
-- Push --
----------
procedure Push (This : in out Instance;
Data : Storage_Element;
Success : out Boolean)
is
begin
Ensure_Buffer (This, Success);
if not Success then
return;
end if;
if Data /= 0 then
Set (This, This.Encode_Pointer, Data);
This.Encode_Pointer := This.Encode_Pointer + 1;
This.Code := This.Code + 1;
end if;
if Data = 0 or else This.Code = 16#FF# then
Set (This, This.Code_Pointer, This.Code);
This.Prev_Code := This.Code;
Commit (This.Queue, This.WG, Count (This.Code));
This.Code := 1;
end if;
end Push;
---------------
-- End_Frame --
---------------
procedure End_Frame (This : in out Instance;
Success : out Boolean)
is
begin
Ensure_Buffer (This, Success);
if not Success then
return;
end if;
if This.Code /= 1 or else This.Prev_Code /= 16#FF# then
Set (This, This.Code_Pointer, This.Code);
Set (This, This.Encode_Pointer, 0);
Commit (This.Queue, This.WG, Count (This.Code) + 1);
else
Set (This, This.Code_Pointer, 0);
Commit (This.Queue, This.WG, Count (This.Code));
end if;
This.Code := 1;
This.Prev_Code := 1;
end End_Frame;
----------------
-- Read_Slice --
----------------
function Read_Slice (This : in out Instance) return Slice_Rec is
function Make_Slice return Slice_Rec
with Pre => State (This.RG) = Valid;
function Make_Slice return Slice_Rec is
Slice : constant BBqueue.Slice_Rec := BBqueue.Slice (This.RG);
begin
return (Slice.Length,
This.Buffer (This.Buffer'First + Slice.From)'Address);
end Make_Slice;
begin
if State (This.RG) = Valid then
-- We already have a read grant
return Make_Slice;
else
-- Try to get a new read grant
BBqueue.Read (This.Queue, This.RG);
if State (This.RG) = Valid then
return Make_Slice;
else
-- No data available
return (0, System.Null_Address);
end if;
end if;
end Read_Slice;
-------------
-- Release --
-------------
procedure Release (This : in out Instance) is
begin
if State (This.RG) = Valid then
BBqueue.Release (This.Queue, This.RG);
end if;
end Release;
-------------
-- Read_CB --
-------------
procedure Read_CB (This : in out Instance;
Result : out Result_Kind)
is
G : Read_Grant := Empty;
begin
Read (This.Queue, G);
Result := State (G);
if Result = Valid then
declare
S : constant BBqueue.Slice_Rec := BBqueue.Slice (G);
B : Storage_Array renames This.Buffer;
To_Release : Count;
begin
Process_Read (B (B'First + S.From .. B'First + S.To),
To_Release);
Release (This.Queue, G, To_Release);
pragma Assert (State (G) = Empty);
end;
end if;
end Read_CB;
end COBS.Queue.Encoder;
|
tests/src/multi_palette.adb
|
Fabien-Chouteau/GESTE
| 13 |
25011
|
<filename>tests/src/multi_palette.adb
with GESTE;
with GESTE.Sprite;
with GESTE.Tile_Bank;
with Ada.Text_IO;
with Console_Char_Screen;
procedure Multi_Palette is
package Console_Screen is new Console_Char_Screen
(Width => 16,
Height => 16,
Buffer_Size => 256,
Init_Char => ' ');
Palette_A : aliased constant GESTE.Palette_Type :=
('#', 'T', ' ', ' ');
Palette_B : aliased constant GESTE.Palette_Type :=
('0', 'T', ' ', ' ');
Background : Character := '_';
Tiles : aliased constant GESTE.Tile_Array :=
(1 => ((2, 2, 1, 2, 2),
(2, 2, 1, 2, 2),
(1, 1, 1, 1, 1),
(2, 2, 1, 2, 2),
(2, 2, 1, 2, 2))
);
Bank_A : aliased GESTE.Tile_Bank.Instance (Tiles'Unrestricted_Access,
GESTE.No_Collisions,
Palette_A'Unrestricted_Access);
Bank_B : aliased GESTE.Tile_Bank.Instance (Tiles'Unrestricted_Access,
GESTE.No_Collisions,
Palette_B'Unrestricted_Access);
Sprite_A : aliased GESTE.Sprite.Instance (Bank => Bank_A'Unrestricted_Access,
Init_Frame => 1);
Sprite_B : aliased GESTE.Sprite.Instance (Bank => Bank_B'Unrestricted_Access,
Init_Frame => 1);
begin
Console_Screen.Verbose;
Sprite_A.Move ((1, 1));
GESTE.Add (Sprite_A'Unrestricted_Access, 0);
Sprite_B.Move ((10, 4));
GESTE.Add (Sprite_B'Unrestricted_Access, 0);
GESTE.Render_Window
(Window => Console_Screen.Screen_Rect,
Background => Background,
Buffer => Console_Screen.Buffer,
Push_Pixels => Console_Screen.Push_Pixels'Unrestricted_Access,
Set_Drawing_Area => Console_Screen.Set_Drawing_Area'Unrestricted_Access);
Console_Screen.Print;
Ada.Text_IO.New_Line;
Sprite_A.Move ((4, 4));
Sprite_B.Move ((6, 6));
GESTE.Render_Dirty
(Screen_Rect => Console_Screen.Screen_Rect,
Background => Background,
Buffer => Console_Screen.Buffer,
Push_Pixels => Console_Screen.Push_Pixels'Unrestricted_Access,
Set_Drawing_Area => Console_Screen.Set_Drawing_Area'Unrestricted_Access);
Console_Screen.Print;
end Multi_Palette;
|
models/hol/sygus/integer_benchmarks/max-4.als
|
johnwickerson/alloystar
| 2 |
1174
|
<filename>models/hol/sygus/integer_benchmarks/max-4.als
open max
--------------------------------------------------------------------------------
-- Variables and Values
--------------------------------------------------------------------------------
one sig X, Y, Z, U extends IntVar {}
--------------------------------------------------------------------------------
-- Commands
--------------------------------------------------------------------------------
run synthIntNodeI for 10 but -1..2 Int, 0 IntLit, 0 BoolLit, 0 BoolVar, 0 BinaryIntOp, 0 UnaryIntOp,
0 GT, 0 LT, 0 Xor, 0 Nand, 0 Nor, 0 BoolInvComp
run synthIntNodeI for 0 but -1..2 Int, exactly 3 ITE, exactly 3 GTE
|
program.asm
|
zxYin/mips-pipeline-simulator
| 19 |
80208
|
# Load some data into memory
addi $t0, $zero, 15 # $t0 = 0xF
sw $t0, 0($zero) # Copy $t0 to memory[0]
addi $t1, $zero, 240 # $t1 = 0xF0
sw $t1, 4($zero) # Copy $t1 to memory[4]
# Do some calculations
# memory[8] = 0xF0 * (0xF + 0xF0)
add $t3, $t0, $t1 # $t3 = $t0 + $t1
lw $t4, 4($zero) # Copy memory[4] to $t4
mult $t5, $t4, $t3 # $t5 = $t4 * $t3
sw $t5, 8($zero) # Copy $t5 to memory[8]
# Verify that the results are correct
# memory[8] = 240*(15+240) = 61200 = 0xEF10
lw $s0, 8($zero)
addi, $s1, $zero, 61200
addi $s7, $zero, 1
beq $s0, $s1, 1
addi $s7, $s7, 1
# If correct, $s7 == 1.
# If not correct, $s7 == 2.
|
tests/typing/bad/testfile-params-3.adb
|
xuedong/mini-ada
| 0 |
21165
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Test is
function F(A, A: integer) return integer is begin return 0; end;
begin
New_Line;
end;
|
PocketCfg/PocketCfg.Res/Res.g4
|
dresswithpockets/pocketcfg
| 0 |
2131
|
grammar Res;
translationUnit : (NEWLINE? (DIRECTIVE | object))*;
objectList : (NEWLINE? object)*;
name : IDENT | STRING_LITERAL;
flagSpecifier : LBRACKET EXCL? FLAG RBRACKET;
object : name flagSpecifier? objectBody;
objectBody : STRING_LITERAL
| (NEWLINE? LBRACE NEWLINE objectList NEWLINE RBRACE);
fragment Identifier : [a-zA-Z0-9_\-]+;
fragment LineEnder : [\n\r]+|EOF;
LBRACKET : '[';
RBRACKET : ']';
LBRACE : '{';
RBRACE : '}';
EXCL : '!';
COMMENT : '//' .*? LineEnder -> skip;
DIRECTIVE : '#' .*? LineEnder;
FLAG : '$' Identifier;
STRING_LITERAL : '"'.*?'"';
IDENT : Identifier;
NEWLINE : [\n\r]+;
WS : [ \t]+ -> skip;
|
src/armvx-m/agate-arch-armvx_m.adb
|
Fabien-Chouteau/AGATE
| 3 |
19382
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017-2020, <NAME> --
-- --
-- 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 System.Machine_Code; use System.Machine_Code;
package body AGATE.Arch.ArmvX_m is
-------------
-- Set_PSP --
-------------
procedure Set_PSP
(Addr : Process_Stack_Pointer)
is
begin
Asm ("msr psp, %0",
Inputs => Process_Stack_Pointer'Asm_Input ("r", Addr),
Volatile => True);
end Set_PSP;
---------
-- PSP --
---------
function PSP
return Process_Stack_Pointer
is
Ret : Process_Stack_Pointer;
begin
Asm ("mrs %0, psp",
Outputs => Process_Stack_Pointer'Asm_Output ("=r", Ret),
Volatile => True);
return Ret;
end PSP;
-------------
-- Set_MSP --
-------------
procedure Set_MSP
(Addr : Process_Stack_Pointer)
is
begin
Asm ("msr msp, %0",
Inputs => Process_Stack_Pointer'Asm_Input ("r", Addr),
Volatile => True);
end Set_MSP;
---------
-- MSP --
---------
function MSP
return Process_Stack_Pointer
is
Ret : Process_Stack_Pointer;
begin
Asm ("mrs %0, msp",
Outputs => Process_Stack_Pointer'Asm_Output ("=r", Ret),
Volatile => True);
return Ret;
end MSP;
-----------------
-- Set_Control --
-----------------
procedure Set_Control (Val : Word) is
begin
Asm ("msr control, %0",
Inputs => Word'Asm_Input ("r", Val),
Volatile => True);
end Set_Control;
-------------
-- Control --
-------------
function Control return Word is
Ret : Word;
begin
Asm ("mrs %0, control",
Outputs => Word'Asm_Output ("=r", Ret),
Volatile => True);
return Ret;
end Control;
-------------------
-- Enable_Faults --
-------------------
procedure Enable_Faults is
begin
Asm ("cpsie f",
Volatile => True);
end Enable_Faults;
--------------------
-- Disable_Faults --
--------------------
procedure Disable_Faults is
begin
Asm ("cpsid f",
Volatile => True);
end Disable_Faults;
----------------
-- Enable_IRQ --
----------------
procedure Enable_IRQ is
begin
Asm ("cpsie i",
Volatile => True);
end Enable_IRQ;
-----------------
-- Disable_IRQ --
-----------------
procedure Disable_IRQ is
begin
Asm ("cpsid i",
Volatile => True);
end Disable_IRQ;
-----------------------------
-- Set_Thread_Unprivileged --
-----------------------------
procedure Set_Thread_Unprivileged is
begin
Set_Control (Control or 1);
end Set_Thread_Unprivileged;
----------------------------
-- Set_Thread_Mode_On_PSP --
----------------------------
procedure Set_Thread_Mode_On_PSP is
begin
Set_Control (Control or 2);
end Set_Thread_Mode_On_PSP;
end AGATE.Arch.ArmvX_m;
|
Cubical/Data/Strict2Group/Explicit/ToXModule.agda
|
Schippmunk/cubical
| 0 |
15332
|
<gh_stars>0
{-# OPTIONS --cubical --safe #-}
module Cubical.Data.Strict2Group.Explicit.ToXModule where
open import Cubical.Foundations.Prelude hiding (comp)
open import Cubical.Data.Group.Base
open import Cubical.Data.XModule.Base
open import Cubical.Data.Group.Action.Base
open import Cubical.Data.Sigma
open import Cubical.Data.Strict2Group.Explicit.Base
open import Cubical.Data.Strict2Group.Explicit.Interface
Strict2GroupExp→XModuleExp : {ℓ : Level} (S : Strict2GroupExp ℓ) → (XModuleExp ℓ)
Strict2GroupExp→XModuleExp (strict2groupexp C₀ C₁ s t i ∘ si ti s∘ t∘ isMorph∘ assoc∘ lUnit∘ rUnit∘) =
record
{ G = C₀ ;
H = ks ;
τ = tₖₛ ;
α = laction
(λ g h → lAction.act lad (id g) h)
(λ h →
ΣPathP (p1 h ,
isProp→PathP
(λ i → snd (P (p1 h i)))
(kerIsNormal {G = C₁} {H = C₀} s (id 1₀) h)
(kerIsNormal {G = C₁} {H = C₀} s 1₁ h))
∙ lAction.identity lad h)
(λ g g' h →
ΣPathP (p2 g g' h ,
isProp→PathP
(λ i → snd (P (p2 g g' h i)))
(kerIsNormal {G = C₁} {H = C₀} s (id (g ∙₀ g')) h)
(kerIsNormal {G = C₁} {H = C₀} s (id g ∙₁ id g') h))
∙ (lAction.coh lad (id g) (id g') h))
λ g h h' → lAction.hom lad (id g) h h' ;
equivar = equivar ;
peiffer = pf }
where
S = strict2groupexp C₀ C₁ s t i ∘ si ti s∘ t∘ isMorph∘ assoc∘ lUnit∘ rUnit∘
open S2GInterface S
-- the kernel of the source map
kers = ker {G = C₁} {H = C₀} s
-- the family of propositions ker(x) ≡ 1
P = Subgroup.typeProp kers
-- kernel coerced to group
ks = Subgroup→Group {G = C₁} kers
-- the left adjoint action of hom on its normal subgroup ker(src)
lad : lAction C₁ ks
lad = lActionAdjSubgroup C₁ kers (kerIsNormal {G = C₁} {H = C₀} s)
-- the target map restricted to ker(src)
tₖₛ = restrictGroupMorph {G = C₁} {H = C₀} t kers
tarₖₛ = fst tₖₛ
tar∙ₖₛ = snd tₖₛ
-- multiplication, inverse in ker src
_∙₁ₖₛ_ = isGroup.comp (Group.groupStruc ks)
ks⁻¹ = isGroup.inv (Group.groupStruc ks)
-- group laws in ker(src)
lUnitₖₛ = isGroup.lUnit (Group.groupStruc ks)
rUnitₖₛ = isGroup.rUnit (Group.groupStruc ks)
rCancelₖₛ = isGroup.rCancel (Group.groupStruc ks)
assocₖₛ = isGroup.assoc (Group.groupStruc ks)
1ₖₛ = isGroup.id (Group.groupStruc ks)
-- Composition restricted to ks×₀ks
∘ₖₛ : (g f : Group.type ks) → (src (fst g) ≡ tarₖₛ f) → Group.type ks
∘ₖₛ g f coh = (⊙' (fst g) (fst f) coh) , ((src⊙' (fst g) (fst f) coh) ∙ snd f)
-- right and left unit law for restricted ∘
abstract
rUnit∘ₖₛ : (h : Group.type ks) →
∘ₖₛ h (id (src (fst h)) , si (src (fst h)) ∙ snd h)
(sym (ti (src (fst h)))) ≡ h
rUnit∘ₖₛ h = ΣPathP (rUnit∘ (fst h) ,
isProp→PathP
(λ i → snd (P (rUnit∘ (fst h) i)))
(src⊙' (fst h) (id (src (fst h))) (sym (ti (src (fst h)))) ∙ si (src (fst h)) ∙ snd h)
(snd h))
abstract
lUnit∘ₖₛ : (h : Group.type ks) →
(⊙ (co (id (tar (fst h))) (fst h) (si (tar (fst h)))) , (src⊙' (id (tar (fst h))) (fst h) (si (tar (fst h)))) ∙ snd h) ≡ h
lUnit∘ₖₛ h = ΣPathP (
lUnit∘ (fst h) ,
isProp→PathP
(λ i → snd (P (lUnit∘ (fst h) i))) (src⊙' (id (tar (fst h))) (fst h) (si (tar (fst h))) ∙ snd h) (snd h))
-- two proofs used in equivariant
abstract
p1 = λ (h : Group.type ks) → cong (λ z → (z ∙₁ fst h) ∙₁ (C₁⁻¹ z)) (morphId {G = C₀} {H = C₁} i)
p2 = λ (g g' : Group.type C₀) (h : Group.type ks) → cong (λ z → (z ∙₁ fst h) ∙₁ (C₁⁻¹ z)) (id∙₀ g g')
equivar = λ g h → tar∙₁ (id g ∙₁ fst h) (C₁⁻¹ (id g)) ∙∙
cong (_∙₀ (tar (C₁⁻¹ (id g)))) (tar∙₁ (id g) (fst h)) ∙∙
cong (((tar (id g)) ∙₀ (tar (fst h))) ∙₀_) (morphInv {G = C₁} {H = C₀} t (id g)) ∙
cong (λ z → (z ∙₀ (tar (fst h))) ∙₀ (C₀⁻¹ z)) (ti g)
-- the peiffer identity, proved according to
-- ixh'ix- ≡ eixh'ix- ≡ hh-ixh'ix- ≡ hh-ixh'ixe
pf : (h h' : Group.type ks) → lAction.act lad (id (tarₖₛ h)) h' ≡ (h ∙₁ₖₛ h') ∙₁ₖₛ (ks⁻¹ h)
pf h h' =
ixh'ix-
≡⟨ sym (lUnitₖₛ ixh'ix-) ⟩
1ₖₛ ∙₁ₖₛ ixh'ix-
≡⟨ cong (_∙₁ₖₛ ixh'ix-) (sym (rCancelₖₛ h)) ⟩
(h ∙₁ₖₛ h-) ∙₁ₖₛ ixh'ix-
≡⟨ assocₖₛ h h- ixh'ix- ⟩
h ∙₁ₖₛ (h- ∙₁ₖₛ ixh'ix-)
≡⟨ cong (h ∙₁ₖₛ_) (
h- ∙₁ₖₛ ixh'ix-
≡⟨ cong (h- ∙₁ₖₛ_) (sym (rUnit∘ₖₛ ixh'ix-)) ⟩
h- ∙₁ₖₛ (∘ₖₛ ixh'ix- (is ixh'ix-) (src≡tarIdSrc (fst ixh'ix-)))
≡⟨ cong (_∙₁ₖₛ (∘ₖₛ ixh'ix- (is ixh'ix-) (src≡tarIdSrc (fst ixh'ix-)))) (sym (lUnit∘ₖₛ h-)) ⟩
(⊙ ix-⊙h-₁ , (src⊙ ix-⊙h-₁) ∙ snd h-) ∙₁ₖₛ ∘ₖₛ ixh'ix- (is ixh'ix-) (src≡tarIdSrc (fst ixh'ix-))
≡⟨ ΣPathP (q3 , isProp→PathP (λ i → snd (P (q3 i))) (snd ((ix-∘h-₁ , (src⊙ ix-⊙h-₁) ∙ snd h-) ∙₁ₖₛ ∘ₖₛ ixh'ix- (is ixh'ix-) (src≡tarIdSrc (fst ixh'ix-)))) (src⊙' (ix- ∙₁ fst ixh'ix-) (h- .fst ∙₁ fst (is ixh'ix-)) q1 ∙ q2)) ⟩
(⊙ (co (ix- ∙₁ fst ixh'ix-) (h- .fst ∙₁ fst (is ixh'ix-)) q1)) , (src⊙' (ix- ∙₁ fst ixh'ix-) (h- .fst ∙₁ fst (is ixh'ix-)) q1) ∙ q2
≡⟨ ΣPathP (q18 , (isProp→PathP (λ j → snd (P (q18 j))) ((src⊙' (ix- ∙₁ fst ixh'ix-) (h- .fst ∙₁ fst (is ixh'ix-)) q1) ∙ q2) ((src⊙' (ix- ∙₁ fst ixh'ix-) (h- .fst ∙₁ 1₁) (q5 ∙ q8)) ∙ q9))) ⟩
(⊙ (co (ix- ∙₁ fst ixh'ix-) (h- .fst ∙₁ 1₁) (q5 ∙ q8))) ,
(src⊙' (ix- ∙₁ fst ixh'ix-) (h- .fst ∙₁ 1₁) (q5 ∙ q8)) ∙ q9
≡⟨ ΣPathP (q17 , (isProp→PathP (λ j → snd (P (q17 j))) ((src⊙' (ix- ∙₁ fst ixh'ix-) (h- .fst ∙₁ 1₁) (q5 ∙ q8)) ∙ q9) ((src⊙' (ix- ∙₁ fst ixh'ix-) (fst h-) q5) ∙ snd h-))) ⟩
(⊙ (co (ix- ∙₁ fst ixh'ix-) (h- .fst) q5)) ,
(src⊙' (ix- ∙₁ fst ixh'ix-) (h- .fst) q5) ∙ snd h-
≡⟨ ΣPathP (q16 , isProp→PathP (λ j → snd (P (q16 j))) ((src⊙' (ix- ∙₁ fst ixh'ix-) (fst h-) q5) ∙ snd h-) ((src⊙' (ix- ∙₁ fst ixh'ix-) (1₁ ∙₁ h- .fst) (q5 ∙ q6)) ∙ q7)) ⟩
(⊙ (co (ix- ∙₁ fst ixh'ix-) (1₁ ∙₁ h- .fst) (q5 ∙ q6))) ,
(src⊙' (ix- ∙₁ fst ixh'ix-) (1₁ ∙₁ h- .fst) (q5 ∙ q6)) ∙ q7
≡⟨ ΣPathP (q15 , (isProp→PathP (λ j → snd (P (q15 j))) ((src⊙' (ix- ∙₁ fst ixh'ix-) (1₁ ∙₁ h- .fst) (q5 ∙ q6)) ∙ q7) ((src⊙' ((fst h') ∙₁ ix-) (1₁ ∙₁ h- .fst) q4) ∙ q7))) ⟩
(⊙ (co ((fst h') ∙₁ ix-) (1₁ ∙₁ h- .fst) q4)) ,
(src⊙' ((fst h') ∙₁ ix-) (1₁ ∙₁ h- .fst) q4) ∙ q7
≡⟨ ΣPathP (q14 , isProp→PathP (λ j → snd (P (q14 j))) ((src⊙' ((fst h') ∙₁ ix-) (1₁ ∙₁ h- .fst) q4) ∙ q7) q12) ⟩
(⊙ (co (fst h') 1₁ ((snd h') ∙ (sym tar1₁≡1₀)))) ∙₁ ix-∘h-₁ , q12
≡⟨ ΣPathP (q11 , isProp→PathP (λ j → snd (P (q11 j))) q12 q13) ⟩
h' .fst ∙₁ ix-∘h-₁ , q13
≡⟨ ΣPathP (q10 , isProp→PathP (λ j → snd (P (q10 j)))
(src∙₁ (fst h') ix-∘h-₁ ∙∙
(λ i₁ → snd h' i₁ ∙₀ src ix-∘h-₁) ∙∙
lUnit₀ (src ix-∘h-₁) ∙∙
src⊙ ix-⊙h-₁ ∙∙
snd h-)
(Subgroup.compClosed kers h' h-)) ⟩
h' .fst ∙₁ h- .fst , Subgroup.compClosed kers h' h- ≡⟨ refl ⟩
(h' ∙₁ₖₛ h-) ≡⟨ refl ⟩ refl ) ⟩
h ∙₁ₖₛ (h' ∙₁ₖₛ h-)
≡⟨ sym (assocₖₛ h h' h-) ⟩
(h ∙₁ₖₛ h') ∙₁ₖₛ h- ≡⟨ refl ⟩ refl
where
-- some abbreviations
h- = ks⁻¹ h -- h⁻¹
x = tarₖₛ h -- target of h
x- = tarₖₛ h- -- target of h⁻¹
x-≡x⁻¹ : x- ≡ C₀⁻¹ x
x-≡x⁻¹ = morphInv {G = ks} {H = C₀} tₖₛ h
ix = id x -- i (t h)
ix- = id x- -- i (t h⁻¹)
ixh'ix- : Group.type ks -- abv. for (ix ∙₁ h') ∙₁ ix-
ixh'ix- = lAction.act lad (id (tarₖₛ h)) h'
is : Group.type ks → Group.type ks -- abv. for i(s _) in ks
is h = id (src (fst h)) , (si (src (fst h))) ∙ snd h
ix-⊙h-₁ = co ix- (fst h-) (si x-)
ix-∘h-₁ = ⊙ ix-⊙h-₁
-- some identities
ix-≡ix⁻¹ : ix- ≡ (C₁⁻¹ ix)
ix-≡ix⁻¹ = (cong id x-≡x⁻¹) ∙ (morphInv {G = C₀} {H = C₁} i x)
ish≡1ₖₛ : (h : Group.type ks) → (is h) ≡ 1ₖₛ
ish≡1ₖₛ h =
ΣPathP
(cong (fst i) (snd h) ∙ id1₀≡1₁ ,
isProp→PathP
(λ j → snd (P (((λ k → id(snd h k)) ∙ id1₀≡1₁) j)))
(si (src (fst h)) ∙ snd h)
(Subgroup.subId kers))
-- t h⁻¹ ≡ (t h)⁻¹
th-≡x- = morphInv {G = ks} {H = C₀} tₖₛ h
-----------------------------------------
-- here comes particles of the main proof
-----------------------------------------
-- coherence condition for the composition
-- ∘ (ix- ∙₁ fst ixh'ix-) (h- .fst ∙₁ fst (is ixh'ix-))
q1 =
src∙₁ ix- (fst ixh'ix-) ∙∙
cong (_∙₀ src (fst ixh'ix-)) (si x-) ∙∙
cong (x- ∙₀_) (snd ixh'ix-) ∙∙
rUnit₀ x- ∙∙
th-≡x- ∙∙
sym (rUnit₀ (C₀⁻¹ x)) ∙∙
cong ((C₀⁻¹ x) ∙₀_) (sym ((ti ((src (fst ixh'ix-)))) ∙ (snd ixh'ix-))) ∙∙
cong (_∙₀ (tar (fst (is ixh'ix-)))) (sym th-≡x-) ∙∙
sym (tar∙₁ (fst h-) (fst (is ixh'ix-)))
-- to show that ∘ q1 is in ks, p2 is proof that f is in ks
q2 = src∙₁ (fst h-) (fst (is ixh'ix-)) ∙∙
cong (_∙₀ (src (fst (is ixh'ix-)))) (snd h-) ∙∙
lUnit₀ (src (fst (is ixh'ix-))) ∙∙
cong (λ z → src (fst z)) (ish≡1ₖₛ ixh'ix-) ∙∙
snd 1ₖₛ
-- (∘ (si x-)) ∙₁ (fst (∘ₖₛ (src≡tarIdSrc (fst ixh'ix-)))) ≡ ∘ q1
q3 =
(ix-∘h-₁ ∙₁ fst (∘ₖₛ ixh'ix- (is ixh'ix-) (src≡tarIdSrc (fst ixh'ix-)))) ≡⟨ refl ⟩
⊙ ix-⊙h-₁ ∙₁ ⊙ co3
≡⟨ sym (isMorph⊙ ix-⊙h-₁ co3) ⟩
⊙ (ix-⊙h-₁ ∙Co co3)
≡⟨ ⊙≡c (ix-⊙h-₁ ∙Co co3) q1 ⟩
⊙ co1 ≡⟨ refl ⟩ refl
where
co1 = co (ix- ∙₁ fst ixh'ix-) (fst h- ∙₁ fst (is ixh'ix-)) q1
co3 = co (fst ixh'ix-) (fst (is ixh'ix-)) (src≡tarIdSrc (fst ixh'ix-))
-- coherence condition for ∘ {g = ?} {f = 1₁ ∙₁ h- .fst} (_∙ q6)
q6 = sym (lUnit₀ (tar (fst h-))) ∙∙
sym (cong (_∙₀ (tar (fst h-))) (morphId {G = C₁} {H = C₀} t)) ∙∙
sym (tar∙₁ 1₁ (fst h-))
-- coherence condition for ∘ {g = (fst h') ∙₁ ix- } {f = 1₁ ∙₁ h- .fst } q4
q4 =
src∙₁ (fst h') ix- ∙∙
(cong (_∙₀ src ix-) (snd h')) ∙∙
lUnit₀ (src ix-) ∙∙
si x- ∙∙
q6
-- coherence condition for ∘ {g = ix- ∙₁ fst ixh'ix- } {f = ?} (q5 ∙ ?)
q5 =
src∙₁ ix- (fst ixh'ix-) ∙∙
cong ((src ix-) ∙₀_) (snd ixh'ix-) ∙∙
rUnit₀ (src ix-) ∙
si x-
-- proof that 1₁ ∙₁ h- .fst : ker s
q7 = src∙₁ 1₁ (fst h-) ∙∙
cong (src 1₁ ∙₀_) (snd h-) ∙∙
rUnit₀ (src 1₁) ∙ src1₁≡1₀
-- proof that s x- ≡ t (h- .fst ∙₁ 1₁)
q8 = sym (rUnit₀ (tar (fst h-))) ∙∙
(sym (cong ((tar (fst h-)) ∙₀_) tar1₁≡1₀)) ∙∙
(sym (tar∙₁ (fst h-) 1₁))
-- proof that h- .fst ∙₁ 1₁ : ker s
q9 = src∙₁ (fst h-) 1₁ ∙∙
cong (_∙₀ (src 1₁)) (snd h-) ∙∙
lUnit₀ (src 1₁) ∙
src1₁≡1₀
-- proof that (h' .fst ∙₁ ix-∘h-₁) ≡ (h' .fst ∙₁ h- .fst)
q10 = cong (h' .fst ∙₁_) (lUnit∘ (fst h-))
-- proof that (h'∘1₁)∙₁ ix-∘h-₁ ≡ h' ∙₁ ix-∘h-₁
q11 = cong (_∙₁ ix-∘h-₁)
(⊙≡ (co (fst h') 1₁ (snd h' ∙ sym tar1₁≡1₀)) (id (src (fst h')) , sym id1₀≡1₁ ∙ sym (cong id (snd h'))) ∙
rUnit⊙c
(fst h')
((snd h' ∙ (λ i₁ → tar1₁≡1₀ (~ i₁))) ∙ cong tar ((λ i₁ → id1₀≡1₁ (~ i₁)) ∙ (λ i₁ → id (snd h' (~ i₁))))))
q12 =
src∙₁ ((⊙ (co (fst h') 1₁ ((snd h') ∙ sym tar1₁≡1₀)))) ix-∘h-₁ ∙∙
cong (_∙₀ (src ix-∘h-₁)) ((src⊙' (fst h') 1₁ ((snd h') ∙ (sym tar1₁≡1₀))) ∙ src1₁≡1₀) ∙∙
lUnit₀ (src ix-∘h-₁) ∙
src⊙' ix- (fst h-) (si x-) ∙ snd h-
q13 = src∙₁ (fst h') ix-∘h-₁ ∙∙
cong (_∙₀ (src ix-∘h-₁)) (snd h') ∙∙
lUnit₀ (src ix-∘h-₁) ∙∙
src⊙' ix- (fst h-) (si x-) ∙∙
snd h-
q14 =
⊙' ((fst h') ∙₁ ix-) (1₁ ∙₁ h- .fst) q4
≡⟨ ⊙≡c~ q4 (𝒸 (co (fst h') 1₁ (snd h' ∙ (λ i₁ → tar1₁≡1₀ (~ i₁))) ∙Co ix-⊙h-₁)) ⟩
⊙' ((fst h') ∙₁ ix-) (1₁ ∙₁ (fst h-)) (𝒸 (co (fst h') 1₁ (snd h' ∙ (λ i₁ → tar1₁≡1₀ (~ i₁))) ∙Co ix-⊙h-₁))
≡⟨ isMorph⊙ (co (fst h') 1₁ (snd h' ∙ (λ i₁ → tar1₁≡1₀ (~ i₁)))) ix-⊙h-₁ ⟩
-- (⊙' (fst h') 1₁ (snd h' ∙ (λ i₁ → tar1₁≡1₀ (~ i₁)))) ∙₁ ix-∘h-₁ ≡⟨ refl ⟩
refl
q15 = ≡⊙c* (q5 ∙ q6)
(cong (ix- ∙₁_) (assoc₁ ix (fst h') (C₁⁻¹ ix)) ∙∙
sym (assoc₁ ix- ix (fst h' ∙₁ C₁⁻¹ ix)) ∙∙
cong (λ z → (z ∙₁ ix) ∙₁ (fst h' ∙₁ C₁⁻¹ ix)) ix-≡ix⁻¹ ∙∙
cong (_∙₁ (fst h' ∙₁ C₁⁻¹ ix)) (lCancel₁ ix) ∙∙
lUnit₁ (fst h' ∙₁ C₁⁻¹ ix) ∙
cong (fst h' ∙₁_) (sym ix-≡ix⁻¹))
q4
{- use this to see what's going on
⊙ co1
≡⟨ ≡⊙c* (q5 ∙ q6)
((cong (ix- ∙₁_) (assoc₁ ix (fst h') (C₁⁻¹ ix))) ∙
sym (assoc₁ ix- ix (fst h' ∙₁ C₁⁻¹ ix)) ∙
cong (λ z → (z ∙₁ ix) ∙₁ (fst h' ∙₁ C₁⁻¹ ix)) ix-≡ix⁻¹ ∙
cong (_∙₁ (fst h' ∙₁ C₁⁻¹ ix)) (lCancel₁ ix) ∙
(lUnit₁ (fst h' ∙₁ C₁⁻¹ ix)) ∙
(cong (fst h' ∙₁_) (sym ix-≡ix⁻¹)))
q4 ⟩
⊙ co2 ≡⟨ refl ⟩ refl
where
co1 = co (ix- ∙₁ (fst ixh'ix-)) (1₁ ∙₁ (fst h-)) (q5 ∙ q6)
co2 = co ((fst h') ∙₁ ix-) (1₁ ∙₁ (fst h-)) q4 -}
q16 = ⊙≡c* q5 (sym (lUnit₁ (fst h-))) (q5 ∙ q6)
{- use this to see what's going on
⊙ co1
≡⟨ ⊙≡c* q5 (sym (lUnit₁ (fst h-))) (q5 ∙ q6) ⟩
⊙ co2 ≡⟨ refl ⟩ refl
where
co1 = co (ix- ∙₁ fst ixh'ix-) (fst h-) q5
co2 = co (ix- ∙₁ fst ixh'ix-) (1₁ ∙₁ fst h-) (q5 ∙ q6) -}
q17 = ⊙≡c* (q5 ∙ q8) (rUnit₁ (fst h-)) q5
{- use this to see what's going on
⊙ co1
≡⟨ ⊙≡c* (q5 ∙ q8) (rUnit₁ (fst h-)) q5 ⟩
⊙ co2 ≡⟨ refl ⟩ refl
where
co1 = co (ix- ∙₁ fst ixh'ix-) (fst h- ∙₁ 1₁) (q5 ∙ q8)
co2 = co (ix- ∙₁ fst ixh'ix-) (fst h-) q5 -}
q18 = ⊙≡c* q1 (cong (fst h- ∙₁_) ((cong id (snd ixh'ix-)) ∙ id1₀≡1₁)) (q5 ∙ q8)
{- use this to see what's going on
⊙ co1 ≡⟨ ⊙≡c* q1 (cong (fst h- ∙₁_)
((cong id (snd ixh'ix-)) ∙ id1₀≡1₁))
(q5 ∙ q8) ⟩
⊙ co2 ≡⟨ refl ⟩ refl
where
co1 = co (ix- ∙₁ fst ixh'ix-) (fst h- ∙₁ (fst (is ixh'ix-))) q1
co2 = co (ix- ∙₁ fst ixh'ix-) (fst h- ∙₁ 1₁) (q5 ∙ q8) -}
|
ZX-Spectrum/assembly/streams_01-09.asm
|
peroff/8-Bit-Tea-Party
| 13 |
81681
|
<filename>ZX-Spectrum/assembly/streams_01-09.asm
;WELCOME TO 8-BIT TEA PARTY!
;
;MAIN FILE FOR ASSEMBLER CODE ON STREAMS.
;WE USING PENTAGON-128K MODEL EMULATION.
;
;CPU: Zilog Z80, 3.5HhZ, 1976.
;RAM: 48Kb, 128Kb With more memory.
;ROM: 16Kb, base and more with 128Kb.
;SCREEN:256x192 monohrome pixels,
; 32x24 color attributes.
;SOUND: 1-Bit beeper,
; AY-3-8910 or YM2149F chip.
;CTRL: Keybord and kempston joystick.
;ADRESS WIDTH:
; 16 BITS OR 0..64Kb OR #0000..#FFFF
;REGISTERS: 8-BIT PART OR 16-BIT AS PAIR.
; AF - ACCUMULATOR AND FLAGS
; BC - DATA/ADDR, FOR LOOPS
; DE - DATA/ADDR, OPERAND HL
; HL - 16-BIT ACCUMULATOR
; I - INTERRUPT, R(DRAM).
;REGISTERS: 16-BIT ONLY.
; IX - INDEX REGISTER.
; IY - INDEX REGISTER.
; SP - STACK POINTER.
; PC - PROGRAM COUNTER.
;INTERRUPTS:
; NMI - NON MASKABLE INTERRUPT.
; IM0 - MASKABLE, HARDWARE.
; IM1 - MASKABLE, STANDARD.
; IM2 - MASKABLE, USER DEFINED.
;IM2 function [I] * 256 + [D]=255.
OPEN_CHANNEL EQU #1601
PRINT_STRING EQU #203C
SCREEN_PIXELS EQU #4000 ;16384
SCREEN_ATTRIB EQU #5800 ;22528
SCREEN_P_SIZE EQU #1800 ;6Kb
SCREEN_A_SIZE EQU #300 ;768Bytes
SCREEN_ATTRIB_H EQU #58
SCREEN_ATTRIB_L EQU #00
SCREEN_ADDR_TOP EQU #5B00
SCREEN_ATTR_WS EQU #180 ;In words
SCREEN_PIX_WS EQU #0C00 ;In words
SCR_A_MID_ADDR EQU #5900 ;S+256
SCR_ATTR_SIZE_X EQU #20 ;32
SCR_ATTR_SIZE_Y EQU #18 ;24
SCR_A_PART_SIZE EQU #100 ;256 Bytes
FONT_SIZE EQU #08 ;8x8
TIMER_FONT_SIZE EQU #58 ;88 bytes
FONT_CODE_START EQU #20 ;32 Space
IM2_PER_SEC EQU #32 ;50 ints
SEC_PER_MIN EQU #3C ;60 secs
NUM_SYS_BASE EQU #0A ;DEC(10)
IM2_I_REG EQU #5B
IM2_B_DATA EQU #FF
ORG #6000 ;START ADDRESS
LD (ALASM_STACK),SP
LD SP,(PROGRAM_STACK)
PUSH DE
LD DE,IM2
CALL IM2_SETUP
;Stream 9. Print char at screen position.
LD A,FONT_CODE_START
LD BC,SCREEN_PIXELS
LD DE,#0000
LD HL,FONT_ENG
PRC_S3: CALL PRINT_CHAR_AT
INC A ;NEXT CHAR
CP #60
JR NZ,PRC_S1
LD A,FONT_CODE_START
PRC_S1: PUSH AF
INC E ;NEXT X
LD A,E
CP SCR_ATTR_SIZE_X
JR NZ,PRC_S2
XOR A ;X = 0
LD E,A
INC D
LD A,D ;IF Y MAX
CP SCR_ATTR_SIZE_Y
JR NZ,PRC_S2
POP AF
JR PRC_S4
PRC_S2: POP AF
JR PRC_S3 ;NEXT PRINT
PRC_S4:
;CALL SCROLL_TEXT_ATTR
;CALL TIMER_ATTR_FONTS
;CALL TEXT_DYNAMIC_ATTR
;CALL CLEAR_SCR_FUNCS
;CALL IM2_PERFORMANCE
TO_RET: POP DE
LD SP,(ALASM_STACK)
RET
;Global variables and data.
STR_HELLO DEFB "Hello World!",0
PROGRAM_STACK DEFW #6000
ALASM_STACK DEFW #0000
DEFB "йцукенгшщз"
;Print char 8x8 pixels on screen.
;A char to print;
;BC address of screen(left-top);
;DE coordinates on screen Y and X;
;HL address of font.
PRINT_CHAR_AT:
PUSH AF
PUSH BC
PUSH DE
PUSH HL
PUSH DE ;HL CHAR IN FONT
EX DE,HL ;THX TO D.KRAPIVIN
SUB FONT_CODE_START
LD L,A
LD H,#00
ADD HL,HL ;CODE * 8 BYTES
ADD HL,HL
ADD HL,HL
ADD HL,DE ;ADD BASE ADDR
POP DE
LD A,D ;[0..23] 5 BITS
AND %00011000 ;3,4 BITS 2K PART
ADD A,B ;2048 = 2^11
LD B,A
LD A,D
AND %00000111 ;[0..7] * 32
RRCA ;5,6,7 BITS OFFS
RRCA ;CYCLE
RRCA
ADD A,E ;PLUS X POSITION
LD C,A ;BC OFFSET BUFFER
LD D,FONT_SIZE
P_CHR_1:LD A,(HL) ;MOVE CHAR
LD (BC),A
INC HL ;NEXT FONT LINE
INC B ;NEXT BUFFER LINE
DEC D
JR NZ,P_CHR_1 ;COUNTER
POP HL
POP DE
POP BC
POP AF
RET
;Stream 8. Scrolling text, with our font.
SCROLL_TEXT_ATTR:
PUSH AF
PUSH BC
PUSH DE
PUSH HL
PUSH IX
PUSH IY
LD D,%01000111
LD E,%00000000
CALL CLEAR_SCR
LD A,#00
OUT (#FE),A
LD IX,TEXT_TO_SCROLL
LD A,#74 ;SCROLL LENGTH
SCR_TA7:PUSH AF
;LD DE,SCR_A_MID_ADDR
LD DE,SCROLL_BUFFER
PUSH BC
PUSH DE
LD A,(IX+0) ;THX TO D.KRAPIVIN
LD BC,FONT_ENG ;FOR OPTIMIZATION
SUB FONT_CODE_START
AND %00111111 ;MASK
LD L,A
LD H,#00
;OFFSET = 8 BIT INDEX * 8(2048 MAX)
;INDEX: 10101111
;OFFSET:00000000_10101111
;01: 00000001_01011110
;02: 00000001_10111100
;03: 00000011_01111000
;RESULT:00000101_01111000
LD A,#03 ;2 ^ 3 = 8
SCR_TA2:SLA L ;OFFSET FIX!
;JR NC,SCR_TA1 ;CARRY
RL H ;IF MORE THAN 256
SCR_TA1:DEC A
JR NZ,SCR_TA2
ADD HL,BC ;FONT OFFSET
LD B,FONT_SIZE ;WRITE CHAR
LD C,B ;TO BUFFER
SCR_TA6:PUSH BC
PUSH DE
SCR_TA5:RLC (HL) ;GET FLAG
JR NC,SCR_TA3 ;IF NOT PAPER
LD A,(ATTR_SCR_P)
JR SCR_TA4
SCR_TA3:LD A,(ATTR_SCR_B)
SCR_TA4:LD (DE),A
INC DE
DJNZ SCR_TA5
LD A,(ATTR_SCR_P)
LD D,A ;NEXT COLOR
AND %11000111 ;OTHERS
LD E,A
LD A,D
AND %00111000 ;PAPER
ADD A,%00001000 ;+8 OR 1 COLOR
AND %00111000
OR E
LD (ATTR_SCR_P),A
POP DE
;LD C,SCR_ATTR_SIZE_X ;B = 0!
LD C,FONT_SIZE
EX DE,HL
ADD HL,BC ;NEXT LINE BUF
EX DE,HL
INC HL ;NEXT LINE FONT
POP BC
DEC C
JR NZ,SCR_TA6 ;NEXT LINE
POP DE
POP BC
LD H,FONT_SIZE
LD IY,SCROLL_BUFFER
PUSH IX
SCR_TA9:LD A,#02 ;NOT FAST
CALL IM2_DELAY
PUSH HL
LD HL,SCR_A_MID_ADDR ;SOURCE
LD DE,SCR_A_MID_ADDR ;DEST
INC HL
LD BC,SCR_A_PART_SIZE ;COUNTER
LDIR ;MOVE
POP HL
PUSH IY ;ONLY FOR STREAM
PUSH HL ;MOVE FROM BUFFER
LD IX,SCR_A_MID_ADDR
LD DE,SCR_ATTR_SIZE_X
ADD IX,DE
DEC IX ;SCR DESTINATION
LD BC,FONT_SIZE
LD L,FONT_SIZE ;DE SOURCE
SCR_TA8:LD A,(IY+0) ;19 TACTS
LD (IX+0),A
ADD IX,DE ;15 TACTS + 32
ADD IY,BC ;NEXT LINE + 8
DEC L
JR NZ,SCR_TA8 ;NEXT LINE BUF
POP HL
POP IY
INC IY ;NEXT COLUMN BUF
;LD A,#04 ;GREEN
;OUT (#FE),A
DEC H ;NEXT SHIFT
JR NZ,SCR_TA9
POP IX
INC IX ;NEXT CHAR
POP AF
DEC A
JP NZ,SCR_TA7
POP IY
POP IX
POP HL
POP DE
POP BC
POP AF
RET
;SCROLL COLORS FOR TEXT
ATTR_SCR_P DB %01001000 ;WHITE
ATTR_SCR_B DB %01000000 ;BLUE
SCROLL_BUFFER DUP 64
DB %01001000
EDUP
TEXT_TO_SCROLL:
DB "WELCOME TO 8-BIT TEA PARTY! "
DB "RETRO CODE FOR ZX SPECTRUM! "
DB "Z80 ASSEMBLER AND 8-BIT TEA! "
DB "HELLO TO ALL OUR FRIENDS! "
FONT_ENG:
DB #00,#00,#00,#00,#00,#00,#00,#00
DB #38,#38,#38,#30,#30,#00,#30,#00
DB #00,#6C,#6C,#6C,#00,#00,#00,#00
DB #6C,#FE,#6C,#6C,#6C,#FE,#6C,#00
DB #10,#7C,#D0,#7C,#16,#FC,#10,#00
DB #62,#A4,#C8,#10,#26,#4A,#8C,#00
DB #70,#D8,#D8,#70,#DA,#CC,#7E,#00
DB #30,#30,#30,#00,#00,#00,#00,#00
DB #0C,#18,#30,#30,#30,#18,#0C,#00
DB #60,#30,#18,#18,#18,#30,#60,#00
DB #00,#6C,#38,#FE,#38,#6C,#00,#00
DB #00,#18,#18,#7E,#18,#18,#00,#00
DB #00,#00,#00,#00,#00,#30,#30,#60
DB #00,#00,#00,#7E,#00,#00,#00,#00
DB #00,#00,#00,#00,#00,#30,#30,#00
DB #02,#04,#08,#10,#20,#40,#80,#00
DB #38,#4C,#C6,#C6,#C6,#64,#38,#00
DB #18,#38,#18,#18,#18,#18,#7E,#00
DB #7C,#C6,#0E,#3C,#78,#E0,#FE,#00
DB #7E,#0C,#18,#3C,#06,#C6,#7C,#00
DB #1C,#3C,#6C,#CC,#FE,#0C,#0C,#00
DB #FC,#C0,#FC,#06,#06,#C6,#7C,#00
DB #3C,#60,#C0,#FC,#C6,#C6,#7C,#00
DB #FE,#C6,#0C,#18,#30,#30,#30,#00
DB #78,#C4,#E4,#78,#9E,#86,#7C,#00
DB #7C,#C6,#C6,#7E,#06,#0C,#78,#00
DB #00,#30,#30,#00,#30,#30,#00,#00
DB #00,#30,#30,#00,#30,#30,#60,#00
DB #0C,#18,#30,#60,#30,#18,#0C,#00
DB #00,#00,#FE,#00,#FE,#00,#00,#00
DB #60,#30,#18,#0C,#18,#30,#60,#00
DB #7C,#FE,#C6,#0C,#38,#00,#38,#00
DB #7C,#82,#BA,#AA,#BE,#80,#7C,#00
DB #38,#6C,#C6,#C6,#FE,#C6,#C6,#00
DB #FC,#C6,#C6,#FC,#C6,#C6,#FC,#00
DB #3C,#66,#C0,#C0,#C0,#66,#3C,#00
DB #F8,#CC,#C6,#C6,#C6,#CC,#F8,#00
DB #FE,#C0,#C0,#FC,#C0,#C0,#FE,#00
DB #FE,#C0,#C0,#FC,#C0,#C0,#C0,#00
DB #3E,#60,#C0,#CE,#C6,#66,#3E,#00
DB #C6,#C6,#C6,#FE,#C6,#C6,#C6,#00
DB #7E,#18,#18,#18,#18,#18,#7E,#00
DB #06,#06,#06,#06,#06,#C6,#7C,#00
DB #C6,#CC,#D8,#F0,#F8,#DC,#CE,#00
DB #60,#60,#60,#60,#60,#60,#7E,#00
DB #C6,#EE,#FE,#FE,#D6,#C6,#C6,#00
DB #C6,#E6,#F6,#FE,#DE,#CE,#C6,#00
DB #7C,#C6,#C6,#C6,#C6,#C6,#7C,#00
DB #FC,#C6,#C6,#C6,#FC,#C0,#C0,#00
DB #7C,#C6,#C6,#C6,#DE,#CC,#7A,#00
DB #FC,#C6,#C6,#CE,#F8,#DC,#CE,#00
DB #78,#CC,#C0,#7C,#06,#C6,#7C,#00
DB #7E,#18,#18,#18,#18,#18,#18,#00
DB #C6,#C6,#C6,#C6,#C6,#C6,#7C,#00
DB #C6,#C6,#C6,#EE,#7C,#38,#10,#00
DB #C6,#C6,#D6,#FE,#FE,#EE,#C6,#00
DB #C6,#EE,#7C,#38,#7C,#EE,#C6,#00
DB #66,#66,#66,#3C,#18,#18,#18,#00
DB #FE,#0E,#1C,#38,#70,#E0,#FE,#00
DB #3C,#30,#30,#30,#30,#30,#3C,#00
DB #80,#40,#20,#10,#08,#04,#02,#00
DB #78,#18,#18,#18,#18,#18,#78,#00
DB #38,#6C,#00,#00,#00,#00,#00,#00
DB #00,#00,#00,#00,#00,#00,#00,#FE
;Stream 7. Simple timer using our fonts.
TIMER_ATTR_FONTS:
PUSH AF
PUSH BC
PUSH DE
PUSH HL
PUSH IX
LD E,%00000000
LD D,%00111000
CALL CLEAR_SCR
LD C,#03 ;NUMBER OF FONTS
LD B,SEC_PER_MIN
LD IX,FONT_DOTS
TIME_A3:PUSH BC
LD HL,#0000 ;HIGH, LOW SECONDS
LD (TIMER_L_SEC),HL
PUSH IX
POP HL
PUSH BC
LD A,(TIMER_MINS)
LD DE,#0800
LD B,%01111111
LD C,%00111000
;OR A ;ONE COLOR
SCF ;MANY COLORS
CALL PRINT_A_CHAR
LD A,#0A
LD E,#08
OR A
CALL PRINT_A_CHAR
POP BC
TIME_A1:LD A,#31
CALL IM2_DELAY
PUSH BC ;BC - SECS
LD A,(TIMER_H_SEC) ;SECS
LD B,%01111111
LD C,%00111000 ;COLORS
LD E,#10
SCF
CALL PRINT_A_CHAR
LD A,(TIMER_L_SEC) ;X10 SECS
LD E,#18
CALL PRINT_A_CHAR
;LD A,#04
;OUT (#FE),A
PUSH HL ;SAVE FONT ADDR
LD HL,(TIMER_L_SEC)
INC L
LD A,L
CP NUM_SYS_BASE ;IF SECS = 10
JR NZ,TIME_A2
LD L,#00 ;SECS = 0
INC H
LD A,H
CP NUM_SYS_BASE ;IF X10 SECS = 10
JR NZ,TIME_A2
LD H,#00
TIME_A2:LD (TIMER_L_SEC),HL
POP HL ;RESTORE ADDR
POP BC
DJNZ TIME_A1 ;NEXT SECOND
LD A,(TIMER_MINS)
INC A
LD (TIMER_MINS),A
LD BC,TIMER_FONT_SIZE
ADD IX,BC ;NOT HL
;LD A,#20 ;DEBUG FOR MINS
;CALL IM2_DELAY
POP BC
DEC C
JR NZ,TIME_A3 ;NEXT FONT
POP IX
POP HL
POP DE
POP BC
POP AF
RET
TIMER_L_SEC DEFB #00 ;SECONDS
TIMER_H_SEC DEFB #00 ;X10 SEC
TIMER_MINS DEFB #00 ;MINS
;Stream 6. Text with dynamic colors attr.
TEXT_DYNAMIC_ATTR:
PUSH AF
PUSH BC
PUSH DE
PUSH HL
PUSH IX
LD IX,FONT_BIT
LD HL,#0100 ;COUNTER ANIM
LD B,#00 ;N COLOR
LD C,%00111000 ;GREY
TXT_A1: PUSH HL
PUSH BC
PUSH IX
POP HL ;HL=IX
LD A,B ;N COLOR
AND %00000111 ;MASK
RLCA ;3 BITS LEFT
RLCA
RLCA
OR %01000000 ;BRIGHT
LD B,A ;PAPER TO DRAW
PUSH BC
POP IY ;IY=BC
LD B,#04 ;LETTERS
LD C,#00 ;N CHAR
LD DE,#0800 ;CENTER SCREEN
TXT_A2: LD A,#01
CALL IM2_DELAY
LD A,C
PUSH BC
PUSH IY
POP BC ;BC=IY
;OR A ;ONE COLOR
SCF ;MANY COLORS
CALL PRINT_A_CHAR
LD A,E
ADD A,FONT_SIZE ;NEXT POSITION
LD E,A
POP BC ;BC COUNTER
INC C
DJNZ TXT_A2
LD A,#04 ;GREEN COLOR
OUT (#FE),A
POP BC ;COLORS
INC B ;NEXT COLOR
POP HL
DEC HL
LD A,H
OR L
JR NZ,TXT_A1 ;NEXT FRAME
POP IX
POP HL
POP DE
POP BC
POP AF
RET
;Print character using colors attributes.
;A character from 0..3;
;F[FLAGS]:
;C is using next color on next line;
;BC first color attribute and paper;
;DE vertical and horizontal position;
;HL address of font.
PRINT_A_CHAR:
PUSH AF ;SAVE REGS
EX AF,AF' ;SAVE AF'
PUSH AF
EX AF,AF'
PUSH BC
PUSH DE
PUSH HL
PUSH IX ;NO PERFORMANCE
PUSH AF ;AF' = AF
EX AF,AF' ;C FLAG FOR
POP AF ;NEXT COLOR
EX AF,AF'
PUSH DE
LD D,#00
RLCA ;A(CHAR)*8
RLCA
RLCA
LD E,A
ADD HL,DE
PUSH HL
POP IX ;IX=HL=FONT CHAR
POP DE
LD H,FONT_SIZE ;8 LINES
PRA_C3: PUSH DE
PUSH BC
LD L,FONT_SIZE ;8 BITS(PIXELS)
PRA_C2: LD A,C
RLC (IX+0) ;IF BIT SET
JR NC,PRA_C1 ;C-10110101
LD A,B ;COLOR
PRA_C1: CALL SET_ATTRIBUTE
INC E
DEC L
JR NZ,PRA_C2
POP BC
EX AF,AF'
JR NC,PRA_C5
EX AF,AF'
LD A,B ;NEXT COLOR
AND %11000111
LD E,A ;E OTHER BITS
LD A,B ;B=01011011
AND %00111000 ;M=00111000
ADD A,%00001000 ;R=00011000
AND %00111000 ;MULTIPLY COMMON
OR E ;1+2=3 4+8=12
LD B,A ;NEW COLOR
JR PRA_C4
PRA_C5: EX AF,AF'
PRA_C4: POP DE
INC D ;NEXT LINE
INC IX
DEC H ;COUNTER LINE
JR NZ,PRA_C3
POP IX
POP HL
POP DE
POP BC
EX AF,AF' ;AF' RESTORE
POP AF
EX AF,AF'
POP AF
RET
FONT_DOTS: ;'0..9' and ':'
DB #00,#00,#00,#00,#00,#00,#00,#00
DB #00,#00,#00,#00,#10,#00,#00,#00
DB #00,#00,#00,#00,#24,#00,#00,#00
DB #00,#00,#00,#00,#54,#00,#00,#00
DB #00,#00,#44,#00,#00,#00,#44,#00
DB #00,#00,#44,#00,#10,#00,#44,#00
DB #00,#00,#44,#00,#44,#00,#44,#00
DB #00,#00,#44,#00,#54,#00,#44,#00
DB #00,#00,#54,#00,#44,#00,#54,#00
DB #00,#00,#54,#00,#54,#00,#54,#00
DB #00,#00,#00,#10,#00,#00,#10,#00
FONT_MAYA:
DB #7E,#81,#AB,#AB,#C3,#BD,#81,#7E
DB #00,#00,#00,#00,#10,#00,#00,#00
DB #00,#00,#00,#00,#24,#00,#00,#00
DB #00,#00,#00,#00,#54,#00,#00,#00
DB #00,#00,#00,#00,#55,#00,#00,#00
DB #00,#00,#00,#00,#00,#7E,#00,#00
DB #00,#00,#00,#10,#00,#7E,#00,#00
DB #00,#00,#00,#28,#00,#7E,#00,#00
DB #00,#00,#00,#54,#00,#7E,#00,#00
DB #00,#00,#00,#AA,#00,#FE,#00,#00
DB #00,#00,#00,#10,#00,#00,#10,#00
FONT_ROME:
DB #00,#A5,#42,#A5,#00,#00,#3C,#00
DB #00,#38,#10,#10,#10,#10,#38,#00
DB #00,#7E,#24,#24,#24,#24,#7E,#00
DB #00,#FE,#54,#54,#54,#54,#FE,#00
DB #00,#F1,#51,#4A,#4A,#44,#E4,#00
DB #00,#44,#44,#28,#28,#10,#10,#00
DB #00,#8F,#8A,#52,#52,#22,#27,#00
DB #00,#BF,#AA,#AA,#AA,#4A,#5F,#00
DB #00,#BF,#B5,#B5,#B5,#55,#5F,#00
DB #00,#E9,#49,#46,#46,#49,#E9,#00
DB #00,#00,#00,#10,#00,#00,#10,#00
FONT_BIT:
DB #00,#00,#54,#00,#44,#00,#54,#00
DB #00,#7C,#42,#7C,#42,#42,#7C,#00
DB #00,#3E,#08,#08,#08,#08,#3E,#00
DB #00,#FE,#10,#10,#10,#10,#10,#00
;Stream 5. IM2 setup and clear screen.
;Testing simple and fast functions.
CLEAR_SCR_FUNCS:
PUSH AF
PUSH BC
PUSH DE
LD BC,#0100
LD D,%01001111
LD E,%10101010
CLRS_1: HALT
CALL CLEAR_SCR
LD A,4
OUT (#FE),A
DEC BC
LD A,B
OR C
JR NZ,CLRS_1
LD BC,#0100
LD D,%01101111
LD E,%01010101
CLRS_2: HALT
CALL CLEAR_SCR_STACK
LD A,4
OUT (#FE),A
DEC BC
LD A,B
OR C
JR NZ,CLRS_2
POP DE
POP BC
POP AF
RET
;Clear screen functon, pixels and attr.
;DE attribute and pixel for fill.
CLEAR_SCR:
PUSH AF
PUSH BC
PUSH HL
LD HL,SCREEN_PIXELS
LD BC,SCREEN_P_SIZE
CLR_1: LD (HL),E ;TACTS:11
INC HL ;6
DEC BC ;6
LD A,B ;4
OR C ;4
JR NZ,CLR_1 ;12=43tacts
LD BC,SCREEN_A_SIZE
CLR_2: LD (HL),D ;43*6912=297k
INC HL
DEC BC
LD A,B
OR C
JR NZ,CLR_2
POP HL
POP BC
POP AF
RET
;Clear screen fast, using stack.
;DE attribute and pixel for fill.
CLEAR_SCR_STACK:
PUSH AF
PUSH BC
PUSH HL
PUSH IX
LD BC,SCREEN_ATTR_WS
LD IX,#0000
ADD IX,SP ;IX PROGRAM STACK
LD SP,SCREEN_ADDR_TOP
LD H,D
LD L,D ;TACTS:(37)
CLRF_1: PUSH HL ;11
DEC BC ;6
LD A,B ;4
OR C ;4
JR NZ,CLRF_1 ;12
LD BC,SCREEN_PIX_WS
LD H,E ;37*3456=128k
LD L,E
CLRF_2: PUSH HL
DEC BC
LD A,B
OR C
JR NZ,CLRF_2
LD SP,IX
POP IX
POP HL
POP BC
POP AF
RET
;Setup IM2 interrupt mode and function.
;DE address function to call AT 1/50s.
IM2_SETUP:
DI
PUSH AF
PUSH HL
LD H,IM2_I_REG ;HL - IM2 ADDR
LD L,IM2_B_DATA
LD A,H
LD I,A ;I - IM2
LD DE,IM2
LD (HL),E
INC HL
LD (HL),D ;[IM2] - ADDR
POP HL
POP AF
IM 2
EI
RET
;Stream 4. Interrupts and performance.
IM2_PERFORMANCE:
PUSH AF
PUSH BC
PUSH DE
PUSH HL
LD HL,#0010
LD DE,#1000
LD BC,#2008
PERF_1: ;HALT
LD A,#32
CALL IM2_DELAY
CALL DYNAMIC_COLOR_TABLE
LD A,4
OUT (#FE),A
DEC HL
LD A,H
OR L
JR NZ,PERF_1
POP HL
POP DE
POP BC
POP AF
RET
;Delay in 1/50 seconds, only with IM2.
;A delay in 1/50, 50 for 1 second.
IM2_DELAY:
PUSH AF
DELAY_1:HALT
DEC A
JR NZ,DELAY_1
POP AF
RET
;Interrupt function, called every 1/50sec.
IM2: DI
PUSH AF
;LD A,1
;OUT (#FE),A
POP AF
EI
RETI
;Stream 3. Dynamic color table.
DYNAMIC_COLOR_TABLE:
PUSH AF
PUSH BC
PUSH DE
PUSH HL
COL_T2: PUSH BC
PUSH DE
LD A,D
AND %00000111 ;COLOR
ADD A,L
AND %00000111
RLCA
RLCA
RLCA ;PAPER
LD C,A ;C = TMP
COL_T1: LD A,E ;X > 16
AND %00010000
RLCA ;
RLCA ;6 BIT BRIGHT
OR C
CALL SET_ATTRIBUTE
INC E
DJNZ COL_T1 ;NEXT COLUMN
POP DE
INC D
POP BC
DEC C
JR NZ,COL_T2
POP HL
POP DE
POP BC
POP AF
RET
;Stream 2. Set attribute at coordinates.
SCR_ATTRIB:
PUSH AF
PUSH BC
PUSH DE
LD BC,#2018
LD DE,#0000
LD A,%01011111
SCR_A2: PUSH BC
PUSH DE
SCR_A1: CALL SET_ATTRIBUTE
INC E
DJNZ SCR_A1
POP DE
INC D
POP BC
DEC C
JR NZ,SCR_A2
POP DE
POP BC
POP AF
RET
;Set attribute on screen at coordinates.
;A attribute[bits]:
;0..3 Ink,
;4..6 Paper,
;5 Bright,
;6 Flash,
;DE Vertical and horizontal
; coordinates [0..23] and [0..31].
SET_ATTRIBUTE:
PUSH DE ;Y AND X -> OFFSET
PUSH AF ;Y * 32 + X=16BITS
LD A,D ;NO CHECK
AND %00000111 ;Y=00010100
RRCA
RRCA
RRCA
OR E
LD E,A ;E LOW OFFSET
LD A,D
AND %00011000
RRCA ;D HIGH OFFSET
RRCA
RRCA
OR SCREEN_ATTRIB_H
LD D,A ;#58=01011000
POP AF
LD (DE),A
POP DE
RET
;Stream 1. Print "Hello World!"
HELLO_WORLD:
PUSH AF
PUSH BC
PUSH DE
LD A,02
CALL OPEN_CHANNEL
LD DE,STR_HELLO
LD BC,#000C
CALL PRINT_STRING
POP DE
POP BC
POP AF
RET
|
src/System/IO/Transducers/Bytes.agda
|
ilya-fiveisky/agda-system-io
| 10 |
4352
|
open import Coinduction using ( ♯_ )
open import Data.Bool using ( Bool ; true ; false ; not )
open import Data.ByteString using ( null ) renaming ( span to #span )
open import Data.Natural using ( Natural )
open import Data.Product using ( _×_ ; _,_ )
open import Data.Word using ( Byte )
open import System.IO.Transducers.Lazy using ( _⇒_ ; inp ; out ; done ; _⟫_ ; π₁ ; π₂ ; _[&]_ )
open import System.IO.Transducers.Weight using ( weight )
open import System.IO.Transducers.Stateful using ( loop )
open import System.IO.Transducers.Session using ( ⟨_⟩ ; _&_ ; ¿ ; * ; _&*_ )
open import System.IO.Transducers.Strict using ( _⇛_ )
module System.IO.Transducers.Bytes where
open System.IO.Transducers.Session public using ( Bytes ; Bytes' )
mutual
span' : (Byte → Bool) → Bytes' ⇛ (Bytes & Bytes)
span' φ x with #span φ x
span' φ x | (x₁ , x₂) with null x₁ | null x₂
span' φ x | (x₁ , x₂) | true | true = inp (♯ span φ)
span' φ x | (x₁ , x₂) | true | false = out false (out true (out x₂ done))
span' φ x | (x₁ , x₂) | false | true = out true (out x₁ (inp (♯ span φ)))
span' φ x | (x₁ , x₂) | false | false = out true (out x₁ (out false (out true (out x₂ done))))
span : (Byte → Bool) → Bytes ⇛ (Bytes & Bytes)
span φ false = out false (out false done)
span φ true = inp (♯ span' φ)
break : (Byte → Bool) → Bytes ⇛ (Bytes & Bytes)
break φ = span (λ x → not (φ x))
mutual
nonempty' : Bytes' & Bytes ⇛ ¿ Bytes & Bytes
nonempty' x with null x
nonempty' x | true = inp (♯ nonempty)
nonempty' x | false = out true (out true (out x done))
nonempty : Bytes & Bytes ⇛ ¿ Bytes & Bytes
nonempty true = inp (♯ nonempty')
nonempty false = out false done
split? : (Byte → Bool) → Bytes ⇒ (¿ Bytes & Bytes)
split? φ = inp (♯ span φ) ⟫ π₂ {Bytes} ⟫ inp (♯ break φ) ⟫ inp (♯ nonempty)
split : (Byte → Bool) → Bytes ⇒ * Bytes
split φ = loop {Bytes} (split? φ) ⟫ π₁
bytes : Bytes ⇒ ⟨ Natural ⟩
bytes = weight
|
programs/oeis/003/A003151.asm
|
neoneye/loda
| 22 |
167474
|
; A003151: Beatty sequence for 1+sqrt(2); a(n) = floor(n*(1+sqrt(2))).
; 2,4,7,9,12,14,16,19,21,24,26,28,31,33,36,38,41,43,45,48,50,53,55,57,60,62,65,67,70,72,74,77,79,82,84,86,89,91,94,96,98,101,103,106,108,111,113,115,118,120,123,125,127,130,132,135,137,140,142,144,147,149,152,154,156,159,161,164,166,168,171,173,176,178,181,183,185,188,190,193,195,197,200,202,205,207,210,212,214,217,219,222,224,226,229,231,234,236,239,241
max $2,$0
seq $0,87057 ; Smallest number whose square is larger than 2*n^2.
add $0,$2
|
bb-runtimes/runtimes/ravenscar-sfp-stm32g474/gnarl/s-musplo.ads
|
JCGobbi/Nucleo-STM32G474RE
| 0 |
27043
|
<gh_stars>0
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . M U L T I P R O C E S S O R S . S P I N _ L O C K S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2010-2021, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- 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/>. --
-- --
------------------------------------------------------------------------------
package System.Multiprocessors.Spin_Locks is
pragma Preelaborate;
---------------
-- Spin lock --
---------------
type Atomic_Flag is mod 2**8;
pragma Atomic (Atomic_Flag);
Unlocked : constant Atomic_Flag := 0;
type Spin_Lock is limited record
Flag : aliased Atomic_Flag := Unlocked;
end record;
-- The default value of a Spin_Lock is unlocked
procedure Lock (Slock : in out Spin_Lock);
pragma Inline (Lock);
-- Loop until lock is acquired
function Locked (Slock : Spin_Lock) return Boolean;
pragma Inline (Locked);
-- Return the current state of the lock
procedure Try_Lock (Slock : in out Spin_Lock; Succeeded : out Boolean);
pragma Inline (Try_Lock);
-- Return True if the lock has been acquired, otherwise don't wait for the
-- lock and return False.
procedure Unlock (Slock : in out Spin_Lock);
pragma Inline (Unlock);
-- Release the lock
end System.Multiprocessors.Spin_Locks;
|
src/hershey_fonts/giza-hershey_fonts.ads
|
Fabien-Chouteau/Giza
| 7 |
30469
|
<filename>src/hershey_fonts/giza-hershey_fonts.ads
------------------------------------------------------------------------------
-- --
-- Giza --
-- --
-- Copyright (C) 2016 <NAME> (<EMAIL>) --
-- --
-- --
-- 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 Interfaces;
with Giza.Context; use Giza.Context;
with Giza.Font; use Giza.Font;
package Giza.Hershey_Fonts is
subtype Parent is Font.Instance;
type Hershey_Font (Number_Of_Glyphs : Natural) is new Parent with private;
overriding
procedure Glyph_Box (This : Hershey_Font;
C : Character;
Width, Height, X_Advance : out Natural;
X_Offset, Y_Offset : out Integer);
overriding
procedure Print_Glyph (This : Hershey_Font;
Ctx : in out Context.Class;
C : Character);
overriding
function Y_Advance (This : Hershey_Font) return Integer;
private
type Coord is new Interfaces.Integer_8 with Size => 8;
type Vect is record
X, Y : Coord;
end record with Pack;
Raise_Pen : constant Vect := (Coord'Last, Coord'Last);
type Vect_Array is array (Natural range <>) of Vect with Pack;
type Glyph (Number_Of_Vectors : Natural) is record
Width, Height, Y_Offset, X_Offset : Coord;
Vects : Vect_Array (1 .. Number_Of_Vectors);
end record;
type Glyph_Access is not null access constant Glyph;
subtype Glyph_Index is Positive;
type Glyph_Access_Array is array (Positive range <>) of Glyph_Access;
type Hershey_Font (Number_Of_Glyphs : Natural) is new Parent with record
Glyphs : Glyph_Access_Array (1 .. Number_Of_Glyphs);
Y_Advance : Coord;
end record;
Empty_Glyph : aliased constant Glyph :=
(Number_Of_Vectors => 0,
Width => 0,
Height => 0,
Y_Offset => 0,
X_Offset => 0,
Vects => (others => (Raise_Pen)));
end Giza.Hershey_Fonts;
|
u7bg/eop-produceItemLabelText.asm
|
JohnGlassmyer/UltimaHacks
| 68 |
28851
|
%include "include/u7bg-all-includes.asm"
%macro callProduceItemDisplayName 0
push word [bp+var_itemFrame]
push word [bp+var_itemQuantity]
push word [bp+var_itemType]
push word [bp+arg_pn_string]
callFromOverlay produceItemDisplayName
add sp, 8
%endmacro
%include "../u7-common/patch-eop-produceItemLabelText.asm"
|
test/Fail/Issue1499.agda
|
cruhland/agda
| 1,989 |
2186
|
<reponame>cruhland/agda
-- 2015-05-05 Bad error message
_=R_ : Rel → Rel → Set
R =R S : (R ⊆ S) × (S ⊆ R) -- here is a typo, : instead of =
ldom : Rel → Pred
ldom R a = ∃ λ b → R a b
-- More than one matching type signature for left hand side ldom R a
-- it could belong to any of: ldom R
|
src/test/resources/data/generationtests/sjasmplus-test7-expected.asm
|
cpcitor/mdlz80optimizer
| 36 |
89185
|
; Test case for the repetition macro in sjasmplus (and also, adding a BASIC-style EOF character at the end of this file)
N: equ 1
call f1 ; this should be repeated 4 times
call f1 ; this should be repeated 4 times
call f1 ; this should be repeated 4 times
call f1 ; this should be repeated 4 times
nop ; this should be repeated twice
nop ; this should be repeated twice
loop:
jr loop
f1:
ret
|
_anim/obj1F.asm
|
vladjester2020/Sonic1TMR
| 0 |
21532
|
<gh_stars>0
; ---------------------------------------------------------------------------
; Animation script - Crabmeat enemy
; ---------------------------------------------------------------------------
dc.w byte_972A-Ani_obj1F, byte_972E-Ani_obj1F, byte_9732-Ani_obj1F
dc.w byte_9736-Ani_obj1F, byte_973C-Ani_obj1F, byte_9742-Ani_obj1F
dc.w byte_9748-Ani_obj1F, byte_974C-Ani_obj1F
byte_972A: dc.b $F, 0, $FF, 0
byte_972E: dc.b $F, 2, $FF, 0
byte_9732: dc.b $F, $22, $FF, 0
byte_9736: dc.b $F, 1, $21, 0, $FF, 0
byte_973C: dc.b $F, $21, 3, 2, $FF, 0
byte_9742: dc.b $F, 1, $23, $22, $FF, 0
byte_9748: dc.b $F, 4, $FF, 0
byte_974C: dc.b 1, 5, 6, $FF
even
|
misc/Parallel/Index.agda
|
yurrriq/parser-combinators
| 7 |
11621
|
<reponame>yurrriq/parser-combinators
------------------------------------------------------------------------
-- Indices
------------------------------------------------------------------------
module Parallel.Index where
open import Data.Product.Record
import Data.Product as Prod; open Prod using () renaming (_,_ to pair)
open import Data.Bool using (Bool; true; false; _∨_; _∧_; if_then_else_)
open import Data.Bool.Properties as Bool
open import Data.Nat using (ℕ; zero; suc; _⊔_)
open import Data.Nat.Properties
open import Algebra
import Algebra.Props.BooleanAlgebra as BAlg
import Algebra.Props.DistributiveLattice as DL
private
module NR = CommutativeSemiringWithoutOne
⊔-⊓-0-commutativeSemiringWithoutOne
module NL = DL distributiveLattice
module BR = CommutativeSemiring Bool.commutativeSemiring-∨-∧
module BA = BAlg Bool.booleanAlgebra
import Relation.Binary.PropositionalEquality as PropEq
open PropEq hiding (setoid)
open ≡-Reasoning
open import Data.Function
open import Relation.Nullary
------------------------------------------------------------------------
-- The index type
-- Does the parser accept the empty string?
Empty : Set
Empty = Bool
-- The maximum "distance" to the next parser which is guaranteed to
-- either consume a token or fail.
Distance : Set
Distance = ℕ
-- Parser indices. Note that it is important that the record type used
-- here has η-equality, since otherwise it would be harder to infer
-- the types.
Index : Set
Index = Empty × Distance
import Algebra.FunctionProperties as P; open P (PropEq.setoid Index)
------------------------------------------------------------------------
-- The basic operations on indices
infixl 50 _·I_
infixl 40 _∣I_
0I : Index
0I = (false , zero)
1I : Index
1I = (true , zero)
_·I_ : Index -> Index -> Index
i₁ ·I i₂ = ( proj₁ i₁ ∧ proj₁ i₂
, (if proj₁ i₁ then proj₂ i₁ ⊔ proj₂ i₂
else proj₂ i₁)
)
_∣I_ : Index -> Index -> Index
i₁ ∣I i₂ = (proj₁ i₁ ∨ proj₁ i₂ , proj₂ i₁ ⊔ proj₂ i₂)
------------------------------------------------------------------------
-- These operations satisfy some algebraic properties
private
-- TODO: General code for taking the product of two commutative
-- monoids. However, I don't want to define this operation for both
-- Data.Product and Data.Product.Record. Hence I'll probably wait
-- (at least) until pattern matching on records is possible, since I
-- plan to merge Data.Product and Data.Product.Record then.
∣-assoc : Associative _∣I_
∣-assoc i₁ i₂ i₃ =
cong₂ _,_ (BR.+-assoc (proj₁ i₁) (proj₁ i₂) (proj₁ i₃))
(NR.+-assoc (proj₂ i₁) (proj₂ i₂) (proj₂ i₃))
∣-comm : Commutative _∣I_
∣-comm i₁ i₂ =
cong₂ _,_ (BR.+-comm (proj₁ i₁) (proj₁ i₂))
(NR.+-comm (proj₂ i₁) (proj₂ i₂))
∣-identity : Identity 0I _∣I_
∣-identity = pair
(\i -> cong₂ _,_ (Prod.proj₁ BR.+-identity (proj₁ i))
(Prod.proj₁ NR.+-identity (proj₂ i)))
(\i -> cong₂ _,_ (Prod.proj₂ BR.+-identity (proj₁ i))
(Prod.proj₂ NR.+-identity (proj₂ i)))
·-assoc : Associative _·I_
·-assoc i₁ i₂ i₃ with proj₁ i₁ | proj₁ i₂
·-assoc i₁ i₂ i₃ | false | e₂ = refl
·-assoc i₁ i₂ i₃ | true | false = refl
·-assoc i₁ i₂ i₃ | true | true =
cong (_,_ (proj₁ i₃)) (NR.+-assoc (proj₂ i₁) (proj₂ i₂) (proj₂ i₃))
·-identity : Identity 1I _·I_
·-identity = pair (\_ -> refl) (\x -> helper (proj₁ x) (proj₂ x))
where
helper : forall e d ->
_≡_ {a = Index} (e ∧ true , (if e then d ⊔ zero else d))
(e , d)
helper false d = refl
helper true d = cong (_,_ true) (Prod.proj₂ NR.+-identity d)
·-∣-distrib : _·I_ DistributesOver _∣I_
·-∣-distrib = pair
(\i₁ i₂ i₃ ->
cong₂ _,_
(Prod.proj₁ BR.distrib (proj₁ i₁) (proj₁ i₂) (proj₁ i₃))
(distribˡ₂ (proj₂ i₁) (proj₂ i₂) (proj₂ i₃) (proj₁ i₁)))
(\i₁ i₂ i₃ ->
cong₂ _,_
(Prod.proj₂ BR.distrib (proj₁ i₁) (proj₁ i₂) (proj₁ i₃))
(distribʳ₂ (proj₂ i₁) (proj₂ i₂) (proj₂ i₃)
(proj₁ i₂) (proj₁ i₃)))
where
lemma : forall d₁ d₂ d₃ -> d₁ ⊔ (d₂ ⊔ d₃) ≡ d₁ ⊔ d₂ ⊔ (d₁ ⊔ d₃)
lemma d₁ d₂ d₃ = begin
d₁ ⊔ (d₂ ⊔ d₃) ≡⟨ sym (NL.∧-idempotent d₁)
⟨ NR.+-pres-≈ ⟩
byDef {x = d₂ ⊔ d₃} ⟩
d₁ ⊔ d₁ ⊔ (d₂ ⊔ d₃) ≡⟨ NR.+-assoc d₁ d₁ (d₂ ⊔ d₃) ⟩
d₁ ⊔ (d₁ ⊔ (d₂ ⊔ d₃)) ≡⟨ byDef {x = d₁} ⟨ NR.+-pres-≈ ⟩
sym (NR.+-assoc d₁ d₂ d₃) ⟩
d₁ ⊔ (d₁ ⊔ d₂ ⊔ d₃) ≡⟨ byDef {x = d₁} ⟨ NR.+-pres-≈ ⟩
(NR.+-comm d₁ d₂ ⟨ NR.+-pres-≈ ⟩
byDef {x = d₃}) ⟩
d₁ ⊔ (d₂ ⊔ d₁ ⊔ d₃) ≡⟨ byDef {x = d₁} ⟨ NR.+-pres-≈ ⟩
NR.+-assoc d₂ d₁ d₃ ⟩
d₁ ⊔ (d₂ ⊔ (d₁ ⊔ d₃)) ≡⟨ sym $ NR.+-assoc d₁ d₂ (d₁ ⊔ d₃) ⟩
d₁ ⊔ d₂ ⊔ (d₁ ⊔ d₃) ∎
distribˡ₂ : forall d₁ d₂ d₃ e₁ ->
(if e₁ then d₁ ⊔ (d₂ ⊔ d₃) else d₁) ≡
(if e₁ then d₁ ⊔ d₂ else d₁) ⊔
(if e₁ then d₁ ⊔ d₃ else d₁)
distribˡ₂ d₁ d₂ d₃ true = lemma d₁ d₂ d₃
distribˡ₂ d₁ d₂ d₃ false = sym (NL.∧-idempotent d₁)
distribʳ₂ : forall d₁ d₂ d₃ e₂ e₃ ->
(if e₂ ∨ e₃ then d₂ ⊔ d₃ ⊔ d₁ else d₂ ⊔ d₃)
≡
(if e₂ then d₂ ⊔ d₁ else d₂) ⊔
(if e₃ then d₃ ⊔ d₁ else d₃)
distribʳ₂ d₁ d₂ d₃ true true = begin
d₂ ⊔ d₃ ⊔ d₁ ≡⟨ NR.+-comm (d₂ ⊔ d₃) d₁ ⟩
d₁ ⊔ (d₂ ⊔ d₃) ≡⟨ lemma d₁ d₂ d₃ ⟩
d₁ ⊔ d₂ ⊔ (d₁ ⊔ d₃) ≡⟨ NR.+-comm d₁ d₂ ⟨ NR.+-pres-≈ ⟩
NR.+-comm d₁ d₃ ⟩
d₂ ⊔ d₁ ⊔ (d₃ ⊔ d₁) ∎
distribʳ₂ d₁ d₂ d₃ true false = begin
d₂ ⊔ d₃ ⊔ d₁ ≡⟨ NR.+-assoc d₂ d₃ d₁ ⟩
d₂ ⊔ (d₃ ⊔ d₁) ≡⟨ byDef {x = d₂} ⟨ NR.+-pres-≈ ⟩
NR.+-comm d₃ d₁ ⟩
d₂ ⊔ (d₁ ⊔ d₃) ≡⟨ sym $ NR.+-assoc d₂ d₁ d₃ ⟩
d₂ ⊔ d₁ ⊔ d₃ ∎
distribʳ₂ d₁ d₂ d₃ false true = NR.+-assoc d₂ d₃ d₁
distribʳ₂ d₁ d₂ d₃ false false = refl
·-idempotent : Idempotent _·I_
·-idempotent i = cong₂ _,_ (BA.∧-idempotent (proj₁ i))
(lemma (proj₁ i) (proj₂ i))
where
lemma : forall b x -> (if b then x ⊔ x else x) ≡ x
lemma true x = NL.∧-idempotent x
lemma false x = refl
∣-idempotent : Idempotent _∣I_
∣-idempotent i = cong₂ _,_ (BA.∨-idempotent (proj₁ i))
(NL.∧-idempotent (proj₂ i))
-- Not quite a semiring, but the proper name is too long...
indexSemiring : SemiringWithoutAnnihilatingZero
indexSemiring = record
{ setoid = PropEq.setoid Index
; _+_ = _∣I_
; _*_ = _·I_
; 0# = 0I
; 1# = 1I
; isSemiringWithoutAnnihilatingZero = record
{ +-isCommutativeMonoid = record
{ isMonoid = record
{ isSemigroup = record
{ assoc = ∣-assoc
; ∙-pres-≈ = cong₂ _∣I_
}
; identity = ∣-identity
}
; comm = ∣-comm
}
; *-isMonoid = record
{ isSemigroup = record
{ assoc = ·-assoc
; ∙-pres-≈ = cong₂ _·I_
}
; identity = ·-identity
}
; distrib = ·-∣-distrib
}
}
module IndexSemiring =
SemiringWithoutAnnihilatingZero indexSemiring
nearSemiring : NearSemiring
nearSemiring = record
{ setoid = setoid
; _+_ = _+_
; _*_ = _*_
; 0# = 0#
; isNearSemiring = record
{ +-isMonoid = +-isMonoid
; *-isSemigroup = *-isSemigroup
; distribʳ = Prod.proj₂ distrib
; zeroˡ = \_ -> PropEq.refl
}
}
where open IndexSemiring
private
lemma : suc zero ≢ zero
lemma ()
-- The indices very nearly form a semiring (∣I, ·I, 0I, 1I). The
-- only missing piece is that 0I is not a right zero for ·I:
notRightZero : ¬ RightZero 0I _·I_
notRightZero zeroʳ = lemma $ cong proj₂ $
zeroʳ (false , suc zero)
-- It might also be worth noting that ·I is not commutative:
notCommutative : ¬ Commutative _·I_
notCommutative comm = lemma $ cong proj₂ $
comm (true , suc zero) (false , zero)
-- Note that we don't want these properties to be true. The second
-- one implies the first, and the first implies that
-- p = p ⊛> symbol
-- is an OK definition, even though it is left recursive.
|
Samveen's example OS/seos/interpret.asm
|
samveen/teasers
| 0 |
245115
|
<filename>Samveen's example OS/seos/interpret.asm
; Code for the main command interpreter executable
; Copyright (c) 2003 onwards, <NAME>
; The SEOS executable format lacks a signature
; This is purely machine instructions and data
jmp _main
start_interpreter_byte db 0xFF
; this is the commands table
; it is used both for parsing the commands as well as the help string
; to display for the help command
command_table_start:
command_table_clear db "clear", ": clears the screen" , 0xd ; help_string + newline
command_table_exit db "exit ", ": exits from the interpreter" , 0xd ; help_string + newline
command_table_help db "help ", ": help for commands" , 0xd ; help_string + newline
command_table_pgup db "pgup ", ": show previous screenful of output", 0xd ; help_string + newline
command_table_reset db "reset", ": reset the system(soft)" , 0xd ; help_string + newline
command_table_exec db "exec ", ": execute a file" , 0xd ; help_string + newline
command_table_list db "list ", ": list files on fs" , 0xd ; help_string + newline
command_table_type db "type ", ": load a file and display it" , 0xd ; help_string + newline
command_table_end db 0
;data
command_prompt db "SEOS :",0
command_line:
times 255 db 0x00
file_name_prompt db "File Name :",0
file_name:
times 64 db 0x00
unknown_command_message db "unknown command",0xd,0
not_found_string db " not found",0xd,0
not_exec_string db " not executable",0xd,0
; the main command interpreter
_main:
push cs
pop ds
loop_main: ; The main loop
mov ah,5
mov edx,command_prompt
int 40h
mov edx, command_line
mov cl, 254
mov ah,1
int 41h
call parse_command_line
call exec_command_line
cmp cl,0
jnz loop_main
retf
;---------------------------------
; function to parse the command line that is convert the string
; in command_line to a number that is then passed to the
; exec_command_line function
; leaves the returned value in dx
parse_command_line:
cmp byte [command_line], 0
jnz parse_command_line_not_null
mov dx, 0
jmp parse_command_line_cleanup
parse_command_line_not_null:
mov si, command_line
lodsd
;test for commands
cmp dword [command_table_clear], eax
jz parse_command_line_clear_command
cmp dword [command_table_exit], eax
jz parse_command_line_exit_command
cmp dword [command_table_help], eax
jz parse_command_line_help_command
cmp dword [command_table_pgup], eax
jz parse_command_line_pgup_command
cmp dword [command_table_reset], eax
jz parse_command_line_reset_command
cmp dword [command_table_exec], eax
jz parse_command_line_exec_command
cmp dword [command_table_list],eax
jz parse_command_line_list_command
cmp dword [command_table_type],eax
jz parse_command_line_type_command
mov dx, -1
jmp parse_command_line_cleanup
parse_command_line_clear_command:
mov dx, 1
jmp parse_command_line_cleanup
parse_command_line_exit_command:
mov dx, 2
jmp parse_command_line_cleanup
parse_command_line_help_command:
mov dx, 3
jmp parse_command_line_cleanup
parse_command_line_pgup_command:
mov dx ,4
jmp parse_command_line_cleanup
parse_command_line_reset_command:
mov dx ,5
jmp parse_command_line_cleanup
parse_command_line_exec_command:
mov dx ,6
jmp parse_command_line_cleanup
parse_command_line_list_command:
mov dx ,7
jmp parse_command_line_cleanup
parse_command_line_type_command:
mov dx ,8
jmp parse_command_line_cleanup
parse_command_line_cleanup:
ret
;---------------------------------
;---------------------------------
; function to exec the command line that is has been
; parsed by the parse_command_line function into a number
retval db 0h
exec_command_line:
mov [retval],1
cmp dx,1
jb exec_command_line_cleanup
je exec_command_line_clear_command
cmp dx,3
jb exec_command_line_exit_command
je exec_command_line_help_command
cmp dx,5
jb exec_command_line_pgup_command
je exec_command_line_reset_command
cmp dx,7
jb exec_command_line_exec_command
je exec_command_line_list_command
cmp dx,9
jb exec_command_line_type_command
mov edx, unknown_command_message
mov ah,5
int 40h
jmp exec_command_line_cleanup
exec_command_line_clear_command:
xor ah, ah
int 40h
jmp exec_command_line_cleanup
exec_command_line_exit_command:
mov [retval],0
jmp exec_command_line_cleanup
exec_command_line_help_command:
mov edx,command_table_start
mov ah, 5
int 40h
jmp exec_command_line_cleanup
exec_command_line_pgup_command:
mov ah,7 ;call show_command_history
int 40h
mov ah,0
int 41h
mov ah,6
int 40h
jmp exec_command_line_cleanup
exec_command_line_reset_command:
int 19h
jmp exec_command_line_cleanup
exec_command_line_exec_command:
mov ah,5
mov edx,file_name_prompt
int 40h
mov edx, file_name
mov cl, 63
mov ah,1
int 41h
cmp byte [file_name] , 0
jz exec_command_line_exec_command_end
mov ebx, 0 ; ebx = offset
mov cx,7000h ; buffer segment ; 16 bit
mov ah,2 ; load file
int 42h
cmp cx, 0
jnz exec_command_line_exec_command_found
mov edx, file_name
mov ah,5
int 40h
cmp al, 0
jnz exec_command_line_exec_command_not_exec
mov ah,5
mov edx, not_found_string
int 40h
jmp exec_command_line_exec_command_end
exec_command_line_exec_command_not_exec:
mov ah,5
mov edx, not_exec_string
int 40h
jmp exec_command_line_exec_command_end
exec_command_line_exec_command_found:
push ds
call far 7000h:0000
pop ds
exec_command_line_exec_command_end:
jmp exec_command_line_cleanup
exec_command_line_list_command:
mov ah,1
int 42h
jmp exec_command_line_cleanup
exec_command_line_type_command:
mov ah,5
mov edx,file_name_prompt
int 40h
mov edx, file_name
mov cl, 63
mov ah,1
int 41h
cmp byte [file_name] , 0
jz exec_command_line_type_command_end
mov ebx, 0 ; ebx = offset
mov cx,7000h ; buffer segment ; 16 bit
mov ah,3 ; load file
int 42h
cmp cx, 0
jnz exec_command_line_type_command_found
mov edx, file_name
mov ah,5
int 40h
mov ah,5
mov edx, not_found_string
int 40h
jmp exec_command_line_type_command_end
exec_command_line_type_command_found:
push ds
; set source
push 7000h
pop ds
mov esi, 0000
;count is in cx
cld
display_loop:
lodsb
mov ah,4
int 40h
loop display_loop
pop ds
exec_command_line_type_command_end:
jmp exec_command_line_cleanup
exec_command_line_cleanup:
mov cl, [retval]
ret
;---------------------------------
;last data
end_interpreter_byte db 0xFF
|
Transynther/x86/_processed/US/_ht_zr_un_/i9-9900K_12_0xa0_notsx.log_339_923.asm
|
ljhsiun2/medusa
| 9 |
99858
|
<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %rax
push %rbp
push %rdx
lea addresses_UC_ht+0x1bdd9, %r11
nop
nop
nop
nop
nop
mfence
mov (%r11), %rbp
nop
nop
nop
nop
nop
cmp $59435, %r12
lea addresses_D_ht+0xf899, %rax
nop
nop
nop
and $7805, %rdx
mov (%rax), %r11w
nop
nop
nop
add $61071, %rax
lea addresses_WT_ht+0x19499, %rbp
clflush (%rbp)
add $61944, %rdx
mov $0x6162636465666768, %rax
movq %rax, %xmm1
movups %xmm1, (%rbp)
xor %rdx, %rdx
lea addresses_D_ht+0x190d9, %r12
nop
nop
nop
nop
xor $46368, %rax
and $0xffffffffffffffc0, %r12
vmovaps (%r12), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %rbp
sub %r15, %r15
lea addresses_A_ht+0x1a159, %rbp
clflush (%rbp)
nop
nop
nop
nop
nop
xor $64520, %rax
movw $0x6162, (%rbp)
nop
nop
nop
nop
nop
add $19892, %rax
pop %rdx
pop %rbp
pop %rax
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %r8
push %rcx
push %rdx
// Faulty Load
lea addresses_US+0x56d9, %r8
nop
nop
nop
cmp $33733, %r10
movups (%r8), %xmm2
vpextrq $1, %xmm2, %r13
lea oracles, %r15
and $0xff, %r13
shlq $12, %r13
mov (%r15,%r13,1), %r13
pop %rdx
pop %rcx
pop %r8
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': True, 'size': 32, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 6}}
{'ff': 264, '46': 2, 'f8': 45, '00': 28}
00 ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff 00 00 ff 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff 46 ff 00 ff 00 ff ff ff ff 00 ff ff ff ff ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 ff ff 00 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 ff ff ff ff ff ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 ff 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 46 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 ff ff f8 ff ff f8 f8 ff ff ff ff f8 ff f8 f8 ff ff ff ff 00 00 00 ff f8 f8 f8 ff f8 f8 ff f8 f8 f8 ff ff ff ff ff ff f8 f8 ff ff 00 ff ff f8 ff f8 ff ff f8 ff 00 f8 ff f8 f8 f8 f8 f8 ff ff f8 ff f8 ff f8 f8 f8 ff ff f8 f8 f8 ff ff f8 f8 f8 ff ff ff ff f8 ff f8 ff ff ff ff f8 f8 f8 f8 ff f8 ff ff ff 00 f8 ff f8 ff ff
*/
|
base/mvdm/dos/v86/doskrnl/bios/sysinit2.asm
|
npocmaka/Windows-Server-2003
| 17 |
170292
|
<reponame>npocmaka/Windows-Server-2003
page ,160
title bios system initialization
;
;----------------------------------------------------------------------------
;
; Modification history
;
; 26-Feb-1991 sudeepb Ported for NT DOSEm
;----------------------------------------------------------------------------
include version.inc ; set version build flags
include biosseg.inc ; establish bios segment structure
lf equ 10
cr equ 13
tab equ 9
; the following depends on the positions of the various letters in switchlist
switchnum equ 11111000b ; which switches require number
ifdef NEC_98
include bpb.inc
endif ;NEC_98
include syscall.inc
include doscntry.inc
include devsym.inc
include ioctl.inc
include devmark.inc ; needed
ifndef NEC_98
stacksw equ true ;include switchable hardware stacks
else ;NEC_98
stacksw equ false ;include switchable hardware stacks
endif ;NEC_98
if ibmjapver
noexec equ true
else
noexec equ false
endif
ifdef NEC_98
Bios_Data segment
extrn ec35_flag: byte
Bios_Data ends
endif ;NEC_98
sysinitseg segment public
assume cs:sysinitseg,ds:nothing,es:nothing,ss:nothing
extrn badopm:byte,crlfm:byte,badcom:byte,badmem:byte,badblock:byte
extrn badsiz_pre:byte,badld_pre:byte
extrn dosinfo:dword
extrn memory_size:word,fcbs:byte,keep:byte
extrn default_drive:byte,confbot:word,alloclim:word
extrn buffers:word,zero:byte,sepchr:byte
extrn files:byte
extrn count:word,chrptr:word
extrn bufptr:byte,memlo:word,prmblk:byte,memhi:word
extrn ldoff:word,area:word,packet:byte,unitcount:byte,
extrn break_addr:dword,bpb_addr:dword,drivenumber:byte
extrn com_level:byte, cmmt:byte, cmmt1:byte, cmmt2:byte
extrn cmd_indicator:byte
extrn donotshownum:byte
extrn multdeviceflag:byte
extrn devmark_addr:word
extrn setdevmarkflag:byte
extrn org_count:word
extrn pararound:near
extrn getchr:near
extrn stall:near
extrn error_line:near
extrn DevEntry:dword
insert_blank db 0 ; M051: indicates that blank has been
; M051: inserted
ifdef JAPAN
extrn badmem2:byte,badld_pre2:byte
extrn IsDBCSCodePage:near
endif
public int24,open_dev,organize,mem_err,newline,calldev,badload
public prndev,auxdev,config,commnd,condev,getnum,badfil,prnerr
public round,delim,print
ifndef NEC_98
public parseline,
else ;NEC_98
public setparms, parseline, diddleback
endif ;NEC_98
public setdoscountryinfo,set_country_path,move_asciiz
public cntry_drv,cntry_root,cntry_path
public delim
public pathstring
public MseDev ; NTVDM internal mouse driver
ifdef NEC_98
;----------------------------------------------------------------------------
;
; procedure : setparms
;
; the following set of routines is used to parse the drivparm = command in
; the config.sys file to change the default drive parameters.
;
;----------------------------------------------------------------------------
;
setparms proc near
push ds
push ax
push bx
push cx
push dx
push cs
pop ds
assume ds:sysinitseg
xor bx,bx
mov bl,byte ptr drive
inc bl ; get it correct for ioctl
; call (1=a,2=b...)
mov dx,offset deviceparameters
mov ah,ioctl
mov al,generic_ioctl
mov ch,rawio
mov cl,set_device_parameters
int 21h
test word ptr switches, flagec35
jz not_ec35
mov cl,byte ptr drive ; which drive was this for?
mov ax,Bios_Data ; get Bios_Data segment
mov ds,ax ; set Bios_Data segment
assume ds:Bios_Data
mov al,1 ; assume drive 0
shl al,cl ; set proper bit depending on drive
or ds:ec35_flag,al ; set the bit in the permanent flags
not_ec35:
pop dx ; fix up all the registers
pop cx
pop bx
pop ax
pop ds
assume ds:nothing
ret
setparms endp
;
;----------------------------------------------------------------------------
;
; procedure : diddleback
;
; replace default values for further drivparm commands
;
;----------------------------------------------------------------------------
;
diddleback proc near
push ds
push cs
pop ds
assume ds:sysinitseg
mov word ptr deviceparameters.dp_cylinders,80
mov byte ptr deviceparameters.dp_devicetype, dev_3inch720kb
mov word ptr deviceparameters.dp_deviceattributes,0
mov word ptr switches,0 ; zero all switches
pop ds
assume ds:nothing
ret
diddleback endp
endif ;NEC_98
;
;----------------------------------------------------------------------------
;
; procedure : parseline
;
; entry point is parseline. al contains the first character in command line.
;
;----------------------------------------------------------------------------
;
parseline proc near
; don't get character first time
push ds
push cs
pop ds
assume ds:sysinitseg
nextswtch:
cmp al,cr ; carriage return?
jz done_line
cmp al,lf ; linefeed?
jz put_back ; put it back and done
; anything less or equal to a space is ignored.
cmp al,' ' ; space?
jbe get_next ; skip over space
cmp al,'/'
jz getparm
stc ; mark error invalid-character-in-input
jmp short exitpl
getparm:
call check_switch
mov word ptr switches,bx ; save switches read so far
jc swterr
get_next:
call getchr
jc done_line
jmp nextswtch
swterr:
jmp short exitpl ; exit if error
done_line:
test word ptr switches,flagdrive ; see if drive specified
jnz okay
stc ; mark error no-drive-specified
jmp short exitpl
okay:
ifndef NEC_98
; mov ax,word ptr switches
; and ax,0003h ; get flag bits for changeline and non-rem
; mov word ptr deviceparameters.dp_deviceattributes,ax
; mov word ptr deviceparameters.dp_tracktableentries, 0
; clc ; everything is fine
; call setdeviceparameters
else ;NEC_98
mov ax,word ptr switches
and ax,0003h ; get flag bits for changeline and non-rem
mov word ptr deviceparameters.dp_deviceattributes,ax
mov word ptr deviceparameters.dp_tracktableentries, 0
clc ; everything is fine
call setdeviceparameters
endif ;NEC_98
exitpl:
pop ds
ret
put_back:
inc count ; one more char to scan
dec chrptr ; back up over linefeed
jmp short done_line
parseline endp
;
;----------------------------------------------------------------------------
;
; procedure : check_switch
;
; processes a switch in the input. it ensures that the switch is valid, and
; gets the number, if any required, following the switch. the switch and the
; number *must* be separated by a colon. carry is set if there is any kind of
; error.
;
;----------------------------------------------------------------------------
;
check_switch proc near
call getchr
jc err_check
and al,0dfh ; convert it to upper case
cmp al,'A'
jb err_check
cmp al,'Z'
ja err_check
push es
push cs
pop es
mov cl,byte ptr switchlist ; get number of valid switches
mov ch,0
mov di,1+offset switchlist ; point to string of valid switches
repne scasb
pop es
jnz err_check
mov ax,1
shl ax,cl ; set bit to indicate switch
mov bx,word ptr switches ; get switches so far
or bx,ax ; save this with other switches
mov cx,ax
test ax, switchnum ; test against switches that require number to follow
jz done_swtch
call getchr
jc err_swtch
cmp al,':'
jnz err_swtch
call getchr
push bx ; preserve switches
mov byte ptr cs:sepchr,' ' ; allow space separators
call getnum
mov byte ptr cs:sepchr,0
pop bx ; restore switches
; because getnum does not consider carriage-return or line-feed as ok, we do
; not check for carry set here. if there is an error, it will be detected
; further on (hopefully).
call process_num
done_swtch:
clc
ret
err_swtch:
xor bx,cx ; remove this switch from the records
err_check:
stc
ret
check_switch endp
;
;----------------------------------------------------------------------------
;
; procedure : process_num
;
; this routine takes the switch just input, and the number following (if any),
; and sets the value in the appropriate variable. if the number input is zero
; then it does nothing - it assumes the default value that is present in the
; variable at the beginning. zero is ok for form factor and drive, however.
;
;----------------------------------------------------------------------------
;
process_num proc near
test word ptr switches,cx ; if this switch has been done before,
jnz done_ret ; ignore this one.
test cx,flagdrive
jz try_f
mov byte ptr drive,al
jmp short done_ret
try_f:
test cx,flagff
jz try_t
; ensure that we do not get bogus form factors that are not supported
ifndef NEC_98
; mov byte ptr deviceparameters.dp_devicetype,al
else ;NEC_98
mov byte ptr deviceparameters.dp_devicetype,al
endif ;NEC_98
jmp short done_ret
try_t:
or ax,ax
jz done_ret ; if number entered was 0, assume default value
test cx,flagcyln
jz try_s
ifndef NEC_98
; mov word ptr deviceparameters.dp_cylinders,ax
else ;NEC_98
mov word ptr deviceparameters.dp_cylinders,ax
endif ;NEC_98
jmp short done_ret
try_s:
test cx,flagseclim
jz try_h
mov word ptr slim,ax
jmp short done_ret
; must be for number of heads
try_h:
mov word ptr hlim,ax
done_ret:
clc
ret
process_num endp
ifdef NEC_98
; M047 -- Begin modifications (too numerous to mark specifically)
;
;----------------------------------------------------------------------------
;
; procedure : setdeviceparameters
;
; setdeviceparameters sets up the recommended bpb in each bds in the
; system based on the form factor. it is assumed that the bpbs for the
; various form factors are present in the bpbtable. for hard files,
; the recommended bpb is the same as the bpb on the drive.
; no attempt is made to preserve registers since we are going to jump to
; sysinit straight after this routine.
;
; if we return carry, the DRIVPARM will be aborted, but presently
; we always return no carry
;
;
; note: there is a routine by the same name in msdioctl.asm
;
;----------------------------------------------------------------------------
;
setdeviceparameters proc near
push es
push cs
pop es
assume es:sysinitseg
xor bx,bx
mov bl,byte ptr deviceparameters.dp_devicetype
cmp bl,dev_5inch
jnz got_80
mov word ptr deviceparameters.dp_cylinders,40 ; 48 tpi=40 cyl
got_80:
shl bx,1 ; get index into bpb table
mov si,bpbtable[bx] ; get address of bpb
mov di,offset deviceparameters.dp_bpb ; es:di -> bpb
mov cx,size A_BPB
cld
repe movsb
pop es
assume es:nothing
test word ptr switches,flagseclim
jz see_heads
mov ax,word ptr slim
mov word ptr deviceparameters.dp_bpb.bpb_sectorspertrack,ax
see_heads:
test word ptr switches,flagheads
jz heads_not_altered
mov ax,word ptr hlim
mov word ptr deviceparameters.dp_bpb.bpb_heads,ax
heads_not_altered:
; set up correct media descriptor byte and sectors/cluster
; sectors/cluster is always 2 except for any one sided disk or 1.44M
mov byte ptr deviceparameters.dp_bpb.bpb_sectorspercluster,2
mov bl,0f0h ; get default mediabyte
; preload the mediadescriptor from the bpb into bh for convenient access
mov bh,byte ptr deviceparameters.dp_bpb.bpb_mediadescriptor
cmp word ptr deviceparameters.dp_bpb.bpb_heads,2 ; >2 heads?
ja got_correct_mediad ; just use default if heads>2
jnz only_one_head ; one head, do one head stuff
; two head drives will use the mediadescriptor from the bpb
mov bl,bh ; get mediadescriptor from bpb
; two sided drives have two special cases to look for. One is
; a 320K diskette (40 tracks, 8 secs per track). It uses
; a mediaid of 0fch. The other is 1.44M, which uses only
; one sector/cluster.
; any drive with 18secs/trk, 2 heads, 80 tracks, will be assumed
; to be a 1.44M and use only 1 sector per cluster. Any other
; type of 2 headed drive is all set.
cmp deviceparameters.dp_bpb.bpb_sectorspertrack,18
jnz not_144m
cmp deviceparameters.dp_cylinders,80
jnz not_144m
; We've got cyl=80, heads=2, secpertrack=18. Set cluster size to 1.
jmp short got_one_secperclus_drive
; check for 320K
not_144m:
cmp deviceparameters.dp_cylinders,40
jnz got_correct_mediad
cmp deviceparameters.dp_bpb.bpb_sectorspertrack,8
jnz got_correct_mediad
mov bl,0fch
jmp short got_correct_mediad
only_one_head:
; if we don't have a 360K drive, then just go use 0f0h as media descr.
cmp deviceparameters.dp_devicetype,dev_5inch
jnz got_one_secperclus_drive
; single sided 360K drive uses either 0fch or 0feh, depending on
; whether sectorspertrack is 8 or 9. For our purposes, anything
; besides 8 will be considered 0fch
mov bl,0fch ; single sided 9 sector media id
cmp word ptr deviceparameters.dp_bpb.bpb_sectorspertrack,8
jnz got_one_secperclus_drive ; okay if anything besides 8
mov bl,0feh ; 160K mediaid
; we've either got a one sided drive, or a 1.44M drive
; either case we'll use 1 sector per cluster instead of 2
got_one_secperclus_drive:
mov byte ptr deviceparameters.dp_bpb.bpb_sectorspercluster,1
got_correct_mediad:
mov byte ptr deviceparameters.dp_bpb.bpb_mediadescriptor,bl
; Calculate the correct number of Total Sectors on medium
;
mov ax,deviceparameters.dp_cylinders
mul word ptr deviceparameters.dp_bpb.bpb_heads
mul word ptr deviceparameters.dp_bpb.bpb_sectorspertrack
mov word ptr deviceparameters.dp_bpb.bpb_totalsectors,ax
clc ; we currently return no errors
ret
setdeviceparameters endp
; M047 -- end rewritten routine
endif ;NEC_98
;
;----------------------------------------------------------------------------
;
; procedure : organize
;
;----------------------------------------------------------------------------
;
assume ds:nothing, es:nothing
organize proc near
mov cx,[count]
jcxz nochar1
call mapcase
xor si,si
mov di,si
xor ax,ax
mov com_level, 0
;org1: call get ;skip leading control characters
; cmp al,' '
; jb org1
org1:
call skip_comment
jz end_commd_line ; found a comment string and skipped.
call get2 ; not a comment string. then get a char.
cmp al, lf
je end_commd_line ; starts with a blank line.
cmp al, ' '
jbe org1 ; skip leading control characters
jmp short findit
end_commd_line:
stosb ; store line feed char in buffer for the linecount.
mov com_level, 0 ; reset the command level.
jmp org1
nochar1:
stc
ret
findit:
push cx
push si
push di
mov bp,si
dec bp
mov si,offset comtab ;prepare to search command table
mov ch,0
findcom:
mov di,bp
mov cl,[si]
inc si
jcxz nocom
repe cmpsb
lahf
add si,cx ;bump to next position without affecting flags
sahf
lodsb ;get indicator letter
jnz findcom
cmp byte ptr es:[di], cr ;the next char might be cr,lf
je gotcom0 ; such as in "rem",cr,lf case.
cmp byte ptr es:[di], lf
je gotcom0
push ax
mov al, byte ptr es:[di] ;now the next char. should be a delim.
call delim
pop ax
jnz findcom
gotcom0:
pop di
pop si
pop cx
jmp short gotcom
nocom:
pop di
pop si
pop cx
mov al,'Z'
stosb ; save indicator char.
skip_line:
call get2
cmp al, lf ; skip this bad command line
jne skip_line
jmp end_commd_line ; handle next command line
gotcom: stosb ;save indicator char in buffer
mov cmd_indicator, al ; save it for the future use.
org2: call get2 ;skip the commad name until delimiter
cmp al, lf
je org21
cmp al, cr
je org21
call delim
jnz org2
jmp short org3
org21: ;if cr or lf then
dec si ; undo si, cx register
inc cx ; and continue
org3:
cmp cmd_indicator, 'Y' ; comment= command?
je get_cmt_token
cmp cmd_indicator, 'I' ; install= command?
je org_file
cmp cmd_indicator, 'D' ; device= command?
je org_file
cmp cmd_indicator, 'S' ; shell= is a special one!!!
je org_file
cmp cmd_indicator, '1' ; switches= command?
je org_switch
jmp org4
org_switch:
call skip_comment
jz end_commd_line_brdg
call get2
call org_delim
jz org_switch
stosb
jmp org5
org_file: ; get the filename and put 0 at end,
call skip_comment
jz org_put_zero
call get2 ; not a comment
call delim
jz org_file ; skip the possible delimeters
stosb ; copy the first non delim char found in buffer
org_copy_file:
call skip_comment ; comment char in the filename?
jz org_put_zero ; then stop copying filename at that point
call get2
cmp al, '/' ; a switch char? (device=filename/xxx)
je end_file_slash ; this will be the special case.
stosb ; save the char. in buffer
call delim
jz end_copy_file
cmp al, ' '
ja org_copy_file ; keep copying
jmp short end_copy_file ; otherwise, assume end of the filename.
get_cmt_token: ; get the token. just max. 2 char.
call get2
cmp al, ' ' ; skip white spaces or "=" char.
je get_cmt_token ; (we are allowing the other special
cmp al, tab ; charaters can used for comment id.
je get_cmt_token ; character.)
cmp al, '=' ; = is special in this case.
je get_cmt_token
cmp al, cr
je get_cmt_end ; cannot accept the carridge return
cmp al, lf
je get_cmt_end
mov cmmt1, al ; store it
mov cmmt, 1 ; 1 char. so far.
call get2
cmp al, ' '
je get_cmt_end
cmp al, tab
je get_cmt_end
cmp al, cr
je get_cmt_end
cmp al, lf
je end_commd_line_brdg
mov cmmt2, al
inc cmmt
get_cmt_end:
call get2
cmp al, lf
jne get_cmt_end ; skip it.
end_commd_line_brdg: jmp end_commd_line ; else jmp to end_commd_line
org_put_zero: ; make the filename in front of
mov byte ptr es:[di], 0 ; the comment string to be an asciiz.
inc di
jmp end_commd_line ; (maybe null if device=/*)
end_file_slash: ; al = "/" option char.
mov byte ptr es:[di],0 ; make a filename an asciiz
inc di ; and
stosb ; store "/" after that.
jmp short org5 ; continue with the rest of the line
end_copy_file:
mov byte ptr es:[di-1], 0 ; make it an asciiz and handle the next char.
cmp al, lf
je end_commd_line_brdg
jmp short org5
org4: ; org4 skips all delimiters after the command name except for '/'
call skip_comment
jz end_commd_line_brdg
call get2
call org_delim ; skip delimiters except '/' (mrw 4/88)
jz org4
jmp short org51
org5: ; rest of the line
call skip_comment ; comment?
jz end_commd_line_brdg
call get2 ; not a comment.
org51:
stosb ; copy the character
cmp al, '"' ; a quote ?
je at_quote
cmp al, ' '
ja org5
; M051 - Start
cmp cmd_indicator, 'U' ; Q: is this devicehigh
jne not_dh ; N:
cmp al, lf ; Q: is this line feed
je org_dhlf ; Y: stuff a blank before the lf
cmp al, cr ; Q: is this a cr
jne org5 ; N:
mov byte ptr es:[di-1], ' ' ; overwrite cr with blank
stosb ; put cr after blank
inc [insert_blank] ; indicate that blank has been
; inserted
jmp org5
not_dh: ; M051 - End
cmp al, lf ; line feed?
je org1_brdg ; handles the next command line.
jmp org5 ; handles next char in this line.
org_dhlf: ; M051 - Start
cmp [insert_blank], 1 ; Q:has a blank already been inserted
je org1_brdg ; Y:
mov byte ptr es:[di-1], ' ' ; overwrite lf with blank
stosb ; put lf after blank
; M051 - End
org1_brdg:
mov [insert_blank], 0 ; M051: clear blank indicator for
; M051: devicehigh
jmp org1
at_quote:
cmp com_level, 0
je up_level
mov com_level, 0 ; reset it.
jmp org5
up_level:
inc com_level ; set it.
jmp org5
organize endp
;
;----------------------------------------------------------------------------
;
; procedure : get2
;
;----------------------------------------------------------------------------
;
get2 proc near
jcxz noget
mov al,es:[si]
inc si
dec cx
od_ret:
ret
noget:
pop cx
mov count,di
mov org_count, di
xor si,si
mov chrptr,si
ng_ret:
ret
get2 endp
;
;----------------------------------------------------------------------------
;
; procedure : skip_comment
;
;skip the commented string until lf, if current es:si-> a comment string.
;in) es:si-> sting
; cx -> length.
;out) zero flag not set if not found a comment string.
; zero flag set if found a comment string and skipped it. al will contain
; the line feed charater at this moment when return.
; ax register destroyed.
; if found, si, cx register adjusted accordingly.
;
;----------------------------------------------------------------------------
;
skip_comment proc near
jcxz noget ; get out of the organize routine.
cmp com_level, 0 ; only check it if parameter level is 0.
jne no_commt ; (not inside quotations)
cmp cmmt, 1
jb no_commt
mov al, es:[si]
cmp cmmt1, al
jne no_commt
cmp cmmt, 2
jne skip_cmmt
mov al, es:[si+1]
cmp cmmt2, al
jne no_commt
skip_cmmt:
jcxz noget ; get out of organize routine.
mov al, es:[si]
inc si
dec cx
cmp al, lf ; line feed?
jne skip_cmmt
no_commt:
ret
skip_comment endp
;
;----------------------------------------------------------------------------
;
; procedure : delim
;
;----------------------------------------------------------------------------
;
delim proc near
cmp al,'/' ; ibm will assume "/" as an delimeter.
jz delim_ret
cmp al, 0 ; special case for sysinit!!!
jz delim_ret
org_delim: ; used by organize routine except for getting
cmp al,' ' ;the filename.
jz delim_ret
cmp al,9
jz delim_ret
cmp al,'='
jz delim_ret
cmp al,','
jz delim_ret
cmp al,';'
delim_ret:
ret
delim endp
;
;----------------------------------------------------------------------------
;
; procedure : newline
;
; newline returns with first character of next line
;
;----------------------------------------------------------------------------
;
newline proc near
call getchr ;skip non-control characters
jc nl_ret
cmp al,lf ;look for line feed
jnz newline
call getchr
nl_ret:
ret
newline endp
;
;----------------------------------------------------------------------------
;
; procedure : mapcase
;
;----------------------------------------------------------------------------
;
mapcase proc near
push cx
push si
push ds
push es
pop ds
xor si,si
convloop:
lodsb
ifdef DBCS
call testkanj
jz normconv ; if this is not lead byte
mov ah,al
lodsb ; get tail byte
cmp ax,DB_SPACE
jnz @f ; if this is not dbcs space
mov word ptr [si-2],' ' ; set 2 single space
@@:
dec cx
jcxz convdone ;just ignore 1/2 kanji error
jmp short noconv
;fall through, know al is not in 'a'-'z' range
normconv:
endif
cmp al,'a'
jb noconv
cmp al,'z'
ja noconv
sub al,20h
mov [si-1],al
noconv:
loop convloop
convdone:
pop ds
pop si
pop cx
ret
ifdef DBCS
public testkanj
testkanj:
push si
push ds
push ax
mov ax,6300h ; get dos dbcs vector
int 21h
pop ax
bdbcs_do:
cmp ds:word ptr [si],0 ; end of lead byte info?
jz bdbcs_notfound ; jump if so
cmp al,ds:[si] ; less than first byte character?
jb bdbcs_next ; jump if not
cmp al,ds:[si+1] ; grater than first byte character?
ja bdbcs_next
bdbcs_found:
push ax
xor ax,ax
inc ax ; reset zero flag
pop ax
bdbcs_exit:
pop ds
pop si
ret
bdbcs_notfound:
push ax
xor ax,ax ; set zero flag
pop ax
jmp short bdbcs_exit
bdbcs_next:
add si,2 ; points next lead byte table
jmp short bdbcs_do
endif ; DBCS
mapcase endp
;
;----------------------------------------------------------------------------
;
; procedure : round
;
; round the values in memlo and memhi to paragraph boundary.
; perform bounds check.
;
;----------------------------------------------------------------------------
;
round proc near
push ax
mov ax,[memlo]
call pararound ; para round up
add [memhi],ax
mov [memlo],0
mov ax,memhi ; ax = new memhi
cmp ax,[alloclim] ; if new memhi >= alloclim, error
jae mem_err
test cs:[setdevmarkflag], for_devmark
jz skip_set_devmarksize
push es
push si
mov si, cs:[devmark_addr]
mov es, si
sub ax, si
dec ax
mov es:[devmark_size], ax ; paragraph
and cs:[setdevmarkflag], not_for_devmark
pop si
pop es
skip_set_devmarksize:
pop ax
clc ;clear carry
ret
mem_err:
mov dx,offset badmem
ifdef JAPAN
call IsDBCSCodePage
jz @f
mov dx,offset badmem2
@@:
endif
push cs
pop ds
call print
jmp stall
round endp
;
;----------------------------------------------------------------------------
;
; procedure : calldev
;
;----------------------------------------------------------------------------
;
calldev proc near
mov ds,word ptr cs:[DevEntry+2]
add bx,word ptr cs:[DevEntry] ;do a little relocation
mov ax,ds:[bx]
push word ptr cs:[DevEntry]
mov word ptr cs:[DevEntry],ax
mov bx,offset packet
call [DevEntry]
pop word ptr cs:[DevEntry]
ret
calldev endp
;
;----------------------------------------------------------------------------
;
; procedure : todigit
;
;----------------------------------------------------------------------------
;
todigit proc near
sub al,'0'
jb notdig
cmp al,9
ja notdig
clc
ret
notdig:
stc
ret
todigit endp
;
;----------------------------------------------------------------------------
;
; procedure : getnum
;
; getnum parses a decimal number.
; returns it in ax, sets zero flag if ax = 0 (may be considered an
; error), if number is bad carry is set, zero is set, ax=0.
;
;----------------------------------------------------------------------------
;
getnum proc near
push bx
xor bx,bx ; running count is zero
b2:
call todigit ; do we have a digit
jc badnum ; no, bomb
xchg ax,bx ; put total in ax
push bx ; save digit
mov bx,10 ; base of arithmetic
mul bx ; shift by one decimal di...
pop bx ; get back digit
add al,bl ; get total
adc ah,0 ; make that 16 bits
jc badnum ; too big a number
xchg ax,bx ; stash total
call getchr ;get next digit
jc b1 ; no more characters
cmp al, ' ' ; space?
jz b15 ; then end of digits
cmp al, ',' ; ',' is a seperator!!!
jz b15 ; then end of digits.
cmp al, tab ; tab
jz b15
cmp al,sepchr ; allow 0 or special separators
jz b15
cmp al,'/' ; see if another switch follows
nop ; cas - remnant of old bad code
nop
jz b15
cmp al,lf ; line-feed?
jz b15
cmp al,cr ; carriage return?
jz b15
or al,al ; end of line separator?
jnz b2 ; no, try as a valid char...
b15:
inc count ; one more character to s...
dec chrptr ; back up over separator
b1:
mov ax,bx ; get proper count
or ax,ax ; clears carry, sets zero accordingly
pop bx
ret
badnum:
mov sepchr,0
xor ax,ax ; set zero flag, and ax = 0
pop bx
stc ; and carry set
ret
getnum endp
;*****************************************************************
setdoscountryinfo proc near
;input: es:di -> pointer to dos_country_cdpg_info
; ds:0 -> buffer.
; si = 0
; ax = country id
; dx = code page id. (if 0, then use ccsyscodepage as a default.)
; bx = file handle
; this routine can handle maxium 438 country_data entries.
;
;output: dos_country_cdpg_info set.
; carry set if any file read failure or wrong information in the file.
; carry set and cx = -1 if cannot find the matching country_id, codepage
; _id in the file.
push di
push ax
push dx
xor cx,cx
xor dx,dx
mov ax,512 ;read 512 bytes
call readincontrolbuffer ;read the file header
jc setdosdata_fail
push es
push si
push cs
pop es
mov di,offset country_file_signature
mov cx,8 ;length of the signature
repz cmpsb
pop si
pop es
jnz setdosdata_fail ;signature mismatch
add si,18 ;si -> county info type
cmp byte ptr ds:[si],1 ;only accept type 1 (currently only 1 header type)
jne setdosdata_fail ;cannot proceed. error return
inc si ;si -> file offset
mov dx,word ptr ds:[si] ;get the info file offset.
mov cx,word ptr ds:[si+2]
mov ax,6144 ;read 6144 bytes.
call readincontrolbuffer ;read info
jc setdosdata_fail
mov cx, word ptr ds:[si] ;get the # of country, codepage combination entries
cmp cx, 438 ;cannot handle more than 438 entries.
;
ja setdosdata_fail
inc si
inc si ;si -> entry information packet
pop dx ;restore code page id
pop ax ;restore country id
pop di
setdoscntry_find: ;search for desired country_id,codepage_id.
cmp ax, word ptr ds:[si+2] ;compare country_id
jne setdoscntry_next
cmp dx, 0 ;no user specified code page ?
je setdoscntry_any_codepage;then no need to match code page id.
cmp dx, word ptr ds:[si+4] ;compare code page id
je setdoscntry_got_it
setdoscntry_next:
add si, word ptr ds:[si] ;next entry
inc si
inc si ;take a word for size of entry itself
loop setdoscntry_find
mov cx, -1 ;signals that bad country id entered.
setdoscntry_fail:
stc
ret
setdosdata_fail:
pop si
pop cx
pop di
jmp short setdoscntry_fail
setdoscntry_any_codepage: ;use the code_page_id of the country_id found.
mov dx, word ptr ds:[si+4]
setdoscntry_got_it: ;found the matching entry
mov cs:cntrycodepage_id, dx ;save code page id for this country.
mov dx, word ptr ds:[si+10] ;get the file offset of country data
mov cx, word ptr ds:[si+12]
mov ax, 512 ;read 512 bytes
call readincontrolbuffer
jc setdoscntry_fail
mov cx, word ptr ds:[si] ;get the number of entries to handle.
inc si
inc si ;si -> first entry
setdoscntry_data:
push di ;es:di -> dos_country_cdpg_info
push cx ;save # of entry left
push si ;si -> current entry in control buffer
mov al, byte ptr ds:[si+2] ;get data entry id
call getcountrydestination ;get the address of destination in es:di
jc setdoscntry_data_next ;no matching data entry id in dos
mov dx, word ptr ds:[si+4] ;get offset of data
mov cx, word ptr ds:[si+6]
mov ax,4200h
stc
int 21h ;move pointer
jc setdosdata_fail
mov dx,512 ;start of data buffer
mov cx,20 ;read 20 bytes only. we only need to
mov ah,3fh ;look at the length of the data in the file.
stc
int 21h ;read the country.sys data
jc setdosdata_fail ;read failure
cmp ax,cx
jne setdosdata_fail
mov dx,word ptr ds:[si+4] ;get offset of data again.
mov cx,word ptr ds:[si+6]
mov ax,4200h
stc
int 21h ;move pointer back again
jc setdosdata_fail
push si
mov si,(512+8) ;get length of the data from the file
mov cx,word ptr ds:[si]
pop si
mov dx,512 ;start of data buffer
add cx,10 ;signature + a word for the length itself
mov ah,3fh ;read the data from the file.
stc
int 21h
jc setdosdata_fail
cmp ax, cx
jne setdosdata_fail
mov al,byte ptr ds:[si+2] ;save data id for future use.
mov si,(512+8) ;si-> data buffer + id tag field
mov cx,word ptr ds:[si] ;get the length of the file
inc cx ;take care of a word for lenght of tab
inc cx ;itself.
cmp cx,(2048 - 512 - 8) ;fit into the buffer?
ja setdosdata_fail
if bugfix
call setdbcs_before_copy
endif
cmp al, setcountryinfo ;is the data for setcountryinfo table?
jne setdoscntry_mov ;no, don't worry
push word ptr es:[di+ccmono_ptr-cccountryinfolen] ;cannot destroy ccmono_ptr address. save them.
push word ptr es:[di+ccmono_ptr-cccountryinfolen+2] ;at this time di -> cccountryinfolen
push di ;save di
push ax
mov ax,cs:cntrycodepage_id ;do not use the code page info in country_info
mov ds:[si+4], ax ;use the saved one for this !!!!
pop ax
setdoscntry_mov:
rep movsb ;copy the table into dos
cmp al, setcountryinfo ;was the ccmono_ptr saved?
jne setdoscntry_data_next
pop di ;restore di
pop word ptr es:[di+ccmono_ptr-cccountryinfolen+2] ;restore
pop word ptr es:[di+ccmono_ptr-cccountryinfolen]
setdoscntry_data_next:
pop si ;restore control buffer pointer
pop cx ;restore # of entries left
pop di ;restore pointer to dso_country_cdpg
add si, word ptr ds:[si] ;try to get the next entry
inc si
inc si ;take a word of entry length itself
dec cx
cmp cx,0
je setdoscntry_ok
jmp setdoscntry_data
setdoscntry_ok:
ret
setdoscountryinfo endp
if bugfix
setdbcs_before_copy proc near
cmp al,setdbcs ; dbcs vector set?
jnz @f ; jump if not
cmp word ptr es:[di], 0 ; zero byte data block?
jz @f ; jump if so
push di
push ax
push cx
mov cx,es:[di] ; load block length
add di,2 ; points actual data
xor al,al ; fill bytes
rep stosb ; clear data block
pop cx
pop ax
pop di
@@:
ret
setdbcs_before_copy endp
endif
getcountrydestination proc near
;get the destination address in the dos country info table.
;input: al - data id
; es:di -> dos_country_cdpg_info
;on return:
; es:di -> destination address of the matching data id
; carry set if no matching data id found in dos.
push cx
add di,ccnumber_of_entries ;skip the reserved area, syscodepage etc.
mov cx,word ptr es:[di] ;get the number of entries
inc di
inc di ;si -> the first start entry id
getcntrydest:
cmp byte ptr es:[di],al
je getcntrydest_ok
cmp byte ptr es:[di],setcountryinfo ;was it setcountryinfo entry?
je getcntrydest_1
add di,5 ;next data id
jmp short getcntrydest_loop
getcntrydest_1:
add di,new_country_size + 3 ;next data id
getcntrydest_loop:
loop getcntrydest
stc
jmp short getcntrydest_exit
getcntrydest_ok:
cmp al,setcountryinfo ;select country info?
jne getcntrydest_ok1
inc di ;now di -> cccountryinfolen
jmp short getcntrydest_exit
getcntrydest_ok1:
les di,dword ptr es:[di+1] ;get the destination in es:di
getcntrydest_exit:
pop cx
ret
getcountrydestination endp
readincontrolbuffer proc near
;move file pointer to cx:dx
;read ax bytes into the control buffer. (should be less than 2 kb)
;si will be set to 0 hence ds:si points to the control buffer.
;entry: cx,dx offset from the start of the file where the read/write pointer
; be moved.
; ax - # of bytes to read
; bx - file handle
; ds - buffer seg.
;return: the control data information is read into ds:0 - ds:0200.
; cx,dx value destroyed.
; carry set if error in reading file.
push ax ;# of bytes to read
mov ax, 4200h
stc
int 21h ;move pointer
pop cx ;# of bytes to read
jc ricb_exit
xor dx,dx ;ds:dx -> control buffer
xor si,si
mov ah,3fh ;read into the buffer
stc
int 21h ;should be less than 1024 bytes.
ricb_exit:
ret
readincontrolbuffer endp
set_country_path proc near
;in: ds - sysinitseg, es - confbot, si -> start of the asciiz path string
; dosinfo_ext, cntry_drv, cntry_root, cntry_path
; assumes current directory is the root directory.
;out: ds:di -> full path (cntry_drv).
; set the cntry_drv string from the country=,,path command.
; ds, es, si value saved.
push si
push ds ;switch ds, es
push es
pop ds
pop es ;now ds -> confbot, es -> sysinitseg
call chk_drive_letter ;current ds:[si] is a drive letter?
jc scp_default_drv ;no, use current default drive.
mov al, byte ptr ds:[si]
inc si
inc si ;si -> next char after ":"
jmp short scp_setdrv
scp_default_drv:
mov ah, 19h
int 21h
add al, "A" ;convert it to a character.
scp_setdrv:
mov cs:cntry_drv, al ;set the drive letter.
mov di, offset cntry_path
mov al, byte ptr ds:[si]
cmp al, "\"
je scp_root_dir
cmp al,"/" ;let's accept "/" as an directory delim
je scp_root_dir
jmp short scp_path
scp_root_dir:
dec di ;di -> cntry_root
scp_path:
call move_asciiz ;copy it
mov di, offset cntry_drv
scpath_exit:
push ds ;switch ds, es
push es
pop ds
pop es ;ds, es value restored
pop si
ret
set_country_path endp
chk_drive_letter proc near
;check if ds:[si] is a drive letter followed by ":".
;assume that every alpha charater is already converted to upper case.
;carry set if not.
push ax
cmp byte ptr ds:[si], "A"
jb cdletter_no
cmp byte ptr ds:[si], "Z"
ja cdletter_no
cmp byte ptr ds:[si+1], ":"
jne cdletter_no
jmp short cdletter_exit
cdletter_no:
stc
cdletter_exit:
pop ax
ret
chk_drive_letter endp
move_asciiz proc near
;in: ds:si -> source es:di -> target
;out: copy the string until 0.
;assumes there exists a 0.
masciiz_loop:
movsb
cmp byte ptr ds:[si-1],0 ;was it 0?
jne masciiz_loop
ret
move_asciiz endp
;
; ds:dx points to string to output (asciz)
;
; prints <badld_pre> <string> <badld_post>
badfil:
push cs
pop es
mov si,dx
badload:
mov dx,offset badld_pre ;want to print config error
ifdef JAPAN
call IsDBCSCodePage
jz @f
mov dx,offset badld_pre2
@@:
endif
mov bx, offset crlfm
prnerr:
push cs
pop ds
call print
prn1:
mov dl,es:[si]
or dl,dl
jz prn2
mov ah,std_con_output
int 21h
inc si
jmp prn1
prn2:
mov dx,bx
call print
cmp donotshownum,1 ; suppress line number when handling command.com
je prnexit
call error_line
prnexit:
ret
print:
cmp cs:bEchoConfig, 0 ; NTVDM skip print call, Jonle
je prnexit
mov ah,std_con_string_output
int 21h
ret
if noexec
; load non exe file called [ds:dx] at memory location es:bx
ldfil:
push ax
push bx
push cx
push dx
push si
push ds
push bx
xor ax,ax ;open the file
mov ah,open
stc ;in case of int 24
int 21h
pop dx ;clean stack in case jump
jc ldret
push dx
mov bx,ax ;handle in bx
xor cx,cx
xor dx,dx
mov ax,(lseek shl 8) or 2
stc ;in case of int 24
int 21h ; get file size in dx:ax
jc ldclsp
or dx,dx
jnz lderrp ; file >64k
pop dx
push dx
mov cx,es ; cx:dx is xaddr
add dx,ax ; add file size to xaddr
jnc dosize
add cx,1000h ; ripple carry
dosize:
mov ax,dx
call pararound
mov dx,ax
add cx,dx
cmp cx,[alloclim]
jb okld
jmp mem_err
okld:
xor cx,cx
xor dx,dx
mov ax,lseek shl 8 ;reset pointer to beginning of file
stc ;in case of int 24
int 21h
jc ldclsp
pop dx
push es ;read the file in
pop ds ;trans addr is ds:dx
mov cx,0ff00h ; .com files arn't any bigger than
; 64k-100h
mov ah,read
stc ;in case of int 24
int 21h
jc ldcls
mov si,dx ;check for exe file
cmp word ptr [si],"ZM"
clc ; assume ok
jnz ldcls ; only know how to do .com files
stc
jmp short ldcls
lderrp:
stc
ldclsp:
pop dx ;clean stack
ldcls:
pushf
mov ah,close ;close the file
stc
int 21h
popf
ldret: pop ds
pop si
pop dx
pop cx
pop bx
pop ax
ret
endif
;
; open device pointed to by dx, al has access code
; if unable to open do a device open null device instead
;
open_dev:
call open_file
jnc open_dev3
open_dev1:
mov dx,offset nuldev
call open_file
of_ret:
ret
open_dev3:
mov bx,ax ; handle from open to bx
xor ax,ax ; get device info
mov ah,ioctl
int 21h
test dl,10000000b
jnz of_ret
mov ah,close
int 21h
jmp open_dev1
open_file:
mov ah,open
stc
int 21h
ret
; test int24. return back to dos with the fake user response of "fail"
int24:
mov al, 3 ; fail the system call
iret ; return back to dos.
include copyrigh.inc ; copyright statement
nuldev db "NUL",0
condev db "CON",0
auxdev db "AUX",0
prndev db "PRN",0
MseDev db "MOUSE",0 ; NTVDM for internal spc mouse
; NTVDM we use a temp file for config.sys 23-Nov-1992 Jonle
; config db "C:\CONFIG.SYS",0
config db 64 dup (0)
cntry_drv db "A:"
cntry_root db "\"
cntry_path db "COUNTRY.SYS",0
db 52 dup (0)
country_file_signature db 0ffh,'COUNTRY'
cntrycodepage_id dw ?
commnd db "\COMMAND.COM",0
db 51 dup (0)
pathstring db 64 dup (0)
comtab label byte
; cmd len command cmd code
; ------- ------- --------
;
db 7, "BUFFERS", 'B'
db 5, "BREAK", 'C'
db 6, "DEVICE", 'D'
db 10, "DEVICEHIGH", 'U'
db 5, "FILES", 'F'
db 4, "FCBS", 'X'
db 9, "LASTDRIVE", 'L'
db 10, "MULTITRACK", 'M'
db 8, "DRIVPARM", 'P'
if stacksw
db 6, "STACKS", 'K'
endif
db 7, "COUNTRY", 'Q'
db 5, "SHELL", 'S'
db 7, "INSTALL", 'I'
db 7, "COMMENT", 'Y'
db 3, "REM", '0'
db 8, "SWITCHES", '1'
db 3, "DOS", 'H'
db 10, "ECHOCONFIG", 'E' ; NTVDM 14-Aug-1992 Jonle
db 11, "NTCMDPROMPT", 'T' ; NTVDM 06-May-1993 sudeepb
db 7, "DOSONLY", 'O' ; NTVDM 06-May-1993 sudeepb
db 0
ifdef NEC_98
public deviceparameters
deviceparameters a_deviceparameters <0,dev_3inch720kb,0,80>
endif ;NEC_98
hlim dw 2
slim dw 9
public bEchoConfig ; NTVDM - 14-Aug-1992 Jonle
bEchoConfig db 0
public drive
drive db ?
public switches
switches dw 0
ifdef NEC_98
; the following are the recommended bpbs for the media that we know of so
; far.
; 48 tpi diskettes
bpb48t dw 512
db 2
dw 1
db 2
dw 112
dw 2*9*40
db 0fdh
dw 2
dw 9
dw 2
dd 0
dd 0
; 96tpi diskettes
bpb96t dw 512
db 1
dw 1
db 2
dw 224
dw 2*15*80
db 0f9h
dw 7
dw 15
dw 2
dd 0
dd 0
; 3 1/2 inch diskette bpb
bpb35 dw 512
db 2
dw 1
db 2
dw 70h
dw 2*9*80
db 0f9h
dw 3
dw 9
dw 2
dd 0
dd 0
bpb35h dw 0200h
db 01h
dw 0001h
db 02h
dw 0e0h
dw 0b40h
db 0f0h
dw 0009h
dw 0012h
dw 0002h
dd 0
dd 0
;
; m037 - BEGIN
;
bpb288 dw 0200h
db 02h
dw 0001h
db 02h
dw 240
dw 2*36*80
db 0f0h
dw 0009h
dw 36
dw 0002h
dd 0
dd 0
;
; m037 - END
;
bpbtable dw bpb48t ; 48tpi drives
dw bpb96t ; 96tpi drives
dw bpb35 ; 3.5" drives
; the following are not supported, so default to 3.5" media layout
dw bpb35 ; not used - 8" drives
dw bpb35 ; not used - 8" drives
dw bpb35 ; not used - hard files
dw bpb35 ; not used - tape drives
dw bpb35h ; 3-1/2" 1.44mb drive
dw bpb35 ; ERIMO m037
dw bpb288 ; 2.88 MB diskette drives m037
endif ;NEC_98
switchlist db 8,"FHSTDICN" ; preserve the positions of n and c.
; the following depend on the positions of the various letters in switchlist
;switchnum equ 11111000b ; which switches require number
flagec35 equ 00000100b ; electrically compatible 3.5 inch disk drive
flagdrive equ 00001000b
flagcyln equ 00010000b
flagseclim equ 00100000b
flagheads equ 01000000b
flagff equ 10000000b
sysinitseg ends
end
|
commands/media/apple-music/apple-music-volume-up.applescript
|
daviddzhou/script-commands
| 1 |
3517
|
<filename>commands/media/apple-music/apple-music-volume-up.applescript
#!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Apple Music Volume Up
# @raycast.mode silent
# Optional parameters:
# @raycast.icon images/apple-music-logo.png
# Documentation:
# @raycast.author <NAME>
# @raycast.authorURL https://github.com/jiserra
# @raycast.packageName Music
try
tell application "Music"
set sound volume to sound volume + 5
do shell script "echo '⬆'"
end tell
end try
|
RecursiveTypes/Subterm/RestrictedHypothesis.agda
|
nad/codata
| 1 |
6433
|
<gh_stars>1-10
------------------------------------------------------------------------
-- Restricted hypotheses
------------------------------------------------------------------------
-- A restricted hypothesis is a hypothesis where both types are
-- sub/terms/ of either one of two given types.
open import RecursiveTypes.Syntax
module RecursiveTypes.Subterm.RestrictedHypothesis
{n} (χ₁ χ₂ : Ty n) where
open import Category.Monad
open import Function
open import Function.Equality using (_⟨$⟩_)
open import Function.Inverse using (module Inverse)
open import Data.List as List
open import Data.List.Relation.Unary.Any as Any
open import Data.List.Relation.Unary.Any.Properties
import Data.List.Categorical
import Data.List.Countdown as Countdown
open import Data.List.Membership.Propositional using (_∈_)
open import Data.List.Membership.Propositional.Properties
import Data.List.Membership.Setoid
open import Data.Product as Prod
open import Data.Sum as Sum
open import Level
open import Relation.Nullary
open import Relation.Binary
import Relation.Binary.Construct.On as On
open import Relation.Binary.PropositionalEquality as PropEq
using (_≡_; refl)
open RawMonad (Data.List.Categorical.monad {ℓ = zero})
open import RecursiveTypes.Subterm as ST using (_⊑_; _∗)
------------------------------------------------------------------------
-- Restricted hypotheses
-- Types which are subterms of either χ₁ or χ₂.
Subterm : Ty n → Set
Subterm σ = σ ⊑ χ₁ ⊎ σ ⊑ χ₂
-- The Subterm predicate is anti-monotone.
anti-mono : ∀ {σ₁ σ₂} → σ₂ ⊑ σ₁ → Subterm σ₁ → Subterm σ₂
anti-mono σ₂⊑σ₁ = Sum.map (ST.trans σ₂⊑σ₁) (ST.trans σ₂⊑σ₁)
-- Hypotheses where both types are subterms.
RestrictedHyp : Set
RestrictedHyp = ∃ Subterm × ∃ Subterm
-- Computes the underlying hypothesis/es.
⟨_⟩ : RestrictedHyp → Hyp n
⟨_⟩ = Prod.map proj₁ proj₁
⟨_⟩⋆ : List RestrictedHyp → List (Hyp n)
⟨_⟩⋆ = List.map ⟨_⟩
-- Equality of restricted hypotheses (ignores the subterm proofs).
_≈_ : Rel RestrictedHyp zero
_≈_ = _≡_ on ⟨_⟩
-- List membership relation for restricted hypotheses.
open Data.List.Membership.Setoid
(record { isEquivalence =
On.isEquivalence (⟨_⟩) PropEq.isEquivalence })
using () renaming (_∈_ to _⟨∈⟩_)
------------------------------------------------------------------------
-- Computing all possible restricted hypotheses
-- Computes all the subterms of the given type.
subtermsOf : ∀ τ → (∀ {σ} → σ ⊑ τ → Subterm σ) → List (∃ Subterm)
subtermsOf τ f = List.map (Prod.map id f) (ST.subtermsOf τ)
subtermsOf-complete :
∀ {τ} (f : ∀ {σ} → σ ⊑ τ → Subterm σ) {σ} →
σ ⊑ τ → ∃ λ σ⊑τ → (σ , f σ⊑τ) ∈ subtermsOf τ f
subtermsOf-complete f σ⊑τ =
Prod.map id (λ ∈ → Inverse.to (map-∈↔ _) ⟨$⟩ (_ , ∈ , refl)) $
ST.subtermsOf-complete σ⊑τ
subtermsOf²-complete :
∀ {σ₁ τ₁ σ₂ τ₂}
(f : ∀ {σ} → σ ⊑ τ₁ → Subterm σ)
(g : ∀ {σ} → σ ⊑ τ₂ → Subterm σ) →
(σ₁⊑τ₁ : σ₁ ⊑ τ₁) (σ₂⊑τ₂ : σ₂ ⊑ τ₂) →
((σ₁ , f σ₁⊑τ₁) ≲ (σ₂ , g σ₂⊑τ₂)) ⟨∈⟩
(subtermsOf τ₁ f ⊗ subtermsOf τ₂ g)
subtermsOf²-complete f g σ₁⊑τ₁ σ₂⊑τ₂ =
Any.map (PropEq.cong $ Prod.map proj₁ proj₁) $
Inverse.to ⊗-∈↔ ⟨$⟩
( proj₂ (subtermsOf-complete f σ₁⊑τ₁)
, proj₂ (subtermsOf-complete g σ₂⊑τ₂)
)
-- All subterms of χ₁.
⊑-χ₁ : List (∃ Subterm)
⊑-χ₁ = subtermsOf χ₁ inj₁
-- All subterms of χ₂.
⊑-χ₂ : List (∃ Subterm)
⊑-χ₂ = subtermsOf χ₂ inj₂
-- All possible restricted hypotheses.
restrictedHyps : List RestrictedHyp
restrictedHyps = (⊑-χ₁ ⊗ ⊑-χ₂) ++ (⊑-χ₂ ⊗ ⊑-χ₁) ++
(⊑-χ₁ ⊗ ⊑-χ₁) ++ (⊑-χ₂ ⊗ ⊑-χ₂)
complete : ∀ h → h ⟨∈⟩ restrictedHyps
complete ((σ , inj₁ σ⊑χ₁) ≲ (τ , inj₂ τ⊑χ₂)) =
Inverse.to ++↔ ⟨$⟩ (inj₁ $
subtermsOf²-complete inj₁ inj₂ σ⊑χ₁ τ⊑χ₂)
complete ((σ , inj₂ σ⊑χ₂) ≲ (τ , inj₁ τ⊑χ₁)) =
Inverse.to (++↔ {xs = ⊑-χ₁ ⊗ ⊑-χ₂}) ⟨$⟩ (inj₂ $
Inverse.to ++↔ ⟨$⟩ (inj₁ $
subtermsOf²-complete inj₂ inj₁ σ⊑χ₂ τ⊑χ₁))
complete ((σ , inj₁ σ⊑χ₁) ≲ (τ , inj₁ τ⊑χ₁)) =
Inverse.to (++↔ {xs = ⊑-χ₁ ⊗ ⊑-χ₂}) ⟨$⟩ (inj₂ $
Inverse.to (++↔ {xs = ⊑-χ₂ ⊗ ⊑-χ₁}) ⟨$⟩ (inj₂ $
Inverse.to ++↔ ⟨$⟩ (inj₁ $
subtermsOf²-complete inj₁ inj₁ σ⊑χ₁ τ⊑χ₁)))
complete ((σ , inj₂ σ⊑χ₂) ≲ (τ , inj₂ τ⊑χ₂)) =
Inverse.to (++↔ {xs = ⊑-χ₁ ⊗ ⊑-χ₂}) ⟨$⟩ (inj₂ $
Inverse.to (++↔ {xs = ⊑-χ₂ ⊗ ⊑-χ₁}) ⟨$⟩ (inj₂ $
Inverse.to (++↔ {xs = ⊑-χ₁ ⊗ ⊑-χ₁}) ⟨$⟩ (inj₂ $
subtermsOf²-complete inj₂ inj₂ σ⊑χ₂ τ⊑χ₂)))
------------------------------------------------------------------------
-- A countdown structure for restricted hypotheses
-- Equality of restricted hypotheses can be decided.
_≟_ : Decidable (_≡_ {A = Hyp n})
( σ₁ ≲ σ₂) ≟ (τ₁ ≲ τ₂) with σ₁ ≡? τ₁ | σ₂ ≡? τ₂
(.τ₁ ≲ .τ₂) ≟ (τ₁ ≲ τ₂) | yes refl | yes refl = yes refl
... | no σ₁≢τ₁ | _ = no (σ₁≢τ₁ ∘ PropEq.cong proj₁)
... | _ | no σ₂≢τ₂ = no (σ₂≢τ₂ ∘ PropEq.cong proj₂)
isDecEquivalence : IsDecEquivalence _≈_
isDecEquivalence =
On.isDecEquivalence ⟨_⟩ $
DecSetoid.isDecEquivalence (PropEq.decSetoid _≟_)
-- The countdown data structure can be used to keep track of (an upper
-- bound of) the number of hypotheses which have not been inserted
-- into a given list of hypotheses yet.
private
open module C =
Countdown (record { isDecEquivalence = isDecEquivalence })
public hiding (empty; emptyFromList)
-- An initialised countdown structure.
empty : [] ⊕ length restrictedHyps
empty = C.emptyFromList restrictedHyps complete
|
src/fltk-widgets-groups-windows-single-menu.adb
|
micahwelf/FLTK-Ada
| 1 |
13370
|
with
Interfaces.C,
System;
use type
System.Address,
Interfaces.C.unsigned;
package body FLTK.Widgets.Groups.Windows.Single.Menu is
procedure menu_window_set_draw_hook
(W, D : in System.Address);
pragma Import (C, menu_window_set_draw_hook, "menu_window_set_draw_hook");
pragma Inline (menu_window_set_draw_hook);
procedure menu_window_set_handle_hook
(W, H : in System.Address);
pragma Import (C, menu_window_set_handle_hook, "menu_window_set_handle_hook");
pragma Inline (menu_window_set_handle_hook);
function new_fl_menu_window
(X, Y, W, H : in Interfaces.C.int;
Label : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_menu_window, "new_fl_menu_window");
pragma Inline (new_fl_menu_window);
function new_fl_menu_window2
(W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_menu_window2, "new_fl_menu_window2");
pragma Inline (new_fl_menu_window2);
procedure free_fl_menu_window
(M : in System.Address);
pragma Import (C, free_fl_menu_window, "free_fl_menu_window");
pragma Inline (free_fl_menu_window);
procedure fl_menu_window_show
(M : in System.Address);
pragma Import (C, fl_menu_window_show, "fl_menu_window_show");
pragma Inline (fl_menu_window_show);
procedure fl_menu_window_hide
(M : in System.Address);
pragma Import (C, fl_menu_window_hide, "fl_menu_window_hide");
pragma Inline (fl_menu_window_hide);
procedure fl_menu_window_flush
(M : in System.Address);
pragma Import (C, fl_menu_window_flush, "fl_menu_window_flush");
pragma Inline (fl_menu_window_flush);
procedure fl_menu_window_set_overlay
(M : in System.Address);
pragma Import (C, fl_menu_window_set_overlay, "fl_menu_window_set_overlay");
pragma Inline (fl_menu_window_set_overlay);
procedure fl_menu_window_clear_overlay
(M : in System.Address);
pragma Import (C, fl_menu_window_clear_overlay, "fl_menu_window_clear_overlay");
pragma Inline (fl_menu_window_clear_overlay);
function fl_menu_window_overlay
(M : in System.Address)
return Interfaces.C.unsigned;
pragma Import (C, fl_menu_window_overlay, "fl_menu_window_overlay");
pragma Inline (fl_menu_window_overlay);
procedure fl_menu_window_draw
(W : in System.Address);
pragma Import (C, fl_menu_window_draw, "fl_menu_window_draw");
pragma Inline (fl_menu_window_draw);
function fl_menu_window_handle
(W : in System.Address;
E : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_menu_window_handle, "fl_menu_window_handle");
pragma Inline (fl_menu_window_handle);
procedure Finalize
(This : in out Menu_Window) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in Menu_Window'Class
then
This.Clear;
free_fl_menu_window (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
Finalize (Single_Window (This));
end Finalize;
package body Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String)
return Menu_Window is
begin
return This : Menu_Window do
This.Void_Ptr := new_fl_menu_window
(Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.To_C (Text));
fl_group_end (This.Void_Ptr);
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
menu_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
menu_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
end return;
end Create;
function Create
(W, H : in Integer;
Text : in String)
return Menu_Window is
begin
return This : Menu_Window do
This.Void_Ptr := new_fl_menu_window2
(Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.To_C (Text));
fl_group_end (This.Void_Ptr);
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
menu_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
menu_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
end return;
end Create;
end Forge;
procedure Show
(This : in out Menu_Window) is
begin
fl_menu_window_show (This.Void_Ptr);
end Show;
procedure Hide
(This : in out Menu_Window) is
begin
fl_menu_window_hide (This.Void_Ptr);
end Hide;
procedure Flush
(This : in out Menu_Window) is
begin
fl_menu_window_flush (This.Void_Ptr);
end Flush;
function Is_Overlay
(This : in Menu_Window)
return Boolean is
begin
return fl_menu_window_overlay (This.Void_Ptr) /= 0;
end Is_Overlay;
procedure Set_Overlay
(This : in out Menu_Window;
Value : in Boolean) is
begin
if Value then
fl_menu_window_set_overlay (This.Void_Ptr);
else
fl_menu_window_clear_overlay (This.Void_Ptr);
end if;
end Set_Overlay;
procedure Draw
(This : in out Menu_Window) is
begin
fl_menu_window_draw (This.Void_Ptr);
end Draw;
function Handle
(This : in out Menu_Window;
Event : in Event_Kind)
return Event_Outcome is
begin
return Event_Outcome'Val
(fl_menu_window_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
end Handle;
end FLTK.Widgets.Groups.Windows.Single.Menu;
|
oeis/324/A324293.asm
|
neoneye/loda-programs
| 11 |
26581
|
<filename>oeis/324/A324293.asm
; A324293: a(n) = A002487(sigma(n)).
; Submitted by <NAME>
; 1,2,1,3,2,2,1,4,5,4,2,3,3,2,2,5,4,10,3,8,1,4,2,4,5,8,3,3,4,4,1,6,2,8,2,19,7,4,3,12,8,2,5,8,10,4,2,5,10,16,4,9,8,4,4,4,3,12,4,8,5,2,5,7,8,4,5,6,2,4,4,20,11,10,5,9,2,8,3,16,13,6,8,3,8,6,4,12,12,18,3,8,1,4,4,6,9,34,10,27
seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
seq $0,2487 ; Stern's diatomic series (or Stern-Brocot sequence): a(0) = 0, a(1) = 1; for n > 0: a(2*n) = a(n), a(2*n+1) = a(n) + a(n+1).
|
oeis/349/A349360.asm
|
neoneye/loda-programs
| 11 |
174242
|
<reponame>neoneye/loda-programs
; A349360: Number of positive integer pairs (s,t), with s,t <= n and s <= t such that either both s and t divide n or both do not.
; Submitted by <NAME>
; 1,3,4,7,9,13,18,20,27,31,48,42,69,65,76,81,123,99,156,126,163,181,234,172,259,263,286,274,381,289,438,372,445,475,506,423,633,605,640,564,783,631,864,762,801,913,1038,796,1087,1011,1138,1102,1329,1117,1336,1212,1441
mov $1,$0
seq $0,184389 ; a(n) = Sum_{k=1..tau(n)} k, where tau is the number of divisors of n (A000005).
seq $1,335567 ; Number of distinct positive integer pairs (s,t) such that s <= t < n where neither s nor t divides n.
add $0,$1
|
libsrc/_DEVELOPMENT/font/fzx/fonts/dkud3/SteAff/_ff_dkud3_SteAff.asm
|
meesokim/z88dk
| 0 |
83312
|
SECTION rodata_font_fzx
PUBLIC _ff_dkud3_SteAff
_ff_dkud3_SteAff:
BINARY "font/fzx/fonts/dkud3/SteAff/ste-aff.fzx"
|
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_1697.asm
|
ljhsiun2/medusa
| 9 |
17333
|
<filename>Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_1697.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1ba59, %r9
nop
nop
nop
sub $18327, %r15
mov $0x6162636465666768, %r11
movq %r11, %xmm5
movups %xmm5, (%r9)
nop
dec %r11
lea addresses_D_ht+0x77b9, %rbp
nop
add $51477, %r14
movb $0x61, (%rbp)
nop
cmp $18009, %r15
lea addresses_UC_ht+0x2259, %r9
nop
nop
add %rsi, %rsi
movb (%r9), %r15b
nop
nop
nop
nop
add $52912, %r15
lea addresses_normal_ht+0x4595, %r12
nop
nop
nop
nop
xor %r11, %r11
and $0xffffffffffffffc0, %r12
vmovaps (%r12), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %r14
nop
nop
nop
nop
xor %r11, %r11
lea addresses_WT_ht+0x17459, %rsi
lea addresses_WT_ht+0x1dfd9, %rdi
nop
nop
nop
nop
nop
add $15987, %r12
mov $114, %rcx
rep movsl
nop
nop
nop
sub %rbp, %rbp
lea addresses_normal_ht+0x18259, %rsi
lea addresses_D_ht+0x12c5f, %rdi
nop
nop
and %r11, %r11
mov $34, %rcx
rep movsq
nop
nop
nop
nop
sub $15854, %rdi
lea addresses_normal_ht+0x1cc23, %rcx
nop
nop
nop
nop
nop
dec %rdi
movl $0x61626364, (%rcx)
nop
nop
nop
nop
nop
cmp $11200, %rbp
lea addresses_normal_ht+0x7ce9, %rsi
lea addresses_WC_ht+0xa059, %rdi
clflush (%rsi)
add %rbp, %rbp
mov $125, %rcx
rep movsl
nop
nop
nop
cmp $60961, %r14
lea addresses_UC_ht+0x15c59, %r9
nop
nop
nop
nop
nop
sub %r15, %r15
mov $0x6162636465666768, %rsi
movq %rsi, %xmm4
and $0xffffffffffffffc0, %r9
movaps %xmm4, (%r9)
nop
nop
nop
add $65188, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %r8
push %rax
push %rbp
push %rsi
// Faulty Load
lea addresses_D+0x7259, %r8
nop
nop
nop
nop
and $17679, %rbp
mov (%r8), %eax
lea oracles, %rsi
and $0xff, %rax
shlq $12, %rax
mov (%rsi,%rax,1), %rax
pop %rsi
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_D', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_D', 'same': True, 'size': 4, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 9, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
test/Succeed/Issue2732-termination.agda
|
shlevy/agda
| 1,989 |
15212
|
-- Andreas, 2017-09-09, re issue #2732
-- eta-contraction needed in termination checker
-- {-# OPTIONS -v term:30 #-}
open import Agda.Builtin.Equality
data O (A : Set) : Set where
leaf : O A
node : (A → O A) → O A
postulate
A : Set
a : A
test1 : (t u : O A) → O A
test1 leaf leaf = leaf
test1 leaf (node g) = test1 leaf (g a)
test1 (node f) leaf = test1 (f a) (node f)
test1 (node f) (node g) = test1 (node λ x → f x) (g a)
-- Should pass even with the eta-expansion.
data Q (A : Set) : Set where
leaf : Q A
node : (f g : A → Q A) (p : f ≡ g) → Q A
-- Having various call arguments in eta-expanded form.
test : (t u : Q A) → Q A
test leaf leaf = leaf
test leaf (node f g p) = test leaf (f a)
test (node f g p) leaf = test (g a) (node f g p)
test (node f .f refl) (node g g' p) = test (node (λ x → f x) _ refl) (g' a)
|
AirMessage/AppleScript/AppleScriptSource/FaceTime/queryIncomingCall.applescript
|
ryanspecter/airmessage-server-next
| 23 |
3056
|
<filename>AirMessage/AppleScript/AppleScriptSource/FaceTime/queryIncomingCall.applescript
--Checks Notification Center for incoming calls, and returns the caller's name
tell application "System Events"
--Wait for a notification call to appear
if not (exists group 1 of UI element 1 of scroll area 1 of window 1 of application process "NotificationCenter") then
return ""
end if
--Get the first notification
set notificationGroup to group 1 of UI element 1 of scroll area 1 of window 1 of application process "NotificationCenter"
--Make sure we're dealing with a FaceTime call notification
if (exists static text 1 of notificationGroup) and (value of static text 1 of notificationGroup = "FaceTime") then
--Return the name of the caller
set callerName to value of static text 2 of notificationGroup
return callerName
else
return ""
end if
end tell
|
stdlib-exts/Data/Vec/Exts.agda
|
WhatisRT/meta-cedille
| 35 |
8703
|
module Data.Vec.Exts where
open import Data.Fin
open import Data.Maybe
open import Data.Nat
open import Data.Vec using (Vec; []; _∷_)
open import Relation.Nullary
open import Relation.Unary
open import Data.Vec.Relation.Unary.Any
findIndex : {n : ℕ} {A : Set} {P : A -> Set} -> Decidable P -> Vec A n -> Maybe (Fin n)
findIndex P? xs with any? P? xs
... | yes ix = just (index ix)
... | no _ = nothing
|
src/cm_mainmenu_rng.asm
|
helgefmi/lttphack
| 28 |
18284
|
; RNG CONTROL {{{
cm_main_goto_rng_control:
%cm_submenu("RNG control", cm_submenu_rng_control)
cm_submenu_rng_control:
dw cm_rng_drops
dw cm_rng_pokey
dw cm_rng_agahnim
dw cm_rng_helmasaur
dw cm_rng_ganon_warp
dw cm_rng_ganon_warp_location
dw cm_rng_eyegore
dw cm_rng_arrghus
dw cm_rng_turtles
dw cm_rng_cannonballs
dw cm_rng_soldiers
dw cm_rng_lanmola
dw cm_rng_conveyor
dw !menu_end
%cm_header("RNG CONTROL")
cm_rng_pokey:
dw !CM_ACTION_CHOICE
dl !ram_pokey_rng
%cm_item("Pokeys")
%cm_item("Random")
%cm_item("ul ul")
%cm_item("ur ul")
%cm_item("dr ul")
%cm_item("dl ul")
%cm_item("ul ur")
%cm_item("ur ur")
%cm_item("dr ur")
%cm_item("dl ur")
%cm_item("ul dr")
%cm_item("ur dr")
%cm_item("dr dr")
%cm_item("dl dr")
%cm_item("ul dl")
%cm_item("ur dl")
%cm_item("dr dl")
%cm_item("dl dl")
db !list_end
cm_rng_agahnim:
dw !CM_ACTION_CHOICE
dl !ram_agahnim_rng
%cm_item("Agahnim")
%cm_item("Random")
%cm_item("Yellow")
%cm_item("Blue")
db !list_end
cm_rng_helmasaur:
dw !CM_ACTION_CHOICE
dl !ram_helmasaur_rng
%cm_item("Helmasaur")
%cm_item("Random")
%cm_item("No fireball")
%cm_item("Fireball")
db !list_end
cm_rng_ganon_warp:
dw !CM_ACTION_CHOICE
dl !ram_ganon_warp_rng
%cm_item("Ganon warps")
%cm_item("Random")
%cm_item("No warp")
%cm_item("Warp")
db !list_end
cm_rng_ganon_warp_location:
dw !CM_ACTION_CHOICE
dl !ram_ganon_warp_location_rng
%cm_item("Ganon warp to")
%cm_item("Random")
%cm_item("Far left")
%cm_item("Bottom left")
%cm_item("Bottom right")
%cm_item("Far right")
db !list_end
cm_rng_eyegore:
dw !CM_ACTION_CHOICE
dl !ram_eyegore_rng
%cm_item("Eyegore walk")
%cm_item("Random")
%cm_item("Short")
%cm_item("Medium")
%cm_item("Long")
db !list_end
cm_rng_arrghus:
dw !CM_ACTION_CHOICE
dl !ram_arrghus_rng
%cm_item("Arrghus walk")
%cm_item("Random")
%cm_item("Shortest")
%cm_item("Short")
%cm_item("Medium")
%cm_item("Long")
%cm_item("Longest")
db !list_end
cm_rng_turtles:
dw !CM_ACTION_CHOICE
dl !ram_turtles_rng
%cm_item("Turtles walk")
%cm_item("Random")
%cm_item("Shortest")
%cm_item("01")
%cm_item("02")
%cm_item("03")
%cm_item("04")
%cm_item("05")
%cm_item("06")
%cm_item("07")
%cm_item("08")
%cm_item("09")
%cm_item("0A")
%cm_item("0B")
%cm_item("0C")
%cm_item("0D")
%cm_item("0E")
%cm_item("0F")
%cm_item("10")
%cm_item("11")
%cm_item("12")
%cm_item("13")
%cm_item("14")
%cm_item("15")
%cm_item("16")
%cm_item("17")
%cm_item("18")
%cm_item("19")
%cm_item("1A")
%cm_item("1B")
%cm_item("1C")
%cm_item("1D")
%cm_item("1E")
%cm_item("Slowest")
db !list_end
cm_rng_cannonballs:
dw !CM_ACTION_CHOICE
dl !ram_cannonballs_rng
%cm_item("Cannonballs")
%cm_item("Random")
%cm_item("00")
%cm_item("01")
%cm_item("02")
%cm_item("03")
%cm_item("04")
%cm_item("05")
%cm_item("06")
%cm_item("07")
%cm_item("08")
%cm_item("09")
%cm_item("0A")
%cm_item("0B")
%cm_item("0C")
%cm_item("0D")
%cm_item("0E")
%cm_item("0F")
%cm_item("10")
%cm_item("11")
%cm_item("12")
%cm_item("13")
%cm_item("14")
%cm_item("15")
%cm_item("16")
%cm_item("17")
%cm_item("18")
%cm_item("19")
%cm_item("1A")
%cm_item("1B")
%cm_item("1C")
%cm_item("1D")
%cm_item("1E")
%cm_item("1F")
db !list_end
cm_rng_soldiers:
dw !CM_ACTION_CHOICE
dl !ram_soldiers_rng
%cm_item("Soldiers")
%cm_item("Random")
%cm_item("00")
%cm_item("01")
%cm_item("02")
%cm_item("03")
%cm_item("04")
%cm_item("05")
%cm_item("06")
%cm_item("07")
%cm_item("08")
%cm_item("09")
%cm_item("0A")
%cm_item("0B")
%cm_item("0C")
%cm_item("0D")
%cm_item("0E")
%cm_item("0F")
%cm_item("10")
%cm_item("11")
%cm_item("12")
%cm_item("13")
%cm_item("14")
%cm_item("15")
%cm_item("16")
%cm_item("17")
%cm_item("18")
%cm_item("19")
%cm_item("1A")
%cm_item("1B")
%cm_item("1C")
%cm_item("1D")
%cm_item("1E")
%cm_item("1F")
db !list_end
cm_rng_lanmola:
dw !CM_ACTION_CHOICE
dl !ram_lanmola_rng
%cm_item("Lanmola exit")
%cm_item("Random")
%cm_item("0,0")
%cm_item("0,1")
%cm_item("0,2")
%cm_item("0,3")
%cm_item("0,4")
%cm_item("0,5")
%cm_item("0,6")
%cm_item("0,7")
%cm_item("1,0")
%cm_item("1,1")
%cm_item("1,2")
%cm_item("1,3")
%cm_item("1,4")
%cm_item("1,5")
%cm_item("1,6")
%cm_item("1,7")
%cm_item("2,0")
%cm_item("2,1")
%cm_item("2,2")
%cm_item("2,3")
%cm_item("2,4")
%cm_item("2,5")
%cm_item("2,6")
%cm_item("2,7")
%cm_item("3,0")
%cm_item("3,1")
%cm_item("3,2")
%cm_item("3,3")
%cm_item("3,4")
%cm_item("3,5")
%cm_item("3,6")
%cm_item("3,7")
%cm_item("4,0")
%cm_item("4,1")
%cm_item("4,2")
%cm_item("4,3")
%cm_item("4,4")
%cm_item("4,5")
%cm_item("4,6")
%cm_item("4,7")
%cm_item("5,0")
%cm_item("5,1")
%cm_item("5,2")
%cm_item("5,3")
%cm_item("5,4")
%cm_item("5,5")
%cm_item("5,6")
%cm_item("5,7")
%cm_item("6,0")
%cm_item("6,1")
%cm_item("6,2")
%cm_item("6,3")
%cm_item("6,4")
%cm_item("6,5")
%cm_item("6,6")
%cm_item("6,7")
%cm_item("7,0")
%cm_item("7,1")
%cm_item("7,2")
%cm_item("7,3")
%cm_item("7,4")
%cm_item("7,5")
%cm_item("7,6")
%cm_item("7,7")
db !list_end
cm_rng_conveyor:
dw !CM_ACTION_CHOICE
dl !ram_conveyor_rng
%cm_item("Conveyor belt")
%cm_item("Random")
%cm_item("Right")
%cm_item("Left")
%cm_item("Down")
%cm_item("Up")
db !list_end
cm_rng_drops:
dw !CM_ACTION_CHOICE
dl !ram_drop_rng
%cm_item("Prize packs")
%cm_item("Vanilla")
%cm_item("Always")
%cm_item("Never")
db !list_end
; }}}
|
oeis/168/A168463.asm
|
neoneye/loda-programs
| 11 |
14304
|
; A168463: a(n) = 5 + 11*floor(n/2).
; Submitted by <NAME>
; 5,16,16,27,27,38,38,49,49,60,60,71,71,82,82,93,93,104,104,115,115,126,126,137,137,148,148,159,159,170,170,181,181,192,192,203,203,214,214,225,225,236,236,247,247,258,258,269,269,280,280,291,291,302,302,313,313,324,324,335,335,346,346,357,357,368,368,379,379,390,390,401,401,412,412,423,423,434,434,445,445,456,456,467,467,478,478,489,489,500,500,511,511,522,522,533,533,544,544,555
add $0,1
div $0,2
mul $0,11
add $0,5
|
Z80/basic_usr_test/bak.asm
|
BleuLlama/LlamaVampireDrive
| 4 |
29520
|
<reponame>BleuLlama/LlamaVampireDrive<gh_stars>1-10
; example code for a BASIC USR function
TermStatus = 0x80
TermData = 0x81
DEINT = 0x0a07
ABPASS = 0x117D
.module BASIC_USR
.area .CODE (ABS)
.org 0xF800
usr:
ld a, r
ld b, #0
call ABPASS
ret
call DEINT
ld a, e
cp #10
jr c, usr_00
ld a, #'H
out (TermData), a
ld a, #'I
out (TermData), a
ld a, #0x0d
out (TermData), a
ld a, #0x0a
out (TermData), a
ld a, #0
ld b, #42
jr usr_ret
usr_00:
inc de
ld a, d
ld b, e
usr_ret:
call ABPASS
ret
|
alloy4fun_models/trashltl/models/3/2YEPgmcbg9WPCs4Y4.als
|
Kaixi26/org.alloytools.alloy
| 0 |
3938
|
<gh_stars>0
open main
pred id2YEPgmcbg9WPCs4Y4_prop4 {
some f : File | eventually (f not in Trash and f in Trash')
}
pred __repair { id2YEPgmcbg9WPCs4Y4_prop4 }
check __repair { id2YEPgmcbg9WPCs4Y4_prop4 <=> prop4o }
|
courses/fundamentals_of_ada/labs/prompts/090_overloading/main.adb
|
AdaCore/training_material
| 15 |
14745
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
--Conversion_Functions
type Digit_T is range 0 .. 9;
type Digit_Name_T is
(Zero, One, Two, Three, Four, Five, Six, Seven, Eight, Nine);
-- functions to convert between Digit_T, Digit_Name_T, and input values
-- function Convert ( ?
-- functions to compare across types
-- function "=" ( ?
Last_Entry : Digit_T := 0;
begin
loop
Put ("Input: ");
declare
Str : constant String := Get_Line;
begin
exit when Str'length = 0;
-- If the string is a number
-- Convert the entry to a name and print it
-- if this input has the same value as the previous value, say so
-- Else (this is a name)
-- Convert the entry to a number and print it
-- if this input has the same value as the previous value, say so
end;
end loop;
end Main;
--Main
|
test/asset/agda-stdlib-1.0/Data/List/Any.agda
|
omega12345/agda-mode
| 0 |
15432
|
------------------------------------------------------------------------
-- The Agda standard library
--
-- This module is DEPRECATED. Please use Data.List.Relation.Unary.Any
-- directly.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.List.Any where
open import Data.List.Relation.Unary.Any public
|
data/pokemon/dex_entries/kricketune.asm
|
AtmaBuster/pokeplat-gen2
| 6 |
241525
|
db "CRICKET@" ; species name
db "By allowing its"
next "cry to resonate in"
next "the hollow of its"
page "belly, it can"
next "produce a"
next "captivating sound.@"
|
experiments/test-suite/mutation-based/10/8/fsm.als
|
kaiyuanw/AlloyFLCore
| 1 |
1126
|
<filename>experiments/test-suite/mutation-based/10/8/fsm.als<gh_stars>1-10
pred test8 {
some disj FSM0: FSM {some disj State0, State1, State2: State {
FSM = FSM0
start = FSM0->State2
no stop
State = State0 + State1 + State2
transition = State1->State1 + State2->State0 + State2->State1
}}
}
run test8 for 3 expect 0
|
tests/asm/16/disp.asm
|
ReneNyffenegger/udis86
| 710 |
11621
|
[bits 16]
mov ax, [eax-0x10]
add bx, [esi+0x10]
add ax, [0xffff]
add ax, [esi+edi*4-0x10]
add ax, [bx+si-0x4877]
|
src/core0/test/loop_none.asm
|
uarc/nexys4-u0-32
| 0 |
87839
|
8
0 loop:+
0
:+
# Align the program
palign:0xC0,32
|
drivers/NVMSIM/test/bandwidth-1.9.3/routines-arm-rpi-32bit.asm
|
huqianshan/OperatingSystemAndCompiler
| 1 |
14689
|
<reponame>huqianshan/OperatingSystemAndCompiler
@============================================================================
@ bandwidth, a benchmark to estimate memory transfer bandwidth.
@ ARM assembly module.
@ Copyright (C) 2010, 2016 by <NAME>.
@
@ This program is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 2 of the License, or
@ (at your option) any later version.
@
@ This program is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ GNU General Public License for more details.
@
@ You should have received a copy of the GNU General Public License
@ along with this program; if not, write to the Free Software
@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@
@ The author may be reached at <EMAIL>.
@=============================================================================
@ Version 0.9 for the Raspberry pi.
@ Note, some instructions are not supported by the ARM CPU in the Raspberry pi 2.
.section code
.globl Writer
.globl WriterVector
.globl RandomWriter
.globl RandomWriterVector
.globl Reader
.globl ReaderVector
.globl RandomReader
.globl RandomReaderVector
.globl RegisterToRegister
.globl VectorToVector
.globl StackReader
.globl StackWriter
.text
@-----------------------------------------------------------------------------
@ Name: Writer
@ Purpose: Performs sequential write into memory, as fast as possible.
@ Params:
@ r0 = address
@ r1 = length, multiple of 256
@ r2 = count
@ r3 = value to write
@-----------------------------------------------------------------------------
Writer:
stmfd sp!,{r4, r5, r6, r7, r8, r9, r10, r11, r12, lr}
@ r4 = temp
@ r5 = temp
and r1, #0xffffff80
mov r4, r0
mov r5, r1
mov r6, r3
mov r7, r3
mov r8, r3
mov r9, r3
mov r10, r3
mov r11, r3
mov r12, r3
.L0:
mov r0, r4
mov r1, r5
.L1:
@ Does 64 transfers, 4 bytes each = 256 bytes total.
@ The "stmia" instruction automatically increments r0.
stmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
stmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
stmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
stmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
stmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
stmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
stmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
stmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
sub r1, #256
cmp r1, #0
bne .L1
sub r2, #1
cmp r2, #0
bne .L0
@ return.
ldmfd sp!,{r4, r5, r6, r7, r8, r9, r10, r11, r12, pc}
@-----------------------------------------------------------------------------
@ Name: WriterVector
@ Purpose: Performs sequential write into memory, as fast as possible.
@ Params:
@ r0 = address
@ r1 = length, multiple of 256
@ r2 = count
@ r3 = value to write
@-----------------------------------------------------------------------------
WriterVector:
stmfd sp!,{r4, r5, lr}
@ r4 = temp
@ r5 = temp
and r1, #0xffffff80
mov r4, r0
mov r5, r1
.L0v:
mov r0, r4
mov r1, r5
.L1v:
@ The vstmia instruction will automatically increment r0.
@ This does 32 transfers, 8 bytes each = 256 bytes total.
@ vstmia r0!, { d0 - d7 }
@ vstmia r0!, { d0 - d7 }
@ vstmia r0!, { d0 - d7 }
@ vstmia r0!, { d0 - d7 }
@ This does 16 transfers, 16 bytes each = 256 bytes total.
vstmia r0!, {q0,q1,q2,q3,q4,q5,q6,q7}
vstmia r0!, {q0,q1,q2,q3,q4,q5,q6,q7}
sub r1, #256
cmp r1, #0
bne .L1v
sub r2, #1
cmp r2, #0
bne .L0v
@ return.
ldmfd sp!,{r4, r5, pc}
@-----------------------------------------------------------------------------
@ Name: Reader
@ Purpose: Performs sequential reads from memory, as fast as possible.
@ Params:
@ r0 = address
@ r1 = length, multiple of 256
@ r2 = count
@-----------------------------------------------------------------------------
Reader:
stmfd sp!,{r4, r5, r6, r7, r8, r9, r10, r11, r12, lr}
@ r3 = temp
and r1, #0xffffff80
mov r4, r0
mov r5, r1
.L2:
mov r0, r4
mov r1, r5
.L3:
@ Does 64 transfers, 4 bytes each = 256 bytes total.
@ The "ldmia" instruction automatically increments r0.
ldmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
ldmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
ldmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
ldmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
ldmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
ldmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
ldmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
ldmia r0!, { r3, r6, r7, r8, r9, r10, r11, r12 }
sub r1, #256
cmp r1, #0
bne .L3
sub r2, #1
cmp r2, #0
bne .L2
@ return.
ldmfd sp!,{r4, r5, r6, r7, r8, r9, r10, r11, r12, pc}
@-----------------------------------------------------------------------------
@ Name: ReaderVector
@ Purpose: Performs sequential reads from memory, as fast as possible.
@ Params:
@ r0 = address
@ r1 = length, multiple of 256
@ r2 = count
@-----------------------------------------------------------------------------
ReaderVector:
stmfd sp!,{r4, r5, lr}
@ r3 = temp
and r1, #0xffffff80
mov r4, r0
mov r5, r1
.L2v:
mov r0, r4
mov r1, r5
.L3v:
@ NOTE: The vldmia instruction will automatically increment r0.
@ 16 bytes * 16 = 256
vldmia r0!, {q0,q1,q2,q3,q4,q5,q6,q7}
vldmia r0!, {q0,q1,q2,q3,q4,q5,q6,q7}
sub r1, #256
cmp r1, #0
bne .L3v
sub r2, #1
cmp r2, #0
bne .L2v
@ return.
ldmfd sp!,{r4, r5, pc}
@-----------------------------------------------------------------------------
@ Name: RandomWriter
@ Purpose: Performs random write into memory, as fast as possible.
@ Params:
@ r0 = pointer to array of chunk pointers
@ r1 = # of 256-byte chunks
@ r2 = # loops to do
@ r3 = value to write
@-----------------------------------------------------------------------------
RandomWriter:
stmfd sp!,{r4, r5, lr}
@ r4 = temp
@ r5 = temp
.L4:
mov r5, #0
.L5:
@ Get pointer to chunk in memory.
ldr r4, [r0, r5, LSL #2]
@ Does 64 transfers, 4 bytes each = 256 bytes total.
str r3, [r4, #160]
str r3, [r4, #232]
str r3, [r4, #224]
str r3, [r4, #96]
str r3, [r4, #164]
str r3, [r4, #76]
str r3, [r4, #100]
str r3, [r4, #220]
str r3, [r4, #248]
str r3, [r4, #104]
str r3, [r4, #4]
str r3, [r4, #136]
str r3, [r4, #112]
str r3, [r4, #200]
str r3, [r4, #12]
str r3, [r4, #128]
str r3, [r4, #148]
str r3, [r4, #196]
str r3, [r4, #216]
str r3, [r4]
str r3, [r4, #84]
str r3, [r4, #140]
str r3, [r4, #204]
str r3, [r4, #184]
str r3, [r4, #124]
str r3, [r4, #48]
str r3, [r4, #64]
str r3, [r4, #212]
str r3, [r4, #240]
str r3, [r4, #236]
str r3, [r4, #24]
str r3, [r4, #252]
str r3, [r4, #68]
str r3, [r4, #20]
str r3, [r4, #72]
str r3, [r4, #32]
str r3, [r4, #28]
str r3, [r4, #52]
str r3, [r4, #244]
str r3, [r4, #180]
str r3, [r4, #80]
str r3, [r4, #60]
str r3, [r4, #8]
str r3, [r4, #56]
str r3, [r4, #208]
str r3, [r4, #228]
str r3, [r4, #40]
str r3, [r4, #172]
str r3, [r4, #120]
str r3, [r4, #176]
str r3, [r4, #108]
str r3, [r4, #132]
str r3, [r4, #16]
str r3, [r4, #44]
str r3, [r4, #92]
str r3, [r4, #168]
str r3, [r4, #152]
str r3, [r4, #156]
str r3, [r4, #188]
str r3, [r4, #36]
str r3, [r4, #88]
str r3, [r4, #116]
str r3, [r4, #192]
str r3, [r4, #144]
add r5, #1
cmp r5, r1
bne .L5
sub r2, #1
cmp r2, #0
bne .L4
@ return.
ldmfd sp!,{r4, r5, pc}
@-----------------------------------------------------------------------------
@ Name: RandomWriterVector
@ Purpose: Performs random write into memory, as fast as possible.
@ Params:
@ r0 = pointer to array of chunk pointers
@ r1 = # of 256-byte chunks
@ r2 = # loops to do
@ r3 = value to write
@-----------------------------------------------------------------------------
RandomWriterVector:
stmfd sp!,{r4, r5, lr}
@ r4 = temp
@ r5 = temp
.L4v:
mov r5, #0
.L5v:
@ Get pointer to chunk in memory.
ldr r4, [r0, r5, LSL #2]
@ Does 16 transfers, 16 bytes each = 256 bytes total.
@ vstr q0, [r4, #48]
@ vstr q0, [r4, #128]
@ vstr q0, [r4, #16]
@ vstr q0, [r4, #208]
@ vstr q0, [r4, #80]
@ vstr q0, [r4, #0]
@ vstr q0, [r4, #32]
@ vstr q0, [r4, #224]
@ vstr q0, [r4, #112]
@ vstr q0, [r4, #96]
@ vstr q0, [r4, #192]
@ vstr q0, [r4, #160]
@ vstr q0, [r4, #96]
@ vstr q0, [r4, #144]
@ vstr q0, [r4, #64]
@ vstr q0, [r4, #240]
@ Does 32 transfers, 8 bytes each = 256 bytes total.
vstr d0, [r4, #56]
vstr d0, [r4, #136]
vstr d0, [r4, #200]
vstr d0, [r4, #80]
vstr d0, [r4, #16]
vstr d0, [r4, #64]
vstr d0, [r4, #192]
vstr d0, [r4, #240]
vstr d0, [r4, #24]
vstr d0, [r4, #104]
vstr d0, [r4, #192]
vstr d0, [r4, #168]
vstr d0, [r4, #96]
vstr d0, [r4, #16]
vstr d0, [r4, #152]
vstr d0, [r4, #56]
vstr d0, [r4, #184]
vstr d0, [r4, #136]
vstr d0, [r4, #192]
vstr d0, [r4, #160]
vstr d0, [r4, #120]
vstr d0, [r4, #136]
vstr d0, [r4, #104]
vstr d0, [r4, #40]
vstr d0, [r4, #192]
vstr d0, [r4, #168]
vstr d0, [r4, #88]
vstr d0, [r4, #176]
vstr d0, [r4, #64]
vstr d0, [r4, #56]
vstr d0, [r4, #200]
vstr d0, [r4, #144]
add r5, #1
cmp r5, r1
bne .L5v
sub r2, #1
cmp r2, #0
bne .L4v
@ return.
ldmfd sp!,{r4, r5, pc}
@-----------------------------------------------------------------------------
@ Name: RandomReader
@ Purpose: Performs random reads from memory, as fast as possible.
@ Params:
@ r0 = pointer to array of chunk pointers
@ r1 = # of 256-byte chunks
@ r2 = # loops to do
@-----------------------------------------------------------------------------
RandomReader:
stmfd sp!,{r4, r5, lr}
@ r3 = temp
@ r4 = temp
@ r5 = temp
.L6:
mov r5, #0
.L7:
@ Get pointer to chunk in memory.
ldr r4, [r0, r5, LSL #2]
@ Does 64 transfers, 4 bytes each = 256 bytes total.
ldr r3, [r4, #160]
ldr r3, [r4, #232]
ldr r3, [r4, #224]
ldr r3, [r4, #96]
ldr r3, [r4, #164]
ldr r3, [r4, #76]
ldr r3, [r4, #100]
ldr r3, [r4, #220]
ldr r3, [r4, #248]
ldr r3, [r4, #104]
ldr r3, [r4, #4]
ldr r3, [r4, #136]
ldr r3, [r4, #112]
ldr r3, [r4, #200]
ldr r3, [r4, #12]
ldr r3, [r4, #128]
ldr r3, [r4, #148]
ldr r3, [r4, #196]
ldr r3, [r4, #216]
ldr r3, [r4]
ldr r3, [r4, #84]
ldr r3, [r4, #140]
ldr r3, [r4, #204]
ldr r3, [r4, #184]
ldr r3, [r4, #124]
ldr r3, [r4, #48]
ldr r3, [r4, #64]
ldr r3, [r4, #212]
ldr r3, [r4, #240]
ldr r3, [r4, #236]
ldr r3, [r4, #24]
ldr r3, [r4, #252]
ldr r3, [r4, #68]
ldr r3, [r4, #20]
ldr r3, [r4, #72]
ldr r3, [r4, #32]
ldr r3, [r4, #28]
ldr r3, [r4, #52]
ldr r3, [r4, #244]
ldr r3, [r4, #180]
ldr r3, [r4, #80]
ldr r3, [r4, #60]
ldr r3, [r4, #8]
ldr r3, [r4, #56]
ldr r3, [r4, #208]
ldr r3, [r4, #228]
ldr r3, [r4, #40]
ldr r3, [r4, #172]
ldr r3, [r4, #120]
ldr r3, [r4, #176]
ldr r3, [r4, #108]
ldr r3, [r4, #132]
ldr r3, [r4, #16]
ldr r3, [r4, #44]
ldr r3, [r4, #92]
ldr r3, [r4, #168]
ldr r3, [r4, #152]
ldr r3, [r4, #156]
ldr r3, [r4, #188]
ldr r3, [r4, #36]
ldr r3, [r4, #88]
ldr r3, [r4, #116]
ldr r3, [r4, #192]
ldr r3, [r4, #144]
add r5, #1
cmp r5, r1
bne .L7
sub r2, #1
cmp r2, #0
bne .L6
@ return.
ldmfd sp!,{r4, r5, pc}
@-----------------------------------------------------------------------------
@ Name: RandomReaderVector
@ Purpose: Performs random reads from memory, as fast as possible.
@ Params:
@ r0 = pointer to array of chunk pointers
@ r1 = # of 256-byte chunks
@ r2 = # loops to do
@-----------------------------------------------------------------------------
RandomReaderVector:
stmfd sp!,{r4, r5, lr}
@ r3 = temp
@ r4 = temp
@ r5 = temp
.L6v:
mov r5, #0
.L7v:
@ Get pointer to chunk in memory.
ldr r4, [r0, r5, LSL #2]
@ Does 16 transfers, 16 bytes each = 256 bytes total.
@ vldr q0, [r4, #48]
@ vldr q0, [r4, #128]
@ vldr q0, [r4, #16]
@ vldr q0, [r4, #208]
@ vldr q0, [r4, #80]
@ vldr q0, [r4, #0]
@ vldr q0, [r4, #32]
@ vldr q0, [r4, #224]
@ vldr q0, [r4, #112]
@ vldr q0, [r4, #96]
@ vldr q0, [r4, #192]
@ vldr q0, [r4, #160]
@ vldr q0, [r4, #96]
@ vldr q0, [r4, #144]
@ vldr q0, [r4, #64]
@ vldr q0, [r4, #240]
@ Does 32 transfers, 8 bytes each = 256 bytes total.
vldr d0, [r4, #56]
vldr d0, [r4, #136]
vldr d0, [r4, #200]
vldr d0, [r4, #80]
vldr d0, [r4, #16]
vldr d0, [r4, #64]
vldr d0, [r4, #192]
vldr d0, [r4, #240]
vldr d0, [r4, #24]
vldr d0, [r4, #104]
vldr d0, [r4, #192]
vldr d0, [r4, #168]
vldr d0, [r4, #96]
vldr d0, [r4, #16]
vldr d0, [r4, #152]
vldr d0, [r4, #56]
vldr d0, [r4, #184]
vldr d0, [r4, #136]
vldr d0, [r4, #192]
vldr d0, [r4, #160]
vldr d0, [r4, #120]
vldr d0, [r4, #136]
vldr d0, [r4, #104]
vldr d0, [r4, #40]
vldr d0, [r4, #192]
vldr d0, [r4, #168]
vldr d0, [r4, #88]
vldr d0, [r4, #176]
vldr d0, [r4, #64]
vldr d0, [r4, #56]
vldr d0, [r4, #200]
vldr d0, [r4, #144]
add r5, #1
cmp r5, r1
bne .L7v
sub r2, #1
cmp r2, #0
bne .L6v
@ return.
ldmfd sp!,{r4, r5, pc}
@-----------------------------------------------------------------------------
@ Name: RegisterToRegister
@ Purpose: Performs register-to-register transfers.
@ Params:
@ r0 = count
@-----------------------------------------------------------------------------
RegisterToRegister:
stmfd sp!,{lr}
@ r1 = temp
.L8:
@ Does 64 transfers, 4 bytes each = 256 bytes total.
mov r1, r2
mov r1, r3
mov r1, r4
mov r1, r5
mov r1, r6
mov r1, r7
mov r1, r8
mov r1, r9
mov r2, r1
mov r2, r3
mov r2, r4
mov r2, r5
mov r2, r6
mov r2, r7
mov r2, r8
mov r2, r9
mov r1, r2
mov r1, r3
mov r1, r4
mov r1, r5
mov r1, r6
mov r1, r7
mov r1, r8
mov r1, r9
mov r1, r2
mov r1, r3
mov r1, r4
mov r1, r5
mov r1, r6
mov r1, r7
mov r1, r8
mov r1, r9
mov r1, r2
mov r1, r3
mov r1, r4
mov r1, r5
mov r1, r6
mov r1, r7
mov r1, r8
mov r1, r9
mov r1, r2
mov r1, r3
mov r1, r4
mov r1, r5
mov r1, r6
mov r1, r7
mov r1, r8
mov r1, r9
mov r1, r2
mov r1, r3
mov r1, r4
mov r1, r5
mov r1, r6
mov r1, r7
mov r1, r8
mov r1, r9
mov r1, r2
mov r1, r3
mov r1, r4
mov r1, r5
mov r1, r6
mov r1, r7
mov r1, r8
mov r1, r9
sub r0, #1
cmp r0, #0
bne .L8
@ return.
ldmfd sp!,{pc}
@-----------------------------------------------------------------------------
@ Name: VectorToVector
@ Purpose: Performs register-to-register transfers.
@ Params:
@ r0 = count
@-----------------------------------------------------------------------------
VectorToVector:
stmfd sp!,{lr}
@ r1 = temp
.L8v:
@ Does 16 transfers, 16 bytes each = 256 bytes total.
vmov q1, q2
vmov q1, q3
vmov q1, q4
vmov q1, q5
vmov q1, q6
vmov q1, q7
vmov q1, q8
vmov q1, q9
vmov q1, q10
vmov q1, q11
vmov q1, q12
vmov q1, q13
vmov q1, q14
vmov q1, q15
vmov q2, q13
vmov q2, q3
@ Does 32 transfers, 8 bytes each = 256 bytes total.
@ vmov d1, d2
@ vmov d1, d3
@ vmov d1, d4
@ vmov d1, d5
@ vmov d1, d6
@ vmov d1, d7
@ vmov d1, d8
@ vmov d1, d9
@ vmov d2, d1
@ vmov d2, d3
@ vmov d2, d4
@ vmov d2, d5
@ vmov d2, d6
@ vmov d2, d7
@ vmov d2, d8
@ vmov d2, d9
@ vmov d1, d2
@ vmov d1, d3
@ vmov d1, d4
@ vmov d1, d5
@ vmov d1, d6
@ vmov d1, d7
@ vmov d1, d8
@ vmov d1, d9
@ vmov d2, d1
@ vmov d2, d3
@ vmov d2, d4
@ vmov d2, d5
@ vmov d2, d6
@ vmov d2, d7
@ vmov d2, d8
@ vmov d2, d9
sub r0, #1
cmp r0, #0
bne .L8v
@ return.
ldmfd sp!,{pc}
@-----------------------------------------------------------------------------
@ Name: StackReader
@ Purpose: Performs stack-to-register transfers.
@ Params:
@ r0 = count
@-----------------------------------------------------------------------------
StackReader:
stmfd sp!,{lr}
@ r1 = temp
sub sp, #32
.L9:
@ Does 64 transfers, 4 bytes each = 256 bytes total.
ldr r1, [sp]
ldr r1, [sp, #4]
ldr r1, [sp, #8]
ldr r1, [sp, #12]
ldr r1, [sp, #16]
ldr r1, [sp, #20]
ldr r1, [sp, #24]
ldr r1, [sp, #28]
ldr r1, [sp]
ldr r1, [sp, #4]
ldr r1, [sp, #8]
ldr r1, [sp, #12]
ldr r1, [sp, #16]
ldr r1, [sp, #20]
ldr r1, [sp, #24]
ldr r1, [sp, #28]
ldr r1, [sp]
ldr r1, [sp, #4]
ldr r1, [sp, #8]
ldr r1, [sp, #12]
ldr r1, [sp, #16]
ldr r1, [sp, #20]
ldr r1, [sp, #24]
ldr r1, [sp, #28]
ldr r1, [sp]
ldr r1, [sp, #4]
ldr r1, [sp, #8]
ldr r1, [sp, #12]
ldr r1, [sp, #16]
ldr r1, [sp, #20]
ldr r1, [sp, #24]
ldr r1, [sp, #28]
ldr r1, [sp]
ldr r1, [sp, #4]
ldr r1, [sp, #8]
ldr r1, [sp, #12]
ldr r1, [sp, #16]
ldr r1, [sp, #20]
ldr r1, [sp, #24]
ldr r1, [sp, #28]
ldr r1, [sp]
ldr r1, [sp, #4]
ldr r1, [sp, #8]
ldr r1, [sp, #12]
ldr r1, [sp, #16]
ldr r1, [sp, #20]
ldr r1, [sp, #24]
ldr r1, [sp, #28]
ldr r1, [sp]
ldr r1, [sp, #4]
ldr r1, [sp, #8]
ldr r1, [sp, #12]
ldr r1, [sp, #16]
ldr r1, [sp, #20]
ldr r1, [sp, #24]
ldr r1, [sp, #28]
ldr r1, [sp]
ldr r1, [sp, #4]
ldr r1, [sp, #8]
ldr r1, [sp, #12]
ldr r1, [sp, #16]
ldr r1, [sp, #20]
ldr r1, [sp, #24]
ldr r1, [sp, #28]
sub r0, #1
cmp r0, #0
bne .L9
add sp, #32
@ return.
ldmfd sp!,{pc}
@-----------------------------------------------------------------------------
@ Name: StackWriter
@ Purpose: Performs register-to-stack transfers.
@ Params:
@ r0 = count
@-----------------------------------------------------------------------------
StackWriter:
stmfd sp!,{lr}
@ r1 = temp
sub sp, #32
.L10:
@ Does 64 transfers, 4 bytes each = 256 bytes total.
str r1, [sp]
str r1, [sp, #4]
str r1, [sp, #8]
str r1, [sp, #12]
str r1, [sp, #16]
str r1, [sp, #20]
str r1, [sp, #24]
str r1, [sp, #28]
str r1, [sp]
str r1, [sp, #4]
str r1, [sp, #8]
str r1, [sp, #12]
str r1, [sp, #16]
str r1, [sp, #20]
str r1, [sp, #24]
str r1, [sp, #28]
str r1, [sp]
str r1, [sp, #4]
str r1, [sp, #8]
str r1, [sp, #12]
str r1, [sp, #16]
str r1, [sp, #20]
str r1, [sp, #24]
str r1, [sp, #28]
str r1, [sp]
str r1, [sp, #4]
str r1, [sp, #8]
str r1, [sp, #12]
str r1, [sp, #16]
str r1, [sp, #20]
str r1, [sp, #24]
str r1, [sp, #28]
str r1, [sp]
str r1, [sp, #4]
str r1, [sp, #8]
str r1, [sp, #12]
str r1, [sp, #16]
str r1, [sp, #20]
str r1, [sp, #24]
str r1, [sp, #28]
str r1, [sp]
str r1, [sp, #4]
str r1, [sp, #8]
str r1, [sp, #12]
str r1, [sp, #16]
str r1, [sp, #20]
str r1, [sp, #24]
str r1, [sp, #28]
str r1, [sp]
str r1, [sp, #4]
str r1, [sp, #8]
str r1, [sp, #12]
str r1, [sp, #16]
str r1, [sp, #20]
str r1, [sp, #24]
str r1, [sp, #28]
str r1, [sp]
str r1, [sp, #4]
str r1, [sp, #8]
str r1, [sp, #12]
str r1, [sp, #16]
str r1, [sp, #20]
str r1, [sp, #24]
str r1, [sp, #28]
sub r0, #1
cmp r0, #0
bne .L10
add sp, #32
@ return.
ldmfd sp!,{pc}
|
Project.asm
|
Ivan-Medvedev/Integrals_Counting
| 0 |
3863
|
<reponame>Ivan-Medvedev/Integrals_Counting
;%include "io.inc"
section .bss
x resq 1
section .data
ln2 dq 0.69314718056
one dq 1.0
two dq 2.0
e dq 2.71828182845904523536
three dq 3.0
four dq 4.0
neight dq -8.0
section .rodata
lf db "%lf", 0
section .text
EXTERN pow
EXTERN log
EXTERN printf
EXTERN scanf
global f1
global f2
global f3
global f1_diff
global f2_diff
global f3_diff
f1:
push ebp
mov ebp, esp
and esp, -16
sub esp, 16
mov eax, dword[ebp + 8]
mov edx, dword[ebp + 12]
mov dword[x], eax
mov dword[x + 4], edx
fld qword[one]
fld qword[four]
fld qword[one]
fld qword[x]
fld qword[x]
fmulp
faddp
fdivp
faddp
mov esp, ebp
pop ebp
ret
f2:
push ebp
mov ebp, esp
and esp, -16
sub esp, 16
mov eax, dword[ebp + 8]
mov dword[esp], eax
mov edx, dword[ebp + 12]
mov dword[esp + 4], edx
mov edx, 0x40080000
xor eax, eax
;mov eax, dword[three]
;mov edx, dword[three + 4]
mov dword[esp + 8], eax
mov dword[esp + 12], edx
call pow
mov esp, ebp
pop ebp
ret
f3:
push ebp
mov ebp, esp
and esp, -16
sub esp, 16
mov eax, dword[ebp + 8]
mov edx, dword[ebp + 12]
mov dword[x], eax
mov dword[x + 4], edx
fld qword[x]
fchs
fst qword[x]
mov eax, dword[x]
mov edx, dword[x + 4]
mov dword[esp + 8], eax
mov dword[esp + 12], edx
mov eax, dword[two]
mov edx, dword[two + 4]
mov dword[esp], eax
mov dword[esp + 4], edx
call pow
mov esp, ebp
pop ebp
ret
f1_diff:
push ebp
mov ebp, esp
mov eax, dword[ebp + 8]
mov edx, dword[ebp + 12]
mov dword[x], eax
mov dword[x + 4], edx
fld qword[neight]
fld qword[x]
fmulp
fld qword[x]
fld qword[x]
fmulp
fld qword[one]
faddp
fld qword[x]
fld qword[x]
fmulp
fld qword[one]
faddp
fmulp
fdivp
mov esp, ebp
pop ebp
ret
f2_diff:
push ebp
mov ebp, esp
mov eax, dword[ebp + 8]
mov edx, dword[ebp + 12]
mov dword[x], eax
mov dword[x + 4], edx
fld qword[three]
fld qword[x]
fmulp
fld qword[x]
fmulp
mov esp, ebp
pop ebp
ret
f3_diff:
push ebp
mov ebp, esp
and esp, -16
sub esp, 16
mov eax, dword[ebp + 8]
mov edx, dword[ebp + 12]
mov dword[esp], eax
mov dword[esp + 4], edx
call f3
fld qword[ln2]
fmulp
fchs
mov esp, ebp
pop ebp
ret
_start_2:
mov ebp, esp; for correct debugging
push ebp
mov ebp, esp
and esp, -16
sub esp, 16
mov dword[esp], lf
mov dword[esp + 4], x
call scanf
mov eax, dword[x]
mov edx, dword[x + 4]
mov dword[esp], eax
mov dword[esp + 4], edx
call f3_diff
fst qword[x]
mov eax, dword[x]
mov edx, dword[x + 4]
mov dword[esp + 4], eax
mov dword[esp + 8], edx
mov dword[esp], lf
call printf
mov esp, ebp
pop ebp
xor eax, eax
ret
|
programs/oeis/134/A134498.asm
|
neoneye/loda
| 22 |
16916
|
<reponame>neoneye/loda
; A134498: a(n) = Fibonacci(7n).
; 0,13,377,10946,317811,9227465,267914296,7778742049,225851433717,6557470319842,190392490709135,5527939700884757,160500643816367088,4660046610375530309,135301852344706746049,3928413764606871165730
mul $0,7
seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
|
src/Constants.agda
|
nad/chi
| 2 |
17322
|
------------------------------------------------------------------------
-- Various constants
------------------------------------------------------------------------
open import Atom
module Constants (atoms : χ-atoms) where
open χ-atoms atoms
c-zero : Const
c-zero = C.name 0
c-suc : Const
c-suc = C.name 1
c-nil : Const
c-nil = C.name 2
c-cons : Const
c-cons = C.name 3
c-apply : Const
c-apply = C.name 4
c-case : Const
c-case = C.name 5
c-rec : Const
c-rec = C.name 6
c-lambda : Const
c-lambda = C.name 7
c-const : Const
c-const = C.name 8
c-var : Const
c-var = C.name 9
c-branch : Const
c-branch = C.name 10
c-true : Const
c-true = C.name 11
c-false : Const
c-false = C.name 12
c-pair : Const
c-pair = C.name 13
v-equal : Var
v-equal = V.name 0
v-m : Var
v-m = V.name 1
v-n : Var
v-n = V.name 2
v-x : Var
v-x = V.name 3
v-new : Var
v-new = V.name 4
v-e : Var
v-e = V.name 5
v-subst : Var
v-subst = V.name 6
v-e₁ : Var
v-e₁ = V.name 7
v-e₂ : Var
v-e₂ = V.name 8
v-bs : Var
v-bs = V.name 9
v-y : Var
v-y = V.name 10
v-c : Var
v-c = V.name 11
v-es : Var
v-es = V.name 12
v-ys : Var
v-ys = V.name 13
v-member : Var
v-member = V.name 14
v-xs : Var
v-xs = V.name 15
v-lookup : Var
v-lookup = V.name 16
v-b : Var
v-b = V.name 17
v-c′ : Var
v-c′ = V.name 18
v-underscore : Var
v-underscore = V.name 19
v-substs : Var
v-substs = V.name 20
v-e′ : Var
v-e′ = V.name 21
v-map : Var
v-map = V.name 22
v-p : Var
v-p = V.name 23
v-eval : Var
v-eval = V.name 24
v-internal-code : Var
v-internal-code = V.name 25
v-halts : Var
v-halts = V.name 26
v-z : Var
v-z = V.name 27
v-f : Var
v-f = V.name 28
v-g : Var
v-g = V.name 29
|
alloy4fun_models/trainstlt/models/7/Ai3YLCtZf8Ep83mpE.als
|
Kaixi26/org.alloytools.alloy
| 0 |
5330
|
<reponame>Kaixi26/org.alloytools.alloy
open main
pred idAi3YLCtZf8Ep83mpE_prop8 {
always (all t:Train |( (some t.pos and some t.pos.signal and some t.pos.prox) and (t.pos.signal) in (Signal-Green) ) implies(some t.pos') since ((t.pos'.signal) in Green))
}
pred __repair { idAi3YLCtZf8Ep83mpE_prop8 }
check __repair { idAi3YLCtZf8Ep83mpE_prop8 <=> prop8o }
|
sw/552tests/rand_simple/t_4_slbi.asm
|
JPShen-UWM/ThreadKraken
| 1 |
81501
|
<reponame>JPShen-UWM/ThreadKraken<gh_stars>1-10
// seed 4
lbi r0, 243 // icount 0
slbi r0, 155 // icount 1
lbi r1, 219 // icount 2
slbi r1, 103 // icount 3
lbi r2, 136 // icount 4
slbi r2, 74 // icount 5
lbi r3, 208 // icount 6
slbi r3, 2 // icount 7
lbi r4, 29 // icount 8
slbi r4, 135 // icount 9
lbi r5, 121 // icount 10
slbi r5, 124 // icount 11
lbi r6, 187 // icount 12
slbi r6, 204 // icount 13
lbi r7, 71 // icount 14
slbi r7, 173 // icount 15
slbi r5, 3 // icount 16
slbi r4, 1 // icount 17
slbi r1, 12 // icount 18
slbi r6, 10 // icount 19
slbi r3, 1 // icount 20
slbi r7, 7 // icount 21
slbi r5, 15 // icount 22
slbi r0, 10 // icount 23
slbi r3, 12 // icount 24
slbi r5, 5 // icount 25
slbi r5, 2 // icount 26
slbi r1, 9 // icount 27
slbi r0, 5 // icount 28
slbi r4, 7 // icount 29
slbi r3, 14 // icount 30
slbi r3, 6 // icount 31
halt // icount 32
|
3-mid/physics/interface/source/private/bullet/bullet_physics-shape.adb
|
charlie5/lace
| 20 |
2717
|
<filename>3-mid/physics/interface/source/private/bullet/bullet_physics-shape.adb
with
bullet_c.Binding,
c_math_c.Vector_2,
c_math_c.Vector_3,
c_math_c.Conversion,
c_math_c.Triangle,
ada.unchecked_Deallocation,
ada.Unchecked_Conversion,
interfaces.C;
package body bullet_Physics.Shape
is
use c_math_c.Conversion,
bullet_c.Binding,
Interfaces;
---------
-- Forge
--
overriding
procedure define (Self : in out Item)
is
begin
raise Error with "Bullet shape not supported.";
end define;
overriding
procedure destruct (Self : in out Item)
is
begin
null;
end destruct;
-------
--- Box
--
type Box_view is access Box;
function new_box_Shape (half_Extents : in Vector_3) return physics.Shape.view
is
Self : constant Box_view := new Box;
c_half_Extents : aliased c_math_c.Vector_3.item := +half_Extents;
begin
Self.C := b3d_new_Box (c_half_Extents'unchecked_Access);
return physics.Shape.view (Self);
end new_box_Shape;
-----------
--- Capsule
--
type Capsule_view is access Capsule;
function new_capsule_Shape (Radii : in Vector_2;
Height : in Real) return physics.Shape.view
is
Self : constant Capsule_view := new Capsule;
c_Radii : aliased c_math_c.Vector_2.item := +Radii;
begin
Self.C := b3d_new_Capsule (c_Radii'unchecked_Access, +Height);
return physics.Shape.view (Self);
end new_capsule_Shape;
--------
--- Cone
--
type Cone_view is access Cone;
function new_cone_Shape (Radius,
Height : in Real) return physics.Shape.view
is
Self : constant Cone_view := new Cone;
begin
Self.C := b3d_new_Cone (+Radius, +Height);
return physics.Shape.view (Self);
end new_cone_Shape;
---------------
--- convex_Hull
--
type convex_Hull_view is access convex_Hull;
function new_convex_hull_Shape (Points : in physics.Vector_3_array) return physics.Shape.view
is
Self : constant convex_Hull_view := new convex_Hull;
c_Points : array (1 .. Points'Length) of aliased c_math_c.Vector_3.item;
begin
for i in c_Points'Range
loop
c_Points (i) := +Points (i);
end loop;
Self.C := b3d_new_convex_Hull (c_Points (1)'unchecked_Access,
c_Points'Length);
return physics.Shape.view (Self);
end new_convex_hull_Shape;
--------
--- Mesh
--
type Mesh_view is access Mesh;
function new_mesh_Shape (Model : access math.Geometry.d3.a_Model) return physics.Shape.view
is
Self : constant Mesh_view := new Mesh;
c_Points : array (1 .. Model.site_Count) of aliased c_math_c.Vector_3.item;
type Triangles is array (1 .. Model.tri_Count) of aliased c_math_c.Triangle.item;
pragma Pack (Triangles);
c_Triangles : Triangles;
begin
for i in c_Points'Range
loop
c_Points (i) := +Model.Sites (i);
end loop;
for i in c_Triangles'Range
loop
c_Triangles (i) := (a => C.int (Model.Triangles (i)(1)),
b => C.int (Model.Triangles (i)(2)),
c => C.int (Model.Triangles (i)(3)));
end loop;
Self.C := b3d_new_Mesh (Points => c_Points (c_Points'First)'unchecked_Access,
point_Count => 0,
Triangles => c_Triangles (c_Triangles'First)'unchecked_Access,
triangle_Count => C.int (Model.tri_Count));
return physics.Shape.view (Self);
end new_mesh_Shape;
------------
--- Cylinder
--
type Cylinder_view is access Cylinder;
function new_cylinder_Shape (half_Extents : in Vector_3) return physics.Shape.view
is
Self : constant Cylinder_view := new Cylinder;
c_half_Extents : aliased c_math_c.Vector_3.item := +half_Extents;
begin
Self.C := b3d_new_Cylinder (c_half_Extents'unchecked_Access);
return physics.Shape.view (Self);
end new_cylinder_Shape;
---------------
--- Heightfield
--
type Heightfield_view is access Heightfield;
function new_heightfield_Shape (Width,
Depth : in Positive;
Heights : in c_math_c.Pointers.Real_Pointer;
min_Height,
max_Height : in Real;
Scale : in Vector_3) return physics.Shape.view
is
use c_math_c.Pointers;
Self : constant Heightfield_view := new Heightfield;
c_Scale : aliased c_math_c.Vector_3.item := +Scale;
begin
Self.C := b3d_new_Heightfield (+Width,
+Depth,
Heights,
c_math_c.Real (min_Height),
c_math_c.Real (max_Height),
c_Scale'unchecked_Access);
return physics.Shape.view (Self);
end new_heightfield_Shape;
---------------
--- multiSphere
--
type multiSphere_view is access multiSphere;
function new_multiSphere_Shape (Positions : in physics.Vector_3_array;
Radii : in math.Vector) return physics.Shape.view
is
pragma Assert (Positions'Length = Radii'Length);
Self : constant multiSphere_view := new multiSphere;
c_Positions : array (1 .. Positions'Length) of aliased c_math_c.Vector_3.item;
c_Radii : array (1 .. Radii 'Length) of aliased c_math_c.Real;
begin
for i in c_Radii'Range
loop
c_Positions (i) := +Positions (i);
c_Radii (i) := +Radii (i);
end loop;
Self.C := b3d_new_multiSphere (c_Positions (1)'unchecked_Access,
c_Radii (1)'unchecked_Access,
Radii'Length);
return physics.Shape.view (Self);
end new_multiSphere_Shape;
---------
--- Plane
--
type Plane_view is access Plane;
function new_plane_Shape (Normal : in Vector_3;
Offset : in Real) return physics.Shape.view
is
Self : constant Plane_view := new Plane;
c_Vector : aliased c_math_c.Vector_3.item := +Normal;
begin
Self.C := b3d_new_Plane (c_Vector'unchecked_Access, +Offset);
return physics.Shape.view (Self);
end new_plane_Shape;
----------
--- Sphere
--
type Sphere_view is access Sphere;
function new_sphere_Shape (Radius : in math.Real) return physics.Shape.view
is
Self : constant Sphere_view := new Sphere;
begin
Self.C := b3d_new_Sphere (+Radius);
return physics.Shape.view (Self);
end new_sphere_Shape;
---------------
--- Attributes
--
overriding
procedure Scale_is (Self : in out Item; Now : Vector_3)
is
begin
null;
end Scale_is;
--------
--- Free
--
procedure free (the_Shape : in out physics.Shape.view)
is
procedure deallocate is new ada.unchecked_Deallocation (physics.Shape.item'Class,
physics.Shape.view);
begin
the_Shape.destruct;
deallocate (the_Shape);
end free;
end bullet_Physics.Shape;
|
tools/parser/css-analysis-parser-parser.ads
|
stcarrez/ada-css
| 3 |
22253
|
package CSS.Analysis.Parser.Parser is
error_count : Natural := 0;
function Parse (Content : in String) return Integer;
end CSS.Analysis.Parser.Parser;
|
generated/natools-static_maps-web-list_templates-commands.ads
|
faelys/natools-web
| 1 |
25510
|
package Natools.Static_Maps.Web.List_Templates.Commands is
pragma Pure;
function Hash (S : String) return Natural;
end Natools.Static_Maps.Web.List_Templates.Commands;
|
programs/oeis/143/A143128.asm
|
jmorken/loda
| 1 |
99254
|
<reponame>jmorken/loda
; A143128: a(n) = Sum_{k=1..n} k*sigma(k).
; 1,7,19,47,77,149,205,325,442,622,754,1090,1272,1608,1968,2464,2770,3472,3852,4692,5364,6156,6708,8148,8923,10015,11095,12663,13533,15693,16685,18701,20285,22121,23801,27077,28483,30763,32947,36547,38269,42301,44193,47889,51399,54711,56967,62919,65712,70362,74034,79130,81992,88472,92432,99152,103712,108932,112472,122552,126334,132286,138838,146966,152426,161930,166486,175054,181678,191758,196870,210910,216312,224748,234048,244688,252080,265184,271504,286384,296185,306517,313489,332305,341485,352837,363277,379117,387127,408187,418379,433835,445739,459275,470675,494867,504373,521131,536575,558275,568577,590609,601321,623161,643321,660493,672049,702289,714279,738039,754911,782687,795569,822929,839489,863849,885143,906383,923519,966719,982812,1005504,1026168,1053944,1073444,1112756,1129012,1161652,1184356,1217116,1234408,1278760,1300040,1327376,1359776,1396496,1415402,1455146,1474606,1521646,1548718,1579390,1603414,1661446,1687546,1719958,1753474,1792842,1815192,1870992,1893944,1939544,1975346,2019698,2049458,2110610,2135416,2173336,2207680,2268160,2299072,2357878,2384610,2432826,2480346,2522178,2550234,2630874,2661801,2716881,2761341,2814317,2844419,2907059,2950459,3015931,3058411,3106471,3138691,3236971,3269913,3331065,3376449,3442689,3484869,3556293,3596685,3659853,3720333,3788733,3825405,3922941,3960383,4017419,4082939,4161143,4200149,4292813,4332613,4425613,4480285,4542097,4590817,4693633,4745293,4809565,4874149,4964421,5014581,5135541,5180273,5260409,5321753,5391089,5447849,5577449,5633001,5704941,5769765,5880645,5936337,6037569,6087521,6200417,6291092,6368384,6420140,6547820,6600490,6699850,6788554,6892954,6947476,7075240,7142920,7242040,7317880,7420696,7478056,7656616,7714938,7811496,7899948,8005844,8089634,8213618,8282778,8401818,8485482,8602482
mov $2,$0
add $2,1
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
cal $0,76835 ; Coefficients in expansion of Eisenstein series -q*E'_2.
mov $3,$0
sub $3,24
div $3,24
add $3,1
add $1,$3
lpe
|
regtests/files/test-ada-1/src/test1.adb
|
stcarrez/resource-embedder
| 7 |
1422
|
<filename>regtests/files/test-ada-1/src/test1.adb<gh_stars>1-10
with Resources1;
with Ada.Command_Line;
with Ada.Text_IO;
procedure Test1 is
use Resources1;
C : Content_Access := Get_Content ("main.html");
begin
if C = null then
Ada.Text_IO.Put_Line ("FAIL: No content 'main.html'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
if C'Length /= 356 then
Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'main.html'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
end if;
C := Get_Content ("js/main.js");
if C = null then
Ada.Text_IO.Put_Line ("FAIL: No content 'js/main.js'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
if C'Length /= 87 then
Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'js/main.js'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
end if;
C := Get_Content ("css/main.css");
if C = null then
Ada.Text_IO.Put_Line ("FAIL: No content 'css/main.css'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
if C'Length /= 60 then
Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'css/main.css'");
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
end if;
Ada.Text_IO.Put ("PASS: ");
for Val of C.all loop
if Character'Val (Val) /= ASCII.LF then
Ada.Text_IO.Put (Character'Val (Val));
end if;
end loop;
Ada.Text_IO.New_Line;
end Test1;
|
linked lists/linked list test.asm
|
IAmAnubhavSaini/blog-posts
| 0 |
89944
|
; Listing generated by Microsoft (R) Optimizing Compiler Version 17.00.60610.1
TITLE d:\source\blog posts\linked lists\linked list test.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB LIBCMT
INCLUDELIB OLDNAMES
_DATA SEGMENT
$SG4315 DB 0aH, 'Found %d in list.', 00H
ORG $+1
$SG4317 DB 0aH, 'Did not find %d in list.', 00H
ORG $+2
$SG4322 DB 0aH, 'Found %d in list.', 00H
ORG $+1
$SG4324 DB 0aH, 'Did not find %d in list.', 00H
ORG $+2
$SG4329 DB 0aH, 'Deleted first %d.', 00H
ORG $+1
$SG4331 DB 0aH, 'Deleted first %d.', 00H
ORG $+1
$SG4333 DB 0aH, 'Did not find %d in list.', 00H
ORG $+2
$SG4335 DB 0aH, 'Deleted first %d.', 00H
ORG $+1
$SG4337 DB 0aH, 'Did not find %d in list.', 00H
ORG $+2
$SG4350 DB 0aH, 'All %d deleted from list.', 00H
ORG $+1
$SG4352 DB 0aH, 'Did not find %d in list.', 00H
ORG $+2
$SG4355 DB 0aH, 'Circular list test: list should not be circular.', 00H
ORG $+2
$SG4357 DB 0aH, 'list is circular.', 00H
ORG $+1
$SG4359 DB 0aH, 'list is not circular.', 00H
ORG $+1
$SG4362 DB 0aH, 'Circular list test: list should be circular.', 00H
ORG $+2
$SG4364 DB 0aH, 'list is circular.', 00H
ORG $+1
$SG4366 DB 0aH, 'list is not circular.', 00H
ORG $+1
$SG4375 DB 0aH, 'Circular list test: list should be circular.', 00H
ORG $+2
$SG4377 DB 0aH, 'list is circular.', 00H
ORG $+1
$SG4379 DB 0aH, 'list is not circular.', 00H
ORG $+1
$SG4380 DB 0aH, 'Circular list test: list should not be circular.', 00H
ORG $+2
$SG4382 DB 0aH, 'list is circular.', 00H
ORG $+1
$SG4384 DB 0aH, 'list is not circular.', 00H
ORG $+1
$SG4390 DB 0aH, 'Should have inserted %d at the beginning: ', 00H
$SG4396 DB 0aH, 'Should have inserted %d at the end: ', 00H
ORG $+2
$SG4402 DB 0aH, 'Should have inserted %d at the mid: ', 00H
_DATA ENDS
PUBLIC _TEST_should_setup_and_confim_via_printing
PUBLIC _TEST_should_find_number_in_list
PUBLIC _TEST_should_not_find_number_in_list
PUBLIC _TEST_should_delete_numbers_first_occurence
PUBLIC _TEST_should_delete_all_occurences_on_a_number
PUBLIC _TEST_shoud_not_be_a_circular_list
PUBLIC _TEST_shoud_be_a_circular_list
PUBLIC _TEST_stack_should_be_reverse_of_the_list
PUBLIC _TEST_should_make_a_circular_list_acircular
PUBLIC _TEST_should_add_node_at_beginning_of_list
PUBLIC _TEST_should_add_node_at_end_of_list
PUBLIC _TEST_should_add_node_at_mid_of_list
EXTRN _printf:PROC
EXTRN _create_node:PROC
EXTRN _add_to_list:PROC
EXTRN _insert_in_list:PROC
EXTRN _make_list_circular:PROC
EXTRN _make_list_acircular:PROC
EXTRN _print_list:PROC
EXTRN _search_list_for_integer:PROC
EXTRN _delete_first_integer_value_matching_node:PROC
EXTRN _delete_all_integer_value_matching_nodes:PROC
EXTRN _is_list_circular:PROC
EXTRN _create_stack_from_existing_list:PROC
; Function compile flags: /Odtp
_TEXT SEGMENT
_head$ = -8 ; size = 4
_num$ = -4 ; size = 4
_TEST_should_add_node_at_mid_of_list PROC
; File d:\source\blog posts\linked lists\linked list test.c
; Line 153
push ebp
mov ebp, esp
sub esp, 8
; Line 154
call _TEST_should_setup_and_confim_via_printing
mov DWORD PTR _head$[ebp], eax
; Line 155
mov DWORD PTR _num$[ebp], 10 ; 0000000aH
; Line 156
push 2
push 1
lea eax, DWORD PTR _num$[ebp]
push eax
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _insert_in_list
add esp, 16 ; 00000010H
; Line 157
mov edx, DWORD PTR _num$[ebp]
push edx
push OFFSET $SG4402
call _printf
add esp, 8
; Line 158
mov eax, DWORD PTR _head$[ebp]
push eax
call _print_list
add esp, 4
; Line 159
mov esp, ebp
pop ebp
ret 0
_TEST_should_add_node_at_mid_of_list ENDP
_TEXT ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
_head$ = -8 ; size = 4
_num$ = -4 ; size = 4
_TEST_should_add_node_at_end_of_list PROC
; File d:\source\blog posts\linked lists\linked list test.c
; Line 144
push ebp
mov ebp, esp
sub esp, 8
; Line 145
call _TEST_should_setup_and_confim_via_printing
mov DWORD PTR _head$[ebp], eax
; Line 146
mov DWORD PTR _num$[ebp], 10 ; 0000000aH
; Line 147
push 0
push 1
lea eax, DWORD PTR _num$[ebp]
push eax
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _insert_in_list
add esp, 16 ; 00000010H
; Line 148
mov edx, DWORD PTR _num$[ebp]
push edx
push OFFSET $SG4396
call _printf
add esp, 8
; Line 149
mov eax, DWORD PTR _head$[ebp]
push eax
call _print_list
add esp, 4
; Line 150
mov esp, ebp
pop ebp
ret 0
_TEST_should_add_node_at_end_of_list ENDP
_TEXT ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
_head$ = -8 ; size = 4
_num$ = -4 ; size = 4
_TEST_should_add_node_at_beginning_of_list PROC
; File d:\source\blog posts\linked lists\linked list test.c
; Line 135
push ebp
mov ebp, esp
sub esp, 8
; Line 136
call _TEST_should_setup_and_confim_via_printing
mov DWORD PTR _head$[ebp], eax
; Line 137
mov DWORD PTR _num$[ebp], 10 ; 0000000aH
; Line 138
push 1
push 1
lea eax, DWORD PTR _num$[ebp]
push eax
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _insert_in_list
add esp, 16 ; 00000010H
; Line 139
mov edx, DWORD PTR _num$[ebp]
push edx
push OFFSET $SG4390
call _printf
add esp, 8
; Line 140
mov eax, DWORD PTR _head$[ebp]
push eax
call _print_list
add esp, 4
; Line 141
mov esp, ebp
pop ebp
ret 0
_TEST_should_add_node_at_beginning_of_list ENDP
_TEXT ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
_head$ = -4 ; size = 4
_TEST_should_make_a_circular_list_acircular PROC
; File d:\source\blog posts\linked lists\linked list test.c
; Line 111
push ebp
mov ebp, esp
push ecx
; Line 112
call _TEST_should_setup_and_confim_via_printing
mov DWORD PTR _head$[ebp], eax
; Line 113
mov eax, DWORD PTR _head$[ebp]
push eax
call _print_list
add esp, 4
; Line 114
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _make_list_circular
add esp, 4
; Line 116
push OFFSET $SG4375
call _printf
add esp, 4
; Line 117
mov edx, DWORD PTR _head$[ebp]
push edx
call _print_list
add esp, 4
; Line 118
mov eax, DWORD PTR _head$[ebp]
push eax
call _is_list_circular
add esp, 4
test eax, eax
je SHORT $LN4@TEST_shoul
; Line 119
push OFFSET $SG4377
call _printf
add esp, 4
; Line 121
jmp SHORT $LN3@TEST_shoul
$LN4@TEST_shoul:
; Line 122
push OFFSET $SG4379
call _printf
add esp, 4
$LN3@TEST_shoul:
; Line 124
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _make_list_acircular
add esp, 4
; Line 125
push OFFSET $SG4380
call _printf
add esp, 4
; Line 126
mov edx, DWORD PTR _head$[ebp]
push edx
call _is_list_circular
add esp, 4
test eax, eax
je SHORT $LN2@TEST_shoul
; Line 127
push OFFSET $SG4382
call _printf
add esp, 4
; Line 129
jmp SHORT $LN5@TEST_shoul
$LN2@TEST_shoul:
; Line 130
push OFFSET $SG4384
call _printf
add esp, 4
$LN5@TEST_shoul:
; Line 132
mov esp, ebp
pop ebp
ret 0
_TEST_should_make_a_circular_list_acircular ENDP
_TEXT ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
_stackTop$ = -8 ; size = 4
_head$ = -4 ; size = 4
_TEST_stack_should_be_reverse_of_the_list PROC
; File d:\source\blog posts\linked lists\linked list test.c
; Line 104
push ebp
mov ebp, esp
sub esp, 8
; Line 105
call _TEST_should_setup_and_confim_via_printing
mov DWORD PTR _head$[ebp], eax
; Line 106
push 0
mov eax, DWORD PTR _head$[ebp]
push eax
call _create_stack_from_existing_list
add esp, 8
mov DWORD PTR _stackTop$[ebp], eax
; Line 107
mov ecx, DWORD PTR _stackTop$[ebp]
push ecx
call _print_list
add esp, 4
; Line 108
mov esp, ebp
pop ebp
ret 0
_TEST_stack_should_be_reverse_of_the_list ENDP
_TEXT ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
_head$ = -4 ; size = 4
_TEST_shoud_be_a_circular_list PROC
; File d:\source\blog posts\linked lists\linked list test.c
; Line 89
push ebp
mov ebp, esp
push ecx
; Line 90
call _TEST_should_setup_and_confim_via_printing
mov DWORD PTR _head$[ebp], eax
; Line 91
mov eax, DWORD PTR _head$[ebp]
push eax
call _print_list
add esp, 4
; Line 92
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _make_list_circular
add esp, 4
; Line 94
push OFFSET $SG4362
call _printf
add esp, 4
; Line 95
mov edx, DWORD PTR _head$[ebp]
push edx
call _print_list
add esp, 4
; Line 96
mov eax, DWORD PTR _head$[ebp]
push eax
call _is_list_circular
add esp, 4
test eax, eax
je SHORT $LN2@TEST_shoud
; Line 97
push OFFSET $SG4364
call _printf
add esp, 4
; Line 99
jmp SHORT $LN3@TEST_shoud
$LN2@TEST_shoud:
; Line 100
push OFFSET $SG4366
call _printf
add esp, 4
$LN3@TEST_shoud:
; Line 102
mov esp, ebp
pop ebp
ret 0
_TEST_shoud_be_a_circular_list ENDP
_TEXT ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
_head$ = -4 ; size = 4
_TEST_shoud_not_be_a_circular_list PROC
; File d:\source\blog posts\linked lists\linked list test.c
; Line 76
push ebp
mov ebp, esp
push ecx
; Line 77
call _TEST_should_setup_and_confim_via_printing
mov DWORD PTR _head$[ebp], eax
; Line 78
mov eax, DWORD PTR _head$[ebp]
push eax
call _print_list
add esp, 4
; Line 79
push OFFSET $SG4355
call _printf
add esp, 4
; Line 80
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _is_list_circular
add esp, 4
test eax, eax
je SHORT $LN2@TEST_shoud
; Line 81
push OFFSET $SG4357
call _printf
add esp, 4
; Line 83
jmp SHORT $LN3@TEST_shoud
$LN2@TEST_shoud:
; Line 84
push OFFSET $SG4359
call _printf
add esp, 4
$LN3@TEST_shoud:
; Line 86
mov esp, ebp
pop ebp
ret 0
_TEST_shoud_not_be_a_circular_list ENDP
_TEXT ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
_head$ = -8 ; size = 4
_num$ = -4 ; size = 4
_TEST_should_delete_all_occurences_on_a_number PROC
; File d:\source\blog posts\linked lists\linked list test.c
; Line 64
push ebp
mov ebp, esp
sub esp, 8
; Line 65
call _TEST_should_setup_and_confim_via_printing
mov DWORD PTR _head$[ebp], eax
; Line 66
mov DWORD PTR _num$[ebp], 2
; Line 67
mov eax, DWORD PTR _num$[ebp]
push eax
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _delete_all_integer_value_matching_nodes
add esp, 8
test eax, eax
je SHORT $LN2@TEST_shoul
; Line 68
mov edx, DWORD PTR _num$[ebp]
push edx
push OFFSET $SG4350
call _printf
add esp, 8
; Line 70
jmp SHORT $LN1@TEST_shoul
$LN2@TEST_shoul:
; Line 71
mov eax, DWORD PTR _num$[ebp]
push eax
push OFFSET $SG4352
call _printf
add esp, 8
$LN1@TEST_shoul:
; Line 73
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _print_list
add esp, 4
; Line 74
mov esp, ebp
pop ebp
ret 0
_TEST_should_delete_all_occurences_on_a_number ENDP
_TEXT ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
_head$ = -8 ; size = 4
_num$ = -4 ; size = 4
_TEST_should_delete_numbers_first_occurence PROC
; File d:\source\blog posts\linked lists\linked list test.c
; Line 26
push ebp
mov ebp, esp
sub esp, 8
; Line 27
call _TEST_should_setup_and_confim_via_printing
mov DWORD PTR _head$[ebp], eax
; Line 28
mov DWORD PTR _num$[ebp], 2
; Line 29
mov eax, DWORD PTR _num$[ebp]
push eax
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _delete_first_integer_value_matching_node
add esp, 8
test eax, eax
je SHORT $LN5@TEST_shoul
; Line 30
mov edx, DWORD PTR _num$[ebp]
push edx
push OFFSET $SG4329
call _printf
add esp, 8
; Line 31
mov eax, DWORD PTR _head$[ebp]
push eax
call _print_list
add esp, 4
$LN5@TEST_shoul:
; Line 33
mov DWORD PTR _num$[ebp], 4
; Line 34
mov ecx, DWORD PTR _num$[ebp]
push ecx
mov edx, DWORD PTR _head$[ebp]
push edx
call _delete_first_integer_value_matching_node
add esp, 8
test eax, eax
je SHORT $LN4@TEST_shoul
; Line 35
mov eax, DWORD PTR _num$[ebp]
push eax
push OFFSET $SG4331
call _printf
add esp, 8
; Line 36
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _print_list
add esp, 4
; Line 38
jmp SHORT $LN3@TEST_shoul
$LN4@TEST_shoul:
; Line 39
mov edx, DWORD PTR _num$[ebp]
push edx
push OFFSET $SG4333
call _printf
add esp, 8
; Line 40
mov eax, DWORD PTR _head$[ebp]
push eax
call _print_list
add esp, 4
$LN3@TEST_shoul:
; Line 42
mov DWORD PTR _num$[ebp], 1
; Line 43
push 1
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _delete_first_integer_value_matching_node
add esp, 8
test eax, eax
je SHORT $LN2@TEST_shoul
; Line 44
mov edx, DWORD PTR _num$[ebp]
push edx
push OFFSET $SG4335
call _printf
add esp, 8
; Line 45
mov eax, DWORD PTR _head$[ebp]
push eax
call _print_list
add esp, 4
; Line 47
jmp SHORT $LN6@TEST_shoul
$LN2@TEST_shoul:
; Line 48
mov ecx, DWORD PTR _num$[ebp]
push ecx
push OFFSET $SG4337
call _printf
add esp, 8
; Line 49
mov edx, DWORD PTR _head$[ebp]
push edx
call _print_list
add esp, 4
$LN6@TEST_shoul:
; Line 51
mov esp, ebp
pop ebp
ret 0
_TEST_should_delete_numbers_first_occurence ENDP
_TEXT ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
_head$ = -8 ; size = 4
_num$ = -4 ; size = 4
_TEST_should_not_find_number_in_list PROC
; File d:\source\blog posts\linked lists\linked list test.c
; Line 15
push ebp
mov ebp, esp
sub esp, 8
; Line 16
call _TEST_should_setup_and_confim_via_printing
mov DWORD PTR _head$[ebp], eax
; Line 17
mov DWORD PTR _num$[ebp], -1
; Line 18
mov eax, DWORD PTR _num$[ebp]
push eax
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _search_list_for_integer
add esp, 8
test eax, eax
je SHORT $LN2@TEST_shoul
; Line 19
mov edx, DWORD PTR _num$[ebp]
push edx
push OFFSET $SG4322
call _printf
add esp, 8
; Line 21
jmp SHORT $LN3@TEST_shoul
$LN2@TEST_shoul:
; Line 22
mov eax, DWORD PTR _num$[ebp]
push eax
push OFFSET $SG4324
call _printf
add esp, 8
$LN3@TEST_shoul:
; Line 24
mov esp, ebp
pop ebp
ret 0
_TEST_should_not_find_number_in_list ENDP
_TEXT ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
_head$ = -8 ; size = 4
_num$ = -4 ; size = 4
_TEST_should_find_number_in_list PROC
; File d:\source\blog posts\linked lists\linked list test.c
; Line 3
push ebp
mov ebp, esp
sub esp, 8
; Line 4
call _TEST_should_setup_and_confim_via_printing
mov DWORD PTR _head$[ebp], eax
; Line 5
mov DWORD PTR _num$[ebp], 2
; Line 6
mov eax, DWORD PTR _num$[ebp]
push eax
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _search_list_for_integer
add esp, 8
test eax, eax
je SHORT $LN2@TEST_shoul
; Line 7
mov edx, DWORD PTR _num$[ebp]
push edx
push OFFSET $SG4315
call _printf
add esp, 8
; Line 9
jmp SHORT $LN3@TEST_shoul
$LN2@TEST_shoul:
; Line 10
mov eax, DWORD PTR _num$[ebp]
push eax
push OFFSET $SG4317
call _printf
add esp, 8
$LN3@TEST_shoul:
; Line 13
mov esp, ebp
pop ebp
ret 0
_TEST_should_find_number_in_list ENDP
_TEXT ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
_head$ = -8 ; size = 4
_num$ = -4 ; size = 4
_TEST_should_setup_and_confim_via_printing PROC
; File d:\source\blog posts\linked lists\linked list test.c
; Line 53
push ebp
mov ebp, esp
sub esp, 8
; Line 54
mov DWORD PTR _num$[ebp], 1
; Line 55
push 1
lea eax, DWORD PTR _num$[ebp]
push eax
call _create_node
add esp, 8
mov DWORD PTR _head$[ebp], eax
; Line 56
mov ecx, DWORD PTR _num$[ebp]
add ecx, 1
mov DWORD PTR _num$[ebp], ecx
push 1
lea edx, DWORD PTR _num$[ebp]
push edx
mov eax, DWORD PTR _head$[ebp]
push eax
call _add_to_list
add esp, 12 ; 0000000cH
; Line 57
mov ecx, DWORD PTR _num$[ebp]
add ecx, 1
mov DWORD PTR _num$[ebp], ecx
push 1
lea edx, DWORD PTR _num$[ebp]
push edx
mov eax, DWORD PTR _head$[ebp]
push eax
call _add_to_list
add esp, 12 ; 0000000cH
; Line 58
mov ecx, DWORD PTR _num$[ebp]
add ecx, 1
mov DWORD PTR _num$[ebp], ecx
push 1
lea edx, DWORD PTR _num$[ebp]
push edx
mov eax, DWORD PTR _head$[ebp]
push eax
call _add_to_list
add esp, 12 ; 0000000cH
; Line 59
mov ecx, DWORD PTR _num$[ebp]
add ecx, 1
mov DWORD PTR _num$[ebp], ecx
push 1
lea edx, DWORD PTR _num$[ebp]
push edx
mov eax, DWORD PTR _head$[ebp]
push eax
call _add_to_list
add esp, 12 ; 0000000cH
; Line 60
mov ecx, DWORD PTR _head$[ebp]
push ecx
call _print_list
add esp, 4
; Line 61
mov eax, DWORD PTR _head$[ebp]
; Line 62
mov esp, ebp
pop ebp
ret 0
_TEST_should_setup_and_confim_via_printing ENDP
_TEXT ENDS
END
|
oeis/081/A081411.asm
|
neoneye/loda-programs
| 11 |
173134
|
; A081411: Partial product of prime gaps: a(n) = a(n-1)*(prime(n+1) - prime(n)).
; Submitted by <NAME>
; 1,2,4,16,32,128,256,1024,6144,12288,73728,294912,589824,2359296,14155776,84934656,169869312,1019215872,4076863488,8153726976,48922361856,195689447424,1174136684544,9393093476352,37572373905408,75144747810816,300578991243264,601157982486528,2404631929946112,33664847019245568,134659388076982272,807956328461893632,1615912656923787264,16159126569237872640,32318253138475745280,193909518830854471680,1163457112985126830080,4653828451940507320320,27922970711643043921920,167537824269858263531520
add $0,1
seq $0,70323 ; Let M_n be the n X n matrix m(i,j)=min(prime(i), prime(j)); then a(n)=det(M_n).
div $0,2
|
src/lab-code/calendar_package/src/mycalendar.adb
|
hannesb0/rtpl18
| 0 |
1427
|
with Ada.Text_IO;
use Ada.Text_IO;
package body mycalendar is
procedure makecal(w: in weekday; d: in daynum; m:in monthnum) is
today_weekday: weekday := w;
today_daynum: daynum := d;
today_monthnum: monthnum := m;
begin
-- print cal
Put_Line("Calendar for the next 30 days:");
for d in Integer range 1 .. 31 loop
-- print
Put(weekday'Image(today_weekday) & ", " & monthname'Image(monthname'Val(today_monthnum-1)) & " " & daynum'Image(today_daynum)); new_line;
-- next day
if (today_weekday /= weekday'Last) then -- ada enums do not wrap around
today_weekday := weekday'succ(today_weekday);
else
Put_Line("----------------------"); -- separate weeks
today_weekday := Mon;
end if;
if (today_daynum = daynum'Last) then -- new month starts
if (today_monthnum = monthnum'last) then
today_monthnum := monthnum'first;
else
today_monthnum := monthnum'Succ(today_monthnum);
end if;
today_daynum := daynum'First;
else
today_daynum := daynum'succ(today_daynum);
end if;
end loop;
end makecal;
end mycalendar;
|
oeis/124/A124758.asm
|
neoneye/loda-programs
| 11 |
245725
|
; A124758: Product of the parts of the compositions in standard order.
; Submitted by <NAME>
; 1,1,2,1,3,2,2,1,4,3,4,2,3,2,2,1,5,4,6,3,6,4,4,2,4,3,4,2,3,2,2,1,6,5,8,4,9,6,6,3,8,6,8,4,6,4,4,2,5,4,6,3,6,4,4,2,4,3,4,2,3,2,2,1,7,6,10,5,12,8,8,4,12,9,12,6,9,6,6,3,10,8,12,6,12,8,8,4,8,6,8,4,6,4,4,2,6,5,8,4
mov $1,10
lpb $0
mov $2,$1
lpb $0
dif $0,2
add $1,10
add $1,$2
lpe
div $0,2
lpe
mov $0,$1
div $0,20
add $0,1
|
tools-src/gnu/gcc/gcc/ada/5vtpopde.ads
|
enfoTek/tomato.linksys.e2000.nvram-mod
| 80 |
15365
|
<reponame>enfoTek/tomato.linksys.e2000.nvram-mod<filename>tools-src/gnu/gcc/gcc/ada/5vtpopde.ads<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K _ P R I M I T I V E S . O P E R A T I O N S --
-- . D E C --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 2000 Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNARL; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, 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. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
--
-- This package is for OpenVMS/Alpha.
--
with System.Aux_DEC;
package System.Task_Primitives.Operations.DEC is
procedure Interrupt_AST_Handler (ID : Address);
-- Handles the AST for Ada95 Interrupts.
procedure RMS_AST_Handler (ID : Address);
-- Handles the AST for RMS_Asynch_Operations.
function Self return System.Aux_DEC.Unsigned_Longword;
-- Returns the task identification for the AST.
procedure Starlet_AST_Handler (ID : Address);
-- Handles the AST for Starlet Tasking_Services.
procedure Task_Synch;
-- Synchronizes the task after the system service completes.
end System.Task_Primitives.Operations.DEC;
|
programs/oeis/261/A261695.asm
|
neoneye/loda
| 22 |
15805
|
<reponame>neoneye/loda
; A261695: First differences of A256534.
; 0,4,12,12,36,12,36,60,84,12,36,60,84,108,132,156,180,12,36,60,84,108,132,156,180,204,228,252,276,300,324,348,372,12,36,60,84,108,132,156,180,204,228,252,276,300,324,348,372,396,420,444,468,492,516,540,564,588,612,636,660,684,708,732,756,12,36,60,84,108
lpb $0
mov $1,$0
min $0,1
sub $1,$0
div $0,8
seq $1,241717 ; The number of P-positions in the game of Nim with up to 3 piles, allowing for piles of zero, such that the number of objects in the largest pile is n.
lpe
mul $1,4
mov $0,$1
|
oeis/155/A155724.asm
|
neoneye/loda-programs
| 11 |
80821
|
<reponame>neoneye/loda-programs<filename>oeis/155/A155724.asm
; A155724: Triangle read by rows: T(m,n) = 2mn + m + n - 4.
; Submitted by <NAME>
; 0,3,8,6,13,20,9,18,27,36,12,23,34,45,56,15,28,41,54,67,80,18,33,48,63,78,93,108,21,38,55,72,89,106,123,140,24,43,62,81,100,119,138,157,176,27,48,69,90,111,132,153,174,195,216,30,53,76,99,122,145,168,191,214,237,260,33,58,83,108,133,158,183,208,233,258,283,308,36,63,90,117,144,171,198,225,252,279,306,333,360,39,68,97,126,155,184,213,242,271
mul $0,2
add $0,1
lpb $0
mov $2,$0
sub $0,2
trn $0,$1
add $1,2
add $2,2
lpe
add $1,1
mul $1,$2
mov $0,$1
sub $0,9
div $0,2
|
source/s-runcon.adb
|
ytomino/drake
| 33 |
23977
|
<reponame>ytomino/drake<gh_stars>10-100
package body System.Runtime_Context is
pragma Suppress (All_Checks);
-- I hope it will be zero-initialized...
Environment_Task_Local_Storage : aliased Task_Local_Storage;
-- implementation
function Get_Environment_Task_Local_Storage
return not null Task_Local_Storage_Access is
begin
return Environment_Task_Local_Storage'Access;
end Get_Environment_Task_Local_Storage;
function Get_Task_Local_Storage
return not null Task_Local_Storage_Access is
begin
return Get_Task_Local_Storage_Hook.all;
end Get_Task_Local_Storage;
end System.Runtime_Context;
|
modular_hashing-sha512.ads
|
annexi-strayline/ASAP-Modular_Hashing
| 0 |
13103
|
------------------------------------------------------------------------------
-- --
-- Modular Hash Infrastructure --
-- --
-- SHA2 (512) --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2019-2021, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * <NAME> (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Interfaces;
with Ada.Streams;
package Modular_Hashing.SHA512 is
type SHA512_Hash is new Hash with private;
-- The final hash is a 512-bit message digest, which can also be displayed
-- as a 128 character hex string and is 64 bytes long
overriding function "<" (Left, Right : SHA512_Hash) return Boolean;
overriding function ">" (Left, Right : SHA512_Hash) return Boolean;
overriding function "=" (Left, Right : SHA512_Hash) return Boolean;
SHA512_Hash_Bytes: constant := 64;
overriding function Binary_Bytes (Value: SHA512_Hash) return Positive is
(SHA512_Hash_Bytes);
overriding function Binary (Value: SHA512_Hash) return Hash_Binary_Value
with Post => Binary'Result'Length = SHA512_Hash_Bytes;
type SHA512_Engine is new Hash_Algorithm with private;
overriding
procedure Write (Stream : in out SHA512_Engine;
Item : in Ada.Streams.Stream_Element_Array);
overriding procedure Reset (Engine : in out SHA512_Engine);
overriding function Digest (Engine : in out SHA512_Engine)
return Hash'Class;
private
use Ada.Streams, Interfaces;
package U_128 is
type Unsigned_128 is
record
--Internal_Repr : array (1 .. 2) of Unsigned_64 := (others => 0);
High : Unsigned_64 := 0;
Low : Unsigned_64 := 0;
end record;
function "+" (Left, Right : Unsigned_128) return Unsigned_128;
end U_128;
-----------------
-- SHA512_Hash --
-----------------
type Message_Digest is array (1 .. 8) of Unsigned_64;
type SHA512_Hash is new Hash with
record
Digest: Message_Digest;
end record;
-------------------
-- SHA512_Engine --
-------------------
-- SHA-2 Defined initialization constants
H0_Initial: constant := 16#6a09e667f3bcc908#;
H1_Initial: constant := 16#bb67ae8584caa73b#;
H2_Initial: constant := 16#3c6ef372fe94f82b#;
H3_Initial: constant := 16#a54ff53a5f1d36f1#;
H4_Initial: constant := 16#510e527fade682d1#;
H5_Initial: constant := 16#9b05688c2b3e6c1f#;
H6_Initial: constant := 16#1f83d9abfb41bd6b#;
H7_Initial: constant := 16#5be0cd19137e2179#;
type K_Arr is array (1 .. 80) of Unsigned_64;
K : constant K_Arr :=
(16#428a2f98d728ae22#, 16#7137449123ef65cd#, 16#b5c0fbcfec4d3b2f#, 16#e9b5dba58189dbbc#,
16#3956c25bf348b538#, 16#59f111f1b605d019#, 16#923f82a4af194f9b#, 16#ab1c5ed5da6d8118#,
16#d807aa98a3030242#, 16#12835b0145706fbe#, 16#243185be4ee4b28c#, 16#550c7dc3d5ffb4e2#,
16#72be5d74f27b896f#, 16#80deb1fe3b1696b1#, 16#9bdc06a725c71235#, 16#c19bf174cf692694#,
16#e49b69c19ef14ad2#, 16#efbe4786384f25e3#, 16#0fc19dc68b8cd5b5#, 16#240ca1cc77ac9c65#,
16#2de92c6f592b0275#, 16#4a7484aa6ea6e483#, 16#5cb0a9dcbd41fbd4#, 16#76f988da831153b5#,
16#983e5152ee66dfab#, 16#a831c66d2db43210#, 16#b00327c898fb213f#, 16#bf597fc7beef0ee4#,
16#c6e00bf33da88fc2#, 16#d5a79147930aa725#, 16#06ca6351e003826f#, 16#142929670a0e6e70#,
16#27b70a8546d22ffc#, 16#2e1b21385c26c926#, 16#4d2c6dfc5ac42aed#, 16#53380d139d95b3df#,
16#650a73548baf63de#, 16#766a0abb3c77b2a8#, 16#81c2c92e47edaee6#, 16#92722c851482353b#,
16#a2bfe8a14cf10364#, 16#a81a664bbc423001#, 16#c24b8b70d0f89791#, 16#c76c51a30654be30#,
16#d192e819d6ef5218#, 16#d69906245565a910#, 16#f40e35855771202a#, 16#106aa07032bbd1b8#,
16#19a4c116b8d2d0c8#, 16#1e376c085141ab53#, 16#2748774cdf8eeb99#, 16#34b0bcb5e19b48a8#,
16#391c0cb3c5c95a63#, 16#4ed8aa4ae3418acb#, 16#5b9cca4f7763e373#, 16#682e6ff3d6b2b8a3#,
16#748f82ee5defb2fc#, 16#78a5636f43172f60#, 16#84c87814a1f0ab72#, 16#8cc702081a6439ec#,
16#90befffa23631e28#, 16#a4506cebde82bde9#, 16#bef9a3f7b2c67915#, 16#c67178f2e372532b#,
16#ca273eceea26619c#, 16#d186b8c721c0c207#, 16#eada7dd6cde0eb1e#, 16#f57d4f7fee6ed178#,
16#06f067aa72176fba#, 16#0a637dc5a2c898a6#, 16#113f9804bef90dae#, 16#1b710b35131c471b#,
16#28db77f523047d84#, 16#32caab7b40c72493#, 16#3c9ebe0a15c9bebc#, 16#431d67c49c100d4c#,
16#4cc5d4becb3e42b6#, 16#597f299cfc657e2a#, 16#5fcb6fab3ad6faec#, 16#6c44198c4a475817#);
type SHA512_Engine is new Hash_Algorithm with record
Last_Element_Index : Stream_Element_Offset := 0;
Buffer : Stream_Element_Array(1 .. 128);
Message_Length : U_128.Unsigned_128;
H0 : Unsigned_64 := H0_Initial;
H1 : Unsigned_64 := H1_Initial;
H2 : Unsigned_64 := H2_Initial;
H3 : Unsigned_64 := H3_Initial;
H4 : Unsigned_64 := H4_Initial;
H5 : Unsigned_64 := H5_Initial;
H6 : Unsigned_64 := H6_Initial;
H7 : Unsigned_64 := H7_Initial;
end record;
end Modular_Hashing.SHA512;
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cc/cc3017c.ada
|
best08618/asylo
| 7 |
9828
|
-- CC3017C.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT AN INSTANCE OF A GENERIC PROCEDURE MUST DECLARE A
-- PROCEDURE AND THAT AN INSTANCE OF A GENERIC FUNCTION MUST
-- DECLARE A FUNCTION. CHECK THAT SCALAR AND ACCESS PARAMETERS
-- ARE COPIED.
--
-- SUBTESTS ARE:
-- (A) SCALAR PARAMETERS TO PROCEDURES.
-- (B) SCALAR PARAMETERS TO FUNCTIONS.
-- (C) ACCESS PARAMETERS TO PROCEDURES.
-- (D) ACCESS PARAMETERS TO FUNCTIONS.
-- HISTORY:
-- <NAME>, 7 AUGUST 1990
-- CJJ 10/16/90 ADJUSTED LINES THAT WERE TOO LONG; REFORMATTED
-- HEADER TO CONFORM TO ACVC STANDARDS.
--
WITH REPORT;
PROCEDURE CC3017C IS
BEGIN
REPORT.TEST ("CC3017C", "CHECK THAT AN INSTANCE OF A GENERIC " &
"PROCEDURE MUST DECLARE A PROCEDURE AND THAT AN " &
"INSTANCE OF A GENERIC FUNCTION MUST DECLARE A " &
"FUNCTION. CHECK THAT SCALAR AND ACCESS PARAMETERS " &
"ARE COPIED");
--------------------------------------------------
SCALAR_TO_PROCS:
DECLARE
-- (A) SCALAR PARAMETERS TO PROCEDURES.
TYPE NUMBER IS RANGE 0 .. 120 ;
VALUE : NUMBER ;
E : EXCEPTION ;
GENERIC
TYPE SCALAR_ITEM IS RANGE <> ;
PROCEDURE P (P_IN : IN SCALAR_ITEM ;
P_OUT : OUT SCALAR_ITEM ;
P_IN_OUT : IN OUT SCALAR_ITEM) ;
PROCEDURE P (P_IN : IN SCALAR_ITEM ;
P_OUT : OUT SCALAR_ITEM ;
P_IN_OUT : IN OUT SCALAR_ITEM) IS
STORE : SCALAR_ITEM ;
BEGIN -- P
STORE := P_IN; -- SAVE VALUE OF P_IN AT PROC ENTRY.
P_OUT := 10;
IF (P_IN /= STORE) THEN
REPORT.FAILED ("ASSIGNMENT TO SCALAR OUT " &
"PARAMETER CHANGES THE VALUE OF " &
"INPUT PARAMETER");
STORE := P_IN; -- RESET STORE FOR NEXT CASE.
END IF;
P_IN_OUT := P_IN_OUT + 100;
IF (P_IN /= STORE) THEN
REPORT.FAILED ("ASSIGNMENT TO SCALAR IN OUT " &
"PARAMETER CHANGES THE VALUE OF " &
"INPUT PARAMETER");
STORE := P_IN; -- RESET STORE FOR NEXT CASE.
END IF;
VALUE := VALUE + 1;
IF (P_IN /= STORE) THEN
REPORT.FAILED ("ASSIGNMENT TO SCALAR GLOBAL " &
"PARAMETER CHANGES THE VALUE OF " &
"INPUT PARAMETER");
END IF;
RAISE E; -- CHECK EXCEPTION HANDLING.
END P;
PROCEDURE NEW_P IS NEW P (SCALAR_ITEM => NUMBER) ;
BEGIN -- SCALAR_TO_PROCS
VALUE := 0; -- INITIALIZE VALUE SO VARIOUS CASES CAN BE DETECTED.
NEW_P (P_IN => VALUE,
P_OUT => VALUE,
P_IN_OUT => VALUE);
REPORT.FAILED ("EXCEPTION NOT RAISED - SCALARS TO PROCEDURES");
EXCEPTION
WHEN E =>
IF (VALUE /= 1) THEN
CASE VALUE IS
WHEN 11 =>
REPORT.FAILED ("OUT ACTUAL SCALAR " &
"PARAMETER CHANGED GLOBAL VALUE");
WHEN 101 =>
REPORT.FAILED ("IN OUT ACTUAL SCALAR " &
"PARAMETER CHANGED GLOBAL VALUE");
WHEN 111 =>
REPORT.FAILED ("OUT AND IN OUT ACTUAL " &
"SCALAR PARAMETERS CHANGED " &
"GLOBAL VALUE");
WHEN OTHERS =>
REPORT.FAILED ("UNDETERMINED CHANGE TO " &
"GLOBAL VALUE");
END CASE;
END IF;
WHEN OTHERS =>
REPORT.FAILED ("WRONG EXCEPTION RAISED - SCALARS TO PROCEDURES");
END SCALAR_TO_PROCS ;
--------------------------------------------------
SCALAR_TO_FUNCS:
DECLARE
-- (B) SCALAR PARAMETERS TO FUNCTIONS.
TYPE NUMBER IS RANGE 0 .. 101 ;
FIRST : NUMBER ;
SECOND : NUMBER ;
GENERIC
TYPE ITEM IS RANGE <> ;
FUNCTION F (F_IN : IN ITEM) RETURN ITEM ;
FUNCTION F (F_IN : IN ITEM) RETURN ITEM IS
STORE : ITEM := F_IN;
BEGIN -- F
FIRST := FIRST + 1;
IF (F_IN /= STORE) THEN
REPORT.FAILED ("ASSIGNMENT TO SCALAR GLOBAL FUNCTION " &
"PARAMETER CHANGES THE VALUE OF " &
"INPUT PARAMETER");
END IF;
RETURN (100);
END F;
FUNCTION NEW_F IS NEW F (ITEM => NUMBER) ;
BEGIN -- SCALAR_TO_FUNCS
FIRST := 100 ;
SECOND := NEW_F (FIRST) ;
END SCALAR_TO_FUNCS ;
--------------------------------------------------
ACCESS_TO_PROCS:
DECLARE
-- (C) ACCESS PARAMETERS TO PROCEDURES.
TYPE MONTH_TYPE IS (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG,
SEP, OCT, NOV, DEC) ;
TYPE DAY_TYPE IS RANGE 1 .. 31 ;
TYPE YEAR_TYPE IS RANGE 1904 .. 2050 ;
TYPE DATE IS RECORD
MONTH : MONTH_TYPE ;
DAY : DAY_TYPE ;
YEAR : YEAR_TYPE ;
END RECORD ;
TYPE DATE_ACCESS IS ACCESS DATE ;
DATE_POINTER : DATE_ACCESS ;
E : EXCEPTION;
GENERIC
TYPE ITEM IS PRIVATE ;
TYPE ACCESS_ITEM IS ACCESS ITEM ;
PROCEDURE P (P_IN : IN ACCESS_ITEM ;
P_OUT : OUT ACCESS_ITEM ;
P_IN_OUT : IN OUT ACCESS_ITEM) ;
PROCEDURE P (P_IN : IN ACCESS_ITEM ;
P_OUT : OUT ACCESS_ITEM ;
P_IN_OUT : IN OUT ACCESS_ITEM) IS
STORE : ACCESS_ITEM ;
BEGIN -- P
STORE := P_IN ; -- SAVE VALUE OF P_IN AT PROC ENTRY.
DATE_POINTER := NEW DATE'(YEAR => 1990,
DAY => 7,
MONTH => AUG) ;
IF (P_IN /= STORE) THEN
REPORT.FAILED ("ASSIGNMENT TO ACCESS GLOBAL " &
"PARAMETER CHANGES THE VALUE OF " &
"INPUT PARAMETER");
STORE := P_IN; -- RESET STORE FOR NEXT CASE.
END IF;
P_OUT := NEW ITEM ;
IF (P_IN /= STORE) THEN
REPORT.FAILED ("ASSIGNMENT TO ACCESS OUT " &
"PARAMETER CHANGES THE VALUE OF " &
"INPUT PARAMETER");
STORE := P_IN; -- RESET STORE FOR NEXT CASE.
END IF;
P_IN_OUT := NEW ITEM ;
IF (P_IN /= STORE) THEN
REPORT.FAILED ("ASSIGNMENT TO ACCESS IN OUT " &
"PARAMETER CHANGES THE VALUE OF " &
"INPUT PARAMETER");
END IF;
RAISE E; -- CHECK EXCEPTION HANDLING.
END P ;
PROCEDURE NEW_P IS NEW P (ITEM => DATE,
ACCESS_ITEM => DATE_ACCESS) ;
BEGIN -- ACCESS_TO_PROCS
DATE_POINTER := NEW DATE'(MONTH => DEC,
DAY => 25,
YEAR => 2000) ;
NEW_P (P_IN => DATE_POINTER,
P_OUT => DATE_POINTER,
P_IN_OUT => DATE_POINTER) ;
REPORT.FAILED ("EXCEPTION NOT RAISED - ACCESS TO PROCEDURES");
EXCEPTION
WHEN E =>
IF (DATE_POINTER.ALL /= (AUG, 7, 1990)) THEN
REPORT.FAILED ("OUT OR IN OUT ACTUAL PROCEDURE " &
"PARAMETER VALUE CHANGED DESPITE " &
"RAISED EXCEPTION");
END IF;
WHEN OTHERS =>
REPORT.FAILED ("WRONG EXCEPTION RAISED - ACCESS TO PROCEDURES");
END ACCESS_TO_PROCS ;
--------------------------------------------------
ACCESS_TO_FUNCS:
DECLARE
-- (D) ACCESS PARAMETERS TO FUNCTIONS.
TYPE MONTH_TYPE IS (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG,
SEP, OCT, NOV, DEC) ;
TYPE DAY_TYPE IS RANGE 1 .. 31 ;
TYPE YEAR_TYPE IS RANGE 1904 .. 2050 ;
TYPE DATE IS RECORD
MONTH : MONTH_TYPE ;
DAY : DAY_TYPE ;
YEAR : YEAR_TYPE ;
END RECORD ;
TYPE DATE_ACCESS IS ACCESS DATE ;
DATE_POINTER : DATE_ACCESS ;
NEXT_DATE : DATE_ACCESS ;
GENERIC
TYPE ITEM IS PRIVATE ;
TYPE ACCESS_ITEM IS ACCESS ITEM ;
FUNCTION F (F_IN : IN ACCESS_ITEM) RETURN ACCESS_ITEM ;
FUNCTION F (F_IN : IN ACCESS_ITEM) RETURN ACCESS_ITEM IS
STORE : ACCESS_ITEM := F_IN ;
BEGIN -- F
DATE_POINTER := NEW DATE'(YEAR => 1990,
DAY => 7,
MONTH => AUG) ;
IF (F_IN /= STORE) THEN
REPORT.FAILED ("ASSIGNMENT TO ACCESS GLOBAL FUNCTION " &
"PARAMETER CHANGES THE VALUE OF " &
"INPUT PARAMETER");
END IF;
RETURN (NULL);
END F ;
FUNCTION NEW_F IS NEW F (ITEM => DATE,
ACCESS_ITEM => DATE_ACCESS) ;
BEGIN -- ACCESS_TO_FUNCS
DATE_POINTER := NULL ;
NEXT_DATE := NEW_F(F_IN => DATE_POINTER) ;
END ACCESS_TO_FUNCS ;
--------------------------------------------------
REPORT.RESULT;
END CC3017C;
|
libsrc/graphics/osca/swapgfxbk.asm
|
jpoikela/z88dk
| 640 |
177693
|
<filename>libsrc/graphics/osca/swapgfxbk.asm
;
; Z88 Graphics Functions - Small C+ stubs
;
; Written around the Interlogic Standard Library
;
; Stubs Written by <NAME> - 15/10/98
;
;
; Page the graphics bank in/out - used by all gfx functions
; Simply does a swap...
;
;
; Stefano - Sept 2011
;
;
; $Id: swapgfxbk.asm,v 1.6 2017-01-02 22:57:58 aralbrec Exp $
;
; INCLUDE "target/osca/def/flos.def"
INCLUDE "target/osca/def/osca.def"
SECTION code_clib
PUBLIC swapgfxbk
PUBLIC _swapgfxbk
PUBLIC swapgfxbk1
PUBLIC _swapgfxbk1
.swapgfxbk
._swapgfxbk
;call kjt_wait_vrt ; wait for last line of display
;call kjt_page_in_video ; page video RAM in at $2000-$3fff
di
ld (asave),a
in a,(sys_mem_select)
or $40
out (sys_mem_select),a ; page in video RAM
ld a,(asave)
ret
.swapgfxbk1
._swapgfxbk1
ld (asave),a
in a,(sys_mem_select) ; page in video RAM
and $bf
out (sys_mem_select),a
;call kjt_page_out_video ; page video RAM out of $2000-$3fff
ld a,@10000011 ; Enable keyboard and mouse interrupts only
out (sys_irq_enable),a
ld a,(asave)
ei
ret
SECTION bss_clib
.asave
defb 0
|
programs/oeis/039/A039267.asm
|
neoneye/loda
| 22 |
174264
|
; A039267: Numbers whose base-12 representation has the same number of 7's and 10's.
; 0,1,2,3,4,5,6,8,9,11,12,13,14,15,16,17,18,20,21,23,24,25,26,27,28,29,30,32,33,35,36,37,38,39,40,41,42,44,45,47,48,49,50,51,52,53,54,56,57,59,60,61,62,63,64,65,66,68,69,71,72,73,74,75,76,77,78,80,81,83
add $0,1
seq $0,39218 ; Numbers whose base-12 representation has the same number of 0's and 9's.
sub $0,2
|
maps/MountMortar1FInside.asm
|
Dev727/ancientplatinum
| 28 |
176028
|
<reponame>Dev727/ancientplatinum
object_const_def ; object_event constants
const MOUNTMORTAR1FINSIDE_BOULDER
const MOUNTMORTAR1FINSIDE_POKE_BALL1
const MOUNTMORTAR1FINSIDE_POKE_BALL2
const MOUNTMORTAR1FINSIDE_POKE_BALL3
const MOUNTMORTAR1FINSIDE_POKE_BALL4
const MOUNTMORTAR1FINSIDE_POKE_BALL5
const MOUNTMORTAR1FINSIDE_SUPER_NERD1
const MOUNTMORTAR1FINSIDE_SUPER_NERD2
const MOUNTMORTAR1FINSIDE_POKE_BALL6
const MOUNTMORTAR1FINSIDE_POKE_BALL7
MountMortar1FInside_MapScripts:
db 0 ; scene scripts
db 0 ; callbacks
TrainerPokemaniacMiller:
trainer POKEMANIAC, MILLER, EVENT_BEAT_POKEMANIAC_MILLER, PokemaniacMillerSeenText, PokemaniacMillerBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext PokemaniacMillerAfterBattleText
waitbutton
closetext
end
TrainerSupernerdMarkus:
trainer SUPER_NERD, MARKUS, EVENT_BEAT_SUPER_NERD_MARKUS, SupernerdMarkusSeenText, SupernerdMarkusBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext SupernerdMarkusAfterBattleText
waitbutton
closetext
end
MountMortar1FBoulder:
jumpstd strengthboulder
MountMortar1FInsideEscapeRope:
itemball ESCAPE_ROPE
MountMortar1FInsideMaxRevive:
itemball MAX_REVIVE
MountMortar1FInsideHyperPotion:
itemball HYPER_POTION
MountMortar1FInsideMaxPotion:
itemball MAX_POTION
MountMortar1FInsideNugget:
itemball NUGGET
MountMortar1FInsideIron:
itemball IRON
MountMortar1FInsideUltraBall:
itemball ULTRA_BALL
MountMortar1FInsideHiddenMaxRepel:
hiddenitem MAX_REPEL, EVENT_MOUNT_MORTAR_1F_INSIDE_HIDDEN_MAX_REPEL
PokemaniacMillerSeenText:
text "I'm not losing"
line "this time!"
done
PokemaniacMillerBeatenText:
text "I lost to some"
line "kid…?"
done
PokemaniacMillerAfterBattleText:
text "A while back, this"
line "karate dude wanted"
para "to battle. He was"
line "ridiculously good."
para "He just thrashed"
line "us silly."
para "He went in deeper"
line "saying it was for"
para "his training. I"
line "wonder how he is?"
done
SupernerdMarkusSeenText:
text "Hey! HUGH!"
done
SupernerdMarkusBeatenText:
text "I mistook you for"
line "someone else…"
done
SupernerdMarkusAfterBattleText:
text "I came to explore"
line "MT.MORTAR, but I"
para "got separated from"
line "my partner…"
para "Did you run into a"
line "trainer who uses a"
para "SEADRA that knows"
line "WATERFALL?"
done
MountMortar1FInside_MapEvents:
db 0, 0 ; filler
db 6 ; warp events
warp_event 11, 47, MOUNT_MORTAR_1F_OUTSIDE, 5
warp_event 29, 47, MOUNT_MORTAR_1F_OUTSIDE, 6
warp_event 5, 39, MOUNT_MORTAR_1F_OUTSIDE, 8
warp_event 33, 41, MOUNT_MORTAR_1F_OUTSIDE, 9
warp_event 3, 19, MOUNT_MORTAR_B1F, 1
warp_event 9, 9, MOUNT_MORTAR_2F_INSIDE, 2
db 0 ; coord events
db 1 ; bg events
bg_event 30, 11, BGEVENT_ITEM, MountMortar1FInsideHiddenMaxRepel
db 10 ; object events
object_event 21, 43, SPRITE_BOULDER, SPRITEMOVEDATA_STRENGTH_BOULDER, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, MountMortar1FBoulder, -1
object_event 35, 38, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, MountMortar1FInsideEscapeRope, EVENT_MOUNT_MORTAR_1F_INSIDE_ESCAPE_ROPE
object_event 16, 10, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, MountMortar1FInsideMaxRevive, EVENT_MOUNT_MORTAR_1F_INSIDE_MAX_REVIVE
object_event 10, 27, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, MountMortar1FInsideHyperPotion, EVENT_MOUNT_MORTAR_1F_INSIDE_HYPER_POTION
object_event 22, 20, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, MountMortar1FInsideMaxPotion, EVENT_MOUNT_MORTAR_1F_INSIDE_MAX_POTION
object_event 35, 19, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, MountMortar1FInsideNugget, EVENT_MOUNT_MORTAR_1F_INSIDE_NUGGET
object_event 33, 43, SPRITE_SUPER_NERD, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 3, TrainerPokemaniacMiller, -1
object_event 24, 28, SPRITE_SUPER_NERD, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_TRAINER, 3, TrainerSupernerdMarkus, -1
object_event 8, 16, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, MountMortar1FInsideIron, EVENT_MOUNT_MORTAR_1F_INSIDE_IRON
object_event 17, 17, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, MountMortar1FInsideUltraBall, EVENT_MOUNT_MORTAR_1F_INSIDE_ULTRA_BALL
|
test/Succeed/Issue2117.agda
|
shlevy/agda
| 1,989 |
8209
|
-- Andreas, 2016-07-27, issue #2117 reported by <NAME>
-- {-# OPTIONS -v tc:10 #-}
record R : Set₁ where
field
A : Set
open R {{...}}
record S (r : R) : Set where
instance i = r
field f : A
-- ERROR WAS:
-- No instance of type R was found in scope.
-- when checking that the expression A has type Set
-- Should succeed!
|
permissionsex-core/src/main/antlr4/ninja/leaping/permissionsex/util/glob/parser/GlobParser.g4
|
GhostRealms/PermissionsEx
| 1 |
6929
|
<reponame>GhostRealms/PermissionsEx<gh_stars>1-10
parser grammar GlobParser;
options {
tokenVocab = GlobLexer;
}
rootGlob: glob EOF;
glob: element+;
literal: CHARACTER+;
or: OR_START glob (OR_SEPARATOR glob)* OR_END;
element: or | literal;
|
src/loggers/adabase-logger-base-file.ads
|
jrmarino/AdaBase
| 30 |
15211
|
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../../License.txt
package AdaBase.Logger.Base.File is
type File_Logger is new Base_Logger and AIL.iLogger with private;
type File_Logger_access is access all File_Logger;
overriding
procedure reaction (listener : File_Logger);
procedure set_filepath (listener : out File_Logger; filename : String);
private
type File_Logger is new Base_Logger and AIL.iLogger
with record
filepath : CT.Text := CT.SUS ("/tmp/adabase.log");
end record;
end AdaBase.Logger.Base.File;
|
oeis/158/A158677.asm
|
neoneye/loda-programs
| 11 |
80037
|
; A158677: Period 6: repeat [3, 4, 0, 5, 6, 3].
; Submitted by <NAME>
; 3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5,6,3,3,4,0,5
mod $0,6
lpb $0
mov $2,$0
mod $0,2
seq $2,6094 ; Products of 2 successive primes.
sub $2,2
mov $3,$2
mul $2,2
min $3,1
add $3,$2
lpe
add $0,$3
add $0,3
mod $0,10
|
Task/Happy-numbers/Ada/happy-numbers.ada
|
LaudateCorpus1/RosettaCodeData
| 1 |
5268
|
<reponame>LaudateCorpus1/RosettaCodeData
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers.Ordered_Sets;
procedure Test_Happy_Digits is
function Is_Happy (N : Positive) return Boolean is
package Sets_Of_Positive is new Ada.Containers.Ordered_Sets (Positive);
use Sets_Of_Positive;
function Next (N : Positive) return Natural is
Sum : Natural := 0;
Accum : Natural := N;
begin
while Accum > 0 loop
Sum := Sum + (Accum mod 10) ** 2;
Accum := Accum / 10;
end loop;
return Sum;
end Next;
Current : Positive := N;
Visited : Set;
begin
loop
if Current = 1 then
return True;
elsif Visited.Contains (Current) then
return False;
else
Visited.Insert (Current);
Current := Next (Current);
end if;
end loop;
end Is_Happy;
Found : Natural := 0;
begin
for N in Positive'Range loop
if Is_Happy (N) then
Put (Integer'Image (N));
Found := Found + 1;
exit when Found = 8;
end if;
end loop;
end Test_Happy_Digits;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.