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 |
|---|---|---|---|---|
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_xr/CiscoXr_as_path_set.g4 | atang42/batfish | 6 | 3619 | <reponame>atang42/batfish
parser grammar CiscoXr_as_path_set;
import CiscoXr_common;
options {
tokenVocab = CiscoXrLexer;
}
s_as_path_set
:
AS_PATH_SET name = as_path_set_name NEWLINE
as_path_set_elem_list END_SET NEWLINE
;
as_path_set_elem_list
:
// no elements
| elems += as_path_set_elem (COMMA elems += as_path_set_elem)*
;
as_path_set_elem
:
NEWLINE*
(
aspse_dfa_regex
| aspse_ios_regex
| aspse_length
| aspse_neighbor_is
| aspse_originates_from
| aspse_passes_through
| aspse_unique_length
)
NEWLINE*
;
aspse_dfa_regex: DFA_REGEX as_path_regex;
aspse_ios_regex: IOS_REGEX as_path_regex;
aspse_length: LENGTH comparator as_path_length ALL?;
aspse_neighbor_is: NEIGHBOR_IS as_range_list EXACT?;
aspse_originates_from: ORIGINATES_FROM as_range_list EXACT?;
aspse_passes_through: PASSES_THROUGH as_range_list EXACT?;
aspse_unique_length: UNIQUE_LENGTH comparator as_path_length ALL?;
as_range_list: SINGLE_QUOTE as_range+ SINGLE_QUOTE;
as_range
:
singleton = as_number
| BRACKET_LEFT lo = as_number DOTDOT hi = as_number BRACKET_RIGHT
;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr3.ads | best08618/asylo | 7 | 7457 | package discr3 is
type E is range 0..255;
type R1 is range 1..5;
type R2 is range 11..15;
type S1 is array(R1 range <>) of E;
type S2 is array(R2 range <>) of E;
V1 : S1( 2..3) := (0,0);
V2 : S2(12..13) := (1,1);
subtype R3 is R1 range 2..3;
V3 : S1 (R3);
end discr3;
|
Transynther/x86/_processed/NC/_st_zr_un_sm_/i9-9900K_12_0xa0_notsx.log_21829_1179.asm | ljhsiun2/medusa | 9 | 164082 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NC/_st_zr_un_sm_/i9-9900K_12_0xa0_notsx.log_21829_1179.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x6eae, %rsi
lea addresses_UC_ht+0x8686, %rdi
nop
nop
nop
nop
nop
cmp %rbp, %rbp
mov $25, %rcx
rep movsw
nop
nop
nop
nop
nop
dec %rax
lea addresses_UC_ht+0x332e, %r14
nop
nop
nop
nop
nop
sub %rbx, %rbx
mov $0x6162636465666768, %rbp
movq %rbp, (%r14)
nop
nop
nop
nop
add $17643, %r14
lea addresses_A_ht+0x584e, %rsi
nop
nop
nop
nop
nop
and %rdi, %rdi
movups (%rsi), %xmm3
vpextrq $1, %xmm3, %rbp
nop
and %rdi, %rdi
lea addresses_A_ht+0x139ce, %r14
nop
nop
add $4623, %rcx
mov (%r14), %di
nop
nop
nop
nop
add %r14, %r14
lea addresses_WC_ht+0x1ca4e, %rbx
nop
nop
nop
nop
nop
dec %rcx
mov (%rbx), %rsi
dec %rsi
lea addresses_WT_ht+0x1bc4e, %rbx
add $16205, %rdi
movw $0x6162, (%rbx)
nop
nop
nop
inc %rbx
lea addresses_D_ht+0xbb4e, %rbp
cmp %rbx, %rbx
mov (%rbp), %eax
nop
nop
nop
nop
nop
inc %rbx
lea addresses_WC_ht+0xf24e, %rbp
nop
dec %rax
movups (%rbp), %xmm5
vpextrq $0, %xmm5, %r14
sub $31712, %rbp
lea addresses_normal_ht+0x12ae, %rax
nop
nop
sub %rcx, %rcx
mov $0x6162636465666768, %rbx
movq %rbx, %xmm7
movups %xmm7, (%rax)
nop
nop
nop
nop
nop
sub %rbp, %rbp
lea addresses_normal_ht+0xa049, %rax
and $40022, %rdi
movups (%rax), %xmm3
vpextrq $1, %xmm3, %rbx
nop
nop
nop
nop
nop
inc %rdi
lea addresses_UC_ht+0x1a9f6, %rsi
nop
nop
nop
add %rbp, %rbp
mov (%rsi), %eax
nop
nop
and %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r8
push %rbx
push %rcx
push %rsi
// Load
lea addresses_WC+0x1e18e, %r8
nop
nop
sub $54297, %r10
movb (%r8), %bl
nop
inc %r14
// Store
lea addresses_A+0x161ce, %rbx
nop
nop
nop
nop
nop
xor $58442, %rsi
movl $0x51525354, (%rbx)
nop
nop
nop
nop
nop
dec %r13
// Store
mov $0x7f84240000000a4e, %r8
nop
nop
nop
nop
nop
cmp $7345, %r13
mov $0x5152535455565758, %rsi
movq %rsi, %xmm5
vmovups %ymm5, (%r8)
nop
nop
nop
nop
nop
xor %r14, %r14
// Faulty Load
mov $0x7f84240000000a4e, %r8
nop
nop
nop
nop
cmp $57555, %rbx
mov (%r8), %r14w
lea oracles, %r13
and $0xff, %r14
shlq $12, %r14
mov (%r13,%r14,1), %r14
pop %rsi
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': True, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 10}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 9}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 3}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'58': 21724, '6d': 1, '00': 104}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
programs/oeis/318/A318743.asm | neoneye/loda | 22 | 98117 | ; A318743: a(n) = Sum_{k=1..n} floor(n/k)^4.
; 1,17,83,274,644,1396,2502,4388,6919,10743,15385,22407,30233,41209,53853,70650,88636,113308,138654,172332,207984,252416,298002,358654,417873,492065,569061,663427,756053,875541,989063,1130915,1272967,1441383,1607147,1817080,2011626,2247962,2484158,2766090,3031852,3363980,3671086,4044988,4412626,4835058,5237284,5741582,6199073,6746945,7280197,7900979,8479845,9191557,9844137,10624069,11370985,12224121,13024987,14023063,14908905,15952937,16967679,18133786,19215390,20522014,21698400,23097246,24428642,25950594,27352276,29078014,30602400,32385296,34110838,36068900,37865512,40030760,41965786,44272548,46436265,48867497,51113643,53864071,56295915,59103227,61784863,64840235,67612941,70976637,73950529,77437471,80716963,84388899,87790343,91903727,95498353,99673249,103640551,108158676
mov $4,2
lpb $4
sub $4,1
add $0,$4
sub $0,1
lpb $0
mov $6,$0
sub $0,1
add $3,1
div $6,$3
add $6,1
pow $6,4
add $5,$6
lpe
mov $2,$4
lpb $2
mov $1,$5
mov $2,0
lpe
lpe
add $1,1
mov $0,$1
|
Arithmetic.agda | haskellcamargo/agda-arithmetic-operations | 0 | 7904 | <filename>Arithmetic.agda
module Arithmetic where
data ℕ : Set where
zero : ℕ
succ : ℕ → ℕ
_+_ : ℕ → ℕ → ℕ
zero + b = b
(succ a) + b = succ (a + b)
-- ℕ + ℕ = succ (succ ℕ))
_*_ : ℕ → ℕ → ℕ
zero * b = zero
(succ a) * b = a + b * a
|
ricerca_minimo.asm | supermirtillo/polito-assembly-8086 | 0 | 179650 | <reponame>supermirtillo/polito-assembly-8086
N equ 4
.model small
.stack
.data
vett db 34, 56, 72, 11
min db ?
.code
.startup
mov al, vett[0] ; minimo al primo elemento del vettore
mov cx, N
mov di, 0
ciclo:
cmp vett[di], al
jnb dopo ; salta se vett[di] >= al
mov al, vett[di] ; altrimenti salva
dopo:
inc di
loop ciclo ; loop su cx
mov min, al
.exit
end |
data/pokemon/base_stats/delibird.asm | TastySnax12/pokecrystal16-493-plus | 2 | 173627 | <gh_stars>1-10
db 0 ; species ID placeholder
db 45, 55, 45, 75, 65, 45
; hp atk def spd sat sdf
db ICE, FLYING ; type
db 45 ; catch rate
db 183 ; base exp
db NO_ITEM, NO_ITEM ; items
db GENDER_F50 ; gender ratio
db 100 ; unknown 1
db 20 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/delibird/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_FAST ; growth rate
dn EGG_WATER_1, EGG_GROUND ; egg groups
; tm/hm learnset
tmhm HEADBUTT, CURSE, ROLLOUT, TOXIC, HIDDEN_POWER, SNORE, BLIZZARD, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, RETURN, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, SWIFT, DETECT, REST, ATTRACT, THIEF, FLY, ICE_BEAM
; end
|
programs/oeis/158/A158770.asm | karttu/loda | 1 | 179295 | <filename>programs/oeis/158/A158770.asm<gh_stars>1-10
; A158770: a(n) = 1521*n^2 - 39.
; 1482,6045,13650,24297,37986,54717,74490,97305,123162,152061,184002,218985,257010,298077,342186,389337,439530,492765,549042,608361,670722,736125,804570,876057,950586,1028157,1108770,1192425,1279122,1368861,1461642,1557465,1656330,1758237,1863186,1971177,2082210,2196285,2313402,2433561,2556762,2683005,2812290,2944617,3079986,3218397,3359850,3504345,3651882,3802461,3956082,4112745,4272450,4435197,4600986,4769817,4941690,5116605,5294562,5475561,5659602,5846685,6036810,6229977,6426186,6625437,6827730,7033065,7241442,7452861,7667322,7884825,8105370,8328957,8555586,8785257,9017970,9253725,9492522,9734361,9979242,10227165,10478130,10732137,10989186,11249277,11512410,11778585,12047802,12320061,12595362,12873705,13155090,13439517,13726986,14017497,14311050,14607645,14907282,15209961,15515682,15824445,16136250,16451097,16768986,17089917,17413890,17740905,18070962,18404061,18740202,19079385,19421610,19766877,20115186,20466537,20820930,21178365,21538842,21902361,22268922,22638525,23011170,23386857,23765586,24147357,24532170,24920025,25310922,25704861,26101842,26501865,26904930,27311037,27720186,28132377,28547610,28965885,29387202,29811561,30238962,30669405,31102890,31539417,31978986,32421597,32867250,33315945,33767682,34222461,34680282,35141145,35605050,36071997,36541986,37015017,37491090,37970205,38452362,38937561,39425802,39917085,40411410,40908777,41409186,41912637,42419130,42928665,43441242,43956861,44475522,44997225,45521970,46049757,46580586,47114457,47651370,48191325,48734322,49280361,49829442,50381565,50936730,51494937,52056186,52620477,53187810,53758185,54331602,54908061,55487562,56070105,56655690,57244317,57835986,58430697,59028450,59629245,60233082,60839961,61449882,62062845,62678850,63297897,63919986,64545117,65173290,65804505,66438762,67076061,67716402,68359785,69006210,69655677,70308186,70963737,71622330,72283965,72948642,73616361,74287122,74960925,75637770,76317657,77000586,77686557,78375570,79067625,79762722,80460861,81162042,81866265,82573530,83283837,83997186,84713577,85433010,86155485,86881002,87609561,88341162,89075805,89813490,90554217,91297986,92044797,92794650,93547545,94303482,95062461
mov $1,2
add $1,$0
mul $1,$0
mul $1,1521
add $1,1482
|
PRG/objects/7-1Maze.asm | narfman0/smb3_pp1 | 0 | 244938 | <filename>PRG/objects/7-1Maze.asm
.byte $01 ; Unknown purpose
.byte OBJ_FLYINGREDPARATROOPA, $09, $07
.byte OBJ_GREENTROOPA, $02, $10
.byte OBJ_GREENTROOPA, $04, $10
.byte OBJ_REDPIRANHA, $0E, $27
.byte OBJ_PIRANHASIDEWAYSRIGHT, $07, $2C
.byte OBJ_PIRANHASIDEWAYSLEFT, $0E, $2F
.byte OBJ_PIRANHASIDEWAYSLEFT, $0A, $33
.byte OBJ_REDTROOPA, $01, $36
.byte OBJ_FLYINGREDPARATROOPA, $04, $43
.byte OBJ_REDTROOPA, $0C, $48
.byte OBJ_REDTROOPA, $07, $57
.byte OBJ_REDPIRANHA, $08, $5E
.byte OBJ_PIRANHASIDEWAYSRIGHT, $02, $60
.byte OBJ_PIRANHASIDEWAYSLEFT, $08, $60
.byte OBJ_REDTROOPA, $03, $6D
.byte $FF ; Terminator
|
Driver/Printer/PrintCom/Graphics/graphicsCommon.asm | steakknife/pcgeos | 504 | 17222 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: common print routines
FILE: graphicsCommon.asm
AUTHOR: <NAME>
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 3/90 initial version
DESCRIPTION:
$Id: graphicsCommon.asm,v 1.1 97/04/18 11:51:23 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LoadSwathHeader
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Takes a HugeArray bitmap and loads it's bitmap header into
the PState
CALLED BY: PrintSwath
PASS: es - pointer to locked PState
dx.cx - VM file and block handle for HugeArray bitmap
RETURN: nothing
DESTROYED: ax
PSEUDO CODE/STRATEGY:
save the VM file handle
lock the VM block;
copy the header into into the PState;
unlock the block;
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 1/31/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LoadSwathHeader proc near
uses bx, di, ds, es, bp
.enter
mov es:[PS_bitmap].segment, dx ; store bitmap file and
mov es:[PS_bitmap].offset, cx ; block handle
mov bx, dx ; bx = file handle
mov ax, cx ; ax = dir block handle
call VMLock ; lock the HugeArray dir block
mov ds, ax ; ds -> HugeArray dir block
mov bx, size HugeArrayDirectory ; skip past dir header
mov ax, ds:[bx].B_width ; copy the elements
mov es:[PS_swath].B_width, ax
mov ax, ds:[bx].B_height
mov es:[PS_swath].B_height, ax
mov al, ds:[bx].B_type
mov es:[PS_swath].B_type, al
mov es:[PS_swath].B_compact, BMC_UNCOMPACTED
call VMUnlock ; release the VM block
.leave
ret
LoadSwathHeader endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DerefFirstScanline
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get pointer to first scan line of HugeBitmap
CALLED BY: PrintSwath
PASS: es - pointer to locked PState block
RETURN: ds:si - pointer to first scan line of the bitmap
adjusted for color number.
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
just use HugeArrayLock
KNOWN BUGS/SIDE EFFECTS/IDEAS:
stores the offset in the PState, for use later
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 2/ 3/92 Initial version
Dave 3/92 Initial version mods
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DerefFirstScanline proc near
uses ax, dx, bx, di, cx
.enter
clr ax
mov es:[PS_curScanNumber], ax ; save for later
mov es:[PS_newScanNumber], ax ; save for later
mov es:[PS_firstBlockScanNumber], ax ; init the block start
clr dx ; accessing scan line
mov bx, es:[PS_bitmap].segment ; load up VM file and
mov di, es:[PS_bitmap].offset ; block handle
call HugeArrayLock
mov es:[PS_curScanOffset],si ; save the beginning of the
; current scanline.
dec ax ; run to zero remaining instead
; of one.
mov es:[PS_lastBlockScanNumber],ax ;set up last scanline
.leave
ret
DerefFirstScanline endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DerefAScanline
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get pointer to a scan line of Locked HugeBitmap
CALLED BY: PrintSwath
PASS: es - pointer to locked PState block
PS_newScanNumber - scanline (element) number to deref.
RETURN: ds:si - pointer to a scan line of the bitmap
adjusted for color number.
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
just use HugeArrayLock
KNOWN BUGS/SIDE EFFECTS/IDEAS:
stores the offset in the PState, for use later
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DerefAScanline proc near
uses dx, bx, di, cx
.enter
mov ax,es:[PS_newScanNumber]
cmp ax,es:[PS_firstBlockScanNumber] ;see if the desired scan is
jb newBlock ;currently dereferenced HAB
cmp ax,es:[PS_lastBlockScanNumber]
jbe haveBlock
newBlock:
;must be in another block, dereference it.
mov si,es:[PS_curScanOffset] ;get index for current scan
call HugeArrayUnlock ;unlock the curent block.
;ax should hold the current scan line # to deref.
mov es:[PS_curScanNumber], ax ; save for later
clr dx ; accessing scan line
mov bx, es:[PS_bitmap].segment ; load up VM file and
mov di, es:[PS_bitmap].offset ; block handle
call HugeArrayLock
EC < or ax,ax >
EC < ERROR_Z DEREFERENCING_OFF_END_OF_BITMAP >
dec cx
dec ax ;get the end of the current
add ax,es:[PS_curScanNumber] ;block.
mov es:[PS_lastBlockScanNumber],ax
mov ax,es:[PS_curScanNumber] ;get the beginning of current
sub ax,cx ;block.
mov es:[PS_firstBlockScanNumber],ax
jmp haveScan
haveBlock:
mov si,es:[PS_curScanOffset]
mov bx,ax ;get the difference.
sub bx,es:[PS_curScanNumber] ;bx now is the number of
;scanlines to move for the next
;scanline.
jz haveScan
mov es:[PS_curScanNumber], ax ; save new scan number.
mov ax,es:[PS_bandBWidth] ;get the byte width of 1 color.
mov cl,es:[PS_swath].[B_type] ;see if its a color bitmap.
and cl,mask BM_FORMAT
cmp cl,BMF_MONO ;Monochrome?
je haveBWidth ;if so, then no adjustment.
cmp cl,BMF_4BIT ;Same goes for 4,8,24 bits
je haveBWidth
cmp cl,BMF_8BIT
je haveBWidth
cmp cl,BMF_24BIT
je haveBWidth
;assume 4 planes passed (even in 3CMY)
shl ax,2 ;now of all 4 colors.
EC< cmp cl,BMF_4CMYK >
EC< je haveBWidth >
EC< cmp cl,BMF_3CMY >
EC< ERROR_NE INVALID_MODE >
haveBWidth:
mul bx ;x scanline difference above.
add si,ax ;point at the beginning of the
;new scanline.
haveScan:
mov es:[PS_curScanOffset],si ; save the beginning of the
; current scanline.
mov cx,es:[PS_curColorNumber] ;set up the offset to CMYK col
jcxz exit
addLoop:
add si,es:[PS_bandBWidth]
loop addLoop ;add that # of widths
clc
exit:
.leave
ret
DerefAScanline endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrLoadPstateVars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
Take the device info table and load the bandHeight, and byteColumn
locations in the PSTATE.
CALLED BY:
Internal
PASS:
es - Segment of PSTATE
RETURN:
cx - number of integral bands in this swath.
dx - number of scanlines left over
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 02/90 Initial version
Dave 03/92 Added swath geometry calculation to end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrLoadPstateVars proc near
uses ax, ds, si, bx
.enter
mov bx,es:[PS_deviceInfo] ;handle for this printer resource.
push bx ;save printer resource handle.
call MemLock ;
mov ds,ax ;get segment address of print resource.
mov al,es:[PS_mode] ;get the mode for this document.
EC< cmp al,PM_GRAPHICS_HI_RES ;see if its a graphic mode.>
EC< ERROR_A INVALID_MODE >
clr ah ;set up for index.
mov si,ax ;into index reg.
mov si,ds:[PI_firstMode][si] ;get index for table of info for this
;mode.
EC< tst si ;see if feature not supported. >
EC< ERROR_Z FEATURE_NOT_SUPPORTED >
clr ah
mov al,ds:[si][GP_bandHeight] ;get the size of the print data for
mov es:[PS_bandHeight],ax
mov al,ds:[si][GP_buffHeight] ;get the size of the band buffer
mov es:[PS_buffHeight],ax
mov al,ds:[si][GP_interleaveFactor] ;get the number of
; interleaves
mov es:[PS_interleaveFactor],ax
pop bx
call MemUnlock ;unlock the printer info resource.
; get width, and calculate byte width of bitmap
mov ax, es:[PS_swath].B_width
mov bx, ax ;assume 8-bit bitmap
mov cl,es:[PS_swath].[B_type] ;see what kind of bitmap.
and cl,mask BM_FORMAT
cmp cl,BMF_8BIT ;8-bit or 24-bit?
je noRounding ;if so, then don't round.
cmp cl,BMF_24BIT
je noRounding
cmp cl,BMF_4BIT ;4-bit rounds by nibbles
jne not4bit
inc ax ; round up to next byte boundary
and al, 0xfe
jmp noRounding
not4bit: ;all other formats:
add ax, 7 ; round up to next byte boundary
and al, 0xf8
noRounding:
mov es:[PS_bandWidth], ax ; load the dot width.
cmp cl,BMF_8BIT ;8-bit:
je setBWidth ; byte width = dot width
cmp cl,BMF_24BIT ;24-bit:
jne not24bit
mov cx, ax ; byte width = 3 * dot width
add ax, ax
add ax, cx
jmp setBWidth
not24bit:
cmp cl,BMF_4BIT ;4-bit:
jne mustBeOneBit
shr ax, 1 ; byte width = dot width / 2
jmp setBWidth
mustBeOneBit: ;all other formats are 1-bit:
mov cl, 3 ; divide by 8....
shr ax, cl ; to obtain the byte width.
setBWidth:
mov es:[PS_bandBWidth], ax
; calculate the #bands
mov ax,es:[PS_swath].B_height ; get the height of bitmap.
clr dx ; dx:ax = divisor
div es:[PS_bandHeight] ;get number of bands in this
mov cx,ax ;swath for counter.
; dx has remainder of division
; this is the #scans
.leave
ret
PrLoadPstateVars endp
|
programs/oeis/052/A052343.asm | neoneye/loda | 22 | 9977 | <reponame>neoneye/loda
; A052343: Number of ways to write n as the unordered sum of two triangular numbers (zero allowed).
; 1,1,1,1,1,0,2,1,0,1,1,1,1,1,0,1,2,0,1,0,1,2,1,0,1,1,0,1,1,1,1,2,0,0,1,0,2,1,1,1,0,0,2,1,0,1,2,0,1,1,0,2,0,0,0,2,2,1,1,0,1,1,0,0,1,1,2,1,0,1,1,0,2,1,0,0,2,0,1,1,0,3,0,1,1,0,0,1,1,0,1,2,1,1,2,0,0,1,0,1
seq $0,8441 ; Number of ways of writing n as the sum of 2 triangular numbers.
mov $2,$0
add $2,1
div $2,2
mov $0,$2
|
test/Fail/Issue755.agda | shlevy/agda | 1,989 | 6639 | -- {-# OPTIONS -v tc.polarity:10 -v tc.conv.elim:25 #-}
module Issue755 where
open import Common.Prelude renaming (Nat to ℕ)
open import Common.Equality
abstract
foo : Bool → ℕ → ℕ
foo true x = 0
foo false x = 0
-- should work
works : ∀{b} → foo b 0 ≡ foo b 1 → foo b 0 ≡ foo b 1
works refl = refl
-- should fail
test : ∀{b} → foo b 0 ≡ foo b 1 → foo b 0 ≡ foo b 1
test refl = refl
-- 0 != 1 of type ℕ
-- when checking that the pattern refl has type foo 0 ≡ foo 1
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/array28_pkg.adb | best08618/asylo | 7 | 21837 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/array28_pkg.adb
package body Array28_Pkg is
function F return Inner_Type is
begin
return "12345";
end;
end Array28_Pkg;
|
data/wildPokemon/route11.asm | etdv-thevoid/pokemon-rgb-enhanced | 1 | 245147 | Route11Mons:
db $0F
IF DEF(_RED)
db 14,EKANS
db 15,SPEAROW
db 12,EKANS
db 9,DROWZEE
db 13,SPEAROW
db 13,DROWZEE
db 15,EKANS
db 17,SPEAROW
db 11,DROWZEE
db 15,DROWZEE
ENDC
IF DEF(_GREEN)
db 14,SANDSHREW
db 15,SPEAROW
db 12,SANDSHREW
db 9,DROWZEE
db 13,SPEAROW
db 13,DROWZEE
db 15,SANDSHREW
db 17,SPEAROW
db 11,DROWZEE
db 15,DROWZEE
ENDC
IF DEF(_BLUE)
db 14,SANDSHREW
db 15,SPEAROW
db 12,SANDSHREW
db 9,DROWZEE
db 13,SPEAROW
db 13,DROWZEE
db 15,SANDSHREW
db 17,SPEAROW
db 11,DROWZEE
db 15,DROWZEE
ENDC
db $05
db 15,TENTACOOL
db 10,TENTACOOL
db 15,TENTACOOL
db 10,TENTACOOL
db 15,TENTACOOL
db 20,TENTACOOL
db 25,TENTACOOL
db 30,TENTACRUEL
db 35,TENTACRUEL
db 40,TENTACRUEL
|
src/keystore-passwords-gpg.adb | thierr26/ada-keystore | 0 | 15780 | <gh_stars>0
-----------------------------------------------------------------------
-- keystore-passwords-gpg -- Password protected by GPG
-- Copyright (C) 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Ada.Exceptions;
with Ada.Strings.Fixed;
with GNAT.Regpat;
with Util.Streams;
with Util.Log.Loggers;
with Util.Encoders;
with Util.Processes;
with Util.Streams.Texts;
with Keystore.Random;
-- === GPG Header data ===
--
-- The GPG encrypted data contains the following information:
-- ```
-- +------------------+-----
-- | TAG | 4b
-- +------------------+-----
-- | Lock Key | 32b
-- | Lock IV | 16b
-- | Wallet Key | 32b
-- | Wallet IV | 16b
-- | Wallet Sign | 32b
-- +------------------+-----
-- ```
package body Keystore.Passwords.GPG is
use Ada.Streams;
use Ada.Strings.Unbounded;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.Passwords.GPG");
function Get_Le_Long (Data : in Ada.Streams.Stream_Element_Array)
return Interfaces.Unsigned_32;
function Get_Unsigned_32 (Data : in Stream_Element_Array) return Interfaces.Unsigned_32;
procedure Put_Unsigned_32 (Data : out Stream_Element_Array;
Value : in Interfaces.Unsigned_32);
-- Headers of GPG packet.
GPG_OLD_TAG_1 : constant Ada.Streams.Stream_Element := 16#85#;
GPG_NEW_VERSION : constant Ada.Streams.Stream_Element := 16#03#;
function Get_Unsigned_32 (Data : in Stream_Element_Array) return Interfaces.Unsigned_32 is
use Interfaces;
begin
return Shift_Left (Unsigned_32 (Data (Data'First)), 24) or
Shift_Left (Unsigned_32 (Data (Data'First + 1)), 16) or
Shift_Left (Unsigned_32 (Data (Data'First + 2)), 8) or
Unsigned_32 (Data (Data'First + 3));
end Get_Unsigned_32;
procedure Put_Unsigned_32 (Data : out Stream_Element_Array;
Value : in Interfaces.Unsigned_32) is
use Interfaces;
begin
Data (Data'First) := Stream_Element (Shift_Right (Value, 24));
Data (Data'First + 1) := Stream_Element (Shift_Right (Value, 16) and 16#0ff#);
Data (Data'First + 2) := Stream_Element (Shift_Right (Value, 8) and 16#0ff#);
Data (Data'First + 3) := Stream_Element (Value and 16#0ff#);
end Put_Unsigned_32;
function Get_Le_Long (Data : in Ada.Streams.Stream_Element_Array)
return Interfaces.Unsigned_32 is
use Interfaces;
begin
return Shift_Left (Unsigned_32 (Data (Data'First)), 24) or
Shift_Left (Unsigned_32 (Data (Data'First + 1)), 16) or
Shift_Left (Unsigned_32 (Data (Data'First + 2)), 8) or
Unsigned_32 (Data (Data'First + 3));
end Get_Le_Long;
-- ------------------------------
-- Extract the Key ID from the data content when it is encrypted by GPG2.
-- ------------------------------
function Extract_Key_Id (Data : in Ada.Streams.Stream_Element_Array) return String is
L1 : Interfaces.Unsigned_32;
L2 : Interfaces.Unsigned_32;
Encode : constant Util.Encoders.Encoder := Util.Encoders.Create ("hex");
begin
if Data'Length < 16 then
return "";
end if;
if Data (Data'First + 4) /= GPG_OLD_TAG_1 then
return "";
end if;
if Data (Data'First + 7) /= GPG_NEW_VERSION then
return "";
end if;
if Data (Data'First + 5) > 4 then
return "";
end if;
L1 := Get_Le_Long (Data (Data'First + 4 + 4 .. Data'Last));
L2 := Get_Le_Long (Data (Data'First + 8 + 4 .. Data'Last));
return Encode.Encode_Unsigned_32 (L1) & Encode.Encode_Unsigned_32 (L2);
end Extract_Key_Id;
-- ------------------------------
-- Get the list of GPG secret keys that could be capable for decrypting a content for us.
-- ------------------------------
procedure List_GPG_Secret_Keys (Context : in out Context_Type;
List : in out Util.Strings.Sets.Set) is
procedure Parse (Line : in String);
-- GPG2 command output:
-- ssb:u:<key-size>:<key-algo>:<key-id>:<create-date>:<expire-date>:::::<e>:
REGEX2 : constant String
:= "^(ssb|sec):u?:[1-9][0-9][0-9][0-9]:[0-9]:([0-9a-fA-F]+):[0-9]+:[0-9]*:::::[esa]+::.*";
-- GPG1 command output:
-- ssb::<key-size>:<key-algo>:<key-id>:<create-date>:<expire-date>:::::<e>:
REGEX1 : constant String
:= "^(ssb|sec):u?:[1-9][0-9][0-9][0-9]:[0-9]:([0-9a-fA-F]+):[0-9-]+:[0-9-]*:::::.*";
Pattern1 : constant GNAT.Regpat.Pattern_Matcher := GNAT.Regpat.Compile (REGEX1);
Pattern2 : constant GNAT.Regpat.Pattern_Matcher := GNAT.Regpat.Compile (REGEX2);
procedure Parse (Line : in String) is
Matches : GNAT.Regpat.Match_Array (0 .. 2);
begin
if GNAT.Regpat.Match (Pattern1, Line) then
GNAT.Regpat.Match (Pattern1, Line, Matches);
List.Include (Line (Matches (2).First .. Matches (2).Last));
elsif GNAT.Regpat.Match (Pattern2, Line) then
GNAT.Regpat.Match (Pattern2, Line, Matches);
List.Include (Line (Matches (2).First .. Matches (2).Last));
end if;
exception
when others =>
Log.Debug ("Unkown line: {0}", Line);
end Parse;
Command : constant String := To_String (Context.List_Key_Command);
Proc : Util.Processes.Process;
Output : Util.Streams.Input_Stream_Access;
Input : Util.Streams.Output_Stream_Access;
Reader : Util.Streams.Texts.Reader_Stream;
begin
Log.Info ("Looking for GPG secrets using {0}", Command);
Util.Processes.Spawn (Proc => Proc,
Command => Command,
Mode => Util.Processes.READ_WRITE_ALL);
Input := Util.Processes.Get_Input_Stream (Proc);
Output := Util.Processes.Get_Output_Stream (Proc);
Reader.Initialize (Output, 4096);
Input.Close;
while not Reader.Is_Eof loop
declare
Line : Ada.Strings.Unbounded.Unbounded_String;
begin
Reader.Read_Line (Line);
Parse (To_String (Line));
end;
end loop;
Util.Processes.Wait (Proc);
if Util.Processes.Get_Exit_Status (Proc) /= 0 then
Log.Warn ("GPG list command '{0}' terminated with exit code{1}", Command,
Natural'Image (Util.Processes.Get_Exit_Status (Proc)));
end if;
exception
when E : Util.Processes.Process_Error =>
Log.Warn ("Cannot execute GPG command '{0}': {1}",
Command, Ada.Exceptions.Exception_Message (E));
end List_GPG_Secret_Keys;
-- ------------------------------
-- Create a secret to protect the keystore.
-- ------------------------------
procedure Create_Secret (Context : in out Context_Type;
Data : in Ada.Streams.Stream_Element_Array) is
P : Secret_Provider_Access;
Tag : constant Tag_Type := Get_Unsigned_32 (Data);
begin
P := new Secret_Provider '(Tag => Tag,
Next => Context.First,
others => <>);
Context.First := P;
Util.Encoders.Create (Data (POS_LOCK_KEY .. POS_LOCK_KEY_LAST), P.Key);
Util.Encoders.Create (Data (POS_LOCK_IV .. POS_LOCK_IV_LAST), P.IV);
Context.Current := P;
end Create_Secret;
-- ------------------------------
-- Create a secret to protect the keystore.
-- ------------------------------
procedure Create_Secret (Context : in out Context_Type) is
Rand : Keystore.Random.Generator;
begin
Rand.Generate (Context.Data);
Context.Create_Secret (Context.Data);
end Create_Secret;
procedure Create_Secret (Context : in out Context_Type;
Image : in Context_Type'Class) is
begin
Context.Encrypt_Command := Image.Encrypt_Command;
Context.Decrypt_Command := Image.Decrypt_Command;
Context.List_Key_Command := Image.List_Key_Command;
Context.Create_Secret;
Context.Data (POS_WALLET_KEY .. POS_WALLET_SIGN_LAST)
:= Image.Data (POS_WALLET_KEY .. POS_WALLET_SIGN_LAST);
end Create_Secret;
procedure Create_Secret (Context : in out Context_Type;
Key_Provider : in Keys.Key_Provider'Class) is
begin
Context.Create_Secret;
if Key_Provider in Keystore.Passwords.Internal_Key_Provider'Class then
Keystore.Passwords.Internal_Key_Provider'Class (Key_Provider).Save_Key
(Context.Data (POS_WALLET_KEY .. POS_WALLET_SIGN_LAST));
end if;
end Create_Secret;
-- ------------------------------
-- Save the GPG secret by encrypting it using the user's GPG key and storing
-- the encrypted data in the keystore data header.
-- ------------------------------
procedure Save_Secret (Context : in out Context_Type;
User : in String;
Index : in Keystore.Header_Slot_Index_Type;
Wallet : in out Keystore.Files.Wallet_File) is
Cmd : constant String := Context.Get_Encrypt_Command (User);
Proc : Util.Processes.Process;
Result : Ada.Streams.Stream_Element_Array (1 .. MAX_ENCRYPT_SIZE);
Last : Ada.Streams.Stream_Element_Offset := 0;
Last2 : Ada.Streams.Stream_Element_Offset;
Input : Util.Streams.Output_Stream_Access;
Output : Util.Streams.Input_Stream_Access;
begin
Log.Info ("Encrypt GPG secret using {0}", Cmd);
Put_Unsigned_32 (Result, Context.Current.Tag);
Last := 4;
Util.Processes.Spawn (Proc => Proc,
Command => Cmd,
Mode => Util.Processes.READ_WRITE_ALL);
Input := Util.Processes.Get_Input_Stream (Proc);
Input.Write (Context.Data (POS_LOCK_KEY .. Context.Data'Last));
Input.Close;
Output := Util.Processes.Get_Output_Stream (Proc);
while Last < Result'Last loop
Output.Read (Result (Last + 1 .. Result'Last), Last2);
exit when Last2 = Last;
Last := Last2;
end loop;
Util.Processes.Wait (Proc);
if Util.Processes.Get_Exit_Status (Proc) /= 0 or Last <= 4 then
Log.Warn ("GPG encrypt command '{0}' terminated with exit code{1}", Cmd,
Natural'Image (Util.Processes.Get_Exit_Status (Proc)));
raise Keystore.Bad_Password;
end if;
Keystore.Files.Set_Header_Data (Wallet, Index,
Keystore.SLOT_KEY_GPG2, Result (1 .. Last));
Context.Index := Context.Index + 1;
exception
when E : Util.Processes.Process_Error =>
Log.Warn ("Cannot execute GPG encrypt command '{0}': {1}",
Cmd, Ada.Exceptions.Exception_Message (E));
raise Keystore.Bad_Password;
end Save_Secret;
-- ------------------------------
-- Load the GPG secrets stored in the keystore header.
-- ------------------------------
procedure Load_Secrets (Context : in out Context_Type;
Wallet : in out Keystore.Files.Wallet_File) is
Data : Ada.Streams.Stream_Element_Array (1 .. MAX_ENCRYPT_SIZE);
Last : Ada.Streams.Stream_Element_Offset;
Kind : Keystore.Header_Slot_Type;
List : Util.Strings.Sets.Set;
begin
-- Get the list of known secret keys.
Context.List_GPG_Secret_Keys (List);
for Index in Header_Slot_Index_Type'Range loop
Wallet.Get_Header_Data (Index, Kind, Data, Last);
exit when Last < Data'First;
if Kind = Keystore.SLOT_KEY_GPG2 then
declare
Key_Id : constant String := Extract_Key_Id (Data (Data'First .. Last));
begin
if List.Contains (Key_Id) then
Context.Decrypt_GPG_Secret (Data (Data'First .. Last));
exit when Context.Valid_Key;
end if;
end;
end if;
end loop;
Context.Current := Context.First;
end Load_Secrets;
-- ------------------------------
-- Get the password through the Getter operation.
-- ------------------------------
overriding
procedure Get_Password (From : in Context_Type;
Getter : not null
access procedure (Password : in Secret_Key)) is
begin
Getter (From.Current.Key);
end Get_Password;
-- ------------------------------
-- Get the key and IV through the Getter operation.
-- ------------------------------
overriding
procedure Get_Key (From : in Context_Type;
Getter : not null
access procedure (Key : in Secret_Key;
IV : in Secret_Key)) is
begin
Getter (From.Current.Key, From.Current.IV);
end Get_Key;
-- ------------------------------
-- Get the Key, IV and signature.
-- ------------------------------
overriding
procedure Get_Keys (From : in Context_Type;
Key : out Secret_Key;
IV : out Secret_Key;
Sign : out Secret_Key) is
begin
Util.Encoders.Create (From.Data (POS_WALLET_KEY .. POS_WALLET_KEY_LAST), Key);
Util.Encoders.Create (From.Data (POS_WALLET_IV .. POS_WALLET_IV_LAST), IV);
Util.Encoders.Create (From.Data (POS_WALLET_SIGN .. POS_WALLET_SIGN_LAST), Sign);
end Get_Keys;
-- ------------------------------
-- Get the key slot number associated with the GPG password.
-- ------------------------------
overriding
function Get_Tag (From : in Context_Type) return Tag_Type is
begin
return From.Current.Tag;
end Get_Tag;
-- ------------------------------
-- Returns true if the provider has a GPG password.
-- ------------------------------
overriding
function Has_Password (From : in Context_Type) return Boolean is
begin
return From.Current /= null;
end Has_Password;
-- ------------------------------
-- Move to the next GPG password.
-- ------------------------------
overriding
procedure Next (From : in out Context_Type) is
begin
From.Current := From.Current.Next;
end Next;
-- ------------------------------
-- Get the command to encrypt the secret for the given GPG user/keyid.
-- ------------------------------
function Get_Encrypt_Command (Context : in Context_Type;
User : in String) return String is
use Ada.Strings.Fixed;
USER_LABEL : constant String := "$USER";
Cmd : constant String := To_String (Context.Encrypt_Command);
Result : Unbounded_String;
First : Positive := Cmd'First;
Pos : Natural;
begin
loop
Pos := Index (Cmd, USER_LABEL, First);
if Pos = 0 then
Append (Result, Cmd (First .. Cmd'Last));
return To_String (Result);
end if;
Append (Result, Cmd (First .. Pos - 1));
Append (Result, User);
First := Pos + USER_LABEL'Length;
end loop;
end Get_Encrypt_Command;
-- ------------------------------
-- Decrypt the data array that was encrypted using GPG2.
-- ------------------------------
procedure Decrypt_GPG_Secret (Context : in out Context_Type;
Data : in Ada.Streams.Stream_Element_Array) is
Proc : Util.Processes.Process;
Last : Ada.Streams.Stream_Element_Offset := 0;
Last2 : Ada.Streams.Stream_Element_Offset;
Cmd : constant String := To_String (Context.Decrypt_Command);
Status : Natural;
begin
Log.Info ("Decrypt GPG secret using {0}", Cmd);
Context.Data (POS_TAG .. POS_TAG_LAST) := Data (Data'First .. Data'First + 3);
Last := POS_TAG_LAST;
Util.Processes.Spawn (Proc => Proc,
Command => Cmd,
Mode => Util.Processes.READ_WRITE_ALL);
Util.Processes.Get_Input_Stream (Proc).Write (Data (POS_LOCK_KEY .. Data'Last));
Util.Processes.Get_Input_Stream (Proc).Close;
while Last < Context.Data'Last loop
Util.Processes.Get_Output_Stream (Proc).Read
(Context.Data (Last + 1 .. Context.Data'Last), Last2);
exit when Last2 = Last;
Last := Last2;
end loop;
Util.Processes.Wait (Proc);
Status := Util.Processes.Get_Exit_Status (Proc);
Context.Valid_Key := Status = 0 and Last > 4;
if Context.Valid_Key then
Context.Create_Secret (Context.Data);
elsif Status /= 0 then
Log.Warn ("GPG decrypt command '{0}' terminated with exit code{1}", Cmd,
Natural'Image (Status));
end if;
Context.Data (POS_TAG .. POS_LOCK_IV_LAST) := (others => 0);
exception
when E : Util.Processes.Process_Error =>
Log.Warn ("Cannot execute GPG decrypt command '{0}': {1}",
Cmd, Ada.Exceptions.Exception_Message (E));
Context.Valid_Key := False;
end Decrypt_GPG_Secret;
-- ------------------------------
-- Setup the command to be executed to encrypt the secret with GPG2.
-- ------------------------------
procedure Set_Encrypt_Command (Into : in out Context_Type;
Command : in String) is
begin
Into.Encrypt_Command := To_Unbounded_String (Command);
end Set_Encrypt_Command;
-- ------------------------------
-- Setup the command to be executed to decrypt the secret with GPG2.
-- ------------------------------
procedure Set_Decrypt_Command (Into : in out Context_Type;
Command : in String) is
begin
Into.Decrypt_Command := To_Unbounded_String (Command);
end Set_Decrypt_Command;
-- ------------------------------
-- Setup the command to be executed to get the list of available GPG secret keys.
-- ------------------------------
procedure Set_List_Key_Command (Into : in out Context_Type;
Command : in String) is
begin
Into.List_Key_Command := To_Unbounded_String (Command);
end Set_List_Key_Command;
overriding
procedure Initialize (Context : in out Context_Type) is
begin
Context.Encrypt_Command := To_Unbounded_String (ENCRYPT_COMMAND);
Context.Decrypt_Command := To_Unbounded_String (DECRYPT_COMMAND);
Context.List_Key_Command := To_Unbounded_String (LIST_COMMAND);
end Initialize;
overriding
procedure Finalize (Context : in out Context_Type) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => Secret_Provider,
Name => Secret_Provider_Access);
begin
Context.Data := (others => 0);
while Context.First /= null loop
Context.Current := Context.First.Next;
Free (Context.First);
Context.First := Context.Current;
end loop;
end Finalize;
end Keystore.Passwords.GPG;
|
programs/oeis/063/A063498.asm | neoneye/loda | 22 | 171438 | <reponame>neoneye/loda
; A063498: Atoms in cluster of n layers around C_60.
; 0,32,104,236,448,760,1192,1764,2496,3408,4520,5852,7424,9256,11368,13780,16512,19584,23016,26828,31040,35672,40744,46276,52288,58800,65832,73404,81536,90248,99560,109492,120064,131296,143208,155820,169152,183224,198056,213668,230080,247312,265384,284316,304128,324840,346472,369044,392576,417088,442600,469132,496704,525336,555048,585860,617792,650864,685096,720508,757120,794952,834024,874356,915968,958880,1003112,1048684,1095616,1143928,1193640,1244772,1297344,1351376,1406888,1463900,1522432,1582504,1644136,1707348,1772160,1838592,1906664,1976396,2047808,2120920,2195752,2272324,2350656,2430768,2512680,2596412,2681984,2769416,2858728,2949940,3043072,3138144,3235176,3334188
mov $3,$0
seq $0,167875 ; One third of product plus sum of three consecutive nonnegative integers; a(n)=(n+1)(n^2+2n+3)/3.
add $1,$0
mul $1,11
mov $2,$3
sub $3,$0
add $3,$2
add $1,$3
sub $1,10
div $1,4
mul $1,4
mov $0,$1
|
map.asm | MohammedAlsayedOmar/Multiplayer-Snake | 0 | 1075 | <filename>map.asm
assume CS:Code_segment_name,DS:Data_segment_name
;COMMENT FOR MUSGI .. EL BETA3A EL SAHLA -
Main2 proc far
mov[inMain],0
mov [obstcales],50
mov [mode],0
call far ptr clearscreenm
call far ptr drawlinem
call far ptr setcruser
Bonus:
;===========
call far ptr Recieve1
cmp [Sentdata],3bh
jne contenu
mov [Sentdata],0
;else print you have been invited
;setCurser
mov bh,0
mov dl,0 ;col zero
mov dh,23 ;row 23
mov ah,2h
int 10h
;print
lea dx,GuestName+2 ;load $
mov ah,9
int 21h
lea dx,GuestDesign ;load $
mov ah,9
int 21h
;setCur Back
mov bh,0
mov dl, byte ptr(col) ;col zero
mov dh,byte ptr(row) ;row 23
mov ah,2h
int 10h
contenu:
mov ah,1
int 16h
jz Bonus
;===========================
call far ptr getinput
cmp al,1bh;quit (esq)
je endmd
call far ptr checkinput
call far ptr setcruser
cmp mode,1 ; drawing obstacles
je draww
cmp mode,2
je savem
cmp mode,3
je loadm
cmp mode,4
je deleteobstt
jmp Bonus
draww:
call far ptr drawobst
jmp Bonus
savem:
call far ptr savemap
mov mode,0 ; reset the mode
mov base,0
jmp Bonus
loadm:
mov [obstcales],50d
call far ptr loadmap
mov mode,0 ; reset the mode
mov temp ,0
jmp Bonus
deleteobstt:
call far ptr deletobst
mov mode,0
jmp Bonus
endmd:
mov [Sentdata],'q' ;send q because escape exit prog
call far ptr Send1
call far ptr clearscreenm
retf
Main2 endp
clearscreenm proc near
mov ax,0003h
int 10h
retf
clearscreenm endp
setcruser proc near
mov AH, 02h
mov bh,0
mov DH,byte ptr(row) ;y
mov DL,byte ptr(col) ;x
int 10h
retf
setcruser endp
getinput proc near
mov ax,0
int 16h
retf
getinput endp
checkinput proc near
cmp ax, 4800h ;UP.
je arrow_up
cmp ax, 5000h ;DOWN.
je arrow_down
cmp ax, 4B00h ;LEFT.
je arrow_left
cmp ax, 4D00h ;RIGHT.
je arrow_right
cmp al,73h ;save map (s)
je savmap
cmp al,6ch ;load map (L)
je loamap
cmp al,70h ;print mode obst (p)
je changemode
cmp al,64h ;delete d
je deletemode
jmp endddd
arrow_up:
cmp row,0
je rowend
sub [row],1
retf
arrow_down:
cmp row,20
je rowstart
add [row],1
retf
arrow_left:
cmp col,0
je colright
sub [col],1
retf
arrow_right:
cmp col,79
je colleft
add [col],1
retf
deletemode:
mov [mode],4
retf
changemode:
cmp mode,0
je change
mov [mode],0
retf
change:
mov [mode],1
retf
rowend:
mov [row],20
retf
rowstart:
mov row,0
retf
colright:
mov col,79
retf
colleft:
mov col,0
retf
savmap:
mov mode,2
retf
loamap:
mov [mode],3
retf
endddd:
retf
checkinput endp
drawobst proc near
cmp obstcales,0
je NoMore
mov ah,08h ;to check if we are making obstcale above each other
int 10h
cmp ah,77h ;compare the returned att with the att
je NoMore
mov ax,row
mov bl,80
mul bl
add ax,col
mov bx,ax
mov map[bx],31h
mov al,20h
mov bh,0
mov bl,77h
mov cx,1
mov ah,9
int 10h
sub [obstcales],1
NoMore:
retf
drawobst endp
checkobst proc near
mov ax,0000
mov ax,row
mov bl,80
mul bl
add ax,col
mov bx,ax
cmp map[bx],31h
je No
mov bx,0
retf
No:
mov bx,1
retf
checkobst endp
deletobst proc near
mov ax,0000
mov ax,row
mov bl,80
mul bl
add ax,col
mov bx,ax
cmp map[bx],31h
jne quitsx
mov map[bx],30h
add [obstcales],1
call far ptr setcruser
mov al,20h
mov bh,0
mov bl,07h
mov cx,1
mov ah,9
int 10h
quitsx:
retf
deletobst endp
drawlinem proc near
mov cx,80
mov ax,0b800h
mov es,ax
mov di,21*160
draw:
lea si,split
movsw
loop draw
retf
drawlinem endp
openfileSL proc near
cmp al,31h
je saveto1
cmp al,32h
je saveto2
cmp al,33h
je saveto3
jmp retttt
saveto1:
lea dx,filename1
jmp openSl
saveto2:
lea dx,filename2
jmp openSl
saveto3:
lea dx,filename3
openSl:
mov ah,3dh ;opening file
mov al,2 ;2 read/write
int 21h
jc ERROROPENs;jump if there is carry (carry=error)
mov fileHandle,ax ;store ax in file handle
retf
ERROROPENs:
lea dx,err
mov ah,09
int 21h
retttt:
retf
openfileSL endp
readfilesl proc near
mov dx,offset map
mov [temp],0
ReadBytess:
mov ah,3fh ;read from file
mov bx,fileHandle
mov cx,1
int 21h
jc ERRORREADs
mov cx,1
cmp ax,cx
jne EndOfFiles
mov bx,temp
cmp map[bx],31h
jne check0s
cmp obstcales,0
je reto
sub obstcales,1
add [temp],1
inc dx
jmp ReadBytess
check0s:
cmp map[bx],30h
jne EndOfFiles
add [temp],1
inc dx
jmp ReadBytess
ERRORREADs:
lea dx,errR
mov ah,09
int 21h
retf
EndOfFiles: ;Close File
mov bx,fileHandle
mov ah,3eh ;close file
int 21h
reto:
retf
readfilesl endp
savemap proc near
;set curser
mov ah,02h
mov bh,0
mov dh,22 ;y
mov dl,0 ;x
int 10h
;print save msg
lea dx,savestate
mov ah,09h
int 21h
call far ptr getinput
call far ptr openfileSL
;writing to file
writefile:
cmp base,1680
je quit
mov bx,base
cmp map[bx],30h
je setdx0
lea dx,map1
jmp write
setdx0:
lea dx,map0
write:
mov AH,40h
mov BX ,fileHandle
mov CX,1
int 21h
add [base],1
jmp writefile
quit:
mov bx,fileHandle
mov ah,3eh ;close file
int 21h
;clear notif area
mov ah,02h
mov bh,0
mov dh,22 ;y
mov dl,0 ;x
int 10h
;print save msg
lea dx,clear
mov ah,09h
int 21h
call far ptr setcruser
retf
savemap endp
loadmap proc near
mov ah,02h
mov bh,0
mov dh,22 ;y
mov dl,0 ;x
int 10h
;print save msg
lea dx,loadstate
mov ah,09h
int 21h
call far ptr getinput
call far ptr openfileSL
call far ptr readfilesl
call far ptr drawmapM
mov ah,02h
mov bh,0
mov dh,22 ;y
mov dl,0 ;x
int 10h
;print save msg
lea dx,clear
mov ah,09h
int 21h
call far ptr setcruser
retf
loadmap endp
|
programs/oeis/256/A256322.asm | jmorken/loda | 1 | 178279 | <reponame>jmorken/loda
; A256322: Number of partitions of 7n into exactly 3 parts.
; 0,4,16,37,65,102,147,200,261,331,408,494,588,690,800,919,1045,1180,1323,1474,1633,1801,1976,2160,2352,2552,2760,2977,3201,3434,3675,3924,4181,4447,4720,5002,5292,5590,5896,6211,6533,6864,7203,7550,7905,8269,8640,9020,9408,9804,10208,10621,11041,11470,11907,12352,12805,13267,13736,14214,14700,15194,15696,16207,16725,17252,17787,18330,18881,19441,20008,20584,21168,21760,22360,22969,23585,24210,24843,25484,26133,26791,27456,28130,28812,29502,30200,30907,31621,32344,33075,33814,34561,35317,36080,36852,37632,38420,39216,40021,40833,41654,42483,43320,44165,45019,45880,46750,47628,48514,49408,50311,51221,52140,53067,54002,54945,55897,56856,57824,58800,59784,60776,61777,62785,63802,64827,65860,66901,67951,69008,70074,71148,72230,73320,74419,75525,76640,77763,78894,80033,81181,82336,83500,84672,85852,87040,88237,89441,90654,91875,93104,94341,95587,96840,98102,99372,100650,101936,103231,104533,105844,107163,108490,109825,111169,112520,113880,115248,116624,118008,119401,120801,122210,123627,125052,126485,127927,129376,130834,132300,133774,135256,136747,138245,139752,141267,142790,144321,145861,147408,148964,150528,152100,153680,155269,156865,158470,160083,161704,163333,164971,166616,168270,169932,171602,173280,174967,176661,178364,180075,181794,183521,185257,187000,188752,190512,192280,194056,195841,197633,199434,201243,203060,204885,206719,208560,210410,212268,214134,216008,217891,219781,221680,223587,225502,227425,229357,231296,233244,235200,237164,239136,241117,243105,245102,247107,249120,251141,253171
mov $4,$0
lpb $0
trn $0,4
add $1,$0
sub $0,2
add $1,1
lpe
mov $3,$4
mov $5,$4
lpb $3
sub $3,1
add $6,$5
lpe
mov $2,4
mov $5,$6
lpb $2
add $1,$5
sub $2,1
lpe
|
DynTheory.agda | msullivan/godels-t | 4 | 11423 | <filename>DynTheory.agda
module DynTheory where
open import Prelude
open import T
---- Some theory about the dynamic semantics
module DynTheory where
-- prove some obvious theorems about iterated stepping
-- transitivity (which makes sense, given that it is the transitive closure)
eval-trans : ∀{A} {e e' e'' : TCExp A} →
e ~>* e' → e' ~>* e'' → e ~>* e''
eval-trans eval-refl E2 = E2
eval-trans (eval-cons S1 E1') E2 = eval-cons S1 (eval-trans E1' E2)
-- prove that we can life any compatibility rule from steps to eval
eval-compat : ∀{A B} {P : TCExp A -> TCExp B} →
(∀{e e'} → (e ~> e' → P e ~> P e')) →
{e e' : TCExp A} → e ~>* e' → P e ~>* P e'
eval-compat f eval-refl = eval-refl
eval-compat f (eval-cons S1 D) = eval-cons (f S1) (eval-compat f D)
-- Lemma we need to prove determism
not-val-and-step : ∀{C : Set} {A : TTp} {e e' : TCExp A} →
TVal e → e ~> e' →
C
not-val-and-step val-zero ()
not-val-and-step val-lam ()
not-val-and-step (val-suc v) (step-suc S1) = not-val-and-step v S1
-- Show that the dynamic semantics are a function
step-deterministic : ∀{A} → (e : TCExp A) → {e' e'' : TCExp A} →
e ~> e' → e ~> e'' ->
e' ≡ e''
-- Trivial contradictory cases
step-deterministic (var x) () S2
step-deterministic (Λ e) () S2
step-deterministic zero () S2
step-deterministic (Λ e $ e') step-beta (step-app-l ())
step-deterministic (Λ e $ e') (step-app-l ()) step-beta
step-deterministic (rec .zero e'' e₂) (step-rec ()) step-rec-z
step-deterministic (rec zero e₀ es) step-rec-z (step-rec ())
-- Nontrival contradictory cases
step-deterministic (rec (suc e) e₁ e₂) (step-rec (step-suc S1)) (step-rec-s v) = not-val-and-step v S1
step-deterministic (rec (suc e) e₁ e₂) (step-rec-s v) (step-rec (step-suc S2)) = not-val-and-step v S2
-- Normal cases
step-deterministic (e $ e') (step-app-l S1) (step-app-l S2) =
resp (λ x → x $ e') (step-deterministic e S1 S2)
step-deterministic (Λ e $ e') step-beta step-beta = Refl
step-deterministic (suc e) (step-suc S1) (step-suc S2) = resp suc (step-deterministic e S1 S2)
step-deterministic (rec e e₁ e₂) (step-rec S1) (step-rec S2) =
resp (λ x → rec x e₁ e₂) (step-deterministic e S1 S2)
step-deterministic (rec zero _ _) step-rec-z step-rec-z = Refl
step-deterministic (rec (suc e) e₁ e₂) (step-rec-s x) (step-rec-s x₁) = Refl
-- Prove that if we evaluate to two expressions, and one is a value,
-- then the other evaluates to it.
eval-finish : ∀{A} → {e : TCExp A} → {e' e'' : TCExp A} →
e ~>* e' → e ~>* e'' →
TVal e'' →
e' ~>* e''
eval-finish eval-refl E2 v = E2
eval-finish (eval-cons S1 E1) eval-refl v = not-val-and-step v S1
eval-finish (eval-cons S1 E1) (eval-cons S2 E2) v with step-deterministic _ S1 S2
... | Refl = eval-finish E1 E2 v
-- Prove that if we evaluate to two values, they are the same
eval-deterministic : ∀{A} → {e : TCExp A} → {e' e'' : TCExp A} →
e ~>* e' → e ~>* e'' →
TVal e' → TVal e'' →
e' ≡ e''
eval-deterministic E1 E2 v1 v2 with eval-finish E1 E2 v2
... | eval-refl = Refl
... | eval-cons S1 _ = not-val-and-step v1 S1
open DynTheory public
|
programs/oeis/095/A095792.asm | neoneye/loda | 22 | 25852 | ; A095792: a(n) = Z(n) - L(n), where Z=A072649 and L=A095791 are lengths of Zeckendorf and lazy Fibonacci representations in binary notation.
; 0,0,0,1,0,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1
seq $0,194029 ; Natural fractal sequence of the Fibonacci sequence (1,2,3,5,8,...).
mov $1,1
mod $1,$0
mov $0,$1
|
programs/oeis/004/A004695.asm | neoneye/loda | 22 | 4798 | ; A004695: a(n) = floor(Fibonacci(n)/2).
; 0,0,0,1,1,2,4,6,10,17,27,44,72,116,188,305,493,798,1292,2090,3382,5473,8855,14328,23184,37512,60696,98209,158905,257114,416020,673134,1089154,1762289,2851443,4613732,7465176,12078908,19544084,31622993,51167077,82790070,133957148,216747218,350704366,567451585,918155951,1485607536,2403763488,3889371024,6293134512,10182505537,16475640049,26658145586,43133785636,69791931222,112925716858,182717648081,295643364939,478361013020,774004377960,1252365390980,2026369768940,3278735159921,5305104928861,8583840088782,13888945017644,22472785106426,36361730124070,58834515230497,95196245354567,154030760585064,249227005939632,403257766524696,652484772464328,1055742538989025,1708227311453353,2763969850442378,4472197161895732,7236167012338110,11708364174233842,18944531186571953,30652895360805795,49597426547377748,80250321908183544,129847748455561292,210098070363744836,339945818819306129,550043889183050965,889989708002357094,1440033597185408060,2330023305187765154,3770056902373173214,6100080207560938369,9870137109934111583,15970217317495049952,25840354427429161536,41810571744924211488,67650926172353373024,109461497917277584513
seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
div $0,2
|
07/MemoryAccess_tests/BasicTest/BasicTest.asm | ashiroji/Nand2Tetris | 0 | 93894 | //push constant 10
@10 //A=index
D=A //D is now the constant
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//pop local 0
@SP
AM=M-1 //AM = M[SP] - 1
D=M //D = the value to pop
@R13
M=D //save the value in R13
@LCL //A=LCL
D=M //save M[local] in D
@0 //A = index
D=D+A //D is now @(local + index)
@R14
M=D //save D value
@R13
D=M //D= value to pop
@R14
A=M //A = (segmentBase+index)
M=D //M[A] = value to pop
//push constant 21
@21 //A=index
D=A //D is now the constant
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//push constant 22
@22 //A=index
D=A //D is now the constant
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//pop argument 2
@SP
AM=M-1 //AM = M[SP] - 1
D=M //D = the value to pop
@R13
M=D //save the value in R13
@ARG //A=ARG
D=M //save M[argument] in D
@2 //A = index
D=D+A //D is now @(argument + index)
@R14
M=D //save D value
@R13
D=M //D= value to pop
@R14
A=M //A = (segmentBase+index)
M=D //M[A] = value to pop
//pop argument 1
@SP
AM=M-1 //AM = M[SP] - 1
D=M //D = the value to pop
@R13
M=D //save the value in R13
@ARG //A=ARG
D=M //save M[argument] in D
@1 //A = index
D=D+A //D is now @(argument + index)
@R14
M=D //save D value
@R13
D=M //D= value to pop
@R14
A=M //A = (segmentBase+index)
M=D //M[A] = value to pop
//push constant 36
@36 //A=index
D=A //D is now the constant
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//pop this 6
@SP
AM=M-1 //AM = M[SP] - 1
D=M //D = the value to pop
@R13
M=D //save the value in R13
@THIS //A=THIS
D=M //save M[this] in D
@6 //A = index
D=D+A //D is now @(this + index)
@R14
M=D //save D value
@R13
D=M //D= value to pop
@R14
A=M //A = (segmentBase+index)
M=D //M[A] = value to pop
//push constant 42
@42 //A=index
D=A //D is now the constant
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//push constant 45
@45 //A=index
D=A //D is now the constant
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//pop that 5
@SP
AM=M-1 //AM = M[SP] - 1
D=M //D = the value to pop
@R13
M=D //save the value in R13
@THAT //A=THAT
D=M //save M[that] in D
@5 //A = index
D=D+A //D is now @(that + index)
@R14
M=D //save D value
@R13
D=M //D= value to pop
@R14
A=M //A = (segmentBase+index)
M=D //M[A] = value to pop
//pop that 2
@SP
AM=M-1 //AM = M[SP] - 1
D=M //D = the value to pop
@R13
M=D //save the value in R13
@THAT //A=THAT
D=M //save M[that] in D
@2 //A = index
D=D+A //D is now @(that + index)
@R14
M=D //save D value
@R13
D=M //D= value to pop
@R14
A=M //A = (segmentBase+index)
M=D //M[A] = value to pop
//push constant 510
@510 //A=index
D=A //D is now the constant
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//pop temp 6
@SP
AM=M-1 //AM = M[SP] - 1
D=M //D = the value to pop
@R13
M=D //save the value in R13
@R11 //A = RAM @
D=A //D is now @static + index
@R14
M=D //save D value
@R13
D=M //D= value to pop
@R14
A=M //A = (segmentBase+index)
M=D //M[A] = value to pop
//push local 0
@LCL //A=LCL
D=M //save M[local] in D
@0 //A = index
D=D+A //D is now @(local + index)
A=D //A = @ contained in D
D=M//D=M[A], value to push
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//push that 5
@THAT //A=THAT
D=M //save M[that] in D
@5 //A = index
D=D+A //D is now @(that + index)
A=D //A = @ contained in D
D=M//D=M[A], value to push
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//add
@SP
AM=M-1 //AM[SP] = M[SP] - 1 e.g @y
D=M //D=M[A] e.g y
A=A-1 //A = @y - 1 e.g @x
M=D+M //M[@x] = y + M[@x]
//push argument 1
@ARG //A=ARG
D=M //save M[argument] in D
@1 //A = index
D=D+A //D is now @(argument + index)
A=D //A = @ contained in D
D=M//D=M[A], value to push
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//sub
@SP
AM=M-1 //AM[SP] = M[SP] - 1 e.g @y
D=-M //D=-M[A] e.g -y
A=A-1 //A = @y - 1 e.g @x
M=D+M //M[@x] = -y + M[@x]
//push this 6
@THIS //A=THIS
D=M //save M[this] in D
@6 //A = index
D=D+A //D is now @(this + index)
A=D //A = @ contained in D
D=M//D=M[A], value to push
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//push this 6
@THIS //A=THIS
D=M //save M[this] in D
@6 //A = index
D=D+A //D is now @(this + index)
A=D //A = @ contained in D
D=M//D=M[A], value to push
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//add
@SP
AM=M-1 //AM[SP] = M[SP] - 1 e.g @y
D=M //D=M[A] e.g y
A=A-1 //A = @y - 1 e.g @x
M=D+M //M[@x] = y + M[@x]
//sub
@SP
AM=M-1 //AM[SP] = M[SP] - 1 e.g @y
D=-M //D=-M[A] e.g -y
A=A-1 //A = @y - 1 e.g @x
M=D+M //M[@x] = -y + M[@x]
//push temp 6
@R11 //A = RAM @
D=A //D is now @static + index
A=D //A = @ contained in D
D=M//D=M[A], value to push
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//add
@SP
AM=M-1 //AM[SP] = M[SP] - 1 e.g @y
D=M //D=M[A] e.g y
A=A-1 //A = @y - 1 e.g @x
M=D+M //M[@x] = y + M[@x]
|
src/Tactic/Reflection/Telescope.agda | L-TChen/agda-prelude | 111 | 3583 |
module Tactic.Reflection.Telescope where
open import Prelude hiding (abs)
open import Builtin.Reflection
open import Tactic.Reflection.DeBruijn
Telescope = List (String × Arg Type)
telView : Type → Telescope × Type
telView (pi a (abs x b)) = first (_∷_ (x , a)) (telView b)
telView a = [] , a
visibleArity : Type → Nat
visibleArity = length ∘ filter (isVisible ∘ snd) ∘ fst ∘ telView
telPi : Telescope → Type → Type
telPi tel b = foldr (λ (x , a) b → pi a (abs x b)) b tel
arity : Name → TC Nat
arity f = length ∘ fst ∘ telView <$> getType f
argTel : Name → TC Telescope
argTel f = fst ∘ telView <$> getType f
telePat : Telescope → List (Arg Pattern)
telePat tel = zipWith (λ x (_ , a) → var x <$ a) (reverse $ from 0 for n) tel
where n = length tel
private
teleArgs′ : Nat → List (Arg Type) → List (Arg Term)
teleArgs′ (suc n) (a ∷ Γ) = (var n [] <$ a) ∷ teleArgs′ n Γ
teleArgs′ _ _ = []
teleArgs : Telescope → List (Arg Term)
teleArgs Γ = teleArgs′ (length Γ) (map snd Γ)
conParams : Name → TC Nat
conParams c =
caseM getDefinition c of λ
{ (data-cons d) → getParameters d
; _ → pure 0 }
conPat : Name → TC Pattern
conPat c = do
np ← conParams c
con c ∘ telePat ∘ drop np <$> argTel c
conTerm : Name → TC Term
conTerm c = do
np ← conParams c
con c ∘ teleArgs ∘ drop np <$> argTel c
|
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/s-traceb.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 237 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . T R A C E B A C K --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2021, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
-- This is the bare board version of this package for ARM EABI targets, using
-- unwind tables.
with Ada.Unchecked_Conversion;
package body System.Traceback is
use System.Traceback_Entries;
type Unwind_Reason_Code is
(URC_OK,
URC_FOREIGN_EXCEPTION_CAUGHT,
URC_END_OF_STACK,
URC_HANDLER_FOUND,
URC_INSTALL_CONTEXT,
URC_CONTINUE_UNWIND,
URC_FAILURE);
pragma Convention (C, Unwind_Reason_Code);
-- The _Unwind_Reason_Code enum defined by ARM EHABI document
pragma Unreferenced (URC_FOREIGN_EXCEPTION_CAUGHT,
URC_END_OF_STACK,
URC_HANDLER_FOUND,
URC_INSTALL_CONTEXT,
URC_CONTINUE_UNWIND);
type Unwind_Context_Type is null record;
type Unwind_Context_Acc is access Unwind_Context_Type;
pragma Convention (C, Unwind_Context_Acc);
-- Access to the opaque _Unwind_Context type
type Unwind_Trace_Fn is access
function (UC : Unwind_Context_Acc; Data : System.Address)
return Unwind_Reason_Code;
pragma Convention (C, Unwind_Trace_Fn);
-- The _Unwind_Trace_Fn function (used for the callback)
function Unwind_Backtrace
(Func : Unwind_Trace_Fn;
Data : System.Address) return Unwind_Reason_Code;
pragma Import (C, Unwind_Backtrace, "_Unwind_Backtrace");
-- The _Unwind_Backtrace function that calls Func with Data for each frame
function Unwind_VRS_Get
(UC : Unwind_Context_Acc;
Reg_Class : Integer;
Reg_Num : Integer;
Data_Rep : Integer;
Addr : System.Address) return Integer;
pragma Import (C, Unwind_VRS_Get, "_Unwind_VRS_Get");
-- The _Unwind_VRS_Get function to extract a register from the unwind
-- context UC.
UVRSR_OK : constant Integer := 0;
-- Success return status for Unwind_VRS_Get
UVRSC_CORE : constant Integer := 0;
-- Core register class for Unwind_VRS_Get
UVRSD_UINT32 : constant Integer := 0;
-- Unsigned int 32 data representation for Unwind_VRS_Get
type Tracebacks_Array_Ptr is access Tracebacks_Array (Positive);
type Callback_Params_Type is record
Tracebacks : Tracebacks_Array_Ptr;
Max_Len : Natural;
Len : Natural;
Exclude_Min : System.Address;
Exclude_Max : System.Address;
Skip_Frames : Natural;
end record;
-- This record contains the parameters for Call_Chain to be passed to
-- the callback. We could have used a nested subprogram, but as we are
-- interfacing with C (in bare board context), we prefer to use an
-- explicit mechanism.
type Callback_Params_Acc is access all Callback_Params_Type;
function Backtrace_Callback
(UC : Unwind_Context_Acc;
Data : System.Address) return Unwind_Reason_Code;
pragma Convention (C, Backtrace_Callback);
-- The callback for _Unwind_Backtrace, which is called for each frame
------------------------
-- Backtrace_Callback --
------------------------
function Backtrace_Callback
(UC : Unwind_Context_Acc;
Data : System.Address) return Unwind_Reason_Code
is
function To_Callback_Params is new Ada.Unchecked_Conversion
(System.Address, Callback_Params_Acc);
Params : constant Callback_Params_Acc := To_Callback_Params (Data);
-- The parameters of Call_Chain
PC : System.Address;
begin
-- Exclude Skip_Frames frames from the traceback.
if Params.Skip_Frames > 0 then
Params.Skip_Frames := Params.Skip_Frames - 1;
return URC_OK;
end if;
-- If the backtrace is full, simply discard new entries
if Params.Len >= Params.Max_Len then
return URC_OK;
end if;
-- Extract the PC (register 15)
if Unwind_VRS_Get (UC, UVRSC_CORE, 15, UVRSD_UINT32, PC'Address) /=
UVRSR_OK
then
return URC_FAILURE;
end if;
-- Discard exluded values
if PC in Params.Exclude_Min .. Params.Exclude_Max then
return URC_OK;
end if;
-- Append an entry
Params.Len := Params.Len + 1;
Params.Tracebacks (Params.Len) := PC;
return URC_OK;
end Backtrace_Callback;
----------------
-- Call_Chain --
----------------
procedure Call_Chain
(Traceback : in out System.Traceback_Entries.Tracebacks_Array;
Max_Len : Natural;
Len : out Natural;
Exclude_Min : System.Address := System.Null_Address;
Exclude_Max : System.Address := System.Null_Address;
Skip_Frames : Natural := 1)
is
function To_Tracebacks_Array_Ptr is new Ada.Unchecked_Conversion
(System.Address, Tracebacks_Array_Ptr);
Params : aliased Callback_Params_Type;
Res : Unwind_Reason_Code;
pragma Unreferenced (Res);
begin
-- Copy parameters; add 1 to Skip_Frames to ignore the caller of
-- Call_Chain.
Params := (Tracebacks => To_Tracebacks_Array_Ptr (Traceback'Address),
Len => 0,
Max_Len => Max_Len,
Exclude_Min => Exclude_Min,
Exclude_Max => Exclude_Max,
Skip_Frames => Skip_Frames + 1);
-- Call the unwinder
Res := Unwind_Backtrace (Backtrace_Callback'Access, Params'Address);
-- Copy the result
Len := Params.Len;
end Call_Chain;
end System.Traceback;
|
src/asf-components-html-text.adb | Letractively/ada-asf | 0 | 15097 | <gh_stars>0
-----------------------------------------------------------------------
-- html -- ASF HTML Components
-- Copyright (C) 2009, 2010, 2011, 2012 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Exceptions;
with EL.Objects;
with ASF.Components.Core;
with ASF.Utils;
package body ASF.Components.Html.Text is
use EL.Objects;
TEXT_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set;
LABEL_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set;
-- ------------------------------
-- Get the local value of the component without evaluating
-- the associated Value_Expression.
-- ------------------------------
overriding
function Get_Local_Value (UI : in UIOutput) return EL.Objects.Object is
begin
return UI.Value;
end Get_Local_Value;
-- ------------------------------
-- Get the value to write on the output.
-- ------------------------------
overriding
function Get_Value (UI : in UIOutput) return EL.Objects.Object is
begin
if not EL.Objects.Is_Null (UI.Value) then
return UI.Value;
else
return UI.Get_Attribute (UI.Get_Context.all, "value");
end if;
end Get_Value;
-- ------------------------------
-- Set the value to write on the output.
-- ------------------------------
overriding
procedure Set_Value (UI : in out UIOutput;
Value : in EL.Objects.Object) is
begin
UI.Value := Value;
end Set_Value;
-- ------------------------------
-- Get the converter that is registered on the component.
-- ------------------------------
overriding
function Get_Converter (UI : in UIOutput)
return ASF.Converters.Converter_Access is
begin
return UI.Converter;
end Get_Converter;
-- ------------------------------
-- Set the converter to be used on the component.
-- ------------------------------
overriding
procedure Set_Converter (UI : in out UIOutput;
Converter : in ASF.Converters.Converter_Access) is
use type ASF.Converters.Converter_Access;
begin
if Converter = null then
UI.Converter := null;
else
UI.Converter := Converter.all'Unchecked_Access;
end if;
end Set_Converter;
-- ------------------------------
-- Get the value of the component and apply the converter on it if there is one.
-- ------------------------------
function Get_Formatted_Value (UI : in UIOutput;
Context : in Faces_Context'Class) return String is
Value : constant EL.Objects.Object := UIOutput'Class (UI).Get_Value;
begin
return UIOutput'Class (UI).Get_Formatted_Value (Value, Context);
end Get_Formatted_Value;
-- ------------------------------
-- Format the value by appling the To_String converter on it if there is one.
-- ------------------------------
function Get_Formatted_Value (UI : in UIOutput;
Value : in Util.Beans.Objects.Object;
Context : in Contexts.Faces.Faces_Context'Class) return String is
use type ASF.Converters.Converter_Access;
begin
if UI.Converter /= null then
return UI.Converter.To_String (Context => Context,
Component => UI,
Value => Value);
else
declare
Converter : constant access ASF.Converters.Converter'Class
:= UI.Get_Converter (Context);
begin
if Converter /= null then
return Converter.To_String (Context => Context,
Component => UI,
Value => Value);
elsif not Is_Null (Value) then
return EL.Objects.To_String (Value);
else
return "";
end if;
end;
end if;
-- If the converter raises an exception, report an error in the logs.
-- At this stage, we know the value and we can report it in this log message.
-- We must queue the exception in the context, so this is done later.
exception
when E : others =>
UI.Log_Error ("Error when converting value '{0}': {1}: {2}",
Util.Beans.Objects.To_String (Value),
Ada.Exceptions.Exception_Name (E),
Ada.Exceptions.Exception_Message (E));
raise;
end Get_Formatted_Value;
procedure Write_Output (UI : in UIOutput;
Context : in out Faces_Context'Class;
Value : in String) is
Writer : constant Response_Writer_Access := Context.Get_Response_Writer;
Escape : constant Object := UI.Get_Attribute (Context, "escape");
begin
Writer.Start_Optional_Element ("span");
UI.Render_Attributes (Context, TEXT_ATTRIBUTE_NAMES, Writer);
if Is_Null (Escape) or To_Boolean (Escape) then
Writer.Write_Text (Value);
else
Writer.Write_Raw (Value);
end if;
Writer.End_Optional_Element ("span");
end Write_Output;
procedure Encode_Begin (UI : in UIOutput;
Context : in out Faces_Context'Class) is
begin
if UI.Is_Rendered (Context) then
UI.Write_Output (Context => Context,
Value => UIOutput'Class (UI).Get_Formatted_Value (Context));
end if;
-- Queue any block converter exception that could be raised.
exception
when E : others =>
Context.Queue_Exception (E);
end Encode_Begin;
-- ------------------------------
-- Label Component
-- ------------------------------
procedure Encode_Begin (UI : in UIOutputLabel;
Context : in out Faces_Context'Class) is
Writer : Response_Writer_Access;
begin
if UI.Is_Rendered (Context) then
Writer := Context.Get_Response_Writer;
Writer.Start_Element ("label");
UI.Render_Attributes (Context, LABEL_ATTRIBUTE_NAMES, Writer);
declare
Value : Util.Beans.Objects.Object := UI.Get_Attribute (Name => "for",
Context => Context);
begin
if not Util.Beans.Objects.Is_Null (Value) then
Writer.Write_Attribute ("for", Value);
end if;
Value := UIOutputLabel'Class (UI).Get_Value;
if not Util.Beans.Objects.Is_Null (Value) then
declare
S : constant String
:= UIOutputLabel'Class (UI).Get_Formatted_Value (Value, Context);
begin
if UI.Get_Attribute (Name => "escape", Context => Context, Default => True) then
Writer.Write_Text (S);
else
Writer.Write_Raw (S);
end if;
end;
end if;
-- Queue and block any converter exception that could be raised.
exception
when E : others =>
Context.Queue_Exception (E);
end;
end if;
end Encode_Begin;
procedure Encode_End (UI : in UIOutputLabel;
Context : in out Faces_Context'Class) is
Writer : Response_Writer_Access;
begin
if UI.Is_Rendered (Context) then
Writer := Context.Get_Response_Writer;
Writer.End_Element ("label");
end if;
end Encode_End;
-- ------------------------------
-- OutputFormat Component
-- ------------------------------
procedure Encode_Begin (UI : in UIOutputFormat;
Context : in out Faces_Context'Class) is
use ASF.Components.Core;
use ASF.Utils;
begin
if not UI.Is_Rendered (Context) then
return;
end if;
declare
Params : constant UIParameter_Access_Array := Get_Parameters (UI);
Values : Object_Array (Params'Range);
Result : Ada.Strings.Unbounded.Unbounded_String;
Fmt : constant String := EL.Objects.To_String (UI.Get_Value);
begin
-- Get the values associated with the parameters.
for I in Params'Range loop
Values (I) := Params (I).Get_Value (Context);
end loop;
Formats.Format (Fmt, Values, Result);
UI.Write_Output (Context => Context,
Value => To_String (Result));
end;
end Encode_Begin;
begin
Utils.Set_Text_Attributes (TEXT_ATTRIBUTE_NAMES);
Utils.Set_Text_Attributes (LABEL_ATTRIBUTE_NAMES);
Utils.Set_Interactive_Attributes (LABEL_ATTRIBUTE_NAMES);
end ASF.Components.Html.Text;
|
source/cvsweb-http.adb | reznikmm/cvsweb2git | 0 | 29691 | <filename>source/cvsweb-http.adb
-- BSD 3-Clause License
--
-- Copyright (c) 2017, <NAME>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- * Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- * Neither the name of the copyright holder nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-- THE POSSIBILITY OF SUCH DAMAGE.
with Ada.Wide_Wide_Text_IO;
with AWS.URL;
with AWS.Response;
package body CvsWeb.HTTP is
---------
-- Get --
---------
not overriding procedure Get
(Self : in out Connection;
URL : League.Strings.Universal_String;
Result : out League.Stream_Element_Vectors.Stream_Element_Vector;
Success : out Boolean)
is
Request : constant AWS.URL.Object :=
AWS.URL.Parse (URL.To_UTF_8_String);
Response : AWS.Response.Data;
begin
if not Self.Ready then
AWS.Client.Create
(Connection => Self.Server,
Host => AWS.URL.URL (Request));
Self.Ready := True;
end if;
Ada.Wide_Wide_Text_IO.Put_Line (URL.To_Wide_Wide_String);
AWS.Client.Get
(Connection => Self.Server,
Result => Response,
URI => AWS.URL.Pathname_And_Parameters (Request));
Result.Clear;
Result.Append (AWS.Response.Message_Body (Response));
Success := True;
exception
when others =>
Success := False;
end Get;
end CvsWeb.HTTP;
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2_notsx.log_12040_672.asm | ljhsiun2/medusa | 9 | 24258 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x11949, %rax
inc %r14
movb (%rax), %r9b
nop
nop
nop
nop
cmp $3517, %r14
lea addresses_WC_ht+0x6599, %rdx
sub $40706, %r9
mov (%rdx), %rbx
nop
sub %rax, %rax
lea addresses_WC_ht+0x10649, %rdi
nop
nop
nop
nop
nop
cmp $10492, %r12
movb $0x61, (%rdi)
nop
nop
nop
nop
nop
cmp $17980, %r12
lea addresses_normal_ht+0xfa38, %rsi
lea addresses_WC_ht+0xc909, %rdi
dec %rax
mov $2, %rcx
rep movsb
cmp $1352, %r9
lea addresses_WC_ht+0xc559, %r14
nop
nop
dec %rsi
vmovups (%r14), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %rbx
nop
nop
nop
nop
nop
and $17498, %rbx
lea addresses_A_ht+0x12549, %r9
clflush (%r9)
nop
xor $31555, %r12
mov $0x6162636465666768, %rdx
movq %rdx, %xmm7
vmovups %ymm7, (%r9)
nop
nop
nop
nop
nop
inc %rsi
lea addresses_normal_ht+0x1e769, %rcx
nop
sub $60216, %r14
mov $0x6162636465666768, %rbx
movq %rbx, (%rcx)
nop
nop
and %rbx, %rbx
lea addresses_normal_ht+0x19058, %rdx
nop
nop
xor $28614, %rdi
movl $0x61626364, (%rdx)
nop
nop
nop
and $52706, %r9
lea addresses_WC_ht+0x148ab, %rdi
nop
nop
nop
nop
add %r9, %r9
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
movups %xmm5, (%rdi)
nop
cmp %r9, %r9
lea addresses_UC_ht+0x17e0f, %rdx
nop
nop
nop
cmp %rax, %rax
mov $0x6162636465666768, %rdi
movq %rdi, (%rdx)
nop
nop
nop
nop
and $46983, %rcx
lea addresses_A_ht+0x10c3e, %rdi
add %rax, %rax
movl $0x61626364, (%rdi)
nop
nop
nop
nop
nop
add %rdx, %rdx
lea addresses_D_ht+0x1e549, %rdx
nop
nop
nop
nop
nop
dec %rbx
vmovups (%rdx), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %rax
nop
nop
nop
nop
sub $60282, %rax
lea addresses_normal_ht+0xfba1, %rdi
nop
nop
nop
nop
nop
add $55633, %r14
mov $0x6162636465666768, %rdx
movq %rdx, %xmm7
movups %xmm7, (%rdi)
nop
nop
nop
nop
and $25442, %rcx
lea addresses_D_ht+0x1bc49, %rsi
nop
sub $28397, %rbx
mov (%rsi), %dx
nop
nop
nop
nop
sub $7865, %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r8
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WC+0x8949, %rbp
nop
nop
nop
xor %r13, %r13
mov $0x5152535455565758, %r11
movq %r11, %xmm0
vmovups %ymm0, (%rbp)
nop
nop
nop
nop
add $56823, %rbp
// Store
lea addresses_WC+0x1d949, %rsi
nop
xor $13568, %rdx
movl $0x51525354, (%rsi)
add %rbp, %rbp
// REPMOV
lea addresses_A+0x13950, %rsi
lea addresses_PSE+0x19289, %rdi
nop
nop
nop
nop
nop
add %rdx, %rdx
mov $16, %rcx
rep movsw
nop
sub %rsi, %rsi
// Faulty Load
mov $0x154d9c0000000149, %r11
nop
nop
nop
cmp %rbp, %rbp
movntdqa (%r11), %xmm5
vpextrq $0, %xmm5, %r13
lea oracles, %r8
and $0xff, %r13
shlq $12, %r13
mov (%r8,%r13,1), %r13
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_PSE', 'congruent': 6, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'00': 12040}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
programs/oeis/104/A104584.asm | karttu/loda | 1 | 87850 | <gh_stars>1-10
; A104584: a(n) = (1/2) * ( 3*n^2 + n*(-1)^n ).
; 0,1,7,12,26,35,57,70,100,117,155,176,222,247,301,330,392,425,495,532,610,651,737,782,876,925,1027,1080,1190,1247,1365,1426,1552,1617,1751,1820,1962,2035,2185,2262,2420,2501,2667,2752,2926,3015,3197,3290,3480,3577,3775,3876,4082,4187,4401,4510,4732,4845,5075,5192,5430,5551,5797,5922,6176,6305,6567,6700,6970,7107,7385,7526,7812,7957,8251,8400,8702,8855,9165,9322,9640,9801,10127,10292,10626,10795,11137,11310,11660,11837,12195,12376,12742,12927,13301,13490,13872,14065,14455,14652,15050,15251,15657,15862,16276,16485,16907,17120,17550,17767,18205,18426,18872,19097,19551,19780,20242,20475,20945,21182,21660,21901,22387,22632,23126,23375,23877,24130,24640,24897,25415,25676,26202,26467,27001,27270,27812,28085,28635,28912,29470,29751,30317,30602,31176,31465,32047,32340,32930,33227,33825,34126,34732,35037,35651,35960,36582,36895,37525,37842,38480,38801,39447,39772,40426,40755,41417,41750,42420,42757,43435,43776,44462,44807,45501,45850,46552,46905,47615,47972,48690,49051,49777,50142,50876,51245,51987,52360,53110,53487,54245,54626,55392,55777,56551,56940,57722,58115,58905,59302,60100,60501,61307,61712,62526,62935,63757,64170,65000,65417,66255,66676,67522,67947,68801,69230,70092,70525,71395,71832,72710,73151,74037,74482,75376,75825,76727,77180,78090,78547,79465,79926,80852,81317,82251,82720,83662,84135,85085,85562,86520,87001,87967,88452,89426,89915,90897,91390,92380,92877
mul $0,3
mov $1,$0
div $1,2
mul $1,4
add $1,1
pow $1,2
div $1,24
|
SPARK_Projects/SPARKSada.ada | arifBurakDemiray/TheCodesThatIWrote | 1 | 29027 | <filename>SPARK_Projects/SPARKSada.ada
----------------------------sparksADA----------------------------
procedure dice_rolling (in loop: int,
out results: int[6])
global dice=: int[1,2,3,4,5,6]
pre => results = 0
loop /= 0
post => results /= 0
for i 1...loop:
rand_num=:rand_num()
if rand_num=1;
results[1] := results[1] + 1
else if rand_num=2
results[2] := results[2] + 1
else if rand_num=3
results[3] := results[3] + 1
else if rand_num=4
results[4] := results[4] + 1
else if rand_num=5
results[5] := results[5] + 1
else rand_num=1
results[6] := results[6] + 1
end if;
procedure random(out number:int)
global => out rand_num int
global => dice =: int[1,2,3,4,5,6]
pre: rand_num = 0
dice /= 0
post: rand_num /= 0
rand_num := pick from dice random
procedure print_randoms(in results: int[6])
global=>null
pre=>result /= 0
post => null
for i 1...7:
print_out("The ",i,"th result is"resulst[i])
----------------------------sparksADA----------------------------
procedure find_double(in n:int,in a:int,in b:int
out fak:int[50],out mult:int)
global=> mult:=1;
global=> fak:= 0;
global=> level_sum:=0;
pre: n /=0,a/=0,b/=0;
post: fact/=null, mult/= 0
for i 0...50:
for j 1...n:
level_sum := level_sum + exp(a,2*j+1) * exp(b,j);
mult := mult * level_sum
if(a > b)
fak[i] := fact(level_sum);
level_sum :=0
procedure exp(in num:int, in pow:int, out result:int)
global => result:=0;
pre => result=0,num/=0;
post => result /=0
for i 0...pow;
result := result + num;
procedure fact(in num:int, out fact:int)
pre=> fact=1, num/=0
post=> fact/=0
num_c := num ,int
while num_c /= 1;
fact = fact * num_c
num_c = num_c - 1
----------------------------sparksADA----------------------------
procedure finder(in a:int[],in b:int[],in c:int[],in loop:int,
out kac_tane:int, out ucuncu:int,
out max:int,out min:int)
pre=>a>0,b>0,loop=size(a,b,c),a b ve c nin boyutları aynı olması beklenir
post=> ucuncu>0
Y := 0 int;
kac_tane = 0
liste:=int[loop]
for i 0...loop:
if(c>0)
x := exp(a[i],b[i]) -1
Y = a[i] + a[i]*b[i] + 3*x;
if(div(Y)=1)
kac_tane = kac_tane +1
else if(c<0)
x := a[i]*b[i] + 2
Y = a[i] + a[i]*b[i] + 3*x;
liste[i]:=Y
else
x := a[i] - 2*b[i] + 3
Y = a[i] + a[i]*b[i] + 3*x;
liste[i]:=Y
end if;
ucuncu := 0
counter:=3 int
min = liste[0]
max = liste[0]
for i 0...loop:
if(counter=0)
ucuncu := liste[loop-i]
break the loop
else
if(liste[loop-i]>0)
counter = counter - 1;
end if;
end if;
for i 0...loop:
if(liste[i]>max)
max:=liste[i]
else if(liste[i]<min)
min:=liste[i]
end if;
procedure exp(in num:int, in pow:int, out result:int)
global => result:=0;
pre => result=0,num/=0;
post => result /=0
for i 0...pow;
result := result + num;
procedure div(in num:int, out res: int)
pre=>num/=0
post => res:=0 or res:=1
division = num/4
res := 0
while(division<1)
if(division = 1)
res:=1
end if;
divison = division/4
----------------------------sparksADA---------------------------- |
gfx/pokemon/goldeen/anim.asm | Dev727/ancientplatinum | 28 | 245246 | frame 1, 30
frame 0, 16
setrepeat 4
frame 2, 12
frame 0, 12
dorepeat 3
endanim
|
ada/hello.adb | dannypsnl/languages-learn | 2 | 20157 | <gh_stars>1-10
with Ada.Text_IO;
procedure Hello is
package IO renames Ada.Text_IO;
begin
IO.Put_Line("Hello, world!");
end Hello;
|
source/Bookends/bookends.applescript | tiagodj/PopClip-Extensions | 1 | 2526 | tell application "Bookends"
if "{popclip modifier flags}" is "1048576" then
tell front library window
if id of group items contains "{popclip text}" then delete group item "{popclip text}"
set myPubs to sql search "allFields REGEX '(?i){popclip text}'"
make new group item with properties {name:"{popclip text}"}
add myPubs to group item "{popclip text}"
end tell
activate
else
set pubList to quick add {"{popclip text}"}
end if
end tell |
alloy4fun_models/trainstlt/models/3/Bkt24rAPK7ZZAYoNj.als | Kaixi26/org.alloytools.alloy | 0 | 3334 | <gh_stars>0
open main
pred idBkt24rAPK7ZZAYoNj_prop4 {
always all disj t, t2 : Train | t.pos != t2.pos
}
pred __repair { idBkt24rAPK7ZZAYoNj_prop4 }
check __repair { idBkt24rAPK7ZZAYoNj_prop4 <=> prop4o } |
libsrc/_DEVELOPMENT/alloc/obstack/c/sdcc_iy/obstack_copy0_callee.asm | meesokim/z88dk | 0 | 1064 | <gh_stars>0
; void *obstack_copy0_callee(struct obstack *ob, void *address, size_t size)
SECTION code_alloc_obstack
PUBLIC _obstack_copy0_callee
_obstack_copy0_callee:
pop af
pop hl
pop de
pop bc
push af
INCLUDE "alloc/obstack/z80/asm_obstack_copy0.asm"
|
programs/oeis/286/A286679.asm | jmorken/loda | 1 | 87950 | <reponame>jmorken/loda<filename>programs/oeis/286/A286679.asm
; A286679: Numbers of the form (2*prime(n)^2 + 1)/3.
; 17,33,81,113,193,241,353,561,641,913,1121,1233,1473,1873,2321,2481,2993,3361,3553,4161,4593,5281,6273,6801,7073,7633,7921,8513,10753,11441,12513,12881,14801,15201,16433,17713,18593,19953,21361,21841,24321,24833,25873,26401,29681,33153,34353,34961,36193,38081,38721,42001,44033,46113,48241,48961,51153,52641,53393,57233,62833,64481,65313,66993,73041,75713,80273,81201,83073,85921,89793,92753,95761,97793,100881,105073,107201,111521,117041,118161,123841,124993,128481,130833,134401,139233,141681,142913,145393,152961,158113,160721,166001,168673,172721,180961,182353,195121,199473,206833,211313,215841,217361,221953,229713,234433,239201,240801,245633,250513,253793,255441,265441,273921,275633,279073,284273,289521,291281,301953,305553,310993,318321,327601,335121,344641,352353,358193,364081,368033,376001,382033,386081,394241,398353,412913,423473,436321,438481,449361,451553,455953,458161,469281,485073,489633,491921,496513,512753,517441,519793,524513,548433,553281,563041,575361,585313,590321,597873,605473,623393,628561,636353,644193,654721,662673,678721,684113,692241,694961,708641,711393,719681,733601,736401,750481,753313,761841,787713,793521,796433,802273,811073,819921,831793,840753,849761,883201,886273,901713,914161,929841,939313,948833,961601,980913,987393,997153,1006961,1010241,1020113,1040001,1056721,1087153,1090561,1097393,1107681,1111121,1121473,1128401,1131873,1138833,1159841,1163361,1173953,1234881,1245793,1256753,1271441,1304801,1323521,1349953,1357553,1361361,1368993,1380481,1395873,1403601,1407473,1419121,1442561,1462241,1466193,1474113,1478081,1486033,1498001,1522081,1546353,1562641,1587233,1599601,1607873,1620321,1636993,1645361,1662161,1670593,1700273,1708801
mov $3,2
mov $5,$0
lpb $3
mov $0,$5
sub $3,1
add $0,$3
cal $0,74367 ; (p^2-5)/4 for odd primes p.
mov $2,$3
mov $4,$0
div $4,2
mul $4,4
lpb $2
mov $1,$4
sub $2,1
lpe
lpe
div $1,4
mul $1,2
div $1,6
mul $1,16
add $1,17
|
sources/MapperDslLib/Parser/Mapper.g4 | cllafleur/CustomMapper | 1 | 1838 | grammar Mapper;
file
: ( WS | WS? NEWLINE | statement)+
;
statement
: extractExpr WS? ASSIGNMENT WS? insertExpr WS? NEWLINE
;
extractExpr
: complexExpr
;
insertExpr
: insertFieldRef | function
;
insertFieldRef
: (insertInstanceRef '.' )? fieldInstanceRef
;
insertInstanceRef
: fieldInstanceRef (DOT fieldInstanceRef)*
;
expr
: ( instanceRef | function | LITTERAL )
;
complexExpr
: ( tupleOfExpr | returnFunctionDereferencement | expr )
;
tupleOfExpr
: '(' namedExpr ( ',' namedExpr )* WS? ')'
;
namedExpr
: WS? ( IDENTIFIER WS? ':' )? WS? (returnFunctionDereferencement | expr) WS?
;
function
: IDENTIFIER WS? '(' WS? complexExpr ( WS? ',' WS? complexExpr )* WS? ')'
;
returnFunctionDereferencement
: function ( '.' instanceRef )
;
instanceRef
: fieldInstanceRef (DOT fieldInstanceRef)*
;
fieldInstanceRef
: IDENTIFIER
;
ASSIGNMENT
: '->' | '=>'
;
DOT
: '.'
;
LITTERAL
: '"' ~ ["]* '"'
;
NEWLINE
: '\r'? '\n'
;
IDENTIFIER
: [_a-zA-Z] [_0-9a-zA-Z]*
;
LINE_COMMENT
: '#' ~[\r\n]* -> skip
;
WS
: [ \t]+
;
|
stub/stublib.asm | paule32/forth2asm | 0 | 246669 | <reponame>paule32/forth2asm
; -----------------------------------------------------------------------------
; MIT License
;
; Copyright (c) 2019 <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.
; -----------------------------------------------------------------------------
; usage: nasm -f bin -o test test.asm
; -----------------------------------------------------------------------------
%include 'header32.asm' ; elf32 binary header
%include "syslib32.asm" ; system lib loader
; -----------------------------------------------------------------------------
; entry point of stub program ...
;
; Linux startup on console is stack based:
;
; EBX => numbers of arguments (see below)
; EBP => put the given argument value/name into EBP (depend by "pop ebp")
;
; $ ./stubprogram 42 A
; | | |
; | | +--- argv[2]
; | +------ argv[1]
; +--------- argv[0] (shall include path name + program name)
; -----------------------------------------------------------------------------
section .text
_start:
sys_prolog
sys_getcmdline_args
mov esi, [ebp + 8] ; argv[0]
mov ecx, 0 ; counter; string is in ESI
.repeat:
lodsb ; load string byte by byte
test al, al ; check if zero (terminator \0
jz .done ; yes, we done the loop
inc ecx ; increment counter
jmp .repeat ; loop
.done:
mov edx, ecx ; string length
mov esi, [ebp + 8] ; the string itself
mov ebx, stdout ; output goes to console
call sys_write
; -------------------------------------
; open argv[0], name is in EBX
; with read-only flag.
; return value in EAX will have file
; descriptor on success ...
; -------------------------------------
mov edx, [ebp + 8]
sys_open edx, O_RDONLY, O_RDONLY, file_desc
jmp .error ; there was an error, errno saved in EAX
.file_ok:
mov [file_desc], eax ; save file descriptor from EAX
; ----------------------------------------------------
; for write the attachment:
; create file with (-rwxr-xr-x) access rights ...
;
; access modes of new file:
; 1 = --x, | r := read
; 5 = --r-x, | w := write
; 6 = --r, | x := exec
; 7 = --r-x, |
; 15 = -xr-x | all access flag in octal !
; 127 = ---xr-xr-x, |
; 128 = --w------- |
; 255 = --wxr-xr-x, |
; 256 = -r-------- |
; 511 = -rwxr-xr-x, |
; 512 = ---------T |
; 666 = --w---x--T, |
; 755 = --wxr----t |
; ----------------------------------------------------
%ifdef DEBUG_TEST
sys_creat tmp_file, 0o750 ; access right
sys_open tmp_file, O_WRONLY, O_WRONLY, tmp_desc
test eax, eax
jns .file_ok2
jmp .error
.file_ok2:
mov [tmp_desc], eax ; save file descriptor
%endif
; ---------------------------------
; seek to stub file size position,
; and read the attachment ...
; ---------------------------------
sys_lseek file_desc, filesize, SEEK_SET
; -----------------------------------------------------------------------------
; for test the kernel, may removed at later time ...
; -----------------------------------------------------------------------------
jmp .jumper ; over jump nex code (peephole)
%ifdef DEBUG_TEST
.read2:
mov ebx, [file_desc] ; sys_open returned fd in EAX (input fd)
mov ecx, char_buff ; buffer
mov edx, 1 ; count read (1 byte)
call sys_read ; "read" kernel call
cmp eax, 0 ; check if pointer EOF, or null-byte
jle .is_eof ; yes, close file
;
mov ebx, [tmp_desc] ; ramfs file descriptor
mov ecx, char_buff ; buffer
mov edx, 1 ; buffer size
call sys_write
jmp .read2 ; else, read next char
%endif
.jumper:
call dll_entry
.is_eof:
syscall SYS_SYNC, nop ; write buffers
; -----------------------------------------------------------------------------
; Linux close file descriptors automatically at end of exec. or process
; -----------------------------------------------------------------------------
sys_close tmp_desc
sys_close file_desc
.error:
sys_exit 0 ; should be exit the program without segfault err.
; -----------------------------------------------------------------------------
; data segment - moved to the end of code
; -----------------------------------------------------------------------------
section .data
;tmp_file db "/tmp/stub.tmp", 0
;tmp_file_len equ $ - tmp_file
cant_loadstub_msg db "error", 10, 0
cant_loadstub_msg_len equ $ - cant_loadstub_msg
file_desc: dd 0
tmp_desc: dd 0
; -----------------------------------------------------------------------------
; bss segment - null data: static allocated memory ...
; -----------------------------------------------------------------------------
section .bss
char_buff: resb 1
; -----------------------------------------------------------------------------
; E-O-F - End Of File (stub) ...
; -----------------------------------------------------------------------------
filesize equ $ - $$
; -----------------------------------------------------------------------------
; now, attachment follows ...
; -----------------------------------------------------------------------------
section .text
dll_entry:
jmp .main
.main: ret
section .data
; -----------------------------------------------------------------------------
; program dependcies: DLL + function name(s) ...
; -----------------------------------------------------------------------------
%define KERNEL32_DLL ; nark, to tell nasm using kernel32.dll code
%define KERNEL32_DLL_FUNC1 ; mark, to tell nasm-lib use func1
%define KERNEL32_DLL_FUNC2 ; mark, func1 ...
; -----------------------------------------------------------------------------
; DLL import/include .data ...
; -----------------------------------------------------------------------------
%ifdef KERNEL32_DLL
%include "kernel32.asm"
%endif
|
alloy4fun_models/trashltl/models/10/NLZj6Npak9Capwspk.als | Kaixi26/org.alloytools.alloy | 0 | 1439 | open main
pred idNLZj6Npak9Capwspk_prop11 {
always ((File - Protected) in Protected)
}
pred __repair { idNLZj6Npak9Capwspk_prop11 }
check __repair { idNLZj6Npak9Capwspk_prop11 <=> prop11o } |
src/io_first.asm | no111u3/m48_robo_asm | 0 | 179748 | <gh_stars>0
;****************************************************************
.include "m48def.inc"
.include "service.inc"
;****************************************************************
; Data
;****************************************************************
.dseg
;****************************************************************
; Code
;****************************************************************
.cseg
.org 0x000
rjmp reset ; Reset Handler
reti ; rjmp EXT_INT0 ; IRQ0 Handler
reti ; rjmp EXT_INT1 ; IRQ1 Handler
reti ; rjmp PCINT0 ; PCINT0 Handler
reti ; rjmp PCINT1 ; PCINT1 Handler
reti ; rjmp PCINT2 ; PCINT2 Handler
reti ; rjmp WDT ; Watchdog Timer Handler
reti ; rjmp TIM2_COMPA ; Timer2 Compare A Handler
reti ; rjmp TIM2_COMPB ; Timer2 Compare B Handler
reti ; rjmp TIM2_OVF ; Timer2 Overflow Handler
reti ; rjmp TIM1_CAPT ; Timer1 Capture Handler
reti ; rjmp TIM1_COMPA ; Timer1 Compare A Handler
reti ; rjmp TIM1_COMPB ; Timer1 Compare B Handler
reti ; rjmp TIM1_OVF ; Timer1 Overflow Handler
reti ; rjmp TIM0_COMPA ; Timer0 Compare A Handler
reti ; rjmp TIM0_COMPB ; Timer0 Compare B Handler
reti ; rjmp TIM0_OVF ; Timer0 Overflow Handler
reti ; rjmp SPI_STC ; SPI Transfer Complete Handler
reti ; rjmp USART_RXC ; USART, RX Complete Handler
reti ; rjmp USART_UDRE ; USART, UDR Empty Handler
reti ; rjmp USART_TXC ; USART, TX Complete Handler
reti ; rjmp ADC ; ADC Conversion Complete Handler
reti ; rjmp EE_RDY ; EEPROM Ready Handler
reti ; rjmp ANA_COMP ; Analog Comparator Handler
reti ; rjmp TWI ; 2-wire Serial Interface Handler
reti ; rjmp SPM_RDY ; Store Program Memory Ready Handler
reset:
sset RAMEND
regram_clear SRAM_START, RAMEND+1
start:
; Internal hardware init ========================================
; PC5 - output, always enable
; PC4 - output, enable if button is pressed
; PC3 - input, pulluped
ldi r16, (1 << PC5) | (1 << PC3); Set Pin 5 and 3 Port C to high
ldi r17, (1 << DDC5) | (1 << DDC4) ; Set Pin 5 and 4 Port C to output
uout PORTC, r16
uout DDRC, r17
;================================================================
; Eternal hardware init =========================================
;================================================================
; Run ===========================================================
Main:
uin r16, PINC ; Read PINC to tmp
sbrs r16, PINC3 ; check Pin 3 to clear
cbi PORTC, PC4 ; disable Pin 4 if cleared
sbrc r16, PINC3 ; check Pin 3 to set
sbi PORTC, PC4 ; enable Pin 4 if setted
rjmp Main
rjmp pc
;================================================================
;****************************************************************
; Eeprom Data
;****************************************************************
.eseg |
src/drivers/gclk_u2122/sam-clock_generator.adb | Fabien-Chouteau/samd51-hal | 1 | 17896 | <filename>src/drivers/gclk_u2122/sam-clock_generator.adb
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2019, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with SAM_SVD.GCLK; use SAM_SVD.GCLK;
package body SAM.Clock_Generator is
-------------------------
-- Configure_Generator --
-------------------------
procedure Configure_Generator
(Id : Generator_Id;
Source : Clock_Source;
DIV_Select : Boolean;
DIV : UInt16;
Run_In_Standby : Boolean;
Output_Enable : Boolean)
is
CTRL : GCLK_GENCTRL_Register := GCLK_Periph.GENCTRL (Integer (Id));
begin
CTRL.GENEN := True;
CTRL.DIV := DIV;
CTRL.DIVSEL := DIV_Select;
CTRL.SRC := GENCTRL_SRCSelect'Enum_Val (Source'Enum_Rep);
CTRL.RUNSTDBY := Run_In_Standby;
CTRL.OE := Output_Enable;
GCLK_Periph.GENCTRL (Integer (Id)) := CTRL;
end Configure_Generator;
-----------------------
-- Disable_Generator --
-----------------------
procedure Disable_Generator (Id : Generator_Id) is
begin
GCLK_Periph.GENCTRL (Integer (Id)).GENEN := False;
end Disable_Generator;
------------------------------
-- Configure_Periph_Channel --
------------------------------
procedure Configure_Periph_Channel
(Periph : Peripheral_Id;
Gen : Generator_Id)
is
CTRL : GCLK_PCHCTRL_Register := GCLK_Periph.PCHCTRL (Integer (Periph));
begin
CTRL.GEN := PCHCTRL_GENSelect (Gen);
CTRL.CHEN := True;
GCLK_Periph.PCHCTRL (Integer (Periph)) := CTRL;
end Configure_Periph_Channel;
----------------------------
-- Disable_Periph_Channel --
----------------------------
procedure Disable_Periph_Channel (Periph : Peripheral_Id) is
begin
GCLK_Periph.PCHCTRL (Integer (Periph)).CHEN := False;
end Disable_Periph_Channel;
end SAM.Clock_Generator;
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca_notsx.log_21829_612.asm | ljhsiun2/medusa | 9 | 80105 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x130f, %rsi
lea addresses_WT_ht+0x15a5c, %rdi
nop
nop
dec %r8
mov $84, %rcx
rep movsb
nop
nop
xor %rdi, %rdi
lea addresses_normal_ht+0xfe19, %r14
nop
nop
add %rsi, %rsi
movb $0x61, (%r14)
nop
nop
nop
nop
sub $45417, %r8
lea addresses_WT_ht+0x83d1, %rsi
clflush (%rsi)
nop
nop
nop
nop
nop
cmp $33001, %rbx
movl $0x61626364, (%rsi)
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_WT_ht+0x19c09, %rbx
nop
nop
nop
add %r8, %r8
movl $0x61626364, (%rbx)
nop
nop
sub %rcx, %rcx
lea addresses_A_ht+0x329d, %rdi
clflush (%rdi)
nop
xor $1418, %r8
movl $0x61626364, (%rdi)
nop
nop
nop
dec %r8
lea addresses_WC_ht+0x68b1, %rdi
nop
dec %r14
movw $0x6162, (%rdi)
add %r10, %r10
lea addresses_D_ht+0x15815, %rsi
nop
sub $63758, %rbx
movb (%rsi), %r8b
nop
nop
nop
nop
nop
and $58530, %rdi
lea addresses_WC_ht+0xa8e9, %rsi
lea addresses_normal_ht+0x10e29, %rdi
nop
nop
nop
xor %rbx, %rbx
mov $55, %rcx
rep movsw
nop
nop
nop
nop
xor %rbx, %rbx
lea addresses_A_ht+0x13ae9, %r8
add %rsi, %rsi
mov (%r8), %edi
nop
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_A_ht+0x10f01, %rdi
nop
xor $28469, %rsi
mov (%rdi), %ecx
nop
add $16440, %r14
lea addresses_A_ht+0x16769, %rcx
nop
nop
nop
and $1551, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, (%rcx)
nop
nop
nop
add $54969, %rbx
lea addresses_normal_ht+0x138e9, %rsi
xor $20173, %r14
vmovups (%rsi), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %rbx
nop
nop
nop
nop
nop
cmp $7250, %rcx
lea addresses_UC_ht+0x11ae9, %r8
clflush (%r8)
nop
nop
cmp %rbx, %rbx
mov $0x6162636465666768, %rsi
movq %rsi, (%r8)
cmp %r14, %r14
lea addresses_WT_ht+0x10029, %rsi
lea addresses_WT_ht+0x182b9, %rdi
clflush (%rdi)
nop
nop
nop
sub $8891, %r9
mov $54, %rcx
rep movsw
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_WC_ht+0x16109, %rsi
lea addresses_normal_ht+0x11fe9, %rdi
nop
nop
nop
add $24742, %r10
mov $73, %rcx
rep movsl
nop
nop
cmp $5082, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %r8
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_UC+0x1b129, %r15
nop
nop
cmp %rdx, %rdx
movb $0x51, (%r15)
nop
nop
nop
nop
nop
and %rbx, %rbx
// Load
lea addresses_UC+0x5769, %r15
nop
nop
and $6122, %r8
movb (%r15), %bl
nop
nop
sub %rdi, %rdi
// Store
lea addresses_WC+0x15c1d, %r8
nop
add $50546, %r10
mov $0x5152535455565758, %r15
movq %r15, (%r8)
xor $63302, %rsi
// REPMOV
lea addresses_normal+0x6ee9, %rsi
lea addresses_UC+0x4989, %rdi
nop
xor %rdx, %rdx
mov $113, %rcx
rep movsl
nop
nop
nop
cmp %r10, %r10
// Load
lea addresses_A+0x6ae9, %rdi
nop
nop
nop
and $59280, %rsi
mov (%rdi), %r15d
sub %r15, %r15
// REPMOV
lea addresses_WC+0x15f69, %rsi
mov $0xf89, %rdi
sub $5608, %r8
mov $26, %rcx
rep movsb
nop
sub %rsi, %rsi
// Store
mov $0x7318240000000ce9, %rdi
nop
and %r15, %r15
movl $0x51525354, (%rdi)
nop
nop
nop
nop
cmp %rsi, %rsi
// Faulty Load
lea addresses_RW+0x4ee9, %rbx
nop
sub %rsi, %rsi
mov (%rbx), %ecx
lea oracles, %r8
and $0xff, %rcx
shlq $12, %rcx
mov (%r8,%rcx,1), %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': True, 'AVXalign': True, 'size': 8, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_normal'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_UC'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WC'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_P'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
Library/BorlandRTL/h_psbp.asm | steakknife/pcgeos | 504 | 1913 | <gh_stars>100-1000
; $Id: h_psbp.asm,v 1.1 97/04/07 12:04:07 newdeal Exp $
;[]-----------------------------------------------------------------[]
;| H_PSBP.ASM -- long pointer routines |
;[]-----------------------------------------------------------------[]
;
; C/C++ Run Time Library - Version 5.0
;
; Copyright (c) 1987, 1992 by Borland International
; All Rights Reserved.
;
INCLUDE rules.asi
; calls to these routines are generated by the compiler to perform
; arithmetic operations on long pointers.
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
;
; ax:dx left hand pointer
; bx:cx right hand pointer
;
; To subtract, first convert both pointers to longs.
; then do a simple signed long subtraction. Actually
; we only store 24 bit ints until the subtraction is
; done.
;
public PSBP@
public F_PSBP@
public N_PSBP@
N_PSBP@ proc near
call F_PSBP@
ret
N_PSBP@ endp
PSBP@ proc far
.fall_thru
PSBP@ endp
F_PSBP@ proc far
push di
mov di,cx
mov ch,dh
mov cl,4
shl dx,cl
shr ch,cl ; dx:ch has the left hand long
add dx,ax
adc ch,0
mov ax,di
shl di,cl
shr ah,cl
add bx,di
adc ah,0 ; bx:ah has the right hand long
sub dx,bx
sbb ch,ah
mov al,ch
cbw ; sign extend the upper part
xchg ax,dx
pop di
ret
F_PSBP@ endp
_TEXT ENDS
|
Library/GrObj/Attr/attrUtils.asm | steakknife/pcgeos | 504 | 166572 | <filename>Library/GrObj/Attr/attrUtils.asm<gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Admin
FILE: objectAttrUtils..asm
AUTHOR: <NAME>, Nov 15, 1991
ROUTINES:
Name
----
GrObjAttrGenerateUndoAreaAttrChangeChain
GrObjAttrGenerateUndoLineAttrChangeChain
GrObjAttrInvalidateAndSendAreaUINotification
GrObjAttrInvalidateAndSendLineUINotification
GrObjAttrInvalidateAndSendUINotification
GrObjChangeGrObjBaseAreaAttrElementField
GrObjChangeGrObjBaseAreaAttrElementByteRecord
GrObjChangeGrObjBaseLineAttrElementField
GrObjGetAreaInfoAndMask
GrObjGetAreaColor
GrObjGetLineColor
GrObjGetAreaInfoAndMask
GrObjGetLineWidth
GrObjApplyGrObjFullAreaAttrElement
GrObjApplyGrObjFullLineAttrElement
GrObjApplyBackgroundAttrs
GrObjApplyGrObjLineToken
GrObjApplyGrObjAreaToken
GrObjAddGrObjFullAreaAttrElement
GrObjAddGrObjFullLineAttrElement
GrObjDerefGrObjLineToken
GrObjDerefGrObjAreaToken
GrObjAddRefGrObjLineToken
GrObjAddRefGrObjAreaToken
GrObjGetGrObjFullAreaAttrElement
GrObjGetGrObjFullLineAttrElement
GrObjDetermineAreaAttributeDataSize
GrObjDetermineLineAttributeDataSize
REVISION HISTORY:
Name Date Description
---- ---- -----------
Steve 11/15/91 Initial revision
DESCRIPTION:
$Id: attrUtils.asm,v 1.1 97/04/04 18:07:05 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAttributesCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjAttrGenerateUndoAreaAttrChangeChain
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Generate an undo chain to undo the impending area attribute
change
CALLED BY: INTERNAL UTILITY
PASS:
*ds:si - object
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
Increment the reference count of the current area token
so that it won't be thrown away.
Create undo chain that will do
on undo - set back to current token
on free - deref the token
Since we are guaranteed that the undo action will eventually be
freed, even if the operation is undone, the increment
of the reference count will be balanced by a decrement.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAttrGenerateUndoAreaAttrChangeChain proc far
class GrObjClass
uses ax,bx,cx,dx,di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_optFlags,mask GOOF_ATTRIBUTE_MANAGER
jnz done
; If we don't exit when element is null we could get
; an undo that caused us to send SET_GROB_AREA_TOKEN
; with FFFFH as the token to ourselves. This causes
; revert to base style. Bad news.
;
mov cx,ds:[di].GOI_areaAttrToken
cmp cx,CA_NULL_ELEMENT
je done
call GenProcessUndoCheckIfIgnoring
tst ax
jnz done
call GrObjAddRefGrObjAreaToken
mov_tr ax,cx ;area token
mov cx,handle areaAttrString
mov dx,offset areaAttrString
call GrObjGlobalStartUndoChain
mov_tr cx,ax ;area token
mov ax,MSG_GO_SET_GROBJ_AREA_TOKEN ;undo message
mov di,MSG_GO_DEREF_A_GROBJ_AREA_TOKEN ;free message
mov bx,mask AUAF_NOTIFY_BEFORE_FREEING ;AddUndoActionFlags
call GrObjGlobalAddFlagsUndoAction
call GrObjGlobalEndUndoChain
done:
.leave
ret
GrObjAttrGenerateUndoAreaAttrChangeChain endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjAttrGenerateUndoLineAttrChangeChain
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Generate an undo chain to undo the impending line attribute
change
CALLED BY: INTERNAL UTILITY
PASS:
*ds:si - object
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
Increment the reference count of the current line token
so that it won't be thrown away.
Create undo chain that will do
on undo - set back to current token
on free - deref the token
Since we are guaranteed that the undo action will eventually be
freed, even if the operation is undone, the increment
of the reference count will be balanced by a decrement.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAttrGenerateUndoLineAttrChangeChain proc far
class GrObjClass
uses ax,bx,cx,dx,di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_optFlags,mask GOOF_ATTRIBUTE_MANAGER
jnz done
; If we don't exit when element is null we could get
; an undo that caused us to send SET_GROB_LINE_TOKEN
; with FFFFH as the token to ourselves. This causes
; revert to base style. Bad news.
;
mov cx,ds:[di].GOI_lineAttrToken
cmp cx,CA_NULL_ELEMENT
je done
call GenProcessUndoCheckIfIgnoring
tst ax
jnz done
call GrObjAddRefGrObjLineToken
mov_tr ax,cx ;line token
mov cx,handle lineAttrString
mov dx,offset lineAttrString
call GrObjGlobalStartUndoChain
mov_tr cx,ax ;line token
mov ax,MSG_GO_SET_GROBJ_LINE_TOKEN ;undo message
mov di,MSG_GO_DEREF_A_GROBJ_LINE_TOKEN ;free message
mov bx,mask AUAF_NOTIFY_BEFORE_FREEING ;AddUndoActionFlags
call GrObjGlobalAddFlagsUndoAction
call GrObjGlobalEndUndoChain
done:
.leave
ret
GrObjAttrGenerateUndoLineAttrChangeChain endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjAttrInvalidateAndSendAreaUINotification
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Invalidate the grobject and initiate an update of
the area ui controllers
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - grobject
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 3/17/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAttrInvalidateAndSendAreaUINotification proc far
uses cx
.enter
call GrObjOptInvalidateArea
mov cx, mask GOUINT_AREA
call GrObjAttrInvalidateAndSendUINotification
.leave
ret
GrObjAttrInvalidateAndSendAreaUINotification endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjAttrInvalidateAndSendLineUINotification
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Invalidate the grobject and initiate an update of
the line ui controllers
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - grobject
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 3/17/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAttrInvalidateAndSendLineUINotification proc far
uses cx
.enter
call GrObjOptInvalidateLine
mov cx, mask GOUINT_LINE
call GrObjAttrInvalidateAndSendUINotification
.leave
ret
GrObjAttrInvalidateAndSendLineUINotification endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjAttrInvalidateAndSendUINotification
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Invalidate the grobject and initiate an update of
the ui controllers
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - grobject
ax - invalidate message
cx - GrObjUINotificationTypes
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 3/17/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAttrInvalidateAndSendUINotification proc near
uses ax,bp
.enter
call GrObjOptSendUINotification
mov bp,GOANT_ATTRED
call GrObjOptNotifyAction
.leave
ret
GrObjAttrInvalidateAndSendUINotification endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjOptInvalidateArea
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: InvalidateArea the object taking into account the
GrObjMessageOptimizationFlags
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - grobject
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL SIZE
Common cases:
opt bit not set
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/26/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjOptInvalidateArea proc far
class GrObjClass
uses di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_msgOptFlags, mask GOMOF_INVALIDATE_AREA
jnz send
call GrObjInvalidate
done:
.leave
ret
send:
push ax
mov ax,MSG_GO_INVALIDATE_AREA
call ObjCallInstanceNoLock
pop ax
jmp done
GrObjOptInvalidateArea endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjOptInvalidateLine
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: InvalidateLine the object taking into account the
GrObjMessageOptimizationFlags
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - grobject
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL SIZE
Common cases:
opt bit not set
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/26/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjOptInvalidateLine proc far
class GrObjClass
uses di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_msgOptFlags, mask GOMOF_INVALIDATE_LINE
jnz send
call GrObjInvalidate
done:
.leave
ret
send:
push ax
mov ax,MSG_GO_INVALIDATE_LINE
call ObjCallInstanceNoLock
pop ax
jmp done
GrObjOptInvalidateLine endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjChangeGrObjBaseAreaAttrElementField
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove reference to passed index and add new reference
for same data with one field changed.
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - object
cx - index
dx:ax - new field data
bx - offset in GrObjBaseAreaAttrElement to field
di - field size in bytes
1 byte - al
2 bytes - ax
3 bytes - dl,ax
4 bytes - dx,ax
RETURN:
cx - new element number
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
If unable to get the current attributes, just punt
and return the original index.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjChangeGrObjBaseAreaAttrElementField proc far
uses ax,bp,di,es
.enter
; Get the current attributes and then remove our
; reference to them
;
sub sp,size GrObjFullAreaAttrElement
mov bp,sp
call GrObjGetGrObjFullAreaAttrElement
jnc clearFrame
call GrObjDerefGrObjAreaToken
; Copy the new data into the attribute structure
;
mov cx,di ;number of bytes
segmov es,ss ;dest segment
mov di,bp ;frame offset
add di,bx ;field offset
stosb
dec cx
jcxz addElement
mov al,ah
stosb
dec cx
jcxz addElement
mov al,dl
stosb
dec cx
jcxz addElement
mov al,dh
stosb
addElement:
; Add the new element to the attribute arrays
;
call GrObjAddGrObjFullAreaAttrElement
mov cx,ax ;new token
clearFrame:
add sp, size GrObjFullAreaAttrElement
.leave
ret
GrObjChangeGrObjBaseAreaAttrElementField endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjChangeGrObjBaseAreaAttrElementByteRecord
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove reference to passed index and add new reference
for same data with one field changed.
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - object
cx - index
al - bits to set
ah - bits to reset
bx - offset in GrObjBaseAreaAttrElement to byte record
RETURN:
cx - new element number
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
If unable to get the current attributes, just punt
and return the original index.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjChangeGrObjBaseAreaAttrElementByteRecord proc far
uses ax,bp,di
.enter
; Get the current attributes and then remove our
; reference to them
;
sub sp,size GrObjFullAreaAttrElement
mov bp,sp
call GrObjGetGrObjFullAreaAttrElement
jnc clearFrame
call GrObjDerefGrObjAreaToken
; Copy the new data into the attribute structure
;
mov di,bx
mov cl,ss:[bp][di]
not ah ;make bits to reset 0's
andnf cl,ah ;reset bits
ornf cl,al ;set bits
mov ss:[bp][di],cl
; Add the new element to the attribute arrays
;
call GrObjAddGrObjFullAreaAttrElement
mov cx,ax ;new token
clearFrame:
add sp, size GrObjFullAreaAttrElement
.leave
ret
GrObjChangeGrObjBaseAreaAttrElementByteRecord endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjChangeGrObjBaseLineAttrElementField
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove reference to passed index and add new reference
for same data with one field changed.
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - object
cx - index
dx:ax - new field data
bx - offset in GrObjBaseLineAttrElement to field
di - field size in bytes
1 byte - al
2 bytes - ax
3 bytes - dl,ax
4 bytes - dx,ax
RETURN:
cx - new element number
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
If unable to get the current attributes, just punt
and return the original index.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjChangeGrObjBaseLineAttrElementField proc far
uses ax,bp,di,es
.enter
; Invalidate the object before hand in case the line
; width shrinks.
;
push ax ;new data
mov ax,MSG_GO_INVALIDATE_LINE
call ObjCallInstanceNoLock
pop ax ;new data
; Get the current attributes and then remove our
; reference to them
;
sub sp,size GrObjFullLineAttrElement
mov bp,sp
call GrObjGetGrObjFullLineAttrElement
jnc clearFrame
call GrObjDerefGrObjLineToken
; Copy the new data into the attribute structure
;
mov cx,di ;number of bytes
segmov es,ss ;dest segment
mov di,bp ;frame offset
add di,bx ;field offset
stosb
dec cx
jz addElement
mov al,ah
stosb
dec cx
jz addElement
mov al,dl
stosb
dec cx
jz addElement
mov al,dh
stosb
addElement:
; Add the new element to the attribute arrays
;
call GrObjAddGrObjFullLineAttrElement
mov cx,ax ;new token
clearFrame:
add sp, size GrObjFullLineAttrElement
.leave
ret
GrObjChangeGrObjBaseLineAttrElementField endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjChangeGrObjBaseLineAttrElementByteRecord
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove reference to passed index and add new reference
for same data with one field changed.
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - object
cx - index
al - bits to set
ah - bits to reset
bx - offset in GrObjBaseLineAttrElement to byte record
RETURN:
cx - new element number
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
If unable to get the current attributes, just punt
and return the original index.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjChangeGrObjBaseLineAttrElementByteRecord proc far
uses ax,bp,di
.enter
; Get the current attributes and then remove our
; reference to them
;
sub sp,size GrObjFullLineAttrElement
mov bp,sp
call GrObjGetGrObjFullLineAttrElement
jnc clearFrame
call GrObjDerefGrObjLineToken
; Copy the new data into the attribute structure
;
mov di,bx
mov cl,ss:[bp][di]
not ah ;make bits to reset 0's
andnf cl,ah ;reset bits
ornf cl,al ;set bits
mov ss:[bp][di],cl
; Add the new element to the attribute arrays
;
call GrObjAddGrObjFullLineAttrElement
mov cx,ax ;new token
clearFrame:
add sp, size GrObjFullLineAttrElement
.leave
ret
GrObjChangeGrObjBaseLineAttrElementByteRecord endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjAddGrObjFullAreaAttrElement
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
Add an element (or a new reference to an existing element)
in the area attr element array in body
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - object
ss:bp - GrObjBaseAreaAttrElement
RETURN:
ax - element number
stc - if this element newly added
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/23/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAddGrObjFullAreaAttrElement proc far
uses di,dx
.enter
EC < call ECGrObjCheckLMemObject >
EC < push ds >
EC < segmov ds,ss >
EC < call GrObjCheckGrObjBaseAreaAttrElement >
EC < pop ds >
call GrObjDetermineAreaAttributeDataSize
mov dx,ax ;element size
mov ax,MSG_GOAM_ADD_AREA_ATTR_ELEMENT
mov di,mask MF_FIXUP_DS or mask MF_CALL or mask MF_STACK
call GrObjMessageToGOAM
.leave
ret
GrObjAddGrObjFullAreaAttrElement endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjAddGrObjFullLineAttrElement
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
Add an element (or a new reference to an existing element)
in the line attr element array in body
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - segment of object block
ss:bp - GrObjBaseLineAttrElement
RETURN:
ax - element number
stc - if this element newly added
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/23/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAddGrObjFullLineAttrElement proc far
uses di,dx
.enter
EC < call ECGrObjCheckLMemObject >
EC < push ds >
EC < segmov ds,ss >
EC < call GrObjCheckGrObjBaseLineAttrElement >
EC < pop ds >
call GrObjDetermineLineAttributeDataSize
mov dx,ax ;element size
mov ax,MSG_GOAM_ADD_LINE_ATTR_ELEMENT
mov di,mask MF_FIXUP_DS or mask MF_STACK or mask MF_CALL
call GrObjMessageToGOAM
.leave
ret
GrObjAddGrObjFullLineAttrElement endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjDerefGrObjAreaToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Dereference element in area attr array (remove if
reference count geos to zero)
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - object
cx - token
RETURN:
stc - if element actually removed
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/23/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjDerefGrObjAreaToken proc far
uses ax,di
.enter
EC < call ECGrObjCheckLMemObject >
; Must check for null element here because floater will
; deref on final_obj_free, but the body will have
; already been destroyed.
;
cmp cx, CA_NULL_ELEMENT
je null
mov ax,MSG_GOAM_DEREF_AREA_ATTR_ELEMENT_TOKEN
mov di,mask MF_FIXUP_DS or mask MF_CALL
call GrObjMessageToGOAM
done:
.leave
ret
null:
clc
jmp done
GrObjDerefGrObjAreaToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjDerefGrObjLineToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Dereference element in line attr array (remove if
reference count geos to zero)
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - object
cx - line token
RETURN:
stc - if element actually removed
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/23/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjDerefGrObjLineToken proc far
uses ax,di
.enter
EC < call ECGrObjCheckLMemObject >
; Must check for null element here because floater will
; deref on final_obj_free, but the body will have
; already been destroyed.
;
cmp cx, CA_NULL_ELEMENT
je null
mov ax,MSG_GOAM_DEREF_LINE_ATTR_ELEMENT_TOKEN
mov di,mask MF_FIXUP_DS or mask MF_CALL
call GrObjMessageToGOAM
done:
.leave
ret
null:
clc
jmp done
GrObjDerefGrObjLineToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjAddRefGrObjAreaToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Add reference to element in area attr array
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - object
cx - area token
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
element is valid
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/23/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAddRefGrObjAreaToken proc far
uses ax,di
.enter
EC < call ECGrObjCheckLMemObject >
mov di,mask MF_FIXUP_DS or mask MF_CALL
mov ax,MSG_GOAM_ADD_REF_AREA_ATTR_ELEMENT_TOKEN
call GrObjMessageToGOAM
.leave
ret
GrObjAddRefGrObjAreaToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjAddRefGrObjLineToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
Add reference to element in line attr array
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - segment of object block
cx - line token
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
element is valid
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/23/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAddRefGrObjLineToken proc far
uses ax,di
.enter
mov ax,MSG_GOAM_ADD_REF_LINE_ATTR_ELEMENT_TOKEN
mov di,mask MF_FIXUP_DS or mask MF_CALL
call GrObjMessageToGOAM
.leave
ret
GrObjAddRefGrObjLineToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjDetermineAreaAttributeDataSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine the size of the area attribute data in
the passed stack frame. The structure begings
with an GrObjBaseAreaAttrElement and size of the remaining
data can be determined for the data in the
GrObjBaseAreaAttrElement.
Currently, there can be no extra data below the
GrObjBaseAreaAttrElement, so just return its size
CALLED BY: INTERNAL (UTILITY)
PASS:
ss:bp - area attributes structure
RETURN:
ax - size of data in structure
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/24/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjDetermineAreaAttributeDataSize proc far
.enter
mov ax, size GrObjBaseAreaAttrElement
cmp ss:[bp].GOBAAE_aaeType,GOAAET_BASE
jne other
done:
.leave
ret
other:
cmp ss:[bp].GOBAAE_aaeType,GOAAET_GRADIENT
EC < ERROR_NE GROBJ_BAD_AREA_ATTR_ELEMENT_TYPE >
mov ax,size GrObjGradientAreaAttrElement
jmp done
GrObjDetermineAreaAttributeDataSize endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjDetermineLineAttributeDataSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine the size of the line attribute data in
the passed stack frame. The structure begings
with an GrObjBaseLineAttrElement and size of the remaining
data can be determined for the data in the
GrObjBaseLineAttrElement.
Currently, there can be no extra data below the
GrObjBaseLineAttrElement, so just return its size
CALLED BY: INTERNAL (UTILITY)
PASS:
ss:bp - line attributes structure
RETURN:
ax - size of data in structure
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/24/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjDetermineLineAttributeDataSize proc far
.enter
mov ax, size GrObjBaseLineAttrElement
cmp ss:[bp].GOBLAE_laeType,GOLAET_BASE
EC < ERROR_NE GROBJ_BAD_LINE_ATTR_ELEMENT_TYPE >
.leave
ret
GrObjDetermineLineAttributeDataSize endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetAreaColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return area color of object . Will return 0,0,0 if
area element is null.
CALLED BY: INTERNAL
PASS:
*ds:si - object
RETURN:
cl - r
ch - g
dl - b
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL SIZE
because it is used during drawing.
Common cases:
Area element is valid
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetAreaColor proc far
class GrObjClass
uses bp
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_areaAttrToken
sub sp, size GrObjFullAreaAttrElement
mov bp,sp
call GrObjGetGrObjFullAreaAttrElement
jnc noElement
mov cl,ss:[bp].GOBAAE_r
mov ch,ss:[bp].GOBAAE_g
mov dl,ss:[bp].GOBAAE_b
clearFrame:
add sp, size GrObjFullAreaAttrElement
.leave
ret
noElement:
clr cx
clr dl
jmp clearFrame
GrObjGetAreaColor endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetLineColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return line color of object . Will return 0,0,0 if
line element is null.
CALLED BY: INTERNAL
PASS:
*ds:si - object
RETURN:
cl - r
ch - g
dl - b
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL SIZE
because it is used during drawing.
Common cases:
Line element is valid
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetLineColor proc far
class GrObjClass
uses bp
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_lineAttrToken
sub sp, size GrObjFullLineAttrElement
mov bp,sp
call GrObjGetGrObjFullLineAttrElement
jnc noElement
mov cl,ss:[bp].GOBLAE_r
mov ch,ss:[bp].GOBLAE_g
mov dl,ss:[bp].GOBLAE_b
clearFrame:
add sp, size GrObjFullLineAttrElement
.leave
ret
noElement:
clr cx
clr dl
jmp clearFrame
GrObjGetLineColor endp
GrObjAttributesCode ends
GrObjDrawCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetGrObjFullAreaAttrElement
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send a message to the GrObjAttributeManager to
get the GrObjFullAreaAttrElement for the passed index
CALLED BY: INTERNAL
PASS:
*ds:si - object
cx - element number
ss:bp - GrObjFullAreaAttrElement - empty
RETURN:
stc - element exists
ss:bp - GrObjFullAreaAttrElement - filled
clc - element
ss:bp - garbage
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL SIZE
because it is used during drawing
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetGrObjFullAreaAttrElement proc far
uses ax,dx,di
.enter
EC < call ECGrObjCheckLMemObject >
mov di,mask MF_FIXUP_DS or mask MF_CALL or mask MF_STACK
mov dx,size GrObjFullAreaAttrElement
mov ax,MSG_GOAM_GET_FULL_AREA_ATTR_ELEMENT
call GrObjMessageToGOAM
; Error check the the area attributes if data was
; actually returned
EC < jnc errorDone >
EC < pushf >
EC < push ds >
EC < segmov ds,ss >
EC < call GrObjCheckGrObjBaseAreaAttrElement >
EC < pop ds >
EC < popf >
EC <errorDone: >
.leave
ret
GrObjGetGrObjFullAreaAttrElement endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetGrObjFullLineAttrElement
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return GrObjBaseLineAttrElement for object
CALLED BY: INTERNAL
PASS:
*ds:si - object
cx - element number
ss:bp - GrObjFullLineAttrElement - empty
RETURN:
stc - element exists
ss:bp - GrObjFullLineAttrElement - filled
clc - element
ss:bp - garbage
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL SIZE
because it is used during drawing
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetGrObjFullLineAttrElement proc far
uses ax,dx,di
.enter
EC < call ECGrObjCheckLMemObject >
mov di,mask MF_FIXUP_DS or mask MF_CALL or mask MF_STACK
mov dx,size GrObjFullLineAttrElement
mov ax,MSG_GOAM_GET_FULL_LINE_ATTR_ELEMENT
call GrObjMessageToGOAM
; Error check the the line attributes if data was
; actually returned
;
EC < jnc errorDone >
EC < pushf >
EC < push ds >
EC < segmov ds,ss >
EC < call GrObjCheckGrObjBaseLineAttrElement >
EC < pop ds >
EC < popf >
EC <errorDone: >
.leave
ret
GrObjGetGrObjFullLineAttrElement endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjApplyGrObjAreaToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Apply the area attributes found in the body area attribute
array at the passed index to the gstate
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - segment of object block
cx - token
di - gstate
RETURN:
di - gstate with attributes applied
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjApplyGrObjAreaToken proc far
uses bp
.enter
EC < call ECGrObjCheckLMemObject >
sub sp,size GrObjFullAreaAttrElement
mov bp,sp
call GrObjGetGrObjFullAreaAttrElement
jnc clearFrame
call GrObjApplyGrObjFullAreaAttrElement
clearFrame:
add sp, size GrObjFullAreaAttrElement
.leave
ret
GrObjApplyGrObjAreaToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjApplyGrObjLineToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Apply the line attributes found in the body line attribute
array at the passed index to the gstate
CALLED BY: INTERNAL (UTILITY)
PASS:
*ds:si - object
cx - token
di - gstate
RETURN:
di - gstate with attributes applied
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjApplyGrObjLineToken proc far
uses bp
.enter
EC < call ECGrObjCheckLMemObject >
sub sp,size GrObjFullLineAttrElement
mov bp,sp
call GrObjGetGrObjFullLineAttrElement
jnc clearFrame
call GrObjApplyGrObjFullLineAttrElement
clearFrame:
add sp, size GrObjFullLineAttrElement
.leave
ret
GrObjApplyGrObjLineToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjApplyGrObjFullAreaAttrElement
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Apply area attibutes passed in stack frame to gstate
PASS:
ss:bp - GrObjFullAreaAttrElement
di - gstate
RETURN:
GState altered
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
nothing
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 11/16/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjApplyGrObjFullAreaAttrElement proc far
uses ax,dx,ds,si
push bx
mov bx, bp ; ss:bx -> GrObjBaseAreaAttrElement
aa local AreaAttr
.enter
EC < call ECCheckGStateHandle >
mov ss:aa.AA_colorFlag, CF_RGB
mov al,ss:[bx].GOBAAE_r
mov ss:aa.AA_color.RGB_red, al
mov ax, {word} ss:[bx].GOBAAE_g ;also GOBAAE_b
mov {word} ss:aa.AA_color.RGB_green, ax
mov ss:aa.AA_mapMode, (CMT_DITHER shl offset CMM_MAP_TYPE )
mov al, ss:[bx].GOBAAE_mask
mov ss:aa.AA_mask, al
segmov ds, ss, si
lea si, ss:aa
call GrSetAreaAttr
mov al, ss:[bx].GOBAAE_drawMode
call GrSetMixMode
mov al,ss:[bx].GOBAAE_pattern.GP_type
mov ah,ss:[bx].GOBAAE_pattern.GP_data
call GrSetAreaPattern
.leave
pop bx
ret
GrObjApplyGrObjFullAreaAttrElement endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjApplyGrObjFullLineAttrElement
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sets gstate to line attrs in passed structure
PASS:
ss:bp - fptr to GrObjFullLineAttrElement
di - gstate
RETURN:
GState altered
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 11/16/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjApplyGrObjFullLineAttrElement proc far
uses ax,cx,dx,si,ds
push bx
mov bx, bp ; ss:bx -> LAE...
la local LineAttr
.enter
EC < call ECCheckGStateHandle >
mov ss:la.LA_colorFlag, CF_RGB
mov al,ss:[bx].GOBLAE_r
mov ss:la.LA_color.RGB_red, al
mov ax,{word} ss:[bx].GOBLAE_g ;also b
mov {word} ss:la.LA_color.RGB_green, ax
mov ax,{word} ss:[bx].GOBLAE_end ;also line join
mov {word} ss:la.LA_end, ax
mov ax,ss:[bx].GOBLAE_width.WWF_int
; We've got a bug I can't find that sets the line width to
; -1. Until we find it lets at least prevent bad things
; from happening.
;
tst ax
js bummer
lineWidthOKNow:
mov ss:la.LA_width.WWF_int, ax
mov ax, ss:[bx].GOBLAE_width.WWF_frac
mov ss:la.LA_width.WWF_frac, ax
mov ss:la.LA_mapMode, (CMT_DITHER shl offset CMM_MAP_TYPE )
mov al, ss:[bx].GOBLAE_mask
mov ss:la.LA_mask, al
mov al, ss:[bx].GOBLAE_style
mov ss:la.LA_style, al
segmov ds, ss, si
lea si, ss:la
call GrSetLineAttr
mov ax,ss:[bx].GOBLAE_miterLimit.WWF_frac
mov bx,ss:[bx].GOBLAE_miterLimit.WWF_int
call GrSetMiterLimit ;degrees
.leave
pop bx
ret
bummer:
mov ax,1
jmp lineWidthOKNow
GrObjApplyGrObjFullLineAttrElement endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetAreaInfoAndMask
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return areaInfo of object . Will return zero if
area element is null.
CALLED BY: INTERNAL
PASS:
*ds:si - object
RETURN:
al - AreaAttrInfoRecord
ah - SystemDrawMask
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL SIZE
because it is used during drawing.
Common cases:
Area element is valid
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetAreaInfoAndMask proc far
class GrObjClass
uses bp,cx
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_areaAttrToken
sub sp, size GrObjFullAreaAttrElement
mov bp,sp
call GrObjGetGrObjFullAreaAttrElement
jnc noElement
mov al,ss:[bp].GOBAAE_areaInfo
mov ah,ss:[bp].GOBAAE_mask
clearFrame:
add sp, size GrObjFullAreaAttrElement
.leave
ret
noElement:
clr al ;AreaAttrInfoRecord
mov ah,SDM_100
jmp clearFrame
GrObjGetAreaInfoAndMask endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjApplyBackgroundAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Apply attributes to draw background of object.
Color = white
Mask = 100
DrawMode = COPY
MapColorToMono = Dither
CALLED BY: INTERNAL
PASS:
*ds:si - object
di - gstate
RETURN:
di - gstate with altered attributes
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/21/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjApplyBackgroundAttrs proc far
class GrObjClass
uses ax,cx,bx
.enter
EC < call ECGrObjCheckLMemObject >
; Apply line attributes because we need the line width,
; end, join, and miter limit for background lines
;
GrObjDeref bx,ds,si
mov cx,ds:[bx].GOI_lineAttrToken
call GrObjApplyGrObjLineToken
; The background color is stored in the area structure
;
GrObjDeref bx,ds,si
mov cx,ds:[bx].GOI_areaAttrToken
sub sp,size GrObjFullAreaAttrElement
mov bp,sp
call GrObjGetGrObjFullAreaAttrElement
jnc clearFrame
mov al,ss:[bp].GOBAAE_backR
mov bl,ss:[bp].GOBAAE_backG
mov bh,ss:[bp].GOBAAE_backB
mov ah,CF_RGB
clearFrame:
add sp, size GrObjFullAreaAttrElement
call GrSetAreaColor
call GrSetLineColor
mov al,SDM_100
call GrSetAreaMask
call GrSetLineMask
mov al,(CMT_DITHER shl offset CMM_MAP_TYPE )
call GrSetAreaColorMap
call GrSetLineColorMap
mov al, MM_COPY
call GrSetMixMode
mov al,PT_SOLID
call GrSetAreaPattern
.leave
ret
GrObjApplyBackgroundAttrs endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetAreaAttrElementType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return GrObjAreaAttrElementType of object
CALLED BY: INTERNAL
PASS:
*ds:si - object
RETURN:
al - GrObjAreaAttrElementType
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
Area element is valid
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetAreaAttrElementType proc far
class GrObjClass
uses bp,cx
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_areaAttrToken
sub sp, size GrObjFullAreaAttrElement
mov bp,sp
call GrObjGetGrObjFullAreaAttrElement
jnc noElement
mov al,ss:[bp].GOBAAE_aaeType
clearFrame:
add sp, size GrObjFullAreaAttrElement
.leave
ret
noElement:
clr al
jmp clearFrame
GrObjGetAreaAttrElementType endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetLineAttrElementType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return GrObjLineAttrElementType of object
CALLED BY: INTERNAL
PASS:
*ds:si - object
RETURN:
al - GrObjLineAttrElementType
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
Line element is valid
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetLineAttrElementType proc far
class GrObjClass
uses bp,cx
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_lineAttrToken
sub sp, size GrObjFullLineAttrElement
mov bp,sp
call GrObjGetGrObjFullLineAttrElement
jnc noElement
mov al,ss:[bp].GOBAAE_aaeType
clearFrame:
add sp, size GrObjFullLineAttrElement
.leave
ret
noElement:
clr al
jmp clearFrame
GrObjGetLineAttrElementType endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetLineInfo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return lineInfo of object . Will return zero if
line element is null.
CALLED BY: INTERNAL
PASS:
*ds:si - object
RETURN:
al - LineAttrInfoRecord
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL SIZE
because it is used during drawing.
Common cases:
Line element is valid
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetLineInfo proc far
class GrObjClass
uses bp,cx
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_lineAttrToken
sub sp, size GrObjFullLineAttrElement
mov bp,sp
call GrObjGetGrObjFullLineAttrElement
jnc noElement
mov al,ss:[bp].GOBLAE_lineInfo
clearFrame:
add sp, size GrObjFullLineAttrElement
.leave
ret
noElement:
clr al
jmp clearFrame
GrObjGetLineInfo endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetArrowheadInfo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return information about arrowheads. Will return zeros if
line element is null.
CALLED BY: INTERNAL
PASS:
*ds:si - object
RETURN:
al - LineAttrInfoRecord
bl - arrowhead length
bh - arrowhead angle
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL SIZE
because it is used during drawing.
Common cases:
Line element is valid
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetArrowheadInfo proc far
class GrObjClass
uses bp,cx
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_lineAttrToken
sub sp, size GrObjFullLineAttrElement
mov bp,sp
call GrObjGetGrObjFullLineAttrElement
jnc noElement
mov al,ss:[bp].GOBLAE_lineInfo
mov bl,ss:[bp].GOBLAE_arrowheadLength
mov bh,ss:[bp].GOBLAE_arrowheadAngle
clearFrame:
add sp, size GrObjFullLineAttrElement
.leave
ret
noElement:
clr al
clr bx
jmp clearFrame
GrObjGetArrowheadInfo endp
GrObjDrawCode ends
GrObjAlmostRequiredCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetLineWidth
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return line width of object. Will return zero if line
element number is null or the line mask is zero.
CALLED BY: INTERNAL
PASS:
*ds:si - object
RETURN:
di:bp - WWFixed width
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL SIZE
because it is used during drawing.
Common cases:
Line element is valid
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetLineWidth proc far
class GrObjClass
uses cx
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
mov cx,ds:[di].GOI_lineAttrToken
sub sp, size GrObjFullLineAttrElement
mov bp,sp
call GrObjGetGrObjFullLineAttrElement
jnc returnZeroThickness
cmp ss:[bp].GOBLAE_mask, SDM_0
je returnZeroThickness
mov di, ss:[bp].GOBLAE_width.WWF_int
mov bp, ss:[bp].GOBLAE_width.WWF_frac
clearFrame:
add sp, size GrObjFullLineAttrElement
.leave
ret
returnZeroThickness:
clr di
mov bp,di
jmp clearFrame
GrObjGetLineWidth endp
GrObjAlmostRequiredCode ends
GrObjSpecialGraphicsCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetStartingGradientColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return starting gradient color of object. Which
happens to be stored in the normal fg area color.
Will return 0,0,0 if area element is null or
isn't of type GOAAET_GRADIENT
CALLED BY: INTERNAL
PASS:
*ds:si - object
RETURN:
cl - r
ch - g
dl - b
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
Area element is valid
Area element is gradient type
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetStartingGradientColor proc far
class GrObjClass
uses bp
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_areaAttrToken
sub sp, size GrObjFullAreaAttrElement
mov bp,sp
call GrObjGetGrObjFullAreaAttrElement
jnc noElement
cmp ss:[bp].GOBAAE_aaeType,GOAAET_GRADIENT
jne noElement
mov cl,ss:[bp].GOBAAE_r
mov ch,ss:[bp].GOBAAE_g
mov dl,ss:[bp].GOBAAE_b
clearFrame:
add sp, size GrObjFullAreaAttrElement
.leave
ret
noElement:
clr cx
clr dl
jmp clearFrame
GrObjGetStartingGradientColor endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetEndingGradientColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return ending gradient color of object.
Will return 0,0,0 if area element is null or
isn't of type GOAAET_GRADIENT
CALLED BY: INTERNAL
PASS:
*ds:si - object
RETURN:
cl - r
ch - g
dl - b
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
Area element is valid
Area element is gradient type
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetEndingGradientColor proc far
class GrObjClass
uses bp
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_areaAttrToken
sub sp, size GrObjFullAreaAttrElement
mov bp,sp
call GrObjGetGrObjFullAreaAttrElement
jnc noElement
cmp ss:[bp].GOBAAE_aaeType,GOAAET_GRADIENT
jne noElement
mov cl,ss:[bp].GOGAAE_endR
mov ch,ss:[bp].GOGAAE_endG
mov dl,ss:[bp].GOGAAE_endB
clearFrame:
add sp, size GrObjFullAreaAttrElement
.leave
ret
noElement:
clr cx
clr dl
jmp clearFrame
GrObjGetEndingGradientColor endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetNumberOfGradientIntervals
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return number of gradient intervals
Will return 0 if area element is null or
isn't of type GOAAET_GRADIENT
CALLED BY: INTERNAL
PASS:
*ds:si - object
RETURN:
cx - number of intervals
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
Area element is valid
Area element is gradient type
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetNumberOfGradientIntervals proc far
class GrObjClass
uses bp
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_areaAttrToken
sub sp, size GrObjFullAreaAttrElement
mov bp,sp
call GrObjGetGrObjFullAreaAttrElement
jnc noElement
cmp ss:[bp].GOBAAE_aaeType,GOAAET_GRADIENT
jne noElement
mov cx,ss:[bp].GOGAAE_numIntervals
clearFrame:
add sp, size GrObjFullAreaAttrElement
.leave
ret
noElement:
clr cx
jmp clearFrame
GrObjGetNumberOfGradientIntervals endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetGradientType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return number of gradient intervals
Will return GOGT_LEFT_TO_RIGHT if area element is null or
isn't of type GOAAET_GRADIENT
CALLED BY: INTERNAL
PASS:
*ds:si - object
RETURN:
al - GrObjGradientType
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
Area element is valid
Area element is gradient type
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetGradientType proc far
class GrObjClass
uses bp
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_areaAttrToken
sub sp, size GrObjFullAreaAttrElement
mov bp,sp
call GrObjGetGrObjFullAreaAttrElement
jnc noElement
cmp ss:[bp].GOBAAE_aaeType,GOAAET_GRADIENT
jne noElement
mov al,ss:[bp].GOGAAE_type
clearFrame:
add sp, size GrObjFullAreaAttrElement
.leave
ret
noElement:
mov al,GOGT_LEFT_TO_RIGHT
jmp clearFrame
GrObjGetGradientType endp
GrObjSpecialGraphicsCode ends
|
asm/include/ram-map.asm | PaddyCo/mw3rando | 0 | 105442 | <reponame>PaddyCo/mw3rando
;; Game
GAME_RAM_START offset $FF962C
gold offset $FF8CAE
curr_shop_item offset $FFA300
curr_shop_addr_array
;; TODO: Figure out max length of shop_spot_states
RAM_START offset $FF1000
temp offset $FF1004
temp2 offset $FF1008
temp3 offset $FF100C
temp4 offset $FF1010
shop_spot_addr
BOUGHT_SPELLS_START offset $FF2000
bought_spells_arr
|
oeis/266/A266217.asm | neoneye/loda-programs | 11 | 179497 | <gh_stars>10-100
; A266217: Binary representation of the n-th iteration of the "Rule 7" elementary cellular automaton starting with a single ON (black) cell.
; Submitted by <NAME>(s1.)
; 1,110,0,1111111,0,11111111111,0,111111111111111,0,1111111111111111111,0,11111111111111111111111,0,111111111111111111111111111,0,1111111111111111111111111111111,0,11111111111111111111111111111111111,0,111111111111111111111111111111111111111,0,1111111111111111111111111111111111111111111,0,11111111111111111111111111111111111111111111111,0,111111111111111111111111111111111111111111111111111,0,1111111111111111111111111111111111111111111111111111111,0
seq $0,266218 ; Decimal representation of the n-th iteration of the "Rule 7" elementary cellular automaton starting with a single ON (black) cell.
mul $0,2
seq $0,7088 ; The binary numbers (or binary words, or binary vectors, or binary expansion of n): numbers written in base 2.
div $0,10
|
src/Similarity.agda | nad/up-to | 0 | 15942 | <filename>src/Similarity.agda
------------------------------------------------------------------------
-- A coinductive definition of (strong) similarity
------------------------------------------------------------------------
{-# OPTIONS --sized-types #-}
open import Labelled-transition-system
module Similarity {ℓ} (lts : LTS ℓ) where
open import Equality.Propositional
open import Prelude
open import Prelude.Size
open import Bisimilarity lts as SB using ([_]_∼_; [_]_∼′_)
open import Indexed-container hiding (⟨_⟩)
open import Relation
import Similarity.General
open LTS lts
private
module General = Similarity.General lts _[_]⟶_ id
open General public
using (module StepC; ⟨_⟩; challenge; force;
reflexive-≤; reflexive-≤′; ≡⇒≤; ≤:_; ≤′:_;
[_]_≡_; [_]_≡′_; []≡↔; Extensionality; extensionality)
-- StepC is given in the following way, rather than via open public,
-- to make hyperlinks to it more informative.
StepC : Container (Proc × Proc) (Proc × Proc)
StepC = General.StepC
-- The following definitions are given explicitly, in order to make
-- the code easier to follow.
Similarity : Size → Rel₂ ℓ Proc
Similarity = ν StepC
Similarity′ : Size → Rel₂ ℓ Proc
Similarity′ = ν′ StepC
infix 4 [_]_≤_ [_]_≤′_ _≤_ _≤′_
[_]_≤_ : Size → Proc → Proc → Type ℓ
[ i ] p ≤ q = ν StepC i (p , q)
[_]_≤′_ : Size → Proc → Proc → Type ℓ
[ i ] p ≤′ q = ν′ StepC i (p , q)
_≤_ : Proc → Proc → Type ℓ
_≤_ = [ ∞ ]_≤_
_≤′_ : Proc → Proc → Type ℓ
_≤′_ = [ ∞ ]_≤′_
private
-- However, these definitions are definitionally equivalent to
-- corresponding definitions in General.
indirect-Similarity : Similarity ≡ General.Similarity
indirect-Similarity = refl
indirect-Similarity′ : Similarity′ ≡ General.Similarity′
indirect-Similarity′ = refl
indirect-[]≤ : [_]_≤_ ≡ General.[_]_≤_
indirect-[]≤ = refl
indirect-[]≤′ : [_]_≤′_ ≡ General.[_]_≤′_
indirect-[]≤′ = refl
indirect-≤ : _≤_ ≡ General._≤_
indirect-≤ = refl
indirect-≤′ : _≤′_ ≡ General._≤′_
indirect-≤′ = refl
mutual
-- Bisimilarity is contained in similarity.
∼⇒≤ : ∀ {i p q} → [ i ] p ∼ q → [ i ] p ≤ q
∼⇒≤ = λ p∼q →
⟨ (λ q⟶q′ →
let p′ , p⟶p′ , p′∼′q′ = SB.left-to-right p∼q q⟶q′
in p′ , p⟶p′ , ∼⇒≤′ p′∼′q′)
⟩
∼⇒≤′ : ∀ {i p q} → [ i ] p ∼′ q → [ i ] p ≤′ q
force (∼⇒≤′ p≳′q) = ∼⇒≤ (SB.force p≳′q)
mutual
-- Similarity is transitive.
transitive-≤ : ∀ {i p q r} → [ i ] p ≤ q → [ i ] q ≤ r → [ i ] p ≤ r
transitive-≤ p≤q q≤r =
⟨ (λ p⟶p′ →
let q′ , q⟶q′ , p′≤q′ = challenge p≤q p⟶p′
r′ , r⟶r′ , q′≤r′ = challenge q≤r q⟶q′
in r′ , r⟶r′ , transitive-≤′ p′≤q′ q′≤r′)
⟩
transitive-≤′ :
∀ {i p q r} → [ i ] p ≤′ q → [ i ] q ≤′ r → [ i ] p ≤′ r
force (transitive-≤′ p≤q q≤r) = transitive-≤ (force p≤q) (force q≤r)
|
programs/oeis/113/A113646.asm | neoneye/loda | 22 | 162044 | <gh_stars>10-100
; A113646: a(n) is the smallest composite integer which is >= n.
; 4,4,4,4,6,6,8,8,9,10,12,12,14,14,15,16,18,18,20,20,21,22,24,24,25,26,27,28,30,30,32,32,33,34,35,36,38,38,39,40,42,42,44,44,45,46,48,48,49,50,51,52,54,54,55,56,57,58,60,60,62,62,63,64,65,66,68,68,69,70,72,72,74,74,75,76,77,78,80,80,81,82,84,84,85,86,87,88,90,90,91,92,93,94,95,96,98,98,99,100
max $0,2
mov $1,$0
seq $1,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
add $0,$1
add $0,1
|
source/asis/asis-gela-visibility.ads | faelys/gela-asis | 4 | 30454 | <filename>source/asis/asis-gela-visibility.ads
------------------------------------------------------------------------------
-- G E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
-- Purpose:
-- Resolve names and fill Corresponding_Defining_Name_List with
-- possible defining names
-- This package stores symbol table as hierarchy of declarative regions
-- starting from parent of Standard and includes regions of all unit
-- of context.
with Asis;
with Asis.Gela.Classes;
package Asis.Gela.Visibility is
type Point is private;
-- Represent point in source. Used to lookup names and to point to
-- place in declarative region.
Null_Point : constant Point;
function Enter_Unit (Unit : Asis.Compilation_Unit) return Point;
-- For given unit find corresponding declarative region.
-- Result used as initial value to traverse AST and construct
-- nested regions.
procedure Enter_Construction
(Element : in Asis.Element;
Point : in out Visibility.Point);
-- Create declarative region for given construct if it need it.
-- Jump to correspondong region if Element is completion.
procedure Leave_Construction
(Element : in Asis.Element;
Point : in out Visibility.Point);
-- Leave declarative region if construction has it.
function Lookup
(Item : Asis.Element;
Point : Visibility.Point) return Asis.Defining_Name_List;
-- Return defining names for given name or operator symbol.
-- Search starts from given point.
function Lookup_Direct
(Item : Asis.Element;
Point : Visibility.Point) return Asis.Defining_Name_List;
-- Return direct names for given name or operator symbol.
function Lookup_In_Region
(Item : Asis.Element;
Reg : Visibility.Point;
Point : Visibility.Point) return Asis.Defining_Name_List;
-- Return names from given region only.
function Lookup_In_Region
(Item : Asis.Element;
Element : Asis.Element;
Point : Visibility.Point)
return Asis.Defining_Name_List;
function Lookup_In_Parent_Region
(Item : Asis.Element;
Element : Asis.Element) return Asis.Defining_Name_List;
function Lookup_Use
(Item : Asis.Element;
Direct : Asis.Defining_Name_List;
Point : Visibility.Point) return Asis.Defining_Name_List;
-- Return names visible through use clauses.
procedure Print_Region
(Point : Visibility.Point;
Prefix : Wide_String := "");
-- Dump given region to stdout
procedure Print_Standard_Region;
procedure Try_To_Resolve
(Element : Asis.Expression;
Point : Visibility.Point);
-- Resolve name and collect in corresponfing_defining_name_list
procedure Try_To_Resolve_Goto
(Element : Asis.Expression;
Stmt : Asis.Statement);
procedure New_Implicit_Declaration
(Element : in Asis.Declaration;
Point : in out Visibility.Point;
Tipe : in Asis.Declaration;
Overridden : out Boolean);
-- Declare implicit declaration to given declarative region.
function Visible_From
(Name : in Asis.Defining_Name;
Point : in Asis.Element) return Boolean;
-- Check if name is visible from given point
function End_Of_Package
(The_Package : Asis.Declaration)
return Asis.Element;
-- Return special element used to mark end of package declaration
-- view point in call to Visible_From function.
-- For now defining_name of the package is chosen as such element.
function Is_Declared (Name : in Asis.Defining_Name) return Boolean;
-- Check if name was declared
procedure Set_Not_Declared (Name : in Asis.Defining_Name);
-- Mark name as not declared
type Region_Item_Access is private;
function Unique_Name (Name : in Asis.Defining_Name) return Wide_String;
-- Return unique name of region where Name declared and unique name of
-- defining name in this region
private
type Region_Node;
type Part_Node;
type Region_Item;
type Region_Access is access all Region_Node;
type Part_Access is access all Part_Node;
type Region_Item_Access is access all Region_Item;
type Item_Kinds is
(Definition,
Char, Wide_Char, Wide_Wide_Char,
Use_Package, Use_Type, Dummy);
type Region_Item (Kind : Item_Kinds := Definition) is record
Part : Part_Access;
Next : Region_Item_Access;
case Kind is
when Definition | Char | Wide_Char | Wide_Wide_Char =>
Defining_Name : Asis.Defining_Name;
-- List of equal names in the same region:
Prev : Region_Item_Access;
-- List of equal names in the upper regions:
Up : Region_Item_Access;
-- Count of equal names in this and upper regions (plus one):
Count : Asis.ASIS_Natural;
case Kind is
when Definition =>
Still_Hidden : Boolean;
Library_Unit : Boolean;
when others =>
null;
end case;
when Use_Package =>
Declaration : Asis.Declaration;
when Use_Type =>
Tipe : Asis.Gela.Classes.Type_Info;
when Dummy =>
null;
end case;
end record;
type Part_Kinds is
(A_Public_Limited_View_Part,
A_Private_Limited_View_Part, -- where names of private children go
A_Visible_Part,
A_Private_Part,
A_Public_Children_Part,
A_Private_Children_Part,
A_Body_Part);
subtype A_Children_Part is Part_Kinds range
A_Public_Children_Part .. A_Private_Children_Part;
subtype A_Limited_View_Part is Part_Kinds range
A_Public_Limited_View_Part .. A_Private_Limited_View_Part;
Is_Visible : constant array (Part_Kinds) of Boolean :=
(A_Public_Limited_View_Part |
A_Visible_Part |
A_Public_Children_Part => True,
others => False);
type Part_Node is record
Dummy_Item : aliased Region_Item (Dummy);
Kind : Part_Kinds;
Region : Region_Access;
Next : Part_Access;
Parent_Item : Region_Item_Access;
Last_Item : Region_Item_Access;
Element : Asis.Element;
end record;
type Region_Node is record
First_Part : aliased Part_Node;
Last_Part : Part_Access;
Next : Region_Access;
First_Child : Region_Access;
Library_Unit : Boolean := False;
Public_Child : Boolean := True;
Depth : Positive := 1;
end record;
-- function Parent (Object : Region) return Region;
type Point is record
Item : Region_Item_Access;
end record;
Null_Point : constant Point := (Item => null);
end Asis.Gela.Visibility;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, <NAME>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of the <NAME>, IE nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
|
programs/oeis/003/A003516.asm | neoneye/loda | 22 | 92016 | ; A003516: Binomial coefficients C(2n+1, n-2).
; 1,7,36,165,715,3003,12376,50388,203490,817190,3268760,13037895,51895935,206253075,818809200,3247943160,12875774670,51021117810,202112640600,800472431850,3169870830126,12551759587422,49699896548176,196793068630200,779255311989700,3085851035479212,12220888964329584,48402641245296107,191724747789809255,759510004936100355,3009106305270645216,11923179284862717872,47249626017378270486,187265264199657100730,742282223705428145880,2942618815403661578310,11666805764052999699370,46261812817306682205610,183461779104129314989200,727646193812764637422200,2886329902123966395108060,11450434956358174214315220,45430499786320780368042960,180269279675371701169705350,715391445687606806682745350,2839309159995701681634184878,11270096716913884935796048416,44739148260023940935799206928,177620046158113916451089618700,705244219552964779378362635700,2800460682733954687567898175216,11121437347187855065264391142612,44170566953810873761232257938876,175446526514648916273469703784540,696940125414123253093858308567840,2768753043690653287291055280401328,11000443884358766514963173965341576,43709177426192925694146261692508888,173688356931669753989875128564649440,690245626090210892047687017807502515
mov $1,5
add $1,$0
add $1,$0
bin $1,$0
mov $0,$1
|
src/asf-beans-params.ads | jquorning/ada-asf | 12 | 25568 | <filename>src/asf-beans-params.ads
-----------------------------------------------------------------------
-- asf-beans-params -- Bean giving access to the request parameters
-- Copyright (C) 2011, 2012 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Beans.Basic;
with Util.Beans.Objects;
package ASF.Beans.Params is
-- Context variable giving access to the request parameters.
PARAM_ATTRIBUTE_NAME : constant String := "param";
-- ------------------------------
-- Request Parameter Bean
-- ------------------------------
-- The <b>Param_Bean</b> gives access to the request parameter.
-- The bean instance is global to the application.
type Param_Bean is new Util.Beans.Basic.Readonly_Bean with private;
-- Get the request parameter identified by the given name.
-- Returns Null_Object if the request does not define such parameter.
overriding
function Get_Value (Bean : in Param_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Return the Param_Bean instance.
function Instance return Util.Beans.Objects.Object;
private
type Param_Bean is new Util.Beans.Basic.Readonly_Bean with null record;
end ASF.Beans.Params;
|
oeis/002/A002203.asm | neoneye/loda-programs | 11 | 16682 | <filename>oeis/002/A002203.asm<gh_stars>10-100
; A002203: Companion Pell numbers: a(n) = 2*a(n-1) + a(n-2), a(0) = a(1) = 2.
; 2,2,6,14,34,82,198,478,1154,2786,6726,16238,39202,94642,228486,551614,1331714,3215042,7761798,18738638,45239074,109216786,263672646,636562078,1536796802,3710155682,8957108166,21624372014,52205852194,126036076402,304278004998,734592086398,1773462177794,4281516441986,10336495061766,24954506565518,60245508192802,145445522951122,351136554095046,847718631141214,2046573816377474,4940866263896162,11928306344169798,28797478952235758,69523264248641314,167844007449518386,405211279147678086
mov $1,2
lpb $0
sub $0,1
mov $3,$1
add $1,$2
mul $3,2
add $2,$3
lpe
mov $0,$1
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48.log_21829_2247.asm | ljhsiun2/medusa | 9 | 244584 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x1a2c7, %rsi
lea addresses_A_ht+0xb967, %rdi
nop
nop
nop
nop
add %rdx, %rdx
mov $34, %rcx
rep movsb
nop
sub $7283, %r9
lea addresses_normal_ht+0xafe7, %r13
nop
nop
nop
inc %rax
mov $0x6162636465666768, %r9
movq %r9, (%r13)
nop
nop
and $51268, %r9
lea addresses_WC_ht+0xfd67, %rax
clflush (%rax)
xor $21961, %rsi
movb $0x61, (%rax)
cmp $19547, %rax
lea addresses_A_ht+0x7137, %r13
nop
nop
sub %rdx, %rdx
movb (%r13), %al
nop
nop
sub $45495, %rcx
lea addresses_A_ht+0x86e7, %rsi
lea addresses_A_ht+0xd567, %rdi
nop
cmp $20991, %rdx
mov $29, %rcx
rep movsl
nop
nop
nop
nop
sub %rdx, %rdx
lea addresses_normal_ht+0x1b487, %r13
nop
add %rcx, %rcx
mov (%r13), %rsi
nop
nop
nop
cmp %rsi, %rsi
lea addresses_WT_ht+0x9d77, %rsi
lea addresses_WC_ht+0xa967, %rdi
nop
and %r11, %r11
mov $78, %rcx
rep movsw
nop
nop
nop
nop
cmp $9927, %r11
lea addresses_normal_ht+0xdf37, %rsi
lea addresses_normal_ht+0xdbe7, %rdi
nop
nop
nop
cmp %rax, %rax
mov $23, %rcx
rep movsq
nop
nop
nop
nop
nop
and $53612, %rdx
lea addresses_A_ht+0xd867, %rsi
lea addresses_normal_ht+0x1c28b, %rdi
nop
nop
nop
nop
nop
xor $41311, %r11
mov $47, %rcx
rep movsw
nop
dec %rax
lea addresses_UC_ht+0x9d87, %rsi
lea addresses_normal_ht+0xc8a7, %rdi
nop
nop
nop
sub %r9, %r9
mov $27, %rcx
rep movsq
add $32812, %rdx
lea addresses_WT_ht+0x124b9, %rsi
lea addresses_D_ht+0x1a467, %rdi
nop
and $43197, %rdx
mov $17, %rcx
rep movsq
xor $46688, %r11
lea addresses_UC_ht+0x13b67, %r11
nop
xor $41069, %rcx
movb (%r11), %al
nop
nop
nop
nop
sub $45179, %rdx
lea addresses_WT_ht+0x1d251, %rsi
nop
nop
sub $35582, %r9
movb $0x61, (%rsi)
nop
nop
nop
nop
nop
sub %rdx, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %rax
push %rbx
push %rdi
// Store
lea addresses_WT+0x12a7, %rbx
nop
nop
inc %rdi
movb $0x51, (%rbx)
nop
nop
add $61913, %rdi
// Faulty Load
mov $0x26b4320000000d67, %rdi
nop
and %r11, %r11
vmovups (%rdi), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %r14
lea oracles, %r11
and $0xff, %r14
shlq $12, %r14
mov (%r11,%r14,1), %r14
pop %rdi
pop %rbx
pop %rax
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': True, 'congruent': 6, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': True, 'congruent': 3, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 0, 'size': 1, '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
*/
|
Transynther/x86/_processed/US/_st_sm_/i7-8650U_0xd2_notsx.log_96_77.asm | ljhsiun2/medusa | 9 | 96145 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0xc8c3, %rsi
lea addresses_normal_ht+0x1290b, %rdi
clflush (%rdi)
dec %rbp
mov $22, %rcx
rep movsq
nop
nop
nop
nop
nop
inc %r14
lea addresses_UC_ht+0x2dc3, %rdx
nop
nop
add $44076, %r10
and $0xffffffffffffffc0, %rdx
vmovaps (%rdx), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $1, %xmm7, %rcx
nop
nop
nop
and $58534, %rbp
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %r8
push %rax
push %rcx
push %rsi
// Store
lea addresses_UC+0x1fcc3, %r8
nop
cmp %r13, %r13
mov $0x5152535455565758, %rsi
movq %rsi, %xmm3
vmovups %ymm3, (%r8)
nop
nop
nop
inc %rax
// Load
mov $0x66f06600000004c3, %r12
nop
nop
nop
xor %rcx, %rcx
mov (%r12), %rax
nop
nop
nop
nop
cmp $49693, %rcx
// Store
lea addresses_US+0x198c3, %r13
and $31854, %r15
movw $0x5152, (%r13)
nop
nop
nop
nop
nop
inc %rax
// Faulty Load
lea addresses_US+0x198c3, %rcx
nop
nop
dec %r8
mov (%rcx), %r15d
lea oracles, %rax
and $0xff, %r15
shlq $12, %r15
mov (%rax,%r15,1), %r15
pop %rsi
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 8, 'same': False}}
{'52': 96}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
llvm-2.9/test/FrontendAda/asm.adb | DependableSystemsLab/Trident | 5 | 18191 | <filename>llvm-2.9/test/FrontendAda/asm.adb<gh_stars>1-10
-- RUN: %llvmgcc -S %s
with System.Machine_Code;
procedure Asm is
begin
System.Machine_Code.Asm ("");
end;
|
.emacs.d/elpa/wisi-3.1.3/wisitoken-parse-packrat-procedural.ads | caqg/linux-home | 0 | 16352 | -- Abstract :
--
-- Procedural packrat parser, supporting only direct left recursion.
--
-- Coding style, algorithm is the same as generated by
-- wisi-generate_packrat, but in procedural form.
--
-- References:
--
-- See parent.
--
-- Copyright (C) 2018 - 2020 Free Software Foundation, Inc.
--
-- This library is free software; you can redistribute it and/or modify it
-- under terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 3, or (at your option) any later
-- version. This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
-- TABILITY 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.
pragma License (Modified_GPL);
with WisiToken.Productions;
package WisiToken.Parse.Packrat.Procedural is
-- These types duplicate Packrat.Generated. We keep them separate so
-- we can experiment with ways of implementing indirect left
-- recursion.
type Memo_State is (No_Result, Failure, Success);
subtype Result_States is Memo_State range Failure .. Success;
type Memo_Entry (State : Memo_State := No_Result) is record
case State is
when No_Result =>
null;
when Failure =>
null;
when Success =>
Result : WisiToken.Valid_Node_Index;
Last_Pos : Base_Token_Index;
end case;
end record;
package Memos is new SAL.Gen_Unbounded_Definite_Vectors
(Token_Index, Memo_Entry, Default_Element => (others => <>));
type Derivs is array (Token_ID range <>) of Memos.Vector;
type Parser (First_Nonterminal, Last_Nonterminal : Token_ID) is new Packrat.Parser with
record
Grammar : WisiToken.Productions.Prod_Arrays.Vector;
Start_ID : Token_ID;
Direct_Left_Recursive : Token_ID_Set (First_Nonterminal .. Last_Nonterminal);
Derivs : Procedural.Derivs (First_Nonterminal .. Last_Nonterminal);
end record;
function Create
(Grammar : in WisiToken.Productions.Prod_Arrays.Vector;
Direct_Left_Recursive : in Token_ID_Set;
Start_ID : in Token_ID;
Trace : access WisiToken.Trace'Class;
Lexer : WisiToken.Lexer.Handle;
User_Data : WisiToken.Syntax_Trees.User_Data_Access)
return Procedural.Parser;
overriding procedure Parse (Parser : aliased in out Procedural.Parser);
overriding function Tree (Parser : in Procedural.Parser) return Syntax_Trees.Tree;
overriding function Tree_Var_Ref
(Parser : aliased in out Procedural.Parser)
return Syntax_Trees.Tree_Variable_Reference;
overriding function Any_Errors (Parser : in Procedural.Parser) return Boolean
is (False);
-- All errors are reported by Parse raising Syntax_Error.
overriding procedure Put_Errors (Parser : in Procedural.Parser)
is null;
end WisiToken.Parse.Packrat.Procedural;
|
programs/oeis/274/A274576.asm | neoneye/loda | 22 | 28102 | ; A274576: a(2n) = floor(n/2), a(2n+1) = a(n), a(0)=0.
; 0,0,0,0,1,0,1,0,2,1,2,0,3,1,3,0,4,2,4,1,5,2,5,0,6,3,6,1,7,3,7,0,8,4,8,2,9,4,9,1,10,5,10,2,11,5,11,0,12,6,12,3,13,6,13,1,14,7,14,3,15,7,15,0,16,8,16,4,17,8,17,2,18,9,18,4,19,9,19,1,20,10,20,5,21,10,21,2,22,11,22,5,23,11,23,0,24,12,24,6
add $0,1
lpb $0
dif $0,2
lpe
div $0,4
|
oeis/092/A092773.asm | neoneye/loda-programs | 11 | 167968 | ; A092773: Prime(prime(n))^2+1)/2.
; 5,13,61,145,481,841,1741,2245,3445,5941,8065,12325,16021,18241,22261,29041,38365,40045,54781,62305,67345,80401,92881,106261,129541,149605,158485,172285,179401,190345,251341,273061,298765,317605,368941,384565
seq $0,6450 ; Prime-indexed primes: primes with prime subscripts.
pow $0,2
add $0,1
div $0,2
|
relaytimer.asm | tschaer/Relay-Timer-v2 | 1 | 15874 | ; relaytimer.asm
; 03.03.2017 <NAME>
; A 6-18hr timer with setting knob and status indicators
; 00: Get TIMER1 interrupt working.
; Bar graph counts up with every LED being 1/8th of the Timeout Value
; The "next" LED will blink to show counting progress. Works.
; 01: Switch to using the 16x16 divide from AVR200
; 02: Move display management out of ISR. With confusing results?
; 03: Ditch ISRs, use a polling loop. Oddly enough, this is reliable :-/
; 04: Change load values to correspond to 500ms; handle seconds counting &
; expiry. Works.
; 05: Update the bar graph display, without blinking. Works.
; 06: Blink the topmost LED. Switch halves when LED is on & off
; 07: Add the 8th LED on RC4; fix expiry logic to allow 16-bit elapsed times
; Doesn't work :-(
; 08: Try again by comparing Timeout to Elapsed for equality using XOR
; Fix bug where ElapsedHI was always zero :-/ NOW it works
; Also limit LED_no to be 7; it will go over when Timeout is not a multiple
; of 8, causing Chunk to be truncated, allowing LED_no to go to 8, which
; when "blinked" with LED_no+1, will run off the display (also crash LED_on)
; 09: Get ADC going, change Timeout & recompute Chunk. Remember to kill noise on
; the ADC input with cap to ground. Works!
; 10: Timeout = ADC * 10. Seems to work...
; 11: Shift ADC right one, Timeout = ADC * 84 + 21600 & cross fingers
; Aha oops, make Chunk 16 bits. Rolls over properly @ 16hrs!!
; 12: Move all the end-of-cycle stuff into the first half, test with hardcoded
; values of InputHI:InputLO to verify timing behaviour (8 hrs, 12 hrs)
; 13: RA3 = "Start at Zero" button (enable Master Clear Reset function)
; Put back to adjustable timeouts. Go over comments.
; 14: Changed LED assignment due to As-Built simplification (see LED_on)
; 15: Clean up.
; - Remove unused variables
; - Rename div16u to DIV16U
; - Rename LED_no to Bars ('No' is such a negative word :^) )
; - ##BUG discovered in expiry code, fix in next version
; - Make TIMER1 reload value a named constant (RELOADH:L)
; 16: Fix expiry code. Since moving the knob may produce a timeout value that
; is LESS than the already elapsed time, Elapsed == Timeout is replaced
; by Elapsed >= Timeout, so the timer fires immediately
list p=16F688 ; processor type, do not remove
__CONFIG 0x30F4 ; External MCLR, INTOSC
; Constants
RELOADH EQU 0x85 ; TIMER1 reload value = 34285 (0x85ED)
RELOADL EQU 0xED
; BANK0 Registers (All)
INDF EQU 0x00 ; Indirect file register
TMR0 EQU 0x01
PCL EQU 0x02 ; Program Counter Lo
STATUS EQU 0x03 ; CPU status register
FSR EQU 0x04 ; Indirect address register
PORTA EQU 0x05
PORTC EQU 0x07
PCLATH EQU 0x0A
INTCON EQU 0x0B
PIR1 EQU 0x0C ; Peripheral status register
TMR1L EQU 0x0E
TMR1H EQU 0x0F
T1CON EQU 0x10
BAUDCTL EQU 0x11
SPBRGH EQU 0x12
SPBRG EQU 0x13
RCREG EQU 0x14
TXREG EQU 0x15
TXSTA EQU 0x16
RCSTA EQU 0x17
WDTCON EQU 0x18
CMCON0 EQU 0x19
CMCON1 EQU 0x1A
ADRESH EQU 0x1E
ADCON0 EQU 0x1F
; BANK1 Registers (No duplicates from BANK0)
OPTION_REG EQU 0x81
TRISA EQU 0x85 ; Data direction register PORT A
TRISC EQU 0x87 ; Data direction register PORT C
PIE1 EQU 0x8C
OSCCON EQU 0x8F ; Internal oscillator config
OSCTUNE EQU 0x90
ANSEL EQU 0x91 ; A to D input pin enable
WPUA EQU 0x95
IOCA EQU 0x96
EEDATH EQU 0x97
EEADRH EQU 0x98
VRCON EQU 0x99
EEDAT EQU 0x9A
EEADR EQU 0x9B
EECON1 EQU 0x9C
EECON2 EQU 0x9D
ADRESL EQU 0x9E
ADCON1 EQU 0x9F
; Variables
; MUL16X8
A EQU 0x20
BL EQU 0x21
BH EQU 0x22
R1 EQU 0x23
R2 EQU 0x24
R3 EQU 0x25
; DIV16U
NL EQU 0x27
NH EQU 0x28
DL EQU 0x29
DH EQU 0x2A
QL EQU 0x2B
QH EQU 0x2C
RL EQU 0x2E
RH EQU 0x2F
divstep EQU 0x30
; MISC
Bars EQU 0x72
ElapsedLO EQU 0x73
ElapsedHI EQU 0x74
TimeoutLO EQU 0x75
TimeoutHI EQU 0x76
InputLO EQU 0x77
InputHI EQU 0x78
ChunkLo EQU 0x79
ChunkHi EQU 0x7A
; Reset Vector
ORG 0x000
CLRF STATUS
GOTO init
; Interrupt Vector
ORG 0x004
ISR NOP
RETFIE
; PROGRAM STARTS HERE
; Bank is always in BANK0. Accesses to BANK1 always restore BANK0.
init ; Set up CPU clock
MOVLW 0x51 ; Fosc = 2MHz (CPU clock = Fosc/4 = 500kHz)
BSF STATUS,5 ; Bank 1
MOVWF OSCCON
BCF STATUS,5
; Common port configuration
MOVLW 0x07 ; Turn off comparators
MOVWF CMCON0
MOVLW 0x40 ; RC2/AN6 is analog input
BSF STATUS,5 ; Bank 1
MOVWF ANSEL
BCF STATUS,5
; Set up Port A
CLRF PORTA
MOVLW 0x08 ; RA3 is an input
BSF STATUS,5 ; Bank 1
MOVWF TRISA
BCF STATUS,5
; Set up Port C
CLRF PORTC
MOVLW 0x04 ; RC2 is an input
BSF STATUS,5 ; Bank 1
MOVWF TRISC
BCF STATUS,5
; Set up ADC
MOVLW 0x40 ; ADC clock = Fosc/4 = 500kHz
BSF STATUS,5 ; Bank 1
MOVWF ADCON1
BCF STATUS,5
MOVLW 0x99 ; Right justify, Vcc, AD6, ADC Enabled
MOVWF ADCON0
; Application setup
CLRF ElapsedLO
CLRF ElapsedHI
; Set up Timer 1
MOVLW 0x34 ; Timer 1 = Fosc/4 + /8 prescaler = 62.5kHz
MOVWF T1CON
; Main loop
main ; First half
BCF PIR1,0 ; Clear TIMR1F
BCF T1CON,0 ; Reload counter
MOVLW RELOADL
MOVWF TMR1L
MOVLW RELOADH
MOVWF TMR1H
BSF T1CON,0 ; Counter is running
; Read Timeout from Potentiometer
BSF ADCON0,1 ; Start conversion
BTFSC ADCON0,1
GOTO $-1
MOVF ADRESH,W ; Input = ADC
MOVWF InputHI
BSF STATUS,5
MOVF ADRESL,W
BCF STATUS,5
MOVWF InputLO ; Input = Input/2 (noise mitigation)
RRF InputHI,F
RRF InputLO,F
MOVF InputLO,W ; Timeout = Input * 84 (0x54)
MOVWF BL
MOVF InputHI,W
MOVWF BH
MOVLW 0x54
MOVWF A
CALL MUL16X8
MOVF R1,W
MOVWF TimeoutLO
MOVF R2,W
MOVWF TimeoutHI
MOVLW 0x60 ; Timeout = Timeout + 21600 (0x5460)
ADDWF TimeoutLO,F
BTFSC STATUS,0
INCF TimeoutHI,F
MOVLW 0x54
ADDWF TimeoutHI,F
; Update Chunk
MOVF TimeoutLO,W ; Chunk = Timeout / 8
MOVWF NL
MOVF TimeoutHI,W
MOVWF NH
MOVLW 0x08
MOVWF DL
MOVLW 0x00
MOVWF DH
CALL DIV16U
MOVF QL, W
MOVWF ChunkLo
MOVF QH, W
MOVWF ChunkHi
; Update Bars
MOVF ElapsedLO,W ; Bars = Elapsed / Chunk
MOVWF NL
MOVF ElapsedHI,W
MOVWF NH
MOVF ChunkLo,W
MOVWF DL
MOVF ChunkHi,W
MOVWF DH
CALL DIV16U
MOVF QL,W ; IF Bars > 7 THEN Bars = 7
ADDLW .248 ; -8 in 2's comp
BTFSS STATUS,0
GOTO main_y
MOVLW 0x07
GOTO main_z
main_y MOVF QL,W
; Update bar graph
main_z MOVWF Bars
CALL LED_on
; End of First Half tasks
BTFSS PIR1,0 ; Wait for timer to expire
GOTO $-1
; Second half
BCF PIR1,0 ; Clear TIMR1F
BCF T1CON,0 ; Reload counter with 34285
MOVLW RELOADL
MOVWF TMR1L
MOVLW RELOADH
MOVWF TMR1H
BSF T1CON,0 ; Counter is running
; Update bar graph
INCF Bars,F
CALL LED_on
; End of Second Half tasks
BTFSS PIR1,0 ; Wait for timer to expire
GOTO $-1
; End-of-Cycle tasks
; Update elapsed time
INCF ElapsedLO,F
BTFSC STATUS,2
INCF ElapsedHI,F
; Handle expiry (Elapsed >= Timeout)
; Port C.3 will be high for one full cycle
BCF PORTC,3
MOVF TimeoutHI, W
SUBWF ElapsedHI, W
BTFSS STATUS,0
GOTO main_x
MOVF TimeoutLO, W
SUBWF ElapsedLO, W
BTFSS STATUS,0
GOTO main_x
BSF PORTC,3
CLRF ElapsedLO
CLRF ElapsedHI
main_x GOTO main
; Subroutines
; LED_off_all : turn off all LEDs
LED_off_all BCF PORTC,4
BCF PORTA,4
BCF PORTA,5
BCF PORTC,1
BCF PORTC,0
BCF PORTA,2
BCF PORTA,1
BCF PORTA,0
RETURN
; LED_on : Display Bars as a bar graph. Numbers go from 0 to 8
LED_on CALL LED_off_all
MOVF Bars,W ; Jump offset = 8 - Bars
SUBLW 0x08
ADDWF PCL,F
LED_on_all BSF PORTC,4 ; ********
BSF PORTA,4 ; *******
BSF PORTA,5 ; ******
BSF PORTC,1 ; *****
BSF PORTC,0 ; ****
BSF PORTA,2 ; ***
BSF PORTA,1 ; **
BSF PORTA,0 ; *
NOP ;
RETURN
; MUL16X8 : (h_ttp://www.piclist.com/techref/microchip/math/mul/m16x8mds2.htm)
; R3:R2:R1 = A*BH:BL
MUL16X8 CLRF R3
CLRF R2
CLRF R1
BSF R1,7
M1 RRF A,F
BTFSS STATUS,0 ; SKPC
GOTO M2
MOVFW BL
ADDWF R2,F
MOVFW BH
BTFSC STATUS,0 ; SKPNC
INCFSZ BH,W
ADDWF R3,F
M2 RRF R3,F
RRF R2,F
RRF R1,F
BTFSS STATUS,0 ; SKPC
GOTO M1
RETURN
; DIV16U : Adapted from AVR DIV16S (App Note AVR200)
; Both operands are assumed to be positive, tracking of what sign the
; quotient shall have is done before calling this routine.
; Write numerator to NH:NL, write denominator to DH:DL
; Quotient is in QH:QL, remainder is in RH:RL
DIV16U CLRF RL ; Initialize
CLRF RH
MOVLW .17
MOVWF divstep
BCF STATUS,0
DIV16U_3 RLF NL,1 ; Division loop
RLF NH,1
DECFSZ divstep,1
GOTO DIV16U_5
MOVF NL,0 ; Exit & clean up
MOVWF QL
MOVF NH,0
MOVWF QH
DIV16U_4 RETURN ; Done
DIV16U_5 RLF RL,1
RLF RH,1
MOVF DL,0 ; R = R - D
SUBWF RL,1
MOVF DH,0
BTFSS STATUS,0
INCF DH,0
SUBWF RH,1
BTFSC STATUS,0 ; Carry = 0 -> borrow occurred, undo subtraction
GOTO DIV16U_6
MOVF DL,0 ; R = R + D
ADDWF RL,1
MOVF DH,0
BTFSC STATUS,0
INCF DH,0
ADDWF RH,1
BCF STATUS,0
GOTO DIV16U_3
DIV16U_6 BSF STATUS,0
GOTO DIV16U_3
END |
Cubical/Categories/Functor/Base.agda | howsiyu/cubical | 0 | 248 | <reponame>howsiyu/cubical
{-# OPTIONS --safe #-}
module Cubical.Categories.Functor.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Data.Sigma
open import Cubical.Categories.Category
private
variable
ℓC ℓC' ℓD ℓD' : Level
record Functor (C : Category ℓC ℓC') (D : Category ℓD ℓD') :
Type (ℓ-max (ℓ-max ℓC ℓC') (ℓ-max ℓD ℓD')) where
no-eta-equality
open Category
field
F-ob : C .ob → D .ob
F-hom : {x y : C .ob} → C [ x , y ] → D [ F-ob x , F-ob y ]
F-id : {x : C .ob} → F-hom (C .id) ≡ D .id {x = F-ob x}
F-seq : {x y z : C .ob} (f : C [ x , y ]) (g : C [ y , z ])
→ F-hom (f ⋆⟨ C ⟩ g) ≡ (F-hom f) ⋆⟨ D ⟩ (F-hom g)
isFull = (x y : _) (F[f] : D [ F-ob x , F-ob y ]) → ∃[ f ∈ C [ x , y ] ] F-hom f ≡ F[f]
isFaithful = (x y : _) (f g : C [ x , y ]) → F-hom f ≡ F-hom g → f ≡ g
isEssentiallySurj = (d : D .ob) → Σ[ c ∈ C .ob ] CatIso D (F-ob c) d
F-square : {x y u v : C .ob}
{f : C [ x , y ]} {g : C [ x , u ]}
{h : C [ u , v ]} {k : C [ y , v ]}
→ f ⋆⟨ C ⟩ k ≡ g ⋆⟨ C ⟩ h
→ (F-hom f) ⋆⟨ D ⟩ (F-hom k) ≡ (F-hom g) ⋆⟨ D ⟩ (F-hom h)
F-square Csquare = sym (F-seq _ _) ∙∙ cong F-hom Csquare ∙∙ F-seq _ _
private
variable
ℓ ℓ' : Level
C D E : Category ℓ ℓ'
open Category
open Functor
Functor≡ : {F G : Functor C D}
→ (h : ∀ (c : ob C) → F-ob F c ≡ F-ob G c)
→ (∀ {c c' : ob C} (f : C [ c , c' ]) → PathP (λ i → D [ h c i , h c' i ]) (F-hom F f) (F-hom G f))
→ F ≡ G
F-ob (Functor≡ hOb hHom i) c = hOb c i
F-hom (Functor≡ hOb hHom i) f = hHom f i
F-id (Functor≡ {C = C} {D = D} {F = F} {G = G} hOb hHom i) =
isProp→PathP (λ j → isSetHom D (hHom (C .id) j) (D .id)) (F-id F) (F-id G) i
F-seq (Functor≡ {C = C} {D = D} {F = F} {G = G} hOb hHom i) f g =
isProp→PathP (λ j → isSetHom D (hHom (f ⋆⟨ C ⟩ g) j) ((hHom f j) ⋆⟨ D ⟩ (hHom g j))) (F-seq F f g) (F-seq G f g) i
-- Helpful notation
-- action on objects
infix 30 _⟅_⟆
_⟅_⟆ : (F : Functor C D)
→ C .ob
→ D .ob
_⟅_⟆ = F-ob
-- action on morphisms
infix 30 _⟪_⟫ -- same infix level as on objects since these will never be used in the same context
_⟪_⟫ : (F : Functor C D)
→ ∀ {x y}
→ C [ x , y ]
→ D [(F ⟅ x ⟆) , (F ⟅ y ⟆)]
_⟪_⟫ = F-hom
-- Functor constructions
𝟙⟨_⟩ : ∀ (C : Category ℓ ℓ') → Functor C C
𝟙⟨ C ⟩ .F-ob x = x
𝟙⟨ C ⟩ .F-hom f = f
𝟙⟨ C ⟩ .F-id = refl
𝟙⟨ C ⟩ .F-seq _ _ = refl
-- functor composition
funcComp : ∀ (G : Functor D E) (F : Functor C D) → Functor C E
(funcComp G F) .F-ob c = G ⟅ F ⟅ c ⟆ ⟆
(funcComp G F) .F-hom f = G ⟪ F ⟪ f ⟫ ⟫
(funcComp G F) .F-id = cong (G ⟪_⟫) (F .F-id) ∙ G .F-id
(funcComp G F) .F-seq f g = cong (G ⟪_⟫) (F .F-seq _ _) ∙ G .F-seq _ _
infixr 30 funcComp
syntax funcComp G F = G ∘F F
_^opF : Functor C D → Functor (C ^op) (D ^op)
(F ^opF) .F-ob = F .F-ob
(F ^opF) .F-hom = F .F-hom
(F ^opF) .F-id = F .F-id
(F ^opF) .F-seq f g = F .F-seq g f
|
programs/oeis/142/A142588.asm | neoneye/loda | 22 | 2052 | <filename>programs/oeis/142/A142588.asm
; A142588: A trisection of A000129, the Pell numbers.
; 0,5,70,985,13860,195025,2744210,38613965,543339720,7645370045,107578520350,1513744654945,21300003689580,299713796309065,4217293152016490,59341817924539925,835002744095575440,11749380235262596085,165326326037771920630,2326317944764069484905,32733777552734744709300,460599203683050495415105,6481122629115441680520770,91196316011299234022705885,1283229546787304717998403160,18056409971033565286000350125,254072969141257218722003304910,3575077977948634627394046618865,50305164660422142002238655969020,707847383223858622658735230185145,9960168529794442859224531878561050,140150206800346058651802181530039845
mul $0,3
seq $0,163271 ; Numerators of fractions in a 'zero-transform' approximation of sqrt(2) by means of a(n) = (a(n-1) + c)/(a(n-1) + 1) with c=2 and a(1)=0.
div $0,2
|
Task/Generate-lower-case-ASCII-alphabet/Ada/generate-lower-case-ascii-alphabet-1.ada | mullikine/RosettaCodeData | 1 | 27633 | <filename>Task/Generate-lower-case-ASCII-alphabet/Ada/generate-lower-case-ascii-alphabet-1.ada
type Lower_Case is new Character range 'a' .. 'z';
|
Appl/GeoWrite/Document/documentSearchSp.asm | steakknife/pcgeos | 504 | 4878 | COMMENT @----------------------------------------------------------------------
Copyright (c) Berkeley Softworks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: GeoWrite
FILE: documentSearchSp.asm
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 3/92 Initial version
DESCRIPTION:
This file contains the VisContent related code for WriteDocumentClass
$Id: documentSearchSp.asm,v 1.1 97/04/04 15:56:21 newdeal Exp $
------------------------------------------------------------------------------@
DocSTUFF segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: WriteDocumentGetObjectForSearchSpell --
MSG_META_GET_OBJECT_FOR_SEARCH_SPELL for WriteDocumentClass
DESCRIPTION: Get an object for search spell. This requires loopoing
through all the text objects in the document
PASS:
*ds:si - instance data
es - segment of WriteDocumentClass
ax - The message
cx:dx - object that search/spell is currently in
bp - GetSearchSpellObjectParam
RETURN:
cx:dx - requested object (or 0 if none)
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
Text objects are enumerated in this order:
1) Each article
2) Main grobj body
3) Each master page
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 11/19/92 Initial version
------------------------------------------------------------------------------@
WriteDocumentGetObjectForSearchSpell method dynamic WriteDocumentClass,
MSG_META_GET_OBJECT_FOR_SEARCH_SPELL
call LockMapBlockES
ifdef GPC
push bp ; save original request
endif
; Getting the first object is easy. Just return the first article
; (which conveniently is our first child)
cmp bp, GSSOT_FIRST_OBJECT
jnz notFirstObject
add bx, ds:[bx].Vis_offset
movdw cxdx, ds:[bx].VCI_comp.CP_firstChild
jmp done
; Getting the last object involves going to the last master page
; and sending it a message to find the last text object on it
notFirstObject:
cmp bp, GSSOT_LAST_OBJECT
jnz notLastObject
mov ax, CA_LAST_ELEMENT
call SectionArrayEToP_ES
jmp lastMasterPageInSection
notLastObject:
; Getting the next or previous object is somewhat of a pain.
; First we have to figure out what type of object we are at
mov ax, offset WriteArticleClass
call isInClass
jnc notArticle
; The object is an article -- find the child number
treatAsArticle:
push bp
call callFindChild
mov_tr ax, bp
pop bp
cmp bp, GSSOT_NEXT_OBJECT
jnz prevArticle
; go to the next article or to the grobj body
inc ax
mov_tr dx, ax
clr cx
call callFindChild ;cx:dx = optr
mov ax, offset WriteArticleClass
call isInClass
LONG jc done
; next object is the grobj body -- go to its first object (if any)
mov bp, GSSOT_FIRST_OBJECT
call getGrObjObject
LONG jnz done
jmp firstMasterPage
prevArticle:
dec ax
LONG js returnNone
mov_tr dx, ax
clr cx
call callFindChild ;cx:dx = optr
jmp done
;---------------------------
; current object is a grobj text object -- get the body
notArticle:
push si, bp
pushdw cxdx ;save grobj text object
push bp
movdw bxsi, cxdx
mov ax, MSG_VIS_FIND_PARENT
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ;cxdx = body
pop bp
movdw bxsi, cxdx ;bxsi = body
popdw cxdx ;cxdx = grobj text object
or bp, mask GSSOP_RELAYED_FLAG
mov ax, MSG_META_GET_OBJECT_FOR_SEARCH_SPELL
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
movdw axdi, cxdx ;axdi = value returned
movdw cxdx, bxsi ;cxdx = grobj body
pop si, bp
tst ax
jz notFound
movdw cxdx, axdi
jmp done
notFound:
; the grobj body needs help -- first map NEXT to FIRST and PREV to LAST
cmp bp, GSSOT_NEXT_OBJECT
mov bp, GSSOT_FIRST_OBJECT
jz 10$
mov bp, GSSOT_LAST_OBJECT
10$:
; see if it is the main body
mov ax, offset WriteMasterPageGrObjBodyClass
call isInClass
jc masterPage
; current object is the main grobj body
mainBodyCommon:
cmp bp, GSSOT_FIRST_OBJECT
jz firstMasterPage
mov bp, GSSOT_PREV_OBJECT
jmp treatAsArticle
; goto first master page
firstMasterPage:
clr ax
call SectionArrayEToP_ES
mov ax, es:[di].SAE_masterPages[0]
jmp gotMasterPageBlock
;---------------------------
; current object (cx:dx) is a master page body -- find it in the array
masterPage:
push cx, dx, si
call MemBlockToVMBlockCX
segxchg ds, es ;ds = map block, es = document
mov si, offset SectionArray
mov bx, cs
mov di, offset FindMasterCallback
call ChunkArrayEnum ;dx = offset of element
EC < ERROR_NC MASTER_PAGE_NOT_FOUND >
mov di, dx
pop cx, dx, si
segxchg ds, es
; es:di = SectionArrayElement, al = # master pages before, ah = # after
lea bx, es:[di].SAE_masterPages
push ax
clr ah
shl ax
add bx, ax ;ds:bx points at master page
pop ax
cmp bp, GSSOT_LAST_OBJECT
jz prevMasterPage
; go to the next master page
tst ah
jz nextSection
mov ax, es:[bx+2]
gotMasterPageBlock:
call WriteVMBlockToMemBlock ;ax = mem block of master page
mov_tr cx, ax
mov dx, offset MasterPageBody
call getGrObjObject
jnz done
jmp masterPage
; go to first master page in next section
nextSection:
push si
segxchg ds, es
mov si, offset SectionArray
call ChunkArrayPtrToElement
inc ax
push cx
call ChunkArrayElementToPtr
pop cx
segxchg ds, es
pop si
jc returnNone
mov ax, es:[di].SAE_masterPages[0]
jmp gotMasterPageBlock
; go to the previous master page
prevMasterPage:
tst al
jz prevSection
mov ax, es:[bx-2]
jmp gotMasterPageBlock
; go to the previous section
prevSection:
push si
segxchg ds, es
mov si, offset SectionArray
call ChunkArrayPtrToElement
dec ax
js wrapToMainBody
push cx
call ChunkArrayElementToPtr
pop cx
segxchg ds, es
pop si
lastMasterPageInSection:
mov bx, es:[di].SAE_numMasterPages
dec bx
shl bx
mov ax, es:[di][bx].SAE_masterPages[0]
jmp gotMasterPageBlock
wrapToMainBody:
segxchg ds, es
pop si
mov ax, es:[MBH_grobjBlock]
call WriteVMBlockToMemBlock
mov_tr cx, ax
mov dx, offset MainBody
mov bp, GSSOT_LAST_OBJECT
call getGrObjObject
jnz done
jmp mainBodyCommon
;---------------------------
returnNone:
clrdw cxdx
done:
ifdef GPC
pop bp ; bp = original command
call handleWrap
endif
EC < call AssertIsWriteDocument >
call VMUnlockES
ret
ifdef GPC
handleWrap label near
;
; check wrap-around: we've wrapped when we get GSSOT_FIRST_OBJECT
; after getting GSSOT_NEXT_OBJECT and returning 0:0, so when get
; GSSOT_NEXT_OBJECT and will return 0:0, set flag, when
; GSSOT_FIRST_OBJECT comes in and flag is set, query user and only
; return first object is user acknowledges wrap around
;
cmp bp, GSSOT_FIRST_OBJECT
je checkWrapped
cmp bp, GSSOT_LAST_OBJECT
je checkWrapped
tst cx
jnz noWrap
cmp bp, GSSOT_NEXT_OBJECT
je markWrap
cmp bp, GSSOT_PREV_OBJECT
jne noWrap
markWrap:
mov ax, TEMP_WRITE_DOCUMENT_NO_SEARCH_WRAP_CHECK
call ObjVarFindData
jc noWrap
push cx
mov ax, TEMP_WRITE_DOCUMENT_SEARCH_WRAPPED
clr cx
call ObjVarAddData
pop cx
noWrap:
retn
checkWrapped:
mov ax, TEMP_WRITE_DOCUMENT_SEARCH_WRAPPED
call ObjVarDeleteData
jc noWrap ; C set if not found
push si
mov ax, offset SearchReachedEndString
cmp bp, GSSOT_FIRST_OBJECT
je gotString
mov ax, offset SearchReachedBeginningString
gotString:
call DisplayQuestion
cmp ax, IC_YES
pop si
je noWrap ; yes, continue search
clrdw cxdx ; stop search
jmp noWrap
endif
;---
; ax = offset of class
; return carry set if cxdx is an article
; destroy: ax
isInClass:
push bx, cx, dx, si, di, bp, ds
movdw bxsi, cxdx ;bx:si = object
mov cx, segment GeoWriteClassStructures
mov_tr dx, ax
mov ax, MSG_META_IS_OBJECT_IN_CLASS
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
pop bx, cx, dx, si, di, bp, ds
retn
;---
callFindChild:
mov ax, offset VI_link
mov bx, offset Vis_offset
mov di, offset VCI_comp
call ObjCompFindChild ;bp = child number
retn
;---
; pass cxdx = grobj body, bp = type
; return cxdx = object or body, Z clear if exists
; destroy: none
getGrObjObject:
push ax, bx, si, di, bp
or bp, mask GSSOP_RELAYED_FLAG
movdw bxsi, cxdx
mov ax, MSG_META_GET_OBJECT_FOR_SEARCH_SPELL
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
tst cx
jnz getDone
movdw cxdx, bxsi ;return body if no object found
getDone:
pop ax, bx, si, di, bp
retn
WriteDocumentGetObjectForSearchSpell endm
COMMENT @----------------------------------------------------------------------
FUNCTION: FindMasterCallback
DESCRIPTION: Callback routine to find a master page
CALLED BY: INTERNAL
PASS:
ds:di - SectionArrayElement
cx - master page VM block
RETURN:
carry - set if found
offset of element
al - number of master pages before
ah - number of master pages after
DESTROYED:
bx, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 11/19/92 Initial version
------------------------------------------------------------------------------@
FindMasterCallback proc far
mov dx, di
clr ax
mov ah, ds:[di].SAE_numMasterPages.low
add di, offset SAE_masterPages
compareLoop:
cmp cx, ds:[di]
stc
jz done
add di, size word
inc al
dec ah
jnz compareLoop
clc
done:
pushf
dec ah
popf
ret
FindMasterCallback endp
ifdef GPC
;
; sorry about this...
;
WriteDocumentClearSearchWrap method dynamic WriteDocumentClass,
MSG_WRITE_DOCUMENT_CLEAR_SEARCH_WRAP_CHECK
mov ax, TEMP_WRITE_DOCUMENT_NO_SEARCH_WRAP_CHECK
clr cx
call ObjVarAddData
ret
WriteDocumentClearSearchWrap endm
WriteDocumentSetSearchWrap method dynamic WriteDocumentClass,
MSG_WRITE_DOCUMENT_SET_SEARCH_WRAP_CHECK
mov ax, TEMP_WRITE_DOCUMENT_NO_SEARCH_WRAP_CHECK
call ObjVarDeleteData
ret
WriteDocumentSetSearchWrap endm
GeoWriteClassStructures segment resource
WSpellControlClass
WSearchReplaceControlClass
GeoWriteClassStructures ends
WSpellControlStartSpell method dynamic WSpellControlClass,
MSG_SC_CHECK_ENTIRE_DOCUMENT,
MSG_SC_CHECK_TO_END,
MSG_SC_CHECK_SELECTION
;
; even though the WriteDocument is run by the process thread,
; synchronization is fine here since the SpellControl will also
; being sending MSG_SPELL_CHECK to the spell target (run by
; process thread)
;
push ax, cx, dx, bp, si
mov ax, MSG_WRITE_DOCUMENT_CLEAR_SEARCH_WRAP_CHECK
mov bx, segment WriteDocumentClass
mov si, offset WriteDocumentClass
mov di, mask MF_RECORD
call ObjMessage
mov cx, di
mov ax, MSG_META_SEND_CLASSED_EVENT
mov dx, TO_MODEL
GetResourceHandleNS WriteDocumentGroup, bx
mov si, offset WriteDocumentGroup
clr di
call ObjMessage
pop ax, cx, dx, bp, si
; resume course
mov di, offset WSpellControlClass
call ObjCallSuperNoLock
ret
WSpellControlStartSpell endm
WSearchReplaceControlStartSearch method dynamic WSearchReplaceControlClass,
MSG_SRC_FIND_NEXT,
MSG_SRC_FIND_PREV,
MSG_REPLACE_CURRENT,
MSG_REPLACE_ALL_OCCURRENCES,
MSG_REPLACE_ALL_OCCURRENCES_IN_SELECTION,
MSG_SRC_REPLACE_ALL_OCCURRENCES_NO_QUERY,
MSG_SRC_FIND_FROM_TOP
;
; even though the WriteDocument is run by the process thread,
; synchronization is fine here since the SpellControl will also
; being sending MSG_SEARCH to the spell target (run by
; process thread)
;
push ax, cx, dx, bp, si
mov ax, MSG_WRITE_DOCUMENT_SET_SEARCH_WRAP_CHECK
mov bx, segment WriteDocumentClass
mov si, offset WriteDocumentClass
mov di, mask MF_RECORD
call ObjMessage
mov cx, di
mov ax, MSG_META_SEND_CLASSED_EVENT
mov dx, TO_MODEL
GetResourceHandleNS WriteDocumentGroup, bx
mov si, offset WriteDocumentGroup
clr di
call ObjMessage
pop ax, cx, dx, bp, si
; resume course
mov di, offset WSearchReplaceControlClass
call ObjCallSuperNoLock
ret
WSearchReplaceControlStartSearch endm
endif
DocSTUFF ends
|
src/Web/Semantic/DL/Sequent/Model.agda | agda/agda-web-semantic | 9 | 820 | <reponame>agda/agda-web-semantic
open import Data.Product using ( _×_ ; _,_ ; proj₁ ; proj₂ )
open import Data.Sum using ( inj₁ ; inj₂ )
open import Data.Unit using ( tt )
open import Relation.Binary.PropositionalEquality using ( refl )
open import Relation.Unary using ( _∈_ ; _⊆_ )
open import Web.Semantic.DL.ABox using
( ABox ; Assertions ; ε ; _,_ ; _∼_ ; _∈₁_ ; _∈₂_ )
open import Web.Semantic.DL.ABox.Interp using
( Interp ; _,_ ; ⌊_⌋ ; ind ; _*_ )
open import Web.Semantic.DL.ABox.Interp.Morphism using
( _≲_ ; _,_ ; ≲⌊_⌋ ; ≲-resp-ind ; _≋_ )
open import Web.Semantic.DL.ABox.Model using
( _⟦_⟧₀ ; _⊨a_ ; Assertions✓ )
open import Web.Semantic.DL.Concept using
( ⟨_⟩ ; ¬⟨_⟩ ; ⊤ ; ⊥ ; _⊓_ ; _⊔_ ; ∀[_]_ ; ∃⟨_⟩_ ; ≤1 ; >1 )
open import Web.Semantic.DL.Concept.Model using ( _⟦_⟧₁ ; ⟦⟧₁-resp-≈ )
open import Web.Semantic.DL.Integrity using
( Unique ; Mediator ; Initial ; _>>_ ; _⊕_⊨_ ; _,_ )
open import Web.Semantic.DL.KB using ( KB ; tbox ; abox )
open import Web.Semantic.DL.KB.Model using ( _⊨_ )
open import Web.Semantic.DL.Role using ( ⟨_⟩ ; ⟨_⟩⁻¹ )
open import Web.Semantic.DL.Role.Model using ( _⟦_⟧₂ ; ⟦⟧₂-resp-≈ )
open import Web.Semantic.DL.Sequent using
( Γ ; γ ; _⊕_⊢_∼_ ; _⊕_⊢_∈₁_ ; _⊕_⊢_∈₂_
; ∼-assert ; ∼-import ;∼-refl ; ∼-sym ; ∼-trans ; ∼-≤1
; ∈₂-assert ; ∈₂-import ; ∈₂-resp-∼ ; ∈₂-subsum
; ∈₂-refl ; ∈₂-trans ; ∈₂-inv-I ; ∈₂-inv-E
; ∈₁-assert ; ∈₁-import ; ∈₁-resp-∼ ; ∈₁-subsum
; ∈₁-⊤-I ; ∈₁-⊓-I ; ∈₁-⊓-E₁ ; ∈₁-⊓-E₂
; ∈₁-⊔-I₁ ; ∈₁-⊔-I₂ ; ∈₁-∃-I ; ∈₁-∀-E )
open import Web.Semantic.DL.Signature using ( Signature )
open import Web.Semantic.DL.TBox using
( TBox ; Axioms ; ε ; _,_ ;_⊑₁_ ; _⊑₂_ ; Tra )
open import Web.Semantic.DL.TBox.Interp using
( interp ; Δ ; _⊨_≈_ ; ≈-refl ; ≈-sym ; ≈-trans ; con-≈ ; rol-≈ ) renaming
( Interp to Interp′ )
open import Web.Semantic.DL.TBox.Interp.Morphism using
( morph ; ≲-image ; ≲-resp-≈ ; ≲-resp-con ; ≲-resp-rol )
open import Web.Semantic.DL.TBox.Minimizable using
( LHS ; RHS ; μTBox
; ⟨_⟩ ; ⊤ ; ⊥ ; _⊓_ ; _⊔_ ; ∀[_]_ ; ∃⟨_⟩_ ; ≤1
; ε ; _,_ ;_⊑₁_ ; _⊑₂_ ; Ref ; Tra )
open import Web.Semantic.DL.TBox.Model using ( _⊨t_ ; Axioms✓ )
open import Web.Semantic.Util using
( Subset ; ⊆-refl ; id ; _∘_ ; _⊕_⊕_ ; _[⊕]_[⊕]_ ; inode ; bnode ; enode )
module Web.Semantic.DL.Sequent.Model {Σ : Signature} {W X Y : Set} where
infix 5 _⊞_
minimal′ : Interp Σ X → KB Σ (X ⊕ W ⊕ Y) → Interp′ Σ
minimal′ I KB =
interp (Γ I KB) (λ x y → (I ⊕ KB ⊢ x ∼ y)) ∼-refl ∼-sym ∼-trans
(λ c x → I ⊕ KB ⊢ x ∈₁ ⟨ c ⟩) (λ r xy → I ⊕ KB ⊢ xy ∈₂ ⟨ r ⟩)
(λ c → ∈₁-resp-∼) (λ r → ∈₂-resp-∼)
minimal : Interp Σ X → KB Σ (X ⊕ W ⊕ Y) → Interp Σ (X ⊕ W ⊕ Y)
minimal I KB = (minimal′ I KB , γ I KB)
complete₂ : ∀ I KB R {xy} → (xy ∈ minimal′ I KB ⟦ R ⟧₂) → (I ⊕ KB ⊢ xy ∈₂ R)
complete₂ I KB ⟨ r ⟩ {(x , y)} xy∈⟦r⟧ = xy∈⟦r⟧
complete₂ I KB ⟨ r ⟩⁻¹ {(x , y)} yx∈⟦r⟧ = ∈₂-inv-I yx∈⟦r⟧
complete₁ : ∀ I KB {C x} → (C ∈ LHS) → (x ∈ minimal′ I KB ⟦ C ⟧₁) →
(I ⊕ KB ⊢ x ∈₁ C)
complete₁ I KB ⟨ c ⟩ x∈⟦c⟧ =
x∈⟦c⟧
complete₁ I KB ⊤ _ =
∈₁-⊤-I
complete₁ I KB (C ⊓ D) (x∈⟦C⟧ , x∈⟦D⟧) =
∈₁-⊓-I (complete₁ I KB C x∈⟦C⟧) (complete₁ I KB D x∈⟦D⟧)
complete₁ I KB (C ⊔ D) (inj₁ x∈⟦C⟧) =
∈₁-⊔-I₁ (complete₁ I KB C x∈⟦C⟧)
complete₁ I KB (C ⊔ D) (inj₂ x∈⟦D⟧) =
∈₁-⊔-I₂ (complete₁ I KB D x∈⟦D⟧)
complete₁ I KB (∃⟨ R ⟩ C) (y , xy∈⟦R⟧ , y∈⟦C⟧) =
∈₁-∃-I (complete₂ I KB R xy∈⟦R⟧) (complete₁ I KB C y∈⟦C⟧)
complete₁ I KB ⊥ ()
sound₂ : ∀ I KB R {xy} → (I ⊕ KB ⊢ xy ∈₂ R) → (xy ∈ minimal′ I KB ⟦ R ⟧₂)
sound₂ I KB ⟨ r ⟩ {(x , y)} ⊢xy∈r = ⊢xy∈r
sound₂ I KB ⟨ r ⟩⁻¹ {(x , y)} ⊢xy∈r⁻ = ∈₂-inv-E ⊢xy∈r⁻
sound₁ : ∀ I KB {C x} → (C ∈ RHS) → (I ⊕ KB ⊢ x ∈₁ C) →
(x ∈ minimal′ I KB ⟦ C ⟧₁)
sound₁ I KB ⟨ c ⟩ ⊢x∈c =
⊢x∈c
sound₁ I KB ⊤ ⊢x∈⊤ =
tt
sound₁ I KB (C ⊓ D) ⊢x∈C⊓D =
(sound₁ I KB C (∈₁-⊓-E₁ ⊢x∈C⊓D) , sound₁ I KB D (∈₁-⊓-E₂ ⊢x∈C⊓D))
sound₁ I KB (∀[ R ] C) ⊢x∈∀RC = λ y xy∈⟦R⟧ →
sound₁ I KB C (∈₁-∀-E ⊢x∈∀RC (complete₂ I KB R xy∈⟦R⟧))
sound₁ I KB (≤1 R) ⊢x∈≤1R = λ y z xy∈⟦R⟧ xz∈⟦R⟧ →
∼-≤1 ⊢x∈≤1R (complete₂ I KB R xy∈⟦R⟧) (complete₂ I KB R xz∈⟦R⟧)
minimal-⊨ : ∀ I KB → (tbox KB ∈ μTBox) → (minimal I KB ⊨ KB)
minimal-⊨ I KB μT =
( minimal-tbox μT (⊆-refl (Axioms (tbox KB)))
, minimal-abox (abox KB) (⊆-refl (Assertions (abox KB)))) where
minimal-tbox : ∀ {T} → (T ∈ μTBox) → (Axioms T ⊆ Axioms (tbox KB)) →
minimal′ I KB ⊨t T
minimal-tbox ε ε⊆T =
tt
minimal-tbox (U , V) UV⊆T =
( minimal-tbox U (λ u → UV⊆T (inj₁ u))
, minimal-tbox V (λ v → UV⊆T (inj₂ v)) )
minimal-tbox (C ⊑₁ D) C⊑₁D∈T = λ x∈⟦C⟧ →
sound₁ I KB D (∈₁-subsum (complete₁ I KB C x∈⟦C⟧) (C⊑₁D∈T refl))
minimal-tbox (Q ⊑₂ R) Q⊑₁R∈T = λ xy∈⟦Q⟧ →
sound₂ I KB R (∈₂-subsum (complete₂ I KB Q xy∈⟦Q⟧) (Q⊑₁R∈T refl))
minimal-tbox (Ref R) RefR∈T = λ x →
sound₂ I KB R (∈₂-refl x (RefR∈T refl))
minimal-tbox (Tra R) TraR∈T = λ xy∈⟦R⟧ yz∈⟦R⟧ →
sound₂ I KB R (∈₂-trans
(complete₂ I KB R xy∈⟦R⟧) (complete₂ I KB R yz∈⟦R⟧) (TraR∈T refl))
minimal-abox : ∀ A → (Assertions A ⊆ Assertions (abox KB)) →
minimal I KB ⊨a A
minimal-abox ε ε⊆A =
tt
minimal-abox (B , C) BC⊆A =
( minimal-abox B (λ b → BC⊆A (inj₁ b))
, minimal-abox C (λ c → BC⊆A (inj₂ c)) )
minimal-abox (x ∼ y) x∼y⊆A =
∼-assert (x∼y⊆A refl)
minimal-abox (x ∈₁ c) x∈C⊆A =
sound₁ I KB ⟨ c ⟩ (∈₁-assert (x∈C⊆A refl))
minimal-abox ((x , y) ∈₂ r) xy∈R⊆A =
sound₂ I KB ⟨ r ⟩ (∈₂-assert (xy∈R⊆A refl))
minimal-≳ : ∀ I KB → (I ≲ inode * minimal I KB)
minimal-≳ I KB = (morph inode ∼-import ∈₁-import ∈₂-import , λ x → ∼-refl)
minimal-≲ : ∀ I KB J → (I ≲ inode * J) → (J ⊨ KB) → (minimal I KB ≲ J)
minimal-≲ I KB J I≲J (J⊨T , J⊨A) =
(morph f minimal-≈ minimal-con minimal-rol , fγ≈j) where
f : Γ I KB → Δ ⌊ J ⌋
f = (≲-image ≲⌊ I≲J ⌋) [⊕] (ind J ∘ bnode) [⊕] (ind J ∘ enode)
fγ≈j : ∀ x → ⌊ J ⌋ ⊨ f (γ I KB x) ≈ ind J x
fγ≈j (inode x) = ≲-resp-ind I≲J x
fγ≈j (bnode v) = ≈-refl ⌊ J ⌋
fγ≈j (enode y) = ≈-refl ⌊ J ⌋
mutual
minimal-≈ : ∀ {x y} → (I ⊕ KB ⊢ x ∼ y) → (⌊ J ⌋ ⊨ f x ≈ f y)
minimal-≈ (∼-assert x∼y∈A) =
≈-trans ⌊ J ⌋ (fγ≈j _)
(≈-trans ⌊ J ⌋ (Assertions✓ J (abox KB) x∼y∈A J⊨A)
(≈-sym ⌊ J ⌋ (fγ≈j _)))
minimal-≈ (∼-import x≈y) =
≲-resp-≈ ≲⌊ I≲J ⌋ x≈y
minimal-≈ ∼-refl =
≈-refl ⌊ J ⌋
minimal-≈ (∼-sym x∼y) =
≈-sym ⌊ J ⌋ (minimal-≈ x∼y)
minimal-≈ (∼-trans x∼y y∼z) =
≈-trans ⌊ J ⌋ (minimal-≈ x∼y) (minimal-≈ y∼z)
minimal-≈ (∼-≤1 x∈≤1R xy∈R xz∈R) =
minimal-con x∈≤1R _ _ (minimal-rol xy∈R) (minimal-rol xz∈R)
minimal-con : ∀ {x C} → (I ⊕ KB ⊢ x ∈₁ C) → (f x ∈ ⌊ J ⌋ ⟦ C ⟧₁)
minimal-con (∈₁-assert x∈c∈A) =
con-≈ ⌊ J ⌋ _ (Assertions✓ J (abox KB) x∈c∈A J⊨A)
(≈-sym ⌊ J ⌋ (fγ≈j _))
minimal-con (∈₁-import x∈⟦c⟧) =
≲-resp-con ≲⌊ I≲J ⌋ x∈⟦c⟧
minimal-con {x} {C} (∈₁-resp-∼ x∈C x∼y) =
⟦⟧₁-resp-≈ ⌊ J ⌋ C (minimal-con x∈C) (minimal-≈ x∼y)
minimal-con (∈₁-subsum x∈C C⊑D∈T) =
Axioms✓ ⌊ J ⌋ (tbox KB) C⊑D∈T J⊨T (minimal-con x∈C)
minimal-con ∈₁-⊤-I =
tt
minimal-con (∈₁-⊓-I x∈C x∈D) =
(minimal-con x∈C , minimal-con x∈D)
minimal-con (∈₁-⊓-E₁ x∈C⊓D) =
proj₁ (minimal-con x∈C⊓D)
minimal-con (∈₁-⊓-E₂ x∈C⊓D) =
proj₂ (minimal-con x∈C⊓D)
minimal-con (∈₁-⊔-I₁ x∈C) =
inj₁ (minimal-con x∈C)
minimal-con (∈₁-⊔-I₂ x∈D) =
inj₂ (minimal-con x∈D)
minimal-con (∈₁-∀-E x∈[R]C xy∈R) =
minimal-con x∈[R]C _ (minimal-rol xy∈R)
minimal-con (∈₁-∃-I xy∈R y∈C) =
(_ , minimal-rol xy∈R , minimal-con y∈C)
minimal-rol : ∀ {x y R} → (I ⊕ KB ⊢ (x , y) ∈₂ R) →
((f x , f y) ∈ ⌊ J ⌋ ⟦ R ⟧₂)
minimal-rol (∈₂-assert xy∈r∈A) =
rol-≈ ⌊ J ⌋ _ (fγ≈j _) (Assertions✓ J (abox KB) xy∈r∈A J⊨A)
(≈-sym ⌊ J ⌋ (fγ≈j _))
minimal-rol (∈₂-import xy∈⟦r⟧) =
≲-resp-rol ≲⌊ I≲J ⌋ xy∈⟦r⟧
minimal-rol {x} {y} {R} (∈₂-resp-∼ w∼x xy∈R y∼z) =
⟦⟧₂-resp-≈ ⌊ J ⌋ R (minimal-≈ w∼x) (minimal-rol xy∈R) (minimal-≈ y∼z)
minimal-rol (∈₂-subsum xy∈Q Q⊑R∈T) =
Axioms✓ ⌊ J ⌋ (tbox KB) Q⊑R∈T J⊨T (minimal-rol xy∈Q)
minimal-rol (∈₂-refl x RefR∈T) =
Axioms✓ ⌊ J ⌋ (tbox KB) RefR∈T J⊨T _
minimal-rol (∈₂-trans xy∈R yz∈R TraR∈T) =
Axioms✓ ⌊ J ⌋ (tbox KB) TraR∈T J⊨T
(minimal-rol xy∈R) (minimal-rol yz∈R)
minimal-rol (∈₂-inv-I xy∈r) =
minimal-rol xy∈r
minimal-rol (∈₂-inv-E xy∈r⁻) =
minimal-rol xy∈r⁻
minimal-≋ : ∀ I KB K I≲K K⊨KB →
(I≲K ≋ minimal-≳ I KB >> minimal-≲ I KB K I≲K K⊨KB)
minimal-≋ I KB K I≲K (K⊨T , K⊨A) = λ x → ≈-refl ⌊ K ⌋
minimal-uniq : ∀ I KB K I≲K →
Unique I (minimal I KB) K (minimal-≳ I KB) I≲K
minimal-uniq I KB K I≲K J≲₁K J≲₂K I≲K≋I≲J≲₁K I≲K≋I≲J≲₂K (inode x) =
≈-trans ⌊ K ⌋ (≈-sym ⌊ K ⌋ (I≲K≋I≲J≲₁K x)) (I≲K≋I≲J≲₂K x)
minimal-uniq I KB K I≲K J≲₁K J≲₂K I≲K≋I≲J≲₁K I≲K≋I≲J≲₂K (bnode v) =
≈-trans ⌊ K ⌋ (≲-resp-ind J≲₁K (bnode v))
(≈-sym ⌊ K ⌋ (≲-resp-ind J≲₂K (bnode v)))
minimal-uniq I KB K I≲K J≲₁K J≲₂K I≲K≋I≲J≲₁K I≲K≋I≲J≲₂K (enode y) =
≈-trans ⌊ K ⌋ (≲-resp-ind J≲₁K (enode y))
(≈-sym ⌊ K ⌋ (≲-resp-ind J≲₂K (enode y)))
minimal-med : ∀ I KB → Mediator I (minimal I KB) (minimal-≳ I KB) KB
minimal-med I KB K I≲K K⊨KB =
( minimal-≲ I KB K I≲K K⊨KB
, minimal-≋ I KB K I≲K K⊨KB
, minimal-uniq I KB K I≲K)
minimal-init : ∀ I KB → (tbox KB ∈ μTBox) → Initial I KB (minimal I KB)
minimal-init I KB μKB =
(minimal-≳ I KB
, minimal-⊨ I KB μKB
, minimal-med I KB)
_⊞_ : Interp Σ X → KB Σ (X ⊕ W ⊕ Y) → Interp Σ Y
I ⊞ KB = enode * minimal I KB
⊞-sound : ∀ I KB₁ KB₂ → (tbox KB₁ ∈ μTBox) → (I ⊞ KB₁ ⊨ KB₂) → (I ⊕ KB₁ ⊨ KB₂)
⊞-sound I KB₁ KB₂ μKB₁ ⊨KB₂ = (minimal I KB₁ , minimal-init I KB₁ μKB₁ , ⊨KB₂) |
nes-test-roms/tutor/tutorchr.asm | joebentley/ones | 1,461 | 241296 | <gh_stars>1000+
; CHR-ROM file for the NES 101 tutorial
; Kinda sorta copyright <NAME>, 2001,2.
; More honestly copyright Commodore Business Machines 1982.
; The first 4K block (256 characters) is where our backgrounds come from.
; These were extracted from the Commodore 64's character ROM, and modified
; to match the NES' character definition schemas. The background is color
; 2 on the palette, and the letterforms themselves color 3. The characters
; are given tile numbers that correspond to their ASCII codes, to simplify
; the creation of the data files.
; The first 20 character locations are blank.
.dsb $0200
.byte $00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 32
.byte $18,$18,$18,$18,$00,$00,$18,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 33
.byte $66,$66,$66,$00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 34
.byte $66,$66,$FF,$66,$FF,$66,$66,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 35
.byte $18,$3E,$60,$3C,$06,$7C,$18,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 36
.byte $62,$66,$0C,$18,$30,$66,$46,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 37
.byte $3C,$66,$3C,$38,$67,$66,$3F,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 38
.byte $06,$0C,$18,$00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 39
.byte $0C,$18,$30,$30,$30,$18,$0C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 40
.byte $30,$18,$0C,$0C,$0C,$18,$30,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 41
.byte $00,$66,$3C,$FF,$3C,$66,$00,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 42
.byte $00,$18,$18,$7E,$18,$18,$00,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 43
.byte $00,$00,$00,$00,$00,$18,$18,$30,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 44
.byte $00,$00,$00,$7E,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 45
.byte $00,$00,$00,$00,$00,$18,$18,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 46
.byte $00,$03,$06,$0C,$18,$30,$60,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 47
.byte $3C,$66,$6E,$76,$66,$66,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 48
.byte $18,$18,$38,$18,$18,$18,$7E,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 49
.byte $3C,$66,$06,$0C,$30,$60,$7E,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 50
.byte $3C,$66,$06,$1C,$06,$66,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 51
.byte $06,$0E,$1E,$66,$7F,$06,$06,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 52
.byte $7E,$60,$7C,$06,$06,$66,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 53
.byte $3C,$66,$60,$7C,$66,$66,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 54
.byte $7E,$66,$0C,$18,$18,$18,$18,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 55
.byte $3C,$66,$66,$3C,$66,$66,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 56
.byte $3C,$66,$66,$3E,$06,$66,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 57
.byte $00,$00,$18,$00,$00,$18,$00,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 58
.byte $00,$00,$18,$00,$00,$18,$18,$30,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 59
.byte $0E,$18,$30,$60,$30,$18,$0E,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 60
.byte $00,$00,$7E,$00,$7E,$00,$00,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 61
.byte $70,$18,$0C,$06,$0C,$18,$70,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 62
.byte $3C,$66,$06,$0C,$18,$00,$18,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 63
.byte $3C,$66,$6E,$6E,$60,$62,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 64
.byte $18,$3C,$66,$7E,$66,$66,$66,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 65
.byte $7C,$66,$66,$7C,$66,$66,$7C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 66
.byte $3C,$66,$60,$60,$60,$66,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 67
.byte $78,$6C,$66,$66,$66,$6C,$78,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 68
.byte $7E,$60,$60,$78,$60,$60,$7E,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 69
.byte $7E,$60,$60,$78,$60,$60,$60,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 70
.byte $3C,$66,$60,$6E,$66,$66,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 71
.byte $66,$66,$66,$7E,$66,$66,$66,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 72
.byte $3C,$18,$18,$18,$18,$18,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 73
.byte $1E,$0C,$0C,$0C,$0C,$6C,$38,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 74
.byte $66,$6C,$78,$70,$78,$6C,$66,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 75
.byte $60,$60,$60,$60,$60,$60,$7E,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 76
.byte $63,$77,$7F,$6B,$63,$63,$63,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 77
.byte $66,$76,$7E,$7E,$6E,$66,$66,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 78
.byte $3C,$66,$66,$66,$66,$66,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 79
.byte $7C,$66,$66,$7C,$60,$60,$60,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 80
.byte $3C,$66,$66,$66,$66,$3C,$0E,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 81
.byte $7C,$66,$66,$7C,$78,$6C,$66,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 82
.byte $3C,$66,$60,$3C,$06,$66,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 83
.byte $7E,$18,$18,$18,$18,$18,$18,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 84
.byte $66,$66,$66,$66,$66,$66,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 85
.byte $66,$66,$66,$66,$66,$3C,$18,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 86
.byte $63,$63,$63,$6B,$7F,$77,$63,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 87
.byte $66,$66,$3C,$18,$3C,$66,$66,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 88
.byte $66,$66,$66,$3C,$18,$18,$18,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 89
.byte $7E,$06,$0C,$18,$30,$60,$7E,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 90
.byte $3C,$30,$30,$30,$30,$30,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 91
.byte $0C,$12,$30,$7C,$30,$62,$FC,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 92
.byte $3C,$0C,$0C,$0C,$0C,$0C,$3C,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 93
.byte $00,$18,$3C,$7E,$18,$18,$18,$18,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 94
.byte $00,$10,$30,$7F,$7F,$30,$10,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; Character 95
; Fill the rest of the first CHR-ROM block with zeroes.
.align $1000
; Here begins the second 4K block. The sprites (all one of them) get their data
; from this page.
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 ; Character 0: Blank
.byte $18,$24,$66,$99,$99,$66,$24,$18,$00,$18,$18,$66,$66,$18,$18,$00 ; Character 1: Diamond sprite
; Fill the rest of the CHR-ROM block with zeroes, giving us exactly 8K of data, which
; is what we want and need.
.align $1000
|
libsrc/_DEVELOPMENT/adt/ba_stack/c/sdcc_iy/ba_stack_destroy_fastcall.asm | meesokim/z88dk | 0 | 168182 | <gh_stars>0
; void ba_stack_destroy_fastcall(ba_stack_t *s)
SECTION code_adt_ba_stack
PUBLIC _ba_stack_destroy_fastcall
defc _ba_stack_destroy_fastcall = asm_ba_stack_destroy
INCLUDE "adt/ba_stack/z80/asm_ba_stack_destroy.asm"
|
alloy4fun_models/trainstlt/models/7/iSjkjcSoGpZd5Fjyy.als | Kaixi26/org.alloytools.alloy | 0 | 4143 | <gh_stars>0
open main
pred idiSjkjcSoGpZd5Fjyy_prop8 {
always (all t:Train | (some t.pos.signal and some t.pos.prox) and ( (t.pos.signal) in (Signal-Green) implies (t.pos in t.pos.prox) since ((t.pos.signal) in Green)))
}
pred __repair { idiSjkjcSoGpZd5Fjyy_prop8 }
check __repair { idiSjkjcSoGpZd5Fjyy_prop8 <=> prop8o } |
Categories/Graphs/Underlying.agda | copumpkin/categories | 98 | 14456 | {-# OPTIONS --universe-polymorphism #-}
module Categories.Graphs.Underlying where
open import Categories.Support.PropositionalEquality
open import Categories.Category
hiding (module Heterogeneous)
open import Categories.Categories
open import Categories.Graphs
open import Categories.Functor
using (Functor; module Functor; ≡⇒≣)
renaming (id to idF; _≡_ to _≡F_)
open import Data.Product
open import Graphs.Graph
open import Graphs.GraphMorphism
Underlying₀ : ∀ {o ℓ e} → Category o ℓ e → Graph o ℓ e
Underlying₀ C = record
{ Obj = Obj
; _↝_ = _⇒_
; _≈_ = _≡_
; equiv = equiv
} where open Category C
Underlying₁ : ∀ {o₁ ℓ₁ e₁ o₂ ℓ₂ e₂}
{X : Category o₁ ℓ₁ e₁}
{Y : Category o₂ ℓ₂ e₂}
→ Functor X Y
→ GraphMorphism (Underlying₀ X) (Underlying₀ Y)
Underlying₁ G = record
{ F₀ = G₀
; F₁ = G₁
; F-resp-≈ = G-resp-≡
}
where
open Functor G
renaming (F₀ to G₀; F₁ to G₁; F-resp-≡ to G-resp-≡)
Underlying : ∀ {o ℓ e} → Functor (Categories o ℓ e) (Graphs o ℓ e)
Underlying {o}{ℓ}{e} = record
{ F₀ = Underlying₀
; F₁ = Underlying₁
; identity = (λ x → ≣-refl) , (λ f → Heterogeneous.refl _)
; homomorphism = (λ x → ≣-refl) , (λ f → Heterogeneous.refl _)
; F-resp-≡ = λ {A B}{F G : Functor A B} → F-resp-≡ {A}{B}{F}{G}
}
where
module Graphs = Category (Graphs o ℓ e)
module Categories = Category (Categories o ℓ e)
.F-resp-≡ : ∀ {A B : Categories.Obj} {G H : Functor A B}
→ G ≡F H
→ Underlying₁ G ≈ Underlying₁ H
F-resp-≡ {A}{B}{G}{H} G≡H
= (≡⇒≣ G H G≡H) , (λ f → convert-~ (G≡H f))
where
open Heterogeneous (Underlying₀ B)
renaming (_~_ to _~₂_)
open Categories.Category.Heterogeneous B
renaming (_∼_ to _~₁_)
convert-~ : ∀ {a b c d}{x : B [ a , b ]}{y : B [ c , d ]} → x ~₁ y → x ~₂ y
convert-~ (≡⇒∼ foo) = ≈⇒~ foo |
thirdparty/adasdl/thin/adasdl/AdaSDL/binding/sdl-rwops.adb | Lucretia/old_nehe_ada95 | 0 | 28721 |
-- ----------------------------------------------------------------- --
-- AdaSDL --
-- Binding to Simple Direct Media Layer --
-- Copyright (C) 2001 A.M.F.Vargas --
-- <NAME> --
-- Ponta Delgada - Azores - Portugal --
-- http://www.adapower.net/~avargas --
-- E-mail: <EMAIL> --
-- ----------------------------------------------------------------- --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-- ----------------------------------------------------------------- --
-- **************************************************************** --
-- This is an Ada binding to SDL ( Simple DirectMedia Layer from --
-- Sam Lantinga - www.libsld.org ) --
-- **************************************************************** --
-- In order to help the Ada programmer, the comments in this file --
-- are, in great extent, a direct copy of the original text in the --
-- SDL header files. --
-- **************************************************************** --
package body SDL.RWops is
-------------
-- RWclose --
-------------
function RWclose
(ctx : RWops_ptr)
return C.int
is
begin
return ctx.close (ctx);
end RWclose;
------------
-- RWread --
------------
function RWread
(ctx : RWops_ptr;
ptr : void_ptr;
size : C.int;
n : C.int)
return C.int
is
begin
return ctx.read (ctx, ptr, size, n);
end RWread;
------------
-- RWSeek --
------------
function RWSeek
(ctx : RWops_ptr;
offset : C.int;
whence : C.int)
return C.int
is
begin
return ctx.seek (ctx, offset, whence);
end RWSeek;
------------
-- RWtell --
------------
function RWtell
(ctx : RWops_ptr)
return C.int
is
begin
return ctx.seek (ctx, 0, C.int (C_Streams.SEEK_CUR));
end RWtell;
-------------
-- RWwrite --
-------------
function RWwrite
(ctx : RWops_ptr;
ptr : void_ptr;
size : C.int;
n : C.int)
return C.int
is
begin
return ctx.write (ctx, ptr, size, n);
end RWwrite;
-- ======================================
function RW_From_File (
file : String;
mode : String)
return RWops_ptr is
begin
return RWFromFile (CS.New_String (file), CS.New_String (mode));
end RW_From_File;
-- ======================================
end SDL.RWops;
|
bb-runtimes/examples/tms570ls31-raven/sci.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 14197 | <reponame>JCGobbi/Nucleo-STM32G474RE
------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2014, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Interfaces; use Interfaces;
with System; use System;
with Ada.Interrupts.Names;
with System.Storage_Elements;
package body Sci is
SCI_BASE : constant := 16#fff7_e400#;
TX_READY : constant := 16#100#;
RX_READY : constant := 16#200#;
SET_TX_INT : constant := 16#100#;
SCIGCR0 : Unsigned_32;
for SCIGCR0'Address use System'To_Address (SCI_BASE + 16#00#);
pragma Volatile (SCIGCR0);
pragma Import (Ada, SCIGCR0);
SCIGCR1 : Unsigned_32;
for SCIGCR1'Address use System'To_Address (SCI_BASE + 16#04#);
pragma Volatile (SCIGCR1);
pragma Import (Ada, SCIGCR1);
SCISETINT : Unsigned_32;
for SCISETINT'Address use System'To_Address (SCI_BASE + 16#0C#);
pragma Volatile (SCISETINT);
pragma Import (Ada, SCISETINT);
SCICLEARINT : Unsigned_32;
for SCICLEARINT'Address use System'To_Address (SCI_BASE + 16#10#);
pragma Volatile (SCICLEARINT);
pragma Import (Ada, SCICLEARINT);
BRS : Unsigned_32;
for BRS'Address use System'To_Address (SCI_BASE + 16#2c#);
pragma Volatile (BRS);
pragma Import (Ada, BRS);
SCIFORMAT : Unsigned_32;
for SCIFORMAT'Address use System'To_Address (SCI_BASE + 16#28#);
pragma Volatile (SCIFORMAT);
pragma Import (Ada, SCIFORMAT);
SCIPIO0 : Unsigned_32;
for SCIPIO0'Address use System'To_Address (SCI_BASE + 16#3c#);
pragma Volatile (SCIPIO0);
pragma Import (Ada, SCIPIO0);
SCIPIO8 : Unsigned_32;
for SCIPIO8'Address use System'To_Address (SCI_BASE + 16#5c#);
pragma Volatile (SCIPIO8);
pragma Import (Ada, SCIPIO8);
SCITD : Unsigned_32;
for SCITD'Address use System'To_Address (SCI_BASE + 16#38#);
pragma Volatile (SCITD);
pragma Import (Ada, SCITD);
SCIFLR : Unsigned_32;
for SCIFLR'Address use System'To_Address (SCI_BASE + 16#1c#);
pragma Volatile (SCIFLR);
pragma Import (Ada, SCIFLR);
procedure Init is
begin
-- Bring out of reset
SCIGCR0 := 1;
-- 8n1, enable RX and TX, async, idle-line mode, SWnRST, internal clk
SCIGCR1 := 16#03_00_00_22#;
-- Baud rate. PLLCLK=180Mhz, VCLK = PLLCLK / 2
declare
Baud : constant := 115200;
VCLK : constant := 90_000_000;
P : constant := VCLK / (16 * Baud) - 1;
M : constant := (VCLK / Baud) rem 16;
begin
BRS := P + M * 2**24;
end;
-- 8 bits
SCIFORMAT := 7;
-- Enable Tx and Rx pins, pull-up
SCIPIO0 := 2#110#;
SCIPIO8 := 2#110#;
-- Enable SCI
SCIGCR1 := SCIGCR1 or 16#80#;
end Init;
protected Prot is
pragma Interrupt_Priority;
procedure Write (S : Address; L : Natural);
entry Wait;
private
procedure Handler;
pragma Attach_Handler
(Handler, Ada.Interrupts.Names.LIN_Level_0_Interrupt);
Done : Boolean := False;
Ptr : Address;
Len : Natural;
end Prot;
protected body Prot is
procedure Write_One
is
use System.Storage_Elements;
C : Character;
for C'Address use Ptr;
pragma Import (Ada, C);
begin
SCITD := Character'Pos (C);
Len := Len - 1;
Ptr := Ptr + 1;
end Write_One;
procedure Write (S : Address; L : Natural) is
begin
pragma Assert (not Done);
Ptr := S;
Len := L;
Write_One;
-- Enable interrupts (level is 0 at reset).
SCISETINT := SET_TX_INT;
Done := False;
end Write;
entry Wait when Done is
begin
null;
end Wait;
procedure Handler is
begin
pragma Assert ((SCIFLR and TX_READY) /= 0);
if Len = 0 then
-- Disable interrupts
SCICLEARINT := SET_TX_INT;
Done := True;
else
-- Next character
Write_One;
end if;
end Handler;
end Prot;
procedure Put_Line (S : String)
is
Crlf : String := (ASCII.CR, ASCII.LF);
begin
if S'Length > 0 then
Prot.Write (S'Address, S'Length);
Prot.Wait;
end if;
Prot.Write (Crlf'Address, Crlf'Length);
Prot.Wait;
end Put_Line;
begin
Init;
end Sci;
|
C5515_Support_Files/C5515_Lib/dsplib_2.40.00/55x_src/cubias.asm | HeroSizy/Sizy | 0 | 19458 | ;***********************************************************
; Version 2.40.00
;***********************************************************
; Note: a symbol "SI_BUGS" is used to make a work around for silicon
; 5510 version1.0. If you are going to use the code on 5510 version1.0
; silicon, you have to put switch -d"SI_BUGS" when you compile the code.
;****************************************************************
; Function: corr_unbias
; Description: unbiased full length correlation of two vectors
; Processor: C55xx
;
; Useage: ushort corr_raw(DATA *x, DATA *r, ushort nx, ushort nr)
; Copyright Texas instruments Inc, 2000
;
; History:
; - Modified save and restore AR5/AR6/AR7 to XAR5/XAR6/XAR7 registers.
; <NAME> - 08/14/01
;****************************************************************
.ARMS_off ;enable assembler for ARMS=0
.CPL_on ;enable assembler for CPL=1
.mmregs ;enable mem mapped register names
.global _corr_unbias
_corr_unbias
; Stack frame
; -----------
RET_ADDR_SZ .set 1 ;return address
;REG_SAVE_SZ .set 3 ;save-on-entry registers saved
REG_SAVE_SZ .set 6 ;save-on-entry registers saved
FRAME_SZ .set 8 ;local variables
ARG_BLK_SZ .set 0 ;argument block
; Register usage
; --------------
PARAM_OFFSET .set REG_SAVE_SZ + FRAME_SZ
.asg 0, temp
.asg 1, x_orig
.asg 3, y_orig
.asg 5, r_orig
.asg "0 + FRAME_SZ", SAVE_AR6
.asg "2 + FRAME_SZ", SAVE_AR7
.asg "4 + FRAME_SZ", SAVE_AR5
.asg "0 + REG_SAVE_SZ + FRAME_SZ", RETURN_ADDR
.asg AR0, x_ptr
.asg XAR0, Xx_ptr
.asg AR1, y_ptr
.asg XAR1, Xy_ptr
.asg AR2, r_ptr
.asg XAR2, Xr_ptr
.asg AR3, mac_cnt
.asg AR4, x_save
.asg XAR4, Xx_save
.asg AR5, y_save
.asg XAR5, Xy_save
.asg AR6, r1_r3_count
.asg AR7, r2_ptr
.asg XAR7, Xr2_ptr
.asg T0, nx
.asg T1, ny
.asg AC2, odd
.asg AC3, mytemp
.asg AC1, B
.asg AC0, A
.asg AC0, oflag ;returned value
;
; Allocate the local frame and argument block
;----------------------------------------------------------------
PSH mmap(ST0_55)
PSH mmap(ST1_55)
PSH mmap(ST2_55)
PSH mmap(ST3_55)
AADD #-(ARG_BLK_SZ + FRAME_SZ + REG_SAVE_SZ), SP
;
; Save any save-on-entry registers that are used
; Configure the status registers as needed.
;----------------------------------------------------------------
MOV XAR5, dbl(*SP(#(SAVE_AR5))) ; PSHM XAR5
|| BSET #ST1_SXMD, ST1_55
MOV XAR7, dbl(*SP(#(SAVE_AR7))) ; PSHM XAR7
|| BSET #ST1_FRCT, ST1_55
MOV XAR6, dbl(*SP(#(SAVE_AR6))) ; PSHM XAR6
;---------- X pointer setup
; x_ptr - X pointer as passed
; x_save - Used extensively in Region 3 and Region 2
; x_orig - Unchanged original X pointer
MOV Xx_ptr, dbl(*sp(#(x_orig)))
ADD nx, x_ptr
SUB #1, x_ptr
MOV Xx_ptr, Xx_save
;---------- Y pointer setup
; y_ptr - Y pointer as passed
; y_save - Y+nx-2 and Y+nx-1 in Region 3
; y_orig - Unchainged original Y pointer
MOV Xy_ptr, dbl(*sp(#(y_orig)))
MOV y_ptr, A
ADD nx, A
SUB #2, A
MOV Xy_ptr, Xy_save
MOV A, y_save
;---------- R pointer setup
; r_ptr - R pointer as passed. Eventually used and initialized as r+nx-2
; r2_ptr - r+ny
; r_orig - Unchainged original Y pointer
MOV Xr_ptr,dbl( *sp(#(r_orig)))
MOV r_ptr, A
MOV r_ptr, B
ADD nx, B
SUB #2, B
MOV B, r_ptr
|| ADD ny, A
MOV Xr_ptr, Xr2_ptr
MOV A, r2_ptr
;
; Initialize MAC cnt for regions 1 & 3, these will be
; calculated in one loop, since the number of elements is the
; same in each region.
;----------------------------------------------------------------
|| MOV nx, B
MOV nx, A
SUB #4, B
SUB #1, A
|| MOV B, mac_cnt
MOV B, r1_r3_count
;+++++++++++ BIAS Calculator +++++++++++++++
; Upon entry:
; r_ptr = r+nx-2
; r2_ptr = r+ny
; mac_cnt = nx-4
; temp = nx-1
;Setup BRC for localrepeat
; BRC0 = mac_cnt
;Setup n_mac
; || *sp(#(temp)) = A
MOV mac_cnt, BRC0 || MOV A, *sp(#(temp))
; Clear SXMD
; bit(ST1,#ST1_SXMD) = #0 ; Clear SXMD
BCLR #ST1_SXMD, ST1_55
RPTBLOCAL biascalclocalend
;Compute bias value
MOV #32767, A || RPT #15
SUBC *sp(#(temp)), A, A
; Adjust the temp value
ADD #-1, *sp(#(temp))
;Store bias value twice into output array
MOV A, *r_ptr-
biascalclocalend: MOV A, *r2_ptr+
; Setup SXMD
BSET #ST1_SXMD, ST1_55
;+++++++++++ End of BIAS calculator +++++++++++++++
; ---- ODD detection ----
; Due to the Dual MAC, we need to know if the region 1 and region 3
; are odd or even in length. If the number is odd, then we will need
; to do an extra MAC outside of the loop.
BTST @#0, r1_r3_count, TC1
MOV #0, odd
.if $isdefed("SI_BUGS")
XCC temp000529, !TC1
.else
XCCPART temp000529, !TC1
.endif
MOV #-1, odd
temp000529:
; For the dual MAC, we need to divide by two followed
; by a subsequent subtraction by 1 only if we have and odd number
; of MAC's to do.
; r1_r3_count = r1_r3_count >> #1;
; || if (odd<#0) execute(d_unit)
; r1_r3_count = r1_r3_count - #1
; BRC0 = r1_r3_count
SFTL r1_r3_count, #-1
.if $isdefed("SI_BUGS")
XCC temp000529b, odd < #0
.else
XCCPART temp000529b, odd < #0
.endif
SUB #1, r1_r3_count
temp000529b:
MOV r1_r3_count, BRC0
|| MOV nx, B
SUB #4, B
MOV B, mac_cnt
; Initial lag is in region 1, load initial MAC count and
; number of elements to calculate in region 1
;----------------------------------------------------------------
REGION1_AND_3:
; ---- Pointer Setup ----
MOV Xy_save, Xy_ptr
MOV Xy_ptr, Xx_ptr
SUB #1, y_ptr, x_ptr
MOV Xx_save, XCDP
;Reset r_ptr to initial values
MOV dbl(*sp(#(r_orig))), B
ADD nx, B
SUB #2, B
MOV B, Xr_ptr
;--------- Calculate sum in region 1
MOV mac_cnt, CSR
RPTBLOCAL endlocal1
SUB #2, y_save
; ---- Preload A ----
MPY *x_ptr-, *CDP-, A :: MPY *y_ptr-, *CDP-, B
; ---- Main Dual MAC loop ----
RPTSUB CSR, #2
MAC *x_ptr-, *CDP-, A :: MAC *y_ptr-, *CDP-, B
; ---- Cleanup MAC ----
MACM *y_ptr-, *CDP-, B
MOV Xx_save, XCDP
; ---- BIAS A and B and Store ----
MPYMR *r_ptr, B, B
MOV Xy_save, Xy_ptr
MOV Xy_ptr, Xx_ptr
SUB #1, x_ptr
MOV HI(B), *r_ptr-
MPYMR *r_ptr, A, A
endlocal1: MOV HI(A), *r_ptr-
; ---- Setup for Region 1 ----
;---------- Calculate some MAC's outside of the loop
BCC REGION1_FINAL, odd == #0
; ---- 3 -----
MPYM *y_ptr-, *CDP-, A
MACM *y_ptr-, *CDP-, A
MACM *y_ptr, *CDP, A
; BIAS
MPYMR *r_ptr, A, A
MOV HI(A), *r_ptr-
; Setup pointers for next loop
SUB #1, y_save
MOV Xx_save, XCDP
MOV Xy_save, Xy_ptr
; ---- 2 -----
REGION1_FINAL:
MPYM *y_ptr-, *CDP-, A
MACMR *y_ptr, *CDP+, A
MOV HI(A << #-1), *r_ptr-
; ---- 1 -----
MPYM *y_ptr, *CDP, A
MOV HI(A), *r_ptr-
;--------- Calculate sum in region 3
MOV r1_r3_count, BRC0
MOV mac_cnt, CSR
; ---- Pointer Setup ----
MOV dbl(*sp(#(y_orig))), B
ADD ny, B
SUB #1, B
MOV B, Xy_save
MOV Xy_save, XCDP
; Compute x_save=X+nx-2
MOV dbl(*sp(#(x_orig))), Xx_save
ADD nx, x_save
SUB #2, x_save
MOV Xx_save, Xy_ptr
MOV Xy_ptr, Xx_ptr
SUB #1, y_ptr, x_ptr
;Reset r2_ptr to initial values
MOV dbl(*sp(#(r_orig))), A
ADD ny, A
MOV A, Xr2_ptr
RPTBLOCAL localend3
SUB #2, x_save
; ---- Preload A ----
MPY *x_ptr-, *CDP-, A :: MPY *y_ptr-, *CDP-, B
; ---- Main Dual MAC loop ----
RPTSUB CSR, #2
MAC *x_ptr-, *CDP-, A :: MAC *y_ptr-, *CDP-, B
; ---- Cleanup MAC ----
MACM *y_ptr-, *CDP-, B
MOV Xy_save, XCDP
; ---- BIAS A and B and Store ----
MPYMR *r2_ptr, B, B
MOV Xx_save, Xy_ptr
MOV Xy_ptr, Xx_ptr
SUB #1, x_ptr
MOV HI(B), *r2_ptr+
MPYMR *r2_ptr, A, A
localend3: MOV HI(A), *r2_ptr+
; ---- Setup for Region 3 ----
; ---- 3 -----
BCC REGION3_FINAL, odd == #0
; no need for division since the previous one did it for me already
; MACs
MPYM *y_ptr-, *CDP-, A
MACM *y_ptr-, *CDP-, A
MACM *y_ptr, *CDP, A
; BIAS
MPYMR *r2_ptr, A, A
MOV HI(A), *r2_ptr+
; Setup pointers for next loop
SUB #1, x_save
MOV Xx_save, XCDP
MOV Xy_save, Xy_ptr
; ---- 2 -----
REGION3_FINAL:
MPYM *y_ptr-, *CDP-, A
MACMR *y_ptr+, *CDP, A
MOV HI(A << #-1), *r2_ptr+
; ---- 1 -----
MPYM *y_ptr, *CDP, A
MOV HI(A), *r2_ptr
;--------- Calculate sum in region 2
; ---- BIAS calculation -----
; Clear SXMD
BCLR #ST1_SXMD, ST1_55
; Actual calculation
MOV #32767, A
MOV nx, *sp(#(temp))
RPT #15
SUBC *sp(#(temp)), A, A
ADD #1, A
MOV A, *sp(#(temp))
; Set SXMD
BSET #ST1_SXMD, ST1_55
;----------
; .end
;----------
REGION2:
; Repeat setup
MOV ny, A
SUB nx, A
MOV A, T3
MOV T3, BRC0
MOV nx, mac_cnt
SUB #2, mac_cnt
; R pointer setup
MOV nx, B
SUB #1, B
ADD dbl(*sp(#(r_orig))), B
MOV B, Xr_ptr
; Setup pointers
MOV dbl(*sp(#(y_orig))), Xy_save
MOV dbl(*sp(#(x_orig))), Xx_save
MOV Xx_save, XCDP
MOV Xy_save, Xy_ptr
MOV mac_cnt, CSR
REGION2_LOOP:
RPTBLOCAL r2localloop
; ---- Setup pointers ----
ADD #1, y_save
; ---- Preload A ----
MPYM *y_ptr+, *CDP+, A
; ---- Main MAC loop ----
; MOV mac_cnt, CSR
RPT CSR
MACM *y_ptr+, *CDP+, A
; ---- BIAS ----
MPYMR *sp(#(temp)), A, A
; ---- Setup for subsequent passes through Region 2 ----
MOV Xx_save, XCDP
MOV Xy_save, Xy_ptr
; ---- Store ----
r2localloop: MOV HI(A), *r_ptr+
; Check if overflow occurred, and setup return value
;----------------------------------------------------------------
MOV #0, oflag
.if $isdefed("SI_BUGS")
XCC dummy1, overflow(A)
.else
XCCPART dummy1, overflow(A)
.endif
dummy1: MOV #1, A
.if $isdefed("SI_BUGS")
XCC dummy2, overflow(B)
.else
XCCPART dummy2, overflow(B)
.endif
dummy2: MOV #1, A
;
; Restore status regs to expected C-convention values as needed
; Restore any save-on-entry registers that are used
;----------------------------------------------------------------
MOV dbl(*SP(#(SAVE_AR7))), XAR7 ; POPM AR7
|| BCLR #ST1_SATD, ST1_55
MOV dbl(*SP(#(SAVE_AR6))), XAR6 ; POPM AR6
|| BCLR SATA
MOV dbl(*SP(#(SAVE_AR5))), XAR5 ; POPM AR5
|| BCLR #ST1_FRCT, ST1_55
;
; Deallocate the local frame and argument block
;----------------------------------------------------------------
AADD #(ARG_BLK_SZ + FRAME_SZ + REG_SAVE_SZ), SP
POP mmap(ST3_55)
POP mmap(ST2_55)
POP mmap(ST1_55)
POP mmap(ST0_55)
;
; Return to calling function
;----------------------------------------------------------------
return ; RETD
;----------------------------------------------------------------
;End of file
|
programs/oeis/155/A155461.asm | neoneye/loda | 22 | 94771 | ; A155461: a(n) = n^2 + 52*n + 30.
; 30,83,138,195,254,315,378,443,510,579,650,723,798,875,954,1035,1118,1203,1290,1379,1470,1563,1658,1755,1854,1955,2058,2163,2270,2379,2490,2603,2718,2835,2954,3075,3198,3323,3450,3579,3710,3843,3978,4115,4254,4395,4538,4683,4830,4979,5130,5283,5438,5595,5754,5915,6078,6243,6410,6579,6750,6923,7098,7275,7454,7635,7818,8003,8190,8379,8570,8763,8958,9155,9354,9555,9758,9963,10170,10379,10590,10803,11018,11235,11454,11675,11898,12123,12350,12579,12810,13043,13278,13515,13754,13995,14238,14483,14730,14979
add $0,26
pow $0,2
sub $0,646
|
alloy4fun_models/trashltl/models/1/JCRsPuhQPucq53r95.als | Kaixi26/org.alloytools.alloy | 0 | 520 | open main
pred idJCRsPuhQPucq53r95_prop2 {
before(no File)
}
pred __repair { idJCRsPuhQPucq53r95_prop2 }
check __repair { idJCRsPuhQPucq53r95_prop2 <=> prop2o } |
oeis/099/A099800.asm | neoneye/loda-programs | 11 | 84029 | ; A099800: Bisection of A002110.
; Submitted by <NAME>(s3)
; 2,30,2310,510510,223092870,200560490130,304250263527210,614889782588491410,1922760350154212639070,7858321551080267055879090,40729680599249024150621323470,267064515689275851355624017992790
mul $0,2
seq $0,88860 ; Twice the primorials (first definition), 2*A002110(n).
div $0,2
|
Driver/Printer/PrintCom/Graphics/graphicsPrintSwath360.asm | steakknife/pcgeos | 504 | 163862 |
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Epson late model 24-pin print drivers
FILE: graphicsPrintSwath360.asm
AUTHOR: <NAME> 1 March 1990
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 3/1/90 Initial revision
DESCRIPTION:
$Id: graphicsPrintSwath360.asm,v 1.1 97/04/18 11:51:23 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrintSwath
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Print a page-wide bitmap
CALLED BY: GLOBAL
PASS: bp - PState segment
dx.cx - VM file and block handle for Huge bitmap
RETURN: carry - set if some transmission error
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 03/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrintSwath proc far
uses ax,cx,ds,bx,dx,si,di,ds,es
.enter
mov es, bp ; es -> PState
; load the bitmap header into the PState
call LoadSwathHeader ; bitmap header into PS_swath
; load up the band width and height
call PrLoadPstateVars ;set up the pstate band Vars.
; size and allocate a graphics data buffer
call PrCreatePrintBuffers ;allocate the print buffer.
; get pointer to data
clr ax
mov es:[PS_curColorNumber],ax ;init offset into scanline.
call DerefFirstScanline ; ds:si -> scan line zero
call SetFirstCMYK ;set the ribbon up.
jc exitErr
; dec cx ; see if only one band to do
jcxz printLastBand
bandLoop:
call PrPrintABand ;print a band from this swath.
jc exitErr
push dx ; save band count
mov dx,HI_RES_BAND_HEIGHT
if HI_RES_INTERLEAVE_FACTOR ne 1 ;only for interleaved passes
cmp es:[PS_mode], PM_GRAPHICS_HI_RES
jne lineFeedHere
sub dx,HI_RES_INTERLEAVE_FACTOR ;make up for extra 1/360 between
;hi resolution passes.
lineFeedHere:
endif
call PrLineFeed ;send control code for hi res.
pop dx
jc exitErr
loop bandLoop
; if any remainder, then we need to send it, plus a shorter
; line feed
printLastBand:
tst dx ; any remainder ?
jz destroyBuffer
call PrPrintABand ; print last band
jc exitErr
cmp es:[PS_mode], PM_GRAPHICS_LOW_RES
jne checkMedRes
mov cx, dx ; amount to line feed (in hires)
shl cx, 1 ; need it *3 for 60 to 180dpi
add dx, cx
checkMedRes:
cmp es:[PS_mode], PM_GRAPHICS_HI_RES
je send360LineFeed
shl dx,1 ;x2 for 180 to 360 dpi
jmp sendLastLineFeed
send360LineFeed:
if HI_RES_INTERLEAVE_FACTOR ne 1 ;only for interleaved passes
sub dx,HI_RES_INTERLEAVE_FACTOR ;make up for extra 1/360 between
;hi resolution passes.
js destroyBuffer ;just leave, if negative result.
endif
sendLastLineFeed:
call PrLineFeed ;
jc exitErr
; all done, kill the buffer and leave
destroyBuffer:
call PrDestroyPrintBuffers ;get rid of print buffer space.
clc ; no errors
exit:
.leave
ret
; some transmission error. cleanup and exit.
exitErr:
call PrDestroyPrintBuffers ;get rid of print buffer space.
stc
jmp exit
PrintSwath endp
|
libsrc/stdio/tms9918/conio_map_colour.asm | Toysoft/z88dk | 0 | 100586 | <reponame>Toysoft/z88dk
; Platform specific colour transformation
;
; Entry: a = colour
; Exit: a = colour to use on screen
; Used: c,f
;
MODULE code_clib
PUBLIC conio_map_colour
EXTERN __CLIB_CONIO_NATIVE_COLOUR
conio_map_colour:
ld c,__CLIB_CONIO_NATIVE_COLOUR
rr c
ret c
and 7
inc a ;(1,3,5,7: black, green, blue, cyan)
bit 0,a
ret nz
add 7 ; (2,4,6,8 -> 9,11,13,15; red, yellow, magenta, white)
ret
|
Source/HBIOS/eastaegg.asm | davidknoll/RomWBW | 194 | 100 | <gh_stars>100-1000
; Adapted from https://rosettacode.org/wiki/Mandelbrot_set#Z80_Assembly
; by <NAME> <EMAIL>
;
; WBWROM SBV V2 Easteregg
;
; Compute a Mandelbrot set on a simple Z80 computer.
;
; Porting this program to another Z80 platform should be easy and straight-
; forward: The only dependencies on my homebrew machine are the system-calls
; used to print strings and characters. These calls are performed by loading
; IX with the number of the system-call and performing an RST 08. To port this
; program to another operating system just replace these system-calls with
; the appropriate versions. Only three system-calls are used in the following:
; _crlf: Prints a CR/LF, _puts: Prints a 0-terminated string (the adress of
; which is expected in HL), and _putc: Print a single character which is
; expected in A. RST 0 give control back to the monitor.
;
#include "std.asm"
cr .equ 0dh
lf .equ 0ah
eos .equ 00h
.org EGG_LOC
scale .equ 256 ; Do NOT change this - the
; arithmetic routines rely on
; this scaling factor! :-)
divergent .equ scale * 4
ld sp,HBX_LOC
ld hl, welcome ; Print a welcome message
call _puts
; for (y = <initial_value> ; y <= y_end; y += y_step)
; {
outer_loop ld hl, (y_end) ; Is y <= y_end?
ld de, (y)
and a ; Clear carry
sbc hl, de ; Perform the comparison
jp m, mandel_end ; End of outer loop reached
; for (x = x_start; x <= x_end; x += x_step)
; {
ld hl, (x_start) ; x = x_start
ld (x), hl
inner_loop ld hl, (x_end) ; Is x <= x_end?
ld de, (x)
and a
sbc hl, de
jp m, inner_loop_end ; End of inner loop reached
; z_0 = z_1 = 0;
ld hl, 0
ld (z_0), hl
ld (z_1), hl
; for (iteration = iteration_max; iteration; iteration--)
; {
ld a, (iteration_max)
ld b, a
iteration_loop push bc ; iteration -> stack
; z2 = (z_0 * z_0 - z_1 * z_1) / SCALE;
ld de, (z_1) ; Compute DE HL = z_1 * z_1
ld b,d
ld c,e
call mul_16
ld (z_0_square_low), hl ; z_0 ** 2 is needed later again
ld (z_0_square_high), de
ld de, (z_0) ; Compute DE HL = z_0 * z_0
ld b,d
ld c,e
call mul_16
ld (z_1_square_low), hl ; z_1 ** 2 will be also needed
ld (z_1_square_high), de
and a ; Compute subtraction
ld bc, (z_0_square_low)
sbc hl, bc
ld (scratch_0), hl ; Save lower 16 bit of result
ld h,d
ld l,e
ld bc, (z_0_square_high)
sbc hl, bc
ld bc, (scratch_0) ; HL BC = z_0 ** 2 - z_1 ** 2
ld c, b ; Divide by scale = 256
ld b, l ; Discard the rest
push bc ; We need BC later
; z3 = 2 * z0 * z1 / SCALE;
ld hl, (z_0) ; Compute DE HL = 2 * z_0 * z_1
add hl, hl
ld d,h
ld e,l
ld bc, (z_1)
call mul_16
ld b, e ; Divide by scale (= 256)
ld c, h ; BC contains now z_3
; z1 = z3 + y;
ld hl, (y)
add hl, bc
ld (z_1), hl
; z_0 = z_2 + x;
pop bc ; Here BC is needed again :-)
ld hl, (x)
add hl, bc
ld (z_0), hl
; if (z0 * z0 / SCALE + z1 * z1 / SCALE > 4 * SCALE)
ld hl, (z_0_square_low) ; Use the squares computed
ld de, (z_1_square_low) ; above
add hl, de
ld b,h ; BC contains lower word of sum
ld c,l
ld hl, (z_0_square_high)
ld de, (z_1_square_high)
adc hl, de
ld h, l ; HL now contains (z_0 ** 2 +
ld l, b ; z_1 ** 2) / scale
ld bc, divergent
and a
sbc hl, bc
; break;
jp c, iteration_dec ; No break
pop bc ; Get latest iteration counter
jr iteration_end ; Exit loop
; iteration++;
iteration_dec pop bc ; Get iteration counter
djnz iteration_loop ; We might fall through!
; }
iteration_end
; printf("%c", display[iteration % 7]);
ld a, b
and $7 ; lower three bits only (c = 0)
sbc hl, hl
ld l, a
ld de, display ; Get start of character array
add hl, de ; address and load the
ld a, (hl) ; character to be printed
call _putc ; Print the character
ld de, (x_step) ; x += x_step
ld hl, (x)
add hl, de
ld (x), hl
jp inner_loop
; }
; printf("\n");
inner_loop_end call _putcrlf ; Print a CR/LF pair
ld de, (y_step) ; y += y_step
ld hl, (y)
add hl, de
ld (y), hl ; Store new y-value
jp outer_loop
; }
mandel_end ld hl, finished ; Print finished-message
call _puts
; GET CONSOLE INPUT STATUS VIA HBIOS
waitch
#IF (BIOS == BIOS_WBW)
LD C,CIO_CONSOLE ; CONSOLE UNIT TO C
LD B,BF_CIOIN ; HBIOS FUNC: INPUT CHAR
RST 08 ; DO IT
; RETURN TO THE LOADER
LD A,BID_BOOT ; BOOT BANK
LD HL,0 ; ADDRESS ZERO
CALL HB_BNKCALL ; DOES NOT RETURN
HALT
#ENDIF
#IF (BIOS == BIOS_UNA)
LD B,0 ; CONSOLE UNIT TO B
LD C,BF_CIOIN ; UBIOS FUNC: INPUT CHAR
CALL $FFFD ; DO IT
; RETURN TO THE LOADER
LD BC,$01FB ; UNA FUNC = SET BANK
LD DE,0 ; ROM BANK 0
CALL $FFFD ; DO IT
JP 0 ; JUMP TO RESTART ADDRESS
#ENDIF
_putcrlf ld hl, crlf
_puts push af
puts0 ld a,(hl)
cp eos
jr z,puts1
call _putc
inc hl
jr puts0
puts1 pop af
ret
_putc
#IF (BIOS == BIOS_WBW)
PUSH AF
PUSH BC
PUSH DE
PUSH HL
LD E,A ; OUTPUT CHAR TO E
LD C,CIO_CONSOLE ; CONSOLE UNIT TO C
LD B,BF_CIOOUT ; HBIOS FUNC: OUTPUT CHAR
RST 08 ; HBIOS OUTPUTS CHARACTDR
POP HL
POP DE
POP BC
POP AF
RET
#ENDIF
#IF (BIOS == BIOS_UNA)
PUSH AF
PUSH BC
PUSH DE
PUSH HL
LD E,A ; OUTPUT CHAR TO E
LD B,0 ; CONSOLE UNIT TO B
LD C,BF_CIOOUT ; UBIOS FUNC: OUTPUT CHAR
CALL $FFFD ; UBIOS OUTPUTS CHARACTDR
POP HL
POP DE
POP BC
POP AF
RET
#ENDIF
welcome .db "Generating a Mandelbrot set..."
.db cr, lf, cr, lf, eos
finished .db "Computation finished."
crlf .db cr, lf, eos
iteration_max .db 10 ; How many iterations
x .dw 0 ; x-coordinate
x_start .dw -2 * scale ; Minimum x-coordinate
x_end .dw 5 * scale / 10 ; Maximum x-coordinate
x_step .dw 4 * scale / 100 ; x-coordinate step-width
y .dw -1 * scale ; Minimum y-coordinate
y_end .dw 1 * scale ; Maximum y-coordinate
y_step .dw 1 * scale / 10 ; y-coordinate step-width
z_0 .dw 0 ;0
z_1 .dw 0 ;0
scratch_0 .dw 0
z_0_square_high .dw 0
z_0_square_low .dw 0
z_1_square_high .dw 0
z_1_square_low .dw 0
display .db " .-+*=#@" ; 8 characters for the display
;
; Compute DEHL = BC * DE (signed): This routine is not too clever but it
; works. It is based on a standard 16-by-16 multiplication routine for unsigned
; integers. At the beginning the sign of the result is determined based on the
; signs of the operands which are negated if necessary. Then the unsigned
; multiplication takes place, followed by negating the result if necessary.
;
mul_16 xor a ; Clear carry and A (-> +)
bit 7, b ; Is BC negative?
jr z, bc_positive ; No
sub c ; A is still zero, complement
ld c, a
ld a, 0
sbc a, b
ld b, a
scf ; Set carry (-> -)
bc_positive bit 7, D ; Is DE negative?
jr z, de_positive ; No
push af ; Remember carry for later!
xor a
sub e
ld e, a
ld a, 0
sbc a, d
ld d, a
pop af ; Restore carry for complement
ccf ; Complement Carry (-> +/-?)
de_positive push af ; Remember state of carry
and a ; Start multiplication
sbc hl, hl
ld a, 16 ; 16 rounds
mul_16_loop add hl, hl
rl e
rl d
jr nc, mul_16_exit
add hl, bc
jr nc, mul_16_exit
inc de
mul_16_exit dec a
jr nz, mul_16_loop
pop af ; Restore carry from beginning
ret nc ; No sign inversion necessary
xor a ; Complement DE HL
sub l
ld l, a
ld a, 0
sbc a, h
ld h, a
ld a, 0
sbc a, e
ld e, a
ld a, 0
sbc a, d
ld d, a
ret
lastbyte .equ $
SLACK .EQU (EGG_END - lastbyte)
.FILL SLACK,'e'
;
.ECHO "EASTEREGG space remaining: "
.ECHO SLACK
.ECHO " bytes.\n"
.end
|
oeis/228/A228521.asm | neoneye/loda-programs | 11 | 91077 | ; A228521: x-values in the solution to the Pell equation x^2 - 29*y^2 = -1.
; Submitted by <NAME>
; 70,1372210,26898060350,527255777608490,10335267725783560630,202591917433553577860770,3971206755197249507443252910,77843594612784567411349065681050,1525890137628596335200014878036689190,29910498399952150749806124227926115821330,586305588109971921369103311915792844293021470,11492762108221171202725012370367247105905691033610,225281122259045809805843771114835465854170511347801750,4415960547029053855592978398667992431306203257533918869890
mul $0,3
lpb $0
sub $0,1
add $3,1
mov $1,$3
mul $1,25
add $2,1
add $2,$1
add $3,$2
lpe
mov $0,$3
div $0,20384
mul $0,254800
add $0,$2
mul $0,5
add $0,70
|
gcc-gcc-7_3_0-release/gcc/ada/a-etgrbu.ads | best08618/asylo | 7 | 13038 | <filename>gcc-gcc-7_3_0-release/gcc/ada/a-etgrbu.ads
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . E X E C U T I O N _ T I M E . G R O U P _ B U D G E T S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2015, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This unit is not implemented in typical GNAT implementations that lie on
-- top of operating systems, because it is infeasible to implement in such
-- environments.
-- If a target environment provides appropriate support for this package,
-- then the Unimplemented_Unit pragma should be removed from this spec and
-- an appropriate body provided.
with System;
with System.Multiprocessors;
package Ada.Execution_Time.Group_Budgets is
pragma Unimplemented_Unit;
type Group_Budget
(CPU : System.Multiprocessors.CPU := System.Multiprocessors.CPU'First)
is tagged limited private;
type Group_Budget_Handler is access
protected procedure (GB : in out Group_Budget);
type Task_Array is
array (Positive range <>) of Ada.Task_Identification.Task_Id;
Min_Handler_Ceiling : constant System.Any_Priority :=
System.Any_Priority'First;
-- Initial value is an arbitrary choice ???
procedure Add_Task
(GB : in out Group_Budget;
T : Ada.Task_Identification.Task_Id);
procedure Remove_Task
(GB : in out Group_Budget;
T : Ada.Task_Identification.Task_Id);
function Is_Member
(GB : Group_Budget;
T : Ada.Task_Identification.Task_Id) return Boolean;
function Is_A_Group_Member
(T : Ada.Task_Identification.Task_Id) return Boolean;
function Members (GB : Group_Budget) return Task_Array;
procedure Replenish
(GB : in out Group_Budget;
To : Ada.Real_Time.Time_Span);
procedure Add
(GB : in out Group_Budget;
Interval : Ada.Real_Time.Time_Span);
function Budget_Has_Expired (GB : Group_Budget) return Boolean;
function Budget_Remaining
(GB : Group_Budget) return Ada.Real_Time.Time_Span;
procedure Set_Handler
(GB : in out Group_Budget;
Handler : Group_Budget_Handler);
function Current_Handler (GB : Group_Budget) return Group_Budget_Handler;
procedure Cancel_Handler
(GB : in out Group_Budget;
Cancelled : out Boolean);
Group_Budget_Error : exception;
private
type Group_Budget
(CPU : System.Multiprocessors.CPU := System.Multiprocessors.CPU'First)
is tagged limited null record;
end Ada.Execution_Time.Group_Budgets;
|
scripts/show_security_settings.applescript | DatasiteLabs/ds-labs-local-setup | 1 | 708 | #!/usr/bin/env osascript
tell application "System Preferences"
try
activate
delay 5
end try
end tell
tell application "System Events"
tell process "System Preferences"
set frontmost to true
delay 2
click button "Show All" of group 1 of group 2 of toolbar of window 1
delay 2
click button "Security
& Privacy" of scroll area 1 of window 1
end tell
end tell
|
oeis/140/A140980.asm | neoneye/loda-programs | 11 | 170742 | <reponame>neoneye/loda-programs
; A140980: Number of (4,2)-noncrossing partitions of [n].
; Submitted by <NAME>
; 1,1,2,5,15,52,202,856,3868,18313,89711,450825,2310453
mov $7,2
lpb $7
sub $0,1
mov $6,$0
sub $7,2
mov $8,2
lpb $8
mov $0,$6
sub $0,1
mov $3,$6
mov $5,$0
sub $8,1
lpb $3
mov $0,$5
sub $3,1
sub $0,$3
mov $2,$0
seq $2,64613 ; Second binomial transform of the Catalan numbers.
add $4,$2
mod $6,1
lpe
lpe
lpe
mov $0,$4
add $0,1
|
yarspg/YARSpg.g4 | lszeremeta/yarspg | 0 | 6480 | /*
[The "BSD licence"]
Copyright (c) 2018-2021, <NAME> (@ University of Bialystok, https://github.com/lszeremeta)
Copyright (c) 2018, <NAME> (@ University of Bialystok, http://www.uwb.edu.pl/)
Copyright (c) 2018, <NAME> (@ University of Bialystok, http://www.uwb.edu.pl/)
All rights reserved.
Based on YARS grammar
(https://github.com/lszeremeta/antlr-yars/blob/master/yars/YARS.g4)
distributed under BSD licence.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
*/
grammar YARSpg;
yarspg
: (statement metadata?)* EOF
;
statement
: node
| edge
| metadata
| variable_declaration
| node_schema
| edge_schema
| variable_declaration_schema
| graph
| graph_schema
;
metadata
: '+' prop_list
;
variable
: '$' variable_name
;
variable_declaration
: variable '=' prop (',' prop)*
;
variable_declaration_schema
: variable '=' prop_schema (',' prop_schema)*
;
variable_name
: ALNUMPLUS
;
graph_id
: DEFAULT
| ALNUMPLUS
;
prop_list
: '[' ( ( prop | variable ) (',' ( prop | variable ) )* )? ']'
;
meta_prop
: '@' '<' ( key ':' value ( ',' key ':' value )* )? '>'
;
graphs_list
: '/' graph_id (',' graph_id)* '/'
;
graph
: '/' graph_id '/' ( '{' ( graph_label ( ',' graph_label )* )? '}' )? prop_list?
;
node
: '(' node_id ( '{' ( node_label ( ',' node_label )* )? '}' )? prop_list? ')' graphs_list?
;
edge
: directed
| undirected
;
directed
: '(' node_id ')' '-' '(' edge_id? ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list? ')' '->' '(' node_id ')' graphs_list?
;
undirected
: '(' node_id ')' '-' '(' edge_id? ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list? ')' '-' '(' node_id ')' graphs_list?
;
node_id
: ALNUMPLUS
;
node_label
: STR
;
prop
: key ':' value meta_prop?
;
edge_id
: ALNUMPLUS
;
edge_label
: STR
;
graph_label
: STR
;
key
: STR
;
value
: primitive_value
| complex_value
;
primitive_value
: STR
;
complex_value
: set_value
| list_value
| struct_value
;
set_value
: '{' (primitive_value | set_value) meta_prop? (',' (primitive_value | set_value) meta_prop?)* '}'
;
list_value
: '[' (primitive_value | list_value) meta_prop? (',' (primitive_value | list_value) meta_prop?)* ']'
;
struct_value
: '{' key ':' (primitive_value | struct_value) meta_prop? (',' key ':' (primitive_value | struct_value) meta_prop?)* '}'
;
node_schema
: 'S' '(' node_id_schema ( '{' ( node_label ( ',' node_label )* )? '}' )? prop_list_schema? ')' graphs_list?
;
node_id_schema
: ALNUMPLUS
;
prop_list_schema
: '[' ( ( prop_schema | variable ) (',' ( prop_schema | variable ) )* )? ']'
;
prop_schema
: key ':' value_schema
;
meta_prop_schema
: '@' '<' ( key ':' value_schema ( ',' key ':' value_schema )* )? '>'
;
cardinality
: min_cardinality max_cardinality?
| max_cardinality
;
min_cardinality
: MIN card_num
;
max_cardinality
: MAX card_num
;
card_num
: UNSIGNED_INT
;
value_schema
: primitive_value_schema (UNIQUE | NULL)? OPTIONAL? meta_prop_schema?
| complex_value_schema NULL? OPTIONAL? meta_prop_schema?
;
primitive_value_schema
: BOOL
| STRING ( '(' max_length? ')' )?
| BYTES ( '(' ( ( min_length ',' )? max_length )? ')' )?
| INTEGER ( '(' precision? ')' )?
| UINTEGER ( '(' precision? ')' )?
| DECIMAL ( '(' ( precision ( ',' scale )? )? ')' )?
| FLOAT ( '(' ( precision ( ',' scale )? )? ')' )?
| DATETIME
| LOCALDATETIME
| DATE
| TIME
| LOCALTIME
| DURATION
| ALNUMPLUS
;
min_length
: UNSIGNED_INT
;
max_length
: UNSIGNED_INT
;
precision
: UNSIGNED_INT
;
scale
: UNSIGNED_INT
;
complex_value_schema
: multiset_schema
| set_schema
| list_schema
| dlist_schema
| struct_schema
;
multiset_schema
: MULTISET '(' (primitive_value_schema | multiset_schema) NULL? cardinality? ')' meta_prop_schema?
;
set_schema
: SET '(' (primitive_value_schema | set_schema) NULL? cardinality? ')' meta_prop_schema?
;
list_schema
: LIST '(' (primitive_value_schema | list_schema) NULL? cardinality? ')' meta_prop_schema?
;
dlist_schema
: DLIST '(' (primitive_value_schema | dlist_schema) NULL? cardinality? ')' meta_prop_schema?
;
struct_schema
: STRUCT '(' (primitive_value_schema | struct_schema) NULL? cardinality? ')' meta_prop_schema?
;
edge_schema
: directed_schema
| undirected_schema
;
directed_schema
: 'S' '(' node_id_schema ')' '-' ( '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' )? '->' '(' node_id_schema ')' graphs_list?
;
undirected_schema
: 'S' '(' node_id_schema ')' '-' ( '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' )? '-' '(' node_id_schema ')' graphs_list?
;
graph_schema
: 'S' '/' graph_id '/' prop_list_schema?
;
// CASE-INSENSITIVE NAMES
// primitive datetypes
BOOL: ( 'B' | 'b' ) ( 'O' | 'o' ) ( 'O' | 'o' ) ( 'L' | 'l' );
STRING: ( 'S' | 's' ) ( 'T' | 't' ) ( 'R' | 'r' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'G' | 'g' );
BYTES: ( 'B' | 'b' ) ( 'Y' | 'y' ) ( 'T' | 't' ) ( 'E' | 'e' ) ( 'S' | 's' );
INTEGER: ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'T' | 't' ) ( 'E' | 'e' ) ( 'G' | 'g' ) ( 'E' | 'e' ) ( 'R' | 'r' );
UINTEGER: ( 'U' | 'u' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'T' | 't' ) ( 'E' | 'e' ) ( 'G' | 'g' ) ( 'E' | 'e' ) ( 'R' | 'r' );
DECIMAL: ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'C' | 'c' ) ( 'I' | 'i' ) ( 'M' | 'm' ) ( 'A' | 'a' ) ( 'L' | 'l' );
FLOAT: ( 'F' | 'f' ) ( 'L' | 'l' ) ( 'O' | 'o' ) ( 'A' | 'a' ) ( 'T' | 't' );
DATETIME: ( 'D' | 'd' ) ( 'A' | 'a' ) ( 'T' | 't' ) ( 'E' | 'e' ) ( 'T' | 't' ) ( 'I' | 'i' ) ( 'M' | 'm' ) ( 'E' | 'e' );
LOCALDATETIME: ( 'L' | 'l' ) ( 'O' | 'o' ) ( 'C' | 'c' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'D' | 'd' ) ( 'A' | 'a' ) ( 'T' | 't' ) ( 'E' | 'e' ) ( 'T' | 't' ) ( 'I' | 'i' ) ( 'M' | 'm' ) ( 'E' | 'e' );
DATE: ( 'D' | 'd' ) ( 'A' | 'a' ) ( 'T' | 't' ) ( 'E' | 'e' );
TIME: ( 'T' | 't' ) ( 'I' | 'i' ) ( 'M' | 'm' ) ( 'E' | 'e' );
LOCALTIME: ( 'L' | 'l' ) ( 'O' | 'o' ) ( 'C' | 'c' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'T' | 't' ) ( 'I' | 'i' ) ( 'M' | 'm' ) ( 'E' | 'e' );
DURATION: ( 'D' | 'd' ) ( 'U' | 'u' ) ( 'R' | 'r' ) ( 'A' | 'a' ) ( 'T' | 't' ) ( 'I' | 'i' ) ( 'O' | 'o' ) ( 'N' | 'n' );
// complex datetypes
MULTISET: ( 'M' | 'm' ) ( 'U' | 'u' ) ( 'L' | 'l' ) ( 'T' | 't' ) ( 'I' | 'i' ) ( 'S' | 's' ) ( 'E' | 'e' ) ( 'T' | 't' );
SET: ( 'S' | 's' ) ( 'E' | 'e' ) ( 'T' | 't' );
LIST: ( 'L' | 'l' ) ( 'I' | 'i' ) ( 'S' | 's' ) ( 'T' | 't' );
DLIST: ( 'D' | 'd' ) ( 'L' | 'l' ) ( 'I' | 'i' ) ( 'S' | 's' ) ( 'T' | 't' );
STRUCT: ( 'S' | 's' ) ( 'T' | 't' ) ( 'R' | 'r' ) ( 'U' | 'u' ) ( 'C' | 'c' ) ( 'T' | 't' );
// keywords
DEFAULT : ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'F' | 'f' ) ( 'A' | 'a' ) ( 'U' | 'u' ) ( 'L' | 'l' ) ( 'T' | 't' );
MIN: ( 'M' | 'm' ) ( 'I' | 'i' ) ( 'N' | 'n' );
MAX: ( 'M' | 'm' ) ( 'A' | 'a' ) ( 'X' | 'x' );
UNIQUE: ( 'U' | 'u' ) ( 'N' | 'n' ) ( 'I' | 'i' ) ( 'Q' | 'q' ) ( 'U' | 'u' ) ( 'E' | 'e' );
NULL: ( 'N' | 'n' ) ( 'U' | 'u' ) ( 'L' | 'l' ) ( 'L' | 'l' );
OPTIONAL: ( 'O' | 'o' ) ( 'P' | 'p' ) ( 'T' | 't' ) ( 'I' | 'i' ) ( 'O' | 'o' ) ( 'N' | 'n' ) ( 'A' | 'a' ) ( 'L' | 'l' );
// END CASE-INSENSITIVE NAMES
COMMENT
: '#' ~[\r\n\f]* -> skip
;
STR
: '"' (~ ["\\\r\n] | '\'' | '\\"')* '"'
;
UNSIGNED_INT
: [0-9]+
;
ALNUMPLUS
: [a-zA-Z_][a-zA-Z0-9_]*
;
WS
: [ \t\n]+ -> skip
;
|
programs/oeis/283/A283443.asm | neoneye/loda | 22 | 102325 | <reponame>neoneye/loda
; A283443: a(n) = lcm(n,6) / gcd(n,6).
; 0,6,3,2,6,30,1,42,12,6,15,66,2,78,21,10,24,102,3,114,30,14,33,138,4,150,39,18,42,174,5,186,48,22,51,210,6,222,57,26,60,246,7,258,66,30,69,282,8,294,75,34,78,318,9,330,84,38,87,354,10,366,93,42,96,390,11,402,102,46,105,426,12,438,111,50,114,462,13,474,120,54,123,498,14,510,129,58,132,534,15,546,138,62,141,570,16,582,147,66
mov $1,6
gcd $1,$0
mul $0,6
pow $1,2
div $0,$1
|
CS660/PA02/code/PA02b_iterative_factorial.asm | T-R0D/Past-Courses | 7 | 80569 | #
# MIPS Iterative Factorial
#
# Author: <NAME>
#
.text
.globl main
.globl iterative_factorial
main:
subu $sp, $sp, 4
sw $ra, ($sp)
subu $sp, $sp, 4
sw $s0, ($sp)
li $a0, 10
jal iterative_factorial
nop
move $s0, $v0
lw $s0, ($sp)
addu $sp, $sp, 4
lw $ra, ($sp)
addu $sp, $sp, 4
li $v0, 10
syscall
iterative_factorial:
subu $sp, $sp, 4
sw $ra, ($sp)
subu $sp, $sp, 4
sw $s0, ($sp)
subu $sp, $sp, 4
sw $s1, ($sp)
move $s0, $a0
li $s1, 1
blt $s0, 0, factorial_error
nop
factorial_loop:
ble $s0, 1, end_factorial
nop
mul $s1, $s1, $s0
sub $s0, $s0, 1
j factorial_loop
factorial_error:
li $s1, -1
end_factorial:
move $v0, $s1
lw $s1, ($sp)
addu $sp, $sp, 4
lw $s0, ($sp)
addu $sp, $sp, 4
lw $ra, ($sp)
addu $sp, $sp, 4
jr $ra
|
src/main/antlr4/it/osys/jaxrsodata/antlr4/ODataOrderBy.g4 | dometec/jaxrs-odata | 5 | 7819 | grammar ODataOrderBy;
/*
* Parser Rules
*/
filter: expr;
expr :
| FIELD ASC
| FIELD DESC
| FIELD ASC COMMA expr
| FIELD DESC COMMA expr
;
/*
* Lexer Rules
*/
COMMA: ',';
ASC: 'asc';
DESC: 'desc';
FIELD: [A-Za-z0-9/]+;
WS: [ \t\r\n]+ -> skip;
|
Antlr/KCC2.g4 | knoxaramav2/KCC | 0 | 3669 | grammar KCC2;
options{
language= CSharp;
}
/*
high : '*'|'/';
low : '+'|'-';
test : test high test
| test low test
| '(' test ')'
| integer
;*/
rules : assembly_decl +;
//constructs
assembly_decl : ASSEMBLY symbol_id asm_block;
class_decl : 'class' symbol_id class_block;
function_decl : symbol_id symbol_id fnc_header function_block;
//blocks
asm_block : L_BRACE ((class_decl|function_decl|~R_BRACE)+)? R_BRACE;
class_block : L_BRACE ((function_decl|var_decl|~R_BRACE)+)? R_BRACE;
function_block : L_BRACE ((var_decl|keyword_call|function_call|expression|~R_BRACE)+)? R_BRACE ;
//groups
fnc_header : L_PARANTH ((var_decl)(','(var_decl)+)?|~R_PARANTH)? R_PARANTH;
call_group : L_PARANTH ((value_id|expression)((','(value_id|expression))+)?|~R_PARANTH)? R_PARANTH;
expr_group : ;
index_anyvalue : index_string|index_integer|index_variable;
index_string : '['string']';
index_integer : '['integer']';
index_variable : '[' ']';
//keywords
keywords : 'return'
| 'print'
| 'exit'
;
//operations
var_decl : symbol_id (index_anyvalue)? symbol_id ('=' (expression|value_id))?;
keyword_call : keywords (call_group|value_id)?;
function_call : call_group;
unary_expr : rv_unary_ops #rv
| lv_unary_ops #lv
;
//operations
/*
expression : (unary_expr|value_id) binary_ops (unary_expr|value_id|expression)
| expression binary_ops (expression|value_id)
| unary_expr;*/
expression : '-' expression
| expression oop_1 expression
| expression oop_2 expression
| expression oop_3 expression
| expression oop_4 expression
| expression oop_5 expression
| expression oop_6 expression
| expression oop_7 expression
| expression oop_8 expression
| expression oop_9 expression
| expression oop_10 expression
| expression oop_11 expression
| expression oop_12 expression
| expression oop_13 expression
| expression oop_14 expression
| expression oop_15 expression
| expression oop_16 expression
| value_id
;
oop_1 : ('.'|index_anyvalue)
;
oop_2 : //index_anyvalue#index
function_call#fnc_call
;
oop_3 : INCREMENT#post_inc
| DECRIMENT#post_dec
;
oop_4 : //INCREMENT #pre_inc
DECRIMENT symbol_id#pre_dec
| NOT#not
| BIT_INVERT#invert
| '(' restric_id ')'#cast
;
oop_5 : MULTIPLY#product
| DIVIDE#quotient
| MODULO#remainder
| EXPONENT#power
;
oop_6 : ADD#sum
| SUBTRACT#difference
;
oop_7 : BIT_LSHIFT#left_shift
| BIT_RSHIFT#right_shift
;
oop_8 : LESS_THAN#less
| expression LESS_OR_EQUAL#less_equal
| GREATER_THAN#greater
| GREATER_OR_EQUAL#greater_equal
;
oop_9 : EQUAL_TO#equal
| NOT_EQUAL#not_equal
;
oop_10 : BIT_AND;
oop_11 : BIT_XOR;
oop_12 : BIT_OR;
oop_13 : AND#and
| NAND#nand;
oop_14 : OR#or
| NOR#nor
| XOR#xor
| XNOR#xnor
;
oop_15 : SET#set
| SET_SUM#set_sum
| SET_DIFFERENCE#set_diff
| SET_PRODUCT#set_product
| SET_QUOTIENT#set_quotient
| SET_REMAINDER#set_remainder
| SET_AND#set_and
| SET_XOR#set_xor
| expression SET_OR expression #set_or
;
oop_16 : LIST#list;
//resolution
rv_unary_ops : symbol_id increment
| symbol_id decrement;
lv_unary_ops : increment symbol_id
| decrement symbol_id
| unary_symb symbol_id;
increment : INCREMENT;
decrement : DECRIMENT;
binary_ops : math_ops
| assign_ops
| logic_ops
| bitwise_ops
;
unary_symb : NOT | BIT_INVERT;
assign_ops : SET
| SET_SUM
| SET_DIFFERENCE
| SET_PRODUCT
| SET_QUOTIENT
| SET_REMAINDER
| SET_AND
| SET_XOR
| SET_OR
;
math_ops : ADD
| SUBTRACT
| MULTIPLY
| DIVIDE
| EXPONENT
| MODULO
;
logic_ops : AND
| NAND
| OR
| NOR
| XOR
| XNOR
;
bitwise_ops : BIT_AND
| BIT_OR
| BIT_XOR
| BIT_LSHIFT
| BIT_RSHIFT
;
symbol_id : IDENTIFIER;
restric_id : IDENTIFIER;
value_id : bool |string | char | decimal | integer | symbol_id;
bool : 'true' | 'false';
decimal : '-'?DECIMAL;
integer : '-'?INTEGER;
string : STRINGLIT;
char : '\'' ALPHA '\'';
/*
* Lexer Rules
*/
//arithmetic operators
SET : '=';
ADD : '+';
SUBTRACT : '-';
MULTIPLY : '*';
DIVIDE : '/';
EXPONENT : '**';
MODULO : '%' ;
SET_SUM : '+=';
SET_DIFFERENCE : '-=';
SET_PRODUCT : '*=';
SET_QUOTIENT : '/=';
SET_REMAINDER : '%=';
INCREMENT : '++';
DECRIMENT : '--';
SET_AND : '&=';
SET_OR : '|=';
SET_XOR : '^=';
//logic operators
AND : '&&';
NAND : '!&';
OR : '||';
NOR : '!|';
XOR : '|||';
XNOR : '!||';
NOT : '!';
//bitwise operators
BIT_AND : '&';
BIT_OR : '|';
BIT_INVERT : '~';
BIT_LSHIFT : '<<';
BIT_RSHIFT : '>>';
BIT_XOR : '^';
//comparison operators
LESS_THAN : '<';
GREATER_THAN : '>';
LESS_OR_EQUAL : '<=';
GREATER_OR_EQUAL: '>=';
EQUAL_TO : '==';
NOT_EQUAL : '!=';
//other
LIST : ',';
fragment LOWERCASE : [a-z] ;
fragment UPPERCASE : [A-Z] ;
fragment ALPHA : [a-zA-Z_];
fragment NEWLINE : '\r'?'\n';
//enclosures
L_BRACKET : '[';
R_BRACKET : ']';
L_PARANTH : '(';
R_PARANTH : ')';
L_BRACE : '{';
R_BRACE : '}';
ASSEMBLY : 'asm' | 'assembly';
//general identifiers
STRINGLIT : STRINGLITPART '"';
STRINGLITPART : '"' (~["\\\n] | '\\' (. | EOF))*;
INTEGER : [0-9];
DECIMAL : '-'?[0-9]+('.'[0-9])?;
IDENTIFIER : ALPHA+ (DECIMAL+)?;//[a-zA-Z_]([a-zA-Z_0-9])+;
SEMI : ';';
WS : [ \r\t\u000C\n]+ -> skip ;
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_1383.asm | ljhsiun2/medusa | 9 | 28198 | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x9ae1, %rbp
dec %r14
movw $0x6162, (%rbp)
sub %rax, %rax
lea addresses_normal_ht+0x1a081, %rsi
lea addresses_D_ht+0x1ae89, %rdi
nop
mfence
mov $46, %rcx
rep movsw
nop
nop
nop
xor %rdx, %rdx
lea addresses_D_ht+0x15ae1, %rsi
xor $2286, %r14
movl $0x61626364, (%rsi)
nop
nop
cmp %rsi, %rsi
lea addresses_D_ht+0x1aee1, %r14
nop
nop
nop
lfence
vmovups (%r14), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %rax
nop
nop
nop
nop
and $3456, %rdx
lea addresses_UC_ht+0x1c2e1, %rsi
nop
nop
nop
nop
nop
sub %r14, %r14
movb (%rsi), %al
nop
nop
nop
add $27946, %rcx
lea addresses_normal_ht+0x165a1, %rsi
lea addresses_A_ht+0x18d91, %rdi
nop
nop
nop
nop
and $63418, %r9
mov $72, %rcx
rep movsw
nop
nop
nop
cmp $22174, %r9
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r8
push %rax
push %rcx
push %rdx
// Load
lea addresses_RW+0x1d1c9, %rax
nop
nop
nop
nop
inc %r10
movups (%rax), %xmm6
vpextrq $0, %xmm6, %r8
dec %r11
// Store
lea addresses_RW+0x42e1, %r10
nop
dec %r11
mov $0x5152535455565758, %rax
movq %rax, %xmm4
movups %xmm4, (%r10)
nop
nop
nop
nop
nop
cmp %r8, %r8
// Faulty Load
lea addresses_RW+0x42e1, %r11
nop
nop
nop
nop
nop
xor %r12, %r12
movups (%r11), %xmm6
vpextrq $1, %xmm6, %r8
lea oracles, %rcx
and $0xff, %r8
shlq $12, %r8
mov (%rcx,%r8,1), %r8
pop %rdx
pop %rcx
pop %rax
pop %r8
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 3, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 2, 'same': True, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 10, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': 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
*/
|
_maps/Credits.asm | kodishmediacenter/msu-md-sonic | 9 | 28027 | ; ---------------------------------------------------------------------------
; Sprite mappings - "SONIC TEAM PRESENTS" and credits
; ---------------------------------------------------------------------------
Map_Cred_internal:
dc.w @staff-Map_Cred_internal
dc.w @gameplan-Map_Cred_internal
dc.w @program-Map_Cred_internal
dc.w @character-Map_Cred_internal
dc.w @design-Map_Cred_internal
dc.w @soundproduce-Map_Cred_internal
dc.w @soundprogram-Map_Cred_internal
dc.w @thanks-Map_Cred_internal
dc.w @presentedby-Map_Cred_internal
dc.w @tryagain-Map_Cred_internal
dc.w @sonicteam-Map_Cred_internal
@staff: dc.b $E ; SONIC TEAM STAFF
dc.b $F8, 5, 0, $2E, $88
dc.b $F8, 5, 0, $26, $98
dc.b $F8, 5, 0, $1A, $A8
dc.b $F8, 1, 0, $46, $B8
dc.b $F8, 5, 0, $1E, $C0
dc.b $F8, 5, 0, $3E, $D8
dc.b $F8, 5, 0, $E, $E8
dc.b $F8, 5, 0, 4, $F8
dc.b $F8, 9, 0, 8, 8
dc.b $F8, 5, 0, $2E, $28
dc.b $F8, 5, 0, $3E, $38
dc.b $F8, 5, 0, 4, $48
dc.b $F8, 5, 0, $5C, $58
dc.b $F8, 5, 0, $5C, $68
@gameplan: dc.b $10 ; GAME PLAN CAROL YAS
dc.b $D8, 5, 0, 0, $80
dc.b $D8, 5, 0, 4, $90
dc.b $D8, 9, 0, 8, $A0
dc.b $D8, 5, 0, $E, $B4
dc.b $D8, 5, 0, $12, $D0
dc.b $D8, 5, 0, $16, $E0
dc.b $D8, 5, 0, 4, $F0
dc.b $D8, 5, 0, $1A, 0
dc.b 8, 5, 0, $1E, $C8
dc.b 8, 5, 0, 4, $D8
dc.b 8, 5, 0, $22, $E8
dc.b 8, 5, 0, $26, $F8
dc.b 8, 5, 0, $16, 8
dc.b 8, 5, 0, $2A, $20
dc.b 8, 5, 0, 4, $30
dc.b 8, 5, 0, $2E, $44
@program: dc.b $A ; PROGRAM YU 2
dc.b $D8, 5, 0, $12, $80
dc.b $D8, 5, 0, $22, $90
dc.b $D8, 5, 0, $26, $A0
dc.b $D8, 5, 0, 0, $B0
dc.b $D8, 5, 0, $22, $C0
dc.b $D8, 5, 0, 4, $D0
dc.b $D8, 9, 0, 8, $E0
dc.b 8, 5, 0, $2A, $E8
dc.b 8, 5, 0, $32, $F8
dc.b 8, 5, 0, $36, 8
@character: dc.b $18 ; CHARACTER DESIGN BIGISLAND
dc.b $D8, 5, 0, $1E, $88
dc.b $D8, 5, 0, $3A, $98
dc.b $D8, 5, 0, 4, $A8
dc.b $D8, 5, 0, $22, $B8
dc.b $D8, 5, 0, 4, $C8
dc.b $D8, 5, 0, $1E, $D8
dc.b $D8, 5, 0, $3E, $E8
dc.b $D8, 5, 0, $E, $F8
dc.b $D8, 5, 0, $22, 8
dc.b $D8, 5, 0, $42, $20
dc.b $D8, 5, 0, $E, $30
dc.b $D8, 5, 0, $2E, $40
dc.b $D8, 1, 0, $46, $50
dc.b $D8, 5, 0, 0, $58
dc.b $D8, 5, 0, $1A, $68
dc.b 8, 5, 0, $48, $C0
dc.b 8, 1, 0, $46, $D0
dc.b 8, 5, 0, 0, $D8
dc.b 8, 1, 0, $46, $E8
dc.b 8, 5, 0, $2E, $F0
dc.b 8, 5, 0, $16, 0
dc.b 8, 5, 0, 4, $10
dc.b 8, 5, 0, $1A, $20
dc.b 8, 5, 0, $42, $30
@design: dc.b $14 ; DESIGN JINYA <NAME>
dc.b $D0, 5, 0, $42, $A0
dc.b $D0, 5, 0, $E, $B0
dc.b $D0, 5, 0, $2E, $C0
dc.b $D0, 1, 0, $46, $D0
dc.b $D0, 5, 0, 0, $D8
dc.b $D0, 5, 0, $1A, $E8
dc.b 0, 5, 0, $4C, $E8
dc.b 0, 1, 0, $46, $F8
dc.b 0, 5, 0, $1A, 4
dc.b 0, 5, 0, $2A, $14
dc.b 0, 5, 0, 4, $24
dc.b $20, 5, 0, $12, $D0
dc.b $20, 5, 0, $3A, $E0
dc.b $20, 5, 0, $E, $F0
dc.b $20, 5, 0, $1A, 0
dc.b $20, 1, 0, $46, $10
dc.b $20, 5, 0, $50, $18
dc.b $20, 5, 0, $22, $30
dc.b $20, 1, 0, $46, $40
dc.b $20, 5, 0, $E, $48
@soundproduce: dc.b $1A ; SOUND PRODUCE MASATO NAKAMURA
dc.b $D8, 5, 0, $2E, $98
dc.b $D8, 5, 0, $26, $A8
dc.b $D8, 5, 0, $32, $B8
dc.b $D8, 5, 0, $1A, $C8
dc.b $D8, 5, 0, $54, $D8
dc.b $D8, 5, 0, $12, $F8
dc.b $D8, 5, 0, $22, 8
dc.b $D8, 5, 0, $26, $18
dc.b $D8, 5, 0, $42, $28
dc.b $D8, 5, 0, $32, $38
dc.b $D8, 5, 0, $1E, $48
dc.b $D8, 5, 0, $E, $58
dc.b 8, 9, 0, 8, $88
dc.b 8, 5, 0, 4, $9C
dc.b 8, 5, 0, $2E, $AC
dc.b 8, 5, 0, 4, $BC
dc.b 8, 5, 0, $3E, $CC
dc.b 8, 5, 0, $26, $DC
dc.b 8, 5, 0, $1A, $F8
dc.b 8, 5, 0, 4, 8
dc.b 8, 5, 0, $58, $18
dc.b 8, 5, 0, 4, $28
dc.b 8, 9, 0, 8, $38
dc.b 8, 5, 0, $32, $4C
dc.b 8, 5, 0, $22, $5C
dc.b 8, 5, 0, 4, $6C
@soundprogram: dc.b $17 ; SOUND PROGRAM JIMITA MACKY
dc.b $D0, 5, 0, $2E, $98
dc.b $D0, 5, 0, $26, $A8
dc.b $D0, 5, 0, $32, $B8
dc.b $D0, 5, 0, $1A, $C8
dc.b $D0, 5, 0, $54, $D8
dc.b $D0, 5, 0, $12, $F8
dc.b $D0, 5, 0, $22, 8
dc.b $D0, 5, 0, $26, $18
dc.b $D0, 5, 0, 0, $28
dc.b $D0, 5, 0, $22, $38
dc.b $D0, 5, 0, 4, $48
dc.b $D0, 9, 0, 8, $58
dc.b 0, 5, 0, $4C, $D0
dc.b 0, 1, 0, $46, $E0
dc.b 0, 9, 0, 8, $E8
dc.b 0, 1, 0, $46, $FC
dc.b 0, 5, 0, $3E, 4
dc.b 0, 5, 0, 4, $14
dc.b $20, 9, 0, 8, $D0
dc.b $20, 5, 0, 4, $E4
dc.b $20, 5, 0, $1E, $F4
dc.b $20, 5, 0, $58, 4
dc.b $20, 5, 0, $2A, $14
@thanks: dc.b $1F ; SPECIAL THANKS FUJIO <NAME>
dc.b $D8, 5, 0, $2E, $80
dc.b $D8, 5, 0, $12, $90
dc.b $D8, 5, 0, $E, $A0
dc.b $D8, 5, 0, $1E, $B0
dc.b $D8, 1, 0, $46, $C0
dc.b $D8, 5, 0, 4, $C8
dc.b $D8, 5, 0, $16, $D8
dc.b $D8, 5, 0, $3E, $F8
dc.b $D8, 5, 0, $3A, 8
dc.b $D8, 5, 0, 4, $18
dc.b $D8, 5, 0, $1A, $28
dc.b $D8, 5, 0, $58, $38
dc.b $D8, 5, 0, $2E, $48
dc.b 0, 5, 0, $5C, $B0
dc.b 0, 5, 0, $32, $C0
dc.b 0, 5, 0, $4C, $D0
dc.b 0, 1, 0, $46, $E0
dc.b 0, 5, 0, $26, $E8
dc.b 0, 9, 0, 8, 0
dc.b 0, 1, 0, $46, $14
dc.b 0, 5, 0, $1A, $1C
dc.b 0, 5, 0, $E, $2C
dc.b 0, 5, 0, 0, $3C
dc.b 0, 1, 0, $46, $4C
dc.b 0, 5, 0, $2E, $54
dc.b 0, 5, 0, $3A, $64
dc.b 0, 1, 0, $46, $74
dc.b $20, 5, 0, $12, $F8
dc.b $20, 5, 0, 4, 8
dc.b $20, 5, 0, $12, $18
dc.b $20, 5, 0, 4, $28
@presentedby: dc.b $F ; PRESENTED BY SEGA
dc.b $F8, 5, 0, $12, $80
dc.b $F8, 5, 0, $22, $90
dc.b $F8, 5, 0, $E, $A0
dc.b $F8, 5, 0, $2E, $B0
dc.b $F8, 5, 0, $E, $C0
dc.b $F8, 5, 0, $1A, $D0
dc.b $F8, 5, 0, $3E, $E0
dc.b $F8, 5, 0, $E, $F0
dc.b $F8, 5, 0, $42, 0
dc.b $F8, 5, 0, $48, $18
dc.b $F8, 5, 0, $2A, $28
dc.b $F8, 5, 0, $2E, $40
dc.b $F8, 5, 0, $E, $50
dc.b $F8, 5, 0, 0, $60
dc.b $F8, 5, 0, 4, $70
@tryagain: dc.b 8 ; TRY AGAIN
dc.b $30, 5, 0, $3E, $C0
dc.b $30, 5, 0, $22, $D0
dc.b $30, 5, 0, $2A, $E0
dc.b $30, 5, 0, 4, $F8
dc.b $30, 5, 0, 0, 8
dc.b $30, 5, 0, 4, $18
dc.b $30, 1, 0, $46, $28
dc.b $30, 5, 0, $1A, $30
@sonicteam: dc.b $11 ; SONIC TEAM PRESENTS
dc.b $E8, 5, 0, $2E, $B4
dc.b $E8, 5, 0, $26, $C4
dc.b $E8, 5, 0, $1A, $D4
dc.b $E8, 1, 0, $46, $E4
dc.b $E8, 5, 0, $1E, $EC
dc.b $E8, 5, 0, $3E, 4
dc.b $E8, 5, 0, $E, $14
dc.b $E8, 5, 0, 4, $24
dc.b $E8, 9, 0, 8, $34
dc.b 0, 5, 0, $12, $C0
dc.b 0, 5, 0, $22, $D0
dc.b 0, 5, 0, $E, $E0
dc.b 0, 5, 0, $2E, $F0
dc.b 0, 5, 0, $E, 0
dc.b 0, 5, 0, $1A, $10
dc.b 0, 5, 0, $3E, $20
dc.b 0, 5, 0, $2E, $30
even |
a-stunau.ads | ytomino/gnat4drake | 0 | 9694 | <gh_stars>0
pragma License (Unrestricted);
package Ada.Strings.Unbounded.Aux is
pragma Preelaborate;
subtype Big_String is String (1 .. Positive'Last);
type Big_String_Access is access all Big_String;
for Big_String_Access'Storage_Size use 0;
procedure Get_String (
U : Unbounded_String;
S : out Big_String_Access;
L : out Natural);
end Ada.Strings.Unbounded.Aux;
|
oeis/162/A162897.asm | neoneye/loda-programs | 11 | 97441 | <gh_stars>10-100
; A162897: a(1)=a(2)=2. a(n) = the smallest integer >= 2 such that a(n-1)^a(n) > a(n-2)^a(n-1).
; 2,2,3,2,4,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33,34,34,35,35,36,36,37,37,38
mov $2,$0
lpb $0
gcd $0,2
mul $0,2
sub $2,2
lpe
div $2,2
mov $0,$2
add $0,2
|
Tests/mathslogs.asm | TinfoilAsteroid/EliteNext | 9 | 96167 | <reponame>TinfoilAsteroid/EliteNext
DEVICE ZXSPECTRUMNEXT
DEFINE DOUBLEBUFFER 1
CSPECTMAP mathslogs.map
OPT --zxnext=cspect --syntax=a --reversepop
INCLUDE "../Macros/carryFlagMacros.asm"
INCLUDE "../Macros/jumpMacros.asm"
INCLUDE "../Macros/ldCopyMacros.asm"
INCLUDE "../Macros/ShiftMacros.asm"
INCLUDE "../Macros/NegateMacros.asm"
testStartup: ORG $8000
ld ix, TestCase1
.TestLoop: ld a,(testCounter)
ld hl, testTotal
cp (hl)
jr z,.Done1
ld a,(ix+testCase.QVal)
ld b,a
ld a,(ix+testCase.AVal)
JumpIfALTNusng 197, .LTCalc
.GTCalc: ld e,a
call AEquAmul256Div197Log
ld (ix+testCase.Result),a
xor a
ld (ix+testCase.Expected),a
jp .NextIteration
.LTCalc: ld e,a
call AEquAmul256Div197LogLT
ld (ix+testCase.Expected),a
xor a
ld (ix+testCase.Result),a
.NextIteration: ld hl,testCounter
inc (hl)
push ix
pop hl
ld a,4
add hl,a
push hl
pop ix
jp .TestLoop
.Done1: ld ix, TestCase10
xor a
ld (testCounter),a
.TestLoop2: ld a,(testCounter)
ld hl, testTotal2
cp (hl)
jr z,.Done
ld a,(ix+testCase.QVal)
ld b,a
ld a,(ix+testCase.AVal)
JumpIfALTNusng b, .LTCalc2
.GTCalc2: ld e,a
call AEquAmul256DivBLog
ld (ix+testCase.Result),a
xor a
ld (ix+testCase.Expected),a
jp .NextIteration2
.LTCalc2: ld e,a
call AEquAmul256DivBLogLT
ld (ix+testCase.Expected),a
xor a
ld (ix+testCase.Result),a
.NextIteration2: ld hl,testCounter
inc (hl)
push ix
pop hl
ld a,4
add hl,a
push hl
pop ix
jp .TestLoop2
.Done break
jp .Done ; complete tight loop
INCLUDE "../Variables/constant_equates.asm"
INCLUDE "../Hardware/L2ColourDefines.asm"
INCLUDE "../Variables/general_variables_macros.asm"
INCLUDE "../Maths/multiply.asm"
INCLUDE "../Variables/general_variables.asm"
INCLUDE "../Maths/logmaths.asm"
INCLUDE "../Tables/antilogtable.asm"
INCLUDE "../Tables/logtable.asm"
STRUCT testCase
AVal BYTE 1
QVal BYTE 2
Result BYTE 3
Expected BYTE 4
ENDS
; 01 02 03 04
TestCase1 DB $05, 197, $FF, $FF
TestCase2 DB $06, 197, $FF, $FF
TestCase3 DB $A5, 197, $FF, $FF
TestCase4 DB $C5, 197, $FF, $FF
TestCase5 DB $65, 197, $FF, $FF
TestCase6 DB $8A, 197, $FF, $FF
TestCase7 DB $AC, 197, $FF, $FF
TestCase8 DB $85, 197, $FF, $FF
TestCase9 DB $09, 197, $FF, $FF
TestCase10 DB $01, 197, $FF, $FF
TestCase12 DB $05, $01, $FF, $FF
TestCase13 DB $05, $A3, $FF, $FF
TestCase14 DB $A5, $83, $FF, $FF
TestCase15 DB $05, $03, $FF, $FF
TestCase16 DB $05, $00, $FF, $FF
TestCase17 DB $0A, $80, $FF, $FF
TestCase18 DB $05, $80, $FF, $FF
TestCase19 DB $85, $83, $FF, $FF
TestCase20 DB $05, $83, $FF, $FF
TestCase21 DB $05, $03, $FF, $FF
testTotal DB ($-TestCase10)/4
testTotal2 DB ($-TestCase10)/4
testCounter DB 0
SAVENEX OPEN "mathslogs.nex", $8000 , $7F00
SAVENEX CFG 0,0,0,1
SAVENEX AUTO
SAVENEX CLOSE
|
test/Succeed/Issue5891DataOfPiSort.agda | KDr2/agda | 0 | 4293 | <gh_stars>0
-- AIM XXXV, 2022-05-06, issue #5891.
-- When checking that the sort of a data type admits data definitions
-- (checkDataSort), we need to handle the case of PiSort.
mutual
Univ1 = _
Univ2 = _
Univ3 = _
postulate
A1 : Univ1
A2 : Univ2
A : Univ3
A = A1 → A2
-- This demonstrates that the sort of a data types can be a PiSort
-- (temporarily, until further information becomes available later):
data Empty : Univ3 where
_ : Univ1
_ = Set
_ : Univ2
_ = Set
-- Should succeed.
|
Extract.agda | ashinkarov/agda-extractor | 1 | 4522 | open import Structures --using (KS; SKS; ks; TCS; Prog; monadTC; _⊕_; Err; ok; error; list-has-el; lift-state; lift-mstate)
open import Reflection as RE hiding (return; _>>=_; _>>_)
open import Reflection.Show
module Extract (kompile-fun : Type → Term → Name → SKS Prog) where
open import Reflection.Term
import Reflection.Name as RN
open import Agda.Builtin.Reflection using (withReconstructed; dontReduceDefs; onlyReduceDefs)
open import Data.List as L hiding (_++_)
open import Data.Unit using (⊤)
open import Data.Product
open import Data.Bool
open import Data.String as S hiding (_++_)
open import Data.Maybe as M hiding (_>>=_)
open import Function --using (_$_; case_of_)
open import ReflHelper
open import Category.Monad using (RawMonad)
open import Category.Monad.State using (StateTMonadState; RawMonadState)
open RawMonad {{...}} public
{-# TERMINATING #-}
kompile-fold : TCS Prog
macro
-- Main entry point of the extractor.
-- `n` is a starting function of the extraction
-- `base` is the set of base functions that we never traverse into.
-- `skip` is the list of functions that we have traversed already.
-- The difference between the two is that `base` would be passed to
-- `dontReduceDefs`, hence never inlined; whereas `skip` mainly avoids
-- potential recursive extraction.
kompile : Name → Names → Names → Term → TC ⊤
kompile n base skip hole = do
(p , st) ← kompile-fold $ ks [ n ] base skip ε 1
--let p = KS.defs st ⊕ p
q ← quoteTC p
unify hole q
-- Traverse through the list of the functions we need to extract
-- and collect all the definitions.
kompile-fold = do
s@(ks fs ba done _ c) ← R.get
case fs of λ where
[] → return ε
(f ∷ fs) → case list-has-el (f RN.≟_) done of λ where
true → do
R.modify λ k → record k{ funs = fs }
kompile-fold
false → do
(ty , te) ← lift-state {RM = monadTC} $ do
ty ← getType f
ty ← withReconstructed $ dontReduceDefs ba $ normalise ty
te ← withReconstructed $ getDefinition f >>= λ where
(function cs) → return $ pat-lam cs []
-- FIXME: currently we do not extract data types, which
-- we should fix by parametrising this module by
-- kompile-type argument, and calling it in the
-- same way as we call kompile-fun now.
--(data-cons d) → return $ con d []
_ → return unknown
te ← pat-lam-norm te ba
return $ ty , te
case te of λ where
unknown →
return $ error $ "kompile: attempting to compile `" ++ showName f ++ "` as function"
_ → do
R.put (ks fs ba (f ∷ done) ε c)
-- Compile the function and make an error more specific in
-- case compilation fails.
(ok q) ← lift-mstate {RM = monadTC} $ kompile-fun ty te f
where (error x) → return $ error $ "in function " ++ showName f ++ ": " ++ x
defs ← KS.defs <$> R.get
let q = defs ⊕ q
--R.modify $! λ k → record k{ defs = ε }
kst ← R.get
--let q = KS.defs kst ⊕ q
R.put $! record kst{ defs = ε }
-- Do the rest of the functions
p ← kompile-fold
return $! p ⊕ "\n\n" ⊕ q
where
module R = RawMonadState (StateTMonadState KS monadTC)
|
src/portscan.ads | kraileth/ravenadm | 18 | 5372 | -- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
-- GCC 6.0 only
-- pragma Suppress (Tampering_Check);
with Definitions; use Definitions;
with HelperText;
with Ada.Text_IO;
private with Ada.Containers.Hashed_Maps;
private with Ada.Containers.Ordered_Sets;
private with Ada.Containers.Vectors;
package PortScan is
package TIO renames Ada.Text_IO;
package HT renames HelperText;
scan_log_error : exception;
type count_type is (total, success, failure, ignored, skipped);
type port_id is private;
type sysroot_characteristics is
record
major : HT.Text;
release : HT.Text;
version : HT.Text;
arch : supported_arch;
end record;
-- Wipe out all scan data so new scan can be performed
procedure reset_ports_tree;
-- Sometimes there is nothing left to do after the sanity check. Let's provide a way to
-- detect that case.
function queue_is_empty return Boolean;
-- Returns the size of the queue before it was pared down.
function original_queue_size return Natural;
-- Returns the current queue size
function queue_length return Integer;
-- Return the length of the original build request
function build_request_length return Integer;
-- Given a port ID, attempt to display the portkey
function get_port_variant (id : port_id) return String;
-- Given a port ID, attempt to display the "ignore" reason
function ignore_reason (id : port_id) return String;
-- Returns true if the given ID is valid (e.g. not port_match_failed)
function valid_port_id (id : port_id) return Boolean;
-- Given a port ID, attempt to return 2-character bucket
function get_bucket (id : port_id) return String;
-- Given an ID and specifying a subpackage, this function returns the package file name.
function calculate_package_name (id : port_id; subpackage : String) return String;
-- Takes origin tuplet (namebase:subpkg:variant) and returns namebase:variant
function convert_depend_origin_to_portkey (origin : String) return String;
-- Takes origin tuplet (namebase-subpkg-variant-version.tzst) and returns subpkg
function subpackage_from_pkgname (pkgname : String) return String;
-- Insert unique NV pair into portlist and dupelist.
procedure insert_into_portlist (port_variant : String);
-- Checks all_ports (id) and returns value of use_procfs
function requires_procfs (id : port_id) return Boolean;
-- Given an index, returns a buildsheet location wrt unkindness
function get_buildsheet_from_origin_list (index : Positive) return String;
-- Returns true if ports binutils (binutils:ravensys) is present in stored origins
-- The pkg version also has to match $binutilsversion
function jail_port_binutils_specified return Boolean;
-- Returns true if ports compiler (gcc9:standard) is present in stored origins
-- The pkg version also has to match $compiler_version
function jail_port_compiler_specified return Boolean;
private
package CON renames Ada.Containers;
max_ports : constant := 8000;
type port_id is range -1 .. max_ports - 1;
subtype port_index is port_id range 0 .. port_id'Last;
port_match_failed : constant port_id := port_id'First;
subtype bucket_code is String (1 .. 2);
pkgng_execution : exception;
circular_logic : exception;
seek_failure : exception;
unknown_format : exception;
type queue_record is
record
ap_index : port_index;
reverse_score : port_index;
end record;
-- Functions for ranking_crate definitions
function "<" (L, R : queue_record) return Boolean;
-- Functions for portkey_crate and package_crate definitions
function port_hash (key : HT.Text) return CON.Hash_Type;
-- Functions for block_crate definitions
function block_hash (key : port_index) return CON.Hash_Type;
function block_ekey (left, right : port_index) return Boolean;
package subqueue is new CON.Vectors
(Element_Type => port_index,
Index_Type => port_index);
package string_crate is new CON.Vectors
(Element_Type => HT.Text,
Index_Type => port_index,
"=" => HT.SU."=");
package sorter is new string_crate.Generic_Sorting ("<" => HT.SU."<");
package ranking_crate is new CON.Ordered_Sets
(Element_Type => queue_record);
package portkey_crate is new CON.Hashed_Maps
(Key_Type => HT.Text,
Element_Type => port_index,
Hash => port_hash,
Equivalent_Keys => HT.equivalent);
package package_crate is new CON.Hashed_Maps
(Key_Type => HT.Text,
Element_Type => Boolean,
Hash => port_hash,
Equivalent_Keys => HT.equivalent);
package block_crate is new CON.Hashed_Maps
(Key_Type => port_index,
Element_Type => port_index,
Hash => block_hash,
Equivalent_Keys => block_ekey);
type subpackage_identifier is
record
port : port_index;
subpackage : HT.Text;
end record;
package spkg_id_crate is new CON.Vectors
(Element_Type => subpackage_identifier,
Index_Type => Positive);
type subpackage_record is
record
subpackage : HT.Text := HT.blank;
pkg_dep_query : HT.Text := HT.blank;
pkg_present : Boolean := False;
remote_pkg : Boolean := False;
never_remote : Boolean := False;
deletion_due : Boolean := False;
spkg_run_deps : spkg_id_crate.Vector;
end record;
package subpackage_crate is new CON.Vectors
(Element_Type => subpackage_record,
Index_Type => Positive);
type port_record is
record
sequence_id : port_index := 0;
key_cursor : portkey_crate.Cursor := portkey_crate.No_Element;
ignore_reason : HT.Text := HT.blank;
pkgversion : HT.Text := HT.blank;
port_variant : HT.Text := HT.blank;
port_namebase : HT.Text := HT.blank;
bucket : bucket_code := "00";
unkind_custom : Boolean := False;
ignored : Boolean := False;
scanned : Boolean := False;
rev_scanned : Boolean := False;
unlist_failed : Boolean := False;
work_locked : Boolean := False;
scan_locked : Boolean := False;
use_procfs : Boolean := False;
reverse_score : port_index := 0;
run_deps : block_crate.Map;
blocked_by : block_crate.Map;
blocks : block_crate.Map;
all_reverse : block_crate.Map;
options : package_crate.Map;
subpackages : subpackage_crate.Vector;
end record;
type dim_make_queue is array (scanners) of subqueue.Vector;
type dim_progress is array (scanners) of port_index;
type dim_all_ports is array (port_index) of port_record;
all_ports : dim_all_ports;
ports_keys : portkey_crate.Map;
make_queue : dim_make_queue;
mq_progress : dim_progress := (others => 0);
rank_queue : ranking_crate.Set;
last_port : port_index := 0;
lot_number : scanners := 1;
lot_counter : port_index := 0;
prescanned : Boolean := False;
log_list : string_crate.Vector;
portlist : string_crate.Vector;
dupelist : string_crate.Vector;
package_list : string_crate.Vector;
distfile_set : portkey_crate.Map;
original_queue_len : CON.Count_Type;
discerr : constant String := "Discovery error";
function get_port_variant (PR : port_record) return String;
function scan_progress return String;
procedure wipe_make_queue;
procedure dump_stack (media : TIO.File_Type);
end PortScan;
|
programs/oeis/181/A181923.asm | jmorken/loda | 1 | 161227 | ; A181923: Nonprimes (A018252) mod 2.
; 1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,0
cal $0,18252 ; The nonprime numbers: 1 together with the composite numbers, A002808.
mod $0,2
mov $1,$0
|
data/pokemon/base_stats/hitmonlee.asm | AtmaBuster/pokeplat-gen2 | 6 | 6645 | <reponame>AtmaBuster/pokeplat-gen2
db 0 ; species ID placeholder
db 50, 120, 53, 87, 35, 110
; hp atk def spd sat sdf
db FIGHTING, FIGHTING ; type
db 45 ; catch rate
db 139 ; base exp
db NO_ITEM, NO_ITEM ; items
db GENDER_F0 ; gender ratio
db 25 ; step cycles to hatch
INCBIN "gfx/pokemon/hitmonlee/front.dimensions"
db GROWTH_MEDIUM_FAST ; growth rate
dn EGG_HUMANSHAPE, EGG_HUMANSHAPE ; egg groups
db 70 ; happiness
; tm/hm learnset
tmhm FOCUS_PUNCH, TOXIC, BULK_UP, HIDDEN_POWER, SUNNY_DAY, PROTECT, RAIN_DANCE, FRUSTRATION, EARTHQUAKE, RETURN, BRICK_BREAK, DOUBLE_TEAM, ROCK_TOMB, FACADE, SECRET_POWER, REST, ATTRACT, THIEF, FOCUS_BLAST, FLING, ENDURE, STONE_EDGE, CAPTIVATE, ROCK_SLIDE, SLEEP_TALK, NATURAL_GIFT, POISON_JAB, SWAGGER, SUBSTITUTE, STRENGTH, ROCK_SMASH, ROCK_CLIMB, BOUNCE, HELPING_HAND, KNOCK_OFF, MUD_SLAP, SNORE, SUCKER_PUNCH, SUPERPOWER, SWIFT, VACUUM_WAVE
; end
|
src/skill-streams-reader.ads | skill-lang/adaCommon | 0 | 30688 | -- ___ _ ___ _ _ --
-- / __| |/ (_) | | Common SKilL implementation --
-- \__ \ ' <| | | |__ stream to skill tokens --
-- |___/_|\_\_|_|____| by: <NAME>, <NAME> --
-- --
pragma Ada_2012;
with Interfaces.C;
with Interfaces.C.Pointers;
with Interfaces.C.Strings;
with Interfaces.C_Streams;
with Skill.Types;
with Ada.Exceptions;
package Skill.Streams.Reader is
type Abstract_Stream is tagged private;
type Stream is access all Abstract_Stream'Class;
type Input_Stream_T is new Abstract_Stream with private;
type Input_Stream is not null access Skill.Streams.Reader.Input_Stream_T;
type Sub_Stream_T is new Abstract_Stream with private;
type Sub_Stream is access Sub_Stream_T;
-- type cast
function To (This : access Abstract_Stream'Class) return Stream is
(Stream(This));
-- note an empty stream will be created if path is null
function Open (Path : Skill.Types.String_Access) return Input_Stream;
-- creates a sub map
function Map
(This : access Input_Stream_T;
Base : Types.v64;
First : Types.v64;
Last : Types.v64) return Sub_Stream;
function Empty_Sub_Stream return Sub_Stream;
-- destroy a map and close the file
procedure Close (This : access Input_Stream_T);
-- destroy a sub map
procedure Free (This : access Sub_Stream_T);
function Path
(This : access Input_Stream_T) return Skill.Types.String_Access;
function Eof (This : access Abstract_Stream'Class) return Boolean;
function Position
(This : access Abstract_Stream'Class) return Skill.Types.v64;
-- checks validity of argument position for this stream,
-- if invalid, raise constraint error
procedure Check_Offset
(This : access Abstract_Stream'Class;
Pos : Skill.Types.v64);
procedure Jump (This : access Abstract_Stream'Class; Pos : Skill.Types.v64);
function I8 (This : access Abstract_Stream'Class) return Skill.Types.i8;
pragma Inline (I8);
use type Interfaces.Integer_8;
function Bool
(This : access Abstract_Stream'Class) return Boolean is
(This.I8 /= 0);
pragma Inline (Bool);
function I16 (This : access Abstract_Stream'Class) return Skill.Types.i16;
pragma Inline (I16);
function I32 (This : access Abstract_Stream'Class) return Skill.Types.i32;
pragma Inline (I32);
function I64 (This : access Abstract_Stream'Class) return Skill.Types.i64;
pragma Inline (I64);
function F32 (This : access Abstract_Stream'Class) return Skill.Types.F32;
pragma Inline (F32);
function F64 (This : access Abstract_Stream'Class) return Skill.Types.F64;
pragma Inline (F64);
function V64 (This : access Abstract_Stream'Class) return Skill.Types.v64;
-- wont happen, simply too large
pragma Inline (V64);
function Parse_Exception
(This : access Input_Stream_T;
Block_Counter : Positive;
Cause : in Ada.Exceptions.Exception_Occurrence;
Message : String) return String;
function Parse_Exception
(This : access Input_Stream_T;
Block_Counter : Positive;
Message : String) return String;
private
package C renames Interfaces.C;
-- returns an invalid map pointer, that can be used in empty maps
function Invalid_Pointer return Map_Pointer;
pragma Inline (Invalid_Pointer);
-- mmap_c_array mmap_open (char const * filename)
function MMap_Open (Path : Interfaces.C.Strings.chars_ptr) return Mmap;
pragma Import (C, MMap_Open, "mmap_read");
-- void mmap_close(FILE *stream)
procedure MMap_Close (File : Interfaces.C_Streams.FILEs);
pragma Import (C, MMap_Close, "mmap_close");
type Abstract_Stream is tagged record
-- current position
Map : Map_Pointer;
-- first position
Base : Map_Pointer;
-- last position
EOF : Map_Pointer;
end record;
type Input_Stream_T is new Abstract_Stream with record
Path : Skill.Types.String_Access; -- shared string!
File : Interfaces.C_Streams.FILEs;
end record;
-- a part that is a sub section of an input stream
type Sub_Stream_T is new Abstract_Stream with null record;
end Skill.Streams.Reader;
|
CPU/cpu_test/test_storage/ov.asm | SilenceX12138/MIPS-Microsystems | 55 | 16307 | <reponame>SilenceX12138/MIPS-Microsystems
.text 0x4180
li $t1,0
eret
.text 0x3000
li $t1,0x7fffffff
li $t2,0x7fffffff
add $t3,$t2,$t1
mult $t1,$t2
mflo $3
addi $3,$3,1
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48.log_21829_2563.asm | ljhsiun2/medusa | 9 | 21143 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x113c6, %rsi
lea addresses_normal_ht+0xdbe6, %rdi
clflush (%rdi)
nop
nop
nop
nop
xor %r11, %r11
mov $34, %rcx
rep movsq
nop
nop
nop
sub $57713, %rsi
lea addresses_A_ht+0x3be6, %rsi
nop
nop
nop
nop
add %r11, %r11
mov (%rsi), %rbp
nop
and %rbp, %rbp
lea addresses_UC_ht+0x18be6, %rsi
lea addresses_WT_ht+0x13e6, %rdi
clflush (%rsi)
sub %r9, %r9
mov $84, %rcx
rep movsl
nop
nop
nop
nop
xor $32577, %rcx
lea addresses_A_ht+0x9816, %r11
add %r10, %r10
mov $0x6162636465666768, %rdi
movq %rdi, (%r11)
nop
nop
add $54387, %r9
lea addresses_A_ht+0x1b5e6, %rsi
lea addresses_normal_ht+0x47e6, %rdi
nop
inc %rbx
mov $38, %rcx
rep movsw
nop
nop
nop
nop
lfence
lea addresses_WC_ht+0x1492a, %rsi
lea addresses_A_ht+0x3a66, %rdi
clflush (%rdi)
nop
dec %r9
mov $12, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp $60548, %rbp
lea addresses_WC_ht+0x136f6, %rcx
nop
nop
nop
nop
inc %rdi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm2
and $0xffffffffffffffc0, %rcx
vmovaps %ymm2, (%rcx)
nop
cmp $35254, %rdi
lea addresses_normal_ht+0xe3e6, %rbp
nop
nop
nop
nop
sub %r9, %r9
mov $0x6162636465666768, %rbx
movq %rbx, %xmm1
vmovups %ymm1, (%rbp)
cmp $15951, %r11
lea addresses_UC_ht+0x1eaae, %rdi
nop
nop
nop
nop
nop
and %rbx, %rbx
mov $0x6162636465666768, %rcx
movq %rcx, %xmm1
movups %xmm1, (%rdi)
nop
nop
nop
add %r9, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r8
push %r9
push %rax
push %rcx
push %rdx
push %rsi
// Store
lea addresses_A+0x18266, %r8
nop
nop
nop
nop
nop
and $39181, %r14
mov $0x5152535455565758, %rsi
movq %rsi, %xmm3
movups %xmm3, (%r8)
inc %r9
// Store
lea addresses_WT+0x18ea6, %r9
nop
nop
nop
and %rcx, %rcx
mov $0x5152535455565758, %r14
movq %r14, (%r9)
nop
nop
nop
nop
inc %rdx
// Store
lea addresses_WC+0x72cd, %rdx
sub %rax, %rax
movw $0x5152, (%rdx)
nop
nop
nop
sub %r9, %r9
// Faulty Load
lea addresses_US+0x123e6, %rax
nop
nop
nop
nop
xor $45849, %rcx
mov (%rax), %r14d
lea oracles, %rcx
and $0xff, %r14
shlq $12, %r14
mov (%rcx,%r14,1), %r14
pop %rsi
pop %rdx
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 6, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 2, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': True, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 10, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 3, 'size': 16, '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/directories/a-dirvol.ads | ytomino/drake | 33 | 17373 | <reponame>ytomino/drake
pragma License (Unrestricted);
-- extended unit
private with Ada.Finalization;
private with System.Native_Directories.Volumes;
package Ada.Directories.Volumes is
-- File system information.
type File_System is limited private;
-- subtype Assigned_File_System is File_System
-- with
-- Dynamic_Predicate => Is_Assigned (Assigned_File_System),
-- Predicate_Failure => raise Status_Error;
function Is_Assigned (FS : File_System) return Boolean;
function Where (Name : String) return File_System;
pragma Inline (Where); -- renamed
function Size (
FS : File_System) -- Assigned_File_System
return File_Size;
function Free_Space (
FS : File_System) -- Assigned_File_System
return File_Size;
function Owner (
FS : File_System) -- Assigned_File_System
return String;
function Format_Name (
FS : File_System) -- Assigned_File_System
return String;
function Directory (
FS : File_System) -- Assigned_File_System
return String; -- mounted to
function Device (
FS : File_System) -- Assigned_File_System
return String; -- mounted from
function Case_Preserving (
FS : File_System) -- Assigned_File_System
return Boolean;
function Case_Sensitive (
FS : File_System) -- Assigned_File_System
return Boolean;
function Is_HFS (
FS : File_System) -- Assigned_File_System
return Boolean;
type File_System_Id is private;
function Identity (
FS : File_System) -- Assigned_File_System
return File_System_Id;
private
package Controlled is
type File_System is limited private;
function Reference (Object : Volumes.File_System)
return not null
access System.Native_Directories.Volumes.File_System;
pragma Inline (Reference);
function Where (Name : String) return Volumes.File_System;
-- [gcc-7] strange error if this function is placed outside of
-- the package Controlled, and Disable_Controlled => True
private
type File_System is
limited new Finalization.Limited_Controlled with
record
Data : aliased System.Native_Directories.Volumes.File_System :=
(others => <>);
end record
with
Disable_Controlled =>
System.Native_Directories.Volumes.Disable_Controlled;
overriding procedure Finalize (Object : in out File_System);
end Controlled;
type File_System is new Controlled.File_System;
function Where (Name : String) return File_System
renames Controlled.Where;
type File_System_Id is new System.Native_Directories.Volumes.File_System_Id;
end Ada.Directories.Volumes;
|
oeis/332/A332757.asm | neoneye/loda-programs | 11 | 163382 | ; A332757: Number of involutions (plus identity) in the n-fold iterated wreath product of C_2.
; Submitted by <NAME>
; 1,2,6,44,2064,4292864,18430828806144,339695459704759501186924544,115393005344028056118476170527365821430429589033713664,13315545682326887517994506072805639054664915214679444711916992466809542959290217586307654871548759705124864
mul $0,2
mov $2,1
mov $3,1
lpb $0
sub $0,2
pow $2,2
add $2,$3
pow $3,2
mul $3,2
lpe
mov $0,$2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.