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
|
---|---|---|---|---|
oeis/142/A142235.asm | neoneye/loda-programs | 11 | 243174 | <gh_stars>10-100
; A142235: Primes congruent to 38 mod 41.
; Submitted by <NAME>
; 79,571,653,1063,1637,1801,2129,2293,2539,2621,3359,3769,3851,4261,4507,4999,5081,5573,5737,6229,6311,6803,6967,7213,7459,7541,7951,8443,8689,9181,10247,10657,10739,10903,11149,11887,11969,12379,12953,13691,14347,14593,15331,15413,15823,16069,16561,16889,17053,17299,17627,17791,18119,19267,19759,19841,20333,20743,21317,21481,21563,21727,23039,23203,23531,24023,25171,25253,26237,26647,26729,26893,27631,28123,28697,29599,29927,30091,30829,30911,31321,31567,31649,32059,32141,32633,32797,33289,33617
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $2,1
mov $3,$1
add $1,$4
mul $3,$4
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,39
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
mul $4,2
lpe
mov $0,$1
sub $0,80
mul $0,2
add $0,79
|
day13/src/day.adb | jwarwick/aoc_2020 | 3 | 11745 | -- AoC 2020, Day 13
with Ada.Text_IO;
with GNAT.String_Split;
use GNAT;
package body Day is
package TIO renames Ada.Text_IO;
function load_file(filename : in String) return Schedule is
file : TIO.File_Type;
earliest : Long_Long_Integer;
departs : Depart_Vectors.Vector := Empty_Vector;
offsets : Depart_Vectors.Vector := Empty_Vector;
subs : String_Split.Slice_Set;
seps : constant String := ",";
begin
TIO.open(File => file, Mode => TIO.In_File, Name => filename);
earliest := Long_Long_Integer'Value(TIO.get_line(file));
String_Split.Create (S => subs, From => TIO.get_line(file), Separators => seps, Mode => String_Split.Multiple);
TIO.close(file);
for i in 1 .. String_Split.Slice_Count(subs) loop
declare
sub : constant String := String_Split.Slice(subs, i);
begin
if sub /= "x" then
departs.append(Long_Long_Integer'Value(sub));
offsets.append(Long_Long_Integer(i) - 1);
end if;
end;
end loop;
return Schedule'(earliest => earliest, departures => departs, offsets => offsets);
end load_file;
function bus_mult(s : in Schedule) return Long_Long_Integer is
offset : Long_Long_Integer := 0;
begin
loop
declare
leave : constant Long_Long_Integer := s.earliest + offset;
begin
for d of s.departures loop
if (leave mod d) = 0 then
return offset * d;
end if;
end loop;
offset := offset + 1;
end;
end loop;
end bus_mult;
function earliest_matching_iterative(s : in Schedule) return Long_Long_Integer is
t : Long_Long_Integer := 1;
begin
main_loop:
loop
declare
match : Boolean := true;
base : constant Long_Long_Integer := Long_Long_Integer(s.departures.first_element) * t;
begin
for i in s.departures.first_index+1 .. s.departures.last_index loop
declare
long_offset : constant Long_Long_Integer := s.offsets(i);
long_depart : constant Long_Long_Integer := s.departures(i);
offset : constant Long_Long_Integer := base + long_offset;
begin
if (offset mod long_depart) /= 0 then
match := false;
exit;
end if;
end;
end loop;
if match then
return base;
end if;
t := t+1;
end;
end loop main_loop;
end earliest_matching_iterative;
function bus_intersect(start : in Long_Long_Integer; step : in Long_Long_Integer;
bus : in Long_Long_Integer; offset : in Long_Long_Integer) return Long_Long_Integer is
t : Long_Long_Integer := start;
offset_t : Long_Long_Integer;
begin
loop
offset_t := t + offset;
if offset_t mod bus = 0 then
exit;
end if;
t := t + step;
end loop;
return t;
end bus_intersect;
function earliest_matching(s : in Schedule) return Long_Long_Integer is
t : Long_Long_Integer := 0;
step : Long_Long_Integer := s.departures.first_element;
begin
for i in s.departures.first_index+1 .. s.departures.last_index loop
t := bus_intersect(t, step, s.departures(i), s.offsets(i));
step := step * s.departures(i);
end loop;
return t;
end earliest_matching;
end Day;
|
programs/oeis/112/A112652.asm | jmorken/loda | 1 | 24356 | <reponame>jmorken/loda<gh_stars>1-10
; A112652: a(n) squared is congruent to a(n) (mod 12).
; 0,1,4,9,12,13,16,21,24,25,28,33,36,37,40,45,48,49,52,57,60,61,64,69,72,73,76,81,84,85,88,93,96,97,100,105,108,109,112,117,120,121,124,129,132,133,136,141,144,145,148,153,156,157,160,165,168,169,172,177,180,181,184,189,192,193,196,201,204,205,208,213,216,217,220,225,228,229,232,237,240,241,244,249,252,253,256,261,264,265,268,273,276,277,280,285,288,289,292,297,300,301,304,309,312,313,316,321,324,325,328,333,336,337,340,345,348,349,352,357,360,361,364,369,372,373,376,381,384,385,388,393,396,397,400,405,408,409,412,417,420,421,424,429,432,433,436,441,444,445,448,453,456,457,460,465,468,469,472,477,480,481,484,489,492,493,496,501,504,505,508,513,516,517,520,525,528,529,532,537,540,541,544,549,552,553,556,561,564,565,568,573,576,577,580,585,588,589,592,597,600,601,604,609,612,613,616,621,624,625,628,633,636,637,640,645,648,649,652,657,660,661,664,669,672,673,676,681,684,685,688,693,696,697,700,705,708,709,712,717,720,721,724,729,732,733,736,741,744,745
mov $1,$0
mov $3,2
lpb $0
sub $0,1
mov $2,2
trn $2,$3
mov $3,$1
mov $1,$2
add $4,3
lpe
add $1,$4
trn $1,2
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/g-regist.adb | orb-zhuchen/Orb | 0 | 7860 | <filename>support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/g-regist.adb
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . R E G I S T R Y --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Interfaces.C;
with System;
with GNAT.Directory_Operations;
package body GNAT.Registry is
use System;
------------------------------
-- Binding to the Win32 API --
------------------------------
subtype LONG is Interfaces.C.long;
subtype ULONG is Interfaces.C.unsigned_long;
subtype DWORD is ULONG;
type PULONG is access all ULONG;
subtype PDWORD is PULONG;
subtype LPDWORD is PDWORD;
subtype Error_Code is LONG;
subtype REGSAM is LONG;
type PHKEY is access all HKEY;
ERROR_SUCCESS : constant Error_Code := 0;
REG_SZ : constant := 1;
REG_EXPAND_SZ : constant := 2;
function RegCloseKey (Key : HKEY) return LONG;
pragma Import (Stdcall, RegCloseKey, "RegCloseKey");
function RegCreateKeyEx
(Key : HKEY;
lpSubKey : Address;
Reserved : DWORD;
lpClass : Address;
dwOptions : DWORD;
samDesired : REGSAM;
lpSecurityAttributes : Address;
phkResult : PHKEY;
lpdwDisposition : LPDWORD)
return LONG;
pragma Import (Stdcall, RegCreateKeyEx, "RegCreateKeyExA");
function RegDeleteKey
(Key : HKEY;
lpSubKey : Address) return LONG;
pragma Import (Stdcall, RegDeleteKey, "RegDeleteKeyA");
function RegDeleteValue
(Key : HKEY;
lpValueName : Address) return LONG;
pragma Import (Stdcall, RegDeleteValue, "RegDeleteValueA");
function RegEnumValue
(Key : HKEY;
dwIndex : DWORD;
lpValueName : Address;
lpcbValueName : LPDWORD;
lpReserved : LPDWORD;
lpType : LPDWORD;
lpData : Address;
lpcbData : LPDWORD) return LONG;
pragma Import (Stdcall, RegEnumValue, "RegEnumValueA");
function RegOpenKeyEx
(Key : HKEY;
lpSubKey : Address;
ulOptions : DWORD;
samDesired : REGSAM;
phkResult : PHKEY) return LONG;
pragma Import (Stdcall, RegOpenKeyEx, "RegOpenKeyExA");
function RegQueryValueEx
(Key : HKEY;
lpValueName : Address;
lpReserved : LPDWORD;
lpType : LPDWORD;
lpData : Address;
lpcbData : LPDWORD) return LONG;
pragma Import (Stdcall, RegQueryValueEx, "RegQueryValueExA");
function RegSetValueEx
(Key : HKEY;
lpValueName : Address;
Reserved : DWORD;
dwType : DWORD;
lpData : Address;
cbData : DWORD) return LONG;
pragma Import (Stdcall, RegSetValueEx, "RegSetValueExA");
function RegEnumKey
(Key : HKEY;
dwIndex : DWORD;
lpName : Address;
cchName : DWORD) return LONG;
pragma Import (Stdcall, RegEnumKey, "RegEnumKeyA");
---------------------
-- Local Constants --
---------------------
Max_Key_Size : constant := 1_024;
-- Maximum number of characters for a registry key
Max_Value_Size : constant := 2_048;
-- Maximum number of characters for a key's value
-----------------------
-- Local Subprograms --
-----------------------
function To_C_Mode (Mode : Key_Mode) return REGSAM;
-- Returns the Win32 mode value for the Key_Mode value
procedure Check_Result (Result : LONG; Message : String);
-- Checks value Result and raise the exception Registry_Error if it is not
-- equal to ERROR_SUCCESS. Message and the error value (Result) is added
-- to the exception message.
------------------
-- Check_Result --
------------------
procedure Check_Result (Result : LONG; Message : String) is
use type LONG;
begin
if Result /= ERROR_SUCCESS then
raise Registry_Error with
Message & " (" & LONG'Image (Result) & ')';
end if;
end Check_Result;
---------------
-- Close_Key --
---------------
procedure Close_Key (Key : HKEY) is
Result : LONG;
begin
Result := RegCloseKey (Key);
Check_Result (Result, "Close_Key");
end Close_Key;
----------------
-- Create_Key --
----------------
function Create_Key
(From_Key : HKEY;
Sub_Key : String;
Mode : Key_Mode := Read_Write) return HKEY
is
REG_OPTION_NON_VOLATILE : constant := 16#0#;
C_Sub_Key : constant String := Sub_Key & ASCII.NUL;
C_Class : constant String := "" & ASCII.NUL;
C_Mode : constant REGSAM := To_C_Mode (Mode);
New_Key : aliased HKEY;
Result : LONG;
Dispos : aliased DWORD;
begin
Result :=
RegCreateKeyEx
(From_Key,
C_Sub_Key (C_Sub_Key'First)'Address,
0,
C_Class (C_Class'First)'Address,
REG_OPTION_NON_VOLATILE,
C_Mode,
Null_Address,
New_Key'Unchecked_Access,
Dispos'Unchecked_Access);
Check_Result (Result, "Create_Key " & Sub_Key);
return New_Key;
end Create_Key;
----------------
-- Delete_Key --
----------------
procedure Delete_Key (From_Key : HKEY; Sub_Key : String) is
C_Sub_Key : constant String := Sub_Key & ASCII.NUL;
Result : LONG;
begin
Result := RegDeleteKey (From_Key, C_Sub_Key (C_Sub_Key'First)'Address);
Check_Result (Result, "Delete_Key " & Sub_Key);
end Delete_Key;
------------------
-- Delete_Value --
------------------
procedure Delete_Value (From_Key : HKEY; Sub_Key : String) is
C_Sub_Key : constant String := Sub_Key & ASCII.NUL;
Result : LONG;
begin
Result := RegDeleteValue (From_Key, C_Sub_Key (C_Sub_Key'First)'Address);
Check_Result (Result, "Delete_Value " & Sub_Key);
end Delete_Value;
-------------------
-- For_Every_Key --
-------------------
procedure For_Every_Key
(From_Key : HKEY;
Recursive : Boolean := False)
is
procedure Recursive_For_Every_Key
(From_Key : HKEY;
Recursive : Boolean := False;
Quit : in out Boolean);
-----------------------------
-- Recursive_For_Every_Key --
-----------------------------
procedure Recursive_For_Every_Key
(From_Key : HKEY;
Recursive : Boolean := False;
Quit : in out Boolean)
is
use type LONG;
use type ULONG;
Index : ULONG := 0;
Result : LONG;
Sub_Key : Interfaces.C.char_array (1 .. Max_Key_Size);
pragma Warnings (Off, Sub_Key);
Size_Sub_Key : aliased ULONG;
Sub_Hkey : HKEY;
function Current_Name return String;
------------------
-- Current_Name --
------------------
function Current_Name return String is
begin
return Interfaces.C.To_Ada (Sub_Key);
end Current_Name;
-- Start of processing for Recursive_For_Every_Key
begin
loop
Size_Sub_Key := Sub_Key'Length;
Result :=
RegEnumKey
(From_Key, Index, Sub_Key (1)'Address, Size_Sub_Key);
exit when not (Result = ERROR_SUCCESS);
Sub_Hkey := Open_Key (From_Key, Interfaces.C.To_Ada (Sub_Key));
Action (Natural (Index) + 1, Sub_Hkey, Current_Name, Quit);
if not Quit and then Recursive then
Recursive_For_Every_Key (Sub_Hkey, True, Quit);
end if;
Close_Key (Sub_Hkey);
exit when Quit;
Index := Index + 1;
end loop;
end Recursive_For_Every_Key;
-- Local Variables
Quit : Boolean := False;
-- Start of processing for For_Every_Key
begin
Recursive_For_Every_Key (From_Key, Recursive, Quit);
end For_Every_Key;
-------------------------
-- For_Every_Key_Value --
-------------------------
procedure For_Every_Key_Value
(From_Key : HKEY;
Expand : Boolean := False)
is
use GNAT.Directory_Operations;
use type LONG;
use type ULONG;
Index : ULONG := 0;
Result : LONG;
Sub_Key : String (1 .. Max_Key_Size);
pragma Warnings (Off, Sub_Key);
Value : String (1 .. Max_Value_Size);
pragma Warnings (Off, Value);
Size_Sub_Key : aliased ULONG;
Size_Value : aliased ULONG;
Type_Sub_Key : aliased DWORD;
Quit : Boolean;
begin
loop
Size_Sub_Key := Sub_Key'Length;
Size_Value := Value'Length;
Result :=
RegEnumValue
(From_Key, Index,
Sub_Key (1)'Address,
Size_Sub_Key'Unchecked_Access,
null,
Type_Sub_Key'Unchecked_Access,
Value (1)'Address,
Size_Value'Unchecked_Access);
exit when not (Result = ERROR_SUCCESS);
Quit := False;
if Type_Sub_Key = REG_EXPAND_SZ and then Expand then
Action
(Natural (Index) + 1,
Sub_Key (1 .. Integer (Size_Sub_Key)),
Directory_Operations.Expand_Path
(Value (1 .. Integer (Size_Value) - 1),
Directory_Operations.DOS),
Quit);
elsif Type_Sub_Key = REG_SZ or else Type_Sub_Key = REG_EXPAND_SZ then
Action
(Natural (Index) + 1,
Sub_Key (1 .. Integer (Size_Sub_Key)),
Value (1 .. Integer (Size_Value) - 1),
Quit);
end if;
exit when Quit;
Index := Index + 1;
end loop;
end For_Every_Key_Value;
----------------
-- Key_Exists --
----------------
function Key_Exists
(From_Key : HKEY;
Sub_Key : String) return Boolean
is
New_Key : HKEY;
begin
New_Key := Open_Key (From_Key, Sub_Key);
Close_Key (New_Key);
-- We have been able to open the key so it exists
return True;
exception
when Registry_Error =>
-- An error occurred, the key was not found
return False;
end Key_Exists;
--------------
-- Open_Key --
--------------
function Open_Key
(From_Key : HKEY;
Sub_Key : String;
Mode : Key_Mode := Read_Only) return HKEY
is
C_Sub_Key : constant String := Sub_Key & ASCII.NUL;
C_Mode : constant REGSAM := To_C_Mode (Mode);
New_Key : aliased HKEY;
Result : LONG;
begin
Result :=
RegOpenKeyEx
(From_Key,
C_Sub_Key (C_Sub_Key'First)'Address,
0,
C_Mode,
New_Key'Unchecked_Access);
Check_Result (Result, "Open_Key " & Sub_Key);
return New_Key;
end Open_Key;
-----------------
-- Query_Value --
-----------------
function Query_Value
(From_Key : HKEY;
Sub_Key : String;
Expand : Boolean := False) return String
is
use GNAT.Directory_Operations;
use type ULONG;
Value : String (1 .. Max_Value_Size);
pragma Warnings (Off, Value);
Size_Value : aliased ULONG;
Type_Value : aliased DWORD;
C_Sub_Key : constant String := Sub_Key & ASCII.NUL;
Result : LONG;
begin
Size_Value := Value'Length;
Result :=
RegQueryValueEx
(From_Key,
C_Sub_Key (C_Sub_Key'First)'Address,
null,
Type_Value'Unchecked_Access,
Value (Value'First)'Address,
Size_Value'Unchecked_Access);
Check_Result (Result, "Query_Value " & Sub_Key & " key");
if Type_Value = REG_EXPAND_SZ and then Expand then
return Directory_Operations.Expand_Path
(Value (1 .. Integer (Size_Value - 1)),
Directory_Operations.DOS);
else
return Value (1 .. Integer (Size_Value - 1));
end if;
end Query_Value;
---------------
-- Set_Value --
---------------
procedure Set_Value
(From_Key : HKEY;
Sub_Key : String;
Value : String;
Expand : Boolean := False)
is
C_Sub_Key : constant String := Sub_Key & ASCII.NUL;
C_Value : constant String := Value & ASCII.NUL;
Value_Type : DWORD;
Result : LONG;
begin
Value_Type := (if Expand then REG_EXPAND_SZ else REG_SZ);
Result :=
RegSetValueEx
(From_Key,
C_Sub_Key (C_Sub_Key'First)'Address,
0,
Value_Type,
C_Value (C_Value'First)'Address,
C_Value'Length);
Check_Result (Result, "Set_Value " & Sub_Key & " key");
end Set_Value;
---------------
-- To_C_Mode --
---------------
function To_C_Mode (Mode : Key_Mode) return REGSAM is
use type REGSAM;
KEY_READ : constant := 16#20019#;
KEY_WRITE : constant := 16#20006#;
KEY_WOW64_64KEY : constant := 16#00100#;
KEY_WOW64_32KEY : constant := 16#00200#;
begin
case Mode is
when Read_Only =>
return KEY_READ + KEY_WOW64_32KEY;
when Read_Write =>
return KEY_READ + KEY_WRITE + KEY_WOW64_32KEY;
when Read_Only_64 =>
return KEY_READ + KEY_WOW64_64KEY;
when Read_Write_64 =>
return KEY_READ + KEY_WRITE + KEY_WOW64_64KEY;
end case;
end To_C_Mode;
end GNAT.Registry;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2310.asm | ljhsiun2/medusa | 9 | 16446 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x296b, %r11
clflush (%r11)
and $64393, %r10
movb $0x61, (%r11)
nop
nop
dec %rdi
lea addresses_D_ht+0x1d567, %rsi
lea addresses_normal_ht+0x1ee23, %rdi
nop
nop
nop
sub %rbp, %rbp
mov $88, %rcx
rep movsq
nop
nop
nop
add $44345, %r11
lea addresses_WT_ht+0xb94b, %rbp
nop
nop
nop
nop
lfence
mov $0x6162636465666768, %r10
movq %r10, %xmm5
movups %xmm5, (%rbp)
nop
sub %r11, %r11
lea addresses_A_ht+0xfee7, %rsi
lea addresses_normal_ht+0x1c977, %rdi
clflush (%rsi)
clflush (%rdi)
inc %r14
mov $47, %rcx
rep movsw
nop
add $32327, %rcx
lea addresses_WT_ht+0x5977, %rsi
lea addresses_UC_ht+0x19160, %rdi
nop
nop
nop
nop
nop
and %r15, %r15
mov $40, %rcx
rep movsw
nop
inc %rsi
lea addresses_D_ht+0x18877, %rsi
lea addresses_UC_ht+0x1ed67, %rdi
nop
nop
nop
nop
sub $35020, %r11
mov $127, %rcx
rep movsw
nop
nop
nop
nop
add $11433, %rbp
lea addresses_UC_ht+0x177e7, %rsi
lea addresses_A_ht+0x10d67, %rdi
nop
nop
sub %r11, %r11
mov $61, %rcx
rep movsw
nop
nop
nop
nop
and %r14, %r14
lea addresses_WC_ht+0x329f, %rsi
lea addresses_A_ht+0x3067, %rdi
nop
nop
sub $1191, %r11
mov $118, %rcx
rep movsw
nop
and %rsi, %rsi
lea addresses_WC_ht+0xfc07, %rsi
lea addresses_WC_ht+0x2667, %rdi
and $45850, %r11
mov $19, %rcx
rep movsb
sub %rbp, %rbp
lea addresses_A_ht+0x12717, %rsi
lea addresses_WC_ht+0x5695, %rdi
nop
nop
nop
nop
nop
sub %rbp, %rbp
mov $79, %rcx
rep movsb
nop
nop
nop
nop
nop
add $37258, %rsi
lea addresses_A_ht+0x1ba67, %rsi
lea addresses_WT_ht+0x1b3e7, %rdi
clflush (%rsi)
nop
cmp %rbp, %rbp
mov $63, %rcx
rep movsl
nop
nop
nop
nop
nop
add $38772, %r14
lea addresses_WC_ht+0x19807, %r15
nop
add $4543, %r10
mov $0x6162636465666768, %r11
movq %r11, %xmm3
vmovups %ymm3, (%r15)
nop
nop
nop
nop
inc %rbp
lea addresses_normal_ht+0xe6a7, %rsi
lea addresses_UC_ht+0x1767, %rdi
nop
inc %r11
mov $84, %rcx
rep movsw
nop
add $41809, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %r9
push %rax
push %rdi
push %rdx
push %rsi
// Store
lea addresses_A+0x15167, %rdi
nop
nop
nop
sub %r9, %r9
mov $0x5152535455565758, %rdx
movq %rdx, %xmm3
vmovups %ymm3, (%rdi)
nop
nop
cmp %rdi, %rdi
// Store
lea addresses_normal+0x18d67, %rax
nop
and $43277, %rsi
mov $0x5152535455565758, %rdx
movq %rdx, %xmm6
vmovups %ymm6, (%rax)
nop
nop
nop
nop
and %rdx, %rdx
// Store
lea addresses_D+0x14327, %r15
nop
nop
nop
nop
inc %rdi
mov $0x5152535455565758, %rdx
movq %rdx, (%r15)
nop
nop
nop
and $32811, %rdx
// Faulty Load
lea addresses_UC+0x18167, %rdx
nop
sub $62391, %r10
mov (%rdx), %r15
lea oracles, %rsi
and $0xff, %r15
shlq $12, %r15
mov (%rsi,%r15,1), %r15
pop %rsi
pop %rdx
pop %rdi
pop %rax
pop %r9
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WT_ht', 'same': True, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WC_ht', 'same': True, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
src/ptrace_binding/asm_generic_posix_types_h.ads | mgrojo/smk | 10 | 26668 | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
package asm_generic_posix_types_h is
-- SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
-- * This file is generally used by user-level software, so you need to
-- * be a little careful about namespace pollution etc.
-- *
-- * First the types that are often defined in different ways across
-- * architectures, so that you can override them.
--
subtype uu_kernel_long_t is long; -- /usr/include/asm-generic/posix_types.h:15
subtype uu_kernel_ulong_t is unsigned_long; -- /usr/include/asm-generic/posix_types.h:16
subtype uu_kernel_ino_t is uu_kernel_ulong_t; -- /usr/include/asm-generic/posix_types.h:20
subtype uu_kernel_mode_t is unsigned; -- /usr/include/asm-generic/posix_types.h:24
subtype uu_kernel_pid_t is int; -- /usr/include/asm-generic/posix_types.h:28
subtype uu_kernel_ipc_pid_t is int; -- /usr/include/asm-generic/posix_types.h:32
subtype uu_kernel_uid_t is unsigned; -- /usr/include/asm-generic/posix_types.h:36
subtype uu_kernel_gid_t is unsigned; -- /usr/include/asm-generic/posix_types.h:37
subtype uu_kernel_suseconds_t is uu_kernel_long_t; -- /usr/include/asm-generic/posix_types.h:41
subtype uu_kernel_daddr_t is int; -- /usr/include/asm-generic/posix_types.h:45
subtype uu_kernel_uid32_t is unsigned; -- /usr/include/asm-generic/posix_types.h:49
subtype uu_kernel_gid32_t is unsigned; -- /usr/include/asm-generic/posix_types.h:50
-- * Most 32 bit architectures use "unsigned int" size_t,
-- * and all 64 bit architectures use "unsigned long" size_t.
--
subtype uu_kernel_size_t is uu_kernel_ulong_t; -- /usr/include/asm-generic/posix_types.h:72
subtype uu_kernel_ssize_t is uu_kernel_long_t; -- /usr/include/asm-generic/posix_types.h:73
subtype uu_kernel_ptrdiff_t is uu_kernel_long_t; -- /usr/include/asm-generic/posix_types.h:74
type uu_kernel_fsid_t_val_array is array (0 .. 1) of aliased int;
type uu_kernel_fsid_t is record
val : aliased uu_kernel_fsid_t_val_array; -- /usr/include/asm-generic/posix_types.h:80
end record;
pragma Convention (C_Pass_By_Copy, uu_kernel_fsid_t); -- /usr/include/asm-generic/posix_types.h:81
-- skipped anonymous struct anon_1
-- * anything below here should be completely generic
--
subtype uu_kernel_off_t is uu_kernel_long_t; -- /usr/include/asm-generic/posix_types.h:87
subtype uu_kernel_loff_t is Long_Long_Integer; -- /usr/include/asm-generic/posix_types.h:88
subtype uu_kernel_time_t is uu_kernel_long_t; -- /usr/include/asm-generic/posix_types.h:89
subtype uu_kernel_time64_t is Long_Long_Integer; -- /usr/include/asm-generic/posix_types.h:90
subtype uu_kernel_clock_t is uu_kernel_long_t; -- /usr/include/asm-generic/posix_types.h:91
subtype uu_kernel_timer_t is int; -- /usr/include/asm-generic/posix_types.h:92
subtype uu_kernel_clockid_t is int; -- /usr/include/asm-generic/posix_types.h:93
type uu_kernel_caddr_t is new Interfaces.C.Strings.chars_ptr; -- /usr/include/asm-generic/posix_types.h:94
subtype uu_kernel_uid16_t is unsigned_short; -- /usr/include/asm-generic/posix_types.h:95
subtype uu_kernel_gid16_t is unsigned_short; -- /usr/include/asm-generic/posix_types.h:96
end asm_generic_posix_types_h;
|
Categories/Fam.agda | copumpkin/categories | 98 | 11450 | module Categories.Fam where
open import Level
open import Relation.Binary using (Rel)
import Relation.Binary.HeterogeneousEquality as Het
open Het using (_≅_) renaming (refl to ≣-refl)
open import Categories.Support.PropositionalEquality
open import Categories.Category
module Fam {a b : Level} where
record Fam : Set (suc a ⊔ suc b) where
constructor _,_
field
U : Set a
T : U → Set b
open Fam public
record Hom (A B : Fam) : Set (a ⊔ b) where
constructor _,_
field
f : U A → U B
φ : (x : U A) → T A x → T B (f x)
record _≡Fam_ {X Y} (f g : (Hom X Y)) : Set (a ⊔ b) where
constructor _,_
field
f≡g : {x : _} → Hom.f f x ≣ Hom.f g x
φ≡γ : {x : _} {bx : _} → Hom.φ f x bx ≅ Hom.φ g x bx
module Eq = _≡Fam_
Cat : Category (suc a ⊔ suc b) (a ⊔ b) (a ⊔ b)
Cat = record {
Obj = Fam;
_⇒_ = Hom;
_≡_ = _≡Fam_;
id = id′;
_∘_ = _∘′_;
assoc = ≣-refl , ≣-refl;
identityˡ = ≣-refl , ≣-refl;
identityʳ = ≣-refl , ≣-refl;
equiv = record {
refl = ≣-refl , ≣-refl;
sym = \ { (f≡g , φ≡γ) → ≣-sym f≡g , Het.sym φ≡γ };
trans = λ {(f≡g , φ≡γ) (g≡h , γ≡η) → ≣-trans f≡g g≡h , Het.trans φ≡γ γ≡η} };
∘-resp-≡ = ∘-resp-≡′ }
where
id′ : {A : Fam} → Hom A A
id′ = (\ x → x) , (\ x bx → bx)
_∘′_ : {A B C : Fam} → Hom B C → Hom A B → Hom A C
_∘′_ (f , φ) (g , γ) = (λ x → f (g x)) , (λ x bx → φ (g x) (γ x bx))
sym′ : ∀ {X Y} → Relation.Binary.Symmetric (_≡Fam_ {X} {Y})
sym′ {Ax , Bx} {Ay , By} {f , φ} {g , γ} (f≡g , φ≡γ) = ≣-sym f≡g , Het.sym φ≡γ
∘-resp-≡′ : {A B C : Fam} {f h : Hom B C} {g i : Hom A B} → f ≡Fam h → g ≡Fam i → (f ∘′ g) ≡Fam (h ∘′ i)
∘-resp-≡′ {f = (f , φ)} {g , γ} {h , η} {i , ι} (f≡g , φ≡γ) (h≡i , η≡ι) =
≣-trans f≡g (≣-cong g h≡i) , Het.trans φ≡γ (Het.cong₂ γ (Het.≡-to-≅ h≡i) η≡ι)
open Category Cat public
Fam : ∀ a b → Category (suc a ⊔ suc b) (a ⊔ b) (a ⊔ b)
Fam a b = Fam.Cat {a} {b}
|
libsrc/_DEVELOPMENT/EXAMPLES/zx/demo_sp1/BlackStar/src/playfx.asm | jpoikela/z88dk | 640 | 172838 | <reponame>jpoikela/z88dk
SECTION code_user
PUBLIC _playfx
_playfx:
; void playfx(unsigned int fx)
; fastcall linkage
; fastcall linkage means
; hl = fx
add hl,hl
ld bc,sfxData
add hl,bc
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
; zsdcc needs ix preserved
push ix
; The Z88DK library contains the
; beepfx sound effects engine so we'll
; just call that.
; asm_bit_beepfx:
; enter : ix = void *effect
; uses : af, bc, de, hl, bc', de', hl', ix
IFDEF __SDCC_IY
; Admittedly this is tricky.
; CLIB=SDCC_IY compiles build the library with IX and IY swapped.
; So although the library function documents IX as the input parameter,
; that has been changed to IY during the library build!
; Technically we also do not have to save IX around this call since
; instead of using IX it's now using IY which is ok with zsdcc.
; But let's keep things as simple as possible since speed here doesn't matter.
push hl
pop iy
ELSE
push hl
pop ix
ENDIF
di
EXTERN asm_bit_beepfx
call asm_bit_beepfx
ei
pop ix
ret
SECTION rodata_user
.sfxData
.SoundEffectsData
defw SoundEffect0Data
defw SoundEffect1Data
defw SoundEffect2Data
defw SoundEffect3Data
defw SoundEffect4Data
.SoundEffect0Data
defb 1 ;tone
defw 4,600,1000,400,128
defb 0
.SoundEffect1Data
defb 2 ;noise
defw 10,100,128
defb 0
.SoundEffect2Data
defb 2 ;noise
defw 10,400,592
defb 0
.SoundEffect3Data
defb 1 ;tone
defw 4,100,16,64,128
defb 0
.SoundEffect4Data
defb 1 ;tone
defw 10,1000,200,16,64
defb 1 ;tone
defw 10,600,200,0,128
defb 0
|
maps/RedsHouse1F.asm | zavytar/pokecolorless | 0 | 24008 | object_const_def ; object_event constants
const REDSHOUSE1F_REDS_MOM
RedsHouse1F_MapScripts:
db 1 ; scene scripts
scene_script .DummyScene
db 0 ; callbacks
.DummyScene:
end
RedsMom:
faceplayer
opentext
writetext RedsMomText1
waitbutton
closetext
end
RedsHouse1FTV:
jumptext RedsHouse1FTVText
RedsHouse1FBookshelf:
jumpstd picturebookshelf
RedsMomText1:
text "Hi, <PLAYER>!"
line "How are you?"
para "If you're looking"
line "for <RIVAL>, he's"
cont "not here right now."
para "He's probably"
line "training his new"
cont "#MON!"
para "…"
para "Sigh… Kids grow"
line "up so fast… It"
cont "said so on TV."
para "Please be careful"
line "and stay out of"
cont "trouble!"
done
RedsHouse1FTVText:
text "It's a movie."
para "Four boys are"
line "walking on"
cont "railroad tracks."
para "I'd better get"
line "a move on, too."
done
RedsHouse1F_MapEvents:
db 0, 0 ; filler
db 3 ; warp events
warp_event 2, 7, PALLET_TOWN, 1
warp_event 3, 7, PALLET_TOWN, 1
warp_event 7, 0, REDS_HOUSE_2F, 1
db 0 ; coord events
db 3 ; bg events
bg_event 0, 1, BGEVENT_READ, RedsHouse1FBookshelf
bg_event 1, 1, BGEVENT_READ, RedsHouse1FBookshelf
bg_event 2, 1, BGEVENT_READ, RedsHouse1FTV
db 1 ; object events
object_event 5, 3, SPRITE_REDS_MOM, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, RedsMom, -1
|
HimemSX.asm | Baron-von-Riedesel/HimemSX | 22 | 84260 |
;--- HimemSX, XMM able to manage up to 1 TB memory.
;--- assembly time parameters
DRIVER_VER equ 300h+52h
VERSIONSTR equ <'3.52'>
INTERFACE_VER equ 350h
lf equ 10
ifndef NUMHANDLES
NUMHANDLES equ 48 ;std 48, default number of handles
endif
MAXHANDLES equ 128 ;std 128, max. number of handles
ALLOWDISABLEA20 equ 1 ;std 1, 1=allow to disable A20
BLOCKSIZE equ 2000h ;std 2000h, block size moved to/from ext. memory (max is 65535!)
USEUNREAL equ 1 ;std 1, 1=use "unreal" mode for EMB copy
PREF66LGDT equ 0 ;std 0, 1=use 66h prefix for LGDT
?LOG equ 0 ;std 0, 1=enable /LOG option
?TESTMEM equ 0 ;std 0, 1=enable /TESTMEM:ON|OFF option
ifndef ?ALTSTRAT
?ALTSTRAT equ 0 ;std 0, 1=use alternate strategy for (re)alloc emb
endif
?MERGE0HDL equ 1 ;std 1, 1=try to merge even if handle to free has size 0
?HINF_MSCOMP equ 1 ;std 1, 1=func. 0Eh (get handle info) MS Himem compatible
?PD110000 equ 0 ;std 0, 1=page dir at 110000h, 0=page dir at end of first i15 block
?ALLOCDX0 equ 1 ;std 1, 1=return DX=0 if alloc fails
ifdef _DEBUG
?CATCHEXC equ 1 ;catch exceptions in protected-mode
else
?CATCHEXC equ 0
endif
?RESTDSESREGS equ 1 ;restore segment registers from unreal mode
?RESTCSREG equ 1 ;restore CS seg after sx pmode - shouldn't be necessary, but apparently is...
if ?RESTDSESREGS or ?CATCHEXC
;--- if DS+ES is to be restored to 64kB before leaving protected-mode,
;--- set page 0-3FFFFFh to RW since GDT is written then [accessed bit] and
;--- CR0 WP bit may be set!
PF_PAGE0 equ 80h + 2 + 1 ;set 4MB page + RW + Present
else
PF_PAGE0 equ 80h + 1 ;set 4MB page + Present
endif
;MAXFREEKB equ 0FBC0h
MAXFREEKB equ 0FFFFh ;std FFFFh, xms v2.0 max ext. memory
;--- constants
CPUID1_PSE36 equ 17
XMS_START equ 1024+64 ; XMS starts at 1088k after HMA
CMD_INIT equ 0 ; init command (used when installed)
;--- DOS device driver status codes used
STATUS_OK equ 0100h ; driver is initialized and ok
STATUS_BAD equ 8103h ; driver couldn't be installed
VDISK_IDSTR equ "VDISK"
VDISK_IDLEN equ 5
VDISK_IDOFS equ 13h
;--- A20 switch methods (must match order in "methods" table)
A20_KBC equ 0
A20_PS2 equ 1
A20_BIOS equ 2
A20_ALWAYSON equ 3
A20_FAST equ 4
A20_PORT92 equ 5
;--- XMS error codes
XMS_NOT_IMPLEMENTED equ 80h
XMS_VDISK_DETECTED equ 81h
XMS_A20_FAILURE equ 82h
XMS_DRIVER_FAILURE equ 8eh
XMS_DRIVER_FATAL equ 8fh
XMS_HMA_NOT_THERE equ 90h
XMS_HMA_IN_USE equ 91h
XMS_HMAREQ_TOO_SMALL equ 92h
XMS_HMA_NOT_USED equ 93h
XMS_A20_STILL_ENABLED equ 94h
XMS_ALL_MEM_ALLOCATED equ 0a0h
XMS_NO_HANDLE_LEFT equ 0a1h
XMS_INVALID_HANDLE equ 0a2h
XMS_INVALID_SOURCE_HANDLE equ 0a3h
XMS_INVALID_SOURCE_OFFSET equ 0a4h
XMS_INVALID_DESTINATION_HANDLE equ 0a5h
XMS_INVALID_DESTINATION_OFFSET equ 0a6h
XMS_INVALID_LENGTH equ 0a7h
XMS_INVALID_OVERLAP equ 0a8h
XMS_PARITY_ERROR equ 0a9h
XMS_BLOCK_NOT_LOCKED equ 0aah
XMS_BLOCK_LOCKED equ 0abh
XMS_LOCK_COUNT_OVERFLOW equ 0ach
XMS_LOCK_FAILED equ 0adh
XMS_ONLY_SMALLER_UMB equ 0b0h
XMS_NO_UMB_AVAILABLE equ 0b1h
XMS_UMB_SEGMENT_NR_INVALID equ 0b2h
option proc:private
option casemap:none
@byte equ <byte ptr>
@word equ <word ptr>
@dword equ <dword ptr>
@DbgOutS macro string
if 0;def _DEBUG
call printstring
db string
db 0
endif
endm
@display macro value
echo value
endm
;--- structures
;--- cpu GDT descriptor
desc struct
limit dw ? ; segment limit
base00_15 dw ? ; low word of base address
base16_23 db ? ; high byte of base address
db ? ; 93h = std ring 0 read/write segment
attr db ? ; attributes, limit 16-19
base24_31 db ?
desc ends
;--- DOS device driver request header
request_hdr struct
req_size db ? ; number of bytes stored
unit_id db ? ; unit ID code
cmd db ? ; command code
status dw ? ; status word
rsvd db 8 dup (?) ; reserved
request_hdr ends
;--- DOS device driver request for INIT
init_strc struct
init_hdr db size request_hdr dup (?)
units db ? ; number of supported units
end_addr dd ? ; end address of resident part
cmd_line dd ? ; address of command line
init_strc ends
;--- XMS_HANDLE is a documented structure, size 10 bytes
XMS_HANDLE struct
xh_flags db ? ; see below
xh_locks db ? ; lock count
xh_baseK dd ? ; base address in kbytes
xh_sizeK dd ? ; size in kbytes
XMS_HANDLE ends
;--- defined values for XMS_HANDLE.flags
XMSF_FREE equ 1 ;describes a free block
XMSF_USED equ 2 ;describes a used block
XMSF_INPOOL equ 4 ;describes a free handle
;--- XMS handle table (documented structure, size 8 bytes)
XMS_HANDLETABLE struct
xht_sig DB ? ; identifier byte?, 1 for MS-DOS HIMEM, 0FDH for us
xht_sizeof DB ? ; size of handle descriptor (xms_handle)
xht_numhandles DW ? ; number of handles
xht_pArray DD ? ; pointer to XMS handles array
XMS_HANDLETABLE ends
;--- structure for XMS AH=0Bh (documented structure)
xms_move struct
len dd ? ; block length in bytes
src_handle dw ? ; source handle
src_offset dd ? ; offset into source
dest_handle dw ? ; destination handle
dest_offset dd ? ; offset into destination
xms_move ends
;--- int 15h, ax=E820h (documented)
SMAP equ 534d4150h
E820MAP struct
baselow dd ?
basehigh dd ?
lenlow dd ?
lenhigh dd ?
type_ dd ?
E820MAP ends
IRETS struct
wIP dw ?
wCS dw ?
bFlags db ?
bFlags2 db ?
IRETS ends
;--- segment definitions
.SEQ ;place segments in the order defined here
_RTEXT segment dword public 'CODE' ; resident code+data
_RTEXT ends
_TEXT segment word public 'CODE' ; nonresident code
_TEXT ends
_DATA segment word public 'DATA' ; nonresident data
_DATA ends
_STACK segment STACK 'STACK' ;1 kB stack
db 1024 dup(?)
_stacktop label byte
_STACK ends
;--- use the TINY model
DGROUP group _RTEXT,_TEXT,_DATA,_STACK
.386P ; 386 instructions + privileged opcodes
;--- nonresident data
_DATA segment
;--- variables
request_ptr DD 0 ; pointer to request header
xms_max DD 4095*1024; value /MAX= parameter
xms_smax DD 1023*4096*1024; value /SUPERMAX= parameter
dwMaxHigh dd -1 ; mask for upper memory address limit
_xms_num_handles DW NUMHANDLES ;value /NUMHANDLES= parameter
_method DB -1 ; value /METHOD: parameter
_startup_verbose DB 00H ; value /VERBOSE parameter
if ?LOG
_xms_logging_enabled DB 00H ; value /LOG parameter
endif
hma_exists db 0
;--- constants
szStartup DB 'HimemSX v', VERSIONSTR, ' [', @CatStr(!"%@Date!"), ']', lf
db 'Portions (c) <NAME> & tom ehlert.', lf, 0
if ?TESTMEM
szTESTMEMOFF DB '/TESTMEM:OFF', 0
endif
szVerbose DB '/V', 0
if ?LOG
szLOG DB '/LOG', 0
endif
szINTERFACE DB 'Interface : XMS v3.5 80686 1TB', lf, 0
szNUMHANDLES DB '/NUMHANDLES=', 0
szSelNumHandles DB 'No of XMS handles: %u', lf, 0
szNumHandlesLim1 DB 'HimemSX: NUMHANDLES must be >= 8, corrected', lf, 0
szNumHandlesLim2 DB 'HimemSX: NUMHANDLES must be <= ',@CatStr(!",%MAXHANDLES,!"),', corrected', lf, 0
szX2MAX32 DB '/X2MAX32', 0
szMETHOD DB '/METHOD:', 0
szMAX DB '/MAX=', 0
szSUPERMAX DB '/SUPERMAX=', 0
szMaximum DB 'Maximum extended memory: %luK', lf, 0
szHMAMIN DB '/HMAMIN=', 0
szMinimum DB 'Minimum HMA that has to be requested: %uK', lf, 0
szHMAMAX DB 'HimemSX: HMAMIN must be <= 63, corrected', lf, 0
szPageDir DB 'Page Directory will be at %lX', lf, 0
szIgnored DB 'Ignored commandline <%s>', lf, 0
;cant_disable_message db 'Can',27h,'t disable A20 - ignored',lf,'$'
dHimem db 'HimemSX: $'
;-- method feedback text
szKBC db "KBC",'$'
szPS2 db "PS/2",'$'
szFast db "Fast",'$'
szBIOS db "BIOS",'$'
szPort92 db "Port 92",'$'
szA20 db " A20 method used",13,lf,'$'
szAlwaysOn db 'Always on','$'
MsgUnknownA20 db 'No Supported A20 method detected',13,lf,'$'
old_dos db 'XMS needs at least DOS version 3.00.$'
xms_twice db 'XMS is already installed.$'
a20_error db 'Unable to switch A20 address line.$'
vdisk_detected db 'VDISK has been detected.$'
no_386 db 'At least a 80386 is required.$'
;xms_sizeerr db 'Unable to determine size of extended memory.$'
xms_toosmall db 'Extended memory is too small or not available.$'
error_msg db ' Driver won''t be installed.',7,13,10,'$'
methods label byte
db 3,"kbc" ;0 (A20_KBC)
db 3,"ps2" ;1 (A20_PS2)
db 4,"bios" ;2
db 8,"alwayson" ;3
db 4,"fast" ;4
db 6,"port92" ;5
db 0
if ?TESTMEM
?TMSTR equ <" /TESTMEM:ON|OFF">
else
?TMSTR equ <" ">
endif
if ?LOG
?LGSTR equ <" /LOG">
else
?LGSTR equ <" ">
endif
szHello label byte
db "Extended memory host for DOS (coordinates the usage of XMS and HMA).", lf
db "HimemSX is a device driver to be loaded in CONFIG.SYS.", lf
db "Place DEVICE=HIMEMSX.EXE [options] before any driver using XMS!", lf, lf
db "Options: /MAX=### /METHOD:xxx /HMAMIN=n /NUMHANDLES=m /V /X2MAX32 /SUPERMAX=###", lf
if ?TESTMEM or ?LOG
db ?TMSTR,?LGSTR, lf
endif
db lf
db " /MAX=### limit memory controlled by XMM to ###K.", lf
db " The HMA is not affected by this value, it's always included.", lf
db " /METHOD:xxx Specifies the method to be used for A20 handling.", lf
db " Possible values for xxx:", lf
db " ALWAYSON Assume that A20 line is permanently ON", lf
db " BIOS Use BIOS to toggle the A20 line", lf
db " FAST Use port 92h, bypass INT 15h test", lf
db " PS2 Use port 92h, bypass PS/2 test", lf
db " KBC Use the keyboard controller", lf
db " PORT92 Use port 92h always", lf
db " /HMAMIN=n Specifies minimum number of Kbs of HMA that a program", lf
db " must request to gain access to the HMA (default: 0Kb).", lf
db " /NUMHANDLES=m Set number of XMS handles (default: 48, min: 8, max: ",@CatStr(!",%MAXHANDLES,!"),").", lf
if ?TESTMEM
db " /TESTMEM:ON|OFF Performs or skips an extended memory test (def: OFF).", lf
endif
db " /SUPERMAX=### limit super-extended memory controlled by XMM to ###K.", lf
db " /V Gives extra information.", lf
db " /X2MAX32 Limit XMS 2.0 free/avail. memory report to 32M-1K.", lf
if ?LOG
db " /LOG Logs the driver activity to the screen.", lf
endif
db 0
_DATA ends
;******************************************************************************
; resident code and data
;******************************************************************************
_RTEXT segment
assume cs:DGROUP, ds:DGROUP
;******************************************************************************
; device driver header
dd -1 ; +0 last driver in list
dw 8000h ; +4 driver flags
dw offset strategy ; +6 pointer to strategy routine
dw offset init_interrupt ; +8 pointer to interrupt handler
db 'XMSXXXX0' ; device driver name
;******************************************************************************
; global data
;--- put some variables before gdt_start (so it is QWORD aligned)
a20_locks dw 0 ; internal A20 lock count
_x2max32 dw MAXFREEKB ; maximum XMS 2.0 free/available 32M
_hma_min dw 0 ; minimal space in HMA
gdt_start label near
gdt32 dw gdt_size-1,gdt_start,0
hma_used db 0 ; set if HMA is used
dummyretf:
retf
data32dsc desc <-1,0,0,92h,0cfh,0> ; 08 32-bit read/write data, 4G
data16dsc desc <-1,0,0,92h, 0h,0> ; 10 16-bit read/write data, 64k
if ?CATCHEXC
code16dsc desc <-1,0,0,9Ah, 0h,0> ; 18 16-bit read/exec code, 64k
code16sel equ 18h
videodsc desc <-1,8000h,0Bh,92h,0h,0>; 20 selector for vga segment B800h
videosel equ 20h
endif
gdt_size equ $ - offset gdt_start
data32sel equ 08h
data16sel equ 10h
xms_highest_addr dd 10FFFFh
xms_handle_table XMS_HANDLETABLE <0fdh, size XMS_HANDLE, 0, 0>
if ?CATCHEXC
gate struct
ofs dw ?
sel dw ?
attrib dw ?
ofs32 dw ?
gate ends
stdidt dw 3FFh,0,0
idt32 dw 19*sizeof gate-1,idt_start,0
idt_start label gate
gate <exc00+00,code16sel,08E00h,0>
gate <exc00+04,code16sel,08E00h,0>
gate <exc00+08,code16sel,08E00h,0>
gate <exc00+12,code16sel,08E00h,0>
gate <exc00+16,code16sel,08E00h,0>
gate <exc00+20,code16sel,08E00h,0>
gate <exc00+24,code16sel,08E00h,0>
gate <exc00+28,code16sel,08E00h,0>
gate <exc00+32,code16sel,08E00h,0>
gate <exc00+36,code16sel,08E00h,0>
gate <exc00+40,code16sel,08E00h,0>
gate <exc00+44,code16sel,08E00h,0>
gate <exc00+48,code16sel,08E00h,0>
gate <exc00+52,code16sel,08E00h,0>
gate <exc00+56,code16sel,08E00h,0>
gate <exc00+60,code16sel,08E00h,0>
gate <exc00+64,code16sel,08E00h,0>
gate <exc00+68,code16sel,08E00h,0>
gate <exc00+72,code16sel,08E00h,0>
EXCNO = 0
exc00 label near
rept 19
push EXCNO
jmp excxx
EXCNO = EXCNO+1
endm
excxx:
pop ax
shld cx,ax,12
and al,0Fh
add al,'0'
and cl,0Fh
add cl,'0'
cmp al,'9'
jbe @F
add al,7
@@:
mov ah,17h
mov ch,17h
shl eax,16
mov ax,cx
push videosel
pop ds
mov dword ptr ds:[0],17581745h
mov dword ptr ds:[4],173D1743h
mov dword ptr ds:[8],eax
jmp $
endif
align 4
;******************************************************************************
;--- A20 get status
; Out: ZF=0 - A20 enabled
; ZF=1 - A20 disabled
test_a20 proc
if 0
push ax
push ds
push es
xor ax,ax
mov ds,ax
dec ax
mov es,ax ; es->FFFF seg
assume es:DGROUP; es is NOT DGROUP, but this makes MASM happy
pushf ; save original flags (IF is important)
cli ; ensure interrupts are off while testing
mov ax,es:[10h] ; read word at FFFF:10h, the 1M limit
not ax ; ~1M word
push @word ds:[0] ; save word we're changing (INT 0 offset)
mov ds:[0],ax ; save ~1M word to 0:0 (and FFFF:10h if A20 disabled)
; mov ax,ds:[0] ; read back, may be unnecessary (forced memory access?)
cmp ax,es:[10h] ; compare 0:0 ~1M word to 1M word, only equal if A20 is disabled
pop @word ds:[0] ; restore INT 0 offset
lahf
popf
sahf
pop es
pop ds
pop ax
else
;--- this might be better: no need to disable interrupts and no memory
;--- is modified. 4 dwords are compared (0000:0010 and FFFF:0020)
push ds
push es
push cx
push si
push di
mov cx,-1
mov es,cx
mov si,10h
inc cx
mov ds,cx
mov di,20h
mov cl,4
repz cmpsd
pop di
pop si
pop cx
pop es
pop ds
endif
ret
test_a20 endp
;******************************************************************************
; enables the A20 address line
; currently dummy/always on, code replaced as A20 tests indicate
; all registers AND flags preserved!
enable_a20 proc
push ax
mov ah,2
jmp disable_enable_a20
enable_a20 endp
disable_a20 proc
push ax
mov ah,0
disable_a20 endp ;fall through
disable_enable_a20 proc ;patch area
;--- the default is the ALWAYSON "method", which is just a dummy
pop ax
ret
; since this is replaceable, we need to bulk up the space allocated for it
; for larger replacement routines
DB 42-2 DUP (?)
size_disable_enable_a20 equ $ - disable_enable_a20
disable_enable_a20 endp
;******************************************************************************
; Interrupt handlers
;******************************************************************************
;******************************************************************************
; new INT15h handler
;
; this externally preserves A20 state on function 87h
;
int15_handler proc
cmp ah,87h
je do_move
cmp ah,88h ; is it a ext. mem size req.?
je ext_mem_size
cmp ax,0E820h ; memory map?
je memmap
db 0EAh
old_int15 dd 0 ; old INT 15h vector
ext_mem_size:
xor ax,ax ; no memory available
exit_set_reset_carry:
push bp
mov bp,sp
rcr [bp+2].IRETS.bFlags,1
rol [bp+2].IRETS.bFlags,1
pop bp
exit_iret:
iret
do_move:
pushf
call test_a20
jz isdisabled
call cs:[old_int15]
call enable_a20 ; preserves flags
jmp exit_set_reset_carry
isdisabled:
call cs:[old_int15]
call disable_a20 ; preserves flags
jmp exit_set_reset_carry
memmap:
pushf
call cs:[old_int15]
jc exit_set_reset_carry
cmp eax,SMAP
jnz exit_iret
cmp es:[di].E820MAP.basehigh,0
jz exit_set_reset_carry
cmp es:[di].E820MAP.type_,1 ;"available" memory?
clc
jnz exit_set_reset_carry
mov byte ptr es:[di].E820MAP.type_,2 ;change to "reserved"
jmp exit_set_reset_carry
int15_handler endp
;******************************************************************************
; new INT2Fh handler. Catches Func. 4300h+4310h
int2f_handler proc
pushf
cmp ah,43h
je @@maybe_my2f
@@jmp_old2f:
popf
db 0EAh
old_int2f dd 0 ; old INT 2fh vector
@@maybe_my2f:
cmp al,00h ; is it "Installation Check"?
je @@get_driver_installed
cmp al,10h ; is it "Get Driver Address"?
je @@get_xms_address
cmp al,09h ; is it "get handle table"?
je @@get_xms_handle_table
cmp al,08h ; is it "get A20 handler number"?
jne @@jmp_old2f
mov al,ah ;al==43h if function supported
machine_type label byte
mov bx,0002 ;bh=switch time; 0=medium, 1=fast, 2=slow
popf ;bl=machine type; 01=std AT (KBC), 02=PS/2 (port 92)
iret
@@get_driver_installed:
mov al,80h ; yes, we are installed ;)
popf
iret
@@get_xms_address:
mov bx,offset xms_dispatcher
@@shared2f:
push cs
pop es
popf
iret
@@get_xms_handle_table:
mov al,ah ;al==43h if function supported
mov bx,offset xms_handle_table
jmp @@shared2f
int2f_handler endp
;******************************************************************************
; XMS functions
;******************************************************************************
; returns XMS version number
; In: AH=0
; Out: AX=XMS version number
; BX=internal revision number
; DX=1 if HMA exists, 0 if not
xms_get_version proc
mov ax,INTERFACE_VER
mov bx,DRIVER_VER
mov dx,1 ; HMA is always available
ret
xms_get_version endp
;******************************************************************************
; requests HMA
; In: AH=1
; DX=space needed in HMA (0ffffh if application tries to request HMA)
; Out: AX=1 if successful, BL=0 (MS Himem compatible)
; AX=0 if not successful
; BL=80h -> function not implemented (implemented here ;) )
; BL=81h -> VDISK is detected
; BL=90h -> HMA does not exist
; BL=91h -> HMA already in use
; BL=92h -> DX less than HMA_MIN
xms_request_hma proc
xor ax,ax
cmp [hma_used],al ; is HMA already used?
mov bl,XMS_HMA_IN_USE
jnz @@exit
cmp dx,[_hma_min] ; is request big enough?
mov bl,XMS_HMAREQ_TOO_SMALL
jb @@exit
inc ax
mov [hma_used],al ; assign HMA to caller
mov bl,0
@@exit:
ret
xms_request_hma endp
;******************************************************************************
; releases HMA
; In: AH=2
; Out: AX=1 if successful, BL=0 (MS Himem compatible)
; AX=0 if not successful
; BL=80h -> function not implemented
; BL=81h -> VDISK is detected
; BL=90h -> HMA doesn't exist
; BL=93h -> HMA wasn't allocated
xms_release_hma proc
xor ax,ax
cmp [hma_used],al ; is HMA used?
mov bl,XMS_HMA_NOT_USED
jz @@exit
mov [hma_used],al ; now release it
inc ax
mov bl,0
@@exit:
ret
xms_release_hma endp
;******************************************************************************
; global A20 address line enable
; In: AH=3
; Out: AX=1 if successful
; AX=0 if not successful
; BL=80h -> function is not implemented
; BL=81h -> VDISK is detected
; BL=82h -> A20 failure
xms_global_enable_a20 proc
call enable_a20 ; enable A20
call test_a20 ; is it really enabled?
jz error_A20_failure
xms_global_enable_a20 endp ; fall throu
xms_success:
mov ax,1
mov bl,0
ret
;******************************************************************************
; global A20 address line disable
; In: AH=4
; Out: AX=1 if successful (A20 is disabled)
; AX=0 if not successful
; BL=80h -> function is not implemented
; BL=81h -> VDISK is detected
; BL=82h -> A20 failure
; BL=94h -> A20 still enabled
xms_global_disable_a20 proc
IF ALLOWDISABLEA20
if 1
cmp [a20_locks],0
jnz error_A20_still_enabled
endif
call disable_a20 ; disable A20
call test_a20 ; is it really disabled?
jz xms_success
endif
error_A20_still_enabled::
xor ax,ax
mov bl,XMS_A20_STILL_ENABLED
ret
xms_global_disable_a20 endp
error_A20_failure:
xor ax,ax
mov bl,XMS_A20_FAILURE
ret
;******************************************************************************
; enables A20 locally
; In: AH=5
; Out: AX=1 if A20 is enabled, 0 otherwise
; BL=80h -> function not implemented
; BL=81h -> VDISK is detected
; BL=82h -> A20 failure
xms_local_enable_a20 proc
cmp [a20_locks],1
inc [a20_locks] ; increase lock counter
jc xms_global_enable_a20
jmp xms_success
xms_local_enable_a20 endp
;******************************************************************************
; disables A20 locally
; In: AH=6
; Out: AX=1 if A20 is disabled, 0 otherwise
; BL=80h -> function not implemented
; BL=81h -> VDISK is detected
; BL=82h -> A20 failure
; BL=94h -> A20 still enabled
xms_local_disable_a20 proc
cmp [a20_locks],0
jz error_A20_failure
dec [a20_locks] ; decrease lock counter
jnz error_A20_still_enabled
jmp xms_global_disable_a20
xms_local_disable_a20 endp
;******************************************************************************
; returns the state of A20
; In: AH=7
; Out: AX=1 if A20 is physically enabled, AX=0 if not
; BL=00h -> function was successful
; BL=80h -> function is not implemented
; BL=81h -> VDISK is detected
xms_query_a20 proc
xor ax,ax ; suppose A20 is disabled
call test_a20
setnz al
mov bl,0
ret
xms_query_a20 endp
;******************************************************************************
; alloc a XMS memory handle
; In: DS=CS
; Out: CY=1 - no free handle
; CY=0 - free handle found
; BX - offset of free handle
xms_alloc_handle proc
mov cx,[xms_handle_table.xht_numhandles] ; check all handles
mov bx, @word [xms_handle_table.xht_pArray]
@@nexthandle:
cmp [bx].XMS_HANDLE.xh_flags,XMSF_INPOOL
jz @@found_handle ; found a blank handle
add bx,sizeof XMS_HANDLE ; skip to next handle
loop @@nexthandle
stc ; no free block found, error
@@found_handle:
ret
xms_alloc_handle endp
;******************************************************************************
; xms_check_handle
; In: DS=CS
; SI - handle to check
;
; Out: CY=1 - no valid handle
; BL=0a2h - XMS_INVALID_HANDLE
; AX=0 - usual error return
;
; CY=0 - no error
;
; registers destroyed - AX
;
;-- called by
;-- xms_free_emb
;-- xms_move_emb
;-- xms_lock_emb
;-- xms_unlock_emb
;-- xms_ext_get_handle_info
;-- xms_ext_realloc_emb
xms_check_handle_ex:
mov si,dx
xms_check_handle proc
push dx
mov ax,si
sub ax, @word [xms_handle_table.xht_pArray]
jb @@no_valid_handle
xor dx,dx
push bx
mov bx,sizeof XMS_HANDLE
div bx
pop bx
or dx,dx
jnz @@no_valid_handle
cmp ax,[xms_handle_table.xht_numhandles] ; less then last handle ??
jae @@no_valid_handle
cmp [si].XMS_HANDLE.xh_flags,XMSF_USED ; is it in use ??
jne @@no_valid_handle
pop dx
xor ax,ax
ret
@@no_valid_handle:
pop dx
pop ax ;skip return address
xor ax,ax
mov bl,XMS_INVALID_HANDLE
stc
ret
xms_check_handle endp
;******************************************************************************
; query free super-extended memory
; In: AH=C8h
; Out: EAX=size of largest free super-extended block in kbytes
; EDX=total amount of free super-extended block in kbytes
; BL=0 if ok
; BL=080h -> function not implemented
; BL=081h -> VDISK is detected
; BL=0a0h -> all super-extended memory is allocated
xms_sext_query_free_mem proc
xor eax,eax ; contains largest free block
xor edx,edx ; contains total free block
push bx
pushf
cli
mov cx,[xms_handle_table.xht_numhandles]
mov bx, @word [xms_handle_table.xht_pArray]
nextitem:
test [bx].XMS_HANDLE.xh_flags,XMSF_FREE ; check if flagged free or in use
je @F
;--- filter blocks below 4 GB
;--- 00000000-003fffffh
test word ptr [bx].XMS_HANDLE.xh_baseK+2, 0ffc0h
jz @F
mov esi, [bx].XMS_HANDLE.xh_sizeK
add edx, esi
cmp esi, eax ; check if larger than largest
jbe @F
mov eax,esi ; larger, update
@@:
add bx,sizeof XMS_HANDLE
loop nextitem
popf ; restore IF
pop bx
mov bl,0
and edx,edx
jnz @@freeblockexists
mov bl,XMS_ALL_MEM_ALLOCATED
@@freeblockexists:
ret ; success
xms_sext_query_free_mem endp
;******************************************************************************
; query free extended memory
; In: AH=88h
; Out: EAX=size of largest free XMS block in kbytes
; ECX=highest ending address of any memory block
; EDX=total amount of free XMS in kbytes
; BL=0 if ok
; BL=080h -> function not implemented
; BL=081h -> VDISK is detected
; BL=0a0h -> all XMS is allocated
xms_ext_query_free_mem proc
xor eax,eax ; contains largest free block
xor edx,edx ; contains total free XMS
push bx
pushf
cli
mov cx,[xms_handle_table.xht_numhandles]
mov bx, @word [xms_handle_table.xht_pArray]
nextitem:
test [bx].XMS_HANDLE.xh_flags,XMSF_FREE ; check if flagged free or in use
je @F
;--- filter blocks beyond 4 GB
;--- 00000000-003fffffh
test word ptr [bx].XMS_HANDLE.xh_baseK+2, 0ffc0h
jnz @F
mov esi, [bx].XMS_HANDLE.xh_sizeK
add edx, esi
cmp esi, eax ; check if larger than largest
jbe @F
mov eax,esi ; larger, update
@@:
add bx,sizeof XMS_HANDLE
loop nextitem
popf ; restore IF
pop bx
mov bl,0
and edx,edx
jnz @@freeblockexists
mov bl,XMS_ALL_MEM_ALLOCATED
@@freeblockexists:
mov ecx,[xms_highest_addr] ; highest address to ecx return value
ret ; success
xms_ext_query_free_mem endp
;******************************************************************************
; returns free XMS
; In: AH=8
; Out: AX=size of largest free XMS block in kbytes
; DX=total amount of free XMS in kbytes
; BL=0 if ok
; BL=0a0h -> all XMS is allocated
xms_query_free_mem proc
; protect high parts
push eax
pop ax
push ecx
push edx
pop dx
call xms_ext_query_free_mem
; returns:
; EAX=size of largest free XMS block in kbytes
; ECX=highest ending address of any memory block (not used)
; EDX=total amount of free XMS in kbytes
movzx ecx, [_x2max32]
cmp edx,ecx ; dx = min(edx,0ffff | 7fff)
jb @@edx_not_larger
mov dx,cx
@@edx_not_larger:
cmp eax,ecx ; ax = min(eax,0ffff | 7fff)
jb @@eax_not_larger
mov ax,cx
@@eax_not_larger:
; restore high parts
push dx
pop edx
pop ecx
push ax
pop eax
ret
xms_query_free_mem endp
;******************************************************************************
; allocates an XMS block
; In: AH=9
; DX=amount of XMS being requested in kbytes
; Out: AX=1 if successful
; DX=handle
; AX=0 if not successful
; BL=080h -> function not implemented
; BL=081h -> VDISK is detected
; BL=0a0h -> all XMS is allocated
; BL=0a1h -> no free handles left
xms_alloc_emb proc
@DbgOutS <"xms_alloc_emb",13,10>
push edx
movzx edx,dx ; extend alloc request to 32-bits
jmp @@xms_alloc2
; 32-bit entry for function 89h, just uses full edx value
xms_ext_alloc_emb:: ;<--- entry, ah=11h
xms_sext_alloc_emb::;<--- entry, ah=15h
@DbgOutS <"xms_ext_alloc_emb",13,10>
push edx
@@xms_alloc2:
push cx
pushf
cli
if 0; v3.35 check for size 0 after scan!
and edx,edx ; a request for 0 kB might still work
jz @@nullhandle
endif
mov cx,[xms_handle_table.xht_numhandles] ; check all handles
mov di, @word [xms_handle_table.xht_pArray]
@@nexthandle:
cmp [di].XMS_HANDLE.xh_flags,XMSF_FREE
jnz @@skipitem
;--- filter blocks
cmp ah,15h ;15h is xms_sext_alloc_emb #
jnz @F
test word ptr [di].XMS_HANDLE.xh_baseK+2,0FFC0h
jnz sext_mem
jmp @@skipitem
@@:
test word ptr [di].XMS_HANDLE.xh_baseK+2,0FFC0h
jnz @@skipitem
sext_mem:
cmp edx,[di].XMS_HANDLE.xh_sizeK ; check if it's large enough
jbe @@found_block
@@skipitem:
add di,sizeof XMS_HANDLE ; skip to next handle
loop @@nexthandle
if 1; v3.35 check for size 0
and edx,edx ; a request for 0 kB might still work
jz @@nullhandle
endif
mov bl,XMS_ALL_MEM_ALLOCATED
@@alloc_failed:
popf
pop cx
pop edx
if ?ALLOCDX0
xor dx,dx ;return DX=0 if alloc fails
endif
xor ax,ax
ret
@@nullhandle:
push bx
call xms_alloc_handle ; get a free handle in BX
mov di,bx
pop bx
mov bl,XMS_NO_HANDLE_LEFT
jc @@alloc_failed
xor ax,ax ; set ZF to skip code below
@@found_block:
mov @word [di].XMS_HANDLE.xh_flags,XMSF_USED ;clear locks field, too
jz @@perfect_fit2 ; if it fits perfectly, go on
push bx
call xms_alloc_handle ; get a free handle in BX
jc @@perfect_fit ; no more handles, use all mem left
ife ?ALTSTRAT
mov esi,[di].XMS_HANDLE.xh_sizeK
mov [di].XMS_HANDLE.xh_sizeK,edx
sub esi,edx ; calculate resting memory
add edx,[di].XMS_HANDLE.xh_baseK; calc new base address of free block
mov @word [bx].XMS_HANDLE.xh_flags,XMSF_FREE
mov [bx].XMS_HANDLE.xh_baseK,edx; set new base of free block
mov [bx].XMS_HANDLE.xh_sizeK,esi; set remaining size of free block
else
;--- alternate strategie: return the new allocated handle,
;--- the found handle stays free
mov [di].XMS_HANDLE.xh_flags,XMSF_FREE
mov esi,[di].XMS_HANDLE.xh_baseK
add [di].XMS_HANDLE.xh_baseK,edx
sub [di].XMS_HANDLE.xh_sizeK,edx
mov [bx].XMS_HANDLE.xh_baseK,esi
mov [bx].XMS_HANDLE.xh_sizeK,edx
mov @word [bx].XMS_HANDLE.xh_flags,XMSF_USED ;clear locks field, too
mov di,bx
endif
@@perfect_fit:
pop bx
@@perfect_fit2:
popf
pop cx
pop edx
mov dx,di ; return handle in DX
mov bl,0
mov ax,1
ret
xms_alloc_emb endp
;******************************************************************************
; frees an XMS block
; In: AH=0ah
; DX=handle to allocated block that should be freed
; Out: AX=1 if successful
; AX=0 if not successful
; BL=080h -> function not implemented
; BL=081h -> VDISK is detected
; BL=0a2h -> handle is invalid
; BL=0abh -> handle is locked
xms_free_emb proc
call xms_check_handle_ex ; check if dx holds a "used" handle
mov bl,XMS_BLOCK_LOCKED
cmp [si].XMS_HANDLE.xh_locks,0 ; is the block locked?
jnz @@exit
push eax
push bx
push cx
push edx
pushf
cli
;--- see if there are blocks to merge
mov eax,[si].XMS_HANDLE.xh_baseK ; get base address
mov edx,[si].XMS_HANDLE.xh_sizeK
mov edi, eax ; base in edi
add eax, edx ; end-address in eax
ife ?MERGE0HDL
mov cl, XMSF_FREE
and edx, edx
jnz @F
mov cl, XMSF_INPOOL
@@:
mov [si].XMS_HANDLE.xh_flags,cl
jz @@done
endif
;--- now scan the handle array for successor/predecessor
mov cx,[xms_handle_table.xht_numhandles]
mov bx,@word [xms_handle_table.xht_pArray]
@@nextitem:
cmp [bx].XMS_HANDLE.xh_flags,XMSF_FREE
jnz @@skipitem
mov edx,[bx].XMS_HANDLE.xh_baseK
cmp eax, edx ; is successor free?
je @F
add edx,[bx].XMS_HANDLE.xh_sizeK
cmp edi, edx ; is predecessor free?
jne @@skipitem
@@:
;--- predecessor/successor in BX
cmp bx,si
jbe @F
xchg bx,si ;merge into the "lower" handle and free the "higher" handle
@@:
xor edx, edx
xchg edx, [si].XMS_HANDLE.xh_sizeK
add [bx].XMS_HANDLE.xh_sizeK, edx ;new size is sum of both handle sizes
xor edx, edx
xchg edx, [si].XMS_HANDLE.xh_baseK
cmp edx, [bx].XMS_HANDLE.xh_baseK
ja @F
mov [bx].XMS_HANDLE.xh_baseK, edx ;new base is min(hdl1.base,hdl2.base)
@@:
mov [si].XMS_HANDLE.xh_flags,XMSF_INPOOL
mov si,bx
@@skipitem:
add bx,sizeof XMS_HANDLE
loop @@nextitem
if ?MERGE0HDL
mov cl, XMSF_FREE
cmp [si].XMS_HANDLE.xh_sizeK,0
jnz @F
mov cl, XMSF_INPOOL
@@:
mov [si].XMS_HANDLE.xh_flags,cl
endif
@@done:
popf
pop edx
pop cx
pop bx
pop eax
inc ax
mov bl,0
@@exit:
ret
xms_free_emb endp
;******************************************************************************
; calculates the move address
; In: SI - handle (0 if EDX should be interpreted as seg:ofs value)
; EDX - offset
; ECX - length
; Out: EAX - move address in kB
; Modifies: EDX, SI
xms_get_move_addr proc
or si,si ; translate address in EDX?
jnz @@is_emb
; its segment:offset in EDX
; eax = 16*(edx high) + dx
movzx eax,dx ; save offset
mov dh,0
shr edx,12 ; convert segment to absolute address
add eax,edx ; add offset
mov edx,eax ; check that eax(address) + ecx (length) is <= 10fff0
add edx,ecx
jc @@wrong_size ; negative length might wrap
cmp edx,10fff0h
ja @@wrong_size
clc
ret
@@is_emb: ; it's a handle:offset pair
call xms_check_handle ;check if si holds a "used" handle
push bx
xor bx,bx
mov eax,ecx ; contains length
add eax,edx ; assert length + offset < size
adc bx,bx
add eax,1024-1 ; round up to kB
adc bx,0
shrd eax,ebx,10 ; convert to kB units
pop bx
cmp eax,[si].XMS_HANDLE.xh_sizeK ; compare with max offset
ja @@wrong_size
mov eax,[si].XMS_HANDLE.xh_baseK ; get block base address
mov esi,eax ; store in source index
shl eax,10 ; convert from kb to linear
shr esi,22
add eax,edx ; add offset into block
adc si,0
ret
@@wrong_size:
mov bl,XMS_INVALID_LENGTH
xor ax,ax
stc
ret
xms_get_move_addr endp
;******************************************************************************
; moves an EMB
; In: AH=0bh
; ES:SI=pointer to XMS move structure (DS is DGROUP)
; Out: AX=1 if successful
; AX=0 if not successful
; BL=080h -> function not implemented
; BL=081h -> VDISK is detected
; BL=082h -> A20 failure
; BL=0a3h -> source handle is invalid
; BL=0a4h -> source offset is invalid
; BL=0a5h -> destination handle is invalid
; BL=0a6h -> destination offset is invalid
; BL=0a7h -> length is invalid
; BL=0a8h -> move has invalid overlap
; BL=0a9h -> parity error
xms_move_emb proc
@DbgOutS <"xms_move_emb enter",13,10>
IF ALLOWDISABLEA20
call test_a20 ; get A20 state
jnz @@was_enabled
call enable_a20 ; now enable it! - if it was disabled
push offset disable_a20 ; and make sure it is disabled on exit
@@was_enabled:
endif
xor ax,ax ; default to error
push ecx
push edx
push eax
push bp
push bx
mov ecx,es:[si].xms_move.len ; get length
test cl,1 ; is it even?
jnz @@move_invalid_length
push si
mov edx,es:[si].xms_move.dest_offset
mov si,es:[si].xms_move.dest_handle
call xms_get_move_addr ; get move address
mov dx,si ;save lines 32-39 in DX, since BL must be preserved
pop si
jc @@copy_dest_is_wrong
mov bx,dx
mov edi,eax ; store in destination index
mov edx,es:[si].xms_move.src_offset
mov si,es:[si].xms_move.src_handle
call xms_get_move_addr ; get move address
jc @@copy_source_is_wrong
xchg eax,esi
mov bh,al
;**************************************************
; setup finished with
; BH.ESI = source A00-A39
; BL.EDI = destination A00-A39
; ECX = number of words to move
;**************************************************
or ecx,ecx ; nothing to do ??
jz @@xms_exit_copy
mov bp,offset rmcopysx ; switch to pm with paging
and bx,bx
jnz @F
mov bp,offset rmcopy ; both blocks < 4GB, no PSE-36 paging needed
@@:
; overlap test. start of destination block (BL.EDI)
; must either be <= start of source block (BH.ESI)
; or >= start of source block + block length (BH.ESI+ECX)
; 1. check if BL.EDI <= BH.ESI
cmp bl,bh
jb @@move_ok_to_start
ja @F
cmp edi,esi
jbe @@move_ok_to_start
@@:
; calculate source + block length: DL.EAX = BH.ESI + ECX
mov dl,bh
mov eax, esi
add eax, ecx
adc dl,0
; 2. check if BL.EDI >= DL.EAX
cmp bl,dl
ja @@move_ok_to_start
jb @@move_invalid_overlap
cmp edi,eax
jb @@move_invalid_overlap
@@move_ok_to_start:
SMSW AX ; don't use priviledged "mov eax,cr0"!
test al,1 ; are we already in PM?
jz @F
; cmp bx,0
; jnz @@copy_invalid_handle
mov bp,offset pmcopy ; yes, use INT 15h, ah=87h
push ss ; set ES for int 15h, ah=87h call
pop es
@@:
mov edx,ecx
@@copy_loop:
mov ecx,edx
cmp ecx,BLOCKSIZE
; jle @F ; 27.10.2020 don't do signed comparisons!
jbe @F
mov ecx,BLOCKSIZE
@@:
sub edx,ecx
push edx
call bp
pop edx
jc @@move_a20_failure
and edx, edx
jnz @@copy_loop
@@xms_exit_copy:
pop bx
pop bp
pop eax
pop edx
pop ecx
inc ax ; success
ret
@@move_invalid_overlap:
mov bl,XMS_INVALID_OVERLAP
jmp @@xms_exit_copy_failure
@@move_invalid_length:
mov bl,XMS_INVALID_LENGTH
jmp @@xms_exit_copy_failure
@@copy_source_is_wrong:
cmp bl,XMS_INVALID_LENGTH
je @@xms_exit_copy_failure
mov bl,XMS_INVALID_SOURCE_HANDLE
jmp @@xms_exit_copy_failure
@@copy_dest_is_wrong:
cmp bl,XMS_INVALID_LENGTH
je @@xms_exit_copy_failure
mov bl,XMS_INVALID_DESTINATION_HANDLE
jmp @@xms_exit_copy_failure
@@copy_invalid_handle:
mov bl,XMS_INVALID_HANDLE
jmp @@xms_exit_copy_failure
@@move_a20_failure:
mov bl,XMS_A20_FAILURE
; common error exit routine
@@xms_exit_copy_failure:
pop ax
pop bp
mov bh,ah ; restore BH only, preserve BL
pop eax
pop edx
pop ecx
ret
;------------------------------------------------------------
; "real-mode" copy proc
; ESI = src linear adress
; EDI = dst linear adress
; ECX = length (hiword cleared)
; 2 strategies are implemented. The first does the move in protected-mode,
; the latter activates "unreal" mode and does the move there.
; After the last transfer "unreal" mode is exited. Interrupts occuring
; during the "interrupt window" will run in "unreal" mode as well, but
; this shouldn't hurt.
rmcopy:
ife USEUNREAL
pushf
cli ; no interrupts when doing protected mode
if PREF66LGDT
db 66h ; load full 32bit base
endif
lgdt fword ptr cs:[gdt32]; load GDTR (use CS prefix here)
mov eax,cr0
inc ax ; set PE bit
mov cr0,eax
jmp @F ; setting CS to a protected-mode selector is not required
@@:
mov dx,data32sel
mov ds,dx
mov es,dx
shr cx,2 ; get number of DWORDS to move
rep movs @dword [edi],[esi]
adc cx,cx
rep movs @word [edi],[esi] ; move a trailing WORD
mov dx,data16sel ; restore selector attributes to 64 kB
mov ds,dx
mov es,dx
dec ax ; clear PE bit
mov cr0,eax
popf
clc
ret
else
if 0
pushf
cli ; no interrupts during the block move
pushf
mov dx,data32sel ; activate "unreal" mode. This has to be done
call set_ureal ; every time since the mode might have been
xor dx,dx ; exited by an interrupt routine.
mov ds,dx
mov es,dx
shr cx,2 ; get number of DWORDS to move
rep movs @dword [edi],[esi]
adc cx,cx
rep movs @word [edi],[esi] ; move a trailing WORD
popf
jnz @F
call reset_ureal
@@:
popf
ret
reset_ureal:
mov dx,data16sel
set_ureal:
if PREF66LGDT
db 66h ; load full 32bit base
endif
lgdt fword ptr cs:[gdt32]; load GDTR (use CS prefix here)
mov eax,cr0
inc ax ; set PE bit
mov cr0,eax
;--- the 80386 needs a "flush" after switching to PM
;--- before a segment register can be set!
jmp @F
@@:
dec ax ; clear PE bit
mov ds,dx
mov es,dx
mov cr0,eax
ret
else
;--- set int 0dh, then just start to copy.
;--- if int 0dh is called, an exception occured, since IRQs are disabled.
;--- then set unreal mode inside int 0dh code.
pushf
push cs
push offset myint0d
xor dx,dx
pop eax
shr ecx,2 ; get number of DWORDS to move
mov ds,dx
mov es,dx
cli
xchg eax,ds:[13*4]
rep movs @dword [edi],[esi]
adc cx,cx
rep movs @word [edi],[esi] ; move a trailing WORD
mov ds:[13*4],eax ; restore int 0dh
popf
ret
myint0d:
push ds
push es
push eax
lgdt fword ptr cs:[gdt32]; load GDTR (use CS prefix here)
mov eax,cr0
inc ax ; set PE bit
mov cr0,eax
; jmp @F
;@@:
mov dx,data32sel
dec ax ; clear PE bit
mov ds,dx
mov es,dx
mov cr0,eax
pop eax
pop es
pop ds
iret
endif
endif
;------------------------------------------------------------------------
; cpu is in v86-mode, use int15, ah=87 to copy things around
; ESI = src linear adress
; EDI = dst linear adress
; ECX = length (hiword cleared)
; int 15h, ah=87h expects:
; CX = number of WORDS to copy
; ES:SI -> GDT
; GDT: entry 0 = 0
; entry 1 = 0
; entry 2 = src
; entry 3 = dst
; entry 4 = used internally
; entry 5 = used internally
pmcopy:
sub sp,2*8 ;room for entries 4+5
shld eax,edi,16 ;push dst descriptor
mov dl,al
mov dh,093h
mov al,0
push ax
push dx
push di
push cx
shld eax,esi,16 ;push src descriptor
mov dl,al
mov al,0
push ax
push dx
push si
push cx
xor eax,eax ;push entries 0+1
push eax
push eax
push eax
push eax
;--- update BH.ESI and BL.EDI
mov ax,bx
add edi,ecx ; buff += copied length
adc al,0
add esi,ecx
adc ah,0
push si
lea si,[esp+2]
push ax
shr cx,1 ; convert to words
;--- is super-extended memory involved?
and bx,bx
jz @F
;--- then the extended Int15h, ah=87h API must be set
;--- CX = F00Fh
;--- HiWord(ECX) = size in words
;--- Hiword(EAX) = F00Fh
;--- DX = src bits 32-47
;--- BX = dst bits 32-47
;--- ES:SI -> GDT similar as in standard Int 15, ah=87h
shl ecx,16
mov cx,0F00Fh
mov ax,cx
shl eax,16
movzx dx,bh
movzx bx,bl
@@:
clc
mov ah,87h
int 15h
pop bx
pop si
lea sp,[esp+6*8];don't modify flags!
ret
;--- copy in pm with 32-bit paging and 4 MB pages
;--- EDI: bits 0-31 of destination
;--- ESI: bits 0-31 of source
;--- BL: bits 32-39 of destination
;--- BH: bits 32-39 of source
;--- ECX: bytes to copy
if ?PD110000
PageDir equ 110000h
endif
DSTBASE equ 400000h*1
SRCBASE equ 400000h*3
rmcopysx::
pushf
push cx
push esi
push edi
cli ; no interrupts when doing protected mode
lgdt fword ptr cs:[gdt32]; load GDTR (use CS prefix here)
if ?CATCHEXC
lidt fword ptr cs:[idt32]
endif
.586p
mov eax,cr4
or al,10h ;enable PSE
mov cr4,eax
.386p
mov eax,cr0
mov dx,data32sel
inc ax ;set PE bit
mov cr0,eax
mov ds,dx
mov es,dx
if ?PD110000
mov edx,PageDir
bts eax,31
mov dword ptr [edx+0],PF_PAGE0
mov cr3,edx
mov cr0,eax
else
mov edx,0
PageDir equ dword ptr $-4
mov cr3,edx
mov dword ptr [edx+0],PF_PAGE0
endif
;--- 4 MB page directory entries:
;--- bit 7: 1=4MB page
;--- bit 12: PAT
;--- bit 13-20: addressbits 32-39
;--- bit 21: 0
;--- bit 22-31: addressbits 22-31
;--- .3.........2.........1.........0
;--- 10987654321098765432109876543210
;--- xxxxxxxxxx?????????????????????? bits 22-31 in edi
;--- ?????????????xxxxxxxxxx????????? shld eax,edi,19
;--- ?????????????xxxxxxxxxx?xxxxxxxx mov al,bl
;--- ?????????????xxxxxxxxxx0xxxxxxxx and ah,0feh
;--- xxxxxxxxxx0xxxxxxxx0000000000000 shl eax,13
shld eax,edi,19
mov al,bl
and ah,0feh
shl eax,13
and edi,3fffffh
mov al,83h ;dst 4MB page, writable, present
add edi,DSTBASE
mov [edx+4],eax
add eax,1 shl 22
jnc @F ;4 GB boundary crossed?
add eax,1 shl 13
@@:
mov [edx+8],eax
shld eax,esi,19
mov al,bh
and ah,0feh
shl eax,13
and esi,3fffffh
mov al,81h ;src 4MB page, present
add esi,SRCBASE
mov [edx+12],eax
add eax,1 shl 22
jnc @F ;4 GB boundary crossed?
add eax,1 shl 13
@@:
mov [edx+16],eax
ife ?PD110000
mov eax,cr0
bts eax,31
mov cr0,eax
endif
shr cx,2 ; get number of DWORDS to move
rep movs @dword [edi],[esi]
adc cx,cx
rep movs @word [edi],[esi] ; move a trailing WORD
if ?RESTDSESREGS
mov dx,data16sel ; restore selector attributes to 64 kB
mov ds,dx
mov es,dx
endif
mov eax,cr0
and eax,7ffffffeh
mov cr0,eax
if ?RESTCSREG
db 0eah ;jmp far16 opcode
dw offset @F
RmCS dw 0
@@:
endif
if ?CATCHEXC
lidt fword ptr cs:[stdidt]
endif
pop edi
pop esi
pop cx
add edi,ecx
adc bl,0
add esi,ecx
adc bh,0
popf
clc
ret
xms_move_emb endp
;******************************************************************************
; locks an EMB
; In: AH=0ch
; DX=XMS handle to be locked
; Out: AX=1 if block is locked
; DX:BX=32-bit linear address of block
; AX=0 if not successful
; BL=080h -> function not implemented
; BL=081h -> VDISK is detected
; BL=0a2h -> handle is invalid
; BL=0ach -> lock count overflow
; BL=0adh -> lock fails
xms_lock_emb proc
@DbgOutS <"xms_lock_emb enter",13,10>
call xms_check_handle_ex ; check if dx holds "used" handle
test [si].XMS_HANDLE.xh_baseK+2,0FFC0h ;beyond 4GB?
mov bl,XMS_LOCK_FAILED
jnz _ret
inc [si].XMS_HANDLE.xh_locks ; increase lock counter
jz @@lock_error
mov esi,[si].XMS_HANDLE.xh_baseK
shl esi,10 ; calculate linear address
push esi
pop bx
pop dx
inc ax
_ret:
ret
@@lock_error::
dec [si].XMS_HANDLE.xh_locks
mov bl,XMS_LOCK_COUNT_OVERFLOW
ret
xms_lock_emb endp
;******************************************************************************
; locks a (super-extended) MB
; In: AH=0cch
; DX=XMS handle to be locked
; Out: AX=1 if block is locked
; EDX:EBX=64-bit linear address of block
; AX=0 if not successful
; BL=080h -> function not implemented
; BL=081h -> VDISK is detected
; BL=0a2h -> handle is invalid
; BL=0ach -> lock count overflow
; BL=0adh -> lock fails
xms_sext_lock_emb proc
@DbgOutS <"xms_sext_lock_emb enter",13,10>
call xms_check_handle_ex ; check if dx holds "used" handle
inc [si].XMS_HANDLE.xh_locks; increase lock counter
jz @@lock_error
mov ebx,[si].XMS_HANDLE.xh_baseK
mov edx,ebx
shl ebx,10 ; calculate linear address 0-31
shr edx,22 ; calculate linear address 32-41
inc ax
ret
xms_sext_lock_emb endp
;******************************************************************************
; unlocks an EMB
; In: AH=0dh
; DX=XMS handle to unlock
; Out: AX=1 if block is unlocked
; AX=0 if not successful
; BL=080h -> function not implemented
; BL=081h -> VDISK is detected
; BL=0a2h -> handle is invalid
; BL=0aah -> block is not locked
xms_unlock_emb proc
@DbgOutS <"xms_unlock_emb enter",13,10>
call xms_check_handle_ex ; check if dx holds "used" handle
cmp [si].XMS_HANDLE.xh_locks,al; check if block is locked
jz @F
dec [si].XMS_HANDLE.xh_locks ; decrease lock counter
inc ax
mov bl,0
ret
@@:
mov bl,XMS_BLOCK_NOT_LOCKED
ret
xms_unlock_emb endp
;******************************************************************************
; get XMS handle information
; In: AH=8eh
; DX=XMS handle
; Out: AX=1 if successful
; BH=block's lock count
; CX=number of free XMS handles
; EDX=block's length in kbytes
xms_ext_get_handle_info proc
@DbgOutS <"xms_ext_get_handle_info enter",13,10>
call xms_check_handle_ex; check handle validity (dx== "used" handle?)
xor cx,cx ; reset free handle counter
mov dx,[xms_handle_table.xht_numhandles]
mov di,@word [xms_handle_table.xht_pArray] ;use DI here, not BX
@@nextitem:
cmp [di].XMS_HANDLE.xh_flags,XMSF_INPOOL
setz al
add cx,ax
add di,sizeof XMS_HANDLE
dec dx
jnz @@nextitem
mov bh,[si].XMS_HANDLE.xh_locks ; store lock count
mov edx,[si].XMS_HANDLE.xh_sizeK ; store block size
; mov bl,0 ;set BL on exit?
mov al,1
ret
xms_ext_get_handle_info endp
;********************************************************************
; returns XMS handle information
; In: AH=0eh
; DX=XMS handle
; Out: AX=1 if successful
; BH=block's lock count
; BL=number of free XMS handles
; DX=block's length in kbytes
; AX=0 if not successful
; BL=080h -> function not implemented
; BL=081h -> VDISK is detected
; BL=0a2h -> handle is invalid
xms_get_handle_info proc
push cx
push edx
pop dx
@DbgOutS <"xms_get_handle_info enter",13,10>
call xms_ext_get_handle_info
or ax,ax
jz @@get_handle_info_err
cmp ch,0 ; bl = min(cx,0xff)
jz @F
mov cl,0ffh
@@:
mov bl,cl
;--- MS Himem: if size > 0xffff, return error BL=A2h
if ?HINF_MSCOMP
cmp edx,010000h ; dx must be <= 0xffff
jc @F
mov bl,XMS_INVALID_HANDLE
dec ax
jmp @@get_handle_info_err
else
cmp edx,010000h ; dx = min(edx,0xffff);
jb @F
mov dx,0ffffh
endif
@@:
@@get_handle_info_err:
push dx
pop edx
pop cx
ret
xms_get_handle_info endp
;******************************************************************************
; reallocates an EMB. shrinking and growing supported
; In: AH=8fh
; EBX=new size for the EMB in kbytes
; DX=unlocked XMS handle
; Out: AX=1 if successful
; AX=0 if not successful
; BL=080h -> function not implemented
; BL=081h -> VDISK is detected
; BL=0a0h -> all XMS is allocated
; BL=0a1h -> all handles are in use
; BL=0a2h -> invalid handle
; BL=0abh -> block is locked
xms_ext_realloc_emb proc
@DbgOutS <"xms_ext_realloc_emb enter",13,10>
call xms_check_handle_ex ; dx == "used" handle?
push edx
; fail if block is locked
cmp [si].XMS_HANDLE.xh_locks,0
jne @@ext_xms_locked
mov edx, ebx
if 1;v3.35
mov cx,[xms_handle_table.xht_numhandles]
mov di,@word [xms_handle_table.xht_pArray]
mov eax,[si].XMS_HANDLE.xh_sizeK
add eax,[si].XMS_HANDLE.xh_baseK
nextitem:
test [di].XMS_HANDLE.xh_flags,XMSF_FREE ;scan "free embs" only
jz skipitem
cmp eax,[di].XMS_HANDLE.xh_baseK ;successor?
jnz skipitem
mov eax,[si].XMS_HANDLE.xh_sizeK
add eax,[di].XMS_HANDLE.xh_sizeK ;get the total size
cmp edx,eax ;new size > total size?
ja @@ext_growing ;then the handle can't grow, have to copy...
sub edx,[si].XMS_HANDLE.xh_sizeK ;get the size which is additionally needed (might be < 0!)
mov [si].XMS_HANDLE.xh_sizeK, ebx
add [di].XMS_HANDLE.xh_baseK, edx
sub [di].XMS_HANDLE.xh_sizeK, edx
jnz @@ext_grow_success ;remaining size > 0?
mov [di].XMS_HANDLE.xh_flags, XMSF_INPOOL ;no, so free the handle
mov [di].XMS_HANDLE.xh_baseK, 0
jmp @@ext_grow_success
skipitem:
add di,sizeof XMS_HANDLE
loop nextitem
endif
cmp ebx,[si].XMS_HANDLE.xh_sizeK
jbe @@ext_shrink_it
@@ext_growing:
; growing, try to allocate a new block
mov ah,11h ;11h is xms_ext_alloc_emb #
test word ptr [si].XMS_HANDLE.xh_baseK+2, 0FFC0h
jz @F
mov ah,15h ;15h is for super-extended memory
@@:
call xms_ext_alloc_emb ;get a new handle in DX, size EDX
and ax,ax
jz @@ext_failed
; got new block, copy info from old block to new block
pop si ; get old handle
push si
; transfer old handle data to new location
xor edi,edi
push edi ; dst.offset
push dx ; dst.handle
push edi ; src.offset
push si ; src.handle
mov edi,[si].XMS_HANDLE.xh_sizeK
shl edi,10 ; K to byte
push edi ; length
mov si,sp
push ss
pop es ; es:si -> xms_move
call xms_move_emb
add sp, sizeof xms_move
push cs ; xms_move_emb eats critical ds value
pop ds
pop si
push si
; swap handle data so handle pointers remain valid
; handle data is 10 bytes long
mov di,dx
pushf
cli ;exchange must be atomic
mov edx,[si+0]
xchg edx,[di+0]
mov [si+0],edx
mov edx,[si+4]
mov ax,[si+8]
xchg edx,[di+4]
xchg ax,[di+8]
mov [si+4],edx
mov [si+8],ax
popf
mov dx,di
; free newly allocated handle in DX with old handle data in it
call xms_free_emb
jmp @@ext_grow_success
@@ext_no_xms_handles_left:
pop bx
popf
mov bl,XMS_NO_HANDLE_LEFT
jmp @@ext_failed
@@ext_xms_locked:
mov bl,XMS_BLOCK_LOCKED
@@ext_failed:
pop edx
xor ax,ax
ret
@@ext_shrink_it:
mov edi,[si].XMS_HANDLE.xh_sizeK ; get old size
sub edi,edx ; calculate what's left over
jz @@ext_dont_need_handle ; jump if we don't need another handle
if 0; v3.36: don't modify si handle data until the new handle has been allocated
mov [si].XMS_HANDLE.xh_sizeK, edx
add edx,[si].XMS_HANDLE.xh_baseK ; calculate new base address
endif
pushf
cli
push bx
call xms_alloc_handle ; alloc a handle in BX, size EDI
jc @@ext_no_xms_handles_left ; return if there's an error
if 1; v3.36: don't modify si handle data until the new handle has been allocated
mov [si].XMS_HANDLE.xh_sizeK, edx
add edx,[si].XMS_HANDLE.xh_baseK ; calculate new base address
endif
mov [bx].XMS_HANDLE.xh_baseK, edx
mov [bx].XMS_HANDLE.xh_sizeK, edi
if 1;v3.35
;--- if this branch is active, there's surely NO free successor
;--- so we don't need to merge.
mov [bx].XMS_HANDLE.xh_flags,XMSF_FREE
pop bx
popf
else
mov @word [bx].XMS_HANDLE.xh_flags,XMSF_USED
mov dx,bx ; and FREE it again -
pop bx
popf
call xms_free_emb ; to merge it with free block list
endif
@@ext_dont_need_handle:
@@ext_grow_success:
pop edx
mov ax,1
mov bl,0
ret
xms_ext_realloc_emb endp
;******************************************************************************
; reallocates an EMB. shrinking and growing supported
; In: AH=0fh
; BX=new size for the EMB in kbytes
; DX=unlocked XMS handle
;
xms_realloc_emb proc
@DbgOutS <"xms_realloc_emb enter",13,10>
push ebx ; protect high part of ebx
pop bx
movzx ebx,bx ; clear top 16 bit
call xms_ext_realloc_emb
push bx ; recover top 16 bit of ebx
pop ebx
ret
xms_realloc_emb endp
;******************************************************************************
; requests an UMB block
; In: AH=10h
; DX=size of requested memory block in paragraphs
; Out: AX=1 if successful
; BX=segment number of UMB
; DX=actual size of the allocated block in paragraphs
; AX=0 if not successful
; DX=size of largest available UMB in paragraphs
; BL=080h -> function not implemented
; BL=0b0h -> only a smaller UMB are available
; BL=0b1h -> no UMBs are available
;******************************************************************************
; releases an UMB block
; In: AH=11h
; DX=segment of UMB
; Out: AX=1 if successful
; AX=0 if not successful
; BL=080h -> function not implemented
; BL=0b2h -> UMB segment number is invalid
;******************************************************************************
; reallocates an UMB
; In: AH=12h
; BX=new size for UMB in paragraphs
; DX=segment of UMB to reallocate
; Out: AX=1 if successful
; AX=0 if not successful
; BL=080h -> function not implemented
; BL=0b0h -> no UMB large enough to satisfy request
; DX=size of largest UMB in paragraphs
; BL=0b2h -> UMB segment is invalid
;xms_realloc_umb:
;xms_request_umb:
;xms_release_umb:
; xor ax,ax
; mov bl,XMS_NOT_IMPLEMENTED
; ret;return_failure
;******************************************************************************
; XMS dispatcher
;******************************************************************************
; XMS dispatcher
; In: AH - function number
; Out: AX=0 -> function not supported
; else see appr. routine
align 2
xms_table label word
dw xms_get_version ;0
dw xms_request_hma ;1
dw xms_release_hma ;2
dw xms_global_enable_a20 ;3
dw xms_global_disable_a20 ;4
dw xms_local_enable_a20 ;5
dw xms_local_disable_a20 ;6
dw xms_query_a20 ;7
dw xms_query_free_mem ;8
dw xms_alloc_emb ;9
dw xms_free_emb ;0A
dw xms_move_emb ;0B
dw xms_lock_emb ;0C
dw xms_unlock_emb ;0D
dw xms_get_handle_info ;0E
dw xms_realloc_emb ;0F
dw xms_ext_query_free_mem ; 88 10
dw xms_ext_alloc_emb ; 89 11
dw xms_ext_get_handle_info ; 8e 12
dw xms_ext_realloc_emb ; 8f 13
dw xms_sext_query_free_mem ; C8 14
dw xms_sext_alloc_emb ; C9 15
dw xms_sext_lock_emb ; CC 16
xms_dispatcher proc
jmp short @F
nop
nop ; 3 nops, guarantee hookability
nop
@@:
if ?LOG
dispatcher_log_entry label byte
call log_entry ; this might get patched
endif
pushf
cmp ah,0fh ; 00-0F?
jbe @@ok1
mov al,ah
shr al,1
cmp al,88h/2 ; 88-89?
jz @@ok2
cmp al,8Eh/2 ; 8E-8F?
jz @@ok3
cmp al,0C8h/2 ; C8-C9?
jz @@ok4
cmp ah,0CCh ; CC?
jz @@ok5
xor ax,ax ; everything else fails
mov bl,XMS_NOT_IMPLEMENTED
jmp @@dispatcher_end
@@ok5:
sub ah,2 ; CC -> CA
@@ok4:
sub ah,0C8h-14h ; C8-CA -> 14-16
jmp @@ok1
@@ok3:
sub ah,4 ; 8E-8F -> 8A-8B
@@ok2:
sub ah, 88h-10h ; 88-8B -> 10-13
;
;real dispatcher
;
; save ds,es,esi,edi
; set es = USERds
; set ds = DGROUP
@@ok1:
cld
push ds ; protect registers
push es
push esi ; might get used 32 bit wide
push edi ;
push ds ; set up segment registers for internal use
pop es
push cs
pop ds
movzx di,ah ; is nowhere used as input
shl di,1
call [xms_table+di] ; call the handler here
pop edi ; restore saved registers
pop esi
pop es
pop ds
; @DbgOutS <"xms exit",13,10>
@@dispatcher_end:
popf
if ?LOG
dispatcher_log_exit label byte
call log_exit ; this might get patched
endif
retf
xms_dispatcher endp
?PRINTSTR = 0
ifdef _DEBUG
?PRINTSTR = 1
endif
?PRINTSTR = ?PRINTSTR + ?LOG
if ?PRINTSTR
;*******************************************
; printing routines
;
; usage:
; call printstring
; db 'hello world'
;
; printdh,printdx - what the name implies
;
;*******************************************
printstring proc
pusha
mov bp,sp
ifdef _DEBUG
pushf
endif
mov si,[bp+16]
cld
@@nextitem:
lods @byte cs:[si]
cmp al, 0 ; end of string?
je @@done
mov ah,0Eh
mov bx,0007h
int 10h
jmp @@nextitem
@@done:
mov [bp+16],si
ifdef _DEBUG
popf
endif
popa
ret
printstring endp
endif
if 0
printdx proc
call printdh
ror dx,8
printdh:
call printnibble
printnibble:
ror dh,4
mov al,dh
and al,0Fh
cmp al,10
sbb al,69H
das
int 29h
ret
printdx endp
endif
if ?LOG
;*** returns NZ, if we shall log NOW
;*** this will LOG stuff to screen only, if
;*** SCROLL_LOCK is locked
lognow proc
push ds
push 40h
pop ds
test @byte ds:[17h],10h
pop ds
ret
lognow endp
log_entry proc
pushf
call lognow
jz @F
call printstring
db 'XMS enter:',0
@@:
popf
ret
log_entry endp
log_exit proc
pushf
call lognow
jz @F
call printstring
db ' XMS leave',13,10,0
@@:
popf
ret
log_exit endp
endif
;******************************************************************************
; mark for the trace log mode driver end. above has to be the resident part,
align 4
trace_driver_end:
_RTEXT ends
_TEXT segment
startoftext label byte
;******************************************************************************
; checks if VDISK is already installed
; note: HMA check is skipped because of speed and some other (weird) reasons.
; In: nothing
; Out: ZF=0 -> VDISK is installed
; ZF=1 -> VDISK not installed
;
; tom:it's absolute unclear, if [13] or [12] should be checked.
; HIMEM verifies [13], so we do that as well.
; goto HELL, dear VDISK
; verify only 4 bytes, should do as well
;
_install_check_vdisk proc
push bx
push ds
xor bx,bx ; get interrupt vector 19h
mov ds,bx
lds bx,ds:[19h*4]
cmp @dword [bx],053494456h; 'VDIS'
pop ds
pop bx
ret
_install_check_vdisk endp
; checks if CPU is a 386
; In: nothing
; Out: CY=0 - processor is a 386 or higher
; CY=1 - processor lower than 386
check_cpu proc
pushf
mov ah,70h
push ax
popf
pushf
pop ax
popf
and ah,0F0h
cmp ah,70h ;Z=386 ok
ret
check_cpu endp
if 0
; checks if A20 can be enabled and disabled
; Out: CF=0 - A20 switching works
; CF=1 - A20 failure
check_a20 proc
call enable_a20
call test_a20 ; TEST_A20 should return ZF=0
jz a20failed
IF ALLOWDISABLEA20
call disable_a20
call test_a20 ; TEST_A20 should return ZF=1
jz a20_ok
; we can't disable A20.
; so what ?
; these guys are crazy anyway,
; and we (nearly) ignore that
mov dx,offset cant_disable_message
call dispmsg
a20_ok:
ENDIF
clc
ret
a20failed:
stc
ret
check_a20 endp
endif
;--- there are 3 A20 switch procs:
;--- 1. KBC (port 64h/60h)
;--- 2. fast, ps2, port92 (port 92h)
;--- 3. BIOS (int 15h, ax=240xh)
; try turning A20 on or off from current to see if it works
; KBC HIMEM method
; entry: ah == 0 A20 turn off, ah == 2 turn on, ax on stack
;
disable_enable_a20_KBC proc
push cx
pushf
cli ; shut off interrupts while we twiddle
call Sync8042 ; check keyboard controller ready
mov al,0D1h ; Send D1h
out 64h,al
call Sync8042
mov al,0ddh ; or df=dd+2
or al,ah ; disable/enable A20 command (DDh/DFh)
out 60h,al
call Sync8042
; wait up to 20 microseconds for A20 line to settle
mov al,0FFh ; pulse output port NULL
out 64h,al
call Sync8042
popf
pop cx
pop ax
ret
Sync8042:
xor cx,cx
@@InSync:
in al,64h
and al,2
loopnz @@InSync
ret
size_disable_enable_a20_KBC equ $ - disable_enable_a20_KBC
disable_enable_a20_KBC endp
; the so-called 'fast' A20 method replacement code
; entry: ah == 0 A20 turn off, ah == 2 turn on, ax on stack
;
disable_enable_a20_fast proc
pushf
in al,92h
or ah,ah
jne @@deaf_on ; turning on A20
test al,2
je @@deaf_done ; already flagged off, don't do it again, might upset something
and al,NOT 2 ; set A20 bit off
jmp @@deaf_out
; ah == 2
@@deaf_on:
test al,ah
jne @@deaf_done ; already flagged on
or al,ah ; set A20 bit on
@@deaf_out:
out 92h,al
; wait until it gets on or off, possibly superfluous, code opinion differs
push cx
xor cx,cx
@@deaf_wait:
in al,92h
and al,2
cmp al,ah
loopne @@deaf_wait
pop cx
@@deaf_done:
popf
pop ax
ret
size_disable_enable_a20_fast equ $ - disable_enable_a20_fast
disable_enable_a20_fast endp
; BIOS A20 method
; entry: ah == 0 A20 turn off, ah == 2 turn on, ax on stack
; don't check for errors, assume BIOS works more than once on same call,
; if it doesn't, not much we can do about it anyway
;
disable_enable_a20_BIOS:
pushf
sub sp,10 ; give buggy BIOS some stack to chew on without causing problems
; one word might suffice, but let's be really safe
cli
shr ah,1 ; ah to 0 or 1
mov al,24h
xchg ah,al ; ax == 2400h to turn off, 2401h to turn on
int 15h
add sp,10 ; restore potentially gnawed-on stack
popf
pop ax
ret
size_disable_enable_a20_BIOS equ $ - disable_enable_a20_BIOS
;--- copy the enable/disable code to disable_enable_a20
flag_kbc:
mov @byte [machine_type+1],1 ;set machine to 1 (AT), which is KBC
mov dx,offset szKBC
mov si,offset disable_enable_a20_KBC
mov cx,size_disable_enable_a20_KBC
jmp xxx_success
flag_bios:
mov dx,offset szBIOS
mov si,offset disable_enable_a20_BIOS
mov cx,size_disable_enable_a20_BIOS
jmp xxx_success
flag_port92:
mov dx,offset szPort92
jmp fast_success
flag_ps2:
mov dx,offset szPS2
jmp fast_success
flag_fast:
mov dx,offset szFast
fast_success:
mov si, offset disable_enable_a20_fast
mov cx, size_disable_enable_a20_fast
xxx_success:
push si
push cx
mov ah,9
int 21h
mov dx,offset szA20
mov ah,9
int 21h
pop cx
pop si
push di
push es
push cs
pop es
mov di, offset disable_enable_a20
rep movsb
pop es
pop di
clc ; flag success
ret
; check if BIOS flags port 92h fast method supported
detect_fast proc
stc
mov ax,2403h
int 15h
jc @@fail_test
or ah,ah
jne @@fail_test
test bl,2 ;PS/2 supported?
je @@fail_test
mov si,offset disable_enable_a20_fast
call detect_and_handle_test
ret
@@fail_test:
stc ; flag failure
ret
detect_fast endp
; check if BIOS flags PS/2 present, to try port 92h fast method used by PS/2's
; shares enable/disable code with fast
detect_PS2 proc
mov ah,0c0h ; get system description vector
stc
int 15h
jc @@fail_test ; not a PS/2
; test feature information byte 1, micro channel implemented bit
test @byte es:[bx+5],2
jz @@fail_test ; not micro channel
mov si,offset disable_enable_a20_fast
call detect_and_handle_test
ret
@@fail_test:
stc ; flag failure
ret
detect_PS2 endp
; check if port 92h fast method supported without BIOS or PS/2 test
; shares enable/disable code with fast and PS/2
detect_port92 proc
mov si,offset disable_enable_a20_fast
call detect_and_handle_test
ret
detect_port92 endp
detect_BIOS proc
stc ; preset carry flag
mov ax,2402h ; get gate status
int 15h
jc @@fail_test
or ah,ah
jne @@fail_test
mov cl,al ; save status
mov si,offset disable_enable_a20_BIOS
call detect_and_handle_test
ret
@@fail_test:
stc ; flag failure
ret
detect_BIOS endp
detect_KBC proc
mov si,offset disable_enable_a20_KBC
call detect_and_handle_test
ret
detect_KBC endp
; upon entry si->disable/enable routine for a20 method being tested
; return carry set if failed, reset if success
;
detect_and_handle_test proc
call test_a20
setnz cl
jz @@dah_2 ; A20 disabled on entry
push offset @@dah_2
push ax
mov ah,0
jmp si ; try to disable A20
@@dah_2:
call test_a20
jnz @@dah_fail ; A20 not disabled
; try to enable A20 (always disabled at this point)
push offset @@dah_3
push ax
mov ah,2
jmp si
@@dah_3:
call test_a20
jz @@dah_fail ; A20 not enabled
or cl,cl
jne @@dah_success ; A20 was enabled on entry, done
push offset @@dah_4 ; disable to entry state
push ax
mov ah,0
jmp si
@@dah_4:
call test_a20
jnz @@dah_fail ; A20 not disabled
@@dah_success:
clc
ret
@@dah_fail:
stc
ret
detect_and_handle_test endp
;--- end of A20 code
; reserve size of routine checks
if size_disable_enable_a20_fast gt size_disable_enable_a20
.err <disable_enable_a20_fast too long, increase buffer! >
endif
if size_disable_enable_a20_BIOS gt size_disable_enable_a20
.err <disable_enable_a20_BIOS too long, increase buffer! >
endif
if size_disable_enable_a20_KBC gt size_disable_enable_a20
.err <disable_enable_a20_KBC too long, increase buffer! >
endif
;--- set the a20 enable/disable code in the resident part
;--- out: NC if ok, C on errors
seta20method proc
; process forced methods
mov al,[_method]
cmp al,A20_ALWAYSON
je @@is_alwayson
cmp al,A20_BIOS
je @@is_bios
cmp al,A20_FAST
je @@is_fast
cmp al,A20_PS2
je @@is_ps2
cmp al,A20_KBC
je @@is_kbc
cmp al,A20_PORT92
je @@is_port92
; check if the A20 line is on, if so assume it's always on
call test_a20
jz @@check_A20_method ; not on, try other methods
; use A20 always on code (dummy enable/disable A20 routine)
@@is_alwayson:
mov dx,offset szAlwaysOn
mov ah,9
int 21h
mov dx,offset szA20
mov ah,9
int 21h
jmp @@got_type
@@check_A20_method:
call detect_fast; see if port 92h (2403h BIOS call) handler supported
jnc @@is_fast
call detect_PS2 ; see if port 92h (PS/2 signature) handler supported
jnc @@is_ps2
call detect_KBC ; see if KBC handler supported
jnc @@is_kbc
; try BIOS here, demoted from first in line because unreliable BIOS
; versions of A20 control exist
call detect_BIOS ; see if BIOS A20 handler supported
jnc @@is_bios
; see if fast port 92h handler supported without BIOS or PS/2 signature
; leave this test until last because messing with port 92h is
; reported to crash some machines which don't support that method
call detect_port92
jnc @@is_port92
; out of options to try, return error
mov dx,offset MsgUnknownA20
call dispmsg
stc
ret
@@is_bios:
call flag_bios
jmp @@got_type
@@is_fast:
call flag_fast
jmp @@got_type
@@is_ps2:
call flag_ps2
jmp @@got_type
@@is_kbc:
call flag_kbc
jmp @@got_type
@@is_port92:
call flag_port92
@@got_type:
clc
ret
seta20method endp
;******************************************************************************
; strategy routine. is called by DOS to initialize the driver once.
; only thing to be done here is to store the address of the device driver
; request block.
; In: ES:BX - address of request header
; Out: nothing
strategy proc far
mov @word cs:[request_ptr+0],bx ; store offset addr
mov @word cs:[request_ptr+2],es ; store segment addr
ret ; far return here!
strategy endp
printf proto c :ptr, :vararg
print_char proc
pop cx
pop dx
push cx
cmp dl,10
jnz @@isnotlf
mov dl,13
mov ah,2
int 21h
mov dl,10
@@isnotlf:
mov ah,2
int 21h
ret
print_char endp
;--- get the A20 method ("/METHOD:xxx")
GetA20Method proc stdcall uses si di pszMethod:ptr
mov si,pszMethod
mov di,offset methods
xor bx,bx
push ds
pop es
cld
@@nextitem:
mov cl,[di]
mov ch,0
jcxz @@notfound
inc di
pusha
@@nextchar:
lodsb
or al,20h
scasb
loopz @@nextchar
popa
jz @@found
add di,cx
inc bx
jmp @@nextitem
@@notfound:
or bx,-1
jmp @@done
@@found:
mov di,si
add si,cx
@@nextchar2:
lodsb
stosb
and al,al
jnz @@nextchar2
@@done:
mov ax,bx
ret
GetA20Method endp
;--- convert long to string
;--- SS may be != DS here!
;--- assume psz is a string defined on stack!
ltob proc stdcall uses edi num:dword, psz:ptr, base:word
mov ch,0
movzx edi,base
mov eax,num
cmp di,-10
jne @@ispositive
mov di,10
and eax,eax
jns @@ispositive
neg eax
mov ch,'-'
@@ispositive:
mov bx,psz
add bx,10
mov @byte ss:[bx],0
dec bx
@@nextdigit:
xor edx, edx
div edi
add dl,'0'
cmp dl,'9'
jbe @@isdigit
add dl,7+20h
@@isdigit:
mov ss:[bx],dl
dec bx
and eax, eax
jne @@nextdigit
cmp ch,0
je @@nosign
mov ss:[bx],ch
dec bx
@@nosign:
inc bx
mov ax,bx
ret
ltob endp
;--- assume SS!=DS
printf proc c uses si di fmt:ptr, args:vararg
local flag:byte
local longarg:byte
local size_:word
local fill:word
local szTmp[12]:byte
lea di,args
nextfcharX:
mov si,fmt
nextfchar:
lodsb
or al,al
je done
cmp al,'%'
je isfspec
push ax
call print_char
jmp nextfchar
done:
xor ax,ax
ret
isfspec:
push nextfcharX
xor dx,dx
mov longarg,dl
mov bl,1
mov cl,' '
cmp @byte [si],'-'
jne @F
dec bx
inc si
@@:
mov flag,bl
cmp @byte [si],'0'
jne @F
mov cl,'0'
inc si
@@:
mov fill,cx
mov bx,dx
.while byte ptr [si] >= '0' && byte ptr [si] <= '9'
lodsb
sub al,'0'
cbw
imul bx,bx,10
add bx,ax
.endw
mov size_,bx
cmp @byte [si],'l'
jne @F
mov longarg,1
inc si
@@:
lodsb
mov fmt,si
cmp al,'x'
je print_x
cmp al,'X'
je print_x
cmp al,'c'
je print_c
cmp al,'d'
je print_d
cmp al,'i'
je print_i
cmp al,'s'
je print_s
cmp al,'u'
je print_u
and al,al
jnz @F
pop ax
jmp done
print_c:
mov ax,ss:[di]
add di,2
@@:
push ax
call print_char
retn
print_x:
mov bx,16
jmp print_number
print_d:
print_i:
mov bx,-10
jmp print_number
print_u:
mov bx,10
print_number:
cmp longarg,0
je @F
mov eax,ss:[di]
add di,4
jmp print_long
@@:
movzx eax,@word ss:[di]
add di,2
cmp bx,0
jge @F
movsx eax,ax
@@:
print_long:
lea cx,szTmp
invoke ltob, eax, cx, bx
mov si,ax
push ds
push ss
pop ds
call print_string
pop ds
retn
print_s:
mov si,ss:[di]
add di,2
print_string:
mov ax,si
mov bx,size_
.while byte ptr [si]
inc si
.endw
sub si,ax
xchg ax,si
sub bx,ax
.if flag == 1
.while sword ptr bx > 0
push fill
call print_char
dec bx
.endw
.endif
.while byte ptr [si]
lodsb
push ax
call print_char
.endw
.while sword ptr bx > 0
push fill
call print_char
dec bx
.endw
retn
printf endp
;--- skip "white space" characters
_skipWhite proc
nextitem:
cmp @byte [si],' '
je @F
cmp @byte [si],9
jne done
@@:
inc si
jmp nextitem
done:
ret
_skipWhite endp
;--- int _cdecl _memicmp(char * psz1, char * psz2, int len);
;--- must preserve BX!
_memicmp proc c uses si di psz1:word, psz2:word, len:word
mov cx,len
mov si,psz2
mov di,psz1
cld
@@nextitem:
lodsb
mov ah,[di]
inc di
or al,20h
or ah,20h
sub al,ah
loopz @@nextitem
cbw
ret
_memicmp endp
;--- toupper() returns uppercase character
_toupper proc
cmp al,'a'
jb @F
cmp al,'z'
ja @F
sub al,20h
@@:
ret
_toupper endp
;--- convert a string into a DWORD, returned in EAX
;--- also accept suffix G, M, K and adjust value then
GetValue proc stdcall uses esi di commandline:word, base:word, usesuffix:word
xor esi, esi ;result
mov bx,commandline
nextchar:
mov al,@byte [bx]
cmp al,'0'
jb @F
cmp al,'9'
ja @F
sub al,'0'
jmp @@I318
@@:
call _toupper
cmp al,'A'
jl @@FB316
sub al,55 ;'A' -> 10
@@I318:
movzx ecx, @word [base]
cmp cl,al
jle @@FB316
xchg eax,esi
mul ecx
xchg eax,esi
movzx eax,al
add esi,eax
inc bx
jmp nextchar
@@FB316:
cmp @byte [usesuffix],0
je @@I322
mov al,[bx]
call _toupper
cmp al,'M'
je is_mega
cmp al,'G' ;'G'
je is_giga
cmp al,'K'
je is_kilo ;'K'
jmp @@I322
is_giga:
shl esi,10
is_mega:
shl esi,10
is_kilo:
mov @byte [bx],' '
@@I322:
push esi
mov si,bx
mov di,commandline
push ds
pop es
@@nextchar:
lodsb
stosb
and al,al
jnz @@nextchar
pop eax
ret
GetValue endp
;--- char * _stdcall FindCommand(char * pszSearchString)
;--- parses the command line for a specific command.
;--- If found, the command is removed and
;--- the address behind that command is returned. Else, 0 is returned
;--- SI -> commandline
FindCommand proc stdcall uses di si pszCmd:ptr
mov di,pszCmd
mov bx,di
.while byte ptr [di]
inc di
.endw
sub di,bx
xchg bx,di ;string len to BX
nextitem:
cmp @byte [si],0
je notfound
invoke _memicmp, si, di, bx
or ax,ax
je itemfound
inc si
jmp nextitem
itemfound: ;item has been found, now remove it from cmdline
push si
mov di,si
add si,bx
push ds
pop es
@@:
lodsb
stosb
and al,al
jnz @B
pop ax
jmp done
notfound:
xor ax,ax
done:
ret
FindCommand endp
;--- ParseCmdLine()
;--- si -> cmdline
ParseCmdLine proc
@DbgOutS <"ParseCmdLine enter",13,10>
invoke printf, offset szStartup
if ?TESTMEM
;--- /TESTMEM:OFF option
invoke FindCommand, offset szTESTMEMOFF
or ax,ax
jne @F
;--- do something useful here!
@@:
endif
;--- /V option
invoke FindCommand, offset szVerbose
or ax,ax
je @F
mov _startup_verbose,1
@@:
if ?LOG
;--- /LOG option
invoke FindCommand, offset szLOG
or ax,ax
je @F
mov _xms_logging_enabled,1
@@:
endif
cmp _startup_verbose,0
je @F
invoke printf,offset szINTERFACE
@@:
;--- /NUMHANDLES=xx option
;--- ensure value xx is within limits
invoke FindCommand, offset szNUMHANDLES
or ax,ax
je nonumhandles
invoke GetValue, ax, 10, 0
mov _xms_num_handles,ax
cmp _startup_verbose,0
je @F
invoke printf,offset szSelNumHandles,ax
@@:
cmp _xms_num_handles,8
jae @F
invoke printf,offset szNumHandlesLim1
mov _xms_num_handles,8
@@:
cmp _xms_num_handles,MAXHANDLES
jbe @F
invoke printf,offset szNumHandlesLim2
mov _xms_num_handles,MAXHANDLES
@@:
nonumhandles:
;--- /X2MAX32 and options
invoke FindCommand, offset szX2MAX32
or ax,ax
je @F
mov _x2max32,32767 ;7fffH
@@:
;--- /METHOD:xx option
invoke FindCommand, offset szMETHOD
or ax,ax
je nomethod
invoke GetA20Method, ax
mov _method,al
nomethod:
;--- /MAX=xx option
invoke FindCommand, offset szMAX
or ax,ax
je nomax
invoke GetValue, ax, 10, 1
mov [xms_max],eax
cmp _startup_verbose,0
je nomax
invoke printf,offset szMaximum, eax
nomax:
;--- /SUPERMAX=xx option
invoke FindCommand, offset szSUPERMAX
or ax,ax
je nosmax
invoke GetValue, ax, 10, 1
mov [xms_smax],eax
nosmax:
;--- /HMAMIN=xx option
invoke FindCommand, offset szHMAMIN
or ax,ax
je nohmamin
invoke GetValue, ax, 10, 1
mov _hma_min,ax
cmp _startup_verbose,0
je @F
invoke printf,offset szMinimum,ax
@@:
cmp _hma_min,63
jbe @F
invoke printf,offset szHMAMAX
mov _hma_min,63
@@:
shl _hma_min,10
nohmamin:
call _skipWhite
cmp @byte [si],0
je @F
invoke printf,offset szIgnored, si
@@:
@DbgOutS <"ParseCmdLine exit",13,10>
xor ax,ax
ret
ParseCmdLine endp
;******************************************************************************
; initializes the driver. called only once!
; may modify DI
; In: DS:DI - pointer to init structure
; Out: DS = DGROUP
DoCommandline proc
mov ax,ss
mov dx,sp
push cs
pop ss
mov sp,offset _stacktop
pusha
push es
lds si,[di].init_strc.cmd_line
@@:
lodsb
cmp al,20h
ja @B
dec si
sub sp,128
mov di,sp
push ss
pop es
mov cx,128-1
@@nextitem2:
lodsb
cmp al,13
jz @@done
cmp al,10
jz @@done
stosb
and al,al
loopnz @@nextitem2
@@done:
mov al,0
stosb
push ss
pop ds ;DS=DGROUP
mov si,sp
call ParseCmdLine
add sp,128
pop es
popa
;--- restore original stack, DOS requires it
mov ss,ax
mov sp,dx
ret
DoCommandline endp
dispmsg proc
push cs
pop ds
push dx
mov dx,offset dHimem
mov ah,9
int 21h
pop dx
mov ah,9
int 21h
ret
dispmsg endp
;--- set entry in handle array
;--- ds:si -> handle array
;--- edx = block addr in kB
;--- ecx = block size in kB
;--- updates ds:si to point to next (free) handle
;--- updates global vars xms_max, xms_smax, xms_highest_addr
seti15handle proc
cmp edx, 1024 ;does the block start at 0x100000?
jnz @F
if ?PD110000
add edx, 64+4 ;then exclude the first 64 kB for HMA + 4 kB for page directory
sub ecx, 64+4
jc exit
else
add edx, 64
sub ecx, 64+4
jc exit
lea eax, [edx+ecx] ;place the page directory at the end of the first block
shl eax, 10
mov [PageDir],eax
endif
or hma_exists,1
@@:
cmp edx, 400000h ;beyond 4GB?
jc @F
sub xms_smax, ecx ;/SUPERMAX option set?
jnc beyond4g
add ecx, xms_smax ;limit to maximum
mov xms_smax,0
jecxz exit
jmp beyond4g
@@:
sub xms_max, ecx ;/MAX option set?
jnc @F
add ecx, xms_max ;limit to maximum
mov xms_max,0
jecxz exit
@@:
lea eax,[edx+ecx]
shl eax,10
dec eax
cmp eax, xms_highest_addr
jb @F
mov xms_highest_addr, eax
@@:
beyond4g:
mov [si].XMS_HANDLE.xh_flags, XMSF_FREE
mov [si].XMS_HANDLE.xh_locks, 0
mov [si].XMS_HANDLE.xh_baseK, edx
mov [si].XMS_HANDLE.xh_sizeK, ecx
add si, sizeof XMS_HANDLE
exit:
ret
seti15handle endp
;-- look for extended memory, int 15h, ax/ah 0e820h
;-- in: ds:si->handle array
;-- modifies eax, ebx, ecx, edx, si, di
;-- out: ds:si->next free handle
geti15mem proc
local mmap:E820MAP
@DbgOutS <"get15mem: get extended memory with int 15, E820",13,10>
; try 0e820h only!
xor ebx,ebx
push ss
pop es
e820_nextitem: ; ebx offset is updated with each successive int 15h
mov edx,SMAP
mov ecx, sizeof E820MAP
lea di, mmap
xor eax,eax
mov mmap.baselow,eax ; insurance against buggy BIOS
mov mmap.basehigh,eax
mov mmap.lenlow,eax
mov mmap.lenhigh,eax
mov mmap.type_,eax
mov ax,0e820h
clc
int 15h
setc dl ; keep carry flag status
cmp eax,SMAP
jne e820_bad ; failure
cmp dl,1
je e820_done ; CF doesn't have to signal fail, can just mean done
cmp ecx,sizeof E820MAP ; didn't return all the info needed, assume done
jb e820_done
cmp mmap.type_,1 ; memory available to OS
jne e820_itemdone
mov edx, mmap.baselow
mov eax, mmap.basehigh
cmp eax,0 ; memory beyond 4 GB?
jnz @F
cmp edx, 100000h ; has to live in extended memory
jb e820_itemdone
@@:
test eax, dwMaxHigh ;block start beyond 4GB/1TB?
jnz e820_itemdone
shrd edx, eax, 10
mov ecx, mmap.lenlow
mov eax, mmap.lenhigh
test eax, dwMaxHigh ;block size > 4GB/1TB?
jnz e820_itemdone
shrd ecx, eax, 10
mov eax, edx
add eax, ecx ;block crossing 4TB (XMS v3 limit)?
jc @F
dec eax
test eax, 0C0000000h;block crossing 1TB barrier (PSE-36 limit)?
jz e820_itemok
@@:
mov ecx, 0C0000000h ;truncate the block to ensure it fits in the first TB
sub ecx, edx
e820_itemok:
call seti15handle ;set xms block, sizeK in ECX, baseK in EDX
e820_itemdone:
cmp ebx,0 ;was this the last entry?
jnz e820_nextitem
e820_bad:
e820_done:
@@exit:
ret
geti15mem endp
hascpuid proc
push di
mov di,sp
and sp,0fffch ;make sure we don't get an exc 11 (if AM set in CR0)
pushfd ; save EFlags
cli
pushd 240000h ; set AC bit in eflags, reset IF
popfd ; pop extended flags
pushfd ; push extended flags
pop ax
pop ax ; get HiWord(EFlags) into AX
popfd ; restore EFlags
mov sp,di
pop di
test al,04 ;AC bit set?
je @F
test al,20h ;CPUID bit set?
jz @F
clc
ret
@@:
stc
ret
hascpuid endp
;--- driver init. this proc should be last
;--- since it initializes the handle table
;--- ds:di = request_ptr
initialize proc
pushf
pushad
cld
@DbgOutS <"initialize enter",13,10>
mov ax,3000h ; get DOS version number
int 21h
cmp al,3h ; we need at least 3.00
jnc @@dosok
mov dx,offset old_dos
@@error_exit: ; error msgs old_dos, xms_twice, a20_error, vdisk_detected, xms_tosmall
call dispmsg
mov dx,offset error_msg
mov ah,9
int 21h
popad
popf
ret
@@dosok:
mov ax,4300h ; check if XMS is already
int 2fh ; installed
cmp al,80h
mov dx,offset xms_twice
je @@error_exit
call DoCommandline ; parse commandline
;--- now DS=DGROUP
call hascpuid
jc @F
xor eax,eax
inc eax
.586
cpuid
.386
bt edx,CPUID1_PSE36
jnc @F
mov byte ptr dwMaxHigh,0; allow memory up to 000000ff.ffffffffh
@@:
@DbgOutS <"initialize: processing selected A20 method",13,10>
call seta20method ; modifies SI!
mov dx,offset a20_error
jc @@error_exit
call _install_check_vdisk ; is VDISK installed?
mov dx,offset vdisk_detected
jz @@error_exit
mov ax,cs ; setup descriptors
; mov [code_seg],ax ; eliminate relocation entry
if ?RESTCSREG
mov RmCS,ax
endif
movzx eax,ax
shl eax,4
; or @dword [code16dsc+2],eax
add @dword [gdt32+2],eax
if ?CATCHEXC
add @dword [idt32+2],eax
mov code16dsc.base00_15,ax
shr eax,16
mov code16dsc.base16_23,al
endif
mov ax,352Fh ; getvect --> es:bx
int 21h
mov @word [old_int2f+0],bx
mov @word [old_int2f+2],es
mov ax,3515h ; getvect --> es:bx
int 21h
mov @word [old_int15+0],bx
mov @word [old_int15+2],es
; ***************** handle LOG mode
mov si, offset trace_driver_end
ifdef _DEBUG
jmp @F
else
if ?LOG
cmp [_xms_logging_enabled],0
jne @F
endif
endif
if ?LOG
mov di, offset dispatcher_log_entry
lea si, [di+3]
mov cx, offset dispatcher_log_exit - (offset dispatcher_log_entry + 2)
mov [dispatcher_log_exit],0cbh ; patch call to RETF
push ds
pop es
rep movsb
mov si, di
add si, 3
and si, not 3
endif
@@:
mov @word xms_handle_table.xht_pArray+0, si
mov @word xms_handle_table.xht_pArray+2, ds
@DbgOutS <"initialize: init handle array",13,10>
call geti15mem ; look for extended memory via int 15h, ax=e820h
cmp hma_exists,1
mov dx,offset xms_toosmall
jnz @@error_exit
cmp _startup_verbose,0
je @F
invoke printf,offset szPageDir,PageDir
@@:
; we clear the handle table, as this may overwrite part of the code above
; but must not erase itself
IF ($ - startoftext) le MAXHANDLES * sizeof XMS_HANDLE
.err <this is an error! reserve some space after driver end ~!!>
ENDIF
mov ax, _xms_num_handles
mov xms_handle_table.xht_numhandles,ax
mov cx,sizeof XMS_HANDLE
mul cx
add ax,@word xms_handle_table.xht_pArray+0
mov bx,ax
xor eax,eax
@@:
mov [si].XMS_HANDLE.xh_flags,XMSF_INPOOL ; handle not used
mov [si].XMS_HANDLE.xh_locks,al ; clear locks
mov [si].XMS_HANDLE.xh_baseK,eax
mov [si].XMS_HANDLE.xh_sizeK,eax
add si,sizeof XMS_HANDLE
cmp si,bx
jb @B
@DbgOutS <"initialize: set int vectors 15h and 2Fh",13,10>
mov ax,252Fh ; install own INT2Fh
mov dx,offset int2f_handler
int 21h
mov ax,2515h ; install own INT15h
mov dx,offset int15_handler
int 21h
; driver init done
les di,[request_ptr]
mov @word es:[di+0].init_strc.end_addr,si
mov @word es:[di+2].init_strc.end_addr,cs ; set end address
mov es:[di].request_hdr.status,STATUS_OK ; we're alright
@@exit:
@DbgOutS <"initialize exit",13,10>
popad
popf
ret
initialize endp
;******************************************************************************
; init_interrupt routine. called by DOS right after the strategy routine to
; process the incoming job. also used to initialize the driver.
init_interrupt proc far
push di
push ds
@DbgOutS <"init interrupt enter",13,10>
lds di,cs:[request_ptr] ; load address of request header
cmp [di].request_hdr.cmd,CMD_INIT; do we have to initialize?
jne @@done
mov @word [di].init_strc.end_addr+0,0 ; init to error
mov @word [di].init_strc.end_addr+2,cs
mov [di].request_hdr.status, STATUS_BAD
call check_cpu ; do we have at least a 386?
jz @F
mov dx,offset no_386
call dispmsg
jmp @@done
@@:
push es
call initialize
pop es
mov @word cs:[6], offset dummyretf; new strategy offset
mov @word cs:[8], offset dummyretf; new interrupt offset
@@done:
; lds si,[request_ptr] ; return this to DOS (why?)
@DbgOutS <"init interrupt exit",13,10>
pop ds
pop di
ret
init_interrupt endp
;*********************************************
; startpoint when executing as EXE
;*********************************************
startexe proc
push cs
pop ds
invoke printf, offset szStartup
invoke printf, offset szHello
mov ah,04ch
int 21h
startexe endp
_TEXT ends
end startexe
|
src/svd/sam_svd-pdec.ads | Fabien-Chouteau/samd51-hal | 1 | 14775 | <gh_stars>1-10
pragma Style_Checks (Off);
-- This spec has been automatically generated from ATSAMD51G19A.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package SAM_SVD.PDEC is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Operation Mode
type CTRLA_MODESelect is
(-- QDEC operating mode
QDEC,
-- HALL operating mode
HALL,
-- COUNTER operating mode
COUNTER)
with Size => 2;
for CTRLA_MODESelect use
(QDEC => 0,
HALL => 1,
COUNTER => 2);
-- PDEC Configuration
type CTRLA_CONFSelect is
(-- Quadrature decoder direction
X4,
-- Secure Quadrature decoder direction
X4S,
-- Decoder direction
X2,
-- Secure decoder direction
X2S,
-- Auto correction mode
AUTOC)
with Size => 3;
for CTRLA_CONFSelect use
(X4 => 0,
X4S => 1,
X2 => 2,
X2S => 3,
AUTOC => 4);
-- PDEC_CTRLA_PINEN array
type PDEC_CTRLA_PINEN_Field_Array is array (0 .. 2) of Boolean
with Component_Size => 1, Size => 3;
-- Type definition for PDEC_CTRLA_PINEN
type PDEC_CTRLA_PINEN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PINEN as a value
Val : HAL.UInt3;
when True =>
-- PINEN as an array
Arr : PDEC_CTRLA_PINEN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 3;
for PDEC_CTRLA_PINEN_Field use record
Val at 0 range 0 .. 2;
Arr at 0 range 0 .. 2;
end record;
-- PDEC_CTRLA_PINVEN array
type PDEC_CTRLA_PINVEN_Field_Array is array (0 .. 2) of Boolean
with Component_Size => 1, Size => 3;
-- Type definition for PDEC_CTRLA_PINVEN
type PDEC_CTRLA_PINVEN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PINVEN as a value
Val : HAL.UInt3;
when True =>
-- PINVEN as an array
Arr : PDEC_CTRLA_PINVEN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 3;
for PDEC_CTRLA_PINVEN_Field use record
Val at 0 range 0 .. 2;
Arr at 0 range 0 .. 2;
end record;
subtype PDEC_CTRLA_ANGULAR_Field is HAL.UInt3;
subtype PDEC_CTRLA_MAXCMP_Field is HAL.UInt4;
-- Control A
type PDEC_CTRLA_Register is record
-- Software Reset
SWRST : Boolean := False;
-- Enable
ENABLE : Boolean := False;
-- Operation Mode
MODE : CTRLA_MODESelect := SAM_SVD.PDEC.QDEC;
-- unspecified
Reserved_4_5 : HAL.UInt2 := 16#0#;
-- Run in Standby
RUNSTDBY : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- PDEC Configuration
CONF : CTRLA_CONFSelect := SAM_SVD.PDEC.X4;
-- Auto Lock
ALOCK : Boolean := False;
-- unspecified
Reserved_12_13 : HAL.UInt2 := 16#0#;
-- PDEC Phase A and B Swap
SWAP : Boolean := False;
-- Period Enable
PEREN : Boolean := False;
-- PDEC Input From Pin 0 Enable
PINEN : PDEC_CTRLA_PINEN_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_19_19 : HAL.Bit := 16#0#;
-- IO Pin 0 Invert Enable
PINVEN : PDEC_CTRLA_PINVEN_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_23 : HAL.Bit := 16#0#;
-- Angular Counter Length
ANGULAR : PDEC_CTRLA_ANGULAR_Field := 16#0#;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- Maximum Consecutive Missing Pulses
MAXCMP : PDEC_CTRLA_MAXCMP_Field := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PDEC_CTRLA_Register use record
SWRST at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
MODE at 0 range 2 .. 3;
Reserved_4_5 at 0 range 4 .. 5;
RUNSTDBY at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
CONF at 0 range 8 .. 10;
ALOCK at 0 range 11 .. 11;
Reserved_12_13 at 0 range 12 .. 13;
SWAP at 0 range 14 .. 14;
PEREN at 0 range 15 .. 15;
PINEN at 0 range 16 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
PINVEN at 0 range 20 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
ANGULAR at 0 range 24 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
MAXCMP at 0 range 28 .. 31;
end record;
-- Command
type CTRLBCLR_CMDSelect is
(-- No action
NONE,
-- Force a counter restart or retrigger
RETRIGGER,
-- Force update of double buffered registers
UPDATE,
-- Force a read synchronization of COUNT
READSYNC,
-- Start QDEC/HALL
START,
-- Stop QDEC/HALL
STOP)
with Size => 3;
for CTRLBCLR_CMDSelect use
(NONE => 0,
RETRIGGER => 1,
UPDATE => 2,
READSYNC => 3,
START => 4,
STOP => 5);
-- Control B Clear
type PDEC_CTRLBCLR_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Lock Update
LUPD : Boolean := False;
-- unspecified
Reserved_2_4 : HAL.UInt3 := 16#0#;
-- Command
CMD : CTRLBCLR_CMDSelect := SAM_SVD.PDEC.NONE;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PDEC_CTRLBCLR_Register use record
Reserved_0_0 at 0 range 0 .. 0;
LUPD at 0 range 1 .. 1;
Reserved_2_4 at 0 range 2 .. 4;
CMD at 0 range 5 .. 7;
end record;
-- Command
type CTRLBSET_CMDSelect is
(-- No action
NONE,
-- Force a counter restart or retrigger
RETRIGGER,
-- Force update of double buffered registers
UPDATE,
-- Force a read synchronization of COUNT
READSYNC,
-- Start QDEC/HALL
START,
-- Stop QDEC/HALL
STOP)
with Size => 3;
for CTRLBSET_CMDSelect use
(NONE => 0,
RETRIGGER => 1,
UPDATE => 2,
READSYNC => 3,
START => 4,
STOP => 5);
-- Control B Set
type PDEC_CTRLBSET_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Lock Update
LUPD : Boolean := False;
-- unspecified
Reserved_2_4 : HAL.UInt3 := 16#0#;
-- Command
CMD : CTRLBSET_CMDSelect := SAM_SVD.PDEC.NONE;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PDEC_CTRLBSET_Register use record
Reserved_0_0 at 0 range 0 .. 0;
LUPD at 0 range 1 .. 1;
Reserved_2_4 at 0 range 2 .. 4;
CMD at 0 range 5 .. 7;
end record;
-- Event Action
type EVCTRL_EVACTSelect is
(-- Event action disabled
OFF,
-- Start, restart or retrigger on event
RETRIGGER,
-- Count on event
COUNT)
with Size => 2;
for EVCTRL_EVACTSelect use
(OFF => 0,
RETRIGGER => 1,
COUNT => 2);
subtype PDEC_EVCTRL_EVINV_Field is HAL.UInt3;
subtype PDEC_EVCTRL_EVEI_Field is HAL.UInt3;
-- PDEC_EVCTRL_MCEO array
type PDEC_EVCTRL_MCEO_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for PDEC_EVCTRL_MCEO
type PDEC_EVCTRL_MCEO_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MCEO as a value
Val : HAL.UInt2;
when True =>
-- MCEO as an array
Arr : PDEC_EVCTRL_MCEO_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for PDEC_EVCTRL_MCEO_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Event Control
type PDEC_EVCTRL_Register is record
-- Event Action
EVACT : EVCTRL_EVACTSelect := SAM_SVD.PDEC.OFF;
-- Inverted Event Input Enable
EVINV : PDEC_EVCTRL_EVINV_Field := 16#0#;
-- Event Input Enable
EVEI : PDEC_EVCTRL_EVEI_Field := 16#0#;
-- Overflow/Underflow Output Event Enable
OVFEO : Boolean := False;
-- Error Output Event Enable
ERREO : Boolean := False;
-- Direction Output Event Enable
DIREO : Boolean := False;
-- Velocity Output Event Enable
VLCEO : Boolean := False;
-- Match Channel 0 Event Output Enable
MCEO : PDEC_EVCTRL_MCEO_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 16,
Bit_Order => System.Low_Order_First;
for PDEC_EVCTRL_Register use record
EVACT at 0 range 0 .. 1;
EVINV at 0 range 2 .. 4;
EVEI at 0 range 5 .. 7;
OVFEO at 0 range 8 .. 8;
ERREO at 0 range 9 .. 9;
DIREO at 0 range 10 .. 10;
VLCEO at 0 range 11 .. 11;
MCEO at 0 range 12 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
end record;
-- PDEC_INTENCLR_MC array
type PDEC_INTENCLR_MC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for PDEC_INTENCLR_MC
type PDEC_INTENCLR_MC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MC as a value
Val : HAL.UInt2;
when True =>
-- MC as an array
Arr : PDEC_INTENCLR_MC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for PDEC_INTENCLR_MC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Clear
type PDEC_INTENCLR_Register is record
-- Overflow/Underflow Interrupt Disable
OVF : Boolean := False;
-- Error Interrupt Disable
ERR : Boolean := False;
-- Direction Interrupt Disable
DIR : Boolean := False;
-- Velocity Interrupt Disable
VLC : Boolean := False;
-- Channel 0 Compare Match Disable
MC : PDEC_INTENCLR_MC_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PDEC_INTENCLR_Register use record
OVF at 0 range 0 .. 0;
ERR at 0 range 1 .. 1;
DIR at 0 range 2 .. 2;
VLC at 0 range 3 .. 3;
MC at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- PDEC_INTENSET_MC array
type PDEC_INTENSET_MC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for PDEC_INTENSET_MC
type PDEC_INTENSET_MC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MC as a value
Val : HAL.UInt2;
when True =>
-- MC as an array
Arr : PDEC_INTENSET_MC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for PDEC_INTENSET_MC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Enable Set
type PDEC_INTENSET_Register is record
-- Overflow/Underflow Interrupt Enable
OVF : Boolean := False;
-- Error Interrupt Enable
ERR : Boolean := False;
-- Direction Interrupt Enable
DIR : Boolean := False;
-- Velocity Interrupt Enable
VLC : Boolean := False;
-- Channel 0 Compare Match Enable
MC : PDEC_INTENSET_MC_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PDEC_INTENSET_Register use record
OVF at 0 range 0 .. 0;
ERR at 0 range 1 .. 1;
DIR at 0 range 2 .. 2;
VLC at 0 range 3 .. 3;
MC at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- PDEC_INTFLAG_MC array
type PDEC_INTFLAG_MC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for PDEC_INTFLAG_MC
type PDEC_INTFLAG_MC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MC as a value
Val : HAL.UInt2;
when True =>
-- MC as an array
Arr : PDEC_INTFLAG_MC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for PDEC_INTFLAG_MC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Interrupt Flag Status and Clear
type PDEC_INTFLAG_Register is record
-- Overflow/Underflow
OVF : Boolean := False;
-- Error
ERR : Boolean := False;
-- Direction Change
DIR : Boolean := False;
-- Velocity
VLC : Boolean := False;
-- Channel 0 Compare Match
MC : PDEC_INTFLAG_MC_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PDEC_INTFLAG_Register use record
OVF at 0 range 0 .. 0;
ERR at 0 range 1 .. 1;
DIR at 0 range 2 .. 2;
VLC at 0 range 3 .. 3;
MC at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- PDEC_STATUS_CCBUFV array
type PDEC_STATUS_CCBUFV_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for PDEC_STATUS_CCBUFV
type PDEC_STATUS_CCBUFV_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CCBUFV as a value
Val : HAL.UInt2;
when True =>
-- CCBUFV as an array
Arr : PDEC_STATUS_CCBUFV_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for PDEC_STATUS_CCBUFV_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Status
type PDEC_STATUS_Register is record
-- Quadrature Error Flag
QERR : Boolean := False;
-- Index Error Flag
IDXERR : Boolean := False;
-- Missing Pulse Error flag
MPERR : Boolean := False;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- Window Error Flag
WINERR : Boolean := False;
-- Hall Error Flag
HERR : Boolean := False;
-- Stop
STOP : Boolean := True;
-- Direction Status Flag
DIR : Boolean := False;
-- Prescaler Buffer Valid
PRESCBUFV : Boolean := False;
-- Filter Buffer Valid
FILTERBUFV : Boolean := False;
-- unspecified
Reserved_10_11 : HAL.UInt2 := 16#0#;
-- Compare Channel 0 Buffer Valid
CCBUFV : PDEC_STATUS_CCBUFV_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 16,
Bit_Order => System.Low_Order_First;
for PDEC_STATUS_Register use record
QERR at 0 range 0 .. 0;
IDXERR at 0 range 1 .. 1;
MPERR at 0 range 2 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
WINERR at 0 range 4 .. 4;
HERR at 0 range 5 .. 5;
STOP at 0 range 6 .. 6;
DIR at 0 range 7 .. 7;
PRESCBUFV at 0 range 8 .. 8;
FILTERBUFV at 0 range 9 .. 9;
Reserved_10_11 at 0 range 10 .. 11;
CCBUFV at 0 range 12 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
end record;
-- Debug Control
type PDEC_DBGCTRL_Register is record
-- Debug Run Mode
DBGRUN : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PDEC_DBGCTRL_Register use record
DBGRUN at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- PDEC_SYNCBUSY_CC array
type PDEC_SYNCBUSY_CC_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for PDEC_SYNCBUSY_CC
type PDEC_SYNCBUSY_CC_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- CC as a value
Val : HAL.UInt2;
when True =>
-- CC as an array
Arr : PDEC_SYNCBUSY_CC_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for PDEC_SYNCBUSY_CC_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Synchronization Status
type PDEC_SYNCBUSY_Register is record
-- Read-only. Software Reset Synchronization Busy
SWRST : Boolean;
-- Read-only. Enable Synchronization Busy
ENABLE : Boolean;
-- Read-only. Control B Synchronization Busy
CTRLB : Boolean;
-- Read-only. Status Synchronization Busy
STATUS : Boolean;
-- Read-only. Prescaler Synchronization Busy
PRESC : Boolean;
-- Read-only. Filter Synchronization Busy
FILTER : Boolean;
-- Read-only. Count Synchronization Busy
COUNT : Boolean;
-- Read-only. Compare Channel 0 Synchronization Busy
CC : PDEC_SYNCBUSY_CC_Field;
-- unspecified
Reserved_9_31 : HAL.UInt23;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PDEC_SYNCBUSY_Register use record
SWRST at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
CTRLB at 0 range 2 .. 2;
STATUS at 0 range 3 .. 3;
PRESC at 0 range 4 .. 4;
FILTER at 0 range 5 .. 5;
COUNT at 0 range 6 .. 6;
CC at 0 range 7 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-- Prescaler Value
type PRESC_PRESCSelect is
(-- No division
DIV1,
-- Divide by 2
DIV2,
-- Divide by 4
DIV4,
-- Divide by 8
DIV8,
-- Divide by 16
DIV16,
-- Divide by 32
DIV32,
-- Divide by 64
DIV64,
-- Divide by 128
DIV128,
-- Divide by 256
DIV256,
-- Divide by 512
DIV512,
-- Divide by 1024
DIV1024)
with Size => 4;
for PRESC_PRESCSelect use
(DIV1 => 0,
DIV2 => 1,
DIV4 => 2,
DIV8 => 3,
DIV16 => 4,
DIV32 => 5,
DIV64 => 6,
DIV128 => 7,
DIV256 => 8,
DIV512 => 9,
DIV1024 => 10);
-- Prescaler Value
type PDEC_PRESC_Register is record
-- Prescaler Value
PRESC : PRESC_PRESCSelect := SAM_SVD.PDEC.DIV1;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PDEC_PRESC_Register use record
PRESC at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
end record;
-- Prescaler Buffer Value
type PRESCBUF_PRESCBUFSelect is
(-- No division
DIV1,
-- Divide by 2
DIV2,
-- Divide by 4
DIV4,
-- Divide by 8
DIV8,
-- Divide by 16
DIV16,
-- Divide by 32
DIV32,
-- Divide by 64
DIV64,
-- Divide by 128
DIV128,
-- Divide by 256
DIV256,
-- Divide by 512
DIV512,
-- Divide by 1024
DIV1024)
with Size => 4;
for PRESCBUF_PRESCBUFSelect use
(DIV1 => 0,
DIV2 => 1,
DIV4 => 2,
DIV8 => 3,
DIV16 => 4,
DIV32 => 5,
DIV64 => 6,
DIV128 => 7,
DIV256 => 8,
DIV512 => 9,
DIV1024 => 10);
-- Prescaler Buffer Value
type PDEC_PRESCBUF_Register is record
-- Prescaler Buffer Value
PRESCBUF : PRESCBUF_PRESCBUFSelect := SAM_SVD.PDEC.DIV1;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PDEC_PRESCBUF_Register use record
PRESCBUF at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
end record;
subtype PDEC_COUNT_COUNT_Field is HAL.UInt16;
-- Counter Value
type PDEC_COUNT_Register is record
-- Counter Value
COUNT : PDEC_COUNT_COUNT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PDEC_COUNT_Register use record
COUNT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype PDEC_CC_CC_Field is HAL.UInt16;
-- Channel n Compare Value
type PDEC_CC_Register is record
-- Channel Compare Value
CC : PDEC_CC_CC_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PDEC_CC_Register use record
CC at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- Channel n Compare Value
type PDEC_CC_Registers is array (0 .. 1) of PDEC_CC_Register;
subtype PDEC_CCBUF_CCBUF_Field is HAL.UInt16;
-- Channel Compare Buffer Value
type PDEC_CCBUF_Register is record
-- Channel Compare Buffer Value
CCBUF : PDEC_CCBUF_CCBUF_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PDEC_CCBUF_Register use record
CCBUF at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- Channel Compare Buffer Value
type PDEC_CCBUF_Registers is array (0 .. 1) of PDEC_CCBUF_Register;
-----------------
-- Peripherals --
-----------------
-- Quadrature Decodeur
type PDEC_Peripheral is record
-- Control A
CTRLA : aliased PDEC_CTRLA_Register;
-- Control B Clear
CTRLBCLR : aliased PDEC_CTRLBCLR_Register;
-- Control B Set
CTRLBSET : aliased PDEC_CTRLBSET_Register;
-- Event Control
EVCTRL : aliased PDEC_EVCTRL_Register;
-- Interrupt Enable Clear
INTENCLR : aliased PDEC_INTENCLR_Register;
-- Interrupt Enable Set
INTENSET : aliased PDEC_INTENSET_Register;
-- Interrupt Flag Status and Clear
INTFLAG : aliased PDEC_INTFLAG_Register;
-- Status
STATUS : aliased PDEC_STATUS_Register;
-- Debug Control
DBGCTRL : aliased PDEC_DBGCTRL_Register;
-- Synchronization Status
SYNCBUSY : aliased PDEC_SYNCBUSY_Register;
-- Prescaler Value
PRESC : aliased PDEC_PRESC_Register;
-- Filter Value
FILTER : aliased HAL.UInt8;
-- Prescaler Buffer Value
PRESCBUF : aliased PDEC_PRESCBUF_Register;
-- Filter Buffer Value
FILTERBUF : aliased HAL.UInt8;
-- Counter Value
COUNT : aliased PDEC_COUNT_Register;
-- Channel n Compare Value
CC : aliased PDEC_CC_Registers;
-- Channel Compare Buffer Value
CCBUF : aliased PDEC_CCBUF_Registers;
end record
with Volatile;
for PDEC_Peripheral use record
CTRLA at 16#0# range 0 .. 31;
CTRLBCLR at 16#4# range 0 .. 7;
CTRLBSET at 16#5# range 0 .. 7;
EVCTRL at 16#6# range 0 .. 15;
INTENCLR at 16#8# range 0 .. 7;
INTENSET at 16#9# range 0 .. 7;
INTFLAG at 16#A# range 0 .. 7;
STATUS at 16#C# range 0 .. 15;
DBGCTRL at 16#F# range 0 .. 7;
SYNCBUSY at 16#10# range 0 .. 31;
PRESC at 16#14# range 0 .. 7;
FILTER at 16#15# range 0 .. 7;
PRESCBUF at 16#18# range 0 .. 7;
FILTERBUF at 16#19# range 0 .. 7;
COUNT at 16#1C# range 0 .. 31;
CC at 16#20# range 0 .. 63;
CCBUF at 16#30# range 0 .. 63;
end record;
-- Quadrature Decodeur
PDEC_Periph : aliased PDEC_Peripheral
with Import, Address => PDEC_Base;
end SAM_SVD.PDEC;
|
Transynther/x86/_processed/NONE/_ht_zr_/i9-9900K_12_0xca.log_21829_1820.asm | ljhsiun2/medusa | 9 | 169888 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_ht_zr_/i9-9900K_12_0xca.log_21829_1820.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r15
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0xc12a, %r13
nop
sub %r14, %r14
movb $0x61, (%r13)
nop
nop
xor %r15, %r15
lea addresses_WT_ht+0x1b70a, %rsi
lea addresses_WC_ht+0x1607a, %rdi
nop
nop
nop
nop
nop
inc %r9
mov $22, %rcx
rep movsq
nop
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_normal_ht+0x1406a, %r14
nop
cmp %r9, %r9
mov (%r14), %di
nop
nop
nop
nop
nop
and $19934, %r9
lea addresses_WT_ht+0x3daa, %rsi
nop
and $54926, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, (%rsi)
nop
nop
nop
nop
nop
sub %r9, %r9
lea addresses_WC_ht+0x11b6a, %rsi
lea addresses_A_ht+0x1e0e9, %rdi
nop
nop
nop
nop
inc %r9
mov $1, %rcx
rep movsl
nop
nop
cmp $22964, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r15
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r9
push %rax
push %rcx
// Faulty Load
lea addresses_UC+0xb52a, %r14
nop
sub $41815, %r11
vmovups (%r14), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %r15
lea oracles, %r14
and $0xff, %r15
shlq $12, %r15
mov (%r14,%r15,1), %r15
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_WT_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 3}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 0}}
{'49': 741, '00': 21088}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 49 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 49 00 00 00 00 49 00 00 00 49 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
libsrc/oz/ozdetectmodel.asm | grancier/z180 | 0 | 98066 | ;
; Sharp OZ family functions
;
; ported from the OZ-7xx SDK by by <NAME>
; by <NAME> - Oct. 2003
;
;
; Detect the OZ model
;
;; ozmodel:
;;
;; bit 0: 0 if 700/730 and 1 if 750/770
;; bit 1: 0 if <770 and 1 if 770
;; bit 2: 0 if 7xxPC and 1 if 7xxM
;
; ------
; $Id: ozdetectmodel.asm,v 1.3 2016/06/27 21:25:36 dom Exp $
;
SECTION code_clib
PUBLIC ozdetectmodel
PUBLIC _ozdetectmodel
EXTERN ozmodel
EXTERN s_filetypetable
EXTERN restore_a000
ozdetectmodel:
_ozdetectmodel:
push bc
push de
call 07f94h
ld (ozmodel),a
ld a,0ch
ld hl,0ab4fh
ld de,String1
call compare4
jr nz,is730or750PC
;; we have either a 770 or a 730M/750M at this point
ld a,0eh ;; we'll check where the font tables are
ld hl,0a300h
ld de,String2
call compare4 ;; z if 770; nz if 730M/750M
ld e,2
jr z,setmodel
ld e,4
setmodel:
ld hl,ozmodel
ld a,(hl)
or e
ld (hl),a
jr Finish
is730or750PC:
ld a,88h
ld (s_filetypetable),a
Finish:
ld a,(ozmodel)
ld l,a
pop de
pop bc
jp restore_a000
compare4:
out (3),a
xor a
out (4),a
ld b,4
top:
ld a,(de)
cp (hl)
ret nz
inc de
inc hl
djnz top
ret
SECTION rodata_clib
String1:
defb 89h,0c0h,19h,4dh
String2:
defm "PC_P"
|
interrupts/int_timing_halt_dmg_mode/main.asm | AntonioND/gbc-hw-tests | 6 | 84860 |
INCLUDE "hardware.inc"
INCLUDE "header.inc"
SECTION "var",BSS
ram_ptr: DS 2
repeat_loop: DS 1
SECTION "Main",HOME
;--------------------------------------------------------------------------
;- Main() -
;--------------------------------------------------------------------------
Main:
ld hl,$A000
; -------------------------------------------------------
ld a,$0A
ld [$0000],a ; enable ram
; -------------------------------------------------------
ld a,IEF_TIMER
ld [rIE],a
xor a,a
ld [rTMA],a
ld a,TACF_STOP|TACF_262KHZ
ld [rTAC],a
ld a,TACF_START|TACF_262KHZ
ld [rTAC],a
di
;REPETITIONS_1 SET 0
; REPT 16
REPETITIONS_2 SET 0
REPT 32
xor a,a
ld [rTIMA],a
ld [rIF],a
dec a
dec a
ld [rDIV],a
ld [rTIMA],a
ei
; REPT REPETITIONS_1
; inc a
; ENDR
halt
REPT REPETITIONS_2
nop
ENDR
ld a,[rTIMA]
ld [hl+],a
REPETITIONS_2 SET REPETITIONS_2+1
ENDR
;REPETITIONS_1 SET REPETITIONS_1+1
; ENDR
; -------------------------------------------------------
push hl ; magic number
ld [hl],$12
inc hl
ld [hl],$34
inc hl
ld [hl],$56
inc hl
ld [hl],$78
pop hl
ld a,$00
ld [$0000],a ; disable ram
; -------------------------------------------------------
.endloop:
halt
jr .endloop
|
alloy4fun_models/trashltl/models/1/3Nq6XGeiEp67G5N6K.als | Kaixi26/org.alloytools.alloy | 0 | 1322 | open main
pred id3Nq6XGeiEp67G5N6K_prop2 {
no File implies eventually some File
}
pred __repair { id3Nq6XGeiEp67G5N6K_prop2 }
check __repair { id3Nq6XGeiEp67G5N6K_prop2 <=> prop2o } |
programs/oeis/270/A270742.asm | neoneye/loda | 22 | 86690 | ; A270742: Binary expansion of C = (1/2)*(3/4)*(7/8)*(15/16)... .
; 0,1,0,0,1,0,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0
mov $2,$0
lpb $0
mov $0,$2
add $1,1
sub $2,$1
add $3,1
div $0,$3
sub $0,$3
lpe
lpb $0
div $0,3
add $1,31
lpe
mod $1,2
mov $0,$1
|
old/Homotopy/ConnectedSuspension.agda | timjb/HoTT-Agda | 294 | 7788 | {-# OPTIONS --without-K #-}
open import Base
open import Homotopy.Truncation
open import Homotopy.Connected
open import Spaces.Suspension
open import Homotopy.PushoutDef
import Homotopy.PushoutUP as PushoutUP
-- In this file I prove that if [A] is n-connected and its (n+1)-truncation is
-- inhabited, then [suspension A] is (n+1)-connected.
--
-- The hypothesis that [τ (S n) A] is inhabited is not necessary, it can be
-- removed but it’s simpler to assume it
module Homotopy.ConnectedSuspension
{i} (A : Set i) {n : ℕ₋₂} (p : is-connected n A) (x₀ : τ (S n) A) where
-- The (n+1)-truncation of the suspension is a pushout of the following diagram
τ-susp-diag : pushout-diag i
τ-susp-diag = diag τ (S n) unit , τ (S n) unit , τ (S n) A
, τ-extend-nondep (λ _ → proj tt)
, τ-extend-nondep (λ _ → proj tt)
module τ-susp-H = PushoutUP τ-susp-diag (is-truncated (S n))
import Homotopy.TruncationRightExact (S n) (suspension-diag A) as Exact
abstract
trunc-cocone : τ-susp-H.cocone (τ (S n) (suspension A))
trunc-cocone = Exact.cocone-τpushout
trunc-is-pushout : τ-susp-H.is-pushout (τ (S n) (suspension A)) trunc-cocone
trunc-is-pushout = Exact.τpushout-is-pushout
-- The previous diagram is equivalent to the following
susp-diag : pushout-diag i
susp-diag = suspension-diag (τ (S n) A)
module susp-H = PushoutUP susp-diag (is-truncated (S n))
-- To be moved
τ-unit-to-unit : τ (S n) (unit {i}) → unit {i}
τ-unit-to-unit _ = tt
abstract
τ-unit-to-unit-is-equiv : is-equiv τ-unit-to-unit
τ-unit-to-unit-is-equiv =
iso-is-eq _ (λ _ → proj tt)
(λ _ → refl)
(τ-extend
⦃ λ _ → ≡-is-truncated (S n) (τ-is-truncated (S n) _) ⦄
(λ _ → refl))
τ-unit-equiv-unit : τ (S n) unit ≃ unit
τ-unit-equiv-unit = (τ-unit-to-unit , τ-unit-to-unit-is-equiv)
-- / To be moved
abstract
τ-susp-equal-susp : τ-susp-diag ≡ susp-diag
τ-susp-equal-susp = pushout-diag-eq τ-unit-equiv-unit τ-unit-equiv-unit
(id-equiv _) (λ _ → refl) (λ _ → refl)
-- But we prove by hand that the point is also a pushout of this diagram
unit-cocone : susp-H.cocone unit
unit-cocone = (id _ susp-H., id _ , cst refl)
private
factor-pushout : (E : Set i) → (susp-H.cocone E → (unit {i} → E))
factor-pushout E c = susp-H.A→top c
x : {E : Set i} → (susp-H.cocone E → E)
x c = susp-H.A→top c tt
y : {E : Set i} → (susp-H.cocone E → E)
y c = susp-H.B→top c tt
x≡y : {E : Set i} (c : susp-H.cocone E) → x c ≡ y c
x≡y c = susp-H.h c x₀
ττA-is-contr : is-contr (τ n (τ (S n) A))
ττA-is-contr = equiv-types-truncated _ (τ-equiv-ττ n A) p
susp-H-unit-is-pushout : susp-H.is-pushout unit unit-cocone
susp-H-unit-is-pushout E ⦃ P-E ⦄ =
iso-is-eq _
(factor-pushout E)
(λ c →
susp-H.cocone-eq-raw _ refl (funext (λ _ → x≡y c))
(app-is-inj x₀ ττA-is-contr (P-E _ _)
(trans-Π2 _ (λ v _ → susp-H.A→top c tt ≡ v tt)
(funext (λ r → susp-H.h c x₀)) _ _
∘ (trans-cst≡app _ (λ u → u tt) (funext (λ r → susp-H.h c x₀)) _
∘ happly (happly-funext (λ _ → susp-H.h c x₀)) tt))))
(λ _ → refl)
-- Type of (S n)-truncated pushout-diagrams (this should probably be defined
-- more generally in Homotopy.PushoutDef or something)
truncated-diag : Set _
truncated-diag = Σ (pushout-diag i)
(λ d → (is-truncated (S n) (pushout-diag.A d))
× ((is-truncated (S n) (pushout-diag.B d))
× (is-truncated (S n) (pushout-diag.C d))))
τ-susp-trunc-diag : truncated-diag
τ-susp-trunc-diag = (τ-susp-diag , (τ-is-truncated (S n) _ ,
(τ-is-truncated (S n) _ ,
τ-is-truncated (S n) _)))
susp-trunc-diag : truncated-diag
susp-trunc-diag = (susp-diag , (unit-is-truncated-S#instance ,
(unit-is-truncated-S#instance ,
τ-is-truncated (S n) _)))
-- The two diagrams are equal as truncated diagrams
abstract
τ-susp-trunc-equal-susp-trunc : τ-susp-trunc-diag ≡ susp-trunc-diag
τ-susp-trunc-equal-susp-trunc = Σ-eq τ-susp-equal-susp
(Σ-eq (π₁ (is-truncated-is-prop (S n) _ _))
(Σ-eq (π₁ (is-truncated-is-prop (S n) _ _))
(π₁ (is-truncated-is-prop (S n) _ _))))
new-cocone : (d : truncated-diag) → (Set i → Set i)
new-cocone (d , (_ , (_ , _))) =
PushoutUP.cocone d (is-truncated (S n))
new-is-pushout : (d : truncated-diag)
→ ((D : Set i) ⦃ PD : is-truncated (S n) D ⦄
(Dcocone : new-cocone d D) → Set _)
new-is-pushout (d , (_ , (_ , _))) =
PushoutUP.is-pushout d (is-truncated (S n))
unit-new-cocone : (d : truncated-diag) → new-cocone d unit
unit-new-cocone d = ((λ _ → tt) PushoutUP., (λ _ → tt) , (λ _ → refl))
unit-is-pushout : (d : truncated-diag) → Set _
unit-is-pushout d = new-is-pushout d unit (unit-new-cocone d)
abstract
unit-τ-is-pushout :
τ-susp-H.is-pushout unit (unit-new-cocone τ-susp-trunc-diag)
unit-τ-is-pushout =
transport unit-is-pushout (! τ-susp-trunc-equal-susp-trunc)
susp-H-unit-is-pushout
private
unit-equiv-τSnΣA : unit {i} ≃ τ (S n) (suspension A)
unit-equiv-τSnΣA =
τ-susp-H.pushout-equiv-pushout
unit (unit-new-cocone τ-susp-trunc-diag) unit-τ-is-pushout
(τ (S n) (suspension A)) trunc-cocone trunc-is-pushout
abstract
suspension-is-connected-S : is-connected (S n) (suspension A)
suspension-is-connected-S =
equiv-types-truncated _ unit-equiv-τSnΣA unit-is-contr
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_1389.asm | ljhsiun2/medusa | 9 | 11149 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r15
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x65c7, %rsi
lea addresses_WT_ht+0x7cc7, %rdi
nop
dec %rbx
mov $80, %rcx
rep movsw
nop
nop
nop
nop
nop
cmp %r15, %r15
lea addresses_WT_ht+0x7797, %r13
xor $13500, %r9
movl $0x61626364, (%r13)
nop
nop
nop
nop
dec %rcx
lea addresses_WT_ht+0x31c7, %rsi
lea addresses_WC_ht+0x16187, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
xor $2183, %r13
mov $85, %rcx
rep movsq
nop
add %r15, %r15
lea addresses_A_ht+0x1d547, %r13
nop
nop
nop
add %rdi, %rdi
mov $0x6162636465666768, %rbx
movq %rbx, %xmm6
movups %xmm6, (%r13)
nop
add $36921, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r15
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %rax
push %rbx
push %rcx
push %rsi
// Faulty Load
lea addresses_D+0x125c7, %r13
nop
nop
nop
nop
nop
and $5712, %rsi
movb (%r13), %bl
lea oracles, %rcx
and $0xff, %rbx
shlq $12, %rbx
mov (%rcx,%rbx,1), %rbx
pop %rsi
pop %rcx
pop %rbx
pop %rax
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_D', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_D', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 4}}
{'src': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 7, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}}
{'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
*/
|
src/Topology.agda | shinji-kono/zf-in-agda | 5 | 12928 | <filename>src/Topology.agda
open import Level
open import Ordinals
module Topology {n : Level } (O : Ordinals {n}) where
open import zf
open import logic
open _∧_
open _∨_
open Bool
import OD
open import Relation.Nullary
open import Data.Empty
open import Relation.Binary.Core
open import Relation.Binary.PropositionalEquality
import BAlgbra
open BAlgbra O
open inOrdinal O
open OD O
open OD.OD
open ODAxiom odAxiom
import OrdUtil
import ODUtil
open Ordinals.Ordinals O
open Ordinals.IsOrdinals isOrdinal
open Ordinals.IsNext isNext
open OrdUtil O
open ODUtil O
import ODC
open ODC O
open import filter
record Toplogy ( L : HOD ) : Set (suc n) where
field
OS : HOD
OS⊆PL : OS ⊆ Power L
o∪ : { P : HOD } → P ⊆ OS → OS ∋ Union P
o∩ : { p q : HOD } → OS ∋ p → OS ∋ q → OS ∋ (p ∩ q)
open Toplogy
record _covers_ ( P q : HOD ) : Set (suc n) where
field
cover : {x : HOD} → q ∋ x → HOD
P∋cover : {x : HOD} → {lt : q ∋ x} → P ∋ cover lt
isCover : {x : HOD} → {lt : q ∋ x} → cover lt ∋ x
-- Base
-- The elements of B cover X ; For any U , V ∈ B and any point x ∈ U ∩ V there is a W ∈ B such that
-- W ⊆ U ∩ V and x ∈ W .
data genTop (P : HOD) : HOD → Set (suc n) where
gi : {x : HOD} → P ∋ x → genTop P x
g∩ : {x y : HOD} → genTop P x → genTop P y → genTop P (x ∩ y)
g∪ : {Q x : HOD} → Q ⊆ P → genTop P (Union Q)
-- Limit point
record LP ( L S x : HOD ) (top : Toplogy L) (S⊆PL : S ⊆ Power L ) ( S∋x : S ∋ x ) : Set (suc n) where
field
neip : {y : HOD} → OS top ∋ y → y ∋ x → HOD
isNeip : {y : HOD} → (o∋y : OS top ∋ y ) → (y∋x : y ∋ x ) → ¬ ( x ≡ neip o∋y y∋x) ∧ ( y ∋ neip o∋y y∋x )
-- Finite Intersection Property
data Finite-∩ (S : HOD) : HOD → Set (suc n) where
fin-∩e : {x : HOD} → S ∋ x → Finite-∩ S x
fin-∩ : {x y : HOD} → Finite-∩ S x → Finite-∩ S y → Finite-∩ S (x ∩ y)
record FIP ( L P : HOD ) : Set (suc n) where
field
fipS⊆PL : P ⊆ Power L
fip≠φ : { x : HOD } → Finite-∩ P x → ¬ ( x ≡ od∅ )
-- Compact
data Finite-∪ (S : HOD) : HOD → Set (suc n) where
fin-∪e : {x : HOD} → S ∋ x → Finite-∪ S x
fin-∪ : {x y : HOD} → Finite-∪ S x → Finite-∪ S y → Finite-∪ S (x ∪ y)
record Compact ( L P : HOD ) : Set (suc n) where
field
finCover : {X y : HOD} → X covers P → P ∋ y → HOD
isFinCover : {X y : HOD} → (xp : X covers P ) → (P∋y : P ∋ y ) → finCover xp P∋y ∋ y
isFininiteCover : {X y : HOD} → (xp : X covers P ) → (P∋y : P ∋ y ) → Finite-∪ X (finCover xp P∋y )
-- FIP is Compact
FIP→Compact : {L P : HOD} → Tolopogy L → FIP L P → Compact L P
FIP→Compact = ?
Compact→FIP : {L P : HOD} → Tolopogy L → Compact L P → FIP L P
Compact→FIP = ?
-- Product Topology
_Top⊗_ : {P Q : HOD} → Topology P → Tolopogy Q → Topology ( P ⊗ Q )
_Top⊗_ = ?
-- existence of Ultra Filter
-- Ultra Filter has limit point
-- FIP is UFL
-- Product of UFL has limit point (Tychonoff)
|
1A/S5/PIM/tps/pr2/ensembles_tableau.adb | MOUDDENEHamza/ENSEEIHT | 4 | 24016 | <reponame>MOUDDENEHamza/ENSEEIHT<filename>1A/S5/PIM/tps/pr2/ensembles_tableau.adb
-- Implantation du module Ensembles.
package body Ensembles_Tableau is
procedure Initialiser (Ensemble : out T_Ensemble) is
begin
Ensemble.Taille := 0;
end Initialiser;
procedure Detruire (Ensemble : in out T_Ensemble) is
begin
Ensemble.Taille := 0;
end Detruire;
function Est_Vide (Ensemble : in T_Ensemble) return Boolean is
begin
return Ensemble.Taille = 0;
end Est_Vide;
function Taille (Ensemble : in T_Ensemble) return Integer is
begin
return Ensemble.Taille;
end Taille;
function Est_Present (Ensemble : in T_Ensemble; Element : in T_Element) return Boolean is
present : Boolean;
begin
present := False;
for i in 1..Taille (Ensemble) loop
if (Ensemble.Tab(i) = Element) then
present := True;
end if;
end loop;
return present;
end Est_Present;
procedure Ajouter (Ensemble : in out T_Ensemble; Element : in T_Element) is
begin
Ensemble.Taille := Ensemble.Taille + 1;
Ensemble.Tab(Ensemble.Taille) := Element;
end Ajouter;
procedure Supprimer (Ensemble : in out T_Ensemble; Element : in T_Element) is
i : Integer;
begin
i := 1;
while ( i <= Taille (Ensemble)) loop
if (Ensemble.Tab(i) = Element) Then
Ensemble.Tab(i) := Ensemble.Tab(Ensemble.Taille);
Ensemble.Taille := Ensemble.Taille - 1;
end if;
i := i + 1;
end loop;
end Supprimer;
procedure Appliquer_Sur_Tous (Ensemble : in T_Ensemble) is
begin
for i in 1..Ensemble.Taille loop
Operation (Ensemble.Tab (i));
end loop;
end Appliquer_Sur_Tous;
end Ensembles_Tableau;
|
simple2.adb | spacekookie/learn_ada | 1 | 9975 | with Ada.Text_IO;
use Ada.Text_IO;
procedure UglyForm is
begin
Put("Good form ");
Put("can aid in ");
Put ("understanding a program,");
New_Line;
Put("and bad form ");
Put("can make a program ");
Put("unreadable.");
New_Line;
end UglyForm;
-- Result of execution
-- Good form can aid in understanding a program,
-- and bad form can make a program unreadable.
|
Assembler/test cases/TwoOperand.asm | MuhanadAtef/32-bit-risc-pipelined-processor | 0 | 81650 | # all numbers in hex format
# we always start by reset signal
#this is a commented line
.ORG 0 #this means the the following line would be at address 0 , and this is the reset address
10
#you should ignore empty lines
.ORG 2 #this is the interrupt address
100
.ORG 10
in R1 #add 5 in R1
in R2 #add 19 in R2
in R3 #FFFD
in R4 #F320
IADD R3,R5,2 #R5 = FFFF , flags no change
ADD R1,R4,R4 #R4= F325 , C-->0, N-->0, Z-->0
SUB R5,R4,R6 #R4= 0CDA , C-->1, N-->0,Z-->0
AND R7,R6,R6 #R6= 00000000 , C-->no change, N-->0, Z-->1
OR R2,R1,R1 #R1=1D , C--> no change, N-->0, Z--> 0
SHL R2,2 #R2=64 , C--> 0, N -->0 , Z -->0
SHR R2,3 #R2=0C , C -->1, N-->0 , Z-->0
SWAP R2,R5 #R5=0C ,R2=FFFF ,no change for flags
ADD R5,R2,R2 #R2= 1000B (C,N,Z= 0)
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/concat1_pkg.adb | best08618/asylo | 7 | 1182 | package body Concat1_Pkg is
function Ident (I : Integer) return Integer is begin return I; end;
end Concat1_Pkg;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/atomic7_1.adb | best08618/asylo | 7 | 6461 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/atomic7_1.adb
-- { dg-do run }
with Atomic7_Pkg2; use Atomic7_Pkg2;
procedure Atomic7_1 is
I : Integer := Stamp;
pragma Atomic (I);
J : Integer := Stamp;
begin
if I /= 1 then
raise Program_Error;
end if;
end;
|
P6/data_P6_2/ALUTest25.asm | alxzzhou/BUAA_CO_2020 | 1 | 170061 | <reponame>alxzzhou/BUAA_CO_2020
lh $3,10($0)
xor $3,$3,$3
lhu $0,4($0)
subu $5,$3,$3
nor $6,$4,$3
or $3,$4,$3
sb $6,6($0)
subu $3,$1,$3
srlv $4,$3,$3
subu $0,$4,$3
addiu $4,$3,10600
srl $3,$3,28
sb $4,10($0)
sll $3,$3,0
andi $5,$5,23343
lhu $4,6($0)
sw $0,12($0)
lb $0,3($0)
or $4,$4,$3
sh $1,6($0)
or $1,$4,$3
srlv $3,$3,$3
addu $5,$5,$3
and $5,$4,$3
sltiu $4,$6,-12071
ori $4,$4,25139
addu $3,$5,$3
srlv $4,$4,$3
slt $4,$5,$3
lb $5,13($0)
sw $1,4($0)
sllv $3,$3,$3
sltu $4,$6,$3
sra $3,$3,6
sra $4,$1,8
ori $6,$3,2891
srlv $6,$4,$3
sltu $4,$1,$3
lb $1,12($0)
and $3,$1,$3
slti $1,$1,-12047
srav $3,$1,$3
addiu $3,$1,31778
sllv $3,$4,$3
lbu $3,16($0)
subu $5,$1,$3
slt $1,$2,$3
lw $5,16($0)
lw $4,16($0)
sra $3,$4,27
addu $1,$1,$3
addiu $3,$3,22658
addu $3,$0,$3
lbu $1,8($0)
addiu $3,$3,-76
subu $3,$3,$3
srav $1,$3,$3
sltu $3,$3,$3
lw $3,4($0)
srlv $5,$3,$3
lb $3,1($0)
andi $3,$3,35106
addu $3,$6,$3
sra $4,$1,5
addu $5,$5,$3
srav $6,$3,$3
lw $0,0($0)
xor $4,$6,$3
sw $5,16($0)
or $4,$6,$3
srlv $4,$2,$3
addu $3,$6,$3
srlv $6,$6,$3
or $6,$3,$3
sltiu $1,$6,-9460
addiu $3,$5,6756
addiu $4,$4,-6473
sltiu $3,$2,22620
xori $3,$3,37852
and $3,$4,$3
sltu $5,$4,$3
lh $1,10($0)
lb $1,10($0)
addu $0,$5,$3
addu $3,$5,$3
srl $4,$0,23
sltiu $6,$2,20981
sra $6,$6,7
srl $5,$5,29
subu $4,$3,$3
addu $5,$3,$3
xori $3,$1,21034
sltu $4,$4,$3
lbu $3,15($0)
sltu $4,$1,$3
srl $5,$1,23
sll $5,$4,19
sw $3,16($0)
nor $5,$6,$3
sllv $3,$3,$3
lhu $3,4($0)
addiu $3,$3,19692
slt $5,$5,$3
lb $1,11($0)
ori $4,$3,28226
ori $3,$1,44073
sllv $4,$4,$3
lhu $4,2($0)
lh $2,0($0)
srl $3,$6,14
lbu $4,9($0)
lw $1,16($0)
srav $4,$4,$3
srav $3,$3,$3
lh $4,6($0)
sra $5,$3,14
srav $1,$0,$3
sllv $1,$1,$3
sllv $5,$5,$3
xori $3,$5,14584
lh $4,16($0)
subu $3,$4,$3
sltiu $3,$3,31834
srlv $4,$4,$3
andi $3,$3,50350
ori $3,$6,47873
srlv $1,$4,$3
addu $3,$3,$3
lb $4,3($0)
sltu $3,$5,$3
addiu $4,$1,3018
slt $3,$0,$3
xori $0,$1,39821
sllv $3,$6,$3
subu $2,$2,$3
slti $5,$6,3319
lbu $3,10($0)
addiu $4,$1,26317
srlv $4,$1,$3
slt $1,$5,$3
xor $1,$3,$3
sw $0,8($0)
slt $5,$6,$3
xor $4,$4,$3
lb $3,5($0)
or $3,$4,$3
lb $3,2($0)
subu $1,$1,$3
lb $4,10($0)
or $5,$3,$3
lw $3,16($0)
xor $4,$1,$3
sllv $4,$6,$3
sll $5,$3,31
subu $3,$3,$3
sllv $0,$0,$3
subu $6,$6,$3
xor $4,$3,$3
sltu $3,$4,$3
srav $4,$6,$3
xor $4,$6,$3
or $4,$3,$3
lw $6,4($0)
slt $4,$4,$3
addu $4,$3,$3
sltiu $4,$4,-3850
xori $5,$5,26661
addu $6,$1,$3
srl $1,$1,20
ori $3,$1,17028
addu $3,$0,$3
lh $3,16($0)
slt $1,$1,$3
addu $3,$0,$3
nor $4,$1,$3
ori $5,$0,57295
slti $5,$5,21645
sltiu $3,$4,-9743
sllv $6,$3,$3
sw $3,4($0)
sltiu $1,$4,20739
sltu $3,$4,$3
srav $3,$3,$3
andi $3,$5,20180
sll $4,$3,7
subu $6,$3,$3
ori $4,$4,54836
sb $4,0($0)
andi $3,$1,30165
lw $5,12($0)
addiu $1,$6,28928
xor $5,$3,$3
lh $3,6($0)
sll $4,$0,17
slt $6,$4,$3
addiu $3,$3,16915
and $1,$6,$3
lw $4,4($0)
lb $1,12($0)
and $4,$4,$3
srav $1,$4,$3
sh $0,4($0)
sll $6,$1,29
srlv $1,$3,$3
slt $3,$3,$3
xor $4,$3,$3
lb $5,4($0)
andi $1,$1,18262
srav $4,$4,$3
addiu $5,$5,-11292
lw $4,12($0)
lhu $3,8($0)
srav $4,$4,$3
sh $3,14($0)
lhu $4,12($0)
lhu $3,14($0)
subu $4,$3,$3
sw $5,0($0)
nor $1,$3,$3
sllv $4,$3,$3
subu $4,$3,$3
andi $0,$0,23814
ori $3,$3,23866
and $1,$4,$3
sra $5,$4,27
sw $2,8($0)
sltu $4,$2,$3
or $4,$3,$3
or $0,$4,$3
lhu $4,0($0)
sb $6,6($0)
addu $4,$5,$3
ori $1,$1,19846
sw $3,0($0)
sb $1,5($0)
addu $4,$4,$3
and $4,$4,$3
or $4,$4,$3
lw $4,12($0)
slti $3,$3,24667
sltu $1,$1,$3
sra $4,$0,6
subu $4,$3,$3
lbu $5,10($0)
andi $4,$0,55641
lw $1,0($0)
or $0,$1,$3
lbu $1,12($0)
addu $5,$5,$3
addiu $3,$3,22236
nor $5,$5,$3
lb $4,1($0)
lbu $4,9($0)
lh $3,4($0)
xor $3,$5,$3
subu $3,$3,$3
addu $1,$1,$3
ori $5,$4,12363
lhu $4,14($0)
subu $0,$4,$3
sllv $4,$0,$3
sll $0,$4,31
addu $3,$3,$3
lb $3,9($0)
addu $5,$5,$3
sltiu $1,$1,-967
subu $3,$4,$3
slti $3,$4,-10141
srlv $3,$4,$3
sltu $1,$5,$3
xor $6,$3,$3
addu $4,$4,$3
addiu $1,$4,26087
lw $3,16($0)
sltiu $4,$3,3347
srl $3,$3,5
addu $5,$1,$3
sra $4,$5,16
sltu $3,$3,$3
sw $3,0($0)
sb $0,8($0)
lbu $4,2($0)
addu $1,$1,$3
addiu $5,$4,-7449
or $4,$4,$3
sra $3,$3,0
subu $1,$1,$3
addu $1,$6,$3
sltiu $0,$2,30819
sltiu $1,$1,-9268
srl $5,$1,11
lb $4,16($0)
and $6,$6,$3
xor $3,$3,$3
addiu $3,$6,-18536
subu $3,$3,$3
addiu $0,$0,26901
sw $4,4($0)
sb $3,5($0)
or $3,$1,$3
lbu $1,9($0)
subu $4,$3,$3
lb $6,7($0)
lb $3,7($0)
addiu $4,$1,-331
addiu $6,$3,8280
addiu $1,$4,-16309
slti $1,$1,4315
andi $6,$3,64204
lb $5,13($0)
srlv $5,$5,$3
lb $4,16($0)
ori $4,$0,57722
sra $4,$3,19
or $4,$3,$3
or $3,$3,$3
lh $4,16($0)
nor $5,$4,$3
subu $4,$2,$3
xori $4,$3,24340
lb $3,13($0)
sltu $3,$4,$3
sltu $3,$1,$3
or $5,$1,$3
andi $5,$4,51724
addu $5,$2,$3
sllv $3,$1,$3
xori $3,$1,9984
addiu $6,$3,28494
sltiu $3,$3,25985
addiu $5,$1,-6878
sra $0,$0,6
nor $0,$3,$3
slti $4,$1,17300
lh $3,16($0)
srlv $4,$4,$3
andi $3,$3,3557
lw $4,8($0)
addiu $5,$3,-4114
sb $3,9($0)
sw $4,4($0)
addiu $3,$3,3230
slt $1,$5,$3
addiu $5,$3,27865
slti $0,$5,14054
nor $1,$4,$3
slt $4,$3,$3
xori $3,$0,32336
xori $4,$5,5630
or $0,$3,$3
addiu $3,$2,19587
or $2,$2,$3
nor $6,$3,$3
lh $5,16($0)
lh $3,8($0)
xori $3,$0,11278
subu $5,$5,$3
addu $4,$4,$3
lhu $3,14($0)
xori $1,$1,16924
addu $0,$1,$3
sb $5,15($0)
lh $3,12($0)
sh $3,6($0)
addiu $4,$5,14392
sb $3,11($0)
nor $0,$0,$3
srlv $5,$5,$3
addiu $5,$5,-14227
sltiu $4,$1,-24674
slt $6,$0,$3
ori $4,$5,15022
sw $5,12($0)
sllv $1,$1,$3
addu $4,$3,$3
nor $3,$5,$3
slt $4,$3,$3
lhu $3,14($0)
lbu $5,13($0)
lbu $5,4($0)
addiu $5,$5,-19557
sll $6,$6,31
subu $6,$1,$3
or $1,$6,$3
sh $1,14($0)
sll $2,$2,1
and $1,$3,$3
sll $6,$4,14
sh $0,16($0)
subu $3,$3,$3
sltu $1,$1,$3
lw $3,8($0)
subu $1,$1,$3
sb $1,12($0)
slt $6,$1,$3
sw $3,12($0)
addiu $1,$5,-18802
addu $6,$4,$3
lhu $1,8($0)
lhu $6,2($0)
addiu $3,$3,-22201
or $1,$1,$3
addu $3,$3,$3
lh $3,4($0)
srlv $0,$3,$3
sltu $3,$5,$3
and $4,$0,$3
xor $0,$3,$3
lw $1,8($0)
and $6,$3,$3
sll $4,$4,30
sllv $1,$6,$3
xori $5,$5,43977
lb $0,6($0)
sltiu $5,$6,17867
slti $3,$3,23376
ori $3,$3,25782
nor $5,$5,$3
ori $4,$3,10653
xor $5,$5,$3
addiu $1,$4,-30325
sll $3,$1,30
lbu $0,0($0)
sll $6,$1,13
subu $6,$5,$3
sll $3,$3,28
addu $6,$4,$3
srav $3,$3,$3
addu $4,$2,$3
lw $5,4($0)
sb $4,7($0)
nor $3,$1,$3
srav $3,$5,$3
and $4,$3,$3
andi $1,$5,49932
sra $1,$4,24
slti $1,$3,2496
subu $3,$3,$3
and $5,$3,$3
andi $5,$3,48136
subu $3,$3,$3
slt $1,$1,$3
sw $4,0($0)
andi $6,$6,47110
subu $1,$3,$3
addiu $5,$5,-9304
addiu $4,$3,-30248
srl $0,$3,26
sll $3,$3,25
addiu $6,$6,22124
srl $4,$6,12
addiu $4,$1,-979
srlv $4,$3,$3
srav $3,$1,$3
sb $3,13($0)
subu $3,$3,$3
slti $4,$3,14959
lbu $0,1($0)
sw $1,12($0)
srav $1,$3,$3
srl $3,$5,8
subu $3,$1,$3
sb $3,3($0)
lb $4,5($0)
srav $3,$4,$3
sb $3,8($0)
addu $3,$4,$3
sh $1,0($0)
sll $3,$3,2
lhu $3,8($0)
ori $4,$3,61517
xor $5,$3,$3
sllv $3,$3,$3
addiu $3,$5,-11425
subu $6,$0,$3
srlv $3,$3,$3
lw $3,0($0)
sltu $3,$4,$3
lb $0,0($0)
lb $4,16($0)
srl $3,$3,14
sra $1,$1,1
addiu $3,$3,21683
lh $0,2($0)
srl $4,$5,26
sltu $3,$5,$3
sltu $3,$3,$3
subu $3,$5,$3
addu $3,$0,$3
srav $3,$3,$3
sltiu $1,$1,7731
lh $4,16($0)
sw $5,12($0)
xori $3,$3,15417
addiu $3,$1,-29027
subu $1,$3,$3
subu $6,$6,$3
sll $4,$1,15
slt $5,$2,$3
addu $3,$3,$3
slt $3,$1,$3
addiu $5,$0,10174
srav $3,$1,$3
lh $4,0($0)
nor $5,$4,$3
addu $4,$3,$3
lh $6,6($0)
addu $4,$3,$3
nor $4,$5,$3
addu $0,$4,$3
srav $0,$3,$3
xori $4,$5,50423
andi $5,$3,29286
srlv $0,$5,$3
ori $3,$4,25147
sw $5,4($0)
addu $3,$0,$3
lb $1,13($0)
sllv $0,$0,$3
addiu $3,$4,-25821
lh $3,10($0)
sh $4,10($0)
addu $4,$1,$3
lb $3,13($0)
ori $3,$0,28231
sltiu $3,$3,7593
sb $0,11($0)
sll $1,$4,14
xori $6,$6,56542
sra $3,$5,15
sltu $5,$3,$3
srl $4,$4,11
sllv $1,$3,$3
addiu $4,$1,-21571
addiu $5,$5,-3833
xor $4,$6,$3
andi $1,$1,36040
subu $1,$4,$3
srav $4,$4,$3
lhu $1,16($0)
ori $0,$3,32409
sll $3,$3,0
lw $1,12($0)
subu $4,$4,$3
sltiu $5,$3,-16434
lw $4,4($0)
andi $4,$4,20669
or $3,$3,$3
srlv $1,$1,$3
sltu $3,$3,$3
addu $4,$3,$3
lb $3,13($0)
lw $0,12($0)
subu $6,$6,$3
or $0,$4,$3
sb $5,3($0)
sra $5,$1,10
sh $3,2($0)
xor $5,$5,$3
srlv $3,$3,$3
lb $3,0($0)
nor $3,$5,$3
slt $3,$4,$3
slt $5,$6,$3
addu $5,$4,$3
lhu $4,14($0)
xor $5,$4,$3
srlv $4,$4,$3
or $4,$4,$3
lhu $3,16($0)
sw $3,8($0)
addiu $3,$5,21110
addu $3,$4,$3
srl $3,$0,14
sltiu $3,$3,-27898
lb $1,9($0)
sllv $4,$3,$3
addiu $3,$6,-29607
ori $4,$3,20314
srlv $6,$6,$3
addiu $5,$0,-26391
sb $5,3($0)
addu $3,$1,$3
addu $4,$5,$3
or $3,$3,$3
or $6,$3,$3
slt $1,$2,$3
sll $1,$1,24
sltiu $5,$3,31332
sllv $0,$3,$3
lbu $5,16($0)
sw $3,4($0)
addiu $2,$2,-26909
sw $1,4($0)
srav $6,$1,$3
ori $5,$1,15552
or $5,$5,$3
sb $3,13($0)
xor $4,$4,$3
subu $3,$3,$3
nor $0,$3,$3
sw $6,16($0)
slt $3,$3,$3
lw $4,16($0)
srl $3,$5,19
lbu $2,5($0)
xor $3,$4,$3
addiu $3,$3,-4244
srav $3,$0,$3
sw $4,4($0)
addu $3,$3,$3
addiu $4,$1,29268
lb $3,16($0)
xor $3,$4,$3
lhu $1,12($0)
sh $5,16($0)
sltu $5,$5,$3
sw $5,12($0)
sh $4,16($0)
xor $5,$3,$3
slt $0,$6,$3
andi $4,$0,24459
ori $0,$1,26303
sltu $1,$1,$3
lw $5,0($0)
sra $3,$3,13
sb $5,13($0)
sllv $1,$1,$3
sh $5,4($0)
srl $4,$3,11
addiu $6,$5,8260
lhu $3,12($0)
lw $1,8($0)
slti $3,$5,-19498
slti $3,$3,-20807
addiu $3,$5,-26616
sra $4,$1,16
xori $1,$5,17104
slti $3,$3,-31663
nor $4,$1,$3
subu $4,$4,$3
sb $4,0($0)
addu $3,$4,$3
subu $4,$0,$3
sw $3,0($0)
sb $3,11($0)
ori $3,$1,25178
sltiu $0,$0,-17230
nor $6,$6,$3
addu $3,$1,$3
addu $5,$5,$3
sw $0,12($0)
andi $5,$0,6999
srlv $4,$4,$3
sltiu $4,$6,-20339
sh $6,8($0)
addiu $4,$6,18982
sw $6,8($0)
andi $3,$6,10077
srl $3,$1,5
ori $4,$3,22501
xor $0,$3,$3
sll $1,$5,22
xor $4,$4,$3
lh $3,12($0)
srav $3,$1,$3
slt $3,$3,$3
sra $3,$3,6
srl $4,$0,8
srl $3,$4,30
sltiu $5,$6,23456
slt $4,$3,$3
addiu $3,$3,-30129
sllv $3,$3,$3
ori $3,$3,10468
or $3,$4,$3
subu $5,$5,$3
slti $5,$5,9041
lw $3,0($0)
sra $0,$6,29
lb $3,3($0)
lw $3,16($0)
lhu $4,16($0)
lhu $4,6($0)
ori $3,$1,52195
sb $3,6($0)
addiu $3,$3,9571
sh $4,2($0)
nor $4,$4,$3
andi $4,$5,30261
nor $4,$4,$3
sltiu $5,$0,-4347
lhu $4,8($0)
sra $3,$2,17
sltiu $3,$4,-32234
addiu $4,$4,835
lb $0,7($0)
lb $5,2($0)
lb $3,4($0)
sw $6,0($0)
ori $3,$3,38608
lb $4,4($0)
slti $0,$0,5119
lw $0,4($0)
slti $0,$1,-13887
slt $1,$3,$3
nor $5,$4,$3
and $4,$1,$3
and $4,$3,$3
subu $0,$4,$3
sll $4,$3,11
lbu $4,5($0)
srl $4,$6,0
addiu $4,$3,-14496
srlv $3,$6,$3
slt $5,$6,$3
sll $1,$3,31
srl $4,$3,9
sltiu $3,$0,-16146
subu $4,$3,$3
xori $3,$3,58010
sw $4,16($0)
srav $3,$3,$3
subu $3,$4,$3
addiu $3,$3,20495
andi $3,$3,27837
lb $6,13($0)
nor $3,$6,$3
sw $3,4($0)
andi $3,$3,1153
slt $4,$3,$3
srav $3,$4,$3
sra $5,$3,16
sltu $1,$4,$3
sra $6,$1,6
sllv $1,$3,$3
xori $1,$3,31703
addiu $4,$4,31536
srl $3,$5,12
subu $6,$5,$3
srl $4,$1,27
sltu $3,$3,$3
sb $5,0($0)
sltiu $3,$6,2575
addiu $1,$4,7923
sltu $3,$0,$3
nor $4,$3,$3
sll $3,$3,17
lbu $3,15($0)
sh $0,16($0)
lh $5,4($0)
sb $3,16($0)
or $3,$5,$3
srav $3,$3,$3
xori $4,$4,10176
sll $3,$3,29
xori $3,$3,17865
sltu $1,$1,$3
subu $4,$2,$3
nor $3,$4,$3
nor $0,$0,$3
xori $4,$1,65132
srav $4,$3,$3
sra $5,$0,14
lh $1,2($0)
slti $6,$3,22918
sb $3,0($0)
srav $1,$1,$3
xor $6,$1,$3
lh $1,4($0)
sltiu $1,$5,7357
lw $3,8($0)
lw $5,12($0)
xori $3,$3,25421
srlv $1,$6,$3
xor $1,$1,$3
sll $3,$4,15
sllv $6,$3,$3
sllv $1,$3,$3
sw $1,0($0)
andi $5,$5,1845
sll $3,$0,7
addu $1,$2,$3
sw $4,12($0)
sb $3,6($0)
subu $4,$3,$3
srav $4,$4,$3
sb $4,13($0)
nor $5,$3,$3
or $6,$6,$3
sllv $3,$1,$3
lb $3,10($0)
lhu $3,8($0)
sra $3,$1,14
srav $4,$4,$3
xor $1,$3,$3
addiu $3,$5,-7219
andi $3,$1,22857
srl $4,$6,15
addiu $5,$4,-23999
sw $4,12($0)
sltu $3,$0,$3
subu $4,$4,$3
subu $3,$3,$3
lbu $4,9($0)
or $5,$5,$3
subu $4,$3,$3
lb $5,0($0)
subu $3,$4,$3
srl $3,$3,9
or $3,$6,$3
nor $1,$3,$3
lh $3,4($0)
and $6,$3,$3
sllv $3,$3,$3
srlv $3,$6,$3
srlv $5,$5,$3
lb $1,5($0)
xor $6,$1,$3
sltu $3,$4,$3
sllv $4,$6,$3
addu $6,$5,$3
sltiu $4,$1,-9319
sw $0,8($0)
sltu $5,$3,$3
sltu $3,$3,$3
addiu $3,$3,26482
addu $5,$5,$3
lw $4,12($0)
or $3,$3,$3
ori $4,$2,3319
sltu $6,$1,$3
addu $3,$4,$3
srav $2,$2,$3
nor $5,$3,$3
ori $3,$5,58941
sh $5,0($0)
sw $5,8($0)
or $0,$4,$3
subu $3,$3,$3
lh $6,12($0)
sllv $3,$3,$3
addiu $1,$1,15398
sll $5,$5,20
sltiu $3,$5,12156
sw $5,0($0)
srlv $3,$4,$3
sllv $4,$3,$3
addu $3,$4,$3
srav $4,$4,$3
srav $1,$4,$3
andi $3,$6,37356
sllv $6,$6,$3
srl $4,$4,4
sra $4,$5,14
addu $4,$3,$3
srlv $3,$3,$3
sltiu $3,$4,26566
andi $6,$1,53097
xori $1,$1,19079
nor $4,$0,$3
xori $3,$5,20082
subu $5,$5,$3
sll $6,$4,24
sll $4,$3,6
sra $3,$4,14
addu $3,$3,$3
xor $3,$3,$3
xori $1,$3,42659
subu $3,$3,$3
sw $3,12($0)
or $4,$0,$3
srav $3,$6,$3
sw $1,4($0)
lw $3,16($0)
addiu $1,$5,-17350
xor $0,$0,$3
sb $3,5($0)
lb $1,9($0)
sw $4,16($0)
sllv $3,$3,$3
srlv $1,$4,$3
lh $5,12($0)
srav $4,$4,$3
sllv $3,$1,$3
sltu $5,$4,$3
addu $6,$0,$3
and $1,$5,$3
|
alloy4fun_models/trashltl/models/5/sGMXbF7R3CGJvK29f.als | Kaixi26/org.alloytools.alloy | 0 | 5026 | <filename>alloy4fun_models/trashltl/models/5/sGMXbF7R3CGJvK29f.als<gh_stars>0
open main
pred idsGMXbF7R3CGJvK29f_prop6 {
all t : Trash | always t in Trash
}
pred __repair { idsGMXbF7R3CGJvK29f_prop6 }
check __repair { idsGMXbF7R3CGJvK29f_prop6 <=> prop6o } |
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48_notsx.log_21829_1221.asm | ljhsiun2/medusa | 9 | 104269 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_A+0xb39e, %r8
nop
nop
nop
nop
nop
cmp $22008, %r14
movb $0x51, (%r8)
nop
inc %r10
// REPMOV
lea addresses_normal+0x1d8ee, %rsi
lea addresses_PSE+0x19332, %rdi
clflush (%rdi)
nop
nop
cmp %r14, %r14
mov $103, %rcx
rep movsq
nop
cmp $12958, %r14
// Faulty Load
lea addresses_WT+0x1f9e, %rdi
nop
nop
cmp %rbx, %rbx
movntdqa (%rdi), %xmm2
vpextrq $0, %xmm2, %rsi
lea oracles, %r8
and $0xff, %rsi
shlq $12, %rsi
mov (%r8,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 0, 'type': 'addresses_PSE'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_normal'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT', 'congruent': 0}}
<gen_prepare_buffer>
{'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
*/
|
src/game_logic/logic.asm | jonasbantunes/tictactoe-gb | 0 | 86346 | <reponame>jonasbantunes/tictactoe-gb
SECTION "Game logic", ROM0
PlayerTurn
call TurnOffLCD
call RenderTurnP1
call ShowCursor
call TurnOnLCD
call EnableVBlank
call EnableTimerInt
.lockup
ei
call WaitVblank
di
ld a, [joybuttons]
ld b, a
ld a, [joyhold]
cpl
and a, b
.ifUp
bit PADB_UP, a
jp z, .ifDown
.thenUp
call CursorUp
jp .end
.ifDown
bit PADB_DOWN, a
jp z, .ifLeft
.thenDown
call CursorDown
jp .end
.ifLeft
bit PADB_LEFT, a
jp z, .ifRight
.thenLeft
call CursorLeft
jp .end
.ifRight
bit PADB_RIGHT, a
jp z, .ifA
.thenRight
call CursorRight
jp .end
.ifA
bit PADB_A, a
jp z, .end
.thenA
; call MarkPlayer
; call SendMark
; call ChangePlayer
; jp Decision
jp CheckPlayer
.end
jp .lockup
CheckPlayer:
ld hl, marks
ld d, 0
ld a, [cursor]
ld e, a
add hl, de
.ifNotMarked
ld a, [hl]
and a, a ; cp a, 0
jp nz, .else
.then
call MarkPlayer
call SendMark
call ChangePlayer
jp Decision
.else
jp PlayerTurn
OpponentTurn:
call TurnOffLCD
call RenderTurnP2
call HideCursor
call TurnOnLCD
call DisableTimerInt
call EnableVBlank
call EnableSerial
.lockup
ei
halt
di
.if
ld a, [serial_turn]
cp a, 1 ; check if is the internal clock turn
jp nz, .end
.then
call MarkOpponent
call ChangePlayer
jp Decision
.end
jp .lockup
Decision:
.ifDraw
ld a, [turns_left]
and a, a ; cp a, 0
jp nz, .endDraw
.thenDraw
jp ShowDraw
.endDraw
.ifWinner
call VerifyWinner
ld a, [winner]
and a, a ; cp a, 0
jp z, .endWinner
.thenWinner
call AddWinnerScore
call TurnOffLCD
call UpdateScore
call TurnOnLCD
jp ShowWinner
.endWinner
.ifPlayerTurn:
ld a, [player_turn]
ld b, a
ld a, [player_num]
cp a, b
jp nz, .elsePlayerTurn
.thenPlayerTurn:
jp PlayerTurn
.elsePlayerTurn:
jp OpponentTurn
ShowDraw:
call TurnOffLCD
call HideCursor
call RenderDrawGame
call TurnOnLCD
.lockup
halt
; jp .lockup
jp AwaitConnection
ShowWinner
call TurnOffLCD
call HideCursor
.if
ld a, [player_num]
add a, 1
ld b, a
ld a, [winner]
cp a, b
jp nz, .else
.then
call RenderYouWon
jp .end
.else
call RenderYouLost
.end
call TurnOnLCD
ei
.lockup
halt
; jp .lockup
jp AwaitConnection
AddWinnerScore:
ld hl, scores
ld d, 0
ld a, [winner]
dec a
ld e, a
add hl, de
ld a, [hl]
inc a
ld [hl], a
ret
ChangePlayer:
ld a, [player_turn]
xor a, $01
ld [player_turn], a
ld a, [turns_left]
dec a
ld [turns_left], a
ret
VerifyWinner:
ld c, 0 ; winner
.check123
ld hl, marks
ld a, $03
REPT 3
ld b, [hl]
inc hl
and a, b
ENDR
or a, c
ld c, a
.check456
ld hl, marks+3
ld a, $03
REPT 3
ld b, [hl]
inc hl
and a, b
ENDR
or a, c
ld c, a
.check789
ld hl, marks+6
ld a, $03
REPT 3
ld b, [hl]
inc hl
and a, b
ENDR
or a, c
ld c, a
.check147
ld hl, marks
ld a, $03
REPT 3
ld b, [hl]
inc hl
inc hl
inc hl
and a, b
ENDR
or a, c
ld c, a
.check258
ld hl, marks + 1
ld a, $03
REPT 3
ld b, [hl]
inc hl
inc hl
inc hl
and a, b
ENDR
or a, c
ld c, a
.check369
ld hl, marks + 2
ld a, $03
REPT 3
ld b, [hl]
inc hl
inc hl
inc hl
and a, b
ENDR
or a, c
ld c, a
.check159
ld hl, marks
ld a, $03
REPT 3
ld b, [hl]
inc hl
inc hl
inc hl
inc hl
and a, b
ENDR
or a, c
ld c, a
.check357
ld hl, marks+2
ld a, $03
REPT 3
ld b, [hl]
inc hl
inc hl
and a, b
ENDR
or a, c
ld c, a
.ifWinner
ld a, c
and a, a ; cp a, 0
jp z, .endWinner
.thenWinner
ld hl, winner
ld [hl], a
.endWinner
ret
SetupGame:
ld hl, cursor
ld de, player_num - cursor
.while
ld a, d
or a, e
jp z, .end
.do
ld [hl], 0
inc hl
dec de
jp .while
.end
ld a, 9
ld [turns_left], a
call TurnOffLCD
call RenderGrid
call RenderScore
call UpdateScore
call RenderCursor
call RenderMarks
call TurnOnLCD
ret |
hello.asm | JesusCrie/MoreOrLessAssembly | 4 | 10922 | global main
extern printf
section .text ; code section
main:
lea rdi, qword [hello] ; pointer string
mov eax, 0
call printf
section .rodata ; read only section (constant)
hello db "<NAME>", 0x0a, 0x00 |
examples/can_utils/print_can_frame.ads | glencornell/ada-socketcan | 2 | 28771 | <reponame>glencornell/ada-socketcan<gh_stars>1-10
-- MIT License
--
-- Copyright (c) 2021 <NAME> <<EMAIL>>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
with Sockets.Can_Frame;
procedure Print_Can_Frame (Frame : in Sockets.Can_Frame.Can_Frame; Prefix : in String := "");
-- Print the raw CAN frame to ada.text_io.current_output. The string
-- specified by the parameter "Prefix" is printed out on the same
-- line just before the can frame. Prefix can be anything that you
-- want, but it is recommended that you use the interface name from
-- which the frame was received. Output is in the format similar to
-- the candump utility. Examples:
--
-- vcan0 52 [5] 10 22 9A 69 E4
-- vcan0 4D6 [8] 56 3C 4F 78 23 19 B 4F
-- vcan0 6BD [8] 29 87 AA 2D 26 1B 33 1D
-- vcan0 E [8] 4B F 79 67 60 D0 C0 5
-- vcan0 269 [1] 4A
-- vcan0 DF [2] AF 2
-- vcan0 13E [4] 3A 93 5 58
|
libsrc/_DEVELOPMENT/alloc/obstack/c/sdcc_iy/obstack_alloc_callee.asm | meesokim/z88dk | 0 | 103568 |
; void *obstack_alloc_callee(struct obstack *ob, size_t size)
SECTION code_alloc_obstack
PUBLIC _obstack_alloc_callee
_obstack_alloc_callee:
pop af
pop hl
pop bc
push af
INCLUDE "alloc/obstack/z80/asm_obstack_alloc.asm"
|
Appl/Term/FSM/fsmMakeTables.asm | steakknife/pcgeos | 504 | 12787 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: FSM
FILE: makeTables.asm
AUTHOR: <NAME>, September 18, 1989
METHODS:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
dc 9/18/89 Initial revision.
DESCRIPTION:
Internally callable routines for this module.
$Id: fsmMakeTables.asm,v 1.1 97/04/04 16:56:32 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
;
; THE BACKTRACKING MECHANISM FOR PARSING ESCAPE CODES:
;
; <Background>
; There are functions mapped incorrectly when there are escape
; codes having absolute digit value and there is also a wildcard
; digit character in another escape sequence. The wildcard
; digit characters are forcefully inserted into the character
; table whereas absolute digit character, like any another
; character, will not inserted into the table if it is already
; there. During parsing, the token is searched from top of table
; for the first match So, the order of escape codes makes a
; difference. For example,
;
; \E[%i%d;%i%dH 26
; \E[4h 37
;
; In this case, '4' in the second sequence will not be
; entered. It will use the next state that first sequence
; generates (the one containing %d and ';'). So, \E5h will be
; mapped to 37 because '5' can be found in wildcard digit
; character table. 'h' can also be found in the next state.
;
; \E[4h 37
; \E[%i%d;%i%dH 26
;
; In this order, '4' is entered first and then wildcard
; character will insert 0-9 characters. So, \E[4;1H will never
; be reached because \E[4 already leads to another path. ';'
; will cause a mismismatch.
;
; <SOLUTION>
; (1) One solution is to produce a deterministic finite state
; machine. However, it demands much memory. The memory
; requirement can go exponetial to the number of termcap
; entries. This should be most elegant solution and fastest in
; performance.
;
; *(2) To improve this non-deterministic finite state
; machine. there is a backtracking mechanism once a sequence of
; input escape sequence is not found in the current path. It
; backtracks to try out the next possible match. Conceptually,
; it is like tree search.
;
; Each state has a character table containing characters to
; match by this state. When we find a match, we check to see if
; there is any more matches in the rest of the character
; table. If so, save-state mode is set and we push the current
; state. By pushing state, it means saving the SavedStateDesc
; which contains the pointer to second match, current state and
; token. We then update the pointer to remember this state as
; the starting point for backtracking. For the subsequent
; characters, if there is a match, we continue push states. When
; there is a mismatch in save-state mode, we get the state for
; backtracking and retry matching characters in another path.
;
; Given the above termcap entry order, when we parse '4', we
; push state and remember there is an alternate path. If we have
; 'h' afterwards, we execute the function and delete all saved
; states. If a ';' is followed, it mismatches and
; backtracks. So, it reloads the state and try the path of
; second escape code. It matches and parsing continues from
; there.
;
; While in save-state mode, if there is more than 1 match in
; character table, it recursively performs the search.
;
; <RESTRICTION>
; All the escape codes containing wildcard digit characters must
; be at the end of the termcap file. The idea is to allow those
; with absolute digit to enter to a state's character table
; first.
;
; For information about data structures, please refer to
; fsmConstant.def
;
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SearchCurTable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Do a special search in the current table during
parsing input string
CALLED BY: FSMParseString
PASS: bx - FSM machine token
ds:si - character buffer
es - dgroup
al - current token
ax - current token (for DBCS only)
RETURN: C - clear if token not found
- set if token found
cx - # number of bytes till end of table
dx - # of chars in table
bx:di - 1 char past the matched token in char token
DESTROYED: (ax, bx, ->DoTokenFunction)
SIDE EFFECTS:
If it is doing backtracking, dgroup::numParseChars will be reduced by
1.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/18/89 Initial version
simon 4/22/95 Added backtracking mechanism
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SearchCurTable proc near
uses es, si
.enter
;
; Get the pointer to the start of character buffer
;
mov es, bx ; es -> FSM segment
retryStart:
clr di ; es:di-> FSMBlockHeader
mov di, es:[di].FSM_curHandle
redoSearch:
mov di, es:[di] ; di -> nptr of current state
mov si, di ; si -> nptr of current state
;
; Get # characters in this state
;
mov cl, es:[di] ; cl -> # char in state
clr ch
mov dx, cx ; dx -> # char in state
add di, CHAR_TABLE_OFFSET
; di -> start of char table
cmp {byte} es:[di], CHAR_WILD
jne scan ; any wild card char?
; (inserted when %c is parsed
; in termcap)
inc di ; force the match
clr cx ; indicate end of table
jmp returnMatch
scan:
;
; Search for a match in character table and push state if necessary.
;
call SearchCharTable ; carry clr if not found
; if found,
; cx <- #bytes till EOT
; esdi <- 1 byte past match
jnc noMatch
returnMatch:
stc ; indcate token found
jmp exit
noMatch:
call Backtrack ; carry set if need to reprocess
; current token
jc noRetry
;
; Check FSM state before retry. Important!!!
;
push es, cx
GetResourceSegmentNS dgroup, es
call CheckFSMState ; cx <- destroyed
pop es, cx
jmp retryStart
noRetry:
clc ; indicate token not found
exit:
.leave
ret
SearchCurTable endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SearchCharTable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Search the character table for matching token
CALLED BY: FSMAugmentDesc
PASS: al = token (character to match)
cx = # bytes to search
es:di = starting point of search in table
RETURN: cx = # bytes till the end of table
es:di = byte past the match if MATCH
= byte past the end of table if MISMATCH
carry clear = token not found
carry set = token found
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Search the table for match;
if (match) {
Search the rest of table for next match;
if (match-again) {
PushState;
}
Return match parameters info;
} else {
Return mismatch parameters info;
}
REVISION HISTORY:
Name Date Description
---- ---- -----------
simon 4/26/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SearchCharTable proc near
bytesLeft local word ; store #bytes till end of
; table
pastMatchPtr local nptr ; store ptr past match or EOT
.enter
EC < Assert_okForRepScasb >
;
; Search through the table for match
;
repne scasb ; ZF clear if not match
jne noMatch
mov ss:[bytesLeft], cx
mov ss:[pastMatchPtr], di
jcxz checkForSavedState
;
; Search for the next match
;
; Reason: There is limitation in parsing termcap file that all
; escape codes containing absolute numbers must preceed those
; with wildcard characters (%c, %d...). They are entered in
; the character table first and later by the wildcard
; characters. (See HandleDecParam). Now we try to see if the
; absolute escape code matches. If so, we proceed with it,
; otherwise, we want to backtrack and compare from this state
; again with the next match of the token. -Simon 4/22/95
;
; It reset saved state when:
; * one match found and it's already past the end of table OR
; * one match found and there is no more match in the table
;
repne scasb
jne noNextMatch
call PushState
match:
stc ; indicate token found
mov cx, ss:[bytesLeft]
; restore params to return
mov di, ss:[pastMatchPtr]
jmp exit
noMatch:
clc ; indicate token not found
exit:
.leave
ret
noNextMatch:
checkForSavedState:
;
; We found a match already. But we need to see if we are in
; save-state mode. If so, we push this state also for backtracking
;
BitTest es:[0].FSM_status, FSMSF_SAVE_STATE
jz match ; flag not set, no need to save state
call PushState ; need to save state
jmp match
SearchCharTable endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Backtrack
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Backtrack to last matching state
CALLED BY: SearchCurTable
PASS: es = bx = FSM token (segment)
ds = termcap buffer segment
RETURN: carry clear = new state set, needs reprocessing current
token
carry set = no new state set, no need to reprocess
current token
DESTROYED: nothing
SIDE EFFECTS:
es:[0].FSM_curHandle = new state if match
Saved states may be popped off.
PSEUDO CODE/STRATEGY:
It backtracks to revert to the last state where there is unvisited
branch for parsing. The whole point of having saved state is to
provide a way to backtrack if search of external function or a match
does not occur.
nodePtr = Get the saved state header node pointer;
if (!nodePtr) { // no saved state, no need to
// reprocess current token
return FALSE;
}
return BacktrackFindMatch(nodePtr);
REVISION HISTORY:
Name Date Description
---- ---- -----------
simon 4/30/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Backtrack proc near
uses ax, di
.enter
EC < Assert_segment es >
EC < Assert_segment bx >
;
; Get the pointer to entry saved state
;
mov di, es:[0].FSM_savedStateHandle
mov di, es:[di] ; di <- savedState block
tst es:[di].SSH_numEntries ; any saved state?
jz noMatch
;
; Do the searching and set to the right state
;
mov al, es:[di].SSH_retryEntry
call BacktrackFindMatch ; carry set if found matched
; state
jmp exit ; propagate results back
noMatch:
stc ; indiate no saved state
exit:
.leave
ret
Backtrack endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BacktrackFindMatch
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Backtrack to last matching state
CALLED BY: Backtrack, BacktrackNextSavedState
PASS: es:di = SavedStateHeader
al = entry # to start seearching
RETURN: carry clear = new state set, needs reprocessing current
token
carry set = no new state set, no need to reprocess
current token
DESTROYED: nothing
SIDE EFFECTS:
es:[0].FSM_curHandle = new state if match
Saved states may be popped off.
PSEUDO CODE/STRATEGY:
It backtracks to revert to the last state where there is unvisited
branch for parsing. The whole point of having saved state is to
provide a way to backtrack if search of external function or a match
does not occur.
currentNode = Pointer-to-node;
Match = TRUE;
// Assume the node has reached the end of table
Set current state to node's state pointed by Pointer-to-node;
Get bytes till end of table;
//
// In the second pass to topLoop, the node should be all unparsed
//
topLoop:
Get token to process;
Get Params ready for DoTokenAction;
call DoTokenAction;
// current state already set
Search through the rest of table for current token;
Update the bytes till end of table in SavedStateDesc;
if (end-of-table) {
Find link to previous Pointer-to-node and update
saved state header;
if (can't find previous) {
ResetSavedState
}
return TRUE;
} else {
Update pointer to next saved state desc;
currentNode = this new node;
Find a match in unparsed node;
if (match) {
Update remaining chars to character buffer;
Update the state of saved state desc;
Find the second match;
if (second-match) {
if (!BacktrackFindMatch(currentNode)) {
Match = FALSE;
}
}
} else {
ResetSavedState
return FALSE;
}
GOTO topLoop
}
REVISION HISTORY:
Name Date Description
---- ---- -----------
simon 4/26/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BacktrackFindMatch proc near
savedStateHdrPtr local word push di
; nptr to savedStateHdrPtr
termcapBufPtr local word push si
savedStatePtr local nptr ; nptr to current saved state
entry local word ; current entry # in saved
; state table
firstEntry local word ; nptr to first saved state
; entry to process
uses ds, ax, bx, cx, dx, si, di
.enter
;
; Get the state backtrack init params
;
mov si, di ; si <- saved state hdr
segmov ds, es, bx ; ds <- FSM token
clr ah
add di, offset SSH_states ; di <- begin of saved states
; array
mov ss:[entry], ax ; save entry#
mov ss:[firstEntry], ax
CheckHack <size SavedStateDesc eq 4>
; entry# to begin backtracking
shl ax
shl ax ; offset within saved state
; table
add di, ax ; di <- saved state entry to
; get
segmov es:[0].FSM_curHandle, es:[di].SSD_state, ax
;
; Get character and bytes till end of table
;
mov ss:[savedStatePtr], di
loopStateTop:
EC < call ECCheckSavedStateHeader >
mov di, ss:[savedStatePtr]
mov al, es:[di].SSD_char ; current token
mov cl, es:[di].SSD_searchChar
; cl <- bytes till end of table
call BacktrackGetCharOffset ; cx destroyed
; di<-nptr to byte after match
; dx<-# bytes in table
;
; Process character!!
;
push di, cx, es, bp, ax
GetResourceSegmentNS dgroup, es
push cx
call CheckFSMState ; cx destroyed
pop cx
call DoTokenAction ; carry set if next state
; carry clr if called func
pop di, cx, es, bp, ax
;
; Search for the second match of character and update bytes till end
; of table in SavedStateDesc.
;
repne scasb
mov di, ss:[savedStatePtr]
mov es:[di].SSD_searchChar, cl
;
; Check if any more saved state to process
;
call BacktrackIsEOT ; carry clear if EOT
; ax<-# saved states
jnc endOfTable
;
; More saved state to process
;
call BacktrackNextSavedState ; carry set if no next state
; to process
jc exit
jmp loopStateTop
endOfTable:
;
; No more states to process
;
call BacktrackHandleEOT ; ax, di destroyed
clc ; indicate match
exit:
.leave
ret
BacktrackFindMatch endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BacktrackGetCharOffset
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the offset in the character table
CALLED BY: BacktrackFindMatch
PASS: es = FSM token
cl = bytes till end of table
RETURN: di = if match, nptr to byte after match
dx = # characters in table
cx = bytes till end of table
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Get the offset in character table from current state
REVISION HISTORY:
Name Date Description
---- ---- -----------
simon 5/ 1/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BacktrackGetCharOffset proc near
.enter
mov di, es:[0].FSM_curHandle; di <- new state
clr ch
mov di, es:[di] ; di <- nptr to new state
mov dl, es:[di].SH_numEntries
clr dh ; dx <- # entries in table
add di, CHAR_TABLE_OFFSET ; di <- nptr to begin of char
; table
;
; Calc offset to character table entry from this parsed node
;
add di, dx ; di <- past end of table
sub di, cx ; di <- 1 byte past target
; match
.leave
ret
BacktrackGetCharOffset endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BacktrackNextSavedState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Prepare the next saved state to process
CALLED BY: BacktrackFindMatch
PASS: ss:bp = inherited stack
ds:si = fptr to SavedStateHeader
es:di = fptr to current SavedStateDesc
RETURN: carry set = no next state to process
SavedStateHeader is reset.
DESTROYED: nothing
SIDE EFFECTS:
ss:[entry] is incremented.
ss:[savedStatePtr] updated to next SavedStateDesc
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
simon 5/ 1/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BacktrackNextSavedState proc near
uses ax, bx, cx, dx, si, di
.enter inherit BacktrackFindMatch
EC < Assert_fptr dssi >
EC < Assert_fptr esdi >
;
; Update pointer to next state
;
add di, size SavedStateDesc
inc ss:[entry] ; update current entry #
mov ss:[savedStatePtr], di ; save current entry nptr
;
; Find out if the character is in current state
;
push di
mov al, es:[di].SSD_char ; al <- char to process
mov di, es:[0].FSM_curHandle; di <- lptr of next state
mov di, es:[di] ; di <-nptr to next state
mov cl, es:[di]
clr ch ; cx <- # char
add di, CHAR_TABLE_OFFSET ; di <- start of char table
cmp {byte}es:[di], CHAR_WILD; any wild car char?
je foundWildChar ; inserted when %c termcap
; entry. Carry clear
;
; Do the searching for first match
;
repne scasb ; Find the first match
mov dx, di ; dx <- begin of next search
pop di ; di <- nptr to current saved
; state entry
mov es:[di].SSD_searchChar, cl
jne noMatch
;
; Check for second match
;
mov di, dx ; restore begin of next search
repne scasb ; Find the second match
jne noSecondMatch
;
; Recursively call for match
;
EC < WARNING TERM_MORE_THAN_TWO_MATCHES_IN_BACKTRACK_STATE >
mov di, si ; di<-nptr to SavedStateHeader
mov ax, ss:[entry]
call BacktrackFindMatch ; carry set if no next state
; to process
jc noMatch
noSecondMatch:
clc ; indicate there's next state
jmp exit
noMatch:
;
; No next state to process
;
ResetSavedStateHeader ds, si
stc ; indicate there's no next
; state
exit:
.leave
ret
foundWildChar:
pop di ; restore stack
jmp exit ; carry should be clear
BacktrackNextSavedState endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BacktrackIsEOT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check if this is the end of saved state table
CALLED BY: BacktrackFindMatch
PASS: ss:bp = inherited stack
ds:si = SavedStateHeader
RETURN: ax = # of saved state
carry clear = reached end of saved state table
DESTROYED: nothing
SIDE EFFECTS:
ss:[entry] will be incremented.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
simon 5/ 1/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BacktrackIsEOT proc near
uses bx
.enter inherit BacktrackFindMatch
EC < Assert_fptr dssi >
;
; entry # is zero based. We increment entry# to see if it equals
; table size.
;
mov bx, ss:[entry]
inc bx ; next entry#
mov al, ds:[si].SSH_numEntries
clr ah
cmp bx, ax ; anymore entry? (EOT?)
;
; Carry CLEAR if reached end of saved state table
;
.leave
ret
BacktrackIsEOT endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BacktrackHandleEOT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Search for previous entry in saved state which has
untraversed paths for its character
CALLED BY: BacktrackFindMatch
PASS: ds:si = fptr to SavedStateHeader
es:di = fptr to entry beginning search (it searches down
the stack, i.e., back previous characters)
ss:bp = inherited statck
RETURN: nothing
DESTROYED: ax, di
SIDE EFFECTS:
SavedStateHeader is reset when there is no more state to retry.
PSEUDO CODE/STRATEGY:
Find link to previous Pointer-to-node and update
saved state header;
if (can't find previous) {
ResetSavedState
}
REVISION HISTORY:
Name Date Description
---- ---- -----------
simon 4/27/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BacktrackHandleEOT proc near
.enter inherit BacktrackFindMatch
EC < Assert_fptr dssi >
EC < Assert_fptr esdi >
mov ax, ss:[firstEntry] ; get starting entry#
searchLoop:
;
; Check if it has more untraversed path on its char
;
tst es:[di].SSD_searchChar ; any bytes till EOT?
jz checkPrevious ; yes, move forward
;
; If this state still has more character to parse, set it to next
; retry.
;
mov ds:[si].SSH_retryEntry, al
segmov ds:[si].SSD_state, es:[0].FSM_curHandle, ax
jmp exit
checkPrevious:
;
; Check to see if the entry is already the top
;
tst ax ; top entry? (entry 0 is top)
jz reset ; no need to do anything
;
; Update pointer to previous state
;
sub di, size SavedStateDesc
dec ax ; update entry #
jmp searchLoop
reset:
;
; Reset SavedStateHeader since there's no more state to retry
;
ResetSavedStateHeader ds, si
exit:
.leave
ret
BacktrackHandleEOT endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PushState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Save the state info for backtracking of a token
CALLED BY: SearchCharTable
PASS: es = segment of FSM token
cl = # chars left in table unmatched
al = current token (character to parse)
RETURN: carry set if saved state table is full
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Get the stack chunk;
if (state stack is full) {
Return error;
} else {
Push the state;
Increment the saved state count;
}
REVISION HISTORY:
Name Date Description
---- ---- -----------
simon 4/22/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PushState proc near
uses bx, bp
.enter
;
; Get the stack chunk
;
mov bp, es:[0].FSM_savedStateHandle
mov bp, es:[bp] ; es:bp <- beginning of chunk
;
; Test if we have reached max saved state
;
mov bl, es:[bp].SSH_numEntries
cmp bl, es:[bp].SSH_maxEntries
; saved state table full?
jge error
;
; Get pointer to new entry
;
push bp ; save character
add bp, offset SSH_states
CheckHack <size SavedStateDesc eq 4>
clr bh
shl bx
shl bx ; offset within saved state
; table
add bp, bx ; bp <- nptr to new entry
;
; Assign saved state info
;
segmov es:[bp].SSD_state, es:[0].FSM_curHandle, bx
mov es:[bp].SSD_char, al
mov es:[bp].SSD_searchChar, cl
;
; Increment the entry count
;
pop bp ; bp <- beginning of saved
; state block
jcxz succeed
;
; Set this state to be the one to backtrack first and retry. That
; means if the match doesn't succeed, it'll backtrack up to this
; state and retry with the rest of the matches.
;
segmov es:[bp].SSH_retryEntry, es:[bp].SSH_numEntries, bl
; # is zero bassed
succeed:
inc es:[bp].SSH_numEntries ; update counter
;
; In save state mode, so push state there after
;
BitSet es:[0].FSM_status, FSMSF_SAVE_STATE
clc ; indicate success
exit:
.leave
ret
error:
EC < WARNING TERM_SAVED_STATE_TABLE_FULL >
stc
jmp exit
PushState endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ResetSavedState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reset the saved state
CALLED BY: DoTokenFunction
PASS: ds = FSM token
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
simon 4/27/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ResetSavedState proc near
uses di
.enter
;
; Get pointer to saved state header
;
mov di, ds:[0].FSM_savedStateHandle
mov di, ds:[di] ; di <- begin of saved state
; blk
ResetSavedStateHeader ds, di
.leave
ret
ResetSavedState endp
if ERROR_CHECK
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckSavedStateHeader
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Verify the saved state header
CALLED BY: GLOBAL
PASS: es = FSM token (FSM segment)
RETURN: nothing
DESTROYED: nothing (flags destroyed)
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
simon 5/ 2/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECCheckSavedStateHeader proc near
uses ax, di
.enter
;
; Get the pointer to saved state header first
;
mov di, es:[0].FSM_savedStateHandle
mov di, es:[di] ; di<-nptr to SavedStateHeader
;
; Check the max entries number
;
cmp es:[di].SSH_maxEntries, INIT_NUM_SAVED_STATES
; max# entries messed up?
ERROR_NE TERM_INVALID_SAVED_STATE_HEADER
;
; Verify this:
; SSH_maxEntries >= SSH_numEntries > SSH_retryEntry
;
mov al, es:[di].SSH_maxEntries
cmp al, es:[di].SSH_numEntries
jge checkRetryEntry
ERROR TERM_INVALID_SAVED_STATE_HEADER
checkRetryEntry:
mov al, es:[di].SSH_numEntries
cmp al, es:[di].SSH_retryEntry
jg headerOK
ERROR TERM_INVALID_SAVED_STATE_HEADER
headerOK:
.leave
ret
ECCheckSavedStateHeader endp
endif ; if ERROR_CHECK
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AddTokenToTable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Add a token to the state's character table
CALLED BY: SetExternalFunc, SetNextState, SetInternalFunc
PASS: al - current token
es - dgroup
bx - FSM machine token
ds - character buffer
RETURN: ---
DESTROYED: bp, di
PSEUDO CODE/STRATEGY:
get the current state
check size
if not enough room
make room (realloc) the state
add token
shift functions down
add token to character table
update the size
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/15/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AddTokenToTable proc near
push ds, si, cx ;don't trash buffer pointer
mov ds, bx ;get FSM segment
clr bp ;
mov si, ds:[bp].FSM_curHandle ;get current handle
mov si, ds:[si] ;dereference the handle
mov di, si ;copy pointer to start of chunk
mov cl, ds:[di] ;get the cur size of the table
tst cl ;is the table empty?
jz ATT_add ;yes, add token
inc di
mov ch, ds:[di] ;get the max size of the table
cmp cl, ch ;is there room for token
jl ATT_ok ;yes
;no, make room, Realloc chunk
push ax ;save the token
mov al, ch ;current size =
mov ch, TABLE_ENTRY_SIZE ;max entry * entry size
mul ch
mov cx, ax
add cx, EXPAND_STATE_SIZE ;add this many more bytes
mov ax, ds:[bp].FSM_curHandle ;get handle of current state
call LMemReAlloc ; and resize the chunk
mov es:[fsmBlockSeg], ds ;LMem heap may have moved
mov bx, ds ; store new fsm segment
mov si, ds:[bp].FSM_curHandle ;dereference the handle
mov si, ds:[si] ; again
mov di, si ;copy pointer to local chunk
inc di
add {byte} ds:[di], ADD_TABLE_ENTRIES ;update max # of entries
pop ax ;restore the token
ATT_ok:
push es, si
segmov es, ds, cx ;make ds point to es
clr ch
mov cl, ds:[si] ;get number of entries to move
add si, CHAR_TABLE_OFFSET ;offset to start of table
add si, cx ;offset to end of char table
shl cl, 1 ;offset into function table
add si, cx ;es:si -> end of function table
mov di, si ;es:di -> end of function table
dec si ;es:si -> last byte in table
std ;set direction flag
rep movsb
cld ;clear direction flag
pop es, si
ATT_add: ;add the token to the table
mov di, si ;
add di, CHAR_TABLE_OFFSET ;get to start of table entries
clr ch
mov cl, ds:[si]
add di, cx ;offset to end of table
mov {byte} ds:[di], al ; and stick it in
inc {byte} ds:[si] ;increment num entries
ATT_ret:
pop ds, si, cx ;restore this segs and regs
ret
AddTokenToTable endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
StoreActionWord
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Store the action word into the current table
CALLED BY: SetExternalFunc, SetInternalFunc, HandleDecParam
PASS: bx - FSM machine token
es - dgroup
dx - action word to store
RETURN: ---
DESTROYED: di, bp
PSEUDO CODE/STRATEGY:
get the current state and
offset to last entry in action table
store the action word (ptr to an action descriptor)
if the least significant bit is 0 - handle to next state
1 - ptr to descriptor
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/20/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
StoreActionWord proc near
push ds, cx ;don't trash buffer pointer
mov ds, bx ;get FSM segment
clr bp ;
clr ch
mov di, ds:[bp].FSM_curHandle ;get current handle
mov di, ds:[di] ;dereference the handle
mov cl, ds:[di] ;get the cur size of the table
add di, CHAR_TABLE_OFFSET ;beginning of char table
add di, cx ;offset to last entry in char
;
; char table size is always 1 more than that in func table. So we
; need to subtract 1 to get to the last entry of func table where we
; store the function.
;
dec cl
shl cl, 1 ;get offset into func table, ;each func table entry is 2 ;byte wide
add di, cx ;point to last entry in func
;table
mov ds:[di], dx ;store the action word
pop ds, cx
ret
StoreActionWord endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetNextState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Token not in table, so add the token and set up next state
CALLED BY: FSMAugmentDesc
PASS: bx - FSM machine token
al - current token
ds:si - termcap buffer
es - dgroup
RETURN: ---
DESTROYED: cx, dx, bp, di
PSEUDO CODE/STRATEGY:
add token to table
create a new state
set action word of token to point to new state
set curState to state just created
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/15/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetNextState proc near
push ds
call AddTokenToTable
call MakeNewState
mov dx, ax ;
call StoreActionWord ;store handle to next state
clr bp
mov ds:[bp].FSM_curHandle, ax ;current state is next state
pop ds
ret
SetNextState endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MakeNewState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: make an empty state
CALLED BY: CreateNextState, HandleDecParam
PASS: bx - FSM machine token
es - dgroup
RETURN: ax - LMem chunk handle
bx - FSM machine token
ds - fsm segment
DESTROYED: cx, bp
PSEUDO CODE/STRATEGY:
Allocate an LMem chunk and
initialize the num entry and max entries field
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/22/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MakeNewState proc near
mov ds, bx ;ds -> FSM segment
mov cx, INIT_LOCAL_STATE_SIZE ;set size of new chunk
clr al ;no heap flags
call LMemAlloc ;get memory for new state
mov es:[fsmBlockSeg], ds ;fsm segment may have changed
mov bx, ds ; (so update variables)
mov bp, ax ;copy the state handle
mov bp, ds:[bp] ;dereference handle and store
InitStateHeader ds, bp
;
; Make sure the character table for the state doesn't begin with
; CHAR_WILD, as SearchCurTable looks at that before looking to
; see if the current number of entries is 0. The problem is when
; building up the state machine, if the first char happens to be
; CHAR_WILD when the state is actually empty, FSMAugmentDesc thinks
; the entry exists and executes the function, running off into
; nowhere (especially if the application thread has placed termStatus
; ON_LINE)...
;
mov {char}ds:[bp+CHAR_TABLE_OFFSET], 0; make sure this
; doesn't hold CHAR_WILD, as
; that can really screw us up
; when building things up
ret
MakeNewState endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DoTokenAction
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Process the token's action word, either go to next state or call function
CALLED BY: FSMAugmentDesc, FSMParseString
PASS: al - current token
bx - FSM machine token
cx - number of bytes till end of table
dx - number of entries in table
ds - termcap buffer segment
es - dgroup
bx:di - one past the matched character entry
RETURN: C - set if set next state
- clear if called function
DESTROYED: cx, dx, di
PSEUDO CODE/STRATEGY:
token may be next state (low bit 0) or
offset into actionChunk (low bit 1)
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/15/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DoTokenAction proc near
push es
call GetActionWord
test cx, AD_FLAG ;is it the next state or a desc?
jz DTA_nextState ;it's an LMemHandle (state)
and cx, CLEAR_AD_FLAG ;its an action descriptor
pop es
cmp es:[termStatus], OFF_LINE ; if off line skip calling
je 10$ ; screen object
call DoTokenFunction ;process it
10$:
jmp short DTA_ret
DTA_nextState:
clr di ;current state is token's next state
mov es:[di].FSM_curHandle, cx
stc ;signal gone to next state
pop es
DTA_ret:
ret
DoTokenAction endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetActionWord
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get action word of a state table entry
CALLED BY: DoTokenAction, HandleDecParam
PASS: al - current token
bx - FSM machine token/segment
cx - number of bytes till end of table
dx - number of entries in table
ds - termcap buffer segment
bx:di - one past the matched character entry
RETURN: cx - action word for that entry
es - fsm segment
DESTROYED: di, dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 10/03/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetActionWord proc near
mov es, bx
add di, cx ;go to start of action table
sub dl, cl ;get table entry of token
dec dl ; (entry 1 is offset 0)
shl dl, 1 ;calculate offset in action table
; (dh already nuked out)
add di, dx ;point to the action word
mov cx, es:[di] ; and fetch it
ret
GetActionWord endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DoTokenFunction
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: process action descriptor
CALLED BY: DoTokenAction
PASS: al - current token
bx - FSM machine token
cx - action descriptor (holds offset into action chunk)
es - dgroup
RETURN: C - set if set next state
- clear if called function
DESTROYED: ---
PSEUDO CODE/STRATEGY:
**** when building the finite state tables this routine will
never be called ***
- get the action descriptor
If INTERNAL function
call (function)
set next state to be current state
If EXTERNAL function
ProcCallMod (function) ** CAN'T USE CALL MOD **
set up arguments
set next state to be ground state
KNOWN BUGS/SIDE EFFECTS/IDEAS:
FSMFunction table may not be built up correctly for modules
other than Screen Module.
Could move the check for unparesed characters to section right
before we cal an EXTERNAL function.
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/20/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DoTokenFunction proc near
uses ds, si, di, ax, bx, bp
.enter
RSP < push cx, dx, si ; save them, don't trash>
;
; In Responder, we want to reduce the number of messages of saving
; and restoring international character. Therefore, we only do so if
; necessary. That means we only save and restore international
; characters (by sending MSG_SCR_SAVE/RESTORE_INTL_CHAR) only if the
; screen needs to be updatd via UpdateScreen or "ext" VT100 escape
; functions. Otherwise, if it only performs internal function, like
; converting number string to actual number, it doesn't save and
; restore international character at all.
;
; The way to tell if we have saved an international is by pushing 0
; or -1 on stack
; 0: intl char not saved. -1: has intl char saved
;
; So, we don't end up saving international character twice or not
; restoring the character after saving.
;
RSP < clr dx >
RSP < push dx >
tst es:[unParseNum] ;before calling function
jle DTF_callFunc ;empty out the 'callback' bufer
;
; In Responder, we need to indicate we save an int'l character
;
RSP < pop dx ; restore stack >
RSP < mov dx, -1 ; use message >
RSP < push dx ; re-insert signal >
RSP < call FSMSaveIntlChar >
GetResourceSegmentNS dgroup, ds
call StoreUnParsedChars
call UpdateScreen ;update screen before call func
DTF_callFunc:
mov ds, bx ;get FSM segment
clr di ;
mov bp, ds:[di].FSM_actionHandle ;
mov bp, ds:[bp] ;ds:bp ->action chunk
add bp, cx ;offset to desired descriptor
push ds:[bp].FD_nextState ;get the next state and save it
cmp ds:[bp].FD_internalFunc, NO_FUNC;call an internal func ?
je DTF_ext ;nope
DTF_int:
call ds:[bp].FD_internalFunc ;yep
cmp ds:[bp].FD_externalFunc, NO_FUNC;call an external function?
jne DTF_ext ;yes
clr di ;no, pt to FSM header
RSP < pop ds:[di].FSM_curHandle ;set the next state >
RSP < pop cx ; cx = Intlchar signal >
RSP < jcxz noIntlCharSaved >
RSP < call FSMRestoreIntlChar >
RSP < noIntlCharSaved: >
stc ;set internal func flag
jmp short DTF_ret
DTF_ext:
;
; Check the stack to see if we have saved int'l character already
;
RSP < mov si, sp >
RSP < inc si >
RSP < inc si ; ss:si = IntlChar signal>
RSP < tst {word}ss:[si] ; don't save if already saved>
RSP < jnz intlCharSaved >
RSP < mov {word} ss:[si], -1 >
RSP < call FSMSaveIntlChar >
RSP < intlCharSaved: >
call ResetSavedState ; reset saved state
call LoadArgs ;EXTERNAL-load the arguments
mov ax, ds:[bp].FD_externalFunc ;load method
if EXTRA_EC ;=============================================================
push di, es
GetResourceSegmentNS dgroup, es, ax
tst es:[funcPtr]
jnz haveStart
wrapAround:
mov di, offset funcBuf
mov es:[funcPtr], di
haveStart:
mov di, es:[funcPtr]
cmp di, ((offset funcBuf) + 100)
jae wrapAround
stosw
mov es:[funcPtr], di
pop di, es
endif ;=====================================================================
mov bx, es:[termuiHandle]
CallScreenObj
xor di, di ;clears C flag and DI
RSP < pop ds:[di].FSM_curHandle ;set the next state >
RSP < pop cx ; cx = IntlChar signal >
RSP < jcxz DTF_ret ; jmp if needn't restore>
RSP < call FSMRestoreIntlChar >
RSP < clc ; return success >
DTF_ret:
NRSP < pop ds:[di].FSM_curHandle ;set the next state >
RSP < pop cx, dx, si ; restore them >
.leave
ret
DoTokenFunction endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LoadArgs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Load the registers with required arguments
CALLED BY: DoTokenFunction
PASS: bx - FSM machine token
es - dgroup
ds:bp - action descriptor
RETURN: cx, dx - set with arguments for function
ax - (Responder only) number of arguments for function
DESTROYED: ---
PSEUDO CODE/STRATEGY:
first - fourth arg ch, cl, dh, dl
KNOWN BUGS/SIDE EFFECTS/IDEAS:
Can't put arguments in ax, bx cause CallMod trashes these
registers. Can only use cx, and dx to pass args to function
If assume that cx, dx are byte sized then can get four
arguments
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/26/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LoadArgs proc near
push bp, si, bx
add bp, offset AD_argumentDesc ;offset to our arg descriptor
mov si, offset argArray ;es:si-> arg array
clr bh ;byte sized args
mov bl, ds:[bp] ;get argument index
cmp bl , ARG_NOT_USED ;is the argument valid
je LA_check2nd ;no,
mov ch, es:[si+bx] ;get argument value
add ch, ds:[bp+1] ;and adjust it
LA_check2nd:
add bp, 2 ;point to next argument field
mov bl, ds:[bp]
cmp bl, ARG_NOT_USED
je LA_ret
mov cl, es:[si+bx] ;get argument
add cl, ds:[bp+1] ;and adjust it
LA_ret:
pop bp, si, bx
ret
LoadArgs endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: set up a pointer to action descriptor stored in action chunk
CALLED BY: FSMAugmentDesc, HandleIncrementParam
PASS: bx - FSM machine token
bx:[curHandle] - handle to current state
es - dgroup
es:[fileEnd] - points to end of buffer
es:[fileHead] - points to place to read from buffer
ds - buffer segment
RETURN: AL token to parse
C set if done parsing buffer
Z set if token is last in current terminal sequence
DESTROYED: al, si
PSEUDO CODE/STRATEGY:
if (curToken is '/' junk)
Process the escaped chars
if (curToken is '%' junk)
UpdateACSize()
Expand the parameters
KNOWN BUGS/SIDE EFFECTS/IDEAS:
** all the subsequent routines have to update fileHead **
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/14/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetToken proc near
mov si, es:[fileHead] ;get ptr to place to read
cmp si, es:[fileEnd] ;are we at end of file
jge GT_fileDone
mov al, ds:[si] ;get token
call CheckToken ;sets return flags for
mov es:[curToken], al ;store current token
inc si ;point to next token
mov es:[fileHead], si ;update file ptr
cmp {byte} ds:[si], END_OF_SEQ ;set C if at end of sequence
clc ;not at end of file
jmp short GT_ret ; FSMAugment
GT_fileDone:
stc ;flag that file done
GT_ret: ;FSMAugment looks at C and Z
ret ; flag
GetToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check If token is part of escaped character e.g. '\' or '^'
CALLED BY: GetToken
PASS: al - token to check
ds:*si - token to check
es - dgroup
bx - FSM token
RETURN: es:[fileHead] - points to place to read from next
es:[curToken] - token to process
al - token to process
ds:si - points to next token to process
DESTROYED: cl
PSEUDO CODE/STRATEGY:
If token is '^' make next character a control char
if token is '/' then process the following escaped chars
if token is '%' then update up argument descriptors
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/14/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckToken proc near
cmp al, "^" ;is it a control char
je CT_ctrl ;
cmp al, "\\" ;is it escape sequence
je CT_esc
cmp al, "%" ;is it parameter flag
je CT_param
jmp short CT_ret ;done checking
CT_ctrl:
inc si ;yes, get the next char
mov al, ds:[si] ;and make it a ctrl char
and al, CTRL_MASK
jmp short CT_ret
CT_esc:
call HandleEscape ;handle escaped characters
jmp short CT_ret
CT_param:
call HandleParam
CT_ret:
ret
CheckToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HandleEscape
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Process Escaped characters
CALLED BY: CheckToken
PASS: bx - FSM machine token
ds:si - points to beginning of escape sequence
RETURN: al - token to process
ah - ffh (if invalid escape sequence)
0 (if token valid)
es - dgroup
es:[inputBase] - set to current number format
DESTROYED: cl
PSEUDO CODE/STRATEGY:
Convert the following escape sequence to their ascii value
\b Backspace (ASCII 8)
\e or \E Escape (ASCII 27, decimal)
\f Formfeed (ASCII 10)
\n Newline (ASCII 10)
\r Carriage return (ASCII 13)
\t Tab (ASCII 9)
\\ Backslash itself
\x<n> Character whose value is <n>, base 16
\<n> Character whose value is <n>, base 8
\[...\] Characters in the range given between the brackets. The
range is specified in standard UNIX character range form,
i.e. a character by itself indicates just that character;
a string like 0-9 indicates the characters from 0 to 9,
inclusive; a ^ at the start of the class causes a match
for all characters not in the range. If - is to be
included, it should be the first character in the class.
\% Following argument to be used in CASE function
d A string of digits. First non-digit ends
argument.
c A hex value
KNOWN BUGS/SIDE EFFECTS/IDEAS:
Since I'm comparing around 10 characters perhaps i should
try to make some type of table coversion?
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/14/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HandleEscape proc near
inc si
mov al, ds:[si] ;get character to convert
cmp al, "e" ;check for escape
je HE_esc
cmp al, "E" ;check for Escape
je HE_esc
cmp al, "n" ;check for newline
je HE_n
cmp al, "r" ;check for carriage return
je HE_r
cmp al, "t" ;check for tab
je HE_t
cmp al, "b" ;check for backspace
je HE_bs
cmp al, "f" ;check for form feed
je HE_f
cmp al, "x" ;check for hex value
je HE_x
cmp al, "%"
je HE_param
mov es:[inputBase], OCTAL ;set octal number base
mov cl, al ;(pass token to check)
push ax, bx ;save char and FSM tokens
CallMod CheckIfNum
pop ax, bx
jc HE_error
call ConvOctalNumber
mov es:[inputBase], DECIMAL ;reset number base back to dec
mov al, dl ;pass octal value
jmp short HE_done
HE_esc:
mov al, CHAR_ESC
jmp short HE_done
HE_n:
mov al, CHAR_NL
jmp short HE_done
HE_r:
mov al, CHAR_CR
jmp short HE_done
HE_t:
mov al, CHAR_TAB
jmp short HE_done
HE_bs:
mov al, CHAR_BS
jmp short HE_done
HE_f:
mov al, CHAR_FF
jmp short HE_done
HE_x:
mov es:[inputBase], HEX ;set input number format
call SetInternalFunc ;tell FSM to process number
jmp short HE_done
HE_param:
inc si
mov al, ds:[si] ;get number format
cmp al, "d" ;if not decimal then error
jne HE_error
mov es:[inputBase], DECIMAL ;set input format to decimal
call SetCaseFunc
jmp short HE_done
HE_error:
mov ah, 0ffh ;signal error
jmp short HE_ret ;leave SI pointing at error char
HE_done:
clr ah ;signal token okay
HE_ret:
ret
HandleEscape endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HandleParam
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: handle parameter specification in description file
CALLED BY: CheckToken
PASS: bx - FSM machine token
ds:*si - token to check
al - token to check
es - dgroup
RETURN: al - next token to process
ds:si - points to this token
DESTROYED: ---
PSEUDO CODE/STRATEGY:
%d - A string of digits. First non-digit ends argument
(setup up internal function to convert Ascii numbers
to hex value)
%c - a single character whose value is stored as argument
%+x - add x to value, then do %
%i - decrement the value by one
%r - reverse order of next two parameters
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/19/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HandleParam proc near
cmp es:[initAD], TRUE ;arg desc initialized?
je HP_ok ;yes
call InitArgDesc ;no
HP_ok:
inc si
mov al, ds:[si] ;get paramter type
cmp al, "c" ;is it a charater
je HP_c ;no, flag error
cmp al, "d" ;is it decimal format
je HP_d ;yes, do it
cmp al, "i"
je HP_i
cmp al, "+"
je HP_offset
jmp short HP_error ;error no match
HP_c:
call HandleCharParam
jmp short HP_done
HP_d:
call HandleDecParam
jmp short HP_done
HP_i:
call HandleIncrementParam ;processed '%i'
jmp short HP_done
HP_offset:
call HandleOffset ;process '%+x'
HP_done:
mov es:[addToken], FALSE ;set flag that token
;shouldn't be added to table
HP_error:
HP_ret:
ret
HandleParam endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HandleCharParam
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle a character parameter
CALLED BY: HandleParam
PASS: bx - FSM machine token
ds:*si - token to check
es - dgroup
RETURN: ---
DESTROYED: ---
PSEUDO CODE/STRATEGY:
Set a state that matches any token
set internal function to store the next token value.
(increment argument index)
creates a new state
sets next state to be this new state
**** To indicate that this state maps all tokens either have
a wildcard token (*) or make size of table entries 255.
Have to modify SearchCurTable to do the right thing,
**** Another hack in the code is to handle the string
'cm=%+ %+ :'in the /etc/termcap file.
Currently the way the parser works is I get a token
then I check to see if the token needs to be processed
(i.e. escape or control chars need to be converted), if
the token is part of a paramter string then I process
that parameter string and return the next character
as the character to be processed. So if '%dm' was a
sequence and the token '%' was passed to CheckToken()
then the parser would process '%d' invisibly and return
'm' as the token to handle next. The parser would
notice that 'm' was the end of the sequence and set
up for an external function to be called. Well with
%+ %+ which I expanded in my termcap file to be
'%+ %c%+ %c' When my CheckToken routine is passed the
first '%' I'll process all four arguments before
returning. Well the problem is that when handling
the '%c' I add a '*' to the table, create a new state,
and set the next state to be this new state that I
created. To make a long story longer, I don't correctly
detect end of sequence when you have a %sequnce as the
last token in the sequence. My hack is that when i know
KNOWN BUGS/SIDE EFFECTS/IDEAS:
We needlessly create states that won't be used.
For example, the sequence %c%c. When processing
the first '%c' we create a state that will be used
to process the next '%c'. When processing the second
'%c' we also create another state, this state won't
be used and is a waste. If we know that we won't
ever get more than (2) %c is a row then can set
flags not to create the extra states.
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/20/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HandleCharParam proc near
push ds, si ;save ptr into char buffer
mov al, CHAR_WILD ;add wildcard character
call AddTokenToTable
mov dx, es:[curACoffset] ; get ptr to action descriptor
or dx, AD_FLAG ; flag that its a func desc
call StoreActionWord ; and store it in state table
mov ds, bx ;now fill in action block
clr bp
mov bp, ds:[bp].FSM_actionHandle ;ds:bp -> LMem handle
mov bp, ds:[bp] ;ds:bp -> Lmem chunk
mov si, es:[curACoffset] ; (store ptr to curent AD)
add bp, si ;ds:bp -> current action desc
mov cx, offset cs:GetChar ;point to get char routine
mov ds:[bp].FD_internalFunc, cx ;set internal func ptr
call MakeNewState
clr bp ; (FSM block may have moved)
mov bp, ds:[bp].FSM_actionHandle ; (So dereference it again)
mov bp, ds:[bp]
add bp, si
mov ds:[bp].FD_nextState, ax ;store next state for this func
clr si
mov ds:[si].FSM_curHandle, ax ;current state is next state
cmp es:[initAD], TRUE ;is the argument descriptor
je HCP_ADok ; initialized?
call InitArgDesc ;no
HCP_ADok:
mov si, es:[argNum] ;update the argument descriptor
mov bp, offset argumentDesc ;calculate index into arg struct
shl si, 1 ;
mov cx, es:[argNum] ;store the argument number
mov {byte} es:[bp+si], cl ;
inc es:[argNum] ;increment argument count
mov es:[reuseAD], TRUE ;if this is last token want
mov dl, INTERNAL ; to reuse this action desc
call UpdateACSize ;point to next action desc
pop ds, si ;restore file ptr
ret
HandleCharParam endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetChar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: store the current token in the argument array
CALLED BY: DoTokenFunction
PASS: bx - FSM machine token
es - dgroup
al - token
RETURN:
DESTROYED: ---
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 11/06/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetChar proc near
mov di, offset argArray
add di, es:[argNum] ;index into argument array
mov {byte} es:[di], al ;and store current token
inc es:[argNum]
ret
GetChar endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HandleDecParam
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle decimal parameter
PASS: bx - FSM machine token
ds:si - file buffer
es - dgroup
dl - function type
RETURN: ---
DESTROYED: dl
PSEUDO CODE/STRATEGY:
Create a new state
Two Ways :
1) Have all tokens map to a common internal function
Internal function checks
if character is a number
CalcNumber
Else
Create a new state
make new state cur state
2)
Add entries 0-9 to this table
make action word point to internal function : CalcNumber
any non-digit gets added to this table just like normal
To properly handle '%d' we create two state, first state is a first
digit state. It only has entries for 0-9. The action word for these
tokens is to go to another state that has also has tokens 0-9.
The action words for these tokens is to call CalcNumber routine.
Non-digits would be handled in this second state.
If tokens 0-9 already in table then don't try to add them again,
just go to their next state.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
Is it okay to increment argument index here?
We're adding ten token sequentially. Is this slow ? cauz we're
shifting all the time? Do something smarter like add the ten
char tokens to the table first then add the ten action words ?
** could expand this to HandleNumParam, so could be used to
process octal, and hex numbers, LATER **
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/20/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HandleDecParam proc near
push ds, si ;save file ptr
;
; Enter 0-9 into character table if the wildcard digits have not been
; entered.
;
HDP_topLoop:
;
; Test if wildcard digit has been entered in this state. If so, skip.
;
mov ds, bx
mov bp, ds:[0].FSM_curHandle ; bp <- lptr of current state
mov bp, ds:[bp] ; dsbp<-fptr to state chunk
cmp ds:[bp].SH_wildcardDigitAction, NULL_ACTION
LONG jne HDP_alreadyInserted ; already there, skip!
mov al, "0"
HDP_notFound:
mov cx, 10 ;create entries to get first #
mov dx, es:[curACoffset] ;store ptr to internal function
mov ds:[bp].SH_wildcardDigitAction, dx
; offset to action table
or dx, AD_FLAG ;
HDP_loop:
call AddTokenToTable ;add tokens 0-9 to tabke
call StoreActionWord ;store func desc to calc # routine
inc al
loop HDP_loop ;
mov ds, bx ;now update the function
;descriptor
clr bp ; beginning
mov bp, ds:[bp].FSM_actionHandle ;ds:bp -> LMem handle
mov bp, ds:[bp] ;ds:bp -> Lmem chunk
mov si, es:[curACoffset] ; (store ptr to curent AD)
add bp, si ;ds:bp -> current action desc
mov cx, offset cs:CalcNumber ;
mov ds:[bp].FD_internalFunc, cx ;flag internal func called
mov es:[reuseAD], TRUE ;if this is last token want
mov dl, INTERNAL ;to reuse it
call UpdateACSize ;point to next action desc
cmp es:[secondState],TRUE ;now fill in the next state
je HDP_secondPass ;the next state for the first state
call MakeNewState ;points to a new state
clr bp ; (FSM block may have moved)
;ignore FUNCTION TYPE
mov bp, ds:[bp].FSM_actionHandle ; (So dereference it again)
mov bp, ds:[bp]
add bp, si
mov ds:[bp].FD_nextState, ax ;
clr si ;new state is the current state.
mov ds:[si].FSM_curHandle, ax ;
mov es:[secondState],TRUE ;set flag to process next state
jmp HDP_topLoop
HDP_secondPass: ;the next state for the second
mov es:[secondState], FALSE ;reset flag
clr si
mov ax, ds:[si].FSM_curHandle ;current state is next state
mov ds:[bp].FD_nextState, ax ;for the internal functions
HDP_skip:
;Do argument descriptor stuff
cmp es:[initAD], TRUE ;is the argument descriptor
je HDP_ADok ; initialized?
call InitArgDesc ;no
HDP_ADok:
mov si, es:[argNum] ;update the argument descriptor
mov bp, offset argumentDesc ;calculate index into arg struct
shl si, 1 ;
mov cx, es:[argNum] ;store the argument number
mov {byte} es:[bp+si], cl ;
inc es:[argNum] ;increment argument count
pop ds, si ;restore file ptr
ret
HDP_alreadyInserted:
;
; The wildcard digits 0-9 has already been inserted. Now we move to
; that next state. Since %d means 1 or more digits, it actually
; points the next state which also has 0-9 wildcard digits.Since it
; recursively points to itself, we want to set this as the next
; state.
;
mov bp, ds:[bp].SH_wildcardDigitAction
; bp <- offset to action table
EC < push bp >
EC < and bp, AD_FLAG >
EC < ERROR_NZ -1 ; action stored should be pure offset to action table>
EC < pop bp >
mov di, ds:[0].FSM_actionHandle ; di <- action table lptr
mov di, ds:[di] ; di <- begin of action table
add di, bp ; di <- action table of
; wildcard digit
segmov ds:[0].FSM_curHandle, ds:[di].FD_nextState, bp
; update the current state
jmp HDP_skip
HandleDecParam endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HandleOffset
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Update offset field of argument descriptor
CALLED BY: HandleParam
PASS: bx - FSM machine token
ds:*si+1 - token to check
es - dgroup
RETURN: ---
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 10/31/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HandleOffset proc near
inc si
mov al, ds:[si] ;get offset amount
cmp al, "\\"
jne HO_char
inc si ;point to octal #
call ConvOctalNumber
jmp short HO_ret
HO_char:
mov dl, al ;move token
HO_ret:
call UpdateArgOffset
ret
HandleOffset endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HandleIncrementParam
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the argument adjust field
CALLED BY: HandleParam
PASS: bx - FSM machine token
es - dgroup
RETURN: ---
DESTROYED: bp, cx
PSEUDO CODE/STRATEGY:
Set the current argument's adjust field to decrement one.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/20/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HandleIncrementParam proc near
mov dl, 1
call UpdateArgOffset
ret
HandleIncrementParam endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UpdateArgOffset
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY:
PASS: bx - FSM machine token
es - dgroup
dl - amount to set the argument offset to
RETURN:
DESTROYED: bp, cx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 11/01/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UpdateArgOffset proc near
push si
mov si, es:[argNum] ;get argument #
mov bp, offset argumentDesc ;calculate index into arg struct
shl si, 1 ; si<-the right argument
inc si ;point to adjust field
;(constant)
neg dl ;negate the offset
mov {byte} es:[bp+si], dl ;
pop si
ret
UpdateArgOffset endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CalcNumber
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: calculate binary value of ascii string
CALLED BY: FSMCreate
PASS: bx - FSM machine token
es - dgroup
al - token to convert
RETURN: ---
DESTROYED: ---
PSEUDO CODE/STRATEGY:
If inNumFlag is FALSE (weren't previously in internal routine)
inNumFlag = TRUE
get new index to store number
clear out number counter
convert token passed
Else
convert token passed
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This function is just like ConvertDecNumber
should merge them, do it LATER ? :=)
* only handles decimals *
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/20/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CalcNumber proc near
EC < cmp es:[argNum], MAX_EMULATION_ARG >
EC < ERROR_AE TERM_MAX_EMULATION_ARGUMENT_EXCEEDED >
cmp es:[inNumFlag], TRUE
je CN_ok
mov es:[inNumFlag], TRUE ;set up function junk
mov di, offset argArray
add di, es:[argNum] ;index into array to store number
mov {byte} es:[di], 0 ;and clear it
CN_ok:
mov ch, al ;save the token
mov di, offset argArray
add di, es:[argNum]
mov al, es:[di]
mov cl, DECIMAL_BASE
mul cl ;shift number over
sub ch, "0" ;get tokens numeric value
add al, ch ;add it to the number
mov {byte} es:[di], al ;stuff in new value
CN_ret:
ret
CalcNumber endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetExternalFunc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set function to call for current token entry
CALLED BY: FSMAugmentDesc
PASS: ds:si - points to function to call
al - current token
es - dgroup
bx - FSM machine token
RETURN: ds:si - beginning of next line
DESTROYED: cx, dx, bp
PSEUDO CODE/STRATEGY:
add current token to table
get function to call
set the function to call
set next state to ground state
KNOWN BUGS/SIDE EFFECTS/IDEAS:
When dealing with terminal sequences that use parameters
may on occasion add bogus tokens to a table that will
never be reached. For example, cm='\EY%+ %c%+ %c 1'
When finishing processing the last %c, we point to a new
table. When SetExternalFunc gets called, we're pointing
to a bogus table, and we'll shove bogus tokens into it,
but we don't care cause all we want to do is set the
the previous AD up correctly.
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/15/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetExternalFunc proc near
push ds, es ;save buffer segment
call AddTokenToTable ;store token
mov dx, es:[curACoffset] ;store ptr to action descriptor
or dx, AD_FLAG ;
call StoreActionWord ;
call SkipWhiteSpace
mov ds, bx ;ds -> FSM segment
clr bp
push ds:[bp].FSM_groundHandle ;save the ground state
mov bp, ds:[bp].FSM_actionHandle ;ds:[bp] -> LMem handle
mov bp, ds:[bp] ;ds:[bp] -> Lmem chunk
cmp es:[reuseAD], TRUE ;hack: reuse previous AD?
jne 10$ ;nope
call ReusePrevAD
10$:
add bp, es:[curACoffset] ;ds:[bp] -> current action desc
pop ds:[bp].FD_nextState ;next state for func
; is ground state
cmp es:[initAD], TRUE ;arg descriptor initialized?
je SEF_ADok ;yes
call InitArgDesc ;no, default to no arguments
SEF_ADok: ;copy the arg desc into
call CopyArgDesc ; into the action desc
mov es:[inputBase], DECIMAL ;functions are in decimal
call GetFunction ; cx = method to call
mov ds:[bp].FD_externalFunc, cx ;store method number
mov dl, EXTERNAL
call UpdateACSize ;point to next AD in chunk
mov es:[initAD], FALSE ;action descriptor not initialized
clr es:[argNum] ;nuke the argument count
clr bp
mov cx, ds:[bp].FSM_groundHandle ;set the current state
mov ds:[bp].FSM_curHandle, cx ; to be ground state
SEF_ret:
pop ds, es
ret
SetExternalFunc endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CopyArgDesc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy the argument structure into the action descriptor
CALLED BY: SetExternalFunc
PASS: bx - FSM machine token
es - dgroup
ds - FSM segment
ds:bp - top of our current action descriptor
RETURN: ---
DESTROYED: cx, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/20/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CopyArgDesc proc near
push es, ds, si
mov di, bp ;di top of action desc
add di, offset AD_argumentDesc ;ds:di -> arg descriptor
mov si, ds ;swap es, ds
segmov ds, es, cx
mov es, si
mov si, offset argumentDesc ;es:si -> idata arg
; array
mov cx, size argumentDesc ;ds:si -> idata array
EC < Assert_okForRepMovsb >
shr cx ;cx <- #words to copy
rep movsw ;es:di -> action desc
pop es, ds, si
ret
CopyArgDesc endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InitArgDesc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: initialize the argument descriptor
CALLED BY: SetExternalFunc
PASS: es - dgroup
RETURN: es:[initAD] - set TRUE
DESTROYED: cx, di
PSEUDO CODE/STRATEGY:
Get current AD
Set all registers to be not used
set all arguments to be not adjusted
KNOWN BUGS/SIDE EFFECTS/IDEAS:
Should I use a 'stos' in the IAD_loop to make it faster
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/19/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
InitArgDesc proc near
mov di, offset argumentDesc ;get ptr to structure
mov cx, MAX_EMULATION_ARG
IAD_loop:
mov {byte} es:[di], ARG_NOT_USED ;flag register not used
inc di
mov {byte} es:[di], NO_ADJUST ;set argument adjust value
inc di
loop IAD_loop
IAD_ret:
mov es:[initAD], TRUE
ret
InitArgDesc endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UpdateACSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Updates the number of action descriptors
CALLED BY: SetExternalFunction, HandleParameter
PASS: bx - FSM machine token
es - dgroup
dl - function type (INTERNAL, EXTERNAL)
ds - FSM segment
RETURN: ds - FSM segment
DESTROYED: ax, cx
PSEUDO CODE/STRATEGY:
if not enough room for another AD
realloc the action chunk
update the max AD count
update the size info for the descriptor just
allocated either function or action descriptor.
The program will always assume that es:[curACoffset]
reflects ptr to space for action/function descriptor
Wheneve the action chunk is updated, we check
to ensure that there's room for another action/function
descriptor.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/18/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UpdateACSize proc near
push si, bp
mov ds, bx ;get FSM segment
clr si
mov cx, es:[curACoffset] ;get current size of Action chunk
cmp cx, es:[maxACsize] ;is there room for another AD
jl CrAD_ok
mov ax, ACTION_DESC_SIZE ;calculate size of AD table
shl ax, 1
add ax, EXPAND_ACTION_SIZE ;increase table by this much
add cx, ax
mov ax, ds:[si].FSM_actionHandle ;get the action handle
call LMemReAlloc ; resize this chunk
mov es:[fsmBlockSeg], ds ;LMem heap may have moved
mov bx, ds ; so update copies
add es:[maxACsize], EXPAND_ACTION_SIZE
;update the new max size
CrAD_ok:
cmp dl, EXTERNAL
je CrAD_ext
mov cx, FUNC_DESC_SIZE ;internal function
jmp short CrAD_ret
CrAD_ext:
mov cx, ACTION_DESC_SIZE ;external function
CrAD_ret:
add es:[curACoffset], cx ;point to next desc in chunk
mov bp, ds:[si].FSM_actionHandle
mov bp, ds:[bp] ;dereference block handle
add bp, es:[curACoffset] ;offset to current chunk
mov ds:[bp].FD_internalFunc, NO_FUNC;default no internal funcs
mov ds:[bp].FD_externalFunc, NO_FUNC;default no external funcs
pop si, bp
ret
UpdateACSize endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetInternalFunc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the action word to point to an internal func
CALLED BY: HandleEscape, HandleParam
PASS: bx - FSM machine token
RETURN: ---
DESTROYED: ---
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/15/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetInternalFunc proc near
;
; *** STUB ***
;
ret
SetInternalFunc endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetCaseFunc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set function descriptor to handle a CASE argument
CALLED BY: HandleEscape
PASS: bx - FSM machine token
es - dgroup
ds:si - pointing into termcap buffer
al - token just read ('d')
RETURN: ---
DESTROYED: ---
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/20/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetCaseFunc proc near
;
; *** STUB ***
;
ret
SetCaseFunc endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SkipWhiteSpace
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: advance pointer past all the non printable chars
CALLED BY: FSMAugmentDesc
PASS: es - dgroup
ds:si - white space to skip
RETURN: ds:si - points to first non Printable char
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
Everything below a space is considered unprintable.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
May not have to update [fileHead]
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/15/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SkipWhiteSpace proc near
SWS_loop:
cmp {byte} ds:[si], CHAR_SPACE ;if char have value > space
jg SWS_ret ;assume its printable
inc si
jmp short SWS_loop
SWS_ret:
ret
SkipWhiteSpace endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetFunction
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get function to call from termcap buffer
CALLED BY: SetExternalFunc
PASS: bx - FSM machine token
es - dgroup
ds - FSM segment
ds:bp - top of our current action descriptor
es:[termSeg] - segment of terminal buffer
termSeg:si - points at function specifier
RETURN: cx - function to call (method #)
ds:si - points to beginning of next line
DESTROYED: ---
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
** should use string search routine to match funtion names
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/15/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetFunction proc near
push ds
mov ds, es:[termSeg]
push bx ;save FSM token
CallMod ConvertDecNumber ;ds:si -> beginning of function
pop bx
cmp ax, ERROR_FLAG ;get function index to call
mov cx, 0 ; hack - in case of error,
; use bell function?
; (preserve flags)
; (brianc 10/1/90)
je GF_exit
shl ax, 1 ;calculate offset into table
cmp ax, FSM_FUNCTION_TABLE_SIZE ; if non-existent func,
WARNING_AE TERM_FUNCTION_NOT_SUPPORTED
jae GF_exit ; bail
mov di, offset FSMFunctionTable ;get the function to call
add di, ax ;offset into the table
GF_eoln:
inc si ;check for eoln
cmp {byte} ds:[si], CHAR_NL
je GF_ret
jmp short GF_eoln
GF_ret:
inc si ;advance file ptr pass newline
mov es:[fileHead], si ;es:si -> start of next sequence
mov cx, cs:[di] ; return method number
GF_exit:
pop ds
ret
GetFunction endp
;
; This table is important in figuring what index escape codes map to.
; Beware of the conditional compilation messing up with number
; seqeunce.
;
FSMFunctionTable label word
dw MSG_SCR_SOUND_BELL ;func 0
dw MSG_SCR_CURSOR_LEFT ;func 1
dw MSG_SCR_TAB ;func 2
dw MSG_SCR_CURSOR_DOWN_OR_SCROLL ;func 3
dw MSG_SCR_CR ;func 4
dw MSG_SCR_SCROLL_DOWN ;func 5
dw MSG_SCR_UP_ARROW ;func 6
dw MSG_SCR_DOWN_ARROW ;func 7
dw MSG_SCR_RIGHT_ARROW ;func 8
dw MSG_SCR_LEFT_ARROW ;func 9
dw MSG_SCR_FUNC_1 ;func 10
dw MSG_SCR_FUNC_2 ;func 11
dw MSG_SCR_FUNC_3 ;func 12
dw MSG_SCR_FUNC_4 ;func 13
dw MSG_SCR_CLEAR_HOME_CURSOR ;func 14
dw MSG_SCR_APPLICATION_KEYPAD ;func 15
dw MSG_SCR_NUMERIC_KEYPAD ;func 16
dw MSG_SCR_CURSOR_UP_UNCONSTRAINED ;func 17
dw MSG_SCR_CURSOR_RIGHT ;func 18
dw MSG_SCR_HOME_CURSOR ;func 19
dw MSG_SCR_CLEAR_TO_END_DISP ;func 20
dw MSG_SCR_CLEAR_TO_END_LINE ;func 21
dw MSG_SCR_NORMAL_MODE ;func 22
dw MSG_SCR_SAVE_CURSOR ;func 23
dw MSG_SCR_RESTORE_CURSOR ;func 24
dw MSG_SCR_CHANGE_SCROLLREG ;func 25
dw MSG_SCR_REL_CURSOR_MOVE ;func 26
dw MSG_SCR_BOLD_ON ;func 27
dw MSG_SCR_UNDERSCORE_ON ;func 28
dw MSG_SCR_BLINK_ON ;func 29
dw MSG_SCR_REV_ON ;func 30
dw MSG_SCR_INS_LINE ;func 31
dw MSG_SCR_BACK_TAB ;func 32
dw MSG_SCR_DEL_LINE ;func 33
dw MSG_SCR_DEL_CHAR ;func 34
dw MSG_SCR_INS_CHAR ;func 35
dw MSG_SCR_GO_STATUS_COL ;func 36
dw MSG_SCR_ENTER_INS_MODE ;func 37
dw MSG_SCR_EXIT_INS_MODE ;func 38
dw MSG_SCR_SCROLL_UP ;func 39
dw MSG_SCR_TERM_INIT ;func 40
dw MSG_SCR_SANE_RESET ;func 41
dw MSG_SCR_GRAPHICS_ON ;func 42
dw MSG_SCR_SET_ROW ;func 43
dw MSG_SCR_SET_COL ;func 44
dw MSG_SCR_UNDERSCORE_OFF ;func 45
dw MSG_SCR_REV_OFF ;func 46
dw MSG_SCR_SET_TAB ;func 47
dw MSG_SCR_CLEAR_TAB ;func 48
dw MSG_SCR_VISUAL_BELL ;func 49
dw MSG_SCR_CURSOR_DOWN_OR_SCROLL_N ;func 50
dw MSG_SCR_CURSOR_LEFT_N ;func 51
dw MSG_SCR_CURSOR_RIGHT_N ;func 52
dw MSG_SCR_CURSOR_UP_N_UNCONSTRAINED ;func 53
dw MSG_SCR_CURSOR_OFF ;func 54
dw MSG_SCR_CURSOR_ON ;func 55
dw MSG_SCR_IGNORE_ESC_SEQ ;func 56
dw MSG_SCR_RESPOND_WHAT_ARE_YOU ;func 57
dw MSG_SCR_RESET_SCROLLREG ;func 58
dw MSG_SCR_RENEW_GRAPHICS_ON ;func 59
dw MSG_SCR_RENEW_SCROLL_REG_BOTTOM ;func 60
if _CHAR_SET
dw MSG_SCR_SELECT_G0 ;func 61
dw MSG_SCR_SELECT_G1 ;func 62
dw MSG_SCR_G0_SELECT_USASCII ;func 63
dw MSG_SCR_G0_SELECT_GRAPHICS ;func 64
dw MSG_SCR_G1_SELECT_USASCII ;func 65
dw MSG_SCR_G1_SELECT_GRAPHICS ;func 66
else
dw MSG_SCR_IGNORE_ESC_SEQ ;func 61
dw MSG_SCR_IGNORE_ESC_SEQ ;func 62
dw MSG_SCR_IGNORE_ESC_SEQ ;func 63
dw MSG_SCR_IGNORE_ESC_SEQ ;func 64
dw MSG_SCR_IGNORE_ESC_SEQ ;func 65
dw MSG_SCR_IGNORE_ESC_SEQ ;func 66
endif
dw MSG_SCR_RESPOND_CURSOR_POSITION ;func 67
dw MSG_SCR_RESPOND_STATUS ;func 68
dw MSG_SCR_CLEAR_TO_BEG_LINE ;func 69
dw MSG_SCR_CLEAR_TO_BEG_DISP ;func 70
dw MSG_SCR_CLEAR_LINE ;func 71
dw MSG_SCR_CURSOR_DOWN ;func 72
dw MSG_SCR_CURSOR_UP_OR_SCROLL ;func 73
dw MSG_SCR_CURSOR_DOWN_N ;func 74
dw MSG_SCR_CURSOR_UP ;func 75
dw MSG_SCR_CURSOR_UP_N ;func 76
dw MSG_SCR_NEXT_LINE ;func 77
dw MSG_SCR_RESET_MODE ;func 78
dw MSG_SCR_SET_MODE ;func 79
dw MSG_SCR_LF ;func 80
FSM_FUNCTION_TABLE_SIZE equ ($-(offset FSMFunctionTable))
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ConvertOctalNumber
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Converts octal ascii number to a hex value
CALLED BY: GetFunction
PASS: ds:si - beginning of string
RETURN: dl - binary value of octal number
si - pointing to end of octal number
DESTROYED: cx
PSEUDO CODE/STRATEGY:
For each character
get value curChar - "0"
multiply current number by 10
add in value
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 01/30/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ConvOctalNumber proc near
mov cl, 2
clr dh
mov dl, ds:[si] ;get first octal number
sub dl, '0' ;convert to binary value
HO_oct:
inc si
mov al, ds:[si] ;get number
sub al, '0'
shl dl, 1 ;shift over octal digit
shl dl, 1 ;
shl dl, 1 ;
add dl, al
loop HO_oct
cmp dl, 128 ;termcap entry said it send
jne HO_ret ;\200, but actually sent NULLs
mov dl, CHAR_NULL
HO_ret:
ret
ConvOctalNumber endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSMInit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: initialize the FSM variables
CALLED BY: FSMCreate
PASS: ax - FSM segment
es - dgroup
RETURN: ---
DESTROYED: cx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/20/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSMInit proc near
mov cl, FALSE
mov es:[initAD], cl ;action descriptor uninitialized
mov es:[inNumFlag], cl ;not in an internal routine
mov es:[secondState], cl ;second state flag is reset
mov es:[inParse], cl ;not in parsed state
clr cx
mov es:[curACoffset], cx ;clear ptr into action chunk
mov es:[argNum], cx ;no arguments stored
mov es:[inputBase], DECIMAL
ret
FSMInit endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckFSMState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: check the fsm state
CALLED BY: FSMParseString, SearchCurTable
PASS: al - current token
es - dgroup
ds:si - points at token
RETURN: ---
DESTROYED: cx
PSEUDO CODE/STRATEGY:
if we were in an internal function (like to calculate numbers
then we want to turn off this flag at the
next non-digit character). So we'll do that here.
Check if we were in one of our internal routines
update argument index accordingly
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/26/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckFSMState proc near
cmp es:[inNumFlag], FALSE ;were we in an internal func?
je CS_ret ;nope,
mov cl, al ;get token to check
push ax, bx ;save char and FSM tokens
CallMod CheckIfNum ;is this token numeric?
pop ax, bx
jnc CS_ret ;yes, pass to internal func
mov es:[inNumFlag], FALSE ;no, reset flag
cmp es:[argNum], MAX_EMULATION_ARG ;don't increase arg when max
jae CS_ret ; is reached
inc es:[argNum] ;advance argument index
CS_ret:
ret
CheckFSMState endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
StoreUnParsedChars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy unrecognized chars into call back buffer
CALLED BY: FSMParseString
PASS: bx - FSM machine token
es - dgroup
ds - char buffer segment (dgroup)
es:[unParseNum] - number of chars to copy
es:[unParseStart] - ptr to where to copy from
es:[unParseBufHead] - ptr to where to copy to
RETURN: es:[unParseStart] - pts to first char after sequence
es:[unParseBufHead] - pts to after the copied sequence
DESTROYED: dx, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
Depend on fact that ds, es same cause buffer is in dgroup
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/29/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
StoreUnParsedChars proc near
EC < call ECCheckDS_ES_dgroup >
push ds, si, cx
mov cx, es:[unParseNum] ;if no chars to copy exit
jcxz SUPC_ret
add es:[unParseBufNum], cx ;update # chars in buffer
mov si, es:[unParseStart] ;ds:si-> ptr to src
if EXTRA_EC ;=============================================================
EC < call ECCheckDS_ES_dgroup >
push ax, cx, si, di
tst ds:[crapPtr]
jnz haveStart
wrapAround:
mov ax, offset crapBuf
mov ds:[crapPtr], ax
haveStart:
mov di, ds:[crapPtr]
mov ax, di
add ax, cx
add ax, cx
cmp ax, ((offset crapBuf) + AUX_BUF_SIZE)
jae wrapAround
rep movsw ; append to crapBuf
mov ds:[crapPtr], di
pop ax, cx, si, di
endif ;=====================================================================
mov di, es:[unParseBufHead] ;es:di-> ptr to dest
cmp si, di
jne SUPC_rep ;if src != dest do the copy
add si, es:[unParseNum] ;else just skip the copy
DBCS < add si, es:[unParseNum] ;char offset -> byte offset>
add di, es:[unParseNum] ; and advance the ptrs
DBCS < add di, es:[unParseNum] ;char offset -> byte offset>
jmp short SUPC_update ; past the chars
SUPC_rep:
push es
segmov es, ds, dx ;es->packet buffer
SBCS < rep movsb ;copy the characters >
DBCS < rep movsw ;copy the characters >
pop es ;restore es to dgroup
SUPC_update:
mov es:[unParseStart], si ;update src pointer
mov es:[unParseBufHead], di ;update dest pointer
clr es:[unParseNum] ;clear num of chars to copy into buf
SUPC_ret:
pop ds, si, cx
ret
StoreUnParsedChars endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UpdateScreen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Pass the unrecognized chars to the screen object
CALLED BY: FSMParseString, DoTokenFunction
PASS: ds, es - dgroup
ds:[fileHead] = offset to start of buffer in [auxBuf].
ds:[unParseBufNum] = number of characters to display
THIS IS OLD:
bx - FSM machine token
al - current character token
ds:bp - current action description
RETURN: ds, es, ax, bx, cx = same
ds:[fileHead] = advanced past buffer of chars
ds:[unParseBufNum] = 0
DESTROYED: dx, bp, si, di
PSEUDO CODE/STRATEGY:
If no chars to print then don't call screen object
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 09/29/89 Initial version
Eric 9/24/90 Since we are sending a method to another
thread, it is a bad idea to pass a pointer
into [auxBuf]. I will send on stack or in
a block on the heap instead.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UpdateScreen proc near
EC < call ECCheckDS_ES_dgroup >
push ds, ax, bx, cx
;decide whether to pass characters on the stack, or using a
;block on the global heap
mov si, es:[fileHead] ;set ds:si = start of buffer of chars
mov dx, es:[unParseBufNum] ;pass #chars in buffer
;
; Don't ever pass 0 characters on to the rest of the app,
; as there is lots of code that assumes a non-0 length
; buffer.
;
tst dx
jz finishUp
cmp dx, MAX_NUM_CHARS_PASSED_ON_STACK
jg passAsBlock
passOnStack:
ForceRef passOnStack
;we can pass this data on the stack (ObjMessage will transfer data
;to other thread's stack)
; ds:si = buffer of characters
; dx = size of buffer
EC < mov ax, 0xED ;place a dummy char on stack >
EC < push ax >
;
; For reason why these EC code of stack data ID is disabled, see
; comments in ScreenData::readFromStack
;
if ERROR_CHECK
push es:[fsmStackDataID] ;push ID # for this method
inc es:[fsmStackDataID] ;prepare for next
endif
mov cx, dx ;set cx = number of characters
DBCS < shl dx, 1 ;# chars -> # bytes >
sub sp, dx ;make room for data on stack
segmov es, ss, bx ;set es:di = destination on stack
mov di, sp
mov bp, sp ;must pass ss:bp = data on stack
SBCS < rep movsb ;move data to stack >
DBCS < rep movsw ;move data to stack >
;pass dx = number of bytes passed on stack
;pass cx = 0 (meaning data passed on stack)
;pass ss:bp = data on stack
EC < tst cx >
EC < ERROR_NZ TERM_ERROR >
;
; For reason why these EC code of stack data ID is disabled, see
; comments in ScreenData::readFromStack
;
EC < add dx, 2 ;allow room for ID >
;
; Responder: scrDisplaySem semaphore is needed for prevent messing
; with local echo of international characters
;
NRSP < mov ax, MSG_SCR_DATA >
RSP < mov ax, MSG_SCR_DISPLAY_DATA_FROM_REMOTE >
mov bx, ds:[termuiHandle] ;set ^lbx:si = screen object
mov si, offset screenObject
if _MODEM_STATUS
mov di, mask MF_FORCE_QUEUE or mask MF_STACK
else
mov di, mask MF_CALL or mask MF_STACK
endif
call ObjMessage ;DOES NOT TRASH DX!
add sp, dx ;clean up stack
EC < pop ax ;make sure stack is lined up again>
EC < cmp ax, 0xED >
EC < ERROR_NE TERM_ERROR >
segmov es, ds, ax ;restore es = ds (may have changed)
jmp short finishUp
passAsBlock:
;we have too many characters to pass on the stack; stuff them into
;a block on the global heap. This block will later be freed when
;the characters are read out of it.
; ds:si = buffer of characters
; dx = size of buffer (# chars)
mov ax, dx ;pass ax = size of block to allocate
DBCS < shl ax, 1 ;# chars -> # bytes >
mov cx, ((mask HAF_LOCK or mask HAF_NO_ERR) shl 8) or \
mask HF_SWAPABLE
;allocate a swappable block and lock it
call MemAlloc ;returns bx = handle, ax = segment
mov es, ax ;set es:di = block
clr di
mov cx, dx ;cx = number of chars to copy
SBCS < rep movsb ;move data to block >
DBCS < rep movsw ;move data to block >
call MemUnlock ;unlock block so can move on heap
DBCS < shl dx, 1 ;# chars -> # bytes >
;pass dx = number of bytes passed in block
;pass cx = handle of block
mov cx, bx ;set cx = handle
NRSP < mov ax, MSG_SCR_DATA >
RSP < mov ax, MSG_SCR_DISPLAY_DATA_FROM_REMOTE >
mov bx, ds:[termuiHandle] ;set ^lbx:si = screen object
mov si, offset screenObject
if not _TELNET
if _MODEM_STATUS
;
; When we send modem command, it can echo back. At this point,
; TermClass is waiting for serial thread's response. So, we don't
; want to block here and use FORCE_QUEUE instead. However, we don't
; want to have allocate so many data blocks and force queue before
; ScreenClass can consume. So, we want to keep it a call to
; ScreenData after connection.
;
BitTest ds:[statusFlags], TSF_SERIAL_MAY_BLOCK
jnz callDataDisplay
mov di, mask MF_FORCE_QUEUE
jmp sendDataDisplay
callDataDisplay:
endif ; _MODEM_STATUS
endif ; !_TELNET
mov di, mask MF_CALL
sendDataDisplay::
call ObjMessage ;DOES NOT TRASH DX!
segmov es, ds, ax ;restore es = ds (may have changed)
finishUp:
mov cx, es:[unParseBufNum]
DBCS < shl cx, 1 ;char offset -> byte offset >
add es:[fileHead], cx ;advance file ptr
clr es:[unParseBufNum]
pop ds, ax, bx, cx
ret
UpdateScreen endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSMParseStrInit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Init variables used for parsing strings
CALLED BY: FSMParseDesc
PASS: es - dgroup
RETURN: ---
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 10/26/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSMParseStrInit proc near
uses ax, cx, di
.enter
mov es:[fsmLocked], FALSE ;initially fsm block not locked
mov es:[inNumFlag], FALSE ;initially not parsing num
clr es:[argNum]
;
; Initialize argArray to zeros
;
CheckHack <DEFAULT_ARGARRAY_ARG_VALUE eq 0>
clr al ; default arg value is zero
mov cx, size argArray
mov di, offset argArray
rep stosb ; zero off argArray
.leave
ret
FSMParseStrInit endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReusePrevAD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: reuse the previous action desc
CALLED BY: SetExternalFunc
PASS: es - dgroup
RETURN: ---
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 11/16/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReusePrevAD proc near
sub es:[curACoffset], FUNC_DESC_SIZE
ret
ReusePrevAD endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ProcessFlags
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check the termcap file for boolean flags to set
CALLED BY: FSMAugmentDesc
PASS: bx - FSM machine token
bx:curHandle - handle to current state
es - dgroup
es:[fileEnd] - points to end of buffer
es:[fileHead] - points to place to read from buffer
ds - buffer segment
RETURN: ---
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 01/29/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ProcessFlags proc near
push bx ;save fsmToken
call InitFlags
call GetFlags
pop bx
ret
ProcessFlags endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetFlags
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check the termcap file for boolean flags to set
CALLED BY: FSMAugmentDesc
PASS: bx - FSM machine token
bx:curHandle - handle to current state
es - dgroup
es:[fileEnd] - points to end of buffer
es:[fileHead] - points to place to read from buffer
ds - buffer segment
RETURN: ---
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 01/29/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetFlags proc near
cmp {byte}ds:[si], START_FLAG ;set boolean flags?
jne exit ;nope
getFlag:
inc si ;point to start of flag
mov ax, ds:[si] ;get flag to scan for
xchg ah, al
mov cx, FSMFlagTableEnd-FSMFlagTable;get length of table
push es
segmov es, cs ; es:di = flag table
mov di, offset FSMFlagTable
repne scasw ;scan for boolean flag
pop es
jz next ;flag not found
;di points one past found entry
; so get offset from start of
; table of entry
sub di, offset FSMFlagTable+(FLAG_SIZE*2)
; start of table
add di, offset FSMFlagMethodTable
mov dh, TRUE
mov ax, cs:[di] ; ax = method for flag found
push si
mov bx, es:[termuiHandle]
CallScreenObj
pop si
next:
add si, FLAG_SIZE
cmp {byte}ds:[si], START_FLAG
je getFlag
getEOLN:
cmp {byte} ds:[si], CHAR_LF
je eoln
inc si
jmp short getEOLN
eoln:
inc si ;inc past eoln
exit:
ret
GetFlags endp
FSMFlagMethodTable label word
dw MSG_SCR_SET_XN
FSMFlagMethodTableEnd label word
FSMFlagTable label word
dw "xn"
FSMFlagTableEnd label word
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InitFlags
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reset terminal flags in screen object
CALLED BY: ProcessFlags
PASS: es - dgroup
RETURN: ---
DESTROYED:
PSEUDO CODE/STRATEGY:
Set all the flags to FALSE
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 01/29/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
InitFlags proc near
;get size of table
mov cx, (FSMFlagMethodTableEnd-FSMFlagMethodTable)/2
mov dh, FALSE ;set default value
mov di, offset FSMFlagMethodTable
resetNext:
push si, di
mov ax, cs:[di] ; ax = method
mov bx, es:[termuiHandle]
CallScreenObj
pop si, di
add di, 2 ;go to next method to set
loop resetNext
ret
InitFlags endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
StripHeader
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reset terminal flags in screen object
CALLED BY: ProcessFlags
PASS: es - dgroup
ds:si - termcap buffer
RETURN: ---
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This is lame I only check if the comment exists on the very first
line and if so then I ignore it. Why don't I check for the comment
at the start of every line?, because I'm a lazy dork
Didn't use scasb, cause didn't want to save es and di somewhere,
besides this isn't used much
REVISION HISTORY:
Name Date Description
---- ---- -----------
dennis 01/29/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
StripHeader proc near
cmp {byte}ds:[si], COMMENT_FLAG
jne exit
getEOLN:
inc si
cmp {byte}ds:[si], CHAR_LF
je eoln
jmp short getEOLN
eoln:
inc si ;advance past eoln
exit:
ret
StripHeader endp
|
FinderNewFile/Scripts/finderNewFile.scpt | heartbleeded/finderNewFile | 2 | 3553 | tell application "Finder" to make new file at (the target of the front window) as alias
|
archive/agda-1/Binding.agda | m0davis/oscar | 0 | 6757 | <reponame>m0davis/oscar<filename>archive/agda-1/Binding.agda
module Binding where
open import Agda.Primitive
data Freer {ℓ} (F : Set ℓ → Set (lsuc ℓ)) (A : Set (lsuc ℓ)) : Set (lsuc ℓ) where
pure : A → Freer F A
free : ∀ {a : Set ℓ} → (a → Freer F A) → F a → Freer F A
|
0400/bare.asm | 20chan/asm-adventures | 0 | 171550 | use32
inc eax
inc eax
dec eax
inc eax |
chat_server_2.adb | cborao/Ada-P4-chat | 0 | 26611 |
--PRÁCTICA 4: <NAME> (chat_server_2)
with Handlers;
with Ada.Text_IO;
with Ada.Calendar;
with Chat_Messages;
with Ordered_Maps_G;
with Chat_Procedures;
with Lower_Layer_UDP;
with Ada.Command_Line;
with Ada.Strings.Unbounded;
procedure Chat_Server_2 is
package ATI renames Ada.Text_IO;
package CM renames Chat_Messages;
package CP renames Chat_Procedures;
package LLU renames Lower_Layer_UDP;
package ACL renames Ada.Command_Line;
package ASU renames Ada.Strings.Unbounded;
use type CM.Message_Type;
use type Ada.Calendar.Time;
Port: Integer;
Server_EP: LLU.End_Point_Type;
Request: Character;
begin
--Binding
Port := Integer'Value(ACL.Argument(1));
Server_EP := LLU.Build (LLU.To_IP(LLU.Get_Host_Name), Port);
if ACL.Argument_Count = 2 and CP.Max_Valid(Natural'Value(ACL.Argument(2))) then
loop
--Server Handler
LLU.Bind(Server_EP, Handlers.Server_Handler'Access);
loop
ATI.Get_Immediate(Request);
ATI.Put_Line(Character'Image(Request));
case Request is
when 'o'|'O' =>
CP.Print_Old_Map;
when 'l'|'L' =>
CP.Print_Active_Map;
when others =>
ATI.Put_Line("Not implemented");
end case;
end loop;
end loop;
else
ATI.New_Line;
ATI.Put_Line("Server Usage: [Port] <Max_Clients (2-50)>");
ATI.New_Line;
end if;
LLU.finalize;
end Chat_Server_2;
|
oeis/142/A142357.asm | neoneye/loda-programs | 11 | 177790 | ; A142357: Primes congruent to 6 mod 47.
; Submitted by <NAME>(w3)
; 53,241,523,617,1087,1181,1933,2027,2309,2591,3061,3343,3719,3907,4001,4283,5693,5881,6163,6257,7103,7573,7949,8231,8419,8513,9547,9829,9923,10111,10487,10957,11239,11897,12743,14153,14341,14717,15187,16033,16127,16691,16879,17443,18289,18947,19417,19699,19793,20357,20639,20921,21391,21673,21767,22613,23459,23741,23929,24023,25057,25339,25621,25903,25997,26561,27031,27407,27689,28723,28817,29287,29569,29663,29851,30133,30509,30697,31543,33329,33893,34457,34739,35491,36713,36901,37277,37747,38593
mov $1,42
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $1,16
sub $2,1
mov $3,$1
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,63
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
sub $0,89
mul $0,2
add $0,53
|
oeis/078/A078322.asm | neoneye/loda-programs | 11 | 162387 | ; A078322: a(n) = rad(n*rad(n)+1), where rad = A007947 (squarefree kernel).
; Submitted by <NAME>(s2)
; 2,5,10,3,26,37,10,17,14,101,122,73,170,197,226,33,290,109,362,201,442,485,530,145,42,677,82,393,842,901,962,65,1090,1157,1226,217,1370,85,1522,401,58,1765,370,969,26,2117,2210,17,86,501,2602,1353,2810,65,3026,785,130,3365,3482,1801,3722,3845,662,129,4226,4357,4490,771,4762,377,5042,433,5330,5477,1126,321,5930,6085,6242,267,122,1345,6890,3529,7226,7397,7570,1937,7922,2701,8282,4233,1730,8837,9026,577,9410,1373,1634,1001
seq $0,64549 ; a(n) = n * Product_{primes p|n} p.
seq $0,7947 ; Largest squarefree number dividing n: the squarefree kernel of n, rad(n), radical of n.
|
programs/oeis/049/A049294.asm | karttu/loda | 0 | 9209 | ; A049294: Number of subgroups of index 3 in free group of rank n+1.
; 1,13,97,625,3841,23233,139777,839425,5038081,30231553,181395457,1088385025,6530334721,39182057473,235092443137,1410554855425,8463329525761,50779977940993,304679869218817,1828079218458625
mov $2,$0
mov $3,2
lpb $2,1
mul $3,3
add $1,$3
mul $1,2
sub $2,1
mul $3,2
lpe
add $1,1
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48.log_21829_2394.asm | ljhsiun2/medusa | 9 | 11942 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0xe8fa, %rbp
nop
nop
nop
nop
nop
and %r11, %r11
mov (%rbp), %cx
xor %rbp, %rbp
lea addresses_WT_ht+0x15aba, %rsi
lea addresses_WT_ht+0x1ad3a, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
cmp %r11, %r11
mov $111, %rcx
rep movsq
and %rcx, %rcx
lea addresses_UC_ht+0x130fa, %r15
nop
nop
nop
nop
cmp %rcx, %rcx
movw $0x6162, (%r15)
nop
nop
and $56984, %r15
lea addresses_WC_ht+0x1e4fa, %rcx
nop
nop
nop
nop
nop
xor $8635, %rdx
movups (%rcx), %xmm2
vpextrq $0, %xmm2, %rsi
nop
nop
xor %rdi, %rdi
lea addresses_D_ht+0x1a8fa, %rbp
add $18273, %rsi
movb $0x61, (%rbp)
nop
nop
and $49340, %rcx
lea addresses_UC_ht+0xd0fa, %rdi
nop
nop
nop
and %rbp, %rbp
movw $0x6162, (%rdi)
dec %rbp
lea addresses_WT_ht+0x1381a, %rdi
nop
add %rdx, %rdx
mov (%rdi), %r15w
inc %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r15
push %rax
push %rdx
push %rsi
// Faulty Load
lea addresses_WC+0x148fa, %r15
clflush (%r15)
nop
nop
nop
add $44836, %rsi
mov (%r15), %r11w
lea oracles, %rax
and $0xff, %r11
shlq $12, %r11
mov (%rax,%r11,1), %r11
pop %rsi
pop %rdx
pop %rax
pop %r15
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': True, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 2, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}}
{'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
*/
|
source/slim-messages-stat.ads | reznikmm/slimp | 0 | 16555 | <reponame>reznikmm/slimp
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package Slim.Messages.STAT is
type STAT_Message is new Message with private;
subtype Event_Kind is String (1 .. 4);
not overriding function Event (Self : STAT_Message) return Event_Kind;
not overriding function WiFi_Level (Self : STAT_Message) return Natural;
not overriding function Elapsed_Seconds
(Self : STAT_Message) return Natural;
private
subtype Byte is Ada.Streams.Stream_Element;
type STAT_Message is new Base_Message
(Max_8 => 4 + 3,
Max_16 => 3,
Max_32 => 8,
Max_64 => 1)
with null record;
overriding function Read
(Data : not null access
League.Stream_Element_Vectors.Stream_Element_Vector)
return STAT_Message;
overriding procedure Write
(Self : STAT_Message;
Tag : out Message_Tag;
Data : out League.Stream_Element_Vectors.Stream_Element_Vector);
overriding procedure Visit
(Self : not null access STAT_Message;
Visiter : in out Slim.Message_Visiters.Visiter'Class);
end Slim.Messages.STAT;
|
ipa/src/main/resources/antlr4/ca/phon/ipa/parser/UnicodeIPA.g4 | phon-ca/phon | 27 | 2809 | /*
* Copyright (C) 2012-2021 <NAME> & <NAME>
*
* 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.
*/
/**
* Grammar for parsing Unicode IPA transcriptions as a list of
* discrete IPA elements.
*/
grammar UnicodeIPA;
// Lexer Rules are generated by transforming
// src/main/resources/ca/phon/ipa/parser/ipa.xml using src/main/resources/xml/xslt/ipa2lexer.xsl
// the resulting lexer grammar can be found at target/generated-sources/antlr4/imports/ipa.g4
// This happens during the 'generate-sources' phase of the build - see pom.xml for details
import ipa;
start
: transcription EOF
;
transcription
: transcription word_boundary transcription
| word
;
word_boundary
: WS # WhiteSpace
;
word
: word compound_word_marker word # CompoundWord
| ipa_element+ # SimpleWord
| pause # WordPause
;
ipa_element
: stress
| phone sctype?
| syllable_boundary
| sandhi
| intra_word_pause
| phonex_matcher_ref
| alignment
;
stress
: PRIMARY_STRESS # PrimaryStress
| SECONDARY_STRESS # SecondaryStress
;
phone
: phone LIGATURE phone # CompoundPhone
| prefix_section? base_phone COMBINING_DIACRITIC* suffix_section? # SinglePhone
;
base_phone
: CONSONANT
| VOWEL
| GLIDE
| COVER_SYMBOL
;
prefix_section
: prefix_diacritic+
;
prefix_diacritic
: PREFIX_DIACRITIC COMBINING_DIACRITIC* # PrefixDiacritic
| SUFFIX_DIACRITIC ROLE_REVERSAL COMBINING_DIACRITIC* # PrefixDiacriticRoleReversed
| SUFFIX_DIACRITIC COMBINING_DIACRITIC* LIGATURE # PrefixDiacriticLigature
;
suffix_section
: suffix_diacritic* phone_length? tone_number?
;
tone_number
: TONE_NUMBER+
;
suffix_diacritic
: SUFFIX_DIACRITIC COMBINING_DIACRITIC* # SuffixDiacritic
| PREFIX_DIACRITIC ROLE_REVERSAL COMBINING_DIACRITIC* # SuffixDiacriticRoleReversed
| LIGATURE PREFIX_DIACRITIC COMBINING_DIACRITIC* # SuffixDiacriticLigature
;
phone_length
: HALF_LONG
| LONG
| LONG HALF_LONG
| LONG LONG
| LONG LONG HALF_LONG
| LONG LONG LONG
;
syllable_boundary
: PERIOD # SyllableBoundary
| MINOR_GROUP # MinorGroup
| MAJOR_GROUP # MajorGroup
;
compound_word_marker
: PLUS # CompoundWordMarker
;
sandhi
: SANDHI # SandhiMarker
;
intra_word_pause
: INTRA_WORD_PAUSE
;
pause
: OPEN_PAREN pause_length CLOSE_PAREN
;
pause_length
: PERIOD # ShortPause
| PERIOD PERIOD # MediumPause
| PERIOD PERIOD PERIOD # LongPause
;
/* Other Items */
/**
* Phonex matcher references are used in find and replace expressions.
*/
phonex_matcher_ref
: prefix_section? BACKSLASH NUMBER COMBINING_DIACRITIC* suffix_section? # GroupNumberRef
| prefix_section? BACKSLASH GROUP_NAME COMBINING_DIACRITIC* suffix_section? # GroupNameRef
;
sctype
: SC_TYPE
;
alignment
: ALIGNMENT
;
|
oeis/326/A326501.asm | neoneye/loda-programs | 11 | 160045 | <filename>oeis/326/A326501.asm
; A326501: a(n) = Sum_{k=0..n} (-k)^k.
; 1,0,4,-23,233,-2892,43764,-779779,15997437,-371423052,9628576948,-275683093663,8640417354593,-294234689237660,10817772136320356,-427076118244539019,18019667955465012597,-809220593930871751580,38537187481365665823844,-1939882468178947923300135,102917717531821052076699865,-5739669300854161469304424556,335688208063365395927342299028,-20544779791784546638427690611539,1313190997058499577810653782232237,-87504650972954023656079879665033388,6068614929234203287140594408735170388
add $0,1
lpb $0
sub $0,1
mov $1,$0
pow $1,$0
sub $1,$2
mov $2,$1
lpe
mov $0,$2
|
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/polygon.lzh/polygon/sf2/bank8.asm | prismotizm/gigaleak | 0 | 83755 | Name: bank8.asm
Type: file
Size: 425
Last-Modified: '1993-01-07T04:42:27Z'
SHA-1: FEA2294D942FEC43DDE3C46B5F9FA5964493502C
Description: null
|
programs/oeis/017/A017163.asm | neoneye/loda | 22 | 22023 | <reponame>neoneye/loda
; A017163: a(n) = (9*n)^3.
; 0,729,5832,19683,46656,91125,157464,250047,373248,531441,729000,970299,1259712,1601613,2000376,2460375,2985984,3581577,4251528,5000211,5832000,6751269,7762392,8869743,10077696,11390625,12812904,14348907,16003008,17779581,19683000,21717639,23887872,26198073,28652616,31255875,34012224,36926037,40001688,43243551,46656000,50243409,54010152,57960603,62099136,66430125,70957944,75686967,80621568,85766121,91125000,96702579,102503232,108531333,114791256,121287375,128024064,135005697,142236648,149721291,157464000,165469149,173741112,182284263,191102976,200201625,209584584,219256227,229220928,239483061,250047000,260917119,272097792,283593393,295408296,307546875,320013504,332812557,345948408,359425431,373248000,387420489,401947272,416832723,432081216,447697125,463684824,480048687,496793088,513922401,531441000,549353259,567663552,586376253,605495736,625026375,644972544,665338617,686128968,707347971
mov $1,9
mul $1,$0
pow $1,3
mov $0,$1
|
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/Keyword.g4 | EvanDylan/incubator-shardingsphere | 1 | 6490 | <reponame>EvanDylan/incubator-shardingsphere<filename>sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/Keyword.g4<gh_stars>1-10
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
lexer grammar Keyword;
import Alphabet;
WS
: [ \t\r\n] + ->skip
;
ALL
: A L L
;
AND
: A N D
;
ANY
: A N Y
;
ASC
: A S C
;
ADMIN
: A D M I N
;
BETWEEN
: B E T W E E N
;
BINARY
: B I N A R Y
;
BY
: B Y
;
DATE
: D A T E
;
DESC
: D E S C
;
DISTINCT
: D I S T I N C T
;
ESCAPE
: E S C A P E
;
EXISTS
: E X I S T S
;
FALSE
: F A L S E
;
FROM
: F R O M
;
GROUP
: G R O U P
;
HAVING
: H A V I N G
;
IN
: I N
;
IS
: I S
;
KEY
: K E Y
;
LIKE
: L I K E
;
LIMIT
: L I M I T
;
MOD
: M O D
;
NOT
: N O T
;
NULL
: N U L L
;
OFFSET
: O F F S E T
;
OR
: O R
;
ORDER
: O R D E R
;
PARTITION
: P A R T I T I O N
;
PRIMARY
: P R I M A R Y
;
REGEXP
: R E G E X P
;
ROW
: R O W
;
SET
: S E T
;
SOUNDS
: S O U N D S
;
TIME
: T I M E
;
TIMESTAMP
: T I M E S T A M P
;
TRUE
: T R U E
;
UNION
: U N I O N
;
UNKNOWN
: U N K N O W N
;
WHERE
: W H E R E
;
WITH
: W I T H
;
XOR
: X O R
;
ADD
: A D D
;
ALTER
: A L T E R
;
ALWAYS
: A L W A Y S
;
AS
: A S
;
CASCADE
: C A S C A D E
;
CHECK
: C H E C K
;
COLUMN
: C O L U M N
;
COMMIT
: C O M M I T
;
CONSTRAINT
: C O N S T R A I N T
;
CREATE
: C R E A T E
;
CURRENT
: C U R R E N T
;
DAY
: D A Y
;
DEFAULT
: D E F A U L T
;
DELETE
: D E L E T E
;
DISABLE
: D I S A B L E
;
DROP
: D R O P
;
ENABLE
: E N A B L E
;
FOR
: F O R
;
FOREIGN
: F O R E I G N
;
FUNCTION
: F U N C T I O N
;
GENERATED
: G E N E R A T E D
;
GRANT
: G R A N T
;
INDEX
: I N D E X
;
ISOLATION
: I S O L A T I O N
;
LEVEL
: L E V E L
;
NO
: N O
;
ON
: O N
;
OPTION
: O P T I O N
;
PRIVILEGES
: P R I V I L E G E S
;
READ
: R E A D
;
REFERENCES
: R E F E R E N C E S
;
REVOKE
: R E V O K E
;
ROLE
: R O L E
;
ROLLBACK
: R O L L B A C K
;
ROWS
: R O W S
;
START
: S T A R T
;
TABLE
: T A B L E
;
TO
: T O
;
TRANSACTION
: T R A N S A C T I O N
;
TRUNCATE
: T R U N C A T E
;
UNIQUE
: U N I Q U E
;
USER
: U S E R
;
YEAR
: Y E A R
;
ACTION
: A C T I O N
;
ARRAY
: A R R A Y
;
BEGIN
: B E G I N
;
BRIN
: B R I N
;
BTREE
: B T R E E
;
CACHE
: C A C H E
;
CAST
: C A S T
;
CHARACTERISTICS
: C H A R A C T E R I S T I C S
;
CLUSTER
: C L U S T E R
;
COLLATE
: C O L L A T E
;
COMMENTS
: C O M M E N T S
;
CONCURRENTLY
: C O N C U R R E N T L Y
;
CONNECT
: C O N N E C T
;
CONSTRAINTS
: C O N S T R A I N T S
;
CURRENT_TIMESTAMP
: C U R R E N T UL_ T I M E S T A M P
;
CURRENT_USER
: C U R R E N T UL_ U S E R
;
CYCLE
: C Y C L E
;
DATA
: D A T A
;
DATABASE
: D A T A B A S E
;
DEFAULTS
: D E F A U L T S
;
DEFERRABLE
: D E F E R R A B L E
;
DEFERRED
: D E F E R R E D
;
DEPENDS
: D E P E N D S
;
DOMAIN
: D O M A I N
;
EXCLUDING
: E X C L U D I N G
;
EXECUTE
: E X E C U T E
;
EXTENDED
: E X T E N D E D
;
EXTENSION
: E X T E N S I O N
;
EXTERNAL
: E X T E R N A L
;
EXTRACT
: E X T R A C T
;
FILTER
: F I L T E R
;
FIRST
: F I R S T
;
FOLLOWING
: F O L L O W I N G
;
FORCE
: F O R C E
;
FULL
: F U L L
;
GIN
: G I N
;
GIST
: G I S T
;
GLOBAL
: G L O B A L
;
HASH
: H A S H
;
HOUR
: H O U R
;
IDENTITY
: I D E N T I T Y
;
IF
: I F
;
IMMEDIATE
: I M M E D I A T E
;
INCLUDING
: I N C L U D I N G
;
INCREMENT
: I N C R E M E N T
;
INDEXES
: I N D E X E S
;
INHERIT
: I N H E R I T
;
INHERITS
: I N H E R I T S
;
INITIALLY
: I N I T I A L L Y
;
INSERT
: I N S E R T
;
LANGUAGE
: L A N G U A G E
;
LARGE
: L A R G E
;
LAST
: L A S T
;
LOCAL
: L O C A L
;
LOGGED
: L O G G E D
;
MAIN
: M A I N
;
MATCH
: M A T C H
;
MAXVALUE
: M A X V A L U E
;
MINUTE
: M I N U T E
;
MINVALUE
: M I N V A L U E
;
MONTH
: M O N T H
;
NOTHING
: N O T H I N G
;
NULLS
: N U L L S
;
OBJECT
: O B J E C T
;
OF
: O F
;
OIDS
: O I D S
;
ONLY
: O N L Y
;
OVER
: O V E R
;
OWNED
: O W N E D
;
OWNER
: O W N E R
;
PARTIAL
: P A R T I A L
;
PLAIN
: P L A I N
;
PRECEDING
: P R E C E D I N G
;
PROCEDURE
: P R O C E D U R E
;
RANGE
: R A N G E
;
RENAME
: R E N A M E
;
REPLICA
: R E P L I C A
;
RESET
: R E S E T
;
RESTART
: R E S T A R T
;
RESTRICT
: R E S T R I C T
;
ROUTINE
: R O U T I N E
;
RULE
: R U L E
;
SAVEPOINT
: S A V E P O I N T
;
SCHEMA
: S C H E M A
;
SECOND
: S E C O N D
;
SECURITY
: S E C U R I T Y
;
SELECT
: S E L E C T
;
SEQUENCE
: S E Q U E N C E
;
SESSION
: S E S S I O N
;
SESSION_USER
: S E S S I O N UL_ U S E R
;
SHOW
: S H O W
;
SIMPLE
: S I M P L E
;
SPGIST
: S P G I S T
;
STATISTICS
: S T A T I S T I C S
;
STORAGE
: S T O R A G E
;
TABLESPACE
: T A B L E S P A C E
;
TEMP
: T E M P
;
TEMPORARY
: T E M P O R A R Y
;
TRIGGER
: T R I G G E R
;
TYPE
: T Y P E
;
UNBOUNDED
: U N B O U N D E D
;
UNLOGGED
: U N L O G G E D
;
UPDATE
: U P D A T E
;
USAGE
: U S A G E
;
USING
: U S I N G
;
VALID
: V A L I D
;
VALIDATE
: V A L I D A T E
;
WITHIN
: W I T H I N
;
WITHOUT
: W I T H O U T
;
ZONE
: Z O N E
;
|
Sets/BoolSet.agda | Lolirofle/stuff-in-agda | 6 | 1821 | <filename>Sets/BoolSet.agda
module Sets.BoolSet {ℓ ℓₑ} where
import Lvl
open import Data.Boolean
import Data.Boolean.Operators
open Data.Boolean.Operators.Logic using (_⟶_ ; _⟵_)
open Data.Boolean.Operators.Programming hiding (_==_)
open import Data.Boolean.Stmt
open import Data.Boolean.Proofs
import Data.List as List
import Data.List.Functions as List
open import Logic
open import Functional
open import Operator.Equals
open import Structure.Setoid
open import Type
-- A function from a type T to a boolean value.
-- This can be interpreted as a computable set over T (a set with a computable containment relation).
BoolSet : ∀{ℓ} → Type{ℓ} → Type{ℓ}
BoolSet(T) = (T → Bool)
module _ {T : Type{ℓ}} ⦃ equiv : Equiv{ℓₑ}(T) ⦄ where
𝐔 : BoolSet(T)
𝐔 = const(𝑇)
∅ : BoolSet(T)
∅ = const(𝐹)
singleton : ⦃ _ : DecidableEquiv(T) ⦄ → T → BoolSet(T)
singleton(t) = (_== t)
enumeration : ⦃ _ : DecidableEquiv(T) ⦄ → List.List(T) → BoolSet(T)
enumeration(l) = (x ↦ List.satisfiesAny(_== x)(l))
_∈?_ : T → BoolSet(T) → Bool
_∈?_ = apply
_∉?_ : T → BoolSet(T) → Bool
_∉?_ a set = !(a ∈? set)
{- TODO: Define a FinitelyEnumerable relation
_⊆?_ : BoolSet(T) → BoolSet(T) → Bool
_⊆?_ A B = all(elem ↦ (elem ∈? A) ⟶ (elem ∈? B))
_⊇?_ : BoolSet(T) → BoolSet(T) → Bool
_⊇?_ A B = all(elem ↦ (elem ∈? A) ⟵ (elem ∈? B))
-}
_∈_ : T → BoolSet(T) → Stmt
_∈_ a set = IsTrue(a ∈? set)
_∉_ : T → BoolSet(T) → Stmt
_∉_ a set = IsTrue(a ∉? set)
_⊆_ : BoolSet(T) → BoolSet(T) → Stmt
_⊆_ set₁ set₂ = (∀{a} → (a ∈ set₁) → (a ∈ set₂))
_⊇_ : BoolSet(T) → BoolSet(T) → Stmt
_⊇_ set₁ set₂ = _⊆_ set₂ set₁
_∪_ : BoolSet(T) → BoolSet(T) → BoolSet(T)
_∪_ A B = (elem ↦ (elem ∈? A) || (elem ∈? B))
_∩_ : BoolSet(T) → BoolSet(T) → BoolSet(T)
_∩_ A B = (elem ↦ (elem ∈? A) && (elem ∈? B))
_∖_ : BoolSet(T) → BoolSet(T) → BoolSet(T)
_∖_ A B = (elem ↦ (elem ∈? A) && !(elem ∈? B))
∁_ : BoolSet(T) → BoolSet(T)
∁_ A = (elem ↦ !(elem ∈? A))
℘_ : BoolSet(T) → BoolSet(BoolSet(T))
℘_ _ = const(𝑇)
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/aspects.adb | djamal2727/Main-Bearing-Analytical-Model | 0 | 30099 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- A S P E C T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2010-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Einfo; use Einfo;
with Nlists; use Nlists;
with Sinfo; use Sinfo;
with GNAT.HTable;
package body Aspects is
-- The following array indicates aspects that a subtype inherits from its
-- base type. True means that the subtype inherits the aspect from its base
-- type. False means it is not inherited.
Base_Aspect : constant array (Aspect_Id) of Boolean :=
(Aspect_Atomic => True,
Aspect_Atomic_Components => True,
Aspect_Constant_Indexing => True,
Aspect_Default_Iterator => True,
Aspect_Discard_Names => True,
Aspect_Independent_Components => True,
Aspect_Iterator_Element => True,
Aspect_Type_Invariant => True,
Aspect_Unchecked_Union => True,
Aspect_Variable_Indexing => True,
Aspect_Volatile => True,
Aspect_Volatile_Full_Access => True,
others => False);
-- The following array indicates type aspects that are inherited and apply
-- to the class-wide type as well.
Inherited_Aspect : constant array (Aspect_Id) of Boolean :=
(Aspect_Constant_Indexing => True,
Aspect_Default_Iterator => True,
Aspect_Implicit_Dereference => True,
Aspect_Iterator_Element => True,
Aspect_Remote_Types => True,
Aspect_Variable_Indexing => True,
others => False);
------------------------------------------
-- Hash Table for Aspect Specifications --
------------------------------------------
type AS_Hash_Range is range 0 .. 510;
-- Size of hash table headers
function AS_Hash (F : Node_Id) return AS_Hash_Range;
-- Hash function for hash table
function AS_Hash (F : Node_Id) return AS_Hash_Range is
begin
return AS_Hash_Range (F mod 511);
end AS_Hash;
package Aspect_Specifications_Hash_Table is new
GNAT.HTable.Simple_HTable
(Header_Num => AS_Hash_Range,
Element => List_Id,
No_Element => No_List,
Key => Node_Id,
Hash => AS_Hash,
Equal => "=");
-------------------------------------
-- Hash Table for Aspect Id Values --
-------------------------------------
type AI_Hash_Range is range 0 .. 112;
-- Size of hash table headers
function AI_Hash (F : Name_Id) return AI_Hash_Range;
-- Hash function for hash table
function AI_Hash (F : Name_Id) return AI_Hash_Range is
begin
return AI_Hash_Range (F mod 113);
end AI_Hash;
package Aspect_Id_Hash_Table is new
GNAT.HTable.Simple_HTable
(Header_Num => AI_Hash_Range,
Element => Aspect_Id,
No_Element => No_Aspect,
Key => Name_Id,
Hash => AI_Hash,
Equal => "=");
---------------------------
-- Aspect_Specifications --
---------------------------
function Aspect_Specifications (N : Node_Id) return List_Id is
begin
if Has_Aspects (N) then
return Aspect_Specifications_Hash_Table.Get (N);
else
return No_List;
end if;
end Aspect_Specifications;
--------------------------------
-- Aspects_On_Body_Or_Stub_OK --
--------------------------------
function Aspects_On_Body_Or_Stub_OK (N : Node_Id) return Boolean is
Aspect : Node_Id;
Aspects : List_Id;
begin
-- The routine should be invoked on a body [stub] with aspects
pragma Assert (Has_Aspects (N));
pragma Assert
(Nkind (N) in N_Body_Stub | N_Entry_Body | N_Package_Body |
N_Protected_Body | N_Subprogram_Body | N_Task_Body);
-- Look through all aspects and see whether they can be applied to a
-- body [stub].
Aspects := Aspect_Specifications (N);
Aspect := First (Aspects);
while Present (Aspect) loop
if not Aspect_On_Body_Or_Stub_OK (Get_Aspect_Id (Aspect)) then
return False;
end if;
Next (Aspect);
end loop;
return True;
end Aspects_On_Body_Or_Stub_OK;
----------------------
-- Exchange_Aspects --
----------------------
procedure Exchange_Aspects (N1 : Node_Id; N2 : Node_Id) is
begin
pragma Assert
(Permits_Aspect_Specifications (N1)
and then Permits_Aspect_Specifications (N2));
-- Perform the exchange only when both nodes have lists to be swapped
if Has_Aspects (N1) and then Has_Aspects (N2) then
declare
L1 : constant List_Id := Aspect_Specifications (N1);
L2 : constant List_Id := Aspect_Specifications (N2);
begin
Set_Parent (L1, N2);
Set_Parent (L2, N1);
Aspect_Specifications_Hash_Table.Set (N1, L2);
Aspect_Specifications_Hash_Table.Set (N2, L1);
end;
end if;
end Exchange_Aspects;
-----------------
-- Find_Aspect --
-----------------
function Find_Aspect (Id : Entity_Id; A : Aspect_Id) return Node_Id is
Decl : Node_Id;
Item : Node_Id;
Owner : Entity_Id;
Spec : Node_Id;
begin
Owner := Id;
-- Handle various cases of base or inherited aspects for types
if Is_Type (Id) then
if Base_Aspect (A) then
Owner := Base_Type (Owner);
end if;
if Is_Class_Wide_Type (Owner) and then Inherited_Aspect (A) then
Owner := Root_Type (Owner);
end if;
if Is_Private_Type (Owner)
and then Present (Full_View (Owner))
and then not Operational_Aspect (A)
then
Owner := Full_View (Owner);
end if;
end if;
-- Search the representation items for the desired aspect
Item := First_Rep_Item (Owner);
while Present (Item) loop
if Nkind (Item) = N_Aspect_Specification
and then Get_Aspect_Id (Item) = A
then
return Item;
end if;
Next_Rep_Item (Item);
end loop;
-- Note that not all aspects are added to the chain of representation
-- items. In such cases, search the list of aspect specifications. First
-- find the declaration node where the aspects reside. This is usually
-- the parent or the parent of the parent.
Decl := Parent (Owner);
if not Permits_Aspect_Specifications (Decl) then
Decl := Parent (Decl);
end if;
-- Search the list of aspect specifications for the desired aspect
if Permits_Aspect_Specifications (Decl) then
Spec := First (Aspect_Specifications (Decl));
while Present (Spec) loop
if Get_Aspect_Id (Spec) = A then
return Spec;
end if;
Next (Spec);
end loop;
end if;
-- The entity does not carry any aspects or the desired aspect was not
-- found.
return Empty;
end Find_Aspect;
--------------------------
-- Find_Value_Of_Aspect --
--------------------------
function Find_Value_Of_Aspect
(Id : Entity_Id;
A : Aspect_Id) return Node_Id
is
Spec : constant Node_Id := Find_Aspect (Id, A);
begin
if Present (Spec) then
if A = Aspect_Default_Iterator then
return Expression (Aspect_Rep_Item (Spec));
else
return Expression (Spec);
end if;
end if;
return Empty;
end Find_Value_Of_Aspect;
-------------------
-- Get_Aspect_Id --
-------------------
function Get_Aspect_Id (Name : Name_Id) return Aspect_Id is
begin
return Aspect_Id_Hash_Table.Get (Name);
end Get_Aspect_Id;
function Get_Aspect_Id (Aspect : Node_Id) return Aspect_Id is
begin
pragma Assert (Nkind (Aspect) = N_Aspect_Specification);
return Aspect_Id_Hash_Table.Get (Chars (Identifier (Aspect)));
end Get_Aspect_Id;
----------------
-- Has_Aspect --
----------------
function Has_Aspect (Id : Entity_Id; A : Aspect_Id) return Boolean is
begin
return Present (Find_Aspect (Id, A));
end Has_Aspect;
------------------
-- Move_Aspects --
------------------
procedure Move_Aspects (From : Node_Id; To : Node_Id) is
pragma Assert (not Has_Aspects (To));
begin
if Has_Aspects (From) then
Set_Aspect_Specifications (To, Aspect_Specifications (From));
Aspect_Specifications_Hash_Table.Remove (From);
Set_Has_Aspects (From, False);
end if;
end Move_Aspects;
---------------------------
-- Move_Or_Merge_Aspects --
---------------------------
procedure Move_Or_Merge_Aspects (From : Node_Id; To : Node_Id) is
procedure Relocate_Aspect (Asp : Node_Id);
-- Move aspect specification Asp to the aspect specifications of node To
---------------------
-- Relocate_Aspect --
---------------------
procedure Relocate_Aspect (Asp : Node_Id) is
Asps : List_Id;
begin
if Has_Aspects (To) then
Asps := Aspect_Specifications (To);
-- Create a new aspect specification list for node To
else
Asps := New_List;
Set_Aspect_Specifications (To, Asps);
Set_Has_Aspects (To);
end if;
-- Remove the aspect from its original owner and relocate it to node
-- To.
Remove (Asp);
Append (Asp, Asps);
end Relocate_Aspect;
-- Local variables
Asp : Node_Id;
Asp_Id : Aspect_Id;
Next_Asp : Node_Id;
-- Start of processing for Move_Or_Merge_Aspects
begin
if Has_Aspects (From) then
Asp := First (Aspect_Specifications (From));
while Present (Asp) loop
-- Store the next aspect now as a potential relocation will alter
-- the contents of the list.
Next_Asp := Next (Asp);
-- When moving or merging aspects from a subprogram body stub that
-- also acts as a spec, relocate only those aspects that may apply
-- to a body [stub]. Note that a precondition must also be moved
-- to the proper body as the pre/post machinery expects it to be
-- there.
if Nkind (From) = N_Subprogram_Body_Stub
and then No (Corresponding_Spec_Of_Stub (From))
then
Asp_Id := Get_Aspect_Id (Asp);
if Aspect_On_Body_Or_Stub_OK (Asp_Id)
or else Asp_Id = Aspect_Pre
or else Asp_Id = Aspect_Precondition
then
Relocate_Aspect (Asp);
end if;
-- When moving or merging aspects from a single concurrent type
-- declaration, relocate only those aspects that may apply to the
-- anonymous object created for the type.
-- Note: It is better to use Is_Single_Concurrent_Type_Declaration
-- here, but Aspects and Sem_Util have incompatible licenses.
elsif Nkind (Original_Node (From)) in
N_Single_Protected_Declaration | N_Single_Task_Declaration
then
Asp_Id := Get_Aspect_Id (Asp);
if Aspect_On_Anonymous_Object_OK (Asp_Id) then
Relocate_Aspect (Asp);
end if;
-- Default case - relocate the aspect to its new owner
else
Relocate_Aspect (Asp);
end if;
Asp := Next_Asp;
end loop;
-- The relocations may have left node From's aspect specifications
-- list empty. If this is the case, simply remove the aspects.
if Is_Empty_List (Aspect_Specifications (From)) then
Remove_Aspects (From);
end if;
end if;
end Move_Or_Merge_Aspects;
-----------------------------------
-- Permits_Aspect_Specifications --
-----------------------------------
Has_Aspect_Specifications_Flag : constant array (Node_Kind) of Boolean :=
(N_Abstract_Subprogram_Declaration => True,
N_Component_Declaration => True,
N_Entry_Body => True,
N_Entry_Declaration => True,
N_Exception_Declaration => True,
N_Exception_Renaming_Declaration => True,
N_Expression_Function => True,
N_Formal_Abstract_Subprogram_Declaration => True,
N_Formal_Concrete_Subprogram_Declaration => True,
N_Formal_Object_Declaration => True,
N_Formal_Package_Declaration => True,
N_Formal_Type_Declaration => True,
N_Full_Type_Declaration => True,
N_Function_Instantiation => True,
N_Generic_Package_Declaration => True,
N_Generic_Renaming_Declaration => True,
N_Generic_Subprogram_Declaration => True,
N_Object_Declaration => True,
N_Object_Renaming_Declaration => True,
N_Package_Body => True,
N_Package_Body_Stub => True,
N_Package_Declaration => True,
N_Package_Instantiation => True,
N_Package_Specification => True,
N_Package_Renaming_Declaration => True,
N_Parameter_Specification => True,
N_Private_Extension_Declaration => True,
N_Private_Type_Declaration => True,
N_Procedure_Instantiation => True,
N_Protected_Body => True,
N_Protected_Body_Stub => True,
N_Protected_Type_Declaration => True,
N_Single_Protected_Declaration => True,
N_Single_Task_Declaration => True,
N_Subprogram_Body => True,
N_Subprogram_Body_Stub => True,
N_Subprogram_Declaration => True,
N_Subprogram_Renaming_Declaration => True,
N_Subtype_Declaration => True,
N_Task_Body => True,
N_Task_Body_Stub => True,
N_Task_Type_Declaration => True,
others => False);
function Permits_Aspect_Specifications (N : Node_Id) return Boolean is
begin
return Has_Aspect_Specifications_Flag (Nkind (N));
end Permits_Aspect_Specifications;
--------------------
-- Remove_Aspects --
--------------------
procedure Remove_Aspects (N : Node_Id) is
begin
if Has_Aspects (N) then
Aspect_Specifications_Hash_Table.Remove (N);
Set_Has_Aspects (N, False);
end if;
end Remove_Aspects;
-----------------
-- Same_Aspect --
-----------------
-- Table used for Same_Aspect, maps aspect to canonical aspect
type Aspect_To_Aspect_Mapping is array (Aspect_Id) of Aspect_Id;
function Init_Canonical_Aspect return Aspect_To_Aspect_Mapping;
-- Initialize the Canonical_Aspect mapping below
function Init_Canonical_Aspect return Aspect_To_Aspect_Mapping is
Result : Aspect_To_Aspect_Mapping;
begin
-- They all map to themselves...
for Aspect in Aspect_Id loop
Result (Aspect) := Aspect;
end loop;
-- ...except for these:
Result (Aspect_Dynamic_Predicate) := Aspect_Predicate;
Result (Aspect_Inline_Always) := Aspect_Inline;
Result (Aspect_Interrupt_Priority) := Aspect_Priority;
Result (Aspect_Postcondition) := Aspect_Post;
Result (Aspect_Precondition) := Aspect_Pre;
Result (Aspect_Shared) := Aspect_Atomic;
Result (Aspect_Static_Predicate) := Aspect_Predicate;
Result (Aspect_Type_Invariant) := Aspect_Invariant;
return Result;
end Init_Canonical_Aspect;
Canonical_Aspect : constant Aspect_To_Aspect_Mapping :=
Init_Canonical_Aspect;
function Same_Aspect (A1 : Aspect_Id; A2 : Aspect_Id) return Boolean is
begin
return Canonical_Aspect (A1) = Canonical_Aspect (A2);
end Same_Aspect;
-------------------------------
-- Set_Aspect_Specifications --
-------------------------------
procedure Set_Aspect_Specifications (N : Node_Id; L : List_Id) is
begin
pragma Assert (Permits_Aspect_Specifications (N));
pragma Assert (not Has_Aspects (N));
pragma Assert (L /= No_List);
Set_Has_Aspects (N);
Set_Parent (L, N);
Aspect_Specifications_Hash_Table.Set (N, L);
end Set_Aspect_Specifications;
-- Package initialization sets up Aspect Id hash table
begin
for J in Aspect_Id loop
Aspect_Id_Hash_Table.Set (Aspect_Names (J), J);
end loop;
end Aspects;
|
Scripts Pack Source Items/Scripts Pack/Core Components/Disk Image Checksum Verify (10.3).applescript | Phorofor/ScriptsPack.macOS | 1 | 2620 | <reponame>Phorofor/ScriptsPack.macOS<filename>Scripts Pack Source Items/Scripts Pack/Core Components/Disk Image Checksum Verify (10.3).applescript
# Scripts Pack - Tweak various preference variables in macOS
# <Phorofor, https://github.com/Phorofor/>
set MacVer to do shell script "sw_vers -productVersion"
set Sdescription to "Skips the verifying when opening disk images to save some time, but can also be a dangerous action to skip the verification process." as string
-- Skip Disk Image Verify
-- Versions compatible: Panther (10.3)+
-- Preference: com.apple.frameworks.diskimages
-- Preference Key: skip-verify
-- Preference location: ~/Library/Preferences/com.apple.frameworks.diskimages.plist
-- Default value (string): false
set useR to do shell script "whoami"
set MacVer to do shell script "sw_vers -productVersion"
set Min to "10.3.0" as string
if MacVer < Min then
display alert "Outdated Mac OS Version!" message "You're using Mac OS " & MacVer & ". This feature isn't supported for that. Come back when you've updated to Panther (10.3) or higher. Then this feature will work." buttons ["OK"] as warning cancel button 1
else
try
set prValue to do shell script "defaults read com.apple.frameworks.diskimages skip-verify"
set toggleBut to "Skip Verify"
set tZ to "skip"
set sTz to "true"
if prValue = "true" then
set toggleBut to "Enable Verify"
set tZ to "enable"
set sTz to "false"
set psValue to "[ ! WARNING ! ]: You appear to have the disk image checksum verify feature turned off. This can be a risky setting, so it's best to use trusted sources so you don't get some malicious attacks or anything. Enable the verify feature to turn it back on."
else
set psValue to "The disk image verify feature is turned on. It's best to leave it that way. Skipping it saves more time but can also be risky."
end if
on error
set psValue to "The verify disk image feature is turned on as its default setting. Don't change this unless you're sure about what you're doing."
end try
set tD to display alert "Would you like to " & tZ & " the checksum verify when opening disk images?" message Sdescription & return & return & psValue buttons ["Cancel", "Clear", toggleBut] cancel button 1
if the button returned of tD is "Skip Verify" then
display alert "Stop right there, " & useR & "!" message "You're about to skip the disk image checksum verify. This can be the most dangerous action, if a giant monster comes and messes up something on this computer while the verify is disabled - that's " & useR & "'s fault, not mine! Are you willing to stay back or going to take the risk?" as warning buttons ["Stay Back", "Proceed with Caution"] cancel button 1 default button 1
set pSet to "The verify feature is now disabled! The disk images will not verify itself automatically anymore so you can save yourself some time! Remember that you set this setting at your own risk. You can change this setting if you're afraid that something is gonna come and mess your computer!"
do shell script "defaults write com.apple.frameworks.diskimages skip-verify true"
end if
if the button returned of tD is "Enable Verify" then
do shell script "defaults write com.apple.frameworks.diskimages skip-verify false"
set pSet to "The disk images will now verify its checksums when being mounted. You're now a bit safer away from those things."
end if
if the button returned of tD is "Clear" then
do shell script "defaults delete com.apple.frameworks.diskimages skip-verify"
set pSet to "You've cleared the preference for disk image verifying."
end if
display alert "Disk Image Verify - Changes Applied" message pSet
end if |
src/tom/library/sl/ada/muvarstrategy.adb | rewriting/tom | 36 | 29862 | with VisitFailurePackage, VisitablePackage, EnvironmentPackage;
use VisitFailurePackage, VisitablePackage, EnvironmentPackage;
with Ada.Text_IO; use Ada.Text_IO;
package body MuVarStrategy is
----------------------------------------------------------------------------
-- Object implementation
----------------------------------------------------------------------------
overriding
function toString(c: MuVar) return String is
str : access String := new String'("[");
begin
if c.name = null then
str := new String'(str.all & "null,");
else
str := new String'(str.all & c.name.all & ",");
end if;
if c.instance = null then
str := new String'(str.all & "null]");
else
str := new String'(str.all & toString(Object'Class(c.instance.all)) & "]");
end if;
return str.all;
end;
----------------------------------------------------------------------------
-- Strategy implementation
----------------------------------------------------------------------------
overriding
function visitLight(str:access MuVar; any: ObjectPtr; i: access Introspector'Class) return ObjectPtr is
begin
if str.instance /= null then
return visitLight(str.instance, any, i);
else
raise VisitFailure;
end if;
end;
overriding
function visit(str: access MuVar; i: access Introspector'Class) return Integer is
begin
if str.instance /= null then
return visit(str.instance, i);
else
return EnvironmentPackage.FAILURE;
end if;
end;
----------------------------------------------------------------------------
procedure makeMuVar(c : in out MuVar; s: access String) is
begin
initSubterm(c);
if s /= null then
c.name := new String'(s.all);
else
c.name := null;
end if;
end;
function newMuVar(s : access String) return StrategyPtr is
ret : StrategyPtr := new MuVar;
begin
makeMuVar(MuVar(ret.all), s);
return ret;
end;
function newMuVar(s : String) return StrategyPtr is
begin
return newMuVar(new String'(s));
end;
function equals(m : access MuVar; o : ObjectPtr) return Boolean is
mptr : access MuVar := null;
begin
if o /= null then
if o.all in MuVar'Class then
mptr := MuVar(o.all)'Access;
if mptr.name /= null then
return m.name.all = mptr.name.all;
else
if mptr.name = m.name and then mptr.instance = m.instance then
return true;
end if;
end if;
end if;
end if;
return false;
end;
function hashCode(m : access MuVar) return Integer is
begin
return 0;
end;
function getInstance(m: access MuVar) return StrategyPtr is
begin
return m.instance;
end;
procedure setInstance(m: access MuVar; s: StrategyPtr) is
begin
m.instance := s;
end;
procedure setName(m: access MuVar; n: access String) is
begin
if n /= null then
m.name := new String'(n.all);
else
m.name := null;
end if;
end;
function isExpanded(m: access Muvar) return Boolean is
begin
if m.instance = null then
return false;
else
return true;
end if;
end;
function getName(m: access Muvar) return access String is
begin
return m.name;
end;
----------------------------------------------------------------------------
end MuVarStrategy;
|
source/machine-pc-freebsd/s-saalsi.adb | ytomino/drake | 33 | 12867 | with C.malloc_np;
function System.System_Allocators.Allocated_Size (
Storage_Address : Address)
return Storage_Elements.Storage_Count
is
pragma Suppress (All_Checks);
begin
return Storage_Elements.Storage_Offset (
C.malloc_np.malloc_usable_size (C.void_const_ptr (Storage_Address)));
end System.System_Allocators.Allocated_Size;
|
agda-stdlib/src/Relation/Binary/Indexed/Homogeneous/Structures.agda | DreamLinuxer/popl21-artifact | 5 | 5455 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Homogeneously-indexed binary relations
------------------------------------------------------------------------
-- The contents of this module should be accessed via
-- `Relation.Binary.Indexed.Homogeneous`.
{-# OPTIONS --without-K --safe #-}
open import Relation.Binary.Indexed.Homogeneous.Core
module Relation.Binary.Indexed.Homogeneous.Structures
{i a ℓ} {I : Set i}
(A : I → Set a) -- The underlying indexed sets
(_≈ᵢ_ : IRel A ℓ) -- The underlying indexed equality relation
where
open import Data.Product using (_,_)
open import Function using (_⟨_⟩_)
open import Level using (Level; _⊔_; suc)
open import Relation.Binary as B using (_⇒_)
open import Relation.Binary.PropositionalEquality as P using (_≡_)
open import Relation.Binary.Indexed.Homogeneous.Definitions
------------------------------------------------------------------------
-- Equivalences
-- Indexed structures are laid out in a similar manner as to those
-- in Relation.Binary. The main difference is each structure also
-- contains proofs for the lifted version of the relation.
record IsIndexedEquivalence : Set (i ⊔ a ⊔ ℓ) where
field
reflᵢ : Reflexive A _≈ᵢ_
symᵢ : Symmetric A _≈ᵢ_
transᵢ : Transitive A _≈ᵢ_
reflexiveᵢ : ∀ {i} → _≡_ ⟨ _⇒_ ⟩ _≈ᵢ_ {i}
reflexiveᵢ P.refl = reflᵢ
-- Lift properties
reflexive : _≡_ ⇒ (Lift A _≈ᵢ_)
reflexive P.refl i = reflᵢ
refl : B.Reflexive (Lift A _≈ᵢ_)
refl i = reflᵢ
sym : B.Symmetric (Lift A _≈ᵢ_)
sym x≈y i = symᵢ (x≈y i)
trans : B.Transitive (Lift A _≈ᵢ_)
trans x≈y y≈z i = transᵢ (x≈y i) (y≈z i)
isEquivalence : B.IsEquivalence (Lift A _≈ᵢ_)
isEquivalence = record
{ refl = refl
; sym = sym
; trans = trans
}
record IsIndexedDecEquivalence : Set (i ⊔ a ⊔ ℓ) where
infix 4 _≟ᵢ_
field
_≟ᵢ_ : Decidable A _≈ᵢ_
isEquivalenceᵢ : IsIndexedEquivalence
open IsIndexedEquivalence isEquivalenceᵢ public
------------------------------------------------------------------------
-- Preorders
record IsIndexedPreorder {ℓ₂} (_∼ᵢ_ : IRel A ℓ₂)
: Set (i ⊔ a ⊔ ℓ ⊔ ℓ₂) where
field
isEquivalenceᵢ : IsIndexedEquivalence
reflexiveᵢ : _≈ᵢ_ ⇒[ A ] _∼ᵢ_
transᵢ : Transitive A _∼ᵢ_
module Eq = IsIndexedEquivalence isEquivalenceᵢ
reflᵢ : Reflexive A _∼ᵢ_
reflᵢ = reflexiveᵢ Eq.reflᵢ
∼ᵢ-respˡ-≈ᵢ : Respectsˡ A _∼ᵢ_ _≈ᵢ_
∼ᵢ-respˡ-≈ᵢ x≈y x∼z = transᵢ (reflexiveᵢ (Eq.symᵢ x≈y)) x∼z
∼ᵢ-respʳ-≈ᵢ : Respectsʳ A _∼ᵢ_ _≈ᵢ_
∼ᵢ-respʳ-≈ᵢ x≈y z∼x = transᵢ z∼x (reflexiveᵢ x≈y)
∼ᵢ-resp-≈ᵢ : Respects₂ A _∼ᵢ_ _≈ᵢ_
∼ᵢ-resp-≈ᵢ = ∼ᵢ-respʳ-≈ᵢ , ∼ᵢ-respˡ-≈ᵢ
-- Lifted properties
reflexive : Lift A _≈ᵢ_ B.⇒ Lift A _∼ᵢ_
reflexive x≈y i = reflexiveᵢ (x≈y i)
refl : B.Reflexive (Lift A _∼ᵢ_)
refl i = reflᵢ
trans : B.Transitive (Lift A _∼ᵢ_)
trans x≈y y≈z i = transᵢ (x≈y i) (y≈z i)
∼-respˡ-≈ : (Lift A _∼ᵢ_) B.Respectsˡ (Lift A _≈ᵢ_)
∼-respˡ-≈ x≈y x∼z i = ∼ᵢ-respˡ-≈ᵢ (x≈y i) (x∼z i)
∼-respʳ-≈ : (Lift A _∼ᵢ_) B.Respectsʳ (Lift A _≈ᵢ_)
∼-respʳ-≈ x≈y z∼x i = ∼ᵢ-respʳ-≈ᵢ (x≈y i) (z∼x i)
∼-resp-≈ : (Lift A _∼ᵢ_) B.Respects₂ (Lift A _≈ᵢ_)
∼-resp-≈ = ∼-respʳ-≈ , ∼-respˡ-≈
isPreorder : B.IsPreorder (Lift A _≈ᵢ_) (Lift A _∼ᵢ_)
isPreorder = record
{ isEquivalence = Eq.isEquivalence
; reflexive = reflexive
; trans = trans
}
------------------------------------------------------------------------
-- Partial orders
record IsIndexedPartialOrder {ℓ₂} (_≤ᵢ_ : IRel A ℓ₂)
: Set (i ⊔ a ⊔ ℓ ⊔ ℓ₂) where
field
isPreorderᵢ : IsIndexedPreorder _≤ᵢ_
antisymᵢ : Antisymmetric A _≈ᵢ_ _≤ᵢ_
open IsIndexedPreorder isPreorderᵢ public
renaming
( ∼ᵢ-respˡ-≈ᵢ to ≤ᵢ-respˡ-≈ᵢ
; ∼ᵢ-respʳ-≈ᵢ to ≤ᵢ-respʳ-≈ᵢ
; ∼ᵢ-resp-≈ᵢ to ≤ᵢ-resp-≈ᵢ
; ∼-respˡ-≈ to ≤-respˡ-≈
; ∼-respʳ-≈ to ≤-respʳ-≈
; ∼-resp-≈ to ≤-resp-≈
)
antisym : B.Antisymmetric (Lift A _≈ᵢ_) (Lift A _≤ᵢ_)
antisym x≤y y≤x i = antisymᵢ (x≤y i) (y≤x i)
isPartialOrder : B.IsPartialOrder (Lift A _≈ᵢ_) (Lift A _≤ᵢ_)
isPartialOrder = record
{ isPreorder = isPreorder
; antisym = antisym
}
|
src/fltk-widgets-groups-text_displays-text_editors.adb | micahwelf/FLTK-Ada | 1 | 2476 | <filename>src/fltk-widgets-groups-text_displays-text_editors.adb<gh_stars>1-10
with
FLTK.Event,
Interfaces.C,
System;
use type
Interfaces.C.unsigned_long,
System.Address;
package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
procedure text_editor_set_draw_hook
(W, D : in System.Address);
pragma Import (C, text_editor_set_draw_hook, "text_editor_set_draw_hook");
pragma Inline (text_editor_set_draw_hook);
procedure text_editor_set_handle_hook
(W, H : in System.Address);
pragma Import (C, text_editor_set_handle_hook, "text_editor_set_handle_hook");
pragma Inline (text_editor_set_handle_hook);
function new_fl_text_editor
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_text_editor, "new_fl_text_editor");
pragma Inline (new_fl_text_editor);
procedure free_fl_text_editor
(TE : in System.Address);
pragma Import (C, free_fl_text_editor, "free_fl_text_editor");
pragma Inline (free_fl_text_editor);
procedure fl_text_editor_default
(TE : in System.Address;
K : in Interfaces.C.int);
pragma Import (C, fl_text_editor_default, "fl_text_editor_default");
pragma Inline (fl_text_editor_default);
procedure fl_text_editor_undo
(TE : in System.Address);
pragma Import (C, fl_text_editor_undo, "fl_text_editor_undo");
pragma Inline (fl_text_editor_undo);
procedure fl_text_editor_cut
(TE : in System.Address);
pragma Import (C, fl_text_editor_cut, "fl_text_editor_cut");
pragma Inline (fl_text_editor_cut);
procedure fl_text_editor_copy
(TE : in System.Address);
pragma Import (C, fl_text_editor_copy, "fl_text_editor_copy");
pragma Inline (fl_text_editor_copy);
procedure fl_text_editor_paste
(TE : in System.Address);
pragma Import (C, fl_text_editor_paste, "fl_text_editor_paste");
pragma Inline (fl_text_editor_paste);
procedure fl_text_editor_delete
(TE : in System.Address);
pragma Import (C, fl_text_editor_delete, "fl_text_editor_delete");
pragma Inline (fl_text_editor_delete);
procedure fl_text_editor_select_all
(TE : in System.Address);
pragma Import (C, fl_text_editor_select_all, "fl_text_editor_select_all");
pragma Inline (fl_text_editor_select_all);
procedure fl_text_editor_backspace
(TE : in System.Address);
pragma Import (C, fl_text_editor_backspace, "fl_text_editor_backspace");
pragma Inline (fl_text_editor_backspace);
procedure fl_text_editor_insert
(TE : in System.Address);
pragma Import (C, fl_text_editor_insert, "fl_text_editor_insert");
pragma Inline (fl_text_editor_insert);
procedure fl_text_editor_enter
(TE : in System.Address);
pragma Import (C, fl_text_editor_enter, "fl_text_editor_enter");
pragma Inline (fl_text_editor_enter);
procedure fl_text_editor_ignore
(TE : in System.Address);
pragma Import (C, fl_text_editor_ignore, "fl_text_editor_ignore");
pragma Inline (fl_text_editor_ignore);
procedure fl_text_editor_home
(TE : in System.Address);
pragma Import (C, fl_text_editor_home, "fl_text_editor_home");
pragma Inline (fl_text_editor_home);
procedure fl_text_editor_end
(TE : in System.Address);
pragma Import (C, fl_text_editor_end, "fl_text_editor_end");
pragma Inline (fl_text_editor_end);
procedure fl_text_editor_page_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_page_down, "fl_text_editor_page_down");
pragma Inline (fl_text_editor_page_down);
procedure fl_text_editor_page_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_page_up, "fl_text_editor_page_up");
pragma Inline (fl_text_editor_page_up);
procedure fl_text_editor_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_down, "fl_text_editor_down");
pragma Inline (fl_text_editor_down);
procedure fl_text_editor_left
(TE : in System.Address);
pragma Import (C, fl_text_editor_left, "fl_text_editor_left");
pragma Inline (fl_text_editor_left);
procedure fl_text_editor_right
(TE : in System.Address);
pragma Import (C, fl_text_editor_right, "fl_text_editor_right");
pragma Inline (fl_text_editor_right);
procedure fl_text_editor_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_up, "fl_text_editor_up");
pragma Inline (fl_text_editor_up);
procedure fl_text_editor_shift_home
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_home, "fl_text_editor_shift_home");
pragma Inline (fl_text_editor_shift_home);
procedure fl_text_editor_shift_end
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_end, "fl_text_editor_shift_end");
pragma Inline (fl_text_editor_shift_end);
procedure fl_text_editor_shift_page_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_page_down, "fl_text_editor_shift_page_down");
pragma Inline (fl_text_editor_shift_page_down);
procedure fl_text_editor_shift_page_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_page_up, "fl_text_editor_shift_page_up");
pragma Inline (fl_text_editor_shift_page_up);
procedure fl_text_editor_shift_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_down, "fl_text_editor_shift_down");
pragma Inline (fl_text_editor_shift_down);
procedure fl_text_editor_shift_left
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_left, "fl_text_editor_shift_left");
pragma Inline (fl_text_editor_shift_left);
procedure fl_text_editor_shift_right
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_right, "fl_text_editor_shift_right");
pragma Inline (fl_text_editor_shift_right);
procedure fl_text_editor_shift_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_up, "fl_text_editor_shift_up");
pragma Inline (fl_text_editor_shift_up);
procedure fl_text_editor_ctrl_home
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_home, "fl_text_editor_ctrl_home");
pragma Inline (fl_text_editor_ctrl_home);
procedure fl_text_editor_ctrl_end
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_end, "fl_text_editor_ctrl_end");
pragma Inline (fl_text_editor_ctrl_end);
procedure fl_text_editor_ctrl_page_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_page_down, "fl_text_editor_ctrl_page_down");
pragma Inline (fl_text_editor_ctrl_page_down);
procedure fl_text_editor_ctrl_page_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_page_up, "fl_text_editor_ctrl_page_up");
pragma Inline (fl_text_editor_ctrl_page_up);
procedure fl_text_editor_ctrl_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_down, "fl_text_editor_ctrl_down");
pragma Inline (fl_text_editor_ctrl_down);
procedure fl_text_editor_ctrl_left
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_left, "fl_text_editor_ctrl_left");
pragma Inline (fl_text_editor_ctrl_left);
procedure fl_text_editor_ctrl_right
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_right, "fl_text_editor_ctrl_right");
pragma Inline (fl_text_editor_ctrl_right);
procedure fl_text_editor_ctrl_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_up, "fl_text_editor_ctrl_up");
pragma Inline (fl_text_editor_ctrl_up);
procedure fl_text_editor_ctrl_shift_home
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_home, "fl_text_editor_ctrl_shift_home");
pragma Inline (fl_text_editor_ctrl_shift_home);
procedure fl_text_editor_ctrl_shift_end
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_end, "fl_text_editor_ctrl_shift_end");
pragma Inline (fl_text_editor_ctrl_shift_end);
procedure fl_text_editor_ctrl_shift_page_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_page_down, "fl_text_editor_ctrl_shift_page_down");
pragma Inline (fl_text_editor_ctrl_shift_page_down);
procedure fl_text_editor_ctrl_shift_page_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_page_up, "fl_text_editor_ctrl_shift_page_up");
pragma Inline (fl_text_editor_ctrl_shift_page_up);
procedure fl_text_editor_ctrl_shift_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_down, "fl_text_editor_ctrl_shift_down");
pragma Inline (fl_text_editor_ctrl_shift_down);
procedure fl_text_editor_ctrl_shift_left
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_left, "fl_text_editor_ctrl_shift_left");
pragma Inline (fl_text_editor_ctrl_shift_left);
procedure fl_text_editor_ctrl_shift_right
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_right, "fl_text_editor_ctrl_shift_right");
pragma Inline (fl_text_editor_ctrl_shift_right);
procedure fl_text_editor_ctrl_shift_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_up, "fl_text_editor_ctrl_shift_up");
pragma Inline (fl_text_editor_ctrl_shift_up);
procedure fl_text_editor_add_key_binding
(TE : in System.Address;
K, S : in Interfaces.C.int;
F : in System.Address);
pragma Import (C, fl_text_editor_add_key_binding, "fl_text_editor_add_key_binding");
pragma Inline (fl_text_editor_add_key_binding);
-- this particular procedure won't be necessary when FLTK keybindings fixed
procedure fl_text_editor_remove_key_binding
(TE : in System.Address;
K, S : in Interfaces.C.int);
pragma Import (C, fl_text_editor_remove_key_binding, "fl_text_editor_remove_key_binding");
pragma Inline (fl_text_editor_remove_key_binding);
procedure fl_text_editor_remove_all_key_bindings
(TE : in System.Address);
pragma Import (C, fl_text_editor_remove_all_key_bindings,
"fl_text_editor_remove_all_key_bindings");
pragma Inline (fl_text_editor_remove_all_key_bindings);
procedure fl_text_editor_set_default_key_function
(TE, F : in System.Address);
pragma Import (C, fl_text_editor_set_default_key_function,
"fl_text_editor_set_default_key_function");
pragma Inline (fl_text_editor_set_default_key_function);
function fl_text_editor_get_insert_mode
(TE : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_text_editor_get_insert_mode, "fl_text_editor_get_insert_mode");
pragma Inline (fl_text_editor_get_insert_mode);
procedure fl_text_editor_set_insert_mode
(TE : in System.Address;
I : in Interfaces.C.int);
pragma Import (C, fl_text_editor_set_insert_mode, "fl_text_editor_set_insert_mode");
pragma Inline (fl_text_editor_set_insert_mode);
-- function fl_text_editor_get_tab_nav
-- (TE : in System.Address)
-- return Interfaces.C.int;
-- pragma Import (C, fl_text_editor_get_tab_nav, "fl_text_editor_get_tab_nav");
-- pragma Inline (fl_text_editor_get_tab_nav);
-- procedure fl_text_editor_set_tab_nav
-- (TE : in System.Address;
-- T : in Interfaces.C.int);
-- pragma Import (C, fl_text_editor_set_tab_nav, "fl_text_editor_set_tab_nav");
-- pragma Inline (fl_text_editor_set_tab_nav);
procedure fl_text_editor_draw
(W : in System.Address);
pragma Import (C, fl_text_editor_draw, "fl_text_editor_draw");
pragma Inline (fl_text_editor_draw);
function fl_text_editor_handle
(W : in System.Address;
E : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_text_editor_handle, "fl_text_editor_handle");
pragma Inline (fl_text_editor_handle);
function Key_Func_Hook
(K : in Interfaces.C.int;
E : in System.Address)
return Interfaces.C.int
is
Ada_Editor : access Text_Editor'Class :=
Editor_Convert.To_Pointer (fl_widget_get_user_data (E));
Modi : Modifier := FLTK.Event.Last_Modifier;
Ada_Key : Key_Combo :=
To_Ada (Interfaces.C.unsigned_long (K) + To_C (Modi));
Found_Binding : Boolean := False;
begin
for B of Ada_Editor.Bindings loop
if B.Key = Ada_Key then
B.Func (Ada_Editor.all);
Found_Binding := True;
end if;
end loop;
if not Found_Binding and then Ada_Editor.Default_Func /= null then
Ada_Editor.Default_Func (Ada_Editor.all, Ada_Key);
end if;
return 1;
end Key_Func_Hook;
procedure Finalize
(This : in out Text_Editor) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in Text_Editor'Class
then
This.Clear;
free_fl_text_editor (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
Finalize (Text_Display (This));
end Finalize;
-- remove this type and array once FLTK keybindings fixed
-- type To_Remove is record
-- Press : Keypress;
-- Modif : Interfaces.C.int;
-- end record;
-- To_Remove_List : array (Positive range <>) of To_Remove :=
-- ((Home_Key, 0),
-- (End_Key, 0),
-- (Page_Down_Key, 0),
-- (Page_Up_Key, 0),
-- (Down_Key, 0),
-- (Left_Key, 0),
-- (Right_Key, 0),
-- (Up_Key, 0),
-- (Character'Pos ('/'), Interfaces.C.int (Mod_Ctrl)),
-- (Delete_Key, Interfaces.C.int (Mod_Shift)),
-- (Insert_Key, Interfaces.C.int (Mod_Ctrl)),
-- (Insert_Key, Interfaces.C.int (Mod_Shift)));
-- use type Interfaces.C.int;
-- To_Remove_Weird : array (Positive range <>) of To_Remove :=
-- ((Enter_Key, -1),
-- (Keypad_Enter_Key, -1),
-- (Backspace_Key, -1),
-- (Insert_Key, -1),
-- (Delete_Key, -1),
-- (Escape_Key, -1));
package body Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String)
return Text_Editor
is
use type Interfaces.C.int;
begin
return This : Text_Editor do
This.Void_Ptr := new_fl_text_editor
(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));
text_editor_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
text_editor_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
-- change things over so key bindings are all handled from the Ada side
This.Bindings := Binding_Vectors.Empty_Vector;
for B of Default_Key_Bindings loop
This.Bindings.Append (B);
end loop;
This.Default_Func := Default'Access;
-- remove these loops and uncomment subsequent "remove_all_key_bindings"
-- when FLTK keybindings fixed
-- for B of To_Remove_List loop
-- fl_text_editor_remove_key_binding
-- (This.Void_Ptr,
-- Interfaces.C.int (B.Press),
-- B.Modif * 65536);
-- end loop;
-- for B of To_Remove_Weird loop
-- fl_text_editor_remove_key_binding
-- (This.Void_Ptr,
-- Interfaces.C.int (B.Press),
-- B.Modif);
-- end loop;
fl_text_editor_remove_all_key_bindings (This.Void_Ptr);
fl_text_editor_set_default_key_function (This.Void_Ptr, Key_Func_Hook'Address);
-- this is irritatingly required due to how FLTK handles certain keys
-- for B of Default_Key_Bindings loop
-- -- remove this conditional once FLTK keybindings fixed
-- if B.Key.Modcode = Mod_None then
-- fl_text_editor_add_key_binding
-- (This.Void_Ptr,
-- Interfaces.C.int (B.Key.Keycode),
-- Interfaces.C.int (B.Key.Modcode) * 65536,
-- Key_Func_Hook'Address);
-- end if;
-- end loop;
end return;
end Create;
end Forge;
procedure Default
(This : in out Text_Editor'Class;
Key : in Key_Combo) is
begin
fl_text_editor_default
(This.Void_Ptr,
Interfaces.C.int (Key.Keycode));
end Default;
procedure Undo
(This : in out Text_Editor'Class) is
begin
fl_text_editor_undo (This.Void_Ptr);
end Undo;
procedure Cut
(This : in out Text_Editor'Class) is
begin
fl_text_editor_cut (This.Void_Ptr);
end Cut;
procedure Copy
(This : in out Text_Editor'Class) is
begin
fl_text_editor_copy (This.Void_Ptr);
end Copy;
procedure Paste
(This : in out Text_Editor'Class) is
begin
fl_text_editor_paste (This.Void_Ptr);
end Paste;
procedure Delete
(This : in out Text_Editor'Class) is
begin
fl_text_editor_delete (This.Void_Ptr);
end Delete;
procedure Select_All
(This : in out Text_Editor'Class) is
begin
fl_text_editor_select_all (This.Void_Ptr);
end Select_All;
procedure KF_Backspace
(This : in out Text_Editor'Class) is
begin
fl_text_editor_backspace (This.Void_Ptr);
end KF_Backspace;
procedure KF_Insert
(This : in out Text_Editor'Class) is
begin
fl_text_editor_insert (This.Void_Ptr);
end KF_Insert;
procedure KF_Enter
(This : in out Text_Editor'Class) is
begin
fl_text_editor_enter (This.Void_Ptr);
end KF_Enter;
procedure KF_Ignore
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ignore (This.Void_Ptr);
end KF_Ignore;
procedure KF_Home
(This : in out Text_Editor'Class) is
begin
fl_text_editor_home (This.Void_Ptr);
end KF_Home;
procedure KF_End
(This : in out Text_Editor'Class) is
begin
fl_text_editor_end (This.Void_Ptr);
end KF_End;
procedure KF_Page_Down
(This : in out Text_Editor'Class) is
begin
fl_text_editor_page_down (This.Void_Ptr);
end KF_Page_Down;
procedure KF_Page_Up
(This : in out Text_Editor'Class) is
begin
fl_text_editor_page_up (This.Void_Ptr);
end KF_Page_Up;
procedure KF_Down
(This : in out Text_Editor'Class) is
begin
fl_text_editor_down (This.Void_Ptr);
end KF_Down;
procedure KF_Left
(This : in out Text_Editor'Class) is
begin
fl_text_editor_left (This.Void_Ptr);
end KF_Left;
procedure KF_Right
(This : in out Text_Editor'Class) is
begin
fl_text_editor_right (This.Void_Ptr);
end KF_Right;
procedure KF_Up
(This : in out Text_Editor'Class) is
begin
fl_text_editor_up (This.Void_Ptr);
end KF_Up;
procedure KF_Shift_Home
(This : in out Text_Editor'Class) is
begin
fl_text_editor_shift_home (This.Void_Ptr);
end KF_Shift_Home;
procedure KF_Shift_End
(This : in out Text_Editor'Class) is
begin
fl_text_editor_shift_end (This.Void_Ptr);
end KF_Shift_End;
procedure KF_Shift_Page_Down
(This : in out Text_Editor'Class) is
begin
fl_text_editor_shift_page_down (This.Void_Ptr);
end KF_Shift_Page_Down;
procedure KF_Shift_Page_Up
(This : in out Text_Editor'Class) is
begin
fl_text_editor_shift_page_up (This.Void_Ptr);
end KF_Shift_Page_Up;
procedure KF_Shift_Down
(This : in out Text_Editor'Class) is
begin
fl_text_editor_shift_down (This.Void_Ptr);
end KF_Shift_Down;
procedure KF_Shift_Left
(This : in out Text_Editor'Class) is
begin
fl_text_editor_shift_left (This.Void_Ptr);
end KF_Shift_Left;
procedure KF_Shift_Right
(This : in out Text_Editor'Class) is
begin
fl_text_editor_shift_right (This.Void_Ptr);
end KF_Shift_Right;
procedure KF_Shift_Up
(This : in out Text_Editor'Class) is
begin
fl_text_editor_shift_up (This.Void_Ptr);
end KF_Shift_Up;
procedure KF_Ctrl_Home
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_home (This.Void_Ptr);
end KF_Ctrl_Home;
procedure KF_Ctrl_End
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_end (This.Void_Ptr);
end KF_Ctrl_End;
procedure KF_Ctrl_Page_Down
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_page_down (This.Void_Ptr);
end KF_Ctrl_Page_Down;
procedure KF_Ctrl_Page_Up
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_page_up (This.Void_Ptr);
end KF_Ctrl_Page_Up;
procedure KF_Ctrl_Down
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_down (This.Void_Ptr);
end KF_Ctrl_Down;
procedure KF_Ctrl_Left
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_left (This.Void_Ptr);
end KF_Ctrl_Left;
procedure KF_Ctrl_Right
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_right (This.Void_Ptr);
end KF_Ctrl_Right;
procedure KF_Ctrl_Up
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_up (This.Void_Ptr);
end KF_Ctrl_Up;
procedure KF_Ctrl_Shift_Home
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_shift_home (This.Void_Ptr);
end KF_Ctrl_Shift_Home;
procedure KF_Ctrl_Shift_End
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_shift_end (This.Void_Ptr);
end KF_Ctrl_Shift_End;
procedure KF_Ctrl_Shift_Page_Down
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_shift_page_down (This.Void_Ptr);
end KF_Ctrl_Shift_Page_Down;
procedure KF_Ctrl_Shift_Page_Up
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_shift_page_up (This.Void_Ptr);
end KF_Ctrl_Shift_Page_Up;
procedure KF_Ctrl_Shift_Down
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_shift_down (This.Void_Ptr);
end KF_Ctrl_Shift_Down;
procedure KF_Ctrl_Shift_Left
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_shift_left (This.Void_Ptr);
end KF_Ctrl_Shift_Left;
procedure KF_Ctrl_Shift_Right
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_shift_right (This.Void_Ptr);
end KF_Ctrl_Shift_Right;
procedure KF_Ctrl_Shift_Up
(This : in out Text_Editor'Class) is
begin
fl_text_editor_ctrl_shift_up (This.Void_Ptr);
end KF_Ctrl_Shift_Up;
procedure Add_Key_Binding
(This : in out Text_Editor;
Key : in Key_Combo;
Func : in Key_Func) is
begin
This.Bindings.Append ((Key, Func));
end Add_Key_Binding;
procedure Add_Key_Binding
(This : in out Text_Editor;
Bind : in Key_Binding) is
begin
This.Bindings.Append (Bind);
end Add_Key_Binding;
procedure Add_Key_Bindings
(This : in out Text_Editor;
List : in Key_Binding_List) is
begin
for I of List loop
This.Bindings.Append (I);
end loop;
end Add_Key_Bindings;
function Get_Bound_Key_Function
(This : in Text_Editor;
Key : in Key_Combo)
return Key_Func is
begin
for I in 1 .. Integer (This.Bindings.Length) loop
if This.Bindings.Element (I).Key = Key then
return This.Bindings.Element (I).Func;
end if;
end loop;
return null;
end Get_Bound_Key_Function;
procedure Remove_Key_Binding
(This : in out Text_Editor;
Key : in Key_Combo)
is
use type Interfaces.C.int;
begin
for I in reverse 1 .. Integer (This.Bindings.Length) loop
if This.Bindings.Reference (I).Key = Key then
This.Bindings.Delete (I);
end if;
end loop;
-- remove this once FLTK keybindings fixed
-- if Key.Modcode /= Mod_None then
-- fl_text_editor_remove_key_binding
-- (This.Void_Ptr,
-- Interfaces.C.int (Key.Keycode),
-- Interfaces.C.int (Key.Modcode) * 65536);
-- end if;
end Remove_Key_Binding;
procedure Remove_Key_Binding
(This : in out Text_Editor;
Bind : in Key_Binding)
is
-- use type Interfaces.C.int;
begin
for I in reverse 1 .. Integer (This.Bindings.Length) loop
if This.Bindings.Reference (I).Key = Bind.Key then
This.Bindings.Delete (I);
end if;
end loop;
-- remove this once FLTK keybindings fixed
-- if Bind.Key.Modcode /= Mod_None then
-- fl_text_editor_remove_key_binding
-- (This.Void_Ptr,
-- Interfaces.C.int (Bind.Key.Keycode),
-- Interfaces.C.int (Bind.Key.Modcode) * 65536);
-- end if;
end Remove_Key_Binding;
procedure Remove_Key_Bindings
(This : in out Text_Editor;
List : in Key_Binding_List) is
begin
for I of List loop
This.Remove_Key_Binding (I);
end loop;
end Remove_Key_Bindings;
procedure Remove_All_Key_Bindings
(This : in out Text_Editor) is
begin
This.Bindings := Binding_Vectors.Empty_Vector;
-- This.Default_Func := null;
-- remove this once FLTK keybindings fixed
-- fl_text_editor_remove_all_key_bindings (This.Void_Ptr);
end Remove_All_Key_Bindings;
function Get_Default_Key_Function
(This : in Text_Editor)
return Default_Key_Func is
begin
return This.Default_Func;
end Get_Default_Key_Function;
procedure Set_Default_Key_Function
(This : in out Text_Editor;
Func : in Default_Key_Func) is
begin
This.Default_Func := Func;
end Set_Default_Key_Function;
function Get_Insert_Mode
(This : in Text_Editor)
return Insert_Mode is
begin
return Insert_Mode'Val (fl_text_editor_get_insert_mode (This.Void_Ptr));
end Get_Insert_Mode;
procedure Set_Insert_Mode
(This : in out Text_Editor;
To : in Insert_Mode) is
begin
fl_text_editor_set_insert_mode (This.Void_Ptr, Insert_Mode'Pos (To));
end Set_Insert_Mode;
-- function Get_Tab_Nav_Mode
-- (This : in Text_Editor)
-- return Tab_Navigation is
-- begin
-- return Tab_Navigation'Val (fl_text_editor_get_tab_nav (This.Void_Ptr));
-- end Get_Tab_Nav_Mode;
-- procedure Set_Tab_Nav_Mode
-- (This : in out Text_Editor;
-- To : in Tab_Navigation) is
-- begin
-- fl_text_editor_set_tab_nav (This.Void_Ptr, Tab_Navigation'Pos (To));
-- end Set_Tab_Nav_Mode;
procedure Draw
(This : in out Text_Editor) is
begin
fl_text_editor_draw (This.Void_Ptr);
end Draw;
function Handle
(This : in out Text_Editor;
Event : in Event_Kind)
return Event_Outcome is
begin
return Event_Outcome'Val
(fl_text_editor_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
end Handle;
end FLTK.Widgets.Groups.Text_Displays.Text_Editors;
|
Cubical/HITs/ListedFiniteSet/Properties.agda | mchristianl/cubical | 0 | 8237 | {-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.HITs.ListedFiniteSet.Properties where
open import Cubical.Foundations.Prelude
open import Cubical.HITs.ListedFiniteSet.Base
private
variable
A : Type₀
_++_ : ∀ (xs ys : LFSet A) → LFSet A
[] ++ ys = ys
(x ∷ xs) ++ ys = x ∷ (xs ++ ys)
---------------------------------------------
dup x xs i ++ ys = proof i
where
proof :
-- Need: (x ∷ x ∷ xs) ++ ys ≡ (x ∷ xs) ++ ys
-- which reduces to:
x ∷ x ∷ (xs ++ ys) ≡ x ∷ (xs ++ ys)
proof = dup x (xs ++ ys)
comm x y xs i ++ ys = comm x y (xs ++ ys) i
trunc xs zs p q i j ++ ys
= trunc (xs ++ ys) (zs ++ ys) (cong (_++ ys) p) (cong (_++ ys) q) i j
assoc-++ : ∀ (xs : LFSet A) ys zs → xs ++ (ys ++ zs) ≡ (xs ++ ys) ++ zs
assoc-++ [] ys zs = refl
assoc-++ (x ∷ xs) ys zs
= cong (x ∷_) (assoc-++ xs ys zs)
------------------------------------
assoc-++ (dup x xs i) ys zs j
= dup x (assoc-++ xs ys zs j) i
assoc-++ (comm x y xs i) ys zs j
= comm x y (assoc-++ xs ys zs j) i
assoc-++ (trunc xs xs' p q i k) ys zs j
= trunc (assoc-++ xs ys zs j) (assoc-++ xs' ys zs j)
(cong (\ xs -> assoc-++ xs ys zs j) p) (cong (\ xs -> assoc-++ xs ys zs j) q) i k
|
3-mid/physics/interface/source/physics-forge.ads | charlie5/lace | 20 | 19212 | <reponame>charlie5/lace
with
physics.Space;
package physics.Forge
--
-- Provides constructors for physics classes.
--
is
type Real_view is access all math.Real;
----------
--- Space
--
function new_Space (Kind : in space_Kind) return Space.view;
end physics.Forge;
|
Comp_Stats_Unit_test.adb | salmoni/CompStats_Statistics_Ada | 0 | 6116 | <gh_stars>0
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;
with CompStats_Statistics;
use CompStats_Statistics;
procedure Comp_Stats_Unit_test is
Values: CompStats_Statistics.Values_Array(1..20);
Values2 : CompStats_Statistics.Values_Array(1..10);
procedure Test_Get_Count (Values : CompStats_Statistics.Values_Array) is
Result : INTEGER;
begin
Put("Get_Count : ");
Result := Get_Count(Values);
if Result = 20 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Count;
procedure Test_Get_Minimum (Values : CompStats_Statistics.Values_Array) is
Result : FLOAT;
begin
Put("Get_Minimum : ");
Result := Get_Minimum(Values);
if Result = -1.405158 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Minimum;
procedure Test_Get_Maximum (Values : CompStats_Statistics.Values_Array) is
Result : FLOAT;
begin
Put("Get_Maximum : ");
Result := Get_Maximum(Values);
if Result = 2.614303 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Maximum;
procedure Test_Get_Range (Values : CompStats_Statistics.Values_Array) is
Result : FLOAT;
begin
Put("Get_Range : ");
Result := Get_Range(Values);
if Result = 4.019462 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Range;
procedure Test_Get_Sum (Values : CompStats_Statistics.Values_Array) is
Result : FLOAT;
begin
Put("Get_Sum : ");
Result := Get_Sum(Values);
if Result = 4.070304 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Sum;
procedure Test_Get_Mean (Values : CompStats_Statistics.Values_Array) is
Result : FLOAT;
begin
Put("Get_Mean : ");
Result := Get_Mean (Values);
if Result = 0.2035152 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Mean;
procedure Test_Get_Sum_Of_Squares (Values : CompStats_Statistics.Values_Array) is
Result : FLOAT;
begin
Put("Get_Sum_Of_Squares : ");
Result := Get_Sum_Of_Squares (Values);
if Result = 24.19856 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Sum_Of_Squares;
procedure Test_Get_Population_Variance (Values : CompStats_Statistics.Values_Array) is
Result : FLOAT;
begin
Put("Get_Population_Variance : ");
Result := Get_Population_Variance (Values);
if Result = 1.209928 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Population_Variance;
procedure Test_Get_Sample_Variance (Values : CompStats_Statistics.Values_Array) is
Result : FLOAT;
begin
Put("Get_Sample_Variance : ");
Result := Get_Sample_Variance (Values);
if Result = 1.273608 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Sample_Variance;
procedure Test_Get_Population_Standard_Deviation (Values : CompStats_Statistics.Values_Array) is
Result : FLOAT;
begin
Put("Get_Population_Standard_Deviation : ");
Result := Get_Population_Standard_Deviation (Values);
if Result = 1.099967 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Population_Standard_Deviation;
procedure Test_Get_Sample_Standard_Deviation (Values : CompStats_Statistics.Values_Array) is
Result : FLOAT;
begin
Put("Get_Sample_Standard_Deviation : ");
Result := Get_Sample_Standard_Deviation (Values);
if Result = 1.128543 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Sample_Standard_Deviation;
procedure Test_Get_Standard_Error_of_Mean (Values : CompStats_Statistics.Values_Array) is
Result : FLOAT;
begin
Put("Get_Standard_Error_of_Mean : ");
Result := Get_Standard_Error_of_Mean (Values);
if Result = 0.2523498 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Standard_Error_of_Mean;
procedure Test_Get_Coefficient_Of_Variation (Values : CompStats_Statistics.Values_Array) is
Result : FLOAT;
begin
Put("Get_Coefficient_Of_Variation : ");
Result := Get_Coefficient_Of_Variation (Values);
if Result = 5.54525 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Coefficient_Of_Variation;
procedure Test_Get_Unique_Values (Values : CompStats_Statistics.Values_Array) is
begin
Put("Get_Unique_Values : ");
declare
Result : CompStats_Statistics.Values_Array := Get_Unique_Values (Values);
begin
for index in Integer range 1..Result'Length loop
put(Result(index));
put(", ");
end loop;
New_Line;
end;
end Test_Get_Unique_Values;
begin
Values := (0.4926728,-0.9673927, -0.4806392, 1.8226585, -1.3384936, 1.1307992, -0.3709324, 2.6143034, 0.6338060, -1.1862009, -0.5621848, 0.7465022, 1.8787472, -0.1642065, -1.4051581, 0.1519102, 0.1349542, 0.8196982, -0.7524447, 0.8719052);
Values2 := (1.0, 1.0, 1.0, 2.3, 2.3, 2.3, -1.0, -1.0, -6.0, 0.0);
Test_Get_Count (Values);
Test_Get_Minimum (Values);
Test_Get_Maximum (Values);
Test_Get_Range (Values);
Test_Get_Sum (Values);
Test_Get_Mean (Values);
Test_Get_Sum_Of_Squares (Values);
Test_Get_Population_Variance (Values);
Test_Get_Sample_Variance (Values);
Test_Get_Population_Standard_Deviation (Values);
Test_Get_Sample_Standard_Deviation (Values);
Test_Get_Standard_Error_of_Mean (Values);
Test_Get_Coefficient_Of_Variation (Values);
Test_Get_Unique_Values (Values2);
end Comp_Stats_Unit_test;
-- 0.4926728,-0.9673927, -0.4806392, 1.8226585, -1.3384936, 1.1307992, -0.3709324, 2.6143034, 0.6338060, -1.1862009, -0.5621848, 0.7465022, 1.8787472, -0.1642065, -1.4051581, 0.1519102, 0.1349542, 0.8196982, -0.7524447, 0.8719052
|
src/joypad.asm | NEPETAISCUTE/simon-gameboy | 1 | 90064 | <filename>src/joypad.asm
INCLUDE "src/lib/hardware.inc"
JOYPADMASK EQU %00001111
SECTION "Joypad", ROM0
;;ReadJoypad
;;a, b and f are trashed
;;returns the status of the joypad 1 into [wJoypad1]
ReadJoypad::
ld a, P1F_GET_DPAD
ldh [rP1], a
ldh a, [rP1]
ldh a, [rP1]
ldh a, [rP1]
ldh a, [rP1]
ldh a, [rP1]
ldh a, [rP1]
cpl
and a, JOYPADMASK
swap a
ld b, a
ld a, P1F_GET_BTN
ldh [rP1], a
ldh a, [rP1]
ldh a, [rP1]
ldh a, [rP1]
ldh a, [rP1]
ldh a, [rP1]
ldh a, [rP1]
cpl
and a, JOYPADMASK
or a, b
ld [wJoypad1], a
ld a, P1F_GET_NONE
ld [rP1], a
ret
|
Transynther/x86/_processed/NC/_zr_/i7-8650U_0xd2_notsx.log_1061_879.asm | ljhsiun2/medusa | 9 | 103268 | .global s_prepare_buffers
s_prepare_buffers:
push %r8
push %rbx
push %rcx
push %rdi
lea addresses_A_ht+0x13a3, %rbx
nop
nop
nop
nop
cmp $27660, %r8
mov (%rbx), %di
dec %rcx
pop %rdi
pop %rcx
pop %rbx
pop %r8
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r15
push %rbx
push %rcx
push %rdi
push %rdx
// Store
lea addresses_RW+0x8383, %r15
clflush (%r15)
add $34254, %r12
mov $0x5152535455565758, %rdx
movq %rdx, (%r15)
and %rdi, %rdi
// Load
mov $0x398a5d0000000ce3, %r15
nop
nop
nop
and %rdi, %rdi
mov (%r15), %r10w
nop
nop
nop
and $46485, %r15
// Store
mov $0xad3, %rbx
nop
nop
nop
nop
nop
cmp $62054, %rcx
movw $0x5152, (%rbx)
nop
nop
nop
nop
nop
sub %rdi, %rdi
// Store
mov $0x863, %rdi
nop
nop
nop
nop
cmp $48946, %rdx
mov $0x5152535455565758, %r12
movq %r12, (%rdi)
nop
nop
nop
nop
nop
cmp $27063, %rdx
// Faulty Load
mov $0x607ffc0000000063, %rcx
nop
nop
inc %r10
mov (%rcx), %rdx
lea oracles, %rbx
and $0xff, %rdx
shlq $12, %rdx
mov (%rbx,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'00': 1061}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/s-bignum.ads | djamal2727/Main-Bearing-Analytical-Model | 0 | 7260 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . B I G N U M S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2012-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides arbitrary precision signed integer arithmetic for
-- use in computing intermediate values in expressions for the case where
-- pragma Overflow_Check (Eliminated) is in effect.
-- Note that we cannot use a straight instantiation of System.Generic_Bignums
-- because the rtsfind mechanism is not ready to handle instantiations.
with System.Shared_Bignums;
package System.Bignums is
pragma Preelaborate;
subtype Bignum is System.Shared_Bignums.Bignum;
function Big_Add (X, Y : Bignum) return Bignum; -- "+"
function Big_Sub (X, Y : Bignum) return Bignum; -- "-"
function Big_Mul (X, Y : Bignum) return Bignum; -- "*"
function Big_Div (X, Y : Bignum) return Bignum; -- "/"
function Big_Exp (X, Y : Bignum) return Bignum; -- "**"
function Big_Mod (X, Y : Bignum) return Bignum; -- "mod"
function Big_Rem (X, Y : Bignum) return Bignum; -- "rem"
function Big_Neg (X : Bignum) return Bignum; -- "-"
function Big_Abs (X : Bignum) return Bignum; -- "abs"
-- Perform indicated arithmetic operation on bignum values. No exception
-- raised except for Div/Mod/Rem by 0 which raises Constraint_Error with
-- an appropriate message.
function Big_EQ (X, Y : Bignum) return Boolean; -- "="
function Big_NE (X, Y : Bignum) return Boolean; -- "/="
function Big_GE (X, Y : Bignum) return Boolean; -- ">="
function Big_LE (X, Y : Bignum) return Boolean; -- "<="
function Big_GT (X, Y : Bignum) return Boolean; -- ">"
function Big_LT (X, Y : Bignum) return Boolean; -- "<"
-- Perform indicated comparison on bignums, returning result as Boolean.
-- No exception raised for any input arguments.
function Bignum_In_LLI_Range (X : Bignum) return Boolean;
-- Returns True if the Bignum value is in the range of Long_Long_Integer,
-- so that a call to From_Bignum is guaranteed not to raise an exception.
function To_Bignum (X : Long_Long_Integer) return Bignum;
-- Convert Long_Long_Integer to Bignum. No exception can be raised for any
-- input argument.
function From_Bignum (X : Bignum) return Long_Long_Integer;
-- Convert Bignum to Long_Long_Integer. Constraint_Error raised with
-- appropriate message if value is out of range of Long_Long_Integer.
private
pragma Inline (Big_Add);
pragma Inline (Big_Sub);
pragma Inline (Big_Mul);
pragma Inline (Big_Div);
pragma Inline (Big_Exp);
pragma Inline (Big_Mod);
pragma Inline (Big_Rem);
pragma Inline (Big_Neg);
pragma Inline (Big_Abs);
pragma Inline (Big_EQ);
pragma Inline (Big_NE);
pragma Inline (Big_GE);
pragma Inline (Big_LE);
pragma Inline (Big_GT);
pragma Inline (Big_LT);
pragma Inline (Bignum_In_LLI_Range);
pragma Inline (To_Bignum);
pragma Inline (From_Bignum);
end System.Bignums;
|
oeis/114/A114688.asm | neoneye/loda-programs | 11 | 163435 | ; A114688: Expansion of (1 +3*x -x^2)/((1-x^2)*(1-2*x-x^2)); a Pellian-related sequence.
; Submitted by <NAME>(s1)
; 1,5,11,30,71,175,421,1020,2461,5945,14351,34650,83651,201955,487561,1177080,2841721,6860525,16562771,39986070,96534911,233055895,562646701,1358349300,3279345301,7917039905,19113425111,46143890130,111401205371,268946300875,649293807121,1567533915120,3784361637361,9136257189845,22056876017051,53250009223950,128556894464951,310363798153855,749284490772661,1808932779699180,4367150050171021,10543232880041225,25453615810253471,61450464500548170,148354544811349811,358159554123247795,864673653057845401
seq $0,52937 ; Expansion of (2-3*x-x^2)/((1-x)*(1-2*x-x^2)).
seq $0,90771 ; Numbers that are congruent to {1, 9} mod 10.
mul $0,3
sub $0,27
div $0,6
|
ohmin.g4 | ypid/opening_hours_grammar | 4 | 5636 | <reponame>ypid/opening_hours_grammar<gh_stars>1-10
grammar ohmin;
// Basic elements
// Trivial stuff, prefixed with 'c' and should never change during grammar development
// Note: case SENSITIVE
// Note: order is important (hold "Ctrl" to inspect how input steam was tolenized in IDEA)
c247string : '24/7';
//HH_MM : NUMBERS ':' NUMBERS;
//TIMERANGE : HH_MM '-' HH_MM;
//TODO: not sure how to include negative integer separately or why it is impossible
//NEGATIVE_INTEGER : '-' (('1'..'9') | ('1'..'9')('0'..'9')+);
NUMBERS : '0' | '00' | '0'? ('1'..'9') | ('1'..'9')('0'..'9')+;
/* How to make them live together with rules above?
YEAR4LETTER : ('19' | '20') '0'..'9' '0'..'9';
MINUTE : '0'? '1'..'9' | ('1'..'5' '0'..'9') | '60';
HOUR : '0'? '1'..'9' | ('1'..'2' '0'..'9') | '21' | '22' | '23' | '24';
ZERO : '0';
*/
//chour : DIGIT | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' | '22' | '23' | '24';
/* daynum */
//cday : FIRSTTENWITHLEADINGZEROS | FIRSTTENWITHOUTLEADINGZEROS | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' | '22' | '23' | '24' | '25' | '26' | '27' | '28' | '29' | '30' | '31';
/* wday */
cdayoftheweek : cworkdays | cweekend; // Unnecessary overcomplication, mainly for richer stats
cworkdays : cworkdays2letters | cworkdays3letters;
cworkdays2letters : 'Mo' | 'Tu' | 'We' | 'Th' | 'Fr';
cworkdays3letters : 'Mon' | 'Tue' | 'Wed' | 'Thu' | 'Fri';
cweekend : cweekend2letters | cweekend3letters;
cweekend2letters : 'Sa' | 'Su';
cweekend3letters : 'Sat' | 'Sun';
//cweeknum : FIRSTTENWITHLEADINGZEROS | FIRSTTENWITHOUTLEADINGZEROS | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' | '22' | '23' | '24' | '25' | '26' | '27' | '28' | '29' | '30' | '31' | '32' | '33' | '34' | '35' | '36' | '37' | '38' | '39' | '40' | '41' | '42' | '43' | '44' | '45' | '46' | '47' | '48' | '49' | '50' | '51' | '52' | '53';
// Is it possible to allow numeric monthss?
cmonth : 'Jan' | 'Feb' | 'Mar' | 'Apr' | 'May' | 'Jun' | 'Jul' | 'Aug' | 'Sep' | 'Oct' | 'Nov' | 'Dec';
/* event */
// TODO: review moveable_holidays
// TODO: review variable_time
csunlightevent : 'dawn' | 'sunrise' | 'sunset' | 'dusk';
/* extended hour */
// TODO test against values in database, adjust
//cwrappinghour : '25' | '26' | '27' | '28' | '29' | '30' | '31' | '32' | '33' | '34' | '35' | '36' | '37' | '38' | '39' | '40' | '41' | '42' | '43' | '44' | '45' | '46' | '47' | '48';
/* plus_or_minus */
coffsetsymbols: '+' | '-';
//TODO: refactor everything above first, have fun
cminute : NUMBERS;
chour : NUMBERS;
cday : NUMBERS;
cweeknum : NUMBERS;
cwrappinghour : NUMBERS;
//
// Non-trivial rules below
//
positive_integer : NUMBERS;
negative_integer : '-' positive_integer; //TODO: see above about NEGATIVE_INTEGER
//integer : negative_integer | positive_integer;
hh_mm : chour ':' cminute;
/* extended_hour_minutes */
//wrapping_hh_mm : cwrappinghour ':' cminute;
COMMENT : '"' ~('"')+? '"';
comment :
COMMENT #Nonemptycomment
| '""' #Emptycomment
;
nth_entry : negative_integer | positive_integer | positive_integer'-'positive_integer;
WS : [' ' | '\t' | '\n']+ -> channel(HIDDEN);
//
// TOP-level rule and actual grammar below
//
// https://github.com/antlr/antlr4/blob/master/doc/
// https://github.com/antlr/antlr4/blob/master/doc/parser-rules.md
//
// status: WIP
// week 4-16 We 00:00-24:00; week 38-42 Sa 00:00-24:00; PH off
// week 2-52/2 We 00:00-24:00; week 1-53/2 Sa 00:00-24:00; PH off
// Jan 23-Feb 11 00:00-24:00; PH off
// Mo-Fr 08:00-12:00, We 14:00-18:00; Su,PH off
// 2012 easter -2 days-2012 easter +2 days: open "Around easter"; PH off
// Mo-Fr 12:00-21:00/03:00
// 2013,2015,2050-2053,2055/2,2020-2029/3,2060+ Jan 1
// 2013,2015,2050-2053,2055/2,2020-2029/3,2060+ Jan 1-14
//
// TODO: incorrectly processed input below
// Jan 23-Feb 11,Feb 12 00:00-24:00; PH off
//
// Anything else?
opening_hours : rule_sequence (rule_separator rule_sequence)* EOF;
rule_sequence :
selector_sequence /* If no rule_modifier is specified, then the rule_sequence is interpreted as open. */
// | rule_modifier // TODO: is this possible?
| selector_sequence rule_modifier;
rule_separator :
';' #rule_separator_normal
| ' || ' #rule_separator_fallback;
//
// Rule modifiers
// status: untested
rule_modifier :
rule_modifier_empty
| rule_modifier_open
| rule_modifier_closed
| rule_modifier_unknown
| rule_modifier_comment
;
rule_modifier_empty : ''; // TODO defaults to 'open'
rule_modifier_open : ('open') (comment)?; // TODO 'opened'
rule_modifier_closed : ('closed' | 'off') (comment)?; // TODO 'closed'
rule_modifier_unknown : ('unknown') (comment)?; // TODO 'unknown'
rule_modifier_comment : comment; // TODO defaults to 'unknown'
//
// Selectors
// status: untested
selector_sequence :
c247string
| small_range_selectors
| wide_range_selectors
| wide_range_selectors small_range_selectors;
small_range_selectors :
weekday_selector
| weekday_selector time_selector (',' weekday_selector time_selector)? // spec says both are required (only this case), but this is not true in practice
| time_selector
;
//
// Weekday selector (Red)
// status: untested
weekday_selector :
weekday_sequence
| holiday_sequence
| holiday_sequence ',' weekday_sequence
| weekday_sequence ',' holiday_sequence
; // any semantic difference between ', ' and ' '?
weekday_sequence : weekday_ranges (',' weekday_ranges)*;
//TODO: refactor "weekday_ranges" names
weekday_ranges : weekday_ranges_single | weekday_ranges_range | weekday_ranges_range_nth | weekday_ranges_range_nth_offset;
weekday_ranges_single : cdayoftheweek;
weekday_ranges_range : cdayoftheweek '-' cdayoftheweek;
/**
* Su represents all Sundays,
* Su[1] - first Sunday of a month,
* Su[-1] - last Sunday of a month.
*/
weekday_ranges_range_nth : cdayoftheweek '[' nth_entry (',' nth_entry)* ']';
weekday_ranges_range_nth_offset : cdayoftheweek '[' nth_entry (',' nth_entry)* ']' day_offset;
holiday_sequence : holiday (',' holiday)*;
holiday : // https://github.com/opening-hours/opening_hours.js#holidays
'PH' (day_offset)? #singular_day_holiday // Only a day shift around one day (± 1 day) is currently defined.
| 'SH' #plural_day_holiday
;
day_offset : (( '+' positive_integer) | (negative_integer)) ('day' 's'?);
//
// Time selector (Blue)
// status: untested
time_selector : timespan (',' timespan)*;
timespan :
// timespan_simple | // This is only valid in point in time mode (tags like collection_times=*)
timespan_openended
| timespan_range
| timespan_range_openended
| timespan_range_cron
// | timespan_case_everyNminutes
// | timespan_case_everyPeriod
;
// timespan_simple : time;
// Ambiguities in '-12' as number or '-'hour
timespan_range : /*TIMERANGE*/ time '-' time; //wrapping_hh_mm
timespan_range_openended : /*TIMERANGE*/ timespan_range '+';
timespan_range_cron : /*TIMERANGE*/ time '-' time '/' time; //wrapping_hh_mm
timespan_openended : time '+';
/**
This notation describes a repeated event:
10:00-16:00/90 and 10:00-16:00/1:30 are evaluated as "from ten am to four pm every 1½ hours".
Especially departure times can be written very concise and compact using this notation.
The interval time following the "/" is valid but ignored for opening_hours.
This is only valid in point in time mode (tags like collection_times=*.
*/
// timespan_case_everyNminutes : time '-' (time | wrapping_hh_mm) '/' cminute;
// timespan_case_everyPeriod : time '-' (time | wrapping_hh_mm) '/' hh_mm;
time : hh_mm | variable_time;
// extended_time : time | wrapping_hh_mm;
variable_time : csunlightevent | csunlightevent coffsetsymbols hh_mm;
wide_range_selectors :
( //TODO: review combinations below
year_sel
| year_sel date_from
| year_sel calendarmonth_range //
| calendarmonth_selector
| week_selector
| year_sel calendarmonth_selector
| year_sel calendarmonth_selector week_selector
| year_sel week_selector
| calendarmonth_selector week_selector
) ':'? |
comment (':')?
;
//
// Year selector (Orange)
// status: untested
//TODO: ideally, we should have rules for "single year" and "multiple years". Out of ideas how to refactor all rules below.
year_sel : year_selector (',' year_selector)*;
year_selector :
year_selector_single
| year_selector_single_cron
| year_selector_range
| year_selector_single_openended
| year_selector_range_cron
;
year_selector_range : year_selector_single '-' year_selector_single;
year_selector_range_cron : year_selector_range '/' positive_integer;
/* year */
year_selector_single : NUMBERS; // YEAR4LETTER;
year_selector_single_cron : year_selector_single '/' positive_integer;
year_selector_single_openended : year_selector_single '+';
//
// Month selector (Green)
// status: untested
calendarmonth_selector : calendarmonth_range (',' calendarmonth_range)*;
calendarmonth_range :
calendarmonth_range_single
| calendarmonth_range_range
| calendarmonth_range_cron
// | calendarmonth_range_from
| calendarmonth_range_from_openended
| calendarmonth_range_from_to
;
//year_selector_single?
calendarmonth_range_single : cmonth;
calendarmonth_range_range : cmonth '-' cmonth;
calendarmonth_range_cron : cmonth '-' cmonth '/' positive_integer;
// calendarmonth_range_from : date_from;
calendarmonth_range_from_openended : date_from date_offset? '+';
calendarmonth_range_from_to : date_from date_offset? '-' date_to date_offset?;
/**
* Given any calendar day:
* +Su - selects the first Sunday after this calendar day
* -Su - selects the last Sunday before this calendar day.
*/
date_offset :
coffsetsymbols cdayoftheweek
| day_offset
;
date_from :
year_selector_single? cmonth cday
| year_selector_single? moveable_holidays
;
date_to : date_from | cday;
/* See https://en.wikipedia.org/wiki/Category:Moveable_holidays */
/* variable_date */
moveable_holidays : 'easter';
//
// Calendar week selector (Yellow)
// status: untested
week_selector : 'week ' week (',' week)*;
week : week_single | week_range | week_range_cron;
week_single : cweeknum;
week_range : cweeknum '-' cweeknum;
week_range_cron : cweeknum '-' cweeknum '/' positive_integer;
|
programs/oeis/166/A166946.asm | neoneye/loda | 22 | 27216 | <gh_stars>10-100
; A166946: a(n) = 1 if n is a rounded multiple of Phi (1.618033989...), the larger golden ratio value; else a(n) = 0
; 1,0,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1
add $0,28
seq $0,189661 ; Fixed point of the morphism 0->010, 1->10 starting with 0.
pow $1,$0
mov $0,$1
|
etude/etude17.als | nishio/learning_alloy | 1 | 3493 | <reponame>nishio/learning_alloy<filename>etude/etude17.als
open util/ordering[Time]
open named_man_ja [Man]
open named_woman_ja [Woman]
sig Time {
event: lone Event
}
fact {
no first.event
all t: Time - first {one t.event}
}
abstract sig Person {
state: State -> Time,
partner: Person -> Time,
parent_bio: set Person,
parent_think: set Person
}{
all t: Time | one state.t
all t: Time | lone partner.t
let p = parent_bio {
no p or born_in_scope
}
let p = parent_think {
no p or born_in_scope
}
}
pred born_in_scope(p: Person){
p.state.first = NotExist
p.state.last != NotExist
}
abstract sig Man, Woman extends Person {}
enum State {NotExist, Married, NotMarried}
enum Event {Marriage, Divorce, Birth}
pred init (t: Time) {
all p: Person | p.state.t in NotMarried + NotExist
all p: Person | p.partner.t = none
}
pred change_state (
target : Person,
t, t': Time,
before, after : State){
some target
all p: target {
p.state.t = before
p.state.t' = after
}
// others don't change their state
all other: (Person - target) {
other.state.t = other.state.t'
}
}
pred keep_partner(others: Person, t, t': Time){
all other: others {
other.partner.t = other.partner.t'
}
}
pred step (t, t': Time) {
{some disj p1 : Man, p2 : Woman {
{
t'.event = Marriage
change_state[p1 + p2, t, t', NotMarried, Married]
p1.partner.t' = p2
p2.partner.t' = p1
keep_partner[Person - p1 - p2, t, t']
} or {
t'.event = Divorce
change_state[p1 + p2, t, t', Married, NotMarried]
p1.partner.t' = none
p2.partner.t' = none
keep_partner[Person - p1 - p2, t, t']
}
}}
or
some p: Person {
// birth
t'.event = Birth
change_state[p, t, t', NotExist, NotMarried]
let father = p.parent_bio & Man {
one father
father.state.t != NotExist
}
let mother = p.parent_bio & Woman {
one mother
mother.state.t != NotExist
let hasband = mother.partner.t {
// p always think his biological mother is his mother
// if mother married, p think mother's hasband is his father
// no other person is tought as parent
p.parent_think = mother + hasband
}
}
keep_partner[Person, t, t']
}
}
fact Traces {
init[first]
all t: Time - last {
step[t, t.next]
}
}
pred can_marry_think (from, to: Person){
to not in from.^parent_think
from not in to.^parent_think
to not in from.parent_think.~parent_think
}
pred can_marry_bio (from, to: Person){
to not in from.^parent_bio
from not in to.^parent_bio
to not in from.parent_bio.~parent_bio
}
run {
some parent_bio
some p1: Man, p2: Woman {
not can_marry_think[p1, p2] and can_marry_bio[p1, p2]
p2 in p1.parent_think.~parent_think
}
} for 6 Person, 8 Time
|
scripts/saffronhouse2.asm | etdv-thevoid/pokemon-rgb-enhanced | 1 | 176675 | <filename>scripts/saffronhouse2.asm
SaffronHouse2Script:
jp EnableAutoTextBoxDrawing
SaffronHouse2TextPointers:
dw SaffronHouse2Text1
SaffronHouse2Text1:
TX_ASM
CheckEvent EVENT_GOT_TM29
jr nz, .explain
ld hl, TM29PreReceiveText
call PrintText
lb bc, TM_29, 1
call GiveItem
jr nc, .BagFull
ld hl, ReceivedTM29Text
call PrintText
SetEvent EVENT_GOT_TM29
jr .done
.BagFull
ld hl, TM29NoRoomText
call PrintText
jr .done
.explain
ld hl, TM29ExplanationText
call PrintText
.done
jp TextScriptEnd
TM29PreReceiveText:
TX_FAR _TM29PreReceiveText
db "@"
ReceivedTM29Text:
TX_FAR _ReceivedTM29Text
TX_SFX_ITEM_1
db "@"
TM29ExplanationText:
TX_FAR _TM29ExplanationText
db "@"
TM29NoRoomText:
TX_FAR _TM29NoRoomText
db "@"
|
programs/oeis/065/A065881.asm | jmorken/loda | 1 | 3930 | <filename>programs/oeis/065/A065881.asm<gh_stars>1-10
; A065881: Ultimate modulo 10: right-hand nonzero digit of n.
; 1,2,3,4,5,6,7,8,9,1,1,2,3,4,5,6,7,8,9,2,1,2,3,4,5,6,7,8,9,3,1,2,3,4,5,6,7,8,9,4,1,2,3,4,5,6,7,8,9,5,1,2,3,4,5,6,7,8,9,6,1,2,3,4,5,6,7,8,9,7,1,2,3,4,5,6,7,8,9,8,1,2,3,4,5,6,7,8,9,9,1,2,3,4,5,6,7,8,9,1,1,2,3,4,5,6,7,8,9,1,1,2,3,4,5,6,7,8,9,2,1,2,3,4,5,6,7,8,9,3,1,2,3,4,5,6,7,8,9,4,1,2,3,4,5,6,7,8,9,5,1,2,3,4,5,6,7,8,9,6,1,2,3,4,5,6,7,8,9,7,1,2,3,4,5,6,7,8,9,8,1,2,3,4,5,6,7,8,9,9,1,2,3,4,5,6,7,8,9,2,1,2,3,4,5,6,7,8,9,1,1,2,3,4,5,6,7,8,9,2,1,2,3,4,5,6,7,8,9,3,1,2,3,4,5,6,7,8,9,4,1,2,3,4,5,6,7,8,9,5
add $0,1
lpb $0
mov $1,$0
mov $0,$2
add $5,$1
add $0,$5
div $0,10
mod $1,10
mov $3,$5
mov $4,2
mul $4,$1
mov $5,$1
mov $1,$4
mul $5,$3
lpe
sub $1,2
div $1,2
add $1,1
|
sigint_handler.ads | evilspacepirate/iris | 0 | 19189 | <gh_stars>0
-----------------------------------------------------------
-- --
-- SIGINT_HANDLER PACKAGE --
-- --
-- Copyright (c) 2017, <NAME> --
-- --
-- Permission to use, copy, modify, and/or distribute --
-- this software for any purpose with or without fee is --
-- hereby granted, provided that the above copyright --
-- notice and this permission notice appear in all --
-- copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR --
-- DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE --
-- INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY --
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE --
-- FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL --
-- DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM --
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION --
-- OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, --
-- ARISING OUT OF OR IN CONNECTION WITH THE USE OR --
-- PERFORMANCE OF THIS SOFTWARE. --
-----------------------------------------------------------
WITH ADA.INTERRUPTS.NAMES; USE ADA.INTERRUPTS.NAMES;
PACKAGE SIGINT_HANDLER IS
PROTECTED HANDLER IS
PROCEDURE HANDLE;
PRAGMA INTERRUPT_STATE (SIGINT, USER);
PRAGMA INTERRUPT_HANDLER (HANDLE);
PRAGMA ATTACH_HANDLER (HANDLE, SIGINT);
END HANDLER;
SIGINT : BOOLEAN := FALSE;
END SIGINT_HANDLER;
|
src/vulkan-math/vulkan-math-ivec3.ads | zrmyers/VulkanAda | 1 | 1157 | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2020 <NAME>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
with Vulkan.Math.GenIType;
with Vulkan.Math.Ivec2;
use Vulkan.Math.GenIType;
use Vulkan.Math.Ivec2;
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package defines a 32-bit signed integer vector type with 3 components.
--------------------------------------------------------------------------------
package Vulkan.Math.Ivec3 is
pragma Preelaborate;
pragma Pure;
--< A 3 component vector of 32-bit signed integers.
subtype Vkm_Ivec3 is Vkm_GenIType(Last_Index => 2);
----------------------------------------------------------------------------
-- Ada does not have the concept of constructors in the sense that they exist
-- in C++. For this reason, we will instead define multiple methods for
-- instantiating a dvec3 here.
----------------------------------------------------------------------------
-- The following are explicit constructors for Ivec3:
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Ivec3 type.
--<
--< @description
--< Produce a default vector with all components set to 0.
--
--< @return a Ivec3 with all components set to 0.0.
----------------------------------------------------------------------------
function Make_Ivec3 return Vkm_Ivec3 is
(GIT.Make_GenType(Last_Index => 2, value => 0)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Ivec3 type.
--<
--< @description
--< Produce a vector with all components set to the same value.
--
--< @param scalar_value
--< The value to set all components to.
--
--< @return
--<An Ivec3 with all components set to scalar_value.
----------------------------------------------------------------------------
function Make_Ivec3 (scalar_value : in Vkm_Int) return Vkm_Ivec3 is
(GIT.Make_GenType(Last_Index => 2, value => scalar_value)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Ivec3 type.
--<
--< @description
--< Produce a vector by copying components from an existing vector.
--
--< @param vec3_value
--< The Ivec3 to copy components from.
--
--< @return
--< An Ivec3 with all of its components set equal to the corresponding
--< components of vec3_value.
----------------------------------------------------------------------------
function Make_Ivec3 (vec3_value : in Vkm_Ivec3) return Vkm_Ivec3 is
(GIT.Make_GenType(vec3_value.data(0),vec3_value.data(1), vec3_value.data(2))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Ivec3 type.
--<
--< @description
--< Produce a vector by specifying the values for each of its components.
--
--< @param value1 Value for component 1.
--< @param value2 Value for component 2.
--< @param value3 Value for componetn 3.
--
--< @return An Ivec3 with all components set as specified.
----------------------------------------------------------------------------
function Make_Ivec3 (value1, value2, value3 : in Vkm_Int) return Vkm_Ivec3
renames GIT.Make_GenType;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Ivec3 type.
--<
--< @description
--< Produce a vector by concatenating a scalar float with a vec2.
--
--< Ivec3 = [scalar_value, vec2_value]
--
--< @param scalar_value The scalar value to concatenate with the Ivec3.
--< @param vec2_value The vec2 to concatenate to the scalar value.
--
--< @return The instance of Ivec3.
----------------------------------------------------------------------------
function Make_Ivec3 (scalar_value : in Vkm_Int;
vec2_value : in Vkm_Ivec2 ) return Vkm_Ivec3 is
(Make_Ivec3(scalar_value, vec2_value.x, vec2_value.y)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Ivec3 type.
--<
--< @description
--< Produce a vector by concatenating a scalar float with a vec2.
--
--< Ivec3 = [vec2_value, scalar_value]
--
--< @param vec2_value The vec2 to concatenate to the scalar value.
--< @param scalar_value The scalar value to concatenate with the Ivec3.
--
--< @return The instance of Ivec3.
----------------------------------------------------------------------------
function Make_Ivec3 (vec2_value : in Vkm_Ivec2;
scalar_value : in Vkm_Int ) return Vkm_Ivec3 is
(Make_Ivec3(vec2_value.x, vec2_value.y, scalar_value)) with Inline;
end Vulkan.Math.Ivec3;
|
main.adb | thieryw/snake_array_impl | 0 | 1467 | with snake_functions,snake_types,ada.calendar,display,ada.text_io ;
use ada.text_io,ada.calendar ;
procedure main is
s : snake_types.Snake ;
dir : snake_types.Snake_direction:=snake_types.LEFT ;
has_new_user_input: boolean;
user_requested_direction : snake_types.Snake_direction ;
user_controls_default : snake_types.User_Controls.Map;
fruit : snake_types.Coordinates ;
fruit_timeout : integer ;
score : integer := 0 ;
timestamp : ada.calendar.time= clock ;
begin
user_controls_default := snake_functions.get_user_controls_default ;
s := snake_functions.create_snake ;
snake_functions.generate_fruit(s, fruit,fruit_timeout) ;
loop
snake_functions.render_game(s,fruit) ;
snake_functions.retreve_user_input(
has_new_user_input,
user_requested_direction,
user_controls_default
) ;
if has_new_user_input then
snake_functions.update_direction(dir,user_requested_direction) ;
end if ;
--FIXME: generate fruit and timeout
snake_functions.move_snake(s,dir,fruit,does_eat_fruit) ;
if snake_functions.is_end_of_game(s) then
exit ;
end if ;
fruit_timeout := fruit_timeout - 1 ;
if fruit_timeout = 0 then
snake_functions.generate_fruit(s, fruit,fruit_timeout) ;
end if ;
--FIXME
put_line("SCORE : " & integer'image(score)) ;
delay 0.1 - (timestamp - clock) ;
timestamp := ada.calendar.clock ;
end loop ;
put_line("YOU LOSE MOTHER FUCKER") ;
delay 3.0 ;
end main ;
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_1895.asm | ljhsiun2/medusa | 9 | 10975 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r14
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x18307, %rsi
nop
nop
sub %r12, %r12
movb $0x61, (%rsi)
nop
nop
cmp $20394, %rcx
lea addresses_WT_ht+0x3e07, %rsi
lea addresses_WT_ht+0x15307, %rdi
nop
cmp %r13, %r13
mov $49, %rcx
rep movsq
nop
nop
sub %r13, %r13
lea addresses_A_ht+0x1ef87, %rsi
lea addresses_A_ht+0x17367, %rdi
nop
nop
nop
add $21221, %rax
mov $98, %rcx
rep movsb
nop
nop
cmp %r13, %r13
lea addresses_WT_ht+0x1c197, %r13
nop
sub %r12, %r12
mov $0x6162636465666768, %rax
movq %rax, %xmm5
vmovups %ymm5, (%r13)
nop
and %r14, %r14
lea addresses_normal_ht+0x1ba07, %rsi
clflush (%rsi)
nop
nop
nop
nop
cmp %rcx, %rcx
vmovups (%rsi), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $0, %xmm4, %rdi
nop
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_normal_ht+0x5b97, %rsi
lea addresses_A_ht+0xa647, %rdi
nop
nop
nop
nop
nop
xor $47005, %rbp
mov $42, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp $2463, %rcx
lea addresses_WC_ht+0x10907, %rsi
nop
nop
nop
sub $21289, %rbp
mov (%rsi), %r12
and $58329, %rdi
lea addresses_WT_ht+0x18d07, %r12
nop
nop
nop
nop
nop
xor %rbp, %rbp
movups (%r12), %xmm2
vpextrq $0, %xmm2, %r13
nop
nop
dec %rcx
lea addresses_A_ht+0xffe7, %rsi
lea addresses_WC_ht+0x18273, %rdi
nop
nop
nop
nop
xor %r13, %r13
mov $109, %rcx
rep movsb
inc %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r14
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %r8
push %rbp
push %rdi
push %rdx
// Load
lea addresses_US+0x10607, %r14
nop
cmp %r8, %r8
mov (%r14), %r15w
nop
nop
nop
nop
sub $28449, %r14
// Load
lea addresses_WC+0x17117, %rbp
nop
nop
nop
nop
nop
xor %rdx, %rdx
mov (%rbp), %r14
nop
nop
nop
add $2476, %rdx
// Store
lea addresses_RW+0x16047, %rdx
and $20625, %rdi
mov $0x5152535455565758, %r10
movq %r10, (%rdx)
nop
nop
nop
sub $24253, %rbp
// Store
lea addresses_WC+0x3947, %r8
nop
nop
nop
sub $55414, %rdx
mov $0x5152535455565758, %rbp
movq %rbp, %xmm5
vmovups %ymm5, (%r8)
xor $49679, %r10
// Load
lea addresses_UC+0xb70f, %rdi
xor $2757, %r14
mov (%rdi), %bp
nop
nop
add %r14, %r14
// Faulty Load
lea addresses_UC+0x15b07, %rbp
nop
nop
inc %r10
mov (%rbp), %edx
lea oracles, %rbp
and $0xff, %rdx
shlq $12, %rdx
mov (%rbp,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %rbp
pop %r8
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
{'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_RW'}}
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC'}}
{'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': True, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 7, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}}
{'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
*/
|
utilities/GetDisplayResolution.applescript | RobTrew/txtquery-tools | 69 | 2003 | -- properties persist across sessions in compiled .scpt files
-- so subsequent runs will be faster
property pX : missing value
property pY : missing value
on run {}
displayResoln()
end run
on displayResoln()
if (pX is missing value) or (pY is missing value) then
set {dlm, my text item delimiters} to {my text item delimiters, "Resolution"}
set lstDisplays to text items of (do shell script "system_profiler SPDisplaysDataType")
repeat with i from 2 to length of lstDisplays
set strLine to item i of lstDisplays
if strLine contains "Main Display: Yes" then exit repeat
end repeat
set my text item delimiters to space
set lstParts to text items of strLine
set my text item delimiters to dlm
set {strX, strY} to {item 2, item 4} of lstParts
set {pX, pY} to {strX as integer, strY as integer}
end if
return {pX , pY}
end displayResoln |
PongTestLED.asm | ParsaHejabi/MicroProcessor-Pong | 0 | 88454 | .MODEL SMALL
.STACK 64
.DATA
UPPER_WALL_START_ROW DW 30
UPPER_WALL_START_COL DW 20
UPPER_WALL_END_ROW DW 35
UPPER_WALL_END_COL DW 280
LEFT_WALL_START_ROW DW 35
LEFT_WALL_START_COL DW 20
LEFT_WALL_END_ROW DW 190
LEFT_WALL_END_COL DW 25
LOWER_WALL_START_ROW DW 185
LOWER_WALL_START_COL DW 25
LOWER_WALL_END_ROW DW 190
LOWER_WALL_END_COL DW 280
ROCKET_INIT_START_ROW DW 95
ROCKET_INIT_START_COL DW 281
ROCKET_INIT_END_ROW DW 125
ROCKET_INIT_END_COL DW 285
BALL_INIT_START_ROW DW 120
BALL_INIT_START_COL DW 260
BALL_INIT_END_ROW DW 130
BALL_INIT_END_COL DW 270
BALL_STATE DW 2 ; 0:LL 1:UL 2:UR 3:LR
BALL_COLOR DB 0FH
INIT_SCORE DB 0
INIT_SCORE_LD DB '0'
INIT_SCORE_HD DB '0'
MSG_WON DW "You won the game!"
MSG_LOSE DW "You lost the game!"
.CODE
MAIN PROC FAR
MOV AX, @DATA
MOV DS, AX
CALL CLEAR_SCREEN
CALL SET_GRAPHIC_MODE
CALL SET_CURSOR_POSITION_LD
CALL DRAW_INIT_SCORE_LD
CALL SET_CURSOR_POSITION_HD
CALL DRAW_INIT_SCORE_HD
CALL DRAW_INIT_ROCKET
; CALL DRAW_WALLS
CALL DRAW_INIT_BALL
MAIN_KEYPRESS_LOOP:
MOV AH, 01
INT 16H ; WAIT FOR FIRST KEY PRESS
JZ MAIN_KEYPRESS_LOOP
MOV AH, 00 ; IF USER WANT TO QUIT LET HIM DO THAT
INT 16H
CMP AL, 'Q' ; Q KEY PRESSED
JE MAIN_DONE
CMP AL, 'q' ; q KEY PRESSED
JE MAIN_DONE
; CALL RANDOM_START ; MAKE START OF THE GAME RANDOM
MAIN_LOOP:
CALL BALL_MOVEMENT
CMP BALL_STATE, 4 ; CHECK IF USER WON THE GAME
JE MAIN_WON
CMP BALL_STATE, 5 ; CHECK IF USER LOSE THE GAME
JE MAIN_LOSE
MOV AH, 01
INT 16H ; CHECK THE KEY PRESS
JZ MAIN_LOOP
CALL CHECK_INPUT
CMP AL, 'Q' ; Q KEY PRESSED
JE MAIN_DONE
CMP AL, 'q' ; q KEY PRESSED
JE MAIN_DONE
JMP MAIN_LOOP
MAIN_WON:
MOV AL, 1
MOV BH, 0
MOV BL, 0000_1010B ; GREEN ON DOS
MOV CX, 17 ; MSG LENGTH
MOV DH, 12
MOV DL, 12
PUSH DS
POP ES
MOV BP, OFFSET MSG_WON
MOV AH, 13H
INT 10H
MOV AH, 7
INT 21H ; WAIT FOR USER TO SEE MESSAGE
JMP MAIN_DONE
MAIN_LOSE:
MOV AL, 1
MOV BH, 0
MOV BL, 0000_0100B ; RED ON DOS
MOV CX, 18 ; MSG LENGTH
MOV DH, 12
MOV DL, 12
PUSH DS
POP ES
MOV BP, OFFSET MSG_LOSE
MOV AH, 13H
INT 10H
MOV AH, 7
INT 21H ; WAIT FOR USER TO SEE MESSAGE
JMP MAIN_DONE
MAIN_DONE:
MOV AX, 4C00H ; EXIT TO OPERATING SYSTEM
INT 21H
MAIN ENDP
CLEAR_SCREEN PROC
MOV AX, 0600H ; SCROLL DOWN
MOV BH, 07H ; SCREEN COLOR
MOV CX, 0000H ; FROM TOP LEFT
MOV DX, 184FH ; TO THE BOTTOM RIGHT
INT 10H
RET
ENDP CLEAR_SCREEN
SET_GRAPHIC_MODE PROC
MOV AH, 00H
MOV AL, 13H
INT 10H
RET
ENDP SET_GRAPHIC_MODE
SET_CURSOR_POSITION_HD PROC
MOV DH, 2
MOV DL, 19
MOV BH, 0
MOV AH, 2
INT 10H
RET
ENDP SET_CURSOR_POSITION_HD
DRAW_INIT_SCORE_HD PROC
MOV DL, INIT_SCORE_HD
MOV AH, 2
INT 21H
MOV AL, INIT_SCORE
OUT 199, AL
RET
ENDP DRAW_INIT_SCORE_HD
SET_CURSOR_POSITION_LD PROC
MOV DH, 2
MOV DL, 20
MOV BH, 0
MOV AH, 2
INT 10H
RET
ENDP SET_CURSOR_POSITION_LD
DRAW_INIT_SCORE_LD PROC
MOV DL, INIT_SCORE_LD
MOV AH, 2
INT 21H
RET
ENDP DRAW_INIT_SCORE_LD
DRAW_WALLS PROC
MOV AH, 0CH
MOV AL, 1111B ; WHITE COLOR
UPPER_WALL:
MOV DX, UPPER_WALL_START_ROW
UW_LOOP1:
MOV CX, UPPER_WALL_START_COL
UW_LOOP2:
INT 10H
INC CX
CMP CX, UPPER_WALL_END_COL
JNZ UW_LOOP2
INC DX
CMP DX, UPPER_WALL_END_ROW
JNZ UW_LOOP1
LEFT_WALL:
MOV DX, LEFT_WALL_START_ROW
LW_LOOP1:
MOV CX, LEFT_WALL_START_COL
LW_LOOP2:
INT 10H
INC CX
CMP CX, LEFT_WALL_END_COL
JNZ LW_LOOP2
INC DX
CMP DX, LEFT_WALL_END_ROW
JNZ LW_LOOP1
LOWER_WALL:
MOV DX, LOWER_WALL_START_ROW
LOW_LOOP1:
MOV CX, LOWER_WALL_START_COL
LOW_LOOP2:
INT 10H
INC CX
CMP CX, LOWER_WALL_END_COL
JNZ LOW_LOOP2
INC DX
CMP DX, LOWER_WALL_END_ROW
JNZ LOW_LOOP1
RET
ENDP DRAW_WALLS
DRAW_INIT_BALL PROC
MOV AH, 0CH
MOV AL, BALL_COLOR ; WHITE COLOR
INIT_BALL:
MOV DX, BALL_INIT_START_ROW
IB_LOOP1:
MOV CX, BALL_INIT_START_COL
IB_LOOP2:
INT 10H
INC CX
CMP CX, BALL_INIT_END_COL
JNZ IB_LOOP2
INC DX
CMP DX, BALL_INIT_END_ROW
JNZ IB_LOOP1
RET
ENDP DRAW_INIT_BALL
DRAW_INIT_ROCKET PROC
MOV AH, 0CH
MOV AL, 1111B ; WHITE COLOR
INIT_ROCKET:
MOV DX, ROCKET_INIT_START_ROW
IR_LOOP1:
MOV CX, ROCKET_INIT_START_COL
IR_LOOP2:
INT 10H
INC CX
CMP CX, ROCKET_INIT_END_COL
JNZ IR_LOOP2
INC DX
CMP DX, ROCKET_INIT_END_ROW
JNZ IR_LOOP1
RET
ENDP DRAW_INIT_ROCKET
RANDOM_START PROC
MOV AH, 00H ; interrupts to get system time
INT 1AH ; CX:DX now hold number of clock ticks since midnight
MOV AX, DX
XOR DX, DX ; MAKE DX ZERO
MOV CX, 2
DIV CX ; DX CONTAINS A NUMBER BETWEEN 0-8
MOV BALL_STATE, DX
RET
ENDP RANDOM_START
CHECK_INPUT PROC
MOV AH, 0
INT 16H
CMP AL, 30D ; UP KEY PRESSED
JE UP_KEYSTROKE
CMP AL, 'W' ; W KEY PRESSED
JE UP_KEYSTROKE
CMP AL, 'w' ; w KEY PRESSED
JE UP_KEYSTROKE
CMP AL, 31D ; DOWN KEY PRESSED
JE DOWN_KEYSTROKE
CMP AL, 'S' ; S KEY PRESSED
JE DOWN_KEYSTROKE
CMP AL, 's' ; s KEY PRESSED
JE DOWN_KEYSTROKE
JMP CI_DONE
UP_KEYSTROKE:
CALL SHIFT_UP_ROCKET
JMP CI_DONE
DOWN_KEYSTROKE:
CALL SHIFT_DOWN_ROCKET
JMP CI_DONE
CI_DONE:
RET
ENDP CHECK_INPUT
SHIFT_UP_ROCKET PROC
MOV AH, 0CH
MOV BX, 3 ; WITH ONE INPUT, SHIFT 3 PIXELS
SUR:
MOV AL, 0
MOV DX, ROCKET_INIT_START_ROW
CMP DX, UPPER_WALL_END_ROW ; CHECK IF WE REACHED UPPER LIMIT
JE SUR_DONE
MOV DX, ROCKET_INIT_END_ROW
MOV CX, ROCKET_INIT_START_COL
SUR_LOOP1:
INT 10H
INC CX
CMP CX, ROCKET_INIT_END_COL
JNZ SUR_LOOP1
MOV AL, 1111B
MOV DX, ROCKET_INIT_START_ROW
MOV CX, ROCKET_INIT_START_COL
SUR_LOOP2:
INT 10H
INC CX
CMP CX, ROCKET_INIT_END_COL
JNZ SUR_LOOP2
DEC ROCKET_INIT_START_ROW
DEC ROCKET_INIT_END_ROW
SUB BX, 1
JNZ SUR
SUR_DONE:
RET
ENDP SHIFT_UP_ROCKET
SHIFT_DOWN_ROCKET PROC
MOV AH, 0CH
MOV BX, 3 ; WITH ONE INPUT, SHIFT 3 PIXELS
SDR:
MOV AL, 0
MOV DX, ROCKET_INIT_END_ROW
CMP DX, LOWER_WALL_START_ROW ; CHECK IF WE REACHED LOWER LIMIT
JE SDR_DONE
MOV DX, ROCKET_INIT_START_ROW
MOV CX, ROCKET_INIT_START_COL
SDR_LOOP1:
INT 10H
INC CX
CMP CX, ROCKET_INIT_END_COL
JNZ SDR_LOOP1
MOV AL, 1111B
MOV DX, ROCKET_INIT_END_ROW
MOV CX, ROCKET_INIT_START_COL
SDR_LOOP2:
INT 10H
INC CX
CMP CX, ROCKET_INIT_END_COL
JNZ SDR_LOOP2
INC ROCKET_INIT_START_ROW
INC ROCKET_INIT_END_ROW
SUB BX, 1
JNZ SDR
SDR_DONE:
RET
ENDP SHIFT_DOWN_ROCKET
BALL_MOVEMENT PROC
MOV CX, BALL_STATE
CMP CX, 0
JE CALL_BMLL
CMP CX, 1
JE CALL_BMUL
CMP CX, 2
JE CALL_BMUR
CMP CX, 3
JE CALL_BMLR
JMP BM_DONE
CALL_BMLL:
CALL BMLL
JMP BM_DONE
CALL_BMUL:
CALL BMUL
JMP BM_DONE
CALL_BMUR:
CALL BMUR
JMP BM_DONE
CALL_BMLR:
CALL BMLR
BM_DONE:
RET
ENDP BALL_MOVEMENT
BMLL PROC
MOV AH, 0CH
MOV BX, 3 ; WITH ONE INPUT, SHIFT 3 PIXELS
BMLL_MAIN_LOOP:
MOV AL, 0
MOV DX, BALL_INIT_END_ROW
CMP DX, LOWER_WALL_START_ROW ; CHECK IF WE HIT LOWER WALL
JE BMLL_CM_UL ; CHANGE MOVEMENT TO UL
MOV DX, BALL_INIT_START_COL
CMP DX, LEFT_WALL_END_COL ; CHECK IF WE HIT LEFT WALL
JE BMLL_CM_LR
MOV DX, BALL_INIT_START_ROW
MOV CX, BALL_INIT_START_COL
BMLL_LOOP1:
INT 10H
INC CX
CMP CX, BALL_INIT_END_COL
JNZ BMLL_LOOP1
DEC BALL_INIT_START_COL
INC BALL_INIT_START_ROW
MOV DX, BALL_INIT_START_ROW
MOV CX, BALL_INIT_END_COL
DEC CX
BMLL_LOOP2:
INT 10H
INC DX
CMP DX, BALL_INIT_END_ROW
JNZ BMLL_LOOP2
DEC BALL_INIT_END_COL
INC BALL_INIT_END_ROW
MOV AL, BALL_COLOR
MOV DX, BALL_INIT_START_ROW
MOV CX, BALL_INIT_START_COL
BMLL_LOOP3:
INT 10H
INC DX
CMP DX, BALL_INIT_END_ROW
JNZ BMLL_LOOP3
MOV DX, BALL_INIT_END_ROW
DEC DX
MOV CX, BALL_INIT_START_COL
BMLL_LOOP4:
INT 10H
INC CX
CMP CX, BALL_INIT_END_COL
JNZ BMLL_LOOP4
; CALL BM_DELAY
SUB BX, 1
JNZ BMLL_MAIN_LOOP
JMP BMLL_DONE
BMLL_CM_UL:
MOV BALL_STATE, 1 ; CHANGE DIRECTION TO UL
JMP BMLL_DONE
BMLL_CM_LR:
MOV BALL_STATE, 3 ; CHANGE DIRECTION TO LR
JMP BMLL_DONE
BMLL_DONE:
RET
ENDP BMLL
BMUL PROC
MOV AH, 0CH
MOV BX, 3 ; WITH ONE INPUT, SHIFT 3 PIXELS
BMUL_MAIN_LOOP:
MOV AL, 0
MOV DX, BALL_INIT_START_COL
CMP DX, LEFT_WALL_END_COL ; CHECK IF WE HIT LEFT WALL
JE BMUL_CM_UR
MOV DX, BALL_INIT_START_ROW
CMP DX, UPPER_WALL_END_ROW ; CHECK IF WE HIT UPPER WALL
JE BMUL_CM_LL
MOV DX, BALL_INIT_END_ROW
DEC DX
MOV CX, BALL_INIT_START_COL
BMUL_LOOP1:
INT 10H
INC CX
CMP CX, BALL_INIT_END_COL
JNZ BMUL_LOOP1
DEC BALL_INIT_START_COL
DEC BALL_INIT_END_ROW
MOV DX, BALL_INIT_START_ROW
MOV CX, BALL_INIT_END_COL
DEC CX
BMUL_LOOP2:
INT 10H
INC DX
CMP DX, BALL_INIT_END_ROW
JNZ BMUL_LOOP2
DEC BALL_INIT_END_COL
DEC BALL_INIT_START_ROW
MOV AL, BALL_COLOR
MOV DX, BALL_INIT_START_ROW
MOV CX, BALL_INIT_START_COL
BMUL_LOOP3:
INT 10H
INC CX
CMP CX, BALL_INIT_END_COL
JNZ BMUL_LOOP3
MOV DX, BALL_INIT_START_ROW
INC DX
MOV CX, BALL_INIT_START_COL
BMUL_LOOP4:
INT 10H
INC DX
CMP DX, BALL_INIT_END_ROW
JNZ BMUL_LOOP4
; CALL BM_DELAY
SUB BX, 1
JNZ BMUL_MAIN_LOOP
JMP BMUL_DONE
BMUL_CM_UR:
MOV BALL_STATE, 2 ; CHANGE DIRECTION TO UR
JMP BMUL_DONE
BMUL_CM_LL:
MOV BALL_STATE, 0 ; CHANGE DIRECTION TO LL
JMP BMUL_DONE
BMUL_DONE:
RET
ENDP BMUL
BMUR PROC
MOV AH, 0CH
MOV BX, 3 ; WITH ONE INPUT, SHIFT 3 PIXELS
BMUR_MAIN_LOOP:
MOV AL, 0
MOV DX, BALL_INIT_START_ROW
CMP DX, UPPER_WALL_END_ROW ; CHECK IF WE HIT UPPER WALL
JE BMUR_CM_LR ; CHANGE MOVEMENT TO LR
MOV DX, BALL_INIT_END_COL
CMP DX, ROCKET_INIT_START_COL ; CHECK IF WE ARE GOING TO HIT ROCKET OR NOT
JE BMUR_ROCKET_CHECK
MOV DX, BALL_INIT_END_ROW
DEC DX
MOV CX, BALL_INIT_START_COL
BMUR_LOOP1:
INT 10H
INC CX
CMP CX, BALL_INIT_END_COL
JNZ BMUR_LOOP1
INC BALL_INIT_END_COL
DEC BALL_INIT_END_ROW
MOV DX, BALL_INIT_START_ROW
MOV CX, BALL_INIT_START_COL
BMUR_LOOP2:
INT 10H
INC DX
CMP DX, BALL_INIT_END_ROW
JNZ BMUR_LOOP2
INC BALL_INIT_START_COL
DEC BALL_INIT_START_ROW
MOV AL, BALL_COLOR
MOV DX, BALL_INIT_START_ROW
MOV CX, BALL_INIT_START_COL
BMUR_LOOP3:
INT 10H
INC CX
CMP CX, BALL_INIT_END_COL
JNZ BMUR_LOOP3
MOV DX, BALL_INIT_START_ROW
INC DX
MOV CX, BALL_INIT_END_COL
DEC CX
BMUR_LOOP4:
INT 10H
INC DX
CMP DX, BALL_INIT_END_ROW
JNZ BMUR_LOOP4
; CALL BM_DELAY
SUB BX, 1
JNZ BMUR_MAIN_LOOP
JMP BMUR_DONE
BMUR_CM_LR:
MOV BALL_STATE, 3 ; CHANGE DIRECTION TO LR
JMP BMUR_DONE
BMUR_ROCKET_CHECK:
MOV DX, BALL_INIT_START_ROW
CMP DX, ROCKET_INIT_START_ROW
JNGE BMUR_FAILED
MOV DX, BALL_INIT_END_ROW
CMP DX, ROCKET_INIT_END_ROW
JNLE BMUR_FAILED
JMP BMUR_BALL_HIT
BMUR_BALL_HIT:
CALL CHANGE_BALL_COLOR
CALL INC_AND_PRINT_SCORE
CMP INIT_SCORE, 30
JE BMUR_WON
MOV BALL_STATE, 1 ; CHANGE DIRECTION TO UL
JMP BMUR_DONE
BMUR_WON:
; WON GAME
MOV BALL_STATE, 4 ; WON THE GAME
JMP BMUR_DONE
BMUR_FAILED:
; GAME FAILED
MOV BALL_STATE, 5
JMP BMUR_DONE
BMUR_DONE:
RET
ENDP BMUR
BMLR PROC
MOV AH, 0CH
MOV BX, 3 ; WITH ONE INPUT, SHIFT 3 PIXELS
BMLR_MAIN_LOOP:
MOV AL, 0
MOV DX, BALL_INIT_END_ROW
CMP DX, LOWER_WALL_START_ROW ; CHECK IF WE HIT LOWER WALL
JE BMLR_CM_UR ; CHANGE MOVEMENT TO UR
MOV DX, BALL_INIT_END_COL
CMP DX, ROCKET_INIT_START_COL ; CHECK IF WE ARE GOING TO HIT ROCKET OR NOT
JE BMLR_ROCKET_CHECK
MOV DX, BALL_INIT_START_ROW
MOV CX, BALL_INIT_START_COL
BMLR_LOOP1:
INT 10H
INC CX
CMP CX, BALL_INIT_END_COL
JNZ BMLR_LOOP1
INC BALL_INIT_START_COL
INC BALL_INIT_START_ROW
MOV DX, BALL_INIT_START_ROW
MOV CX, BALL_INIT_START_COL
DEC CX
BMLR_LOOP2:
INT 10H
INC DX
CMP DX, BALL_INIT_END_ROW
JNZ BMLR_LOOP2
INC BALL_INIT_END_COL
INC BALL_INIT_END_ROW
MOV AL, BALL_COLOR
MOV DX, BALL_INIT_END_ROW
DEC DX
MOV CX, BALL_INIT_START_COL
BMLR_LOOP3:
INT 10H
INC CX
CMP CX, BALL_INIT_END_COL
JNZ BMLR_LOOP3
MOV DX, BALL_INIT_START_ROW
MOV CX, BALL_INIT_END_COL
DEC CX
BMLR_LOOP4:
INT 10H
INC DX
CMP DX, BALL_INIT_END_ROW
JNZ BMLR_LOOP4
; CALL BM_DELAY
SUB BX, 1
JNZ BMLR_MAIN_LOOP
JMP BMLR_DONE
BMLR_CM_UR:
MOV BALL_STATE, 2 ; CHANGE DIRECTION TO UR
JMP BMLR_DONE
BMLR_ROCKET_CHECK:
MOV DX, BALL_INIT_START_ROW
CMP DX, ROCKET_INIT_START_ROW
JNGE BMLR_FAILED
MOV DX, BALL_INIT_END_ROW
CMP DX, ROCKET_INIT_END_ROW
JNLE BMLR_FAILED
JMP BMLR_BALL_HIT
BMLR_BALL_HIT:
CALL CHANGE_BALL_COLOR
CALL INC_AND_PRINT_SCORE
CMP INIT_SCORE, 30
JE BMLR_WON
MOV BALL_STATE, 0 ; CHANGE DIRECTION TO LL
JMP BMLR_DONE
BMLR_WON:
; WON GAME
MOV BALL_STATE, 4 ; WON THE GAME
JMP BMLR_DONE
BMLR_FAILED:
; GAME FAILED
MOV BALL_STATE, 5
JMP BMLR_DONE
BMLR_DONE:
RET
ENDP BMLR
CHANGE_BALL_COLOR PROC
MOV AH, 00H ; interrupts to get system time
INT 1AH ; CX:DX now hold number of clock ticks since midnight
MOV AX, DX
XOR DX, DX ; MAKE DX ZERO
MOV CX, 9
DIV CX ; DX CONTAINS A NUMBER BETWEEN 0-8
INC DL
MOV BALL_COLOR, DL
RET
ENDP CHANGE_BALL_COLOR
INC_AND_PRINT_SCORE PROC
CMP INIT_SCORE_LD, '9'
JE IAPS_INC_HD
INC INIT_SCORE_LD
CALL SET_CURSOR_POSITION_LD
CALL DRAW_INIT_SCORE_LD
JMP IAPS_END
IAPS_INC_HD:
INC INIT_SCORE_HD
MOV INIT_SCORE_LD, '0'
CALL SET_CURSOR_POSITION_HD
CALL DRAW_INIT_SCORE_HD
CALL SET_CURSOR_POSITION_LD
CALL DRAW_INIT_SCORE_LD
IAPS_END:
INC INIT_SCORE
MOV AL, INIT_SCORE
OUT 199, AL
RET
ENDP INC_AND_PRINT_SCORE
BM_DELAY PROC
MOV CX, 5FFFH
BM_DELAY_LOOP:
LOOP BM_DELAY_LOOP
RET
ENDP BM_DELAY
END MAIN |
platforms/m3/pre_v12/compiled_prog_vlsipool/haltRX/SRAM_test_0.asm | lab11/M-ulator | 19 | 243441 | <reponame>lab11/M-ulator
SRAM_test_0/SRAM_test_0.elf: file format elf32-littlearm
Disassembly of section .text:
00000000 <hang-0x90>:
0: 00002000 .word 0x00002000
4: 000000a1 .word 0x000000a1
...
1c: 00000090 .word 0x00000090
20: 00000090 .word 0x00000090
24: 00000090 .word 0x00000090
28: 00000090 .word 0x00000090
...
34: 00000090 .word 0x00000090
...
40: 0000019d .word 0x0000019d
44: 000001a9 .word 0x000001a9
48: 000001b5 .word 0x000001b5
4c: 000001c1 .word 0x000001c1
50: 000001cd .word 0x000001cd
54: 000001d9 .word 0x000001d9
58: 000001e5 .word 0x000001e5
5c: 000001f1 .word 0x000001f1
60: 000001fd .word 0x000001fd
64: 0000020d .word 0x0000020d
68: 0000021d .word 0x0000021d
6c: 0000022d .word 0x0000022d
70: 0000023d .word 0x0000023d
74: 0000024d .word 0x0000024d
78: 0000025d .word 0x0000025d
7c: 0000026d .word 0x0000026d
80: 0000027d .word 0x0000027d
...
00000090 <hang>:
90: e7fe b.n 90 <hang>
...
000000a0 <_start>:
a0: f000 f9ea bl 478 <main>
a4: e7fc b.n a0 <_start>
Disassembly of section .text.mbus_write_message32:
000000a8 <mbus_write_message32>:
a8: 4b02 ldr r3, [pc, #8] ; (b4 <mbus_write_message32+0xc>)
aa: 0100 lsls r0, r0, #4
ac: 4318 orrs r0, r3
ae: 6001 str r1, [r0, #0]
b0: 2001 movs r0, #1
b2: 4770 bx lr
b4: a0003000 .word 0xa0003000
Disassembly of section .text.mbus_enumerate:
000000b8 <mbus_enumerate>:
b8: 0603 lsls r3, r0, #24
ba: 2080 movs r0, #128 ; 0x80
bc: 0580 lsls r0, r0, #22
be: 4318 orrs r0, r3
c0: 4b01 ldr r3, [pc, #4] ; (c8 <mbus_enumerate+0x10>)
c2: 6018 str r0, [r3, #0]
c4: 4770 bx lr
c6: 46c0 nop ; (mov r8, r8)
c8: a0003000 .word 0xa0003000
Disassembly of section .text.mbus_sleep_all:
000000cc <mbus_sleep_all>:
cc: 4b01 ldr r3, [pc, #4] ; (d4 <mbus_sleep_all+0x8>)
ce: 2200 movs r2, #0
d0: 601a str r2, [r3, #0]
d2: 4770 bx lr
d4: a0003010 .word 0xa0003010
Disassembly of section .text.delay:
000000d8 <delay>:
d8: b500 push {lr}
da: 2300 movs r3, #0
dc: e001 b.n e2 <delay+0xa>
de: 46c0 nop ; (mov r8, r8)
e0: 3301 adds r3, #1
e2: 4283 cmp r3, r0
e4: d1fb bne.n de <delay+0x6>
e6: bd00 pop {pc}
Disassembly of section .text.write_regfile:
000000e8 <write_regfile>:
e8: 0880 lsrs r0, r0, #2
ea: 0209 lsls r1, r1, #8
ec: b508 push {r3, lr}
ee: 0a09 lsrs r1, r1, #8
f0: 4b05 ldr r3, [pc, #20] ; (108 <write_regfile+0x20>)
f2: 0600 lsls r0, r0, #24
f4: 4308 orrs r0, r1
f6: 6018 str r0, [r3, #0]
f8: 4b04 ldr r3, [pc, #16] ; (10c <write_regfile+0x24>)
fa: 2210 movs r2, #16
fc: 601a str r2, [r3, #0]
fe: 200a movs r0, #10
100: f7ff ffea bl d8 <delay>
104: bd08 pop {r3, pc}
106: 46c0 nop ; (mov r8, r8)
108: a0002000 .word 0xa0002000
10c: a000200c .word 0xa000200c
Disassembly of section .text.set_wakeup_timer:
00000110 <set_wakeup_timer>:
110: b510 push {r4, lr}
112: 1c14 adds r4, r2, #0
114: 2900 cmp r1, #0
116: d003 beq.n 120 <set_wakeup_timer+0x10>
118: 2180 movs r1, #128 ; 0x80
11a: 0209 lsls r1, r1, #8
11c: 4301 orrs r1, r0
11e: e001 b.n 124 <set_wakeup_timer+0x14>
120: 0440 lsls r0, r0, #17
122: 0c41 lsrs r1, r0, #17
124: 4804 ldr r0, [pc, #16] ; (138 <set_wakeup_timer+0x28>)
126: f7ff ffdf bl e8 <write_regfile>
12a: 2c00 cmp r4, #0
12c: d002 beq.n 134 <set_wakeup_timer+0x24>
12e: 4b03 ldr r3, [pc, #12] ; (13c <set_wakeup_timer+0x2c>)
130: 2201 movs r2, #1
132: 601a str r2, [r3, #0]
134: bd10 pop {r4, pc}
136: 46c0 nop ; (mov r8, r8)
138: a0000034 .word 0xa0000034
13c: a0001300 .word 0xa0001300
Disassembly of section .text.set_halt_until_mbus_rx:
00000140 <set_halt_until_mbus_rx>:
140: 4805 ldr r0, [pc, #20] ; (158 <set_halt_until_mbus_rx+0x18>)
142: b508 push {r3, lr}
144: 6801 ldr r1, [r0, #0]
146: 4b05 ldr r3, [pc, #20] ; (15c <set_halt_until_mbus_rx+0x1c>)
148: 4019 ands r1, r3
14a: 2390 movs r3, #144 ; 0x90
14c: 021b lsls r3, r3, #8
14e: 4319 orrs r1, r3
150: f7ff ffca bl e8 <write_regfile>
154: bd08 pop {r3, pc}
156: 46c0 nop ; (mov r8, r8)
158: a0000028 .word 0xa0000028
15c: ffff0fff .word 0xffff0fff
Disassembly of section .text.set_halt_until_mbus_tx:
00000160 <set_halt_until_mbus_tx>:
160: 4805 ldr r0, [pc, #20] ; (178 <set_halt_until_mbus_tx+0x18>)
162: b508 push {r3, lr}
164: 6801 ldr r1, [r0, #0]
166: 4b05 ldr r3, [pc, #20] ; (17c <set_halt_until_mbus_tx+0x1c>)
168: 4019 ands r1, r3
16a: 23a0 movs r3, #160 ; 0xa0
16c: 021b lsls r3, r3, #8
16e: 4319 orrs r1, r3
170: f7ff ffba bl e8 <write_regfile>
174: bd08 pop {r3, pc}
176: 46c0 nop ; (mov r8, r8)
178: a0000028 .word 0xa0000028
17c: ffff0fff .word 0xffff0fff
Disassembly of section .text.init_interrupt:
00000180 <init_interrupt>:
180: 4a03 ldr r2, [pc, #12] ; (190 <init_interrupt+0x10>)
182: 4b04 ldr r3, [pc, #16] ; (194 <init_interrupt+0x14>)
184: 601a str r2, [r3, #0]
186: 4b04 ldr r3, [pc, #16] ; (198 <init_interrupt+0x18>)
188: 2200 movs r2, #0
18a: 601a str r2, [r3, #0]
18c: 4770 bx lr
18e: 46c0 nop ; (mov r8, r8)
190: 0001ffff .word 0x0001ffff
194: e000e280 .word 0xe000e280
198: e000e100 .word 0xe000e100
Disassembly of section .text.handler_ext_int_0:
0000019c <handler_ext_int_0>:
19c: 4b01 ldr r3, [pc, #4] ; (1a4 <handler_ext_int_0+0x8>)
19e: 2201 movs r2, #1
1a0: 601a str r2, [r3, #0]
1a2: 4770 bx lr
1a4: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_1:
000001a8 <handler_ext_int_1>:
1a8: 4b01 ldr r3, [pc, #4] ; (1b0 <handler_ext_int_1+0x8>)
1aa: 2202 movs r2, #2
1ac: 601a str r2, [r3, #0]
1ae: 4770 bx lr
1b0: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_2:
000001b4 <handler_ext_int_2>:
1b4: 4b01 ldr r3, [pc, #4] ; (1bc <handler_ext_int_2+0x8>)
1b6: 2204 movs r2, #4
1b8: 601a str r2, [r3, #0]
1ba: 4770 bx lr
1bc: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_3:
000001c0 <handler_ext_int_3>:
1c0: 4b01 ldr r3, [pc, #4] ; (1c8 <handler_ext_int_3+0x8>)
1c2: 2208 movs r2, #8
1c4: 601a str r2, [r3, #0]
1c6: 4770 bx lr
1c8: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_4:
000001cc <handler_ext_int_4>:
1cc: 4b01 ldr r3, [pc, #4] ; (1d4 <handler_ext_int_4+0x8>)
1ce: 2210 movs r2, #16
1d0: 601a str r2, [r3, #0]
1d2: 4770 bx lr
1d4: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_5:
000001d8 <handler_ext_int_5>:
1d8: 4b01 ldr r3, [pc, #4] ; (1e0 <handler_ext_int_5+0x8>)
1da: 2220 movs r2, #32
1dc: 601a str r2, [r3, #0]
1de: 4770 bx lr
1e0: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_6:
000001e4 <handler_ext_int_6>:
1e4: 4b01 ldr r3, [pc, #4] ; (1ec <handler_ext_int_6+0x8>)
1e6: 2240 movs r2, #64 ; 0x40
1e8: 601a str r2, [r3, #0]
1ea: 4770 bx lr
1ec: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_7:
000001f0 <handler_ext_int_7>:
1f0: 4b01 ldr r3, [pc, #4] ; (1f8 <handler_ext_int_7+0x8>)
1f2: 2280 movs r2, #128 ; 0x80
1f4: 601a str r2, [r3, #0]
1f6: 4770 bx lr
1f8: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_8:
000001fc <handler_ext_int_8>:
1fc: 4b02 ldr r3, [pc, #8] ; (208 <handler_ext_int_8+0xc>)
1fe: 2280 movs r2, #128 ; 0x80
200: 0052 lsls r2, r2, #1
202: 601a str r2, [r3, #0]
204: 4770 bx lr
206: 46c0 nop ; (mov r8, r8)
208: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_9:
0000020c <handler_ext_int_9>:
20c: 4b02 ldr r3, [pc, #8] ; (218 <handler_ext_int_9+0xc>)
20e: 2280 movs r2, #128 ; 0x80
210: 0092 lsls r2, r2, #2
212: 601a str r2, [r3, #0]
214: 4770 bx lr
216: 46c0 nop ; (mov r8, r8)
218: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_10:
0000021c <handler_ext_int_10>:
21c: 4b02 ldr r3, [pc, #8] ; (228 <handler_ext_int_10+0xc>)
21e: 2280 movs r2, #128 ; 0x80
220: 00d2 lsls r2, r2, #3
222: 601a str r2, [r3, #0]
224: 4770 bx lr
226: 46c0 nop ; (mov r8, r8)
228: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_11:
0000022c <handler_ext_int_11>:
22c: 4b02 ldr r3, [pc, #8] ; (238 <handler_ext_int_11+0xc>)
22e: 2280 movs r2, #128 ; 0x80
230: 0112 lsls r2, r2, #4
232: 601a str r2, [r3, #0]
234: 4770 bx lr
236: 46c0 nop ; (mov r8, r8)
238: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_12:
0000023c <handler_ext_int_12>:
23c: 4b02 ldr r3, [pc, #8] ; (248 <handler_ext_int_12+0xc>)
23e: 2280 movs r2, #128 ; 0x80
240: 0152 lsls r2, r2, #5
242: 601a str r2, [r3, #0]
244: 4770 bx lr
246: 46c0 nop ; (mov r8, r8)
248: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_13:
0000024c <handler_ext_int_13>:
24c: 4b02 ldr r3, [pc, #8] ; (258 <handler_ext_int_13+0xc>)
24e: 2280 movs r2, #128 ; 0x80
250: 0192 lsls r2, r2, #6
252: 601a str r2, [r3, #0]
254: 4770 bx lr
256: 46c0 nop ; (mov r8, r8)
258: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_14:
0000025c <handler_ext_int_14>:
25c: 4b02 ldr r3, [pc, #8] ; (268 <handler_ext_int_14+0xc>)
25e: 2280 movs r2, #128 ; 0x80
260: 01d2 lsls r2, r2, #7
262: 601a str r2, [r3, #0]
264: 4770 bx lr
266: 46c0 nop ; (mov r8, r8)
268: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_15:
0000026c <handler_ext_int_15>:
26c: 4b02 ldr r3, [pc, #8] ; (278 <handler_ext_int_15+0xc>)
26e: 2280 movs r2, #128 ; 0x80
270: 0212 lsls r2, r2, #8
272: 601a str r2, [r3, #0]
274: 4770 bx lr
276: 46c0 nop ; (mov r8, r8)
278: e000e280 .word 0xe000e280
Disassembly of section .text.handler_ext_int_16:
0000027c <handler_ext_int_16>:
27c: 4b02 ldr r3, [pc, #8] ; (288 <handler_ext_int_16+0xc>)
27e: 2280 movs r2, #128 ; 0x80
280: 0252 lsls r2, r2, #9
282: 601a str r2, [r3, #0]
284: 4770 bx lr
286: 46c0 nop ; (mov r8, r8)
288: e000e280 .word 0xe000e280
Disassembly of section .text.initialization:
0000028c <initialization>:
28c: b508 push {r3, lr}
28e: 4a07 ldr r2, [pc, #28] ; (2ac <initialization+0x20>)
290: 4b07 ldr r3, [pc, #28] ; (2b0 <initialization+0x24>)
292: 601a str r2, [r3, #0]
294: 4b07 ldr r3, [pc, #28] ; (2b4 <initialization+0x28>)
296: 2200 movs r2, #0
298: 601a str r2, [r3, #0]
29a: f7ff ff51 bl 140 <set_halt_until_mbus_rx>
29e: 2004 movs r0, #4
2a0: f7ff ff0a bl b8 <mbus_enumerate>
2a4: f7ff ff5c bl 160 <set_halt_until_mbus_tx>
2a8: bd08 pop {r3, pc}
2aa: 46c0 nop ; (mov r8, r8)
2ac: deadbeef .word 0xdeadbeef
2b0: 000005b0 .word 0x000005b0
2b4: 000005ac .word 0x000005ac
Disassembly of section .text.cycle0:
000002b8 <cycle0>:
2b8: b508 push {r3, lr}
2ba: 4b05 ldr r3, [pc, #20] ; (2d0 <cycle0+0x18>)
2bc: 20a0 movs r0, #160 ; 0xa0
2be: 6819 ldr r1, [r3, #0]
2c0: f7ff fef2 bl a8 <mbus_write_message32>
2c4: 20fa movs r0, #250 ; 0xfa
2c6: 0080 lsls r0, r0, #2
2c8: f7ff ff06 bl d8 <delay>
2cc: bd08 pop {r3, pc}
2ce: 46c0 nop ; (mov r8, r8)
2d0: 000005ac .word 0x000005ac
Disassembly of section .text.cycle1:
000002d4 <cycle1>:
2d4: b508 push {r3, lr}
2d6: 4b05 ldr r3, [pc, #20] ; (2ec <cycle1+0x18>)
2d8: 20a1 movs r0, #161 ; 0xa1
2da: 6819 ldr r1, [r3, #0]
2dc: f7ff fee4 bl a8 <mbus_write_message32>
2e0: 20fa movs r0, #250 ; 0xfa
2e2: 0080 lsls r0, r0, #2
2e4: f7ff fef8 bl d8 <delay>
2e8: bd08 pop {r3, pc}
2ea: 46c0 nop ; (mov r8, r8)
2ec: 000005ac .word 0x000005ac
Disassembly of section .text.cycle2:
000002f0 <cycle2>:
2f0: b508 push {r3, lr}
2f2: 4b05 ldr r3, [pc, #20] ; (308 <cycle2+0x18>)
2f4: 20a2 movs r0, #162 ; 0xa2
2f6: 6819 ldr r1, [r3, #0]
2f8: f7ff fed6 bl a8 <mbus_write_message32>
2fc: 20fa movs r0, #250 ; 0xfa
2fe: 0080 lsls r0, r0, #2
300: f7ff feea bl d8 <delay>
304: bd08 pop {r3, pc}
306: 46c0 nop ; (mov r8, r8)
308: 000005ac .word 0x000005ac
Disassembly of section .text.cycle3:
0000030c <cycle3>:
30c: b508 push {r3, lr}
30e: 4b05 ldr r3, [pc, #20] ; (324 <cycle3+0x18>)
310: 20a3 movs r0, #163 ; 0xa3
312: 6819 ldr r1, [r3, #0]
314: f7ff fec8 bl a8 <mbus_write_message32>
318: 20fa movs r0, #250 ; 0xfa
31a: 0080 lsls r0, r0, #2
31c: f7ff fedc bl d8 <delay>
320: bd08 pop {r3, pc}
322: 46c0 nop ; (mov r8, r8)
324: 000005ac .word 0x000005ac
Disassembly of section .text.cycle4:
00000328 <cycle4>:
328: b508 push {r3, lr}
32a: 4b05 ldr r3, [pc, #20] ; (340 <cycle4+0x18>)
32c: 20a4 movs r0, #164 ; 0xa4
32e: 6819 ldr r1, [r3, #0]
330: f7ff feba bl a8 <mbus_write_message32>
334: 20fa movs r0, #250 ; 0xfa
336: 0080 lsls r0, r0, #2
338: f7ff fece bl d8 <delay>
33c: bd08 pop {r3, pc}
33e: 46c0 nop ; (mov r8, r8)
340: 000005ac .word 0x000005ac
Disassembly of section .text.cycle5:
00000344 <cycle5>:
344: b508 push {r3, lr}
346: 4b05 ldr r3, [pc, #20] ; (35c <cycle5+0x18>)
348: 20a5 movs r0, #165 ; 0xa5
34a: 6819 ldr r1, [r3, #0]
34c: f7ff feac bl a8 <mbus_write_message32>
350: 20fa movs r0, #250 ; 0xfa
352: 0080 lsls r0, r0, #2
354: f7ff fec0 bl d8 <delay>
358: bd08 pop {r3, pc}
35a: 46c0 nop ; (mov r8, r8)
35c: 000005ac .word 0x000005ac
Disassembly of section .text.cycle6:
00000360 <cycle6>:
360: b508 push {r3, lr}
362: 4b05 ldr r3, [pc, #20] ; (378 <cycle6+0x18>)
364: 20a6 movs r0, #166 ; 0xa6
366: 6819 ldr r1, [r3, #0]
368: f7ff fe9e bl a8 <mbus_write_message32>
36c: 20fa movs r0, #250 ; 0xfa
36e: 0080 lsls r0, r0, #2
370: f7ff feb2 bl d8 <delay>
374: bd08 pop {r3, pc}
376: 46c0 nop ; (mov r8, r8)
378: 000005ac .word 0x000005ac
Disassembly of section .text.cycle7:
0000037c <cycle7>:
37c: b508 push {r3, lr}
37e: 4b05 ldr r3, [pc, #20] ; (394 <cycle7+0x18>)
380: 20a7 movs r0, #167 ; 0xa7
382: 6819 ldr r1, [r3, #0]
384: f7ff fe90 bl a8 <mbus_write_message32>
388: 20fa movs r0, #250 ; 0xfa
38a: 0080 lsls r0, r0, #2
38c: f7ff fea4 bl d8 <delay>
390: bd08 pop {r3, pc}
392: 46c0 nop ; (mov r8, r8)
394: 000005ac .word 0x000005ac
Disassembly of section .text.cycle8:
00000398 <cycle8>:
398: b508 push {r3, lr}
39a: 4b05 ldr r3, [pc, #20] ; (3b0 <cycle8+0x18>)
39c: 20a8 movs r0, #168 ; 0xa8
39e: 6819 ldr r1, [r3, #0]
3a0: f7ff fe82 bl a8 <mbus_write_message32>
3a4: 20fa movs r0, #250 ; 0xfa
3a6: 0080 lsls r0, r0, #2
3a8: f7ff fe96 bl d8 <delay>
3ac: bd08 pop {r3, pc}
3ae: 46c0 nop ; (mov r8, r8)
3b0: 000005ac .word 0x000005ac
Disassembly of section .text.cycle9:
000003b4 <cycle9>:
3b4: b508 push {r3, lr}
3b6: 4b05 ldr r3, [pc, #20] ; (3cc <cycle9+0x18>)
3b8: 20a9 movs r0, #169 ; 0xa9
3ba: 6819 ldr r1, [r3, #0]
3bc: f7ff fe74 bl a8 <mbus_write_message32>
3c0: 20fa movs r0, #250 ; 0xfa
3c2: 0080 lsls r0, r0, #2
3c4: f7ff fe88 bl d8 <delay>
3c8: bd08 pop {r3, pc}
3ca: 46c0 nop ; (mov r8, r8)
3cc: 000005ac .word 0x000005ac
Disassembly of section .text.cycle10:
000003d0 <cycle10>:
3d0: b508 push {r3, lr}
3d2: 4b05 ldr r3, [pc, #20] ; (3e8 <cycle10+0x18>)
3d4: 20aa movs r0, #170 ; 0xaa
3d6: 6819 ldr r1, [r3, #0]
3d8: f7ff fe66 bl a8 <mbus_write_message32>
3dc: 20fa movs r0, #250 ; 0xfa
3de: 0080 lsls r0, r0, #2
3e0: f7ff fe7a bl d8 <delay>
3e4: bd08 pop {r3, pc}
3e6: 46c0 nop ; (mov r8, r8)
3e8: 000005ac .word 0x000005ac
Disassembly of section .text.cycle11:
000003ec <cycle11>:
3ec: b508 push {r3, lr}
3ee: 4b05 ldr r3, [pc, #20] ; (404 <cycle11+0x18>)
3f0: 20ab movs r0, #171 ; 0xab
3f2: 6819 ldr r1, [r3, #0]
3f4: f7ff fe58 bl a8 <mbus_write_message32>
3f8: 20fa movs r0, #250 ; 0xfa
3fa: 0080 lsls r0, r0, #2
3fc: f7ff fe6c bl d8 <delay>
400: bd08 pop {r3, pc}
402: 46c0 nop ; (mov r8, r8)
404: 000005ac .word 0x000005ac
Disassembly of section .text.cycle12:
00000408 <cycle12>:
408: b508 push {r3, lr}
40a: 4b05 ldr r3, [pc, #20] ; (420 <cycle12+0x18>)
40c: 20ac movs r0, #172 ; 0xac
40e: 6819 ldr r1, [r3, #0]
410: f7ff fe4a bl a8 <mbus_write_message32>
414: 20fa movs r0, #250 ; 0xfa
416: 0080 lsls r0, r0, #2
418: f7ff fe5e bl d8 <delay>
41c: bd08 pop {r3, pc}
41e: 46c0 nop ; (mov r8, r8)
420: 000005ac .word 0x000005ac
Disassembly of section .text.cycle13:
00000424 <cycle13>:
424: b508 push {r3, lr}
426: 4b05 ldr r3, [pc, #20] ; (43c <cycle13+0x18>)
428: 20ad movs r0, #173 ; 0xad
42a: 6819 ldr r1, [r3, #0]
42c: f7ff fe3c bl a8 <mbus_write_message32>
430: 20fa movs r0, #250 ; 0xfa
432: 0080 lsls r0, r0, #2
434: f7ff fe50 bl d8 <delay>
438: bd08 pop {r3, pc}
43a: 46c0 nop ; (mov r8, r8)
43c: 000005ac .word 0x000005ac
Disassembly of section .text.cycle14:
00000440 <cycle14>:
440: b508 push {r3, lr}
442: 4b05 ldr r3, [pc, #20] ; (458 <cycle14+0x18>)
444: 20ae movs r0, #174 ; 0xae
446: 6819 ldr r1, [r3, #0]
448: f7ff fe2e bl a8 <mbus_write_message32>
44c: 20fa movs r0, #250 ; 0xfa
44e: 0080 lsls r0, r0, #2
450: f7ff fe42 bl d8 <delay>
454: bd08 pop {r3, pc}
456: 46c0 nop ; (mov r8, r8)
458: 000005ac .word 0x000005ac
Disassembly of section .text.cycle15:
0000045c <cycle15>:
45c: b508 push {r3, lr}
45e: 4b05 ldr r3, [pc, #20] ; (474 <cycle15+0x18>)
460: 20af movs r0, #175 ; 0xaf
462: 6819 ldr r1, [r3, #0]
464: f7ff fe20 bl a8 <mbus_write_message32>
468: 20fa movs r0, #250 ; 0xfa
46a: 0080 lsls r0, r0, #2
46c: f7ff fe34 bl d8 <delay>
470: bd08 pop {r3, pc}
472: 46c0 nop ; (mov r8, r8)
474: 000005ac .word 0x000005ac
Disassembly of section .text.startup.main:
00000478 <main>:
478: b538 push {r3, r4, r5, lr}
47a: f7ff fe81 bl 180 <init_interrupt>
47e: 4b45 ldr r3, [pc, #276] ; (594 <main+0x11c>)
480: 681a ldr r2, [r3, #0]
482: 4b45 ldr r3, [pc, #276] ; (598 <main+0x120>)
484: 429a cmp r2, r3
486: d001 beq.n 48c <main+0x14>
488: f7ff ff00 bl 28c <initialization>
48c: 2400 movs r4, #0
48e: 4d43 ldr r5, [pc, #268] ; (59c <main+0x124>)
490: 682b ldr r3, [r5, #0]
492: 2b00 cmp r3, #0
494: d104 bne.n 4a0 <main+0x28>
496: 20fa movs r0, #250 ; 0xfa
498: 0080 lsls r0, r0, #2
49a: f7ff fe1d bl d8 <delay>
49e: e057 b.n 550 <main+0xd8>
4a0: 230f movs r3, #15
4a2: 4023 ands r3, r4
4a4: d102 bne.n 4ac <main+0x34>
4a6: f7ff ff07 bl 2b8 <cycle0>
4aa: e047 b.n 53c <main+0xc4>
4ac: 2b01 cmp r3, #1
4ae: d102 bne.n 4b6 <main+0x3e>
4b0: f7ff ff10 bl 2d4 <cycle1>
4b4: e042 b.n 53c <main+0xc4>
4b6: 2b02 cmp r3, #2
4b8: d102 bne.n 4c0 <main+0x48>
4ba: f7ff ff19 bl 2f0 <cycle2>
4be: e03d b.n 53c <main+0xc4>
4c0: 2b03 cmp r3, #3
4c2: d102 bne.n 4ca <main+0x52>
4c4: f7ff ff22 bl 30c <cycle3>
4c8: e038 b.n 53c <main+0xc4>
4ca: 2b04 cmp r3, #4
4cc: d102 bne.n 4d4 <main+0x5c>
4ce: f7ff ff2b bl 328 <cycle4>
4d2: e033 b.n 53c <main+0xc4>
4d4: 2b05 cmp r3, #5
4d6: d102 bne.n 4de <main+0x66>
4d8: f7ff ff34 bl 344 <cycle5>
4dc: e02e b.n 53c <main+0xc4>
4de: 2b06 cmp r3, #6
4e0: d102 bne.n 4e8 <main+0x70>
4e2: f7ff ff3d bl 360 <cycle6>
4e6: e029 b.n 53c <main+0xc4>
4e8: 2b07 cmp r3, #7
4ea: d102 bne.n 4f2 <main+0x7a>
4ec: f7ff ff46 bl 37c <cycle7>
4f0: e024 b.n 53c <main+0xc4>
4f2: 2b08 cmp r3, #8
4f4: d102 bne.n 4fc <main+0x84>
4f6: f7ff ff4f bl 398 <cycle8>
4fa: e01f b.n 53c <main+0xc4>
4fc: 2b09 cmp r3, #9
4fe: d102 bne.n 506 <main+0x8e>
500: f7ff ff58 bl 3b4 <cycle9>
504: e01a b.n 53c <main+0xc4>
506: 2b0a cmp r3, #10
508: d102 bne.n 510 <main+0x98>
50a: f7ff ff61 bl 3d0 <cycle10>
50e: e015 b.n 53c <main+0xc4>
510: 2b0b cmp r3, #11
512: d102 bne.n 51a <main+0xa2>
514: f7ff ff6a bl 3ec <cycle11>
518: e010 b.n 53c <main+0xc4>
51a: 2b0c cmp r3, #12
51c: d102 bne.n 524 <main+0xac>
51e: f7ff ff73 bl 408 <cycle12>
522: e00b b.n 53c <main+0xc4>
524: 2b0d cmp r3, #13
526: d102 bne.n 52e <main+0xb6>
528: f7ff ff7c bl 424 <cycle13>
52c: e006 b.n 53c <main+0xc4>
52e: 2b0e cmp r3, #14
530: d102 bne.n 538 <main+0xc0>
532: f7ff ff85 bl 440 <cycle14>
536: e001 b.n 53c <main+0xc4>
538: f7ff ff90 bl 45c <cycle15>
53c: 682b ldr r3, [r5, #0]
53e: 20fa movs r0, #250 ; 0xfa
540: 3301 adds r3, #1
542: 0080 lsls r0, r0, #2
544: 3401 adds r4, #1
546: 602b str r3, [r5, #0]
548: f7ff fdc6 bl d8 <delay>
54c: 2c64 cmp r4, #100 ; 0x64
54e: d19e bne.n 48e <main+0x16>
550: 4b12 ldr r3, [pc, #72] ; (59c <main+0x124>)
552: 4a13 ldr r2, [pc, #76] ; (5a0 <main+0x128>)
554: 6819 ldr r1, [r3, #0]
556: 4291 cmp r1, r2
558: d108 bne.n 56c <main+0xf4>
55a: 20dd movs r0, #221 ; 0xdd
55c: 4911 ldr r1, [pc, #68] ; (5a4 <main+0x12c>)
55e: f7ff fda3 bl a8 <mbus_write_message32>
562: 20fa movs r0, #250 ; 0xfa
564: 0080 lsls r0, r0, #2
566: f7ff fdb7 bl d8 <delay>
56a: e7fe b.n 56a <main+0xf2>
56c: 681a ldr r2, [r3, #0]
56e: 490e ldr r1, [pc, #56] ; (5a8 <main+0x130>)
570: 3201 adds r2, #1
572: 20dd movs r0, #221 ; 0xdd
574: 601a str r2, [r3, #0]
576: f7ff fd97 bl a8 <mbus_write_message32>
57a: 20fa movs r0, #250 ; 0xfa
57c: 0080 lsls r0, r0, #2
57e: f7ff fdab bl d8 <delay>
582: 2101 movs r1, #1
584: 2002 movs r0, #2
586: 1c0a adds r2, r1, #0
588: f7ff fdc2 bl 110 <set_wakeup_timer>
58c: f7ff fd9e bl cc <mbus_sleep_all>
590: 2001 movs r0, #1
592: bd38 pop {r3, r4, r5, pc}
594: 000005b0 .word 0x000005b0
598: deadbeef .word 0xdeadbeef
59c: 000005ac .word 0x000005ac
5a0: 000003e7 .word 0x000003e7
5a4: 0ea70ea7 .word 0x0ea70ea7
5a8: 0ea7f00d .word 0x0ea7f00d
|
llvm-gcc-4.2-2.9/gcc/ada/gnatname.adb | vidkidz/crossbridge | 1 | 21584 | <reponame>vidkidz/crossbridge
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T N A M E --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Gnatvsn; use Gnatvsn;
with Hostparm;
with Opt;
with Osint; use Osint;
with Output; use Output;
with Prj.Makr;
with Table;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Command_Line; use GNAT.Command_Line;
with GNAT.OS_Lib; use GNAT.OS_Lib;
procedure Gnatname is
Usage_Output : Boolean := False;
-- Set to True when usage is output, to avoid multiple output
Usage_Needed : Boolean := False;
-- Set to True by -h switch
Version_Output : Boolean := False;
-- Set to True when version is output, to avoid multiple output
Very_Verbose : Boolean := False;
-- Set to True with -v -v
Create_Project : Boolean := False;
-- Set to True with a -P switch
File_Path : String_Access := new String'("gnat.adc");
-- Path name of the file specified by -c or -P switch
File_Set : Boolean := False;
-- Set to True by -c or -P switch.
-- Used to detect multiple -c/-P switches.
package Excluded_Patterns is new Table.Table
(Table_Component_Type => String_Access,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 10,
Table_Name => "Gnatname.Excluded_Patterns");
-- Table to accumulate the negative patterns
package Foreign_Patterns is new Table.Table
(Table_Component_Type => String_Access,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 10,
Table_Name => "Gnatname.Foreign_Patterns");
-- Table to accumulate the foreign patterns
package Patterns is new Table.Table
(Table_Component_Type => String_Access,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 10,
Table_Name => "Gnatname.Patterns");
-- Table to accumulate the name patterns
package Source_Directories is new Table.Table
(Table_Component_Type => String_Access,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 10,
Table_Name => "Gnatname.Source_Directories");
-- Table to accumulate the source directories specified directly with -d
-- or indirectly with -D.
package Preprocessor_Switches is new Table.Table
(Table_Component_Type => String_Access,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 2,
Table_Increment => 50,
Table_Name => "Gnatname.Preprocessor_Switches");
-- Table to store the preprocessor switches to be used in the call
-- to the compiler.
procedure Output_Version;
-- Print name and version
procedure Usage;
-- Print usage
procedure Scan_Args;
-- Scan the command line arguments
procedure Add_Source_Directory (S : String);
-- Add S in the Source_Directories table
procedure Get_Directories (From_File : String);
-- Read a source directory text file
--------------------------
-- Add_Source_Directory --
--------------------------
procedure Add_Source_Directory (S : String) is
begin
Source_Directories.Increment_Last;
Source_Directories.Table (Source_Directories.Last) := new String'(S);
end Add_Source_Directory;
---------------------
-- Get_Directories --
---------------------
procedure Get_Directories (From_File : String) is
File : Ada.Text_IO.File_Type;
Line : String (1 .. 2_000);
Last : Natural;
begin
Open (File, In_File, From_File);
while not End_Of_File (File) loop
Get_Line (File, Line, Last);
if Last /= 0 then
Add_Source_Directory (Line (1 .. Last));
end if;
end loop;
Close (File);
exception
when Name_Error =>
Fail ("cannot open source directory """ & From_File & '"');
end Get_Directories;
--------------------
-- Output_Version --
--------------------
procedure Output_Version is
begin
if not Version_Output then
Version_Output := True;
Output.Write_Eol;
Output.Write_Str ("GNATNAME ");
Output.Write_Line (Gnatvsn.Gnat_Version_String);
Output.Write_Line
("Copyright 2001-" &
Current_Year &
", Free Software Foundation, Inc.");
end if;
end Output_Version;
---------------
-- Scan_Args --
---------------
procedure Scan_Args is
begin
Initialize_Option_Scan;
-- Scan options first
loop
case Getopt ("c: d: gnatep=! gnatep! gnateD! D: h P: v x: f:") is
when ASCII.NUL =>
exit;
when 'c' =>
if File_Set then
Fail ("only one -P or -c switch may be specified");
end if;
File_Set := True;
File_Path := new String'(Parameter);
Create_Project := False;
when 'd' =>
Add_Source_Directory (Parameter);
when 'D' =>
Get_Directories (Parameter);
when 'f' =>
Foreign_Patterns.Increment_Last;
Foreign_Patterns.Table (Foreign_Patterns.Last) :=
new String'(Parameter);
when 'g' =>
Preprocessor_Switches.Increment_Last;
Preprocessor_Switches.Table (Preprocessor_Switches.Last) :=
new String'('-' & Full_Switch & Parameter);
when 'h' =>
Usage_Needed := True;
when 'P' =>
if File_Set then
Fail ("only one -c or -P switch may be specified");
end if;
File_Set := True;
File_Path := new String'(Parameter);
Create_Project := True;
when 'v' =>
if Opt.Verbose_Mode then
Very_Verbose := True;
else
Opt.Verbose_Mode := True;
end if;
when 'x' =>
Excluded_Patterns.Increment_Last;
Excluded_Patterns.Table (Excluded_Patterns.Last) :=
new String'(Parameter);
when others =>
null;
end case;
end loop;
-- Now, get the name patterns, if any
loop
declare
S : String := Get_Argument (Do_Expansion => False);
begin
exit when S = "";
Canonical_Case_File_Name (S);
Patterns.Increment_Last;
Patterns.Table (Patterns.Last) := new String'(S);
end;
end loop;
exception
when Invalid_Switch =>
Fail ("invalid switch " & Full_Switch);
end Scan_Args;
-----------
-- Usage --
-----------
procedure Usage is
begin
if not Usage_Output then
Usage_Needed := False;
Usage_Output := True;
Write_Str ("Usage: ");
Osint.Write_Program_Name;
Write_Line (" [switches] naming-pattern [naming-patterns]");
Write_Eol;
Write_Line ("switches:");
Write_Line (" -cfile create configuration pragmas file");
Write_Line (" -ddir use dir as one of the source " &
"directories");
Write_Line (" -Dfile get source directories from file");
Write_Line (" -fpat foreign pattern");
Write_Line (" -gnateDsym=v preprocess with symbol definition");
Write_Line (" -gnatep=data preprocess files with data file");
Write_Line (" -h output this help message");
Write_Line (" -Pproj update or create project file proj");
Write_Line (" -v verbose output");
Write_Line (" -v -v very verbose output");
Write_Line (" -xpat exclude pattern pat");
end if;
end Usage;
-- Start of processing for Gnatname
begin
-- Add the directory where gnatname is invoked in front of the
-- path, if gnatname is invoked with directory information.
-- Only do this if the platform is not VMS, where the notion of path
-- does not really exist.
if not Hostparm.OpenVMS then
declare
Command : constant String := Command_Name;
begin
for Index in reverse Command'Range loop
if Command (Index) = Directory_Separator then
declare
Absolute_Dir : constant String :=
Normalize_Pathname
(Command (Command'First .. Index));
PATH : constant String :=
Absolute_Dir &
Path_Separator &
Getenv ("PATH").all;
begin
Setenv ("PATH", PATH);
end;
exit;
end if;
end loop;
end;
end if;
-- Initialize tables
Excluded_Patterns.Set_Last (0);
Foreign_Patterns.Set_Last (0);
Patterns.Set_Last (0);
Source_Directories.Set_Last (0);
Preprocessor_Switches.Set_Last (0);
-- Get the arguments
Scan_Args;
if Opt.Verbose_Mode then
Output_Version;
end if;
if Usage_Needed then
Usage;
end if;
-- If no pattern was specified, print the usage and return
if Patterns.Last = 0 and Foreign_Patterns.Last = 0 then
Usage;
return;
end if;
-- If no source directory was specified, use the current directory as the
-- unique directory. Note that if a file was specified with directory
-- information, the current directory is the directory of the specified
-- file.
if Source_Directories.Last = 0 then
Source_Directories.Increment_Last;
Source_Directories.Table (Source_Directories.Last) := new String'(".");
end if;
declare
Directories : Argument_List (1 .. Integer (Source_Directories.Last));
Name_Patterns : Argument_List (1 .. Integer (Patterns.Last));
Excl_Patterns : Argument_List (1 .. Integer (Excluded_Patterns.Last));
Frgn_Patterns : Argument_List (1 .. Integer (Foreign_Patterns.Last));
Prep_Switches : Argument_List
(1 .. Integer (Preprocessor_Switches.Last));
begin
-- Build the Directories and Name_Patterns arguments
for Index in Directories'Range loop
Directories (Index) := Source_Directories.Table (Index);
end loop;
for Index in Name_Patterns'Range loop
Name_Patterns (Index) := Patterns.Table (Index);
end loop;
for Index in Excl_Patterns'Range loop
Excl_Patterns (Index) := Excluded_Patterns.Table (Index);
end loop;
for Index in Frgn_Patterns'Range loop
Frgn_Patterns (Index) := Foreign_Patterns.Table (Index);
end loop;
for Index in Prep_Switches'Range loop
Prep_Switches (Index) := Preprocessor_Switches.Table (Index);
end loop;
-- Call Prj.Makr.Make where the real work is done
Prj.Makr.Make
(File_Path => File_Path.all,
Project_File => Create_Project,
Directories => Directories,
Name_Patterns => Name_Patterns,
Excluded_Patterns => Excl_Patterns,
Foreign_Patterns => Frgn_Patterns,
Preproc_Switches => Prep_Switches,
Very_Verbose => Very_Verbose);
end;
if Opt.Verbose_Mode then
Write_Eol;
end if;
end Gnatname;
|
programs/oeis/152/A152556.asm | neoneye/loda | 22 | 246403 | ; A152556: a(n) = 2*(2*n+2)^floor((n-1)/2).
; 1,2,2,16,20,288,392,8192,11664,320000,468512,15925248,23762752,963780608,1458000000,68719476736,105046700288,5642219814912,8695584276992,524288000000000,813342767698944,54394721876836352,84841494965553152,6232805962420322304,9765625000000000000,781754012972500385792,1229575252353016799232,106530593546206374264832,168110140833113738264576,15672832819200000000000000,24803538869315053824278528,2475880078570760549798248448,3928158732213644200735997952,417996455380740196633256394752,664658611392020000000000000000,75107349288208415283769428148224,119665574759900159778264689410048,14311154052757268463817888158973952,22841932514339760506510990419427328
mov $1,$0
add $0,1
add $1,1
mov $2,$1
add $1,$0
div $0,2
pow $1,$0
div $1,$2
mov $0,$1
|
examples/demo-grammar/tinyc/src/samples/sample_1_io.asm | fossabot/FlyLab | 0 | 13916 | <reponame>fossabot/FlyLab
FUNC @main:
var n
readint "Please input an integer: "
pop n
push n
print "Your input number is: %d"
push 0
ret ~
ENDFUNC
|
test/Succeed/Issue2603.agda | shlevy/agda | 1,989 | 15409 | -- Andreas, 2017-06-14, issue #2603
-- reported by rfindler, shrunk test case by Ulf
-- {-# OPTIONS -v tc.conv:40 -v tc.conv.atom:50 -v tc:80 -v tc.meta.assign:70 #-}
{-# OPTIONS --allow-unsolved-metas #-}
open import Agda.Builtin.Equality
data List (A : Set) : Set where
[] : List A
postulate
Signal : Set
data Any (xs : List Signal) : Set where
no : Any xs
any : ∀ xs → Any xs
any [] = no
record Env : Set where
field sig : List Signal
open Env
Can : (θ : Env) → Any (sig θ) → Set
Can θ no = Signal
postulate
elephant : ∀ θ → Can θ (any (sig θ)) ≡ Signal
lemma2 : Set
lemma2 rewrite elephant _ = Signal
-- Should succeed.
-- This lead to an internal error when the conversion checker
-- tried to eta expand a meta variable but dontAssignMetas was on.
|
data/maps/headers/VermilionPokecenter.asm | opiter09/ASM-Machina | 1 | 104361 | <gh_stars>1-10
map_header VermilionPokecenter, VERMILION_POKECENTER, POKECENTER, 0
end_map_header
|
src/main/antlr/TinyScript.g4 | jacobsimpson/tinyscript | 4 | 7250 | grammar TinyScript;
options
{
language = Java;
}
@header {
package jacob.simpson.tinyscript.grammar;
}
program
:
| ( COMMENT | printStatement | declarationStatement | assignmentStatement )*
;
printStatement
: PRINT
| PRINT STRING
| PRINT IDENTIFIER
;
declarationStatement
: VAR IDENTIFIER
;
assignmentStatement
: IDENTIFIER '=' INTEGER
;
PRINT
: 'print'
;
VAR
: 'var'
;
STRING
: '"' ~('\"')* '"' {setText(getText().substring(1, getText().length()-1));}
;
IDENTIFIER
: LETTER (DIGIT | LETTER)*
;
INTEGER
: DIGIT+
;
COMMENT
: '#' ~( '\r' | '\n' )*
;
WS : [ \t\r\n]+ -> skip
;
fragment DIGIT : '0' .. '9';
fragment LETTER : 'a' .. 'z' | 'A' .. 'Z'; |
Cubical/Data/List/FinData.agda | thomas-lamiaux/cubical | 1 | 16237 | {-# OPTIONS --safe #-}
module Cubical.Data.List.FinData where
open import Cubical.Foundations.Prelude
open import Cubical.Data.List
open import Cubical.Data.FinData
variable
ℓ : Level
A : Type ℓ
-- copy-paste from agda-stdlib
lookup : ∀ (xs : List A) → Fin (length xs) → A
lookup (x ∷ xs) zero = x
lookup (x ∷ xs) (suc i) = lookup xs i
|
oeis/156/A156270.asm | neoneye/loda-programs | 11 | 25876 | <filename>oeis/156/A156270.asm
; A156270: a(n) = 8^n*Catalan(n).
; Submitted by <NAME>(s1)
; 1,8,128,2560,57344,1376256,34603008,899678208,23991418880,652566593536,18034567675904,504967894925312,14294475794808832,408413594137395200,11762311511156981760,341107033823552471040,9952299339793060331520,291934113967263103057920,8604373885350912511180800,254689467006387010330951680,7567915591046928306976849920,225661483078490225880764252160,6750221754695707626346339368960,202506652640871228790390181068800,6091400111437406562014936646549504,183679141821804874793065781957492736
mov $1,$0
seq $0,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!).
lpb $1
mul $0,8
sub $1,1
lpe
|
llvm-gcc-4.2-2.9/gcc/ada/a-wtenau.ads | vidkidz/crossbridge | 1 | 13187 | <reponame>vidkidz/crossbridge
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ T E X T _ I O . E N U M E R A T I O N _ A U X --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the routines for Ada.Wide_Text_IO.Enumeration_IO
-- that are shared among separate instantiations.
private package Ada.Wide_Text_IO.Enumeration_Aux is
procedure Get_Enum_Lit
(File : File_Type;
Buf : out Wide_String;
Buflen : out Natural);
-- Reads an enumeration literal value from the file, folds to upper case,
-- and stores the result in Buf, setting Buflen to the number of stored
-- characters (Buf has a lower bound of 1). If more than Buflen characters
-- are present in the literal, Data_Error is raised.
procedure Scan_Enum_Lit
(From : Wide_String;
Start : out Natural;
Stop : out Natural);
-- Scans an enumeration literal at the start of From, skipping any leading
-- spaces. Sets Start to the first character, Stop to the last character.
-- Raises End_Error if no enumeration literal is found.
procedure Put
(File : File_Type;
Item : Wide_String;
Width : Field;
Set : Type_Set);
-- Outputs the enumeration literal image stored in Item to the given File,
-- using the given Width and Set parameters (Item is always in upper case).
procedure Puts
(To : out Wide_String;
Item : Wide_String;
Set : Type_Set);
-- Stores the enumeration literal image stored in Item to the string To,
-- padding with trailing spaces if necessary to fill To. Set is used to
end Ada.Wide_Text_IO.Enumeration_Aux;
|
src/GBA.Timers.ads | 98devin/ada-gba-dev | 7 | 21095 | <gh_stars>1-10
-- Copyright (c) 2021 <NAME>
-- zlib License -- see LICENSE for details.
with Interfaces;
use Interfaces;
with GBA.Memory.IO_Registers;
use GBA.Memory.IO_Registers;
package GBA.Timers is
subtype Timer_Value is Unsigned_16;
type Timer_Scale is
( x1
, x64
, x256
, x1024
);
for Timer_Scale use
( x1 => 0
, x64 => 1
, x256 => 2
, x1024 => 3
);
type Timer_Increment_Type is
( Independent
, Linked_To_Previous
);
for Timer_Increment_Type use
( Independent => 0
, Linked_To_Previous => 1
);
type Timer_Control_Info is
record
Scale : Timer_Scale;
Increment : Timer_Increment_Type;
Trigger_IRQ : Boolean;
Enabled : Boolean;
end record
with Size => 16;
for Timer_Control_Info use
record
Scale at 0 range 0 .. 1;
Increment at 0 range 2 .. 2;
Trigger_IRQ at 0 range 6 .. 6;
Enabled at 0 range 7 .. 7;
end record;
type Timer is
record
Value : Timer_Value;
Control_Info : Timer_Control_Info;
end record;
type Timer_ID is range 0 .. 3;
Timers : array (Timer_ID) of Timer
with Import, Address => TM0CNT_L;
function Get_Count (ID : Timer_ID) return Timer_Value
with Inline_Always;
procedure Set_Initial_Value (ID : Timer_ID; Value : Timer_Value)
with Inline_Always;
procedure Start_Timer (ID : Timer_ID)
with Inline_Always;
procedure Set_Timer_Scale (ID : Timer_ID; Scale : Timer_Scale)
with Inline_Always;
procedure Set_Timer_Increment_Type (ID : Timer_ID; Increment : Timer_Increment_Type)
with Inline_Always;
end GBA.Timers; |
extensions/ts-parser/src/main/antlr/TypeScriptParser.g4 | raghav-deepsource/doov | 55 | 3998 | parser grammar TypeScriptParser;
import JavaScriptParser;
options {
tokenVocab=TypeScriptLexer;
superClass=JavaScriptBaseParser;
}
//
// A.1 Types
//
// - typeParams:
typeParameters: '<' typeParameterList '>';
typeParameterList: typeParameter (',' typeParameter)*;
typeParameter: bindingIdentifier constraint?;
constraint: 'extends' type;
// - typeArguments: (like typeParams but not allowing constraint)
typeArguments: '<' typeArgumentList '>' ;
typeArgumentList: typeArgument (',' typeArgument)* ;
typeArgument: type;
// - Types:
type
: unionOrIntersectionOrPrimaryType
| functionType
| constructorType
;
unionOrIntersectionOrPrimaryType
: unionOrIntersectionOrPrimaryType '|' unionOrIntersectionOrPrimaryType #Union
| unionOrIntersectionOrPrimaryType '&' unionOrIntersectionOrPrimaryType #Intersection
| primaryType #Primary
;
primaryType
: '(' type ')' #ParenthesizedPrimType
| predefinedType #PredefinedPrimType
| typeReference #ReferencePrimType
| objectType #ObjectPrimType
| primaryType {notLineTerminator()}? '[' ']' #ArrayPrimType
| '[' tupleElementTypes ']' #TuplePrimType
| typeQuery #QueryPrimType
| thisType #ThisPrimType
;
// -- primary Types: paranthesized and predefined
//parenthesizedType: '(' type ')';
predefinedType
: 'any'
| 'number'
| 'boolean'
| 'string'
| 'symbol'
| 'void'
;
// -- primary Types: typeReference
typeReference: typeName ({notLineTerminator()}? typeArguments)? ;
typeName
: identifierReference
| namespaceName '.' identifierReference
;
//typeName: (namespaceName '.')? identifierReference;
//
namespaceName: (identifierReference '.')* identifierReference;
// -- primary Types: objectType
objectType: '{' typeBody? '}';
typeBody: typeMemberList (';' | ',')? ;
typeMemberList: typeMember ((';' | ',') typeMember)* ;
typeMember
: propertySignatur
| callSignature
| constructSignature
| indexSignature
| methodSignature
;
// -- primary Types: array- and tupleTypes
//arrayType: primaryType {notLineTerminator()}? '[' ']';
//tupleType: '[' tupleElementTypes ']';
tupleElementTypes: tupleElementType (',' tupleElementType)* ;
tupleElementType: type;
// -- union/intersection types + function/constructor types:
// (not sure why they are sorted here in the spec, in the middle of primary Types)
//unionType: unionOrIntersectionOrPrimaryType '|' intersectionOrPrimaryType;
//intersectionType: intersectionOrPrimaryType '&' primaryType;
functionType: typeParameters? '(' parameterList? ')' '=>' type;
constructorType: 'new' typeParameters? '(' parameterList? ')' '=>' type;
// -- primary Types: typeQuery and thisType
typeQuery: 'typeof' typeQueryExpression;
typeQueryExpression
: identifierReference
| (identifierName '.')+ identifierName //idName includes idReference
;
//original:
//typeQueryExpression
// : identifierReference -can end with idRef
// | typeQueryExpression '.' identifierName -or can end with idName, but then needs at least one ((idRef|idName) .) as prefix
// ;
thisType: 'this';
// -- typeMembers:
// -- typeMembers: propertySignature
propertySignatur: propertyName '?'? typeAnnotation?;
typeAnnotation: ':' type;
// -- typeMembers: callSignature
callSignature: typeParameters? '(' parameterList? ')' typeAnnotation? ;
parameterList
: requiredParameterList
| optionalParameterList
| restParameter
| requiredParameterList ',' optionalParameterList
| requiredParameterList ',' restParameter
| optionalParameterList ',' restParameter
| requiredParameterList ',' optionalParameterList ',' restParameter
;
requiredParameterList: requiredParameter (',' requiredParameter)* ;
requiredParameter
: decoratorList? accessibilityModifier? bindingIdentifierOrPattern typeAnnotation? //added decoratorList for Ext.2
| decoratorList? bindingIdentifier ':' StringLiteral //added decoratorList for Ext.2
;
accessibilityModifier
: Public
| Private
| Protected
;
bindingIdentifierOrPattern
: bindingIdentifier
| bindingPattern
;
optionalParameterList: optionalParameter (',' optionalParameter)* ;
optionalParameter
: decoratorList? accessibilityModifier? bindingIdentifierOrPattern '?' typeAnnotation? //added decoratorList for Ext.2
| decoratorList? accessibilityModifier? bindingIdentifierOrPattern typeAnnotation? initializer //added decoratorList for Ext.2
| decoratorList? bindingIdentifier '?' ':' StringLiteral //added decoratorList for Ext.2
;
restParameter: '...' bindingIdentifier typeAnnotation? ;
// -- typeMembers: constructSignature, indexSignature, methodSignature:
constructSignature: 'new' typeParameters? '(' parameterList? ')' typeAnnotation? ;
indexSignature: '[' bindingIdentifier ':' ('string' | 'number') ']' typeAnnotation;
methodSignature: propertyName '?'? callSignature;
// - typeAliasDeclaration (not used yet, but will be in A.3)
typeAliasDeclaration: 'type' bindingIdentifier typeParameters? '=' type ';' ;
//
// A.2 Expressions
//
//Actually called "propertyDefinition" in ES2015 spec, but the imported javascript grammar names it differently:
propertyAssignment //modified
: identifierReference # PropertyShorthand //identifierReference
| propertyName '=' singleExpression # CoverInitializedName
| propertyName ':' singleExpression # PropertyExpressionAssignment
| propertyName callSignature '{' functionBody '}'# MethodProperty
| getAccessor # PropertyGetter
| setAccessor # PropertySetter
;
getAccessor: 'get ' propertyName '(' ')' typeAnnotation? '{' functionBody '}';
setAccessor: 'set ' propertyName '(' bindingIdentifierOrPattern typeAnnotation? ')' '{' functionBody '}';
// Overrides JavaScript Rule:
// propertyAssignment //propertyAssignment actually called "propertyDefinition" in Spec
// : propertyName (':' |'=') singleExpression # PropertyExpressionAssignment //original spec: (proName ':' assignmentExpression | coverInitializedName)
// | '[' singleExpression ']' ':' singleExpression # ComputedPropertyExpressionAssignment
// | getter '(' ')' '{' functionBody '}' # PropertyGetter //actually in methodDefinition
// | setter '(' Identifier ')' '{' functionBody '}' # PropertySetter //actually in methoddefinition
// | generatorMethod # MethodProperty //actually in methoddefinition
// //propertyName '(' strictFormalParameters ')' '{' functionBody '}' missing
// | Identifier # PropertyShorthand //identifierReference
// ;
functionExpression: 'function' bindingIdentifier? callSignature '{' functionBody '}';
// Overrides JavaScript Rule:
// functionExpression: Function Identifier? '(' formalParameterList? ')' '{' functionBody '}';
arrowFunctionParameters
: Identifier
| callSignature
;
// Overrides JavaScript Rule:
//arrowFunctionParameters
// : Identifier
// | '(' formalParameterList? ')'
// ;
arguments
: typeArguments? '(' argumentsList?')'
;
// Overrides JavaScript Rule:
//arguments
// : '('(
// singleExpression (',' singleExpression)* (',' lastArgument)?
// | lastArgument
// )?')'
// ;
unaryExpression
: Delete singleExpression # DeleteExpression
| Void singleExpression # VoidExpression
| Typeof singleExpression # TypeofExpression
| '++' singleExpression # PreIncrementExpression
| '--' singleExpression # PreDecreaseExpression
| '+' singleExpression # UnaryPlusExpression
| '-' singleExpression # UnaryMinusExpression
| '~' singleExpression # BitNotExpression
| '!' singleExpression # NotExpression
| '<' type '>' singleExpression # TypeCastExpression //Added to original expression //note: typescript spec says ('<' type '>' unaryExpression), but imported JavaScript grammar handles this different.
;
//
// A.3 Statements
//
declaration
: hoistableDeclaration
| classDeclaration
| lexicalDeclaration
| interfaceDeclaration // Added to original expression TODO unit test
| typeAliasDeclaration // Added to original expression
| enumDeclaration // Added to original expression TODO unit test
;
variableDeclaration
: simpleVariableDeclaration
| destructuringVariableDeclaration
;
simpleVariableDeclaration: bindingIdentifier typeAnnotation? initializer? ;
destructuringVariableDeclaration: bindingPattern typeAnnotation? initializer ; //initializer not optional!
// Overrides JavaScript Rule:
// variableDeclaration
// : (Identifier | arrayLiteral | objectLiteral) ('=' singleExpression)? // ECMAScript 6: Array & Object Matching
// ;
lexicalBinding //TODO unit test / not sure how this rule can ever be reached from scriptbody?!
: simpleLexicalBinding
| destructuringLexicalBinding
;
simpleLexicalBinding: bindingIdentifier typeAnnotation? initializer? ;
destructuringLexicalBinding: bindingPattern typeAnnotation? initializer? ; //initializer IS optional!
// Overrides JavaScript Rule:
//lexicalBinding
// : bindingIdentifier initializer?
// | bindingPattern initializer?
// ;
//
// A.4 Functions
//
functionDeclaration
: 'function' bindingIdentifier? callSignature '{' functionBody '}'
| 'function' bindingIdentifier? callSignature ';'
;
// Overrides JavaScript Rule:
//functionDeclaration: Function Identifier '(' formalParameterList? ')' '{' functionBody '}' ;
//
// A.5 Interfaces
//
interfaceDeclaration: 'interface' bindingIdentifier typeParameters? interfaceExtendsClause? objectType;
interfaceExtendsClause: 'extends' classOrInterfaceTypeList;
classOrInterfaceTypeList: classOrInterfaceType (',' classOrInterfaceType)* ;
classOrInterfaceType: typeReference;
//
// A.6 Classes TODO unit tests
//
// - Class Declaration (the 'head' / 'outer frame' of the class)
//classDeclaration: 'class' bindingIdentifier? typeParameters? classHeritage '{' classBody '}';
//decoratorList added for "Ext.2 Decorators"
classDeclaration: decoratorList? 'class' bindingIdentifier? typeParameters? classHeritage '{' classBody '}';
// Overrides JavaScript Rule:
//classDeclaration
// : Class Identifier classTail
// ;
classHeritage: classExtendsClause? implementsClause?;
// Overrides JavaScript Rule:
//classHeritage: Extends singleExpression;
classExtendsClause: 'extends' classType;
classType: typeReference;
implementsClause: 'implements' classOrInterfaceTypeList;
// - Class Elements (the elements inside the body of a class)
classElement
: constructorDeclaration
| propertyMemberDeclaration
| indexMemberDeclaration
;
// Overrides JavaScript Rule:
// classElement
// : Static? methodDefinition
// ;
// - Class Elements - constructors:
constructorDeclaration : accessibilityModifier? 'constructor' '(' parameterList? ')' ('{' functionBody '}')? ;
// - Class Elements - propertiy members:
propertyMemberDeclaration
: memberVariableDeclaration
| memberFunctionDeclaration
| memberAccessorDeclaration
;
memberVariableDeclaration: accessibilityModifier? 'static'? propertyName typeAnnotation? initializer? ';';
memberFunctionDeclaration: accessibilityModifier? propertyName callSignature ('{' functionBody '}')? ;
memberAccessorDeclaration: accessibilityModifier? 'static'? (getAccessor | setAccessor);
// - Class Elements - index members:
indexMemberDeclaration: indexSignature ';';
//
// A.7 Enums TODO unit tests
//
enumDeclaration: 'const'? 'enum' bindingIdentifier '{' enumBody? '}';
enumBody: enumMember (',' enumMember)* ','? ;
enumMember: propertyName ('=' enumValue)? ;
enumValue: '=' singleExpression; //actually " '=' assignmentExpression "
//
// A.8 Namespaces TODO unit tests
//
namespaceDeclaration: 'namespace' identifierPath '{' namespaceBody '}';
identifierPath: (bindingIdentifier '.')* bindingIdentifier;
namespaceBody: namespaceElements? ;
namespaceElements: namespaceElement+ ;
namespaceElement
: statement
| lexicalDeclaration
| functionDeclaration
| generatorDeclaration
| classDeclaration
| interfaceDeclaration
| typeAliasDeclaration
| enumDeclaration
| namespaceDeclaration
//TODO | ambientDeclaration
| importAliasDeclaration
| exportNamespaceElement
;
exportNamespaceElement
: 'export' variableStatement
| 'export' lexicalDeclaration
| 'export' functionDeclaration
| 'export' generatorDeclaration
| 'export' classDeclaration
| 'export' interfaceDeclaration
| 'export' typeAliasDeclaration
| 'export' enumDeclaration
| 'export' namespaceDeclaration
//TODO | 'export' ambientDeclaration
| 'export' importAliasDeclaration
;
importAliasDeclaration: 'import' bindingIdentifier '=' entityName ';' ;
entityName : namespaceName ('.' identifierReference)?;
//
// A.9 Scripts and Modules TODO unit tests
//
// - Source File Types:
sourceFile: implementationSourceFile | declarationSourceFile;
implementationSourceFile: implementationScript | implementationModule;
declarationSourceFile: declarationScript | declarationModule;
// - implementation scripts:
implementationScript: implementationScriptElement* ;
implementationScriptElement
: implementationElement
//TODO | ambientModuleDeclaration
;
implementationElement
: /*statement -> pushing this to bottom as workaround
| */lexicalDeclaration
| functionDeclaration
| generatorDeclaration
| classDeclaration
| interfaceDeclaration
| typeAliasDeclaration
| enumDeclaration
| namespaceDeclaration
//TODO| ambientDeclaration
| importAliasDeclaration
| statement //see comment on above first alternative -^
;
// - declaration scripts:
declarationScript: declarationScriptElement* ;
declarationScriptElement
: declarationElement
//TODO| ambientModuleDeclaration
;
declarationElement
: interfaceDeclaration
| typeAliasDeclaration
| namespaceDeclaration
//TODO | ambientDeclaration
| importAliasDeclaration
;
// - implementation module:
implementationModule: implementationModuleElement* ;
implementationModuleElement
: implementationElement
| importDeclaration
| importAliasDeclaration
| importRequireDeclaration
| exportImplementationElement
| exportDefaultImplementationElement
| exportListDeclaration
| exportAssignment
;
// - implementation module:
declarationModule: declarationModuleElement* ;
declarationModuleElement
: declarationElement
| importDeclaration
| importAliasDeclaration
| exportDeclarationElement
| exportDefaultDeclarationElement
| exportListDeclaration
| exportAssignment
;
// - details of alternatives for implementation / declarationModuleElement
importRequireDeclaration: 'import' bindingIdentifier '=' 'require' '(' StringLiteral ')' ';' ;
exportImplementationElement
: 'export' variableStatement
| 'export' lexicalDeclaration
| 'export' functionDeclaration
| 'export' generatorDeclaration
| decoratorList? 'export' classDeclaration // decoratorList added for Ext.2
| 'export' interfaceDeclaration
| 'export' typeAliasDeclaration
| 'export' enumDeclaration
| 'export' namespaceDeclaration
//TODO | 'export' ambientDeclaration
| 'export' importAliasDeclaration
;
exportDeclarationElement
: 'export' interfaceDeclaration
| 'export' typeAliasDeclaration
//TODO| 'export' ambientDeclaration
| 'export' importAliasDeclaration
;
exportDefaultImplementationElement
: 'export' 'default' functionDeclaration
| 'export' 'default' generatorDeclaration
| 'export' 'default' classDeclaration
| 'export' 'default' '=' singleExpression ';' //actually: assignmentexpression
;
exportDefaultDeclarationElement
://TODO 'export' 'default' ambientFunctionDeclaration
//TODO| 'export' 'default' ambientClassDeclaration
/*TODO|*/ 'export' 'default' identifierReference ';'
;
exportListDeclaration
: 'export' '*' fromClause ';'
| 'export' exportClause fromClause ';'
| 'export' exportClause ';'
;
exportAssignment: 'export' '=' identifierReference ';' ;
//
// A.10 Ambients TODO unit tests
//
ambientDeclaration
: 'declare' ambientVariableDeclaration
| 'declare' ambientFunctionDeclaration
| 'declare' ambientClassDeclaration
| 'declare' ambientEnumDeclaration
| 'declare' ambientNamespaceDeclaration
;
ambientVariableDeclaration
: 'var' ambientBindingList ';'
| 'let' ambientBindingList ';'
| 'const' ambientBindingList ';'
;
ambientBindingList: ambientBinding+ ;
ambientBinding : bindingIdentifier typeAnnotation? ;
ambientFunctionDeclaration : 'function' bindingIdentifier callSignature ';' ;
ambientClassDeclaration : 'class' bindingIdentifier typeParameters? classHeritage '{' ambientClassBody '}';
ambientClassBody: ambientClassBodyElement* ;
ambientClassBodyElement
: ambientConstructorDeclaration
| ambientPropertyMemberDeclaration
| indexSignature
;
ambientConstructorDeclaration: 'constructor' '(' parameterList? ')' ';' ;
ambientPropertyMemberDeclaration: accessibilityModifier? 'static'? propertyName (typeAnnotation | callSignature)? ';' ;
ambientEnumDeclaration: enumDeclaration;
ambientNamespaceDeclaration: 'namespace' identifierPath '{' ambientNamespaceBody '}' ;
ambientNamespaceBody: ambientNamespaceElement* ;
ambientNamespaceElement
: 'export'? ambientVariableDeclaration
//| 'export'? ambientLexicalDeclaration - see https://github.com/Microsoft/TypeScript/issues/14534
| 'export'? ambientFunctionDeclaration
| 'export'? ambientClassDeclaration
| 'export'? interfaceDeclaration
| 'export'? ambientEnumDeclaration
| 'export'? ambientNamespaceDeclaration
| 'export'? importAliasDeclaration
;
ambientModuleDeclaration: 'declare' 'module' StringLiteral '{' declarationModule '}' ;
//
// Ext.1 Workarounds caused by non-standard JavaScript Grammar:
//
/* The following additions are not part of the TypeScript 1.8 spec,
* but I needed to add them to make the parser work as expected.
*/
//Problem: in "new Foo<T1>(...);" the '<' is interpreted as relational operator. Actually it should be the typeArguments of the 'arguments' rule.
newExpression
: 'new' identifierReference arguments?
| 'new' singleExpression arguments?;
//Problem: in "foo<T1>(...);" the '<' is interpreted as relational operator. Actually it should be the typeArguments of the 'arguments' rule.
//
// Ext.2 Additions to 1.8: Decorators
//
/* https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Decorators.md:
* "A Decorator is a special kind of declaration that can be attached to a
* class declaration, method, accessor, property, or parameter."
*/
/* First try: using the grammar of the official ecmascript proposal: https://tc39.github.io/proposal-decorators/ */
decoratorList: decorator+ ; //TODO unit test
decorator: '@' (decoratorMemberExpression | decoratorCallExpression);
decoratorMemberExpression
: identifierReference
| decoratorMemberExpression '.' identifierName
| '(' singleExpression ')' //actually: 'expression', not singleexpression
;
decoratorCallExpression: decoratorMemberExpression arguments;
|
programs/oeis/211/A211617.asm | jmorken/loda | 1 | 160073 | ; A211617: Number of ordered triples (w,x,y) with all terms in {-n,...-1,1,...,n} and 2w+x+y>0.
; 0,3,30,101,244,479,834,1329,1992,2843,3910,5213,6780,8631,10794,13289,16144,19379,23022,27093,31620,36623,42130,48161,54744,61899,69654,78029,87052,96743,107130,118233,130080,142691,156094,170309,185364,201279,218082,235793,254440,274043,294630,316221,338844,362519,387274,413129,440112,468243,497550,528053,559780,592751,626994,662529,699384,737579,777142,818093,860460,904263,949530,996281,1044544,1094339,1145694,1198629,1253172,1309343,1367170,1426673,1487880,1550811,1615494,1681949,1750204,1820279,1892202,1965993,2041680,2119283,2198830,2280341,2363844,2449359,2536914,2626529,2718232,2812043,2907990,3006093,3106380,3208871,3313594,3420569,3529824,3641379,3755262,3871493,3990100,4111103,4234530,4360401,4488744,4619579,4752934,4888829,5027292,5168343,5312010,5458313,5607280,5758931,5913294,6070389,6230244,6392879,6558322,6726593,6897720,7071723,7248630,7428461,7611244,7796999,7985754,8177529,8372352,8570243,8771230,8975333,9182580,9392991,9606594,9823409,10043464,10266779,10493382,10723293,10956540,11193143,11433130,11676521,11923344,12173619,12427374,12684629,12945412,13209743,13477650,13749153,14024280,14303051,14585494,14871629,15161484,15455079,15752442,16053593,16358560,16667363,16980030,17296581,17617044,17941439,18269794,18602129,18938472,19278843,19623270,19971773,20324380,20681111,21041994,21407049,21776304,22149779,22527502,22909493,23295780,23686383,24081330,24480641,24884344,25292459,25705014,26122029,26543532,26969543,27400090,27835193,28274880,28719171,29168094,29621669,30079924,30542879,31010562,31482993,31960200,32442203,32929030,33420701,33917244,34418679,34925034,35436329,35952592,36473843,37000110,37531413,38067780,38609231,39155794,39707489,40264344,40826379,41393622,41966093,42543820,43126823,43715130,44308761,44907744,45512099,46121854,46737029,47357652,47983743,48615330,49252433,49895080,50543291,51197094,51856509,52521564,53192279,53868682,54550793,55238640,55932243,56631630,57336821,58047844,58764719,59487474,60216129,60950712,61691243
mov $3,$0
mov $4,$0
pow $0,2
lpb $0
sub $0,1
trn $0,1
sub $3,2
lpe
mov $1,$3
mov $2,$4
mul $2,$4
mul $2,$4
mov $5,$2
mul $5,4
add $1,$5
|
tools/files/applib/src/64bit/sdepack.asm | nehalem501/gendev | 2,662 | 9510 | ;;
;; aPLib compression library - the smaller the better :)
;;
;; fasm 64-bit safe assembler wrapper for aP_depack_asm_safe
;;
;; Copyright (c) 1998-2014 <NAME>
;; All Rights Reserved
;;
;; http://www.ibsensoftware.com/
;;
format MS64 COFF
public aPsafe_depack
extrn aP_depack_asm_safe
extrn aP_crc32
; =============================================================
section '.text' code readable executable
aPsafe_depack:
; aPsafe_depack(const void *source,
; size_t srclen,
; void *destination
; size_t dstlen)
mov [rsp + 8], rcx
mov [rsp + 16], rdx
mov [rsp + 24], r8
mov [rsp + 32], r9
push rdi
sub rsp, 32
mov rdi, rcx ; rdi -> source
test rcx, rcx
jz .return_error
test r8, r8
jz .return_error
cmp rdx, 24 ; check srclen >= 24
jb .return_error ;
mov eax, [rdi] ; eax = header.tag
cmp eax, 032335041h ; check tag == 'AP32'
jne .return_error
mov eax, [rdi + 4] ; rax = header.header_size
cmp eax, 24 ; check header_size >= 24
jb .return_error
sub rdx, rax ; rdx = srclen without header
jc .return_error ;
cmp [rdi + 8], edx ; check header.packed_size is
ja .return_error ; within remaining srclen
add rcx, rax ; rcx -> packed data
mov edx, [rdi + 8] ; rdx = header.packed_size
call aP_crc32
cmp eax, [rdi + 12] ; check eax == header.packed_crc
jne .return_error
mov r9, [rsp + 72] ; r9 = dstlen
mov edx, [rdi + 16] ; rdx = header.orig_size
cmp rdx, r9 ; check header.orig_size is ok
ja .return_error
mov eax, [rdi + 4] ; rax = header.header_size
mov rcx, [rsp + 48] ; rcx -> source
mov edx, [rdi + 8] ; rdx = header.packed_size
mov r8, [rsp + 64] ; r8 -> destination
add rcx, rax ; rcx -> compressed data
call aP_depack_asm_safe
mov edx, [rdi + 16] ; rdx = header.orig_size
cmp rax, rdx ; check rax == header.orig_size
jne .return_error
mov rcx, [rsp + 64] ; rcx -> destination
call aP_crc32
cmp eax, [rdi + 20] ; check eax = header.orig_crc
mov eax, [rdi + 16] ; rax = header.orig_size
je .return_rax
.return_error:
or rax, -1 ; rax = -1
.return_rax:
add rsp, 32
pop rdi
ret
; =============================================================
|
tests/covered/E.agda | andrejtokarcik/agda-semantics | 3 | 4139 | <filename>tests/covered/E.agda
module E where
t : Set -> Set
t x = x
|
Terminal Status Bar App/open_terminal_tab.applescript | allen-garvey/open-in-terminal-tab-app | 1 | 513 | try
tell application "Finder" to set current_directory to quoted form of POSIX path of (target of window 1 as alias)
tell application "Terminal"
activate
-- based on http://apple.stackexchange.com/questions/15317/how-can-i-write-a-script-to-open-multiple-terminal-tabs-and-execute-code-in-them
-- Get a window that's not busy.
if (count of windows) is greater than 0 then
repeat with currentWindow in windows
if currentWindow is not busy then
set targetWindow to currentWindow
end if
end repeat
end if
--if Terminal is currently open, open new tab
-- Open a new tab.
set terminalCommand to "cd " & current_directory
try
get targetWindow
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script terminalCommand in targetWindow
on error
do script terminalCommand
end try
end tell
on error
beep
end try
return input |
src/natools-s_expressions.ads | faelys/natools | 0 | 21910 | ------------------------------------------------------------------------------
-- Copyright (c) 2013-2014, <NAME> --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Natools.S_Expression declare basic types used in all children packages --
-- dealing with S-expressions. --
-- --
-- S-expressions here are defined as a half serialization mechanism, using --
-- standard syntax from http://people.csail.mit.edu/rivest/Sexp.txt --
-- --
-- Briefly, "atoms" are defined as a sequence of octets of any length, and --
-- "lists" are defined as a sequence of items, each of which being either --
-- an atom or another list. A S-expression is a sequence of octets that --
-- represents such a list. --
-- --
-- So atoms are unstructured blob of data, supposed to be the serialization --
-- of some lower-level object (e.g. a string), and they are structured as --
-- leaves in a tree. --
-- --
-- All S-expression code here assume that Stream_Element is actually an --
-- 8-bit byte. So Octet, Atom and related types are derived from --
-- Ada.Streams entries. --
------------------------------------------------------------------------------
with Ada.Streams;
package Natools.S_Expressions is
pragma Pure (Natools.S_Expressions);
-----------------
-- Basic Types --
-----------------
subtype Octet is Ada.Streams.Stream_Element;
subtype Offset is Ada.Streams.Stream_Element_Offset;
subtype Count is Ada.Streams.Stream_Element_Count;
subtype Atom is Ada.Streams.Stream_Element_Array;
Null_Atom : constant Atom (1 .. 0) := (others => <>);
function To_String (Data : in Atom) return String;
function To_Atom (Data : in String) return Atom;
function "=" (Left, Right : Atom) return Boolean
renames Ada.Streams."=";
function "<" (Left, Right : Atom) return Boolean
renames Ada.Streams."<";
function Less_Than (Left, Right : Atom) return Boolean;
-----------------------------
-- S-expression Descriptor --
-----------------------------
package Events is
type Event is
(Error,
Open_List,
Close_List,
Add_Atom,
End_Of_Input);
end Events;
type Descriptor is limited interface;
-- Descriptor interface can be implemented by objects that can
-- describe a S-expression to its holder, using an event-driven
-- interface. The current event reports error conditions, or whether
-- a beginning or end of list encountered, or whether a new atom is
-- available.
function Current_Event (Object : in Descriptor) return Events.Event
is abstract;
-- Return the current event in Object
function Current_Atom (Object : in Descriptor) return Atom is abstract;
-- Return the current atom in an Object whose state is Add_Atom
function Current_Level (Object : in Descriptor) return Natural is abstract;
-- Return the number of nested lists currently opened
procedure Query_Atom
(Object : in Descriptor;
Process : not null access procedure (Data : in Atom)) is abstract;
-- Read-in-place callback for the current atom in Object.
-- Must only be called when current event in Object is Add_Event.
procedure Read_Atom
(Object : in Descriptor;
Data : out Atom;
Length : out Count) is abstract;
-- Copy the current atom in Object to Data.
-- Must only be called when current event in Object is Add_Event.
procedure Next
(Object : in out Descriptor;
Event : out Events.Event) is abstract;
-- Update Object to reflect the next event in the S-expression
procedure Next (Object : in out Descriptor'Class);
-- Call Next discarding current event
procedure Close_Current_List (Object : in out Descriptor'Class);
-- Repeatedly call Next until reaching end-of-input or the Close_List
-- event matching the current list.
-- Note: if current event is Open_List, then this is the designated list
-- while for other events, including Close_List, the designated list
-- contains the current object or the just-closed list.
private
use type Ada.Streams.Stream_Element;
use type Ada.Streams.Stream_Element_Offset;
use type Ada.Streams.Stream_Element_Array;
use type Events.Event;
end Natools.S_Expressions;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_231.asm | ljhsiun2/medusa | 9 | 95154 | <filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_231.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x106a9, %r10
nop
and $56128, %rbx
mov $0x6162636465666768, %r13
movq %r13, (%r10)
nop
nop
nop
nop
nop
and %rdx, %rdx
lea addresses_normal_ht+0xa3c9, %rbx
xor %r15, %r15
mov (%rbx), %bp
nop
nop
dec %rbp
lea addresses_D_ht+0x1d6b9, %rsi
lea addresses_WC_ht+0x133f9, %rdi
nop
nop
nop
inc %rbp
mov $84, %rcx
rep movsb
nop
dec %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r15
push %r9
push %rax
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_WC+0x1de79, %rsi
lea addresses_normal+0x1c079, %rdi
nop
nop
nop
nop
and %r9, %r9
mov $54, %rcx
rep movsl
nop
nop
nop
nop
add $47081, %r11
// REPMOV
lea addresses_A+0x2e39, %rsi
lea addresses_WC+0x549, %rdi
sub $3400, %r15
mov $85, %rcx
rep movsb
nop
cmp %rax, %rax
// Faulty Load
lea addresses_WC+0x1de79, %rax
nop
add %rdi, %rdi
movb (%rax), %cl
lea oracles, %r15
and $0xff, %rcx
shlq $12, %rcx
mov (%r15,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WC', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC', 'congruent': 0, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal', 'congruent': 9, 'same': False}}
{'src': {'type': 'addresses_A', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC', 'congruent': 3, 'same': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WC', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 4, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': True}}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
mpmclab/week 1/apj3.asm | apurvjain9999/Microprocessor-8085 | 0 | 178632 | LDA 5000H
MOV B,A
LDA 5002H
ADD B
MOV C,A
SUB B
MOV B,A
MOV A,C
SUB B
STA 5002H
MOV A,B
STA 5000H
hlt |
oeis/131/A131473.asm | neoneye/loda-programs | 11 | 90703 | <reponame>neoneye/loda-programs<filename>oeis/131/A131473.asm
; A131473: a(n) = n^6 - n.
; 0,0,62,726,4092,15620,46650,117642,262136,531432,999990,1771550,2985972,4826796,7529522,11390610,16777200,24137552,34012206,47045862,63999980,85766100,113379882,148035866,191102952,244140600,308915750,387420462,481890276,594823292,728999970,887503650,1073741792,1291467936,1544804382,1838265590,2176782300,2565726372,3010936346,3518743722,4095999960,4750104200,5489031702,6321363006,7256313812,8303765580,9474296850,10779215282,12230590416,13841287152,15624999950,17596287750,19770609612,22164361076
mov $1,$0
pow $0,6
sub $0,$1
|
kv-avm-warrants.ads | davidkristola/vole | 4 | 5404 | with Ada.Finalization;
with kv.avm.Control;
limited with kv.avm.Instances;
package kv.avm.Warrants is
type Warrant_Type is new Ada.Finalization.Controlled with private;
overriding procedure Initialize (Self : in out Warrant_Type);
overriding procedure Adjust (Self : in out Warrant_Type);
overriding procedure Finalize (Self : in out Warrant_Type);
procedure Initialize
(Self : in out Warrant_Type;
Machine : in kv.avm.Control.Control_Access;
Instance : access kv.avm.Instances.Instance_Type);
private
type Warrant_Type is new Ada.Finalization.Controlled with
record
Machine : kv.avm.Control.Control_Access;
Instance : access kv.avm.Instances.Instance_Type;
end record;
end kv.avm.Warrants;
|
kernel.asm | jakiki6/simpleOS | 5 | 87800 | <reponame>jakiki6/simpleOS
org 0x0000
start:
call setup_check
call setup_handler
call setup_sched
call setup_threads
call setup_drivers
mov si, strings.welcome
call print_string
call panic
%include "lib.asm"
%include "sched.asm"
%include "check.asm"
%include "handler.asm"
%include "threads.asm"
%include "drivers.asm"
%include "strings.asm"
times 65536 - ($ - $$) nop
|
test/Fail/Issue2944.agda | cruhland/agda | 1,989 | 3431 | <gh_stars>1000+
module _ where
open import Agda.Primitive
open import Agda.Builtin.List
open import Agda.Builtin.Nat hiding (_==_)
open import Agda.Builtin.Equality
open import Agda.Builtin.Unit
open import Agda.Builtin.Bool
infix -1 _,_
record _×_ {a b} (A : Set a) (B : Set b) : Set (a ⊔ b) where
constructor _,_
field fst : A
snd : B
open _×_
data Constraint : Set₁ where
mkConstraint : {A : Set} (x y : A) → x ≡ y → Constraint
infix 0 _==_
pattern _==_ x y = mkConstraint x y refl
T : Bool → Set
T false = Nat
T true = Nat → Nat
bla : (Nat → Nat) → Nat → Nat
bla f zero = zero
bla f = f -- underapplied clause!
pred : Nat → Nat
pred zero = zero
pred (suc n) = n
-- 0 and 1 are both solutions, so should not be solved.
bad! : Constraint
bad! = bla pred _ == zero
-- Should not fail, since 2 is a solution!
more-bad! : Constraint
more-bad! = bla pred _ == 1
-- Same thing for projections
blabla : Nat → Nat × Nat
blabla zero = 1 , 1
blabla (suc n) = 0 , n
-- Don't fail: 0 is a valid solution
oops : Constraint
oops = fst (blabla _) == 1
bla₂ : Bool → Nat × Nat
bla₂ false = 0 , 1
bla₂ true .fst = 0
bla₂ true .snd = 1
-- Don't solve: false and true are both solutions
wrong : Constraint
wrong = bla₂ _ .fst == 0
|
prototyping/Properties/TypeNormalization.agda | Libertus-Lab/luau | 1 | 8513 | {-# OPTIONS --rewriting #-}
module Properties.TypeNormalization where
open import Luau.Type using (Type; Scalar; nil; number; string; boolean; never; unknown; _⇒_; _∪_; _∩_)
open import Luau.Subtyping using (Tree; Language; ¬Language; function; scalar; unknown; left; right; function-ok₁; function-ok₂; function-err; function-tgt; scalar-function; scalar-function-ok; scalar-function-err; scalar-function-tgt; function-scalar; _,_)
open import Luau.TypeNormalization using (_∪ⁿ_; _∩ⁿ_; _∪ᶠ_; _∪ⁿˢ_; _∩ⁿˢ_; normalize)
open import Luau.Subtyping using (_<:_; _≮:_; witness; never)
open import Properties.Subtyping using (<:-trans; <:-refl; <:-unknown; <:-never; <:-∪-left; <:-∪-right; <:-∪-lub; <:-∩-left; <:-∩-right; <:-∩-glb; <:-∩-symm; <:-function; <:-function-∪-∩; <:-function-∩-∪; <:-function-∪; <:-everything; <:-union; <:-∪-assocl; <:-∪-assocr; <:-∪-symm; <:-intersect; ∪-distl-∩-<:; ∪-distr-∩-<:; <:-∪-distr-∩; <:-∪-distl-∩; ∩-distl-∪-<:; <:-∩-distl-∪; <:-∩-distr-∪; scalar-∩-function-<:-never; scalar-≢-∩-<:-never)
-- Normal forms for types
data FunType : Type → Set
data Normal : Type → Set
data FunType where
_⇒_ : ∀ {S T} → Normal S → Normal T → FunType (S ⇒ T)
_∩_ : ∀ {F G} → FunType F → FunType G → FunType (F ∩ G)
data Normal where
_⇒_ : ∀ {S T} → Normal S → Normal T → Normal (S ⇒ T)
_∩_ : ∀ {F G} → FunType F → FunType G → Normal (F ∩ G)
_∪_ : ∀ {S T} → Normal S → Scalar T → Normal (S ∪ T)
never : Normal never
unknown : Normal unknown
data OptScalar : Type → Set where
never : OptScalar never
number : OptScalar number
boolean : OptScalar boolean
string : OptScalar string
nil : OptScalar nil
-- Top function type
fun-top : ∀ {F} → (FunType F) → (F <: (never ⇒ unknown))
fun-top (S ⇒ T) = <:-function <:-never <:-unknown
fun-top (F ∩ G) = <:-trans <:-∩-left (fun-top F)
-- function types are inhabited
fun-function : ∀ {F} → FunType F → Language F function
fun-function (S ⇒ T) = function
fun-function (F ∩ G) = (fun-function F , fun-function G)
fun-≮:-never : ∀ {F} → FunType F → (F ≮: never)
fun-≮:-never F = witness function (fun-function F) never
-- function types aren't scalars
fun-¬scalar : ∀ {F S t} → (s : Scalar S) → FunType F → Language F t → ¬Language S t
fun-¬scalar s (S ⇒ T) function = scalar-function s
fun-¬scalar s (S ⇒ T) (function-ok₁ p) = scalar-function-ok s
fun-¬scalar s (S ⇒ T) (function-ok₂ p) = scalar-function-ok s
fun-¬scalar s (S ⇒ T) (function-err p) = scalar-function-err s
fun-¬scalar s (S ⇒ T) (function-tgt p) = scalar-function-tgt s
fun-¬scalar s (F ∩ G) (p₁ , p₂) = fun-¬scalar s G p₂
¬scalar-fun : ∀ {F S} → FunType F → (s : Scalar S) → ¬Language F (scalar s)
¬scalar-fun (S ⇒ T) s = function-scalar s
¬scalar-fun (F ∩ G) s = left (¬scalar-fun F s)
scalar-≮:-fun : ∀ {F S} → FunType F → Scalar S → S ≮: F
scalar-≮:-fun F s = witness (scalar s) (scalar s) (¬scalar-fun F s)
unknown-≮:-fun : ∀ {F} → FunType F → unknown ≮: F
unknown-≮:-fun F = witness (scalar nil) unknown (¬scalar-fun F nil)
-- Normalization produces normal types
normal : ∀ T → Normal (normalize T)
normalᶠ : ∀ {F} → FunType F → Normal F
normal-∪ⁿ : ∀ {S T} → Normal S → Normal T → Normal (S ∪ⁿ T)
normal-∩ⁿ : ∀ {S T} → Normal S → Normal T → Normal (S ∩ⁿ T)
normal-∪ⁿˢ : ∀ {S T} → Normal S → OptScalar T → Normal (S ∪ⁿˢ T)
normal-∩ⁿˢ : ∀ {S T} → Normal S → Scalar T → OptScalar (S ∩ⁿˢ T)
normal-∪ᶠ : ∀ {F G} → FunType F → FunType G → FunType (F ∪ᶠ G)
normal nil = never ∪ nil
normal (S ⇒ T) = (normal S) ⇒ (normal T)
normal never = never
normal unknown = unknown
normal boolean = never ∪ boolean
normal number = never ∪ number
normal string = never ∪ string
normal (S ∪ T) = normal-∪ⁿ (normal S) (normal T)
normal (S ∩ T) = normal-∩ⁿ (normal S) (normal T)
normalᶠ (S ⇒ T) = S ⇒ T
normalᶠ (F ∩ G) = F ∩ G
normal-∪ⁿ S (T₁ ∪ T₂) = (normal-∪ⁿ S T₁) ∪ T₂
normal-∪ⁿ S never = S
normal-∪ⁿ S unknown = unknown
normal-∪ⁿ never (T ⇒ U) = T ⇒ U
normal-∪ⁿ never (G₁ ∩ G₂) = G₁ ∩ G₂
normal-∪ⁿ unknown (T ⇒ U) = unknown
normal-∪ⁿ unknown (G₁ ∩ G₂) = unknown
normal-∪ⁿ (R ⇒ S) (T ⇒ U) = normalᶠ (normal-∪ᶠ (R ⇒ S) (T ⇒ U))
normal-∪ⁿ (R ⇒ S) (G₁ ∩ G₂) = normalᶠ (normal-∪ᶠ (R ⇒ S) (G₁ ∩ G₂))
normal-∪ⁿ (F₁ ∩ F₂) (T ⇒ U) = normalᶠ (normal-∪ᶠ (F₁ ∩ F₂) (T ⇒ U))
normal-∪ⁿ (F₁ ∩ F₂) (G₁ ∩ G₂) = normalᶠ (normal-∪ᶠ (F₁ ∩ F₂) (G₁ ∩ G₂))
normal-∪ⁿ (S₁ ∪ S₂) (T₁ ⇒ T₂) = normal-∪ⁿ S₁ (T₁ ⇒ T₂) ∪ S₂
normal-∪ⁿ (S₁ ∪ S₂) (G₁ ∩ G₂) = normal-∪ⁿ S₁ (G₁ ∩ G₂) ∪ S₂
normal-∩ⁿ S never = never
normal-∩ⁿ S unknown = S
normal-∩ⁿ S (T ∪ U) = normal-∪ⁿˢ (normal-∩ⁿ S T) (normal-∩ⁿˢ S U )
normal-∩ⁿ never (T ⇒ U) = never
normal-∩ⁿ unknown (T ⇒ U) = T ⇒ U
normal-∩ⁿ (R ⇒ S) (T ⇒ U) = (R ⇒ S) ∩ (T ⇒ U)
normal-∩ⁿ (R ∩ S) (T ⇒ U) = (R ∩ S) ∩ (T ⇒ U)
normal-∩ⁿ (R ∪ S) (T ⇒ U) = normal-∩ⁿ R (T ⇒ U)
normal-∩ⁿ never (T ∩ U) = never
normal-∩ⁿ unknown (T ∩ U) = T ∩ U
normal-∩ⁿ (R ⇒ S) (T ∩ U) = (R ⇒ S) ∩ (T ∩ U)
normal-∩ⁿ (R ∩ S) (T ∩ U) = (R ∩ S) ∩ (T ∩ U)
normal-∩ⁿ (R ∪ S) (T ∩ U) = normal-∩ⁿ R (T ∩ U)
normal-∪ⁿˢ S never = S
normal-∪ⁿˢ never number = never ∪ number
normal-∪ⁿˢ unknown number = unknown
normal-∪ⁿˢ (R ⇒ S) number = (R ⇒ S) ∪ number
normal-∪ⁿˢ (R ∩ S) number = (R ∩ S) ∪ number
normal-∪ⁿˢ (R ∪ number) number = R ∪ number
normal-∪ⁿˢ (R ∪ boolean) number = normal-∪ⁿˢ R number ∪ boolean
normal-∪ⁿˢ (R ∪ string) number = normal-∪ⁿˢ R number ∪ string
normal-∪ⁿˢ (R ∪ nil) number = normal-∪ⁿˢ R number ∪ nil
normal-∪ⁿˢ never boolean = never ∪ boolean
normal-∪ⁿˢ unknown boolean = unknown
normal-∪ⁿˢ (R ⇒ S) boolean = (R ⇒ S) ∪ boolean
normal-∪ⁿˢ (R ∩ S) boolean = (R ∩ S) ∪ boolean
normal-∪ⁿˢ (R ∪ number) boolean = normal-∪ⁿˢ R boolean ∪ number
normal-∪ⁿˢ (R ∪ boolean) boolean = R ∪ boolean
normal-∪ⁿˢ (R ∪ string) boolean = normal-∪ⁿˢ R boolean ∪ string
normal-∪ⁿˢ (R ∪ nil) boolean = normal-∪ⁿˢ R boolean ∪ nil
normal-∪ⁿˢ never string = never ∪ string
normal-∪ⁿˢ unknown string = unknown
normal-∪ⁿˢ (R ⇒ S) string = (R ⇒ S) ∪ string
normal-∪ⁿˢ (R ∩ S) string = (R ∩ S) ∪ string
normal-∪ⁿˢ (R ∪ number) string = normal-∪ⁿˢ R string ∪ number
normal-∪ⁿˢ (R ∪ boolean) string = normal-∪ⁿˢ R string ∪ boolean
normal-∪ⁿˢ (R ∪ string) string = R ∪ string
normal-∪ⁿˢ (R ∪ nil) string = normal-∪ⁿˢ R string ∪ nil
normal-∪ⁿˢ never nil = never ∪ nil
normal-∪ⁿˢ unknown nil = unknown
normal-∪ⁿˢ (R ⇒ S) nil = (R ⇒ S) ∪ nil
normal-∪ⁿˢ (R ∩ S) nil = (R ∩ S) ∪ nil
normal-∪ⁿˢ (R ∪ number) nil = normal-∪ⁿˢ R nil ∪ number
normal-∪ⁿˢ (R ∪ boolean) nil = normal-∪ⁿˢ R nil ∪ boolean
normal-∪ⁿˢ (R ∪ string) nil = normal-∪ⁿˢ R nil ∪ string
normal-∪ⁿˢ (R ∪ nil) nil = R ∪ nil
normal-∩ⁿˢ never number = never
normal-∩ⁿˢ never boolean = never
normal-∩ⁿˢ never string = never
normal-∩ⁿˢ never nil = never
normal-∩ⁿˢ unknown number = number
normal-∩ⁿˢ unknown boolean = boolean
normal-∩ⁿˢ unknown string = string
normal-∩ⁿˢ unknown nil = nil
normal-∩ⁿˢ (R ⇒ S) number = never
normal-∩ⁿˢ (R ⇒ S) boolean = never
normal-∩ⁿˢ (R ⇒ S) string = never
normal-∩ⁿˢ (R ⇒ S) nil = never
normal-∩ⁿˢ (R ∩ S) number = never
normal-∩ⁿˢ (R ∩ S) boolean = never
normal-∩ⁿˢ (R ∩ S) string = never
normal-∩ⁿˢ (R ∩ S) nil = never
normal-∩ⁿˢ (R ∪ number) number = number
normal-∩ⁿˢ (R ∪ boolean) number = normal-∩ⁿˢ R number
normal-∩ⁿˢ (R ∪ string) number = normal-∩ⁿˢ R number
normal-∩ⁿˢ (R ∪ nil) number = normal-∩ⁿˢ R number
normal-∩ⁿˢ (R ∪ number) boolean = normal-∩ⁿˢ R boolean
normal-∩ⁿˢ (R ∪ boolean) boolean = boolean
normal-∩ⁿˢ (R ∪ string) boolean = normal-∩ⁿˢ R boolean
normal-∩ⁿˢ (R ∪ nil) boolean = normal-∩ⁿˢ R boolean
normal-∩ⁿˢ (R ∪ number) string = normal-∩ⁿˢ R string
normal-∩ⁿˢ (R ∪ boolean) string = normal-∩ⁿˢ R string
normal-∩ⁿˢ (R ∪ string) string = string
normal-∩ⁿˢ (R ∪ nil) string = normal-∩ⁿˢ R string
normal-∩ⁿˢ (R ∪ number) nil = normal-∩ⁿˢ R nil
normal-∩ⁿˢ (R ∪ boolean) nil = normal-∩ⁿˢ R nil
normal-∩ⁿˢ (R ∪ string) nil = normal-∩ⁿˢ R nil
normal-∩ⁿˢ (R ∪ nil) nil = nil
normal-∪ᶠ (R ⇒ S) (T ⇒ U) = (normal-∩ⁿ R T) ⇒ (normal-∪ⁿ S U)
normal-∪ᶠ (R ⇒ S) (G ∩ H) = normal-∪ᶠ (R ⇒ S) G ∩ normal-∪ᶠ (R ⇒ S) H
normal-∪ᶠ (E ∩ F) G = normal-∪ᶠ E G ∩ normal-∪ᶠ F G
scalar-∩-fun-<:-never : ∀ {F S} → FunType F → Scalar S → (F ∩ S) <: never
scalar-∩-fun-<:-never (T ⇒ U) S = scalar-∩-function-<:-never S
scalar-∩-fun-<:-never (F ∩ G) S = <:-trans (<:-intersect <:-∩-left <:-refl) (scalar-∩-fun-<:-never F S)
flipper : ∀ {S T U} → ((S ∪ T) ∪ U) <: ((S ∪ U) ∪ T)
flipper = <:-trans <:-∪-assocr (<:-trans (<:-union <:-refl <:-∪-symm) <:-∪-assocl)
∩-<:-∩ⁿ : ∀ {S T} → Normal S → Normal T → (S ∩ T) <: (S ∩ⁿ T)
∩ⁿ-<:-∩ : ∀ {S T} → Normal S → Normal T → (S ∩ⁿ T) <: (S ∩ T)
∩-<:-∩ⁿˢ : ∀ {S T} → Normal S → Scalar T → (S ∩ T) <: (S ∩ⁿˢ T)
∩ⁿˢ-<:-∩ : ∀ {S T} → Normal S → Scalar T → (S ∩ⁿˢ T) <: (S ∩ T)
∪ᶠ-<:-∪ : ∀ {F G} → FunType F → FunType G → (F ∪ᶠ G) <: (F ∪ G)
∪ⁿ-<:-∪ : ∀ {S T} → Normal S → Normal T → (S ∪ⁿ T) <: (S ∪ T)
∪-<:-∪ⁿ : ∀ {S T} → Normal S → Normal T → (S ∪ T) <: (S ∪ⁿ T)
∪ⁿˢ-<:-∪ : ∀ {S T} → Normal S → OptScalar T → (S ∪ⁿˢ T) <: (S ∪ T)
∪-<:-∪ⁿˢ : ∀ {S T} → Normal S → OptScalar T → (S ∪ T) <: (S ∪ⁿˢ T)
∩-<:-∩ⁿ S never = <:-∩-right
∩-<:-∩ⁿ S unknown = <:-∩-left
∩-<:-∩ⁿ S (T ∪ U) = <:-trans <:-∩-distl-∪ (<:-trans (<:-union (∩-<:-∩ⁿ S T) (∩-<:-∩ⁿˢ S U)) (∪-<:-∪ⁿˢ (normal-∩ⁿ S T) (normal-∩ⁿˢ S U)) )
∩-<:-∩ⁿ never (T ⇒ U) = <:-∩-left
∩-<:-∩ⁿ unknown (T ⇒ U) = <:-∩-right
∩-<:-∩ⁿ (R ⇒ S) (T ⇒ U) = <:-refl
∩-<:-∩ⁿ (R ∩ S) (T ⇒ U) = <:-refl
∩-<:-∩ⁿ (R ∪ S) (T ⇒ U) = <:-trans <:-∩-distr-∪ (<:-trans (<:-union (∩-<:-∩ⁿ R (T ⇒ U)) (<:-trans <:-∩-symm (∩-<:-∩ⁿˢ (T ⇒ U) S))) (<:-∪-lub <:-refl <:-never))
∩-<:-∩ⁿ never (T ∩ U) = <:-∩-left
∩-<:-∩ⁿ unknown (T ∩ U) = <:-∩-right
∩-<:-∩ⁿ (R ⇒ S) (T ∩ U) = <:-refl
∩-<:-∩ⁿ (R ∩ S) (T ∩ U) = <:-refl
∩-<:-∩ⁿ (R ∪ S) (T ∩ U) = <:-trans <:-∩-distr-∪ (<:-trans (<:-union (∩-<:-∩ⁿ R (T ∩ U)) (<:-trans <:-∩-symm (∩-<:-∩ⁿˢ (T ∩ U) S))) (<:-∪-lub <:-refl <:-never))
∩ⁿ-<:-∩ S never = <:-never
∩ⁿ-<:-∩ S unknown = <:-∩-glb <:-refl <:-unknown
∩ⁿ-<:-∩ S (T ∪ U) = <:-trans (∪ⁿˢ-<:-∪ (normal-∩ⁿ S T) (normal-∩ⁿˢ S U)) (<:-trans (<:-union (∩ⁿ-<:-∩ S T) (∩ⁿˢ-<:-∩ S U)) ∩-distl-∪-<:)
∩ⁿ-<:-∩ never (T ⇒ U) = <:-never
∩ⁿ-<:-∩ unknown (T ⇒ U) = <:-∩-glb <:-unknown <:-refl
∩ⁿ-<:-∩ (R ⇒ S) (T ⇒ U) = <:-refl
∩ⁿ-<:-∩ (R ∩ S) (T ⇒ U) = <:-refl
∩ⁿ-<:-∩ (R ∪ S) (T ⇒ U) = <:-trans (∩ⁿ-<:-∩ R (T ⇒ U)) (<:-∩-glb (<:-trans <:-∩-left <:-∪-left) <:-∩-right)
∩ⁿ-<:-∩ never (T ∩ U) = <:-never
∩ⁿ-<:-∩ unknown (T ∩ U) = <:-∩-glb <:-unknown <:-refl
∩ⁿ-<:-∩ (R ⇒ S) (T ∩ U) = <:-refl
∩ⁿ-<:-∩ (R ∩ S) (T ∩ U) = <:-refl
∩ⁿ-<:-∩ (R ∪ S) (T ∩ U) = <:-trans (∩ⁿ-<:-∩ R (T ∩ U)) (<:-∩-glb (<:-trans <:-∩-left <:-∪-left) <:-∩-right)
∩-<:-∩ⁿˢ never number = <:-∩-left
∩-<:-∩ⁿˢ never boolean = <:-∩-left
∩-<:-∩ⁿˢ never string = <:-∩-left
∩-<:-∩ⁿˢ never nil = <:-∩-left
∩-<:-∩ⁿˢ unknown T = <:-∩-right
∩-<:-∩ⁿˢ (R ⇒ S) T = scalar-∩-fun-<:-never (R ⇒ S) T
∩-<:-∩ⁿˢ (F ∩ G) T = scalar-∩-fun-<:-never (F ∩ G) T
∩-<:-∩ⁿˢ (R ∪ number) number = <:-∩-right
∩-<:-∩ⁿˢ (R ∪ boolean) number = <:-trans <:-∩-distr-∪ (<:-∪-lub (∩-<:-∩ⁿˢ R number) (scalar-≢-∩-<:-never boolean number (λ ())))
∩-<:-∩ⁿˢ (R ∪ string) number = <:-trans <:-∩-distr-∪ (<:-∪-lub (∩-<:-∩ⁿˢ R number) (scalar-≢-∩-<:-never string number (λ ())))
∩-<:-∩ⁿˢ (R ∪ nil) number = <:-trans <:-∩-distr-∪ (<:-∪-lub (∩-<:-∩ⁿˢ R number) (scalar-≢-∩-<:-never nil number (λ ())))
∩-<:-∩ⁿˢ (R ∪ number) boolean = <:-trans <:-∩-distr-∪ (<:-∪-lub (∩-<:-∩ⁿˢ R boolean) (scalar-≢-∩-<:-never number boolean (λ ())))
∩-<:-∩ⁿˢ (R ∪ boolean) boolean = <:-∩-right
∩-<:-∩ⁿˢ (R ∪ string) boolean = <:-trans <:-∩-distr-∪ (<:-∪-lub (∩-<:-∩ⁿˢ R boolean) (scalar-≢-∩-<:-never string boolean (λ ())))
∩-<:-∩ⁿˢ (R ∪ nil) boolean = <:-trans <:-∩-distr-∪ (<:-∪-lub (∩-<:-∩ⁿˢ R boolean) (scalar-≢-∩-<:-never nil boolean (λ ())))
∩-<:-∩ⁿˢ (R ∪ number) string = <:-trans <:-∩-distr-∪ (<:-∪-lub (∩-<:-∩ⁿˢ R string) (scalar-≢-∩-<:-never number string (λ ())))
∩-<:-∩ⁿˢ (R ∪ boolean) string = <:-trans <:-∩-distr-∪ (<:-∪-lub (∩-<:-∩ⁿˢ R string) (scalar-≢-∩-<:-never boolean string (λ ())))
∩-<:-∩ⁿˢ (R ∪ string) string = <:-∩-right
∩-<:-∩ⁿˢ (R ∪ nil) string = <:-trans <:-∩-distr-∪ (<:-∪-lub (∩-<:-∩ⁿˢ R string) (scalar-≢-∩-<:-never nil string (λ ())))
∩-<:-∩ⁿˢ (R ∪ number) nil = <:-trans <:-∩-distr-∪ (<:-∪-lub (∩-<:-∩ⁿˢ R nil) (scalar-≢-∩-<:-never number nil (λ ())))
∩-<:-∩ⁿˢ (R ∪ boolean) nil = <:-trans <:-∩-distr-∪ (<:-∪-lub (∩-<:-∩ⁿˢ R nil) (scalar-≢-∩-<:-never boolean nil (λ ())))
∩-<:-∩ⁿˢ (R ∪ string) nil = <:-trans <:-∩-distr-∪ (<:-∪-lub (∩-<:-∩ⁿˢ R nil) (scalar-≢-∩-<:-never string nil (λ ())))
∩-<:-∩ⁿˢ (R ∪ nil) nil = <:-∩-right
∩ⁿˢ-<:-∩ never T = <:-never
∩ⁿˢ-<:-∩ unknown T = <:-∩-glb <:-unknown <:-refl
∩ⁿˢ-<:-∩ (R ⇒ S) T = <:-never
∩ⁿˢ-<:-∩ (F ∩ G) T = <:-never
∩ⁿˢ-<:-∩ (R ∪ number) number = <:-∩-glb <:-∪-right <:-refl
∩ⁿˢ-<:-∩ (R ∪ boolean) number = <:-trans (∩ⁿˢ-<:-∩ R number) (<:-intersect <:-∪-left <:-refl)
∩ⁿˢ-<:-∩ (R ∪ string) number = <:-trans (∩ⁿˢ-<:-∩ R number) (<:-intersect <:-∪-left <:-refl)
∩ⁿˢ-<:-∩ (R ∪ nil) number = <:-trans (∩ⁿˢ-<:-∩ R number) (<:-intersect <:-∪-left <:-refl)
∩ⁿˢ-<:-∩ (R ∪ number) boolean = <:-trans (∩ⁿˢ-<:-∩ R boolean) (<:-intersect <:-∪-left <:-refl)
∩ⁿˢ-<:-∩ (R ∪ boolean) boolean = <:-∩-glb <:-∪-right <:-refl
∩ⁿˢ-<:-∩ (R ∪ string) boolean = <:-trans (∩ⁿˢ-<:-∩ R boolean) (<:-intersect <:-∪-left <:-refl)
∩ⁿˢ-<:-∩ (R ∪ nil) boolean = <:-trans (∩ⁿˢ-<:-∩ R boolean) (<:-intersect <:-∪-left <:-refl)
∩ⁿˢ-<:-∩ (R ∪ number) string = <:-trans (∩ⁿˢ-<:-∩ R string) (<:-intersect <:-∪-left <:-refl)
∩ⁿˢ-<:-∩ (R ∪ boolean) string = <:-trans (∩ⁿˢ-<:-∩ R string) (<:-intersect <:-∪-left <:-refl)
∩ⁿˢ-<:-∩ (R ∪ string) string = <:-∩-glb <:-∪-right <:-refl
∩ⁿˢ-<:-∩ (R ∪ nil) string = <:-trans (∩ⁿˢ-<:-∩ R string) (<:-intersect <:-∪-left <:-refl)
∩ⁿˢ-<:-∩ (R ∪ number) nil = <:-trans (∩ⁿˢ-<:-∩ R nil) (<:-intersect <:-∪-left <:-refl)
∩ⁿˢ-<:-∩ (R ∪ boolean) nil = <:-trans (∩ⁿˢ-<:-∩ R nil) (<:-intersect <:-∪-left <:-refl)
∩ⁿˢ-<:-∩ (R ∪ string) nil = <:-trans (∩ⁿˢ-<:-∩ R nil) (<:-intersect <:-∪-left <:-refl)
∩ⁿˢ-<:-∩ (R ∪ nil) nil = <:-∩-glb <:-∪-right <:-refl
∪ᶠ-<:-∪ (R ⇒ S) (T ⇒ U) = <:-trans (<:-function (∩-<:-∩ⁿ R T) (∪ⁿ-<:-∪ S U)) <:-function-∪-∩
∪ᶠ-<:-∪ (R ⇒ S) (G ∩ H) = <:-trans (<:-intersect (∪ᶠ-<:-∪ (R ⇒ S) G) (∪ᶠ-<:-∪ (R ⇒ S) H)) ∪-distl-∩-<:
∪ᶠ-<:-∪ (E ∩ F) G = <:-trans (<:-intersect (∪ᶠ-<:-∪ E G) (∪ᶠ-<:-∪ F G)) ∪-distr-∩-<:
∪-<:-∪ᶠ : ∀ {F G} → FunType F → FunType G → (F ∪ G) <: (F ∪ᶠ G)
∪-<:-∪ᶠ (R ⇒ S) (T ⇒ U) = <:-trans <:-function-∪ (<:-function (∩ⁿ-<:-∩ R T) (∪-<:-∪ⁿ S U))
∪-<:-∪ᶠ (R ⇒ S) (G ∩ H) = <:-trans <:-∪-distl-∩ (<:-intersect (∪-<:-∪ᶠ (R ⇒ S) G) (∪-<:-∪ᶠ (R ⇒ S) H))
∪-<:-∪ᶠ (E ∩ F) G = <:-trans <:-∪-distr-∩ (<:-intersect (∪-<:-∪ᶠ E G) (∪-<:-∪ᶠ F G))
∪ⁿˢ-<:-∪ S never = <:-∪-left
∪ⁿˢ-<:-∪ never number = <:-refl
∪ⁿˢ-<:-∪ never boolean = <:-refl
∪ⁿˢ-<:-∪ never string = <:-refl
∪ⁿˢ-<:-∪ never nil = <:-refl
∪ⁿˢ-<:-∪ unknown number = <:-∪-left
∪ⁿˢ-<:-∪ unknown boolean = <:-∪-left
∪ⁿˢ-<:-∪ unknown string = <:-∪-left
∪ⁿˢ-<:-∪ unknown nil = <:-∪-left
∪ⁿˢ-<:-∪ (R ⇒ S) number = <:-refl
∪ⁿˢ-<:-∪ (R ⇒ S) boolean = <:-refl
∪ⁿˢ-<:-∪ (R ⇒ S) string = <:-refl
∪ⁿˢ-<:-∪ (R ⇒ S) nil = <:-refl
∪ⁿˢ-<:-∪ (R ∩ S) number = <:-refl
∪ⁿˢ-<:-∪ (R ∩ S) boolean = <:-refl
∪ⁿˢ-<:-∪ (R ∩ S) string = <:-refl
∪ⁿˢ-<:-∪ (R ∩ S) nil = <:-refl
∪ⁿˢ-<:-∪ (R ∪ number) number = <:-union <:-∪-left <:-refl
∪ⁿˢ-<:-∪ (R ∪ boolean) number = <:-trans (<:-union (∪ⁿˢ-<:-∪ R number) <:-refl) flipper
∪ⁿˢ-<:-∪ (R ∪ string) number = <:-trans (<:-union (∪ⁿˢ-<:-∪ R number) <:-refl) flipper
∪ⁿˢ-<:-∪ (R ∪ nil) number = <:-trans (<:-union (∪ⁿˢ-<:-∪ R number) <:-refl) flipper
∪ⁿˢ-<:-∪ (R ∪ number) boolean = <:-trans (<:-union (∪ⁿˢ-<:-∪ R boolean) <:-refl) flipper
∪ⁿˢ-<:-∪ (R ∪ boolean) boolean = <:-union <:-∪-left <:-refl
∪ⁿˢ-<:-∪ (R ∪ string) boolean = <:-trans (<:-union (∪ⁿˢ-<:-∪ R boolean) <:-refl) flipper
∪ⁿˢ-<:-∪ (R ∪ nil) boolean = <:-trans (<:-union (∪ⁿˢ-<:-∪ R boolean) <:-refl) flipper
∪ⁿˢ-<:-∪ (R ∪ number) string = <:-trans (<:-union (∪ⁿˢ-<:-∪ R string) <:-refl) flipper
∪ⁿˢ-<:-∪ (R ∪ boolean) string = <:-trans (<:-union (∪ⁿˢ-<:-∪ R string) <:-refl) flipper
∪ⁿˢ-<:-∪ (R ∪ string) string = <:-union <:-∪-left <:-refl
∪ⁿˢ-<:-∪ (R ∪ nil) string = <:-trans (<:-union (∪ⁿˢ-<:-∪ R string) <:-refl) flipper
∪ⁿˢ-<:-∪ (R ∪ number) nil = <:-trans (<:-union (∪ⁿˢ-<:-∪ R nil) <:-refl) flipper
∪ⁿˢ-<:-∪ (R ∪ boolean) nil = <:-trans (<:-union (∪ⁿˢ-<:-∪ R nil) <:-refl) flipper
∪ⁿˢ-<:-∪ (R ∪ string) nil = <:-trans (<:-union (∪ⁿˢ-<:-∪ R nil) <:-refl) flipper
∪ⁿˢ-<:-∪ (R ∪ nil) nil = <:-union <:-∪-left <:-refl
∪-<:-∪ⁿˢ T never = <:-∪-lub <:-refl <:-never
∪-<:-∪ⁿˢ never number = <:-refl
∪-<:-∪ⁿˢ never boolean = <:-refl
∪-<:-∪ⁿˢ never string = <:-refl
∪-<:-∪ⁿˢ never nil = <:-refl
∪-<:-∪ⁿˢ unknown number = <:-unknown
∪-<:-∪ⁿˢ unknown boolean = <:-unknown
∪-<:-∪ⁿˢ unknown string = <:-unknown
∪-<:-∪ⁿˢ unknown nil = <:-unknown
∪-<:-∪ⁿˢ (R ⇒ S) number = <:-refl
∪-<:-∪ⁿˢ (R ⇒ S) boolean = <:-refl
∪-<:-∪ⁿˢ (R ⇒ S) string = <:-refl
∪-<:-∪ⁿˢ (R ⇒ S) nil = <:-refl
∪-<:-∪ⁿˢ (R ∩ S) number = <:-refl
∪-<:-∪ⁿˢ (R ∩ S) boolean = <:-refl
∪-<:-∪ⁿˢ (R ∩ S) string = <:-refl
∪-<:-∪ⁿˢ (R ∩ S) nil = <:-refl
∪-<:-∪ⁿˢ (R ∪ number) number = <:-∪-lub <:-refl <:-∪-right
∪-<:-∪ⁿˢ (R ∪ boolean) number = <:-trans flipper (<:-union (∪-<:-∪ⁿˢ R number) <:-refl)
∪-<:-∪ⁿˢ (R ∪ string) number = <:-trans flipper (<:-union (∪-<:-∪ⁿˢ R number) <:-refl)
∪-<:-∪ⁿˢ (R ∪ nil) number = <:-trans flipper (<:-union (∪-<:-∪ⁿˢ R number) <:-refl)
∪-<:-∪ⁿˢ (R ∪ number) boolean = <:-trans flipper (<:-union (∪-<:-∪ⁿˢ R boolean) <:-refl)
∪-<:-∪ⁿˢ (R ∪ boolean) boolean = <:-∪-lub <:-refl <:-∪-right
∪-<:-∪ⁿˢ (R ∪ string) boolean = <:-trans flipper (<:-union (∪-<:-∪ⁿˢ R boolean) <:-refl)
∪-<:-∪ⁿˢ (R ∪ nil) boolean = <:-trans flipper (<:-union (∪-<:-∪ⁿˢ R boolean) <:-refl)
∪-<:-∪ⁿˢ (R ∪ number) string = <:-trans flipper (<:-union (∪-<:-∪ⁿˢ R string) <:-refl)
∪-<:-∪ⁿˢ (R ∪ boolean) string = <:-trans flipper (<:-union (∪-<:-∪ⁿˢ R string) <:-refl)
∪-<:-∪ⁿˢ (R ∪ string) string = <:-∪-lub <:-refl <:-∪-right
∪-<:-∪ⁿˢ (R ∪ nil) string = <:-trans flipper (<:-union (∪-<:-∪ⁿˢ R string) <:-refl)
∪-<:-∪ⁿˢ (R ∪ number) nil = <:-trans flipper (<:-union (∪-<:-∪ⁿˢ R nil) <:-refl)
∪-<:-∪ⁿˢ (R ∪ boolean) nil = <:-trans flipper (<:-union (∪-<:-∪ⁿˢ R nil) <:-refl)
∪-<:-∪ⁿˢ (R ∪ string) nil = <:-trans flipper (<:-union (∪-<:-∪ⁿˢ R nil) <:-refl)
∪-<:-∪ⁿˢ (R ∪ nil) nil = <:-∪-lub <:-refl <:-∪-right
∪ⁿ-<:-∪ S never = <:-∪-left
∪ⁿ-<:-∪ S unknown = <:-∪-right
∪ⁿ-<:-∪ never (T ⇒ U) = <:-∪-right
∪ⁿ-<:-∪ unknown (T ⇒ U) = <:-∪-left
∪ⁿ-<:-∪ (R ⇒ S) (T ⇒ U) = ∪ᶠ-<:-∪ (R ⇒ S) (T ⇒ U)
∪ⁿ-<:-∪ (R ∩ S) (T ⇒ U) = ∪ᶠ-<:-∪ (R ∩ S) (T ⇒ U)
∪ⁿ-<:-∪ (R ∪ S) (T ⇒ U) = <:-trans (<:-union (∪ⁿ-<:-∪ R (T ⇒ U)) <:-refl) (<:-∪-lub (<:-∪-lub (<:-trans <:-∪-left <:-∪-left) <:-∪-right) (<:-trans <:-∪-right <:-∪-left))
∪ⁿ-<:-∪ never (T ∩ U) = <:-∪-right
∪ⁿ-<:-∪ unknown (T ∩ U) = <:-∪-left
∪ⁿ-<:-∪ (R ⇒ S) (T ∩ U) = ∪ᶠ-<:-∪ (R ⇒ S) (T ∩ U)
∪ⁿ-<:-∪ (R ∩ S) (T ∩ U) = ∪ᶠ-<:-∪ (R ∩ S) (T ∩ U)
∪ⁿ-<:-∪ (R ∪ S) (T ∩ U) = <:-trans (<:-union (∪ⁿ-<:-∪ R (T ∩ U)) <:-refl) (<:-∪-lub (<:-∪-lub (<:-trans <:-∪-left <:-∪-left) <:-∪-right) (<:-trans <:-∪-right <:-∪-left))
∪ⁿ-<:-∪ S (T ∪ U) = <:-∪-lub (<:-trans (∪ⁿ-<:-∪ S T) (<:-union <:-refl <:-∪-left)) (<:-trans <:-∪-right <:-∪-right)
∪-<:-∪ⁿ S never = <:-∪-lub <:-refl <:-never
∪-<:-∪ⁿ S unknown = <:-unknown
∪-<:-∪ⁿ never (T ⇒ U) = <:-∪-lub <:-never <:-refl
∪-<:-∪ⁿ unknown (T ⇒ U) = <:-unknown
∪-<:-∪ⁿ (R ⇒ S) (T ⇒ U) = ∪-<:-∪ᶠ (R ⇒ S) (T ⇒ U)
∪-<:-∪ⁿ (R ∩ S) (T ⇒ U) = ∪-<:-∪ᶠ (R ∩ S) (T ⇒ U)
∪-<:-∪ⁿ (R ∪ S) (T ⇒ U) = <:-trans <:-∪-assocr (<:-trans (<:-union <:-refl <:-∪-symm) (<:-trans <:-∪-assocl (<:-union (∪-<:-∪ⁿ R (T ⇒ U)) <:-refl)))
∪-<:-∪ⁿ never (T ∩ U) = <:-∪-lub <:-never <:-refl
∪-<:-∪ⁿ unknown (T ∩ U) = <:-unknown
∪-<:-∪ⁿ (R ⇒ S) (T ∩ U) = ∪-<:-∪ᶠ (R ⇒ S) (T ∩ U)
∪-<:-∪ⁿ (R ∩ S) (T ∩ U) = ∪-<:-∪ᶠ (R ∩ S) (T ∩ U)
∪-<:-∪ⁿ (R ∪ S) (T ∩ U) = <:-trans <:-∪-assocr (<:-trans (<:-union <:-refl <:-∪-symm) (<:-trans <:-∪-assocl (<:-union (∪-<:-∪ⁿ R (T ∩ U)) <:-refl)))
∪-<:-∪ⁿ never (T ∪ U) = <:-trans <:-∪-assocl (<:-union (∪-<:-∪ⁿ never T) <:-refl)
∪-<:-∪ⁿ unknown (T ∪ U) = <:-trans <:-∪-assocl (<:-union (∪-<:-∪ⁿ unknown T) <:-refl)
∪-<:-∪ⁿ (R ⇒ S) (T ∪ U) = <:-trans <:-∪-assocl (<:-union (∪-<:-∪ⁿ (R ⇒ S) T) <:-refl)
∪-<:-∪ⁿ (R ∩ S) (T ∪ U) = <:-trans <:-∪-assocl (<:-union (∪-<:-∪ⁿ (R ∩ S) T) <:-refl)
∪-<:-∪ⁿ (R ∪ S) (T ∪ U) = <:-trans <:-∪-assocl (<:-union (∪-<:-∪ⁿ (R ∪ S) T) <:-refl)
normalize-<: : ∀ T → normalize T <: T
<:-normalize : ∀ T → T <: normalize T
<:-normalize nil = <:-∪-right
<:-normalize (S ⇒ T) = <:-function (normalize-<: S) (<:-normalize T)
<:-normalize never = <:-refl
<:-normalize unknown = <:-refl
<:-normalize boolean = <:-∪-right
<:-normalize number = <:-∪-right
<:-normalize string = <:-∪-right
<:-normalize (S ∪ T) = <:-trans (<:-union (<:-normalize S) (<:-normalize T)) (∪-<:-∪ⁿ (normal S) (normal T))
<:-normalize (S ∩ T) = <:-trans (<:-intersect (<:-normalize S) (<:-normalize T)) (∩-<:-∩ⁿ (normal S) (normal T))
normalize-<: nil = <:-∪-lub <:-never <:-refl
normalize-<: (S ⇒ T) = <:-function (<:-normalize S) (normalize-<: T)
normalize-<: never = <:-refl
normalize-<: unknown = <:-refl
normalize-<: boolean = <:-∪-lub <:-never <:-refl
normalize-<: number = <:-∪-lub <:-never <:-refl
normalize-<: string = <:-∪-lub <:-never <:-refl
normalize-<: (S ∪ T) = <:-trans (∪ⁿ-<:-∪ (normal S) (normal T)) (<:-union (normalize-<: S) (normalize-<: T))
normalize-<: (S ∩ T) = <:-trans (∩ⁿ-<:-∩ (normal S) (normal T)) (<:-intersect (normalize-<: S) (normalize-<: T))
|
oeis/035/A035287.asm | neoneye/loda-programs | 11 | 29184 | ; A035287: Number of ways to place a non-attacking white and black rook on n X n chessboard.
; 0,4,36,144,400,900,1764,3136,5184,8100,12100,17424,24336,33124,44100,57600,73984,93636,116964,144400,176400,213444,256036,304704,360000,422500,492804,571536,659344,756900,864900,984064,1115136,1258884,1416100,1587600,1774224,1976836,2196324,2433600,2689600,2965284,3261636,3579664,3920400,4284900,4674244,5089536,5531904,6002500,6502500,7033104,7595536,8191044,8820900,9486400,10188864,10929636,11710084,12531600,13395600,14303524,15256836,16257024,17305600,18404100,19554084,20757136,22014864
mov $1,$0
pow $1,2
add $0,$1
pow $0,2
|
objc/one-step-processing/ObjectiveCPreprocessorParser.g4 | ChristianWulf/grammars-v4 | 0 | 6915 | /*
Objective-C Preprocessor grammar.
The MIT License (MIT).
Copyright (c) 2016, <NAME> (<EMAIL>).
Copyright (c) 2016, <NAME> (<EMAIL>).
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
parser grammar ObjectiveCPreprocessorParser;
options { tokenVocab=ObjectiveCLexer; }
directive
: SHARP (DIRECTIVE_IMPORT | DIRECTIVE_INCLUDE) directiveText #preprocessorImport
| SHARP DIRECTIVE_IF preprocessorExpression #preprocessorConditional
| SHARP DIRECTIVE_ELIF preprocessorExpression #preprocessorConditional
| SHARP DIRECTIVE_ELSE #preprocessorConditional
| SHARP DIRECTIVE_ENDIF #preprocessorConditional
| SHARP DIRECTIVE_IFDEF DIRECTIVE_CONDITIONAL_SYMBOL #preprocessorDef
| SHARP DIRECTIVE_IFNDEF DIRECTIVE_CONDITIONAL_SYMBOL #preprocessorDef
| SHARP DIRECTIVE_UNDEF DIRECTIVE_CONDITIONAL_SYMBOL #preprocessorDef
| SHARP DIRECTIVE_PRAGMA directiveText #preprocessorPragma
| SHARP DIRECTIVE_ERROR directiveText #preprocessorError
| SHARP DIRECTIVE_WARNING directiveText #preprocessorWarning
| SHARP DIRECTIVE_DEFINE DIRECTIVE_CONDITIONAL_SYMBOL directiveText? #preprocessorDefine
;
directiveText
: DIRECTIVE_TEXT+
;
preprocessorExpression
: DIRECTIVE_TRUE #preprocessorConstant
| DIRECTIVE_FALSE #preprocessorConstant
| DIRECTIVE_DECIMAL_LITERAL #preprocessorConstant
| DIRECTIVE_STRING #preprocessorConstant
| DIRECTIVE_CONDITIONAL_SYMBOL
(DIRECTIVE_LP preprocessorExpression DIRECTIVE_RP)? #preprocessorConditionalSymbol
| DIRECTIVE_LP preprocessorExpression DIRECTIVE_RP #preprocessorParenthesis
| DIRECTIVE_BANG preprocessorExpression #preprocessorNot
| preprocessorExpression
op=(DIRECTIVE_EQUAL | DIRECTIVE_NOTEQUAL) preprocessorExpression #preprocessorBinary
| preprocessorExpression op=DIRECTIVE_AND preprocessorExpression #preprocessorBinary
| preprocessorExpression op=DIRECTIVE_OR preprocessorExpression #preprocessorBinary
| preprocessorExpression
op=(DIRECTIVE_LT | DIRECTIVE_GT | DIRECTIVE_LE | DIRECTIVE_GE)
preprocessorExpression #preprocessorBinary
| DIRECTIVE_DEFINED
(DIRECTIVE_CONDITIONAL_SYMBOL |
DIRECTIVE_LP DIRECTIVE_CONDITIONAL_SYMBOL DIRECTIVE_RP) #preprocessorDefined
; |
oeis/021/A021414.asm | neoneye/loda-programs | 11 | 104170 | ; A021414: Expansion of 1/((1-x)(1-3x)(1-5x)(1-6x)).
; Submitted by <NAME>
; 1,15,148,1218,9079,63693,429346,2815296,18097717,114645531,718257904,4461736734,27532164115,169004094729,1033087293022,6293858904732,38239893731473,231823257614487,1402859602945900,8476759647362490,51158573262786991,308441532160312005,1858099702951411738,11185850908870937208,67301369332682261869,404739536664309678483,2433093827139737349736,14621846010046216720086,87847491330631452111307,527667024438505037669121,3168912529213448549163094,19028027089119293005146324,114240922106688296864994505
add $0,2
lpb $0
sub $0,1
add $2,2
mul $2,6
sub $2,11
mul $3,5
add $3,$1
mul $1,3
add $1,$2
lpe
mov $0,$3
|
Working Disassembly/General/Sprites/Robotnik/Map - Eggrobo.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 5 | 164071 | <filename>Working Disassembly/General/Sprites/Robotnik/Map - Eggrobo.asm<gh_stars>1-10
; Eggrobo mappings
dc.w word_184F44-Map_EggRobo
dc.w word_184F46-Map_EggRobo
dc.w word_184F60-Map_EggRobo
dc.w word_184F6E-Map_EggRobo
dc.w word_184F8E-Map_EggRobo
dc.w word_184F96-Map_EggRobo
dc.w word_184F9E-Map_EggRobo
dc.w word_184FAC-Map_EggRobo
word_184F44: dc.w 0 ; DATA XREF: ROM:00184F34o
word_184F46: dc.w 4 ; DATA XREF: ROM:00184F34o
dc.b $E8, $F, $20, 0, $FF, $EC
dc.b $F0, 3, $20, $10, 0, $C
dc.b 8, $C, $20, $14, $FF, $EC
dc.b $10, 8, $20, $18, $FF, $EC
word_184F60: dc.w 2 ; DATA XREF: ROM:00184F34o
dc.b $F4, $D, $20, $1B, $FF, $F0
dc.b 4, 8, $20, $23, $FF, $F8
word_184F6E: dc.w 5 ; DATA XREF: ROM:00184F34o
dc.b $E8, $F, $20, 0, $FF, $EC
dc.b $F0, 3, $20, $10, 0, $C
dc.b 8, $C, $20, $14, $FF, $EC
dc.b $10, 8, $20, $18, $FF, $EC
dc.b 8, $A, 0, $26, 0, 4
word_184F8E: dc.w 1 ; DATA XREF: ROM:00184F34o
dc.b $F4, $A, $20, $2F, $FF, $F4
word_184F96: dc.w 1 ; DATA XREF: ROM:00184F34o
dc.b $F4, $A, $20, $38, $FF, $F4
word_184F9E: dc.w 2 ; DATA XREF: ROM:00184F34o
dc.b $F4, $A, $20, $41, $FF, $F4
dc.b $C, 0, $20, $4A, $FF, $FC
word_184FAC: dc.w 2 ; DATA XREF: ROM:00184F34o
dc.b $FC, $C, $20, $4B, $FF, $E0
dc.b $FC, $C, $28, $4B, 0, 0
|
programs/oeis/182/A182255.asm | karttu/loda | 1 | 22228 | ; A182255: 81n^2 - 2247n + 15383.
; 15383,13217,11213,9371,7691,6173,4817,3623,2591,1721,1013,467,83,-139,-199,-97,167,593,1181,1931,2843,3917,5153,6551,8111,9833,11717,13763,15971,18341,20873,23567,26423,29441,32621,35963,39467,43133,46961,50951,55103
sub $0,5
mov $1,2
mov $3,$0
sub $3,9
add $1,$3
sub $1,11
mul $1,21
mov $2,9
mul $2,$3
pow $2,2
add $2,1
add $1,$2
sub $1,94
div $1,6
mul $1,6
add $1,83
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.