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 |
|---|---|---|---|---|
test/Fail/Issue4121-2.agda | shlevy/agda | 1,989 | 8471 | module _ where
module M where
data D : Set where
c : D
pattern c′ = c
open M hiding (c′)
x : D
x = c′
|
game/banks/chr_data.asm | benoitryder/super-tilt-bro | 0 | 247325 | <reponame>benoitryder/super-tilt-bro
* = $8000
; Reserved for characters tiles (no need for static initialization, game logic handles it)
.dsb CHARACTERS_END_TILES_OFFSET, 0
; Tiles moved elsewhere
;TODO move all other tiles in more appropriate locations
.dsb 27*16, 0
; TILE $7d - Blood particle
;
; 02000000
; 22200000
; 02000000
; 00000000
; 00000200
; 00002220
; 00000200
; 00000000
TILE_BLOOD_PARTICLE = (*-$8000)/16
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %01000000, %11100000, %01000000, %00000000, %00000100, %00001110, %00000100, %00000000
; TILE $7e - Explosion 1
;
; 00111100
; 01111110
; 11111111
; 11111111
; 11111111
; 11111111
; 01111110
; 00111100
TILE_EXPLOSION_1 = (*-$8000)/16
.byt %00111100, %01111110, %11111111, %11111111, %11111111, %11111111, %01111110, %00111100
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
; TILE $7f - Explosion 2
;
; 00000000
; 00000000
; 00330300
; 00003000
; 00033000
; 00303300
; 00000000
; 00000000
TILE_EXPLOSION_2 = (*-$8000)/16
.byt %00000000, %00000000, %00110100, %00001000, %00011000, %00101100, %00000000, %00000000
.byt %00000000, %00000000, %00110100, %00001000, %00011000, %00101100, %00000000, %00000000
; TILE $80 - Explosion 3
;
; 00200000
; 02300020
; 02300332
; 02000000
; 00000030
; 23000002
; 02330032
; 00220022
TILE_EXPLOSION_3 = (*-$8000)/16
.byt %00000000, %00100000, %00100110, %00000000, %00000010, %01000000, %00110010, %00000000
.byt %00100000, %01100010, %01100111, %01000000, %00000010, %11000001, %01110011, %00110011
; TILE $81 - Explosion 4
;
; 02000020
; 22220222
; 02000022
; 00000020
; 00000000
; 20000020
; 22000222
; 22200022
TILE_EXPLOSION_4 = (*-$8000)/16
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %01000010, %11110111, %01000011, %00000010, %00000000, %10000010, %11000111, %11100011
; TILE $82 - Explosion 5
;
; 02000020
; 20000202
; 00000002
; 00000000
; 00000000
; 00000020
; 20000002
; 22000022
TILE_EXPLOSION_5 = (*-$8000)/16
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %01000010, %10000101, %00000001, %00000000, %00000000, %00000010, %10000001, %11000011
; TILE $83 - Moving platform
;
; 33333333
; 33333333
; 00000000
; 00000000
; 00000000
; 00000000
; 00000000
; 00000000
TILE_MOVING_PLATFORM = (*-$8000)/16
.byt %11111111, %11111111, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %11111111, %11111111, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
; 5 tiles - Cloud
; Pattern
; 1 2
; 3 4 5
TILE_CLOUD_1 = (*-$8000)/16
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000001, %00000011, %00000111
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000001, %00000011
TILE_CLOUD_2 = (*-$8000)/16
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %11100000, %11110000, %11111000
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %11100000, %11110000
TILE_CLOUD_3 = (*-$8000)/16
.byt %00001111, %01111111, %11111111, %01111011, %11111111, %11111111, %01111000, %00110000
.byt %00000111, %00000111, %01110111, %11111111, %11111111, %11111111, %11111111, %01111000
TILE_CLOUD_4 = (*-$8000)/16
.byt %11111100, %11111101, %11111111, %11111111, %11111111, %11111111, %11100111, %01100000
.byt %11111000, %11111000, %11111101, %11111111, %11111111, %11111111, %11111111, %11100000
TILE_CLOUD_5 = (*-$8000)/16
.byt %01110000, %11111000, %11111000, %11111100, %11111100, %11111110, %11110110, %00000000
.byt %00000000, %01110000, %11110000, %11111000, %11111000, %11111100, %11111111, %11110100
; Unused
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
; TILES $8e to $91 - Music icon
TILE_ICON_MUSIC_1 = (*-$8000)/16
.byt %00000000, %00000000, %00011111, %00001100, %00001100, %00001111, %00011000, %00011000
.byt %11111111, %11111111, %11100000, %11110011, %11110011, %11110000, %11100111, %11100111
TILE_ICON_MUSIC_2 = (*-$8000)/16
.byt %00000000, %00000000, %11111000, %00011000, %11110000, %00110000, %00110000, %00110000
.byt %11111111, %11111111, %00000111, %11100111, %00001111, %11001111, %11001111, %11001111
TILE_ICON_MUSIC_3 = (*-$8000)/16
.byt %00011000, %00011000, %00011000, %00111100, %01111100, %01111100, %00111000, %00000000
.byt %11100111, %11100111, %11100111, %11000011, %10000011, %10000011, %11000111, %11111111
TILE_ICON_MUSIC_4 = (*-$8000)/16
.byt %00110000, %01111000, %11111000, %11110000, %01100000, %00000000, %00000000, %00000000
.byt %11001111, %10000111, %00000111, %00001111, %10011111, %11111111, %11111111, %11111111
; TILES $92 to $95 - Stocks icon
TILE_ICON_STOCKS_1 = (*-$8000)/16
.byt %00000000, %00000000, %00000000, %00011100, %00111110, %01110011, %01100001, %01100011
.byt %11111111, %11111111, %11111111, %11100011, %11000001, %10001100, %10011110, %10011100
TILE_ICON_STOCKS_2 = (*-$8000)/16
.byt %00000000, %00000000, %00000000, %01110000, %11111000, %11011100, %10001100, %00001100
.byt %11111111, %11111111, %11111111, %10001111, %00000111, %00100011, %01110011, %11110011
TILE_ICON_STOCKS_3 = (*-$8000)/16
.byt %01100000, %00110000, %00011000, %00001100, %00000110, %00000011, %00000001, %00000000
.byt %10011111, %11001111, %11100111, %11110011, %11111001, %11111100, %11111110, %11111111
TILE_ICON_STOCKS_4 = (*-$8000)/16
.byt %00001100, %00011000, %00110000, %01100000, %11000000, %10000000, %00000000, %00000000
.byt %11110011, %11100111, %11001111, %10011111, %00111111, %01111111, %11111111, %11111111
; TILES $96 to $99 - Player icon
TILE_ICON_PLAYER_1 = (*-$8000)/16
.byt %00000000, %00110000, %00110000, %00011000, %00011111, %00110000, %00111100, %01000110
.byt %11111111, %11001111, %11001111, %11100111, %11100000, %11001111, %11000011, %10111001
TILE_ICON_PLAYER_2 = (*-$8000)/16
.byt %00000000, %00001100, %00001100, %00011000, %11111000, %00001100, %00111100, %01100010
.byt %11111111, %11110011, %11110011, %11100111, %00000111, %11110011, %11000011, %10011101
TILE_ICON_PLAYER_3 = (*-$8000)/16
.byt %01010110, %01010110, %01000100, %00111000, %00010011, %00001100, %00000111, %00000000
.byt %10101001, %10101001, %10111011, %11000111, %11101100, %11110011, %11111000, %11111111
TILE_ICON_PLAYER_4 = (*-$8000)/16
.byt %01101010, %01101010, %00100010, %00011100, %11001000, %00110000, %11100000, %00000000
.byt %10010101, %10010101, %11011101, %11100011, %00110111, %11001111, %00011111, %11111111
; TILE $9a - Text dot "."
;
; 02200000
; 21120000
; 21120000
; 02200000
; 00000000
; 00000000
; 00000000
; 00000000
TILE_TEXT_DOT = (*-$8000)/16
.byt %00000000, %01100000, %01100000, %00000000, %00000000, %00000000, %00000000, %00000000
.byt %01100000, %10010000, %10010000, %01100000, %00000000, %00000000, %00000000, %00000000
; TILE $9b - Out of screen bubble
;
; 00000000
; 00011100
; 00122210
; 01222221
; 01222221
; 01222221
; 00122210
; 00011100
TILE_OUT_OF_SCREEN_BUBBLE = (*-$8000)/16
.byt %00000000, %00011100, %00100010, %01000001, %01000001, %01000001, %00100010, %00011100
.byt %00000000, %00000000, %00011100, %00111110, %00111110, %00111110, %00011100, %00000000
; 8 tiles - Power flames for "The Hunt" buff
TILE_POWER_FLAMES_TINY_1 = (*-$8000)/16
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000001
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000001
TILE_POWER_FLAMES_TINY_2 = (*-$8000)/16
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000010, %00000000
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000010, %00000000
TILE_POWER_FLAMES_LITTLE_1 = (*-$8000)/16
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000010, %00000011
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000010, %00000011
TILE_POWER_FLAMES_LITTLE_2 = (*-$8000)/16
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000100, %00000110, %00000011
.byt %00000000, %00000000, %00000000, %00000000, %00000000, %00000100, %00000110, %00000011
TILE_POWER_FLAMES_MEDIUM_1 = (*-$8000)/16
.byt %00000000, %00000001, %00001000, %00000010, %00000100, %00001100, %00001110, %00000111
.byt %00000000, %00000001, %00001000, %00000010, %00000100, %00001100, %00001110, %00000111
TILE_POWER_FLAMES_MEDIUM_2 = (*-$8000)/16
.byt %00000000, %00000100, %00000001, %00010010, %00000110, %00000110, %00000110, %00000011
.byt %00000000, %00000100, %00000001, %00010010, %00000110, %00000110, %00000110, %00000011
TILE_POWER_FLAMES_LARGE_1 = (*-$8000)/16
.byt %00001000, %01000000, %00000000, %00010100, %10011000, %00011100, %00011110, %00101111
.byt %00001000, %01000000, %00000000, %00010100, %10011000, %00011100, %00011110, %00101111
TILE_POWER_FLAMES_LARGE_2 = (*-$8000)/16
.byt %00100101, %10001000, %00011000, %00011101, %01011100, %00011110, %00001110, %00000111
.byt %00100101, %10001000, %00011000, %00011101, %01011100, %00011110, %00001110, %00000111
; TILE ntsc indicator
;
; 01111110
; 11211211
; 11221211
; 11221211
; 11212211
; 11212211
; 11211211
; 01111110
TILE_NTSC_INDICATOR = (*-$8000)/16
.byt %01111110, %11011011, %11001011, %11001011, %11010011, %11010011, %11011011, %01111110
.byt %00000000, %00100100, %00110100, %00110100, %00101100, %00101100, %00100100, %00000000
#echo CHR-DATA number of free sprites
#print 256-(*-$8000)/16
#if $9000-* < 0
#error VRAM pattern1 data occupies too much space
#else
.dsb $9000-*, 0
#endif
; No CHR-TILES in this brank (should always be handled by gamestates logic)
#if $a000-* < 0
#error VRAM pattern2 data occupies too much space
#else
.dsb $a000-*, 0
#endif
#if $c000-* < 0
#error CHR-BANK occupies too much space
#else
.dsb $c000-*, 0
#endif
|
oeis/065/A065958.asm | neoneye/loda-programs | 11 | 89199 | ; A065958: a(n) = n^2*Product_{distinct primes p dividing n} (1+1/p^2).
; Submitted by <NAME>
; 1,5,10,20,26,50,50,80,90,130,122,200,170,250,260,320,290,450,362,520,500,610,530,800,650,850,810,1000,842,1300,962,1280,1220,1450,1300,1800,1370,1810,1700,2080,1682,2500,1850,2440,2340,2650,2210,3200,2450,3250,2900,3400,2810,4050,3172,4000,3620,4210,3482,5200,3722,4810,4500,5120,4420,6100,4490,5800,5300,6500,5042,7200,5330,6850,6500,7240,6100,8500,6242,8320,7290,8410,6890,10000,7540,9250,8420,9760,7922,11700,8500,10600,9620,11050,9412,12800,9410,12250,10980,13000
add $0,1
mov $1,1
lpb $0
cmp $2,0
mov $3,$0
lpb $3
mov $4,$0
mov $6,$2
cmp $6,0
add $2,$6
mod $4,$2
cmp $4,0
cmp $4,0
mov $5,$2
add $2,1
cmp $5,1
max $4,$5
sub $3,$4
lpe
mov $5,1
lpb $0
dif $0,$2
mul $5,$2
lpe
dif $5,$2
mul $1,$5
pow $2,2
add $2,1
mul $2,$5
mul $1,$2
lpe
mov $0,$1
|
pwnlib/shellcraft/templates/thumb/linux/readfile.asm | IMULMUL/python3-pwntools | 325 | 242204 | <reponame>IMULMUL/python3-pwntools
<%
from pwnlib.shellcraft import thumb
from pwnlib.util.net import sockaddr
%>
<%page args="path, dst='r6'"/>
<%docstring>
Args: [path, dst (imm/reg) = r6]
Opens the specified file path and sends its content to the specified file descriptor.
Leaves the destination file descriptor in r6 and the input file descriptor in r5.
</%docstring>
/* Save dst fd for later */
${thumb.mov('r6', dst)}
${thumb.pushstr(path)}
${thumb.syscall('SYS_open', 'sp', 'O_RDONLY')}
/* Save src fd for later */
${thumb.mov('r5', 'r0')}
/* Allocate room for struct stat */
sub sp, sp, #88
${thumb.syscall('SYS_fstat64', 'r0', 'sp')}
/* Load file size into r3 */
ldr r3, [sp, #48]
${thumb.syscall('SYS_sendfile', 'r6', 'r5', 0, 'r3')}
|
3-mid/opengl/source/lean/light/opengl-light.adb | charlie5/lace | 20 | 3705 | <gh_stars>10-100
package body openGL.Light
is
function is_On (Self : in Item) return Boolean
is
begin
return Self.On;
end is_On;
procedure is_On (Self : in out Item; Now : in Boolean := True)
is
begin
Self.On := Now;
end is_On;
function Site (Self : in Item) return openGL.Site
is
begin
return Self.Site;
end Site;
procedure Site_is (Self : in out Item; Now : in openGL.Site)
is
begin
Self.Site := Now;
end Site_is;
end openGL.Light;
|
libsrc/_DEVELOPMENT/adt/p_forward_list_alt/c/sccz80/p_forward_list_alt_init.asm | jpoikela/z88dk | 640 | 8672 |
; void p_forward_list_alt_init(void *p)
SECTION code_clib
SECTION code_adt_p_forward_list_alt
PUBLIC p_forward_list_alt_init
EXTERN asm_p_forward_list_alt_init
defc p_forward_list_alt_init = asm_p_forward_list_alt_init
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _p_forward_list_alt_init
defc _p_forward_list_alt_init = p_forward_list_alt_init
ENDIF
|
source/nodes/program-relative_access_types.ads | reznikmm/gela | 0 | 23525 | <filename>source/nodes/program-relative_access_types.ads
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
generic
type Object is limited private;
type Object_Access is access all Object;
package Program.Relative_Access_Types is
type Relative_Access is limited private;
function "+" (Value : Object_Access) return Relative_Access with Inline;
function "-" (Value : Relative_Access) return Object_Access with Inline;
private
type Relative_Access is range -2 ** 31 .. 2 ** 31 - 1;
end Program.Relative_Access_Types;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_761.asm | ljhsiun2/medusa | 9 | 7826 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x9bb3, %rsi
lea addresses_WC_ht+0x35b3, %rdi
nop
nop
nop
nop
xor %r13, %r13
mov $76, %rcx
rep movsb
nop
dec %rcx
pop %rsi
pop %rdi
pop %rcx
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rsi
// Faulty Load
lea addresses_WC+0xc4b3, %r8
nop
nop
nop
nop
and $7569, %rbp
mov (%r8), %cx
lea oracles, %r9
and $0xff, %rcx
shlq $12, %rcx
mov (%r9,%rcx,1), %rcx
pop %rsi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': True}}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
src/jsa.ads | sparre/JSA | 1 | 1749 | -- Root name-space for general, reusable packages from
-- JSA Research & Innovation.
--
-- Licence: ISC
package JSA
with Pure
is
end JSA;
|
music/Clear Work.applescript | casey/local | 18 | 2964 | <reponame>casey/local
property my_title : "Clear Work"
tell application "Music"
set sel to selection
repeat with outerTrack in sel
set innerTrack to contents of outerTrack
set work of innerTrack to ""
end
end
|
src/Track.g4 | hdgarrood/klasma | 7 | 6415 | grammar Track;
track: decl+ ;
decl: channel_decl | block_decl | endline ;
channel_decl: ID SPACE COLON SPACE CHANNEL SPACE WAVE channel_body ;
channel_body: block_list_line+ ;
block_list_line: endline (SPACE block_name)+ SPACE? ;
block_name: ID ;
block_decl: ID SPACE COLON SPACE BLOCK block_body ;
block_body: note_list_line+ ;
note_list_line: endline (SPACE note)+ SPACE? ;
note: NOTENAME OCTAVE? LENGTH? ;
endline : SPACE? NEWLINE ;
ID : [a-z][a-zA-Z0-9_]* ;
COLON : ':' ;
CHANNEL : 'CHANNEL';
BLOCK : 'BLOCK' ;
TRACK : 'TRACK' ;
WAVE : 'TRIANGLE' | 'SQUARE' | 'SAWTOOTH' | 'NOISE' ;
NOTENAME: 'Ab'
| 'A'
| 'A#'
| 'Bb'
| 'B'
| 'C'
| 'C#'
| 'Db'
| 'D'
| 'D#'
| 'Eb'
| 'E'
| 'F'
| 'F#'
| 'Gb'
| 'G'
| 'G#'
| '^' // rest
;
OCTAVE : [0-9]+ ;
LENGTH : ('+' | '-' | '.')+ ;
NEWLINE : '\r\n' | '\n' ;
SPACE : (' ' | '\t')+ ;
COMMENT : '--' .*? NEWLINE -> skip ;
|
net/testdata/JsonParser.dll.asm | lillobillo/completion | 300 | 12774 | ModuleRow
&{Generation:0 Name:JsonParser.dll Mvid:FA75A08B-59E8-4D4A-B10E-2114294958F4 EncId:nil EncBaseId:nil}
TypeRefRow
&{ResolutionScope:AssemblyRefRow[1] TypeName:NumberStyles TypeNamespace:System.Globalization}
&{ResolutionScope:AssemblyRefRow[1] TypeName:IDictionary`2 TypeNamespace:System.Collections.Generic}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Type TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:PropertyInfo TypeNamespace:System.Reflection}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Exception TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Object TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Char TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:RuntimeHelpers TypeNamespace:System.Runtime.CompilerServices}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Array TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:RuntimeFieldHandle TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Dictionary`2 TypeNamespace:System.Collections.Generic}
&{ResolutionScope:AssemblyRefRow[1] TypeName:IEnumerable`1 TypeNamespace:System.Collections.Generic}
&{ResolutionScope:AssemblyRefRow[1] TypeName:IEnumerator`1 TypeNamespace:System.Collections.Generic}
&{ResolutionScope:AssemblyRefRow[1] TypeName:MemberInfo TypeNamespace:System.Reflection}
&{ResolutionScope:AssemblyRefRow[1] TypeName:String TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:DateTime TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:RuntimeTypeHandle TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:CultureInfo TypeNamespace:System.Globalization}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Int32 TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:IFormatProvider TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:List`1 TypeNamespace:System.Collections.Generic}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Convert TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[2] TypeName:Func`2 TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[2] TypeName:Enumerable TypeNamespace:System.Linq}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Double TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Int64 TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:IEnumerator TypeNamespace:System.Collections}
&{ResolutionScope:AssemblyRefRow[1] TypeName:IDisposable TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:KeyValuePair`2 TypeNamespace:System.Collections.Generic}
&{ResolutionScope:AssemblyRefRow[1] TypeName:StringBuilder TypeNamespace:System.Text}
&{ResolutionScope:AssemblyRefRow[1] TypeName:StringComparer TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:IEqualityComparer`1 TypeNamespace:System.Collections.Generic}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Activator TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:BindingFlags TypeNamespace:System.Reflection}
&{ResolutionScope:AssemblyRefRow[1] TypeName:IEnumerable TypeNamespace:System.Collections}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Boolean TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:TimeSpan TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:ICollection`1 TypeNamespace:System.Collections.Generic}
&{ResolutionScope:AssemblyRefRow[1] TypeName:IList`1 TypeNamespace:System.Collections.Generic}
&{ResolutionScope:AssemblyRefRow[1] TypeName:ArgumentOutOfRangeException TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:NotSupportedException TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:CompilerGeneratedAttribute TypeNamespace:System.Runtime.CompilerServices}
&{ResolutionScope:AssemblyRefRow[1] TypeName:Enum TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:ValueType TypeNamespace:System}
&{ResolutionScope:AssemblyRefRow[1] TypeName:RuntimeCompatibilityAttribute TypeNamespace:System.Runtime.CompilerServices}
TypeDefRow
&{Flags:0 TypeName:<Module> TypeNamespace: Extends:TypeDefRow[0] FieldList:FieldRow[1] MethodList:MethodDefRow[1]}
&{Flags:257 TypeName:JsonToken TypeNamespace:Json Extends:TypeRefRow[43] FieldList:FieldRow[1] MethodList:MethodDefRow[1]}
&{Flags:1048577 TypeName:InvalidJsonException TypeNamespace:Json Extends:TypeRefRow[5] FieldList:FieldRow[14] MethodList:MethodDefRow[1]}
&{Flags:1 TypeName:JsonParser TypeNamespace:Json Extends:TypeRefRow[6] FieldList:FieldRow[14] MethodList:MethodDefRow[2]}
&{Flags:1048960 TypeName:<PrivateImplementationDetails>{fa75a08b-59e8-4d4a-b10e-2114294958f4} TypeNamespace: Extends:TypeRefRow[6] FieldList:FieldRow[18] MethodList:MethodDefRow[40]}
&{Flags:1048851 TypeName:$ArrayType=32 TypeNamespace: Extends:TypeRefRow[44] FieldList:FieldRow[19] MethodList:MethodDefRow[40]}
FieldRow
&{Flags:1542 Name:value__ Signature:Blob[1]}
&{Flags:32854 Name:Unknown Signature:Blob[4]}
&{Flags:32854 Name:LeftBrace Signature:Blob[4]}
&{Flags:32854 Name:RightBrace Signature:Blob[4]}
&{Flags:32854 Name:Colon Signature:Blob[4]}
&{Flags:32854 Name:Comma Signature:Blob[4]}
&{Flags:32854 Name:LeftBracket Signature:Blob[4]}
&{Flags:32854 Name:RightBracket Signature:Blob[4]}
&{Flags:32854 Name:String Signature:Blob[4]}
&{Flags:32854 Name:Number Signature:Blob[4]}
&{Flags:32854 Name:True Signature:Blob[4]}
&{Flags:32854 Name:False Signature:Blob[4]}
&{Flags:32854 Name:Null Signature:Blob[4]}
&{Flags:32849 Name:JsonNumbers Signature:Blob[8]}
&{Flags:49 Name:_cache Signature:Blob[12]}
&{Flags:49 Name:_base16 Signature:Blob[23]}
&{Flags:17 Name:<>f__am$cache2 Signature:Blob[566]}
&{Flags:275 Name:$field-0 Signature:Blob[101]}
MethodDefRow
&{RVA:8272 ImplFlags:0 Flags:6278 Name:.ctor Signature:Blob[87] ParamList:ParamRow[1]}
&{RVA:8281 ImplFlags:0 Flags:6278 Name:.ctor Signature:Blob[92] ParamList:ParamRow[2]}
&{RVA:8292 ImplFlags:0 Flags:150 Name:Serialize Signature:Blob[701] ParamList:ParamRow[2]}
&{RVA:8320 ImplFlags:0 Flags:150 Name:Deserialize Signature:Blob[717] ParamList:ParamRow[3]}
&{RVA:8360 ImplFlags:0 Flags:150 Name:Deserialize Signature:Blob[740] ParamList:ParamRow[5]}
&{RVA:8397 ImplFlags:0 Flags:145 Name:DeserializeImpl Signature:Blob[764] ParamList:ParamRow[6]}
&{RVA:8407 ImplFlags:0 Flags:145 Name:DeserializeImpl Signature:Blob[781] ParamList:ParamRow[9]}
&{RVA:8424 ImplFlags:0 Flags:145 Name:DeserializeType Signature:Blob[764] ParamList:ParamRow[12]}
&{RVA:8856 ImplFlags:0 Flags:150 Name:FromJson Signature:Blob[823] ParamList:ParamRow[15]}
&{RVA:8916 ImplFlags:0 Flags:150 Name:FromJson Signature:Blob[858] ParamList:ParamRow[16]}
&{RVA:9000 ImplFlags:0 Flags:150 Name:ToJson Signature:Blob[881] ParamList:ParamRow[18]}
&{RVA:9036 ImplFlags:0 Flags:147 Name:GetBagForObject Signature:Blob[896] ParamList:ParamRow[19]}
&{RVA:9204 ImplFlags:0 Flags:147 Name:GetBagForObject Signature:Blob[929] ParamList:ParamRow[21]}
&{RVA:9227 ImplFlags:0 Flags:147 Name:InitializeBag Signature:Blob[941] ParamList:ParamRow[22]}
&{RVA:9240 ImplFlags:0 Flags:147 Name:PrepareInstance Signature:Blob[950] ParamList:ParamRow[22]}
&{RVA:9268 ImplFlags:0 Flags:147 Name:PrepareInstance Signature:Blob[963] ParamList:ParamRow[24]}
&{RVA:9320 ImplFlags:0 Flags:147 Name:CacheReflection Signature:Blob[981] ParamList:ParamRow[25]}
&{RVA:9372 ImplFlags:0 Flags:147 Name:SerializeItem Signature:Blob[993] ParamList:ParamRow[26]}
&{RVA:9576 ImplFlags:0 Flags:147 Name:SerializeDateTime Signature:Blob[1012] ParamList:ParamRow[28]}
&{RVA:9644 ImplFlags:0 Flags:147 Name:SerializeArray Signature:Blob[1027] ParamList:ParamRow[29]}
&{RVA:9808 ImplFlags:0 Flags:147 Name:SerializeObject Signature:Blob[1027] ParamList:ParamRow[31]}
&{RVA:10032 ImplFlags:0 Flags:147 Name:SerializeString Signature:Blob[993] ParamList:ParamRow[33]}
&{RVA:10208 ImplFlags:0 Flags:147 Name:GetUnicode Signature:Blob[1080] ParamList:ParamRow[35]}
&{RVA:10300 ImplFlags:0 Flags:147 Name:ParsePair Signature:Blob[1091] ParamList:ParamRow[36]}
&{RVA:10396 ImplFlags:0 Flags:147 Name:ParseToken Signature:Blob[1114] ParamList:ParamRow[38]}
&{RVA:10424 ImplFlags:0 Flags:147 Name:ParseString Signature:Blob[1133] ParamList:ParamRow[41]}
&{RVA:10784 ImplFlags:0 Flags:147 Name:ParseValue Signature:Blob[1160] ParamList:ParamRow[43]}
&{RVA:10944 ImplFlags:0 Flags:147 Name:ParseObject Signature:Blob[1179] ParamList:ParamRow[45]}
&{RVA:11256 ImplFlags:0 Flags:147 Name:ParseArray Signature:Blob[1226] ParamList:ParamRow[47]}
&{RVA:11464 ImplFlags:0 Flags:147 Name:ParseNumber Signature:Blob[1160] ParamList:ParamRow[49]}
&{RVA:11608 ImplFlags:0 Flags:147 Name:NextToken Signature:Blob[1271] ParamList:ParamRow[51]}
&{RVA:11697 ImplFlags:0 Flags:147 Name:GetTokenFromSymbol Signature:Blob[1290] ParamList:ParamRow[53]}
&{RVA:11708 ImplFlags:0 Flags:147 Name:GetTokenFromSymbol Signature:Blob[1296] ParamList:ParamRow[54]}
&{RVA:11968 ImplFlags:0 Flags:147 Name:IgnoreWhitespace Signature:Blob[1308] ParamList:ParamRow[56]}
&{RVA:11996 ImplFlags:0 Flags:147 Name:IgnoreWhitespace Signature:Blob[1321] ParamList:ParamRow[59]}
&{RVA:12096 ImplFlags:0 Flags:147 Name:GetKeyword Signature:Blob[1338] ParamList:ParamRow[63]}
&{RVA:12196 ImplFlags:0 Flags:147 Name:BaseConvert Signature:Blob[1361] ParamList:ParamRow[68]}
&{RVA:12296 ImplFlags:0 Flags:6161 Name:.cctor Signature:Blob[1376] ParamList:ParamRow[71]}
&{RVA:12332 ImplFlags:0 Flags:145 Name:<SerializeString>m__0 Signature:Blob[1380] ParamList:ParamRow[71]}
ParamRow
&{Flags:0 Sequence:1 Name:message}
&{Flags:0 Sequence:1 Name:instance}
&{Flags:0 Sequence:1 Name:json}
&{Flags:0 Sequence:2 Name:type}
&{Flags:0 Sequence:1 Name:json}
&{Flags:0 Sequence:1 Name:map}
&{Flags:0 Sequence:2 Name:bag}
&{Flags:0 Sequence:3 Name:instance}
&{Flags:0 Sequence:1 Name:map}
&{Flags:0 Sequence:2 Name:bag}
&{Flags:0 Sequence:3 Name:instance}
&{Flags:0 Sequence:1 Name:map}
&{Flags:0 Sequence:2 Name:bag}
&{Flags:0 Sequence:3 Name:instance}
&{Flags:0 Sequence:1 Name:json}
&{Flags:0 Sequence:1 Name:json}
&{Flags:2 Sequence:2 Name:type}
&{Flags:0 Sequence:1 Name:bag}
&{Flags:0 Sequence:1 Name:type}
&{Flags:0 Sequence:2 Name:instance}
&{Flags:0 Sequence:1 Name:instance}
&{Flags:2 Sequence:1 Name:instance}
&{Flags:0 Sequence:2 Name:type}
&{Flags:2 Sequence:1 Name:instance}
&{Flags:0 Sequence:1 Name:item}
&{Flags:0 Sequence:1 Name:sb}
&{Flags:0 Sequence:2 Name:item}
&{Flags:0 Sequence:1 Name:sb}
&{Flags:0 Sequence:1 Name:item}
&{Flags:0 Sequence:2 Name:sb}
&{Flags:0 Sequence:1 Name:item}
&{Flags:0 Sequence:2 Name:sb}
&{Flags:0 Sequence:1 Name:sb}
&{Flags:0 Sequence:2 Name:item}
&{Flags:0 Sequence:1 Name:code}
&{Flags:0 Sequence:1 Name:data}
&{Flags:0 Sequence:2 Name:index}
&{Flags:0 Sequence:1 Name:token}
&{Flags:0 Sequence:2 Name:data}
&{Flags:0 Sequence:3 Name:index}
&{Flags:0 Sequence:1 Name:data}
&{Flags:0 Sequence:2 Name:index}
&{Flags:0 Sequence:1 Name:data}
&{Flags:0 Sequence:2 Name:index}
&{Flags:0 Sequence:1 Name:data}
&{Flags:0 Sequence:2 Name:index}
&{Flags:0 Sequence:1 Name:data}
&{Flags:0 Sequence:2 Name:index}
&{Flags:0 Sequence:1 Name:data}
&{Flags:0 Sequence:2 Name:index}
&{Flags:0 Sequence:1 Name:data}
&{Flags:0 Sequence:2 Name:index}
&{Flags:0 Sequence:1 Name:symbol}
&{Flags:0 Sequence:1 Name:symbol}
&{Flags:0 Sequence:2 Name:token}
&{Flags:0 Sequence:1 Name:data}
&{Flags:0 Sequence:2 Name:index}
&{Flags:0 Sequence:3 Name:symbol}
&{Flags:0 Sequence:1 Name:data}
&{Flags:0 Sequence:2 Name:index}
&{Flags:0 Sequence:3 Name:token}
&{Flags:0 Sequence:4 Name:symbol}
&{Flags:0 Sequence:1 Name:word}
&{Flags:0 Sequence:2 Name:target}
&{Flags:0 Sequence:3 Name:data}
&{Flags:0 Sequence:4 Name:index}
&{Flags:0 Sequence:5 Name:result}
&{Flags:0 Sequence:1 Name:input}
&{Flags:0 Sequence:2 Name:charSet}
&{Flags:0 Sequence:3 Name:minLength}
&{Flags:0 Sequence:1 Name:symbol}
MemberRefRow
&{Class:TypeRefRow[5] Name:.ctor Signature:Blob[87]}
&{Class:TypeRefRow[6] Name:.ctor Signature:Blob[92]}
&{Class:TypeRefRow[8] Name:InitializeArray Signature:Blob[105]}
&{Class:TypeSpecRow[1] Name:.ctor Signature:Blob[123]}
&{Class:TypeSpecRow[3] Name:GetEnumerator Signature:Blob[143]}
&{Class:TypeSpecRow[4] Name:get_Current Signature:Blob[159]}
&{Class:TypeRefRow[14] Name:get_Name Signature:Blob[164]}
&{Class:TypeSpecRow[5] Name:ContainsKey Signature:Blob[175]}
&{Class:TypeRefRow[15] Name:Empty Signature:Blob[181]}
&{Class:TypeRefRow[15] Name:Replace Signature:Blob[184]}
&{Class:TypeSpecRow[5] Name:get_Item Signature:Blob[190]}
&{Class:TypeRefRow[4] Name:get_PropertyType Signature:Blob[197]}
&{Class:TypeRefRow[3] Name:GetTypeFromHandle Signature:Blob[202]}
&{Class:TypeRefRow[6] Name:ToString Signature:Blob[164]}
&{Class:TypeRefRow[18] Name:get_InvariantCulture Signature:Blob[209]}
&{Class:TypeRefRow[19] Name:Parse Signature:Blob[214]}
&{Class:TypeRefRow[16] Name:.ctor Signature:Blob[223]}
&{Class:TypeRefRow[16] Name:ToUniversalTime Signature:Blob[230]}
&{Class:TypeRefRow[16] Name:AddSeconds Signature:Blob[235]}
&{Class:TypeRefRow[22] Name:ToByte Signature:Blob[250]}
&{Class:TypeSpecRow[8] Name:.ctor Signature:Blob[262]}
&{Class:TypeRefRow[24] Name:Select Signature:Blob[268]}
&{Class:TypeRefRow[24] Name:ToArray Signature:Blob[297]}
&{Class:TypeRefRow[22] Name:ToDouble Signature:Blob[314]}
&{Class:TypeRefRow[22] Name:ToInt32 Signature:Blob[319]}
&{Class:TypeRefRow[22] Name:ToInt64 Signature:Blob[324]}
&{Class:TypeRefRow[4] Name:SetValue Signature:Blob[329]}
&{Class:TypeRefRow[27] Name:MoveNext Signature:Blob[337]}
&{Class:TypeRefRow[28] Name:Dispose Signature:Blob[92]}
&{Class:TypeRefRow[24] Name:Single Signature:Blob[341]}
&{Class:TypeSpecRow[9] Name:get_Value Signature:Blob[369]}
&{Class:TypeRefRow[15] Name:ToCharArray Signature:Blob[374]}
&{Class:TypeRefRow[30] Name:.ctor Signature:Blob[123]}
&{Class:TypeRefRow[3] Name:get_FullName Signature:Blob[164]}
&{Class:TypeRefRow[15] Name:Contains Signature:Blob[379]}
&{Class:TypeSpecRow[10] Name:get_Item Signature:Blob[190]}
&{Class:TypeRefRow[4] Name:get_CanWrite Signature:Blob[337]}
&{Class:TypeRefRow[4] Name:get_CanRead Signature:Blob[337]}
&{Class:TypeRefRow[4] Name:GetValue Signature:Blob[394]}
&{Class:TypeSpecRow[5] Name:Add Signature:Blob[401]}
&{Class:TypeRefRow[31] Name:get_OrdinalIgnoreCase Signature:Blob[409]}
&{Class:TypeSpecRow[12] Name:.ctor Signature:Blob[421]}
&{Class:TypeRefRow[33] Name:CreateInstance Signature:Blob[433]}
&{Class:TypeRefRow[33] Name:CreateInstance Signature:Blob[439]}
&{Class:TypeSpecRow[10] Name:ContainsKey Signature:Blob[175]}
&{Class:TypeRefRow[3] Name:GetProperties Signature:Blob[445]}
&{Class:TypeSpecRow[10] Name:Add Signature:Blob[401]}
&{Class:TypeRefRow[36] Name:ToString Signature:Blob[164]}
&{Class:TypeRefRow[15] Name:ToLower Signature:Blob[164]}
&{Class:TypeRefRow[30] Name:Append Signature:Blob[454]}
&{Class:TypeRefRow[25] Name:TryParse Signature:Blob[460]}
&{Class:TypeRefRow[30] Name:Append Signature:Blob[471]}
&{Class:TypeRefRow[6] Name:GetType Signature:Blob[197]}
&{Class:TypeRefRow[16] Name:get_UtcNow Signature:Blob[477]}
&{Class:TypeRefRow[16] Name:op_Subtraction Signature:Blob[482]}
&{Class:TypeRefRow[37] Name:get_TotalSeconds Signature:Blob[492]}
&{Class:TypeRefRow[24] Name:Cast Signature:Blob[496]}
&{Class:TypeRefRow[24] Name:Count Signature:Blob[513]}
&{Class:TypeRefRow[35] Name:GetEnumerator Signature:Blob[524]}
&{Class:TypeRefRow[27] Name:get_Current Signature:Blob[529]}
&{Class:TypeSpecRow[5] Name:get_Keys Signature:Blob[533]}
&{Class:TypeSpecRow[14] Name:GetEnumerator Signature:Blob[143]}
&{Class:TypeSpecRow[15] Name:get_Current Signature:Blob[159]}
&{Class:TypeSpecRow[16] Name:get_Count Signature:Blob[562]}
&{Class:TypeSpecRow[17] Name:.ctor Signature:Blob[262]}
&{Class:TypeSpecRow[18] Name:.ctor Signature:Blob[262]}
&{Class:TypeRefRow[15] Name:.ctor Signature:Blob[598]}
&{Class:TypeRefRow[15] Name:Concat Signature:Blob[604]}
&{Class:TypeRefRow[15] Name:Format Signature:Blob[610]}
&{Class:TypeSpecRow[9] Name:.ctor Signature:Blob[401]}
&{Class:TypeSpecRow[19] Name:get_Item Signature:Blob[623]}
&{Class:TypeRefRow[30] Name:.ctor Signature:Blob[92]}
&{Class:TypeSpecRow[20] Name:get_Count Signature:Blob[562]}
&{Class:TypeRefRow[30] Name:Append Signature:Blob[636]}
&{Class:TypeRefRow[9] Name:Copy Signature:Blob[646]}
&{Class:TypeRefRow[15] Name:.ctor Signature:Blob[657]}
&{Class:TypeRefRow[22] Name:ToInt32 Signature:Blob[663]}
&{Class:TypeRefRow[40] Name:.ctor Signature:Blob[92]}
&{Class:TypeSpecRow[12] Name:get_Count Signature:Blob[562]}
&{Class:TypeRefRow[15] Name:Concat Signature:Blob[669]}
&{Class:TypeSpecRow[12] Name:Add Signature:Blob[401]}
&{Class:TypeSpecRow[9] Name:get_Key Signature:Blob[159]}
&{Class:TypeRefRow[41] Name:.ctor Signature:Blob[87]}
&{Class:TypeSpecRow[7] Name:.ctor Signature:Blob[92]}
&{Class:TypeSpecRow[7] Name:Add Signature:Blob[675]}
&{Class:TypeRefRow[15] Name:get_Length Signature:Blob[562]}
&{Class:TypeRefRow[15] Name:get_Chars Signature:Blob[681]}
&{Class:TypeRefRow[30] Name:Insert Signature:Blob[686]}
&{Class:TypeRefRow[30] Name:Insert Signature:Blob[694]}
&{Class:TypeRefRow[30] Name:get_Length Signature:Blob[562]}
&{Class:TypeRefRow[42] Name:.ctor Signature:Blob[92]}
&{Class:TypeRefRow[45] Name:.ctor Signature:Blob[92]}
ConstantRow
&{Type:8 Padding:0 Parent:FieldRow[2] Value:Blob[27]}
&{Type:8 Padding:0 Parent:FieldRow[3] Value:Blob[32]}
&{Type:8 Padding:0 Parent:FieldRow[4] Value:Blob[37]}
&{Type:8 Padding:0 Parent:FieldRow[5] Value:Blob[42]}
&{Type:8 Padding:0 Parent:FieldRow[6] Value:Blob[47]}
&{Type:8 Padding:0 Parent:FieldRow[7] Value:Blob[52]}
&{Type:8 Padding:0 Parent:FieldRow[8] Value:Blob[57]}
&{Type:8 Padding:0 Parent:FieldRow[9] Value:Blob[62]}
&{Type:8 Padding:0 Parent:FieldRow[10] Value:Blob[67]}
&{Type:8 Padding:0 Parent:FieldRow[11] Value:Blob[72]}
&{Type:8 Padding:0 Parent:FieldRow[12] Value:Blob[77]}
&{Type:8 Padding:0 Parent:FieldRow[13] Value:Blob[82]}
&{Type:8 Padding:0 Parent:FieldRow[14] Value:Blob[96]}
CustomAttributeRow
&{Parent:AssemblyRow[1] Type:MemberRefRow[92] Value:Blob[1385]}
&{Parent:TypeDefRow[5] Type:MemberRefRow[91] Value:Blob[32]}
&{Parent:FieldRow[17] Type:MemberRefRow[91] Value:Blob[32]}
&{Parent:MethodDefRow[39] Type:MemberRefRow[91] Value:Blob[32]}
ClassLayoutRow
&{PackingSize:1 ClassSize:32 Parent:TypeDefRow[6]}
StandAloneSigRow
&{Signature:Blob[708]}
&{Signature:Blob[724]}
&{Signature:Blob[747]}
&{Signature:Blob[800]}
&{Signature:Blob[833]}
&{Signature:Blob[871]}
&{Signature:Blob[891]}
&{Signature:Blob[908]}
&{Signature:Blob[976]}
&{Signature:Blob[987]}
&{Signature:Blob[1000]}
&{Signature:Blob[1018]}
&{Signature:Blob[1034]}
&{Signature:Blob[1047]}
&{Signature:Blob[1064]}
&{Signature:Blob[1085]}
&{Signature:Blob[1108]}
&{Signature:Blob[1128]}
&{Signature:Blob[1145]}
&{Signature:Blob[1172]}
&{Signature:Blob[1196]}
&{Signature:Blob[1242]}
&{Signature:Blob[1261]}
&{Signature:Blob[1284]}
&{Signature:Blob[1304]}
&{Signature:Blob[1356]}
&{Signature:Blob[1369]}
TypeSpecRow
&{Signature:Blob[113]}
&{Signature:Blob[133]}
&{Signature:Blob[136]}
&{Signature:Blob[152]}
&{Signature:Blob[168]}
&{Signature:Blob[241]}
&{Signature:Blob[244]}
&{Signature:Blob[255]}
&{Signature:Blob[362]}
&{Signature:Blob[384]}
&{Signature:Blob[133]}
&{Signature:Blob[414]}
&{Signature:Blob[133]}
&{Signature:Blob[543]}
&{Signature:Blob[549]}
&{Signature:Blob[555]}
&{Signature:Blob[574]}
&{Signature:Blob[586]}
&{Signature:Blob[616]}
&{Signature:Blob[629]}
FieldRVARow
&{RVA:24576 Field:FieldRow[18]}
AssemblyRow
&{HashAlgId:SHA1 MajorVersion:0 MinorVersion:0 BuildNumber:0 RevisionNumber:0 Flags:0 PublicKey:Blob[0] Name:JsonParser Culture:}
AssemblyRefRow
&{MajorVersion:2 MinorVersion:0 BuildNumber:0 RevisionNumber:0 Flags:0 PublicKeyOrToken:Blob[1416] Name:mscorlib Culture: HashValue:Blob[0]}
&{MajorVersion:3 MinorVersion:5 BuildNumber:0 RevisionNumber:0 Flags:0 PublicKeyOrToken:Blob[1416] Name:System.Core Culture: HashValue:Blob[0]}
NestedClassRow
&{NestedClass:TypeDefRow[6] EnclosingClass:TypeDefRow[5]}
GenericParamRow
&{Number:0 Flags:0 Owner:MethodDefRow[3] Name:T}
&{Number:0 Flags:0 Owner:MethodDefRow[5] Name:T}
&{Number:0 Flags:0 Owner:MethodDefRow[7] Name:T}
&{Number:0 Flags:0 Owner:MethodDefRow[13] Name:T}
&{Number:0 Flags:0 Owner:MethodDefRow[16] Name:T}
MethodSpecRow
&{Method:MethodDefRow[13] Instantiation:Blob[128]}
&{Method:MethodDefRow[16] Instantiation:Blob[128]}
&{Method:MethodDefRow[7] Instantiation:Blob[128]}
&{Method:MemberRefRow[22] Instantiation:Blob[292]}
&{Method:MemberRefRow[23] Instantiation:Blob[310]}
&{Method:MemberRefRow[30] Instantiation:Blob[353]}
&{Method:MemberRefRow[44] Instantiation:Blob[128]}
&{Method:MemberRefRow[57] Instantiation:Blob[509]}
&{Method:MemberRefRow[58] Instantiation:Blob[509]}
&{Method:MemberRefRow[22] Instantiation:Blob[581]}
&{Method:MemberRefRow[22] Instantiation:Blob[593]}
&{Method:MemberRefRow[23] Instantiation:Blob[642]}
net://type/Json.JsonToken
net://type/Json.InvalidJsonException
net://type/Json.JsonParser
public class net://type/Json.JsonToken
extends net://type/System.Enum
public net://type/System.Int32 value__ // net://field/Json.JsonToken;0
public static net://type/Json.JsonToken Unknown // net://field/Json.JsonToken;1
public static net://type/Json.JsonToken LeftBrace // net://field/Json.JsonToken;2
public static net://type/Json.JsonToken RightBrace // net://field/Json.JsonToken;3
public static net://type/Json.JsonToken Colon // net://field/Json.JsonToken;4
public static net://type/Json.JsonToken Comma // net://field/Json.JsonToken;5
public static net://type/Json.JsonToken LeftBracket // net://field/Json.JsonToken;6
public static net://type/Json.JsonToken RightBracket // net://field/Json.JsonToken;7
public static net://type/Json.JsonToken String // net://field/Json.JsonToken;8
public static net://type/Json.JsonToken Number // net://field/Json.JsonToken;9
public static net://type/Json.JsonToken True // net://field/Json.JsonToken;10
public static net://type/Json.JsonToken False // net://field/Json.JsonToken;11
public static net://type/Json.JsonToken Null // net://field/Json.JsonToken;12
public class net://type/Json.InvalidJsonException
extends net://type/System.Exception
public InvalidJsonException(net://type/System.String message) // net://method/Json.InvalidJsonException;0
public class net://type/Json.JsonParser
extends net://type/System.Object
private static net://type/System.Globalization.NumberStyles JsonNumbers // net://field/Json.JsonParser;0
private static net://type/System.Collections.Generic.IDictionary`2<net://type/System.Type, net://type/System.Reflection.PropertyInfo[]> _cache // net://field/Json.JsonParser;1
private static net://type/System.Char[] _base16 // net://field/Json.JsonParser;2
public JsonParser() // net://method/Json.JsonParser;0
public static net://type/System.String Serialize(T instance) // net://method/Json.JsonParser;1
public static net://type/System.Object Deserialize(net://type/System.String json, net://type/System.Type type) // net://method/Json.JsonParser;2
public static T Deserialize(net://type/System.String json) // net://method/Json.JsonParser;3
private static net://type/System.Void DeserializeImpl(net://type/System.Collections.Generic.IEnumerable`1<net://type/System.Reflection.PropertyInfo> map, net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> bag, net://type/System.Object instance) // net://method/Json.JsonParser;4
private static net://type/System.Void DeserializeImpl(net://type/System.Collections.Generic.IEnumerable`1<net://type/System.Reflection.PropertyInfo> map, net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> bag, T instance) // net://method/Json.JsonParser;5
private static net://type/System.Void DeserializeType(net://type/System.Collections.Generic.IEnumerable`1<net://type/System.Reflection.PropertyInfo> map, net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> bag, net://type/System.Object instance) // net://method/Json.JsonParser;6
public static net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> FromJson(net://type/System.String json) // net://method/Json.JsonParser;7
public static net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> FromJson(net://type/System.String json, net://type/Json.JsonToken type) // net://method/Json.JsonParser;8
public static net://type/System.String ToJson(net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> bag) // net://method/Json.JsonParser;9
public static net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> GetBagForObject(net://type/System.Type type, net://type/System.Object instance) // net://method/Json.JsonParser;10
public static net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> GetBagForObject(T instance) // net://method/Json.JsonParser;11
public static net://type/System.Collections.Generic.Dictionary`2<net://type/System.String, net://type/System.Object> InitializeBag() // net://method/Json.JsonParser;12
public static net://type/System.Collections.Generic.IEnumerable`1<net://type/System.Reflection.PropertyInfo> PrepareInstance(net://type/System.Object instance, net://type/System.Type type) // net://method/Json.JsonParser;13
public static net://type/System.Collections.Generic.IEnumerable`1<net://type/System.Reflection.PropertyInfo> PrepareInstance(T instance) // net://method/Json.JsonParser;14
public static net://type/System.Void CacheReflection(net://type/System.Type item) // net://method/Json.JsonParser;15
public static net://type/System.Void SerializeItem(net://type/System.Text.StringBuilder sb, net://type/System.Object item) // net://method/Json.JsonParser;16
public static net://type/System.Void SerializeDateTime(net://type/System.Text.StringBuilder sb) // net://method/Json.JsonParser;17
public static net://type/System.Void SerializeArray(net://type/System.Object item, net://type/System.Text.StringBuilder sb) // net://method/Json.JsonParser;18
public static net://type/System.Void SerializeObject(net://type/System.Object item, net://type/System.Text.StringBuilder sb) // net://method/Json.JsonParser;19
public static net://type/System.Void SerializeString(net://type/System.Text.StringBuilder sb, net://type/System.Object item) // net://method/Json.JsonParser;20
public static net://type/System.String GetUnicode(net://type/System.Int32 code) // net://method/Json.JsonParser;21
public static net://type/System.Collections.Generic.KeyValuePair`2<net://type/System.String, net://type/System.Object> ParsePair(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;22
public static net://type/System.Boolean ParseToken(net://type/Json.JsonToken token, net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;23
public static net://type/System.String ParseString(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;24
public static net://type/System.Object ParseValue(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;25
public static net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> ParseObject(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;26
public static net://type/System.Collections.Generic.IEnumerable`1<net://type/System.Object> ParseArray(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;27
public static net://type/System.Object ParseNumber(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;28
public static net://type/Json.JsonToken NextToken(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;29
public static net://type/Json.JsonToken GetTokenFromSymbol(net://type/System.Char symbol) // net://method/Json.JsonParser;30
public static net://type/Json.JsonToken GetTokenFromSymbol(net://type/System.Char symbol, net://type/Json.JsonToken token) // net://method/Json.JsonParser;31
public static net://type/System.Void IgnoreWhitespace(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index, net://type/System.Char symbol) // net://method/Json.JsonParser;32
public static net://type/Json.JsonToken IgnoreWhitespace(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index, net://type/Json.JsonToken token, net://type/System.Char symbol) // net://method/Json.JsonParser;33
public static net://type/System.Void GetKeyword(net://type/System.String word, net://type/Json.JsonToken target, net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index, net://type/Json.JsonToken result) // net://method/Json.JsonParser;34
public static net://type/System.String BaseConvert(net://type/System.Int32 input, net://type/System.Char[] charSet, net://type/System.Int32 minLength) // net://method/Json.JsonParser;35
|
Driver/Mouse/CasioPen/casiopen.asm | steakknife/pcgeos | 504 | 91010 | <reponame>steakknife/pcgeos
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Mouse Driver -- Casio Zoomer pen mouse driver
FILE: casiopen.asm
AUTHOR: <NAME>, November 4, 1992
ROUTINES:
Name Description
---- -----------
MouseDevInit Intialize the device, registering a handler
with the DOS Mouse driver
MouseDevExit Deinitialize the device, nuking our handler.
MouseDevHandler Handler for DOS driver to call.
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/4/92 Initial revision
DESCRIPTION:
Mouse driver to support the Casio Zoomer pen.
$Id: casiopen.asm,v 1.1 97/04/18 11:48:08 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
_Mouse = 1
MOUSE_NUM_BUTTONS = 1
MOUSE_CANT_SET_RATE = 1
MOUSE_SEPARATE_INIT = 1
MOUSE_DONT_ACCELERATE = 1
MOUSE_USES_ABSOLUTE_DELTAS = 1
MOUSE_CAN_BE_CALIBRATED = 1
RECORD_PEN_EVENTS equ FALSE
; Assumes .30 dot pitch
;
DIGITIZER_X_RES = 84 ;84 DPI
DIGITIZER_Y_RES = 84 ;84 DPI
HARDWARE_TYPE equ <ZOOMER>
.186 ; allow NEC V20 instructions
MOUSE_PTR_FLAGS = mask PF_HIDE_PTR_IF_NOT_OF_ALWAYS_SHOW_TYPE
include mouseCommon.asm ; Include common definitions/code.
include timer.def
include graphics.def
include system.def
;------------------------------------------------------------------------------
; Casio Zoomer Constants
;------------------------------------------------------------------------------
CASIO_DISPLAY_X equ 256
CASIO_DISPLAY_Y equ 320
; The CasioPenFunction's are accessed via interrupt 15h, with the
; function number passed in AL
;
CASIO_INTERRUPT equ 0x15
CASIO_FUNCTION equ 0x70
CallCasio macro function
mov ax, function or (CASIO_FUNCTION shl 8)
int CASIO_INTERRUPT
endm
CasioPenFunction etype byte
CPF_RETURN_CALLBACKS enum CasioPenFunction, 00h
CPF_GET_PEN_MODE enum CasioPenFunction, 01h
CPF_READ_PEN_STATUS enum CasioPenFunction, 02h
CPF_GET_PEN_HANDLER enum CasioPenFunction, 03h
CPF_GET_CALIBRATION_POINTS enum CasioPenFunction, 04h
CPF_GET_CALIBRATION_RESULTS enum CasioPenFunction, 05h
CPF_SET_PEN_MODE equ CPF_GET_PEN_MODE
CPF_SET_PEN_HANDLER equ CPF_GET_PEN_HANDLER
CPF_SET_CALIBRATION_RESULTS equ CPF_GET_CALIBRATION_RESULTS
HardIcon struct
HI_leftEdge word ; left edge of hard icon (inclusive)
HI_dataCX word ; data to pass back in CX
HI_dataDX word ; data to pass back in DX
HI_dataBP word ; data to pass back in BP
HardIcon ends
;------------------------------------------------------------------------------
; Other constants
;------------------------------------------------------------------------------
PEN_GET_MODE equ 00h
PEN_SET_MODE equ 01h
PEN_GET_HANDLER equ 00h
PEN_SET_HANDLER equ 01h
PEN_MODE_DISABLE equ 00h
PEN_MODE_ENABLE equ 01h
CasioPenStatus etype byte
CPS_PEN_SCAN enum CasioPenStatus, 00h
CPS_PEN_ON enum CasioPenStatus, 01h
CPS_PEN_OFF enum CasioPenStatus, 02h
CPS_RESERVED enum CasioPenStatus, 03h
CasioPenReturn etype byte
CPR_CONTINUE enum CasioPenReturn, 00h
CPR_DISCONTINUE enum CasioPenReturn, 01h
CasioPenCalibration etype byte
CPC_GET_CALIBRATION enum CasioPenCalibration, 00h
CPC_SET_CALIBRATION enum CasioPenCalibration, 01h
PenHistory struct
PH_status CasioPenStatus
PH_penX word
PH_penY word
PenHistory ends
BAD_MOUSE_COORDINATE enum FatalErrors
;------------------------------------------------------------------------------
; DEVICE STRINGS
;------------------------------------------------------------------------------
MouseExtendedInfoSeg segment lmem LMEM_TYPE_GENERAL
mouseExtendedInfo DriverExtendedInfoTable <
{}, ; lmem header added by Esp
length mouseNameTable, ; Number of supported devices
offset mouseNameTable,
offset mouseInfoTable
>
mouseNameTable lptr.char casioPenName
lptr.char 0 ; null-terminator
casioPenName chunk.char 'Zoomer Pen', 0
mouseInfoTable MouseExtendedInfo \
mask MEI_CALIBRATE ; can be calibrated
ForceRef mouseExtendedInfo
MouseExtendedInfoSeg ends
;------------------------------------------------------------------------------
; Variables
;------------------------------------------------------------------------------
idata segment
mouseRates label byte ; to avoid assembly errors
MOUSE_NUM_RATES equ 0
if RECORD_PEN_EVENTS
historyLoc word offset history
endif
idata ends
udata segment
oldHandler fptr.far ; old handler fptr
lastPosAdj Point ; last adjusted point
lastPosRaw Point ; last raw point
hardIconDown BooleanByte ; pen down in hard-icon area
if RECORD_PEN_EVENTS
history PenHistory 1000 dup (<>)
historyEnd label byte
endif
udata ends
Init segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseDevInit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initialize the device
CALLED BY: MouseSetDevice()
PASS: DS, ES = DGroup
RETURN: carry = set on error (s/b nothing)
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/4/92 Initial Revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseDevInit proc far
uses ax, bx, cx, dx, di, si
.enter
; Attempt to calibrate the digitizer based upon settings
; in the .INI file
;
mov cx, 4 ; # of calibration points
call ReadCalibrationDataFromIni
; Turn the pen scan off
;
mov bx, (PEN_SET_MODE shl 8) or PEN_MODE_DISABLE
CallCasio CPF_SET_PEN_MODE
; Set up the pen handler, saving the old one
;
mov bh, PEN_GET_HANDLER
CallCasio CPF_GET_PEN_HANDLER
movdw ds:[oldHandler], dxcx
mov bh, PEN_SET_HANDLER
mov dx, segment MouseDevHandler
mov cx, offset MouseDevHandler
CallCasio CPF_SET_PEN_HANDLER
; Turn the pen scan on
;
mov bx, (PEN_SET_MODE shl 8) or PEN_MODE_ENABLE
CallCasio CPF_SET_PEN_MODE
; Finally, position cursor in middle of screen
; (all buttons are up)
;
mov bh, MouseButtonBits<1,1,1,1>
mov cx, CASIO_DISPLAY_X / 2
mov dx, CASIO_DISPLAY_Y / 2
call MouseSendEventsFar
clc
.leave
ret
MouseDevInit endp
categoryString char "mouse", 0
keyString char "calibration", 0
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReadCalibrationDataFromIni
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read the calibration data from the .INI file, and reset
the calibration if valid values are found
CALLED BY: MouseDevInit
PASS: CX = # of points expected to be found
RETURN: Nothing
DESTROYED: AX, BX, CX, DX
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 4/17/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReadCalibrationDataFromIni proc near
uses di, si, bp, ds, es
.enter
; Read the data from the .INI file
;
mov bp, 100
sub sp, bp
segmov es, ss
mov di, sp
push cx
segmov ds, cs, cx
mov si, offset categoryString
mov dx, offset keyString
call InitFileReadData
; If error or if amount of data doesn't match, ignore
;
pop bp
jc done
shr cx, 2 ; 4 bytes per point
cmp cx, bp
jne done
; Else re-calibrate the digitzer
;
movdw dxsi, esdi ; point buffer => DX:SI
mov ax, CPF_SET_CALIBRATION_RESULTS or \
(CASIO_FUNCTION shl 8)
mov bh, CPC_SET_CALIBRATION
call CalibrationBIOSCommon
done:
add sp, 100
.leave
ret
ReadCalibrationDataFromIni endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WriteCalibrationDataToIni
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Write the calibration points to the .INI file
CALLED BY: MouseSetCalibrationPoints
PASS: DX:SI = Point buffer
CX = # of points
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 4/17/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
WriteCalibrationDataToIni proc far
uses cx, dx, bp, di, si, ds, es
.enter
movdw esdi, dxsi
shl cx, 2 ; each point is 4 bytes
mov bp, cx
segmov ds, cs, cx
mov si, offset categoryString
mov dx, offset keyString
call InitFileWriteData
.leave
ret
WriteCalibrationDataToIni endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CalibrationCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Either set or get the calibration data
CALLED BY: UTILITY
PASS: AX = BIOS function
BH = Sub-function
DX:SI = Buffer
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 4/17/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CalibrationBIOSCommon proc far
uses cx
.enter
mov cx, si ; point buffer => DX:CX
call SysLockBIOS
int CASIO_INTERRUPT
call SysUnlockBIOS
.leave
ret
CalibrationBIOSCommon endp
Init ends
Resident segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseDevExit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Clean up after ourselves
CALLED BY: MouseExit()
PASS: DS = DGroup
RETURN: carry = set on error
DESTROYED: AX, BX, CX, DX
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/4/92 Initial Revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseDevExit proc near
; Tell the pen to stop reporting
;
mov bx, (PEN_SET_MODE shl 8) or PEN_MODE_DISABLE
CallCasio CPF_SET_PEN_MODE
; Restore the previous handler
;
mov bh, PEN_SET_HANDLER
movdw dxcx, ds:[oldHandler]
CallCasio CPF_SET_PEN_HANDLER
clc
ret
MouseDevExit endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseTestDevice
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See if the device specified is present.
CALLED BY: DRE_TEST_DEVICE
PASS: dx:si = null-terminated name of device (ignored, here)
RETURN: ax = DevicePresent enum
carry set if string invalid, clear otherwise
DESTROYED: ax, bx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/4/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseTestDevice proc near
.enter
; Check the pen status
;
CallCasio CPF_READ_PEN_STATUS
mov ax, DP_NOT_PRESENT
cmp bl, 1
jae done ; if not 0 or 1, error
mov ax, DP_PRESENT
done:
clc
.leave
ret
MouseTestDevice endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseSetDevice
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Turn on the device.
CALLED BY: DRE_SET_DEVICE
PASS: dx:si = pointer to null-terminated device name string
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
Just call the device-initialization routine in Init
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/4/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseSetDevice proc near
call MouseDevInit
ret
MouseSetDevice endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseDevHandler
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Mouse handler routine to take the event and pass it to
MouseSendEvents()
CALLED BY: EXTERNAL (Pen BIOS)
PASS: AL = CasioPenStatus
(CX,DX) = Adjusted coordinate
(SI,DI) = Raw coordinate
RETURN: AL = CasioPenReturn
DESTROYED: AH, BX, CX, DX, DI, SI
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/4/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
inHandler byte 1
MouseDevHandler proc far
dec cs:inHandler
jns notInHandler
mov al, CPR_CONTINUE ; branch if already in routine
jmp endInterrupt ; & continue scan
notInHandler:
uses ds
.enter
; Pass the information on to the system
;
segmov ds, dgroup, bx ; dgroup => DS
and al, CPS_RESERVED ; clear high bits
cmp al, CPS_RESERVED
je discontinue ; if reserved, abort
cmp dx, CASIO_DISPLAY_Y
jg hardIconCheck ; if beyond length, do hard icon
screenEvent:
tst ds:[hardIconDown] ; if pen down in hard icon area
jnz done ; ...then no normal pen input
mov bh, 0xff ; assume mouse is up
cmp al, CPS_PEN_OFF ; check assumption
je penUp
mov bh, not (mask MOUSE_B0) ; else mark b0 down, others up
sendMouseEvent:
if RECORD_PEN_EVENTS
push si
mov si, ds:[historyLoc]
cmp si, offset historyEnd
je doneHistory
mov ds:[si].PH_status, al
mov ds:[si].PH_penX, cx
mov ds:[si].PH_penY, dx
add ds:[historyLoc], size PenHistory
doneHistory:
pop si
endif
push ax
call MouseSendEvents
pop ax
; We're done. Determine if pen scan should continue.
done:
cmp al, CPS_PEN_OFF ; if pen is not OFF, continue
mov al, CPR_CONTINUE ; assume that we continue
jne exit
discontinue:
mov ds:[hardIconDown], BB_FALSE
mov al, CPR_DISCONTINUE ; discontinue scan
exit:
.leave
endInterrupt:
inc cs:inHandler
ret
; Record pen position on pen-up, so we can avoid brain-dead
; BIOS bugs for when we want to query the pen position
; (needed for calibration)
penUp:
mov ds:[lastPosAdj].P_x, cx
mov ds:[lastPosAdj].P_y, dx
mov ds:[lastPosRaw].P_x, si
mov ds:[lastPosRaw].P_y, di
jmp sendMouseEvent
; Hard icon events may only be generated if the user
; starts the pen down in the hard icon area. Else, we
; just constrain the input to the screen
hardIconCheck:
cmp al, CPS_PEN_ON
je hardIconEvent
tst ds:[hardIconDown]
jz screenEvent
; Deal with events in the hard icon area. Each area is
; 256 / 10 = 25.6 = 26 pixels wide. We make the leftmost
; & rightmost icons two pixels smaller than the rest
hardIconEvent:
mov ds:[hardIconDown], BB_TRUE
cmp al, CPS_PEN_OFF
jne done ; if not PEN_OFF, do nothing
mov ds:[hardIconDown], BB_FALSE
mov di, offset hardIconTableEnd
tableLoop:
sub di, (size HardIcon)
cmp cx, cs:[di].HI_leftEdge
jl tableLoop
; Found the correct hard icon - send off the message
;
mov ax, MSG_META_NOTIFY
mov bx, ds:[mouseOutputHandle]
mov cx, cs:[di].HI_dataCX
mov dx, cs:[di].HI_dataDX
mov bp, cs:[di].HI_dataBP
mov di, mask MF_FORCE_QUEUE
call ObjMessage
jmp discontinue
MouseDevHandler endp
hardIconTable HardIcon < \
8000h,
MANUFACTURER_ID_GEOWORKS,
GWNT_HARD_ICON_BAR_FUNCTION,
HIBF_TOGGLE_EXPRESS_MENU
>, < \
24,
MANUFACTURER_ID_GEOWORKS,
GWNT_STARTUP_INDEXED_APP,
0
>, < \
50,
MANUFACTURER_ID_GEOWORKS,
GWNT_STARTUP_INDEXED_APP,
1
>, < \
76,
MANUFACTURER_ID_GEOWORKS,
GWNT_STARTUP_INDEXED_APP,
2
>, < \
102,
MANUFACTURER_ID_GEOWORKS,
GWNT_STARTUP_INDEXED_APP,
3
>, < \
128,
MANUFACTURER_ID_GEOWORKS,
GWNT_STARTUP_INDEXED_APP,
4
>, < \
154,
MANUFACTURER_ID_GEOWORKS,
GWNT_STARTUP_INDEXED_APP,
5
>, < \
180,
MANUFACTURER_ID_GEOWORKS,
GWNT_HARD_ICON_BAR_FUNCTION,
HIBF_TOGGLE_MENU_BAR
>, < \
206,
MANUFACTURER_ID_GEOWORKS,
GWNT_HARD_ICON_BAR_FUNCTION,
HIBF_DISPLAY_FLOATING_KEYBOARD
>, < \
232,
MANUFACTURER_ID_GEOWORKS,
GWNT_HARD_ICON_BAR_FUNCTION,
HIBF_DISPLAY_HELP
>
hardIconTableEnd label byte
ForceRef hardIconTable
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseGetCalibrationPoints
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the calibration points for the current device
CALLED BY: MouseStrategy
PASS: DX:SI = Buffer holding up to MAX_NUM_CALIBRATION_POINTS
calibration points
RETURN: DX:SI = Buffer filled with calibration points
CX = # of calibration points
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 12/15/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseGetCalibrationPoints proc near
uses ax
.enter
; Call BIOS, asking for points
;
mov ax, CPF_GET_CALIBRATION_POINTS or (CASIO_FUNCTION shl 8)
call CalibrationBIOSCommon
mov cx, 4 ; 4 points were returned
.leave
ret
MouseGetCalibrationPoints endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseSetCalibrationPoints
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the calibration points for the current device
CALLED BY: MouseStrategy
PASS: DX:SI = Buffer holding up the calibration points
CX = # of calibration points
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 12/15/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseSetCalibrationPoints proc near
uses ax, bx
.enter
; Call BIOS, asking for points
;
mov ax, CPF_SET_CALIBRATION_RESULTS or \
(CASIO_FUNCTION shl 8)
mov bh, CPC_SET_CALIBRATION
call CalibrationBIOSCommon
call WriteCalibrationDataToIni
.leave
ret
MouseSetCalibrationPoints endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseGetRawCoordinate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the current calibrated & non-calibrated coordinate
CALLED BY: MouseStrategy
PASS: Nothing
RETURN: (AX,BX) = raw (uncalibrated) coordinate
(CX,DX) = adjusted (calibrated) coordinate
Carry = Clear (point returned)
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 12/15/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseGetRawCoordinate proc near
uses di, si
.enter
; Lock down BIOS, make the call, and return
;
call SysLockBIOS
CallCasio CPF_READ_PEN_STATUS
tst bl
jz penOff
movdw axbx, sidi ; raw Point => (AX, BX)
done:
call SysUnlockBIOS
clc ; point always returned
.leave
ret
; Pen is off the screen - return the last coordinate
penOff:
mov ax, ds:[lastPosRaw].P_x
mov bx, ds:[lastPosRaw].P_y
mov cx, ds:[lastPosAdj].P_x
mov dx, ds:[lastPosAdj].P_y
jmp done
MouseGetRawCoordinate endp
MouseSendEventsFar proc far
call MouseSendEvents
ret
MouseSendEventsFar endp
Resident ends
end
|
libsrc/_DEVELOPMENT/adt/b_vector/c/sccz80/b_vector_read_block_callee.asm | teknoplop/z88dk | 8 | 99959 | <reponame>teknoplop/z88dk
; size_t b_vector_read_block(void *dst, size_t n, b_vector_t *v, size_t idx)
SECTION code_clib
SECTION code_adt_b_vector
PUBLIC b_vector_read_block_callee
EXTERN b_array_read_block_callee
defc b_vector_read_block_callee = b_array_read_block_callee
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48.log_21829_2342.asm | ljhsiun2/medusa | 9 | 171970 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r15
push %r8
push %rax
push %rbx
lea addresses_normal_ht+0x4e7d, %r15
nop
nop
nop
sub $34827, %r10
mov (%r15), %eax
nop
add $19724, %r11
lea addresses_D_ht+0x477d, %r15
nop
nop
add $55906, %r8
mov $0x6162636465666768, %rbx
movq %rbx, %xmm2
movups %xmm2, (%r15)
sub $37085, %r15
lea addresses_D_ht+0x5029, %r11
nop
nop
nop
nop
and %r12, %r12
movw $0x6162, (%r11)
nop
nop
nop
nop
nop
add %r11, %r11
lea addresses_D_ht+0x13b99, %r8
xor $258, %rbx
vmovups (%r8), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %r12
nop
add $57295, %r12
lea addresses_normal_ht+0x98bd, %r11
nop
nop
nop
xor $61789, %r10
movb $0x61, (%r11)
nop
nop
nop
nop
nop
and %r10, %r10
lea addresses_normal_ht+0x4285, %rbx
nop
nop
nop
nop
nop
inc %rax
movw $0x6162, (%rbx)
nop
xor $17643, %r8
pop %rbx
pop %rax
pop %r8
pop %r15
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %rbp
push %rbx
push %rcx
// Store
mov $0x3ecc760000000305, %r12
nop
nop
inc %r13
movw $0x5152, (%r12)
nop
nop
nop
nop
and %r13, %r13
// Store
mov $0xb51, %rbx
nop
nop
and %r12, %r12
mov $0x5152535455565758, %r13
movq %r13, (%rbx)
nop
add %r12, %r12
// Faulty Load
lea addresses_US+0x16f7d, %rbp
nop
nop
nop
nop
nop
add $21511, %rcx
mov (%rbp), %r13w
lea oracles, %rbx
and $0xff, %r13
shlq $12, %r13
mov (%rbx,%r13,1), %r13
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 1, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 2, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': True}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
PRG/levels/Giant/4-2.asm | narfman0/smb3_pp1 | 0 | 15866 | ; Original address was $B067
; 4-2
.word W504_EndL ; Alternate level layout
.word W504_EndO ; Alternate object layout
.byte LEVEL1_SIZE_08 | LEVEL1_YSTART_140
.byte LEVEL2_BGPAL_00 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18 | LEVEL2_UNUSEDFLAG
.byte LEVEL3_TILESET_11 | LEVEL3_VSCROLL_LOCKLOW | LEVEL3_PIPENOTEXIT
.byte LEVEL4_BGBANK_INDEX(11) | LEVEL4_INITACT_NOTHING
.byte LEVEL5_BGM_ATHLETIC | LEVEL5_TIME_300
.byte $17, $00, $62, $15, $08, $83, $16, $10, $82, $17, $16, $81, $16, $1B, $82, $14
.byte $21, $84, $15, $28, $40, $17, $28, $60, $16, $2D, $82, $53, $21, $E2, $55, $2A
.byte $42, $11, $30, $10, $55, $30, $47, $17, $38, $60, $14, $3C, $84, $35, $43, $40
.byte $36, $43, $40, $37, $43, $40, $38, $43, $40, $32, $44, $10, $33, $44, $10, $34
.byte $44, $10, $35, $44, $10, $36, $44, $10, $37, $44, $10, $38, $44, $10, $56, $45
.byte $08, $37, $45, $40, $38, $45, $40, $55, $4A, $45, $31, $4A, $02, $32, $4A, $13
.byte $16, $47, $84, $14, $50, $84, $55, $53, $45, $55, $5C, $46, $33, $54, $13, $32
.byte $5E, $12, $16, $59, $82, $32, $58, $80, $33, $58, $80, $34, $58, $80, $32, $62
.byte $80, $33, $62, $80, $34, $62, $80, $10, $65, $10, $55, $66, $47, $16, $63, $82
.byte $13, $6E, $60, $15, $6E, $60, $17, $6E, $60, $34, $70, $44, $15, $7A, $61, $73
.byte $7B, $62, $01, $7E, $60, $03, $7E, $60, $05, $7E, $60, $07, $7E, $60, $09, $7E
.byte $60, $0B, $7E, $60, $0D, $7E, $60, $0F, $7E, $60, $11, $7E, $60, $13, $7E, $60
.byte $15, $7E, $60, $17, $7E, $60, $19, $7E, $60, $59, $00, $81, $80, $E7, $73, $20
.byte $FF
|
source/streams/a-sostio.ads | ytomino/drake | 33 | 23792 | pragma License (Unrestricted);
-- extended unit
with System.Storage_Elements;
package Ada.Streams.Overlaps_Storage_IO is
-- Overlapping stream access to existing memory.
pragma Preelaborate;
pragma Compile_Time_Error (
Standard'Storage_Unit /= Stream_Element'Size,
"this is not 8-bit machine.");
type Overlay (<>) is limited private;
function Create (
Address : System.Address;
Size : System.Storage_Elements.Storage_Count)
return Overlay;
procedure Reset (Object : in out Overlay);
function Stream (Object : Overlay)
return not null access Root_Stream_Type'Class;
pragma Inline (Stream);
-- Note: Write propagates Storage_Error if overflow.
private
type Overlay is limited new Seekable_Stream_Type with record
Address : System.Address;
Size : System.Storage_Elements.Storage_Count;
Index : System.Storage_Elements.Storage_Offset := 1;
end record;
overriding procedure Read (
Object : in out Overlay;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset);
overriding procedure Write (
Object : in out Overlay;
Item : Stream_Element_Array);
overriding procedure Set_Index (
Object : in out Overlay;
To : Stream_Element_Positive_Count);
overriding function Index (Object : Overlay)
return Stream_Element_Positive_Count;
overriding function Size (Object : Overlay)
return Stream_Element_Count;
end Ada.Streams.Overlaps_Storage_IO;
|
Task/Count-in-factors/Ada/count-in-factors.ada | LaudateCorpus1/RosettaCodeData | 1 | 11029 | <reponame>LaudateCorpus1/RosettaCodeData<gh_stars>1-10
with Ada.Command_Line, Ada.Text_IO, Prime_Numbers;
procedure Count is
package Prime_Nums is new Prime_Numbers
(Number => Natural, Zero => 0, One => 1, Two => 2); use Prime_Nums;
procedure Put (List : Number_List) is
begin
for Index in List'Range loop
Ada.Text_IO.Put (Integer'Image (List (Index)));
if Index /= List'Last then
Ada.Text_IO.Put (" x");
end if;
end loop;
end Put;
N : Natural := 1;
Max_N : Natural := 15; -- the default for Max_N
begin
if Ada.Command_Line.Argument_Count = 1 then -- read Max_N from command line
Max_N := Integer'Value (Ada.Command_Line.Argument (1));
end if; -- else use the default
loop
Ada.Text_IO.Put (Integer'Image (N) & ": ");
Put (Decompose (N));
Ada.Text_IO.New_Line;
N := N + 1;
exit when N > Max_N;
end loop;
end Count;
|
oeis/112/A112850.asm | neoneye/loda-programs | 11 | 171209 | <reponame>neoneye/loda-programs
; A112850: Number of graph endomorphisms of undirected cycles of even length: |End(C_2n)|.
; Submitted by <NAME>(s2)
; 2,32,132,576,2540,11112,48076,205952,875196,3695160,15519548,64899792,270415652,1123264856,4653525660,19234572544,79342611548,326704870872,1343120024476,5513861152880,22606830726564,92580354403768,378737813469692,1547884976788896,6320530321887700,25787763713301512,105134728984998156,428326673642584752,1743901456973380436,7095874893891685560,28856557901826187580,117287945020325794304,476482276645073538972,1934806820316359218456,7853039447166399180380,31860902899932248102832
add $0,2
mov $1,$0
mul $0,2
sub $0,2
bin $0,$1
min $1,$0
add $0,2
mul $1,$0
mov $0,$1
sub $0,2
mul $0,2
|
src/BasicIO.agda | cruhland/agda-editor | 0 | 11393 | <filename>src/BasicIO.agda
module BasicIO where
open import Agda.Builtin.IO public
open import Data.Char
open import Data.List
{-# FOREIGN GHC import Control.Exception #-}
{-# FOREIGN GHC import System.Environment #-}
-- This is easier than using the IO functions in the standard library,
-- but it's technically not as type-safe. And it bypasses the
-- termination checker.
postulate
return : {A : Set} → A → IO A
_>>_ : {A B : Set} → IO A → IO B → IO B
_>>=_ : {A B : Set} → IO A → (A → IO B) → IO B
fail : {A : Set} → List Char → IO A
bracket : {A B C : Set} → IO A → (A → IO B) → (A → IO C) → IO C
getArgs : IO (List (List Char))
{-# COMPILE GHC return = \_ -> return #-}
{-# COMPILE GHC _>>_ = \_ _ -> (>>) #-}
{-# COMPILE GHC _>>=_ = \_ _ -> (>>=) #-}
{-# COMPILE GHC fail = \_ -> fail #-}
{-# COMPILE GHC bracket = \ _ _ _ -> bracket #-}
{-# COMPILE GHC getArgs = getArgs #-}
|
cql/src/main/java/com/huawei/streaming/cql/semanticanalyzer/parser/Identifiers.g4 | chenqixu/StreamCQL | 8 | 1641 | /**
* 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.
*/
/*
* CQL中的一些关键性词法定义
*/
parser grammar Identifiers;
/**
* 由于担心语法冲突或者其他导致别名失效等原因,暂时只修改函数名称相关
* 即只修改函数名称中包含的这些关键字。
* KW_UNIDIRECTION
*/
cqlIdentifier
: KW_DAY
| KW_HOUR
| KW_MINUTES
| KW_SECONDS
| KW_MILLISECONDS
| KW_BOOLEAN
| KW_INT
| KW_LONG
| KW_FLOAT
| KW_DOUBLE
| KW_STRING
| KW_TIMESTAMP
| KW_DATE
| KW_TIME
| KW_DECIMAL
| KW_OPERATOR
| Identifier
;
packageNameIdentifier
: cqlIdentifier (DOT cqlIdentifier)*
;
streamProperties
: KW_PROPERTIES LPAREN streamPropertiesList RPAREN
;
confName
: StringLiteral
| packageNameIdentifier
;
/*
配置属性的值只能是字符串类型,
不支持其他类型
*/
confValue
: StringLiteral
;
strValue
: StringLiteral
;
/*
位操作符
正,负等操作符号
*/
unaryOperator
: PLUS
| MINUS
| TILDE
;
functionName
: cqlIdentifier
;
windowName
: cqlIdentifier
;
className
: innerClassName
| userDefinedClassName
;
innerClassName
: packageNameIdentifier
;
userDefinedClassName
: StringLiteral
;
path
: StringLiteral
;
applicationName
: cqlIdentifier
| constIntegerValue
;
columnName
: cqlIdentifier
;
isForce
: KW_FORCE
;
ifExists
: KW_IF KW_EXISTS
;
ifNotExists
: KW_IF KW_NOT KW_EXISTS
;
streamName
: cqlIdentifier
;
dataSourceName
: cqlIdentifier
;
streamAlias
: cqlIdentifier
;
streamNameOrAlias
: cqlIdentifier
;
columnALias
: cqlIdentifier
;
constNull
: KW_NULL
;
extended
: KW_EXTENDED
;
identifierNot
: KW_NOT
;
nullCondition
: identifierNot? KW_NULL
;
operatorName
: cqlIdentifier
;
|
asm/fpga_bootloader.asm | FKD13/RCPU | 17 | 2026 | .text
.global main:
; (blocking) reads one char from uart to the D register
; pollutes A, B, C, D
; needs 1 stack space
uart_read_char:
; push address of misc.in (which contains if uart is writeable/readable), and read option
LDV B, (0b110)
PSH B
SYS
; pop read value in B
POP B
; get second-to-last bit: AND with 2
LDV A, 2
AND A, B
; if A now contains 2, that means we can read from uart
LDV C, uart_read_char:
LDV B, 2
; if A == 0, then A < B and we will retry
JLT B, C
; read from uart to D register
LDV A, (0b1010)
PSH A
SYS
POP D
RET
; (blocking) write the D register to uart
; pollutes A, B, C
; needs 2 stack space
uart_send_char:
LDV B, (0b110)
PSH B
SYS
; pop read value in B
POP B
; get last bit: AND with 1
LDV A, 1
AND A, B
; if A now contains 1, that means we can write to uart
LDV C, uart_send_char:
LDV B, 1
; if A == 0, then A < B and we will retry
JLT B, C
; else write to uart
PSH D
LDV A, (0b1001)
PSH A
SYS
RET
; blocking, reads two chars from uart into a 16-bit value into the D register
; the first character is the most significant byte, the second character the least
; pollutes A, B, C, D
read_16_bits_from_uart:
LDV A, uart_read_char:
CAL A
; D contains the first 8 bits of the address, shift it and push it onto the stack
LSH D, 7
LSH D, 1
PSH D
LDV A, uart_read_char:
CAL A
; D now contains the last 8 bits of the address
POP C
; C now contains the first 8 bits of the address
OR D, C
; now D contains the full address
RET
main:
; send a single '>'
LDV A, uart_send_char:
LDV D, 62
CAL A
LDV A, read_16_bits_from_uart:
CAL A
; push the address onto the stack
PSH D
LDV A, read_16_bits_from_uart:
CAL A
; the value to load is now in the D register
POP C
LDP C, D
; The first ever instruction will be a jump to main
; this makes it easy to transfer control flow to the now-loaded program:
; you just need to overwrite the jump in address 0 with a jump to your loaded program
JMP 0
|
libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sdcc_iy/wa_priority_queue_data_fastcall.asm | jpoikela/z88dk | 640 | 174726 | <filename>libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sdcc_iy/wa_priority_queue_data_fastcall.asm
; void *wa_priority_queue_data_fastcall(wa_priority_queue_t *q)
SECTION code_clib
SECTION code_adt_wa_priority_queue
PUBLIC _wa_priority_queue_data_fastcall
EXTERN asm_wa_priority_queue_data
defc _wa_priority_queue_data_fastcall = asm_wa_priority_queue_data
|
src/main/antlr/BibLexer.g4 | vlsergey/tex2html | 0 | 2634 | lexer grammar BibLexer ;
@header {
package com.github.vlsergey.tex2html.grammar;
}
CURLY_BRACKET_OPEN : '{' ;
CURLY_BRACKET_CLOSE : '}' ;
AT : '@' ;
COMMA : ',' ;
EQUAL : '=' ;
AND : ' and ' ;
ALPHANUMERIC : [a-zA-Z0-9]+ ;
ETC : ~[a-zA-Z0-9={}@, \t\r\n]+ ;
SPACES : [ \t\r\n]+ ;
|
school2/8B/mid1.asm | momomeomo/School | 0 | 103059 | INCLUDE asmlib.inc
.data
prompt byte "How many numbers to enter: ",0
sump byte "The sum of the ",0
sumx byte " values is ",0
counter DWORD 0
sum DWORD 0
.code
main PROC
;//sets all registers to 0
mov edx, 0
mov ecx, 0
mov eax, 0
mov ebx, 0
mov ah, 0
mov ax, 0
mov al, 0
mov edx, offset prompt
call writeline
call readint
mov ecx, eax
mov counter, eax
l1:
mov eax, 0
call readint
add sum, eax
loop l1
mov edx, offset sump
call writestring
mov eax, counter
call writeint
mov edx, offset sumx
call writestring
mov eax, sum
call writeint
main ENDP
END main |
test/Compiler/simple/Issue561.agda | alhassy/agda | 4 | 4585 | <filename>test/Compiler/simple/Issue561.agda
module Issue561 where
open import Common.Prelude hiding (primIsDigit)
primitive
primIsDigit : Char → Bool
main : IO Bool
main = return true
|
lab07/demo/demo.asm | adinasm/iocla-demos | 0 | 87759 | <reponame>adinasm/iocla-demos
%include "../../utils/printf32.asm"
struc demo_struct
.num: resw 1
name: resb 20
endstruc
struc another_struct
x: resd 3
y: resb 1
z: resw 12
.num: resb 1
endstruc
section .data
array dw 12, 3, 45, 1, 24, 17, 5, 6, 9, 10
arr2 times 5 dw 12
len equ 10
struct_instance:
istruc demo_struct
at demo_struct.num, dw 0x1234
at name, db "pclp", 0 ; 'p', 'c', 'l', 'p', 0
iend
section .bss
number resd 1
section .text
extern printf
global main
main:
push ebp
mov ebp, esp
PRINTF32 `num = %d\n\x0`, demo_struct.num
PRINTF32 `name = %d\n\x0`, name
PRINTF32 `x = %d\n\x0`, x
PRINTF32 `y = %d\n\x0`, y
PRINTF32 `z = %d\n\x0`, z
PRINTF32 `struct_instance.num = 0x%hx\n\x0`, [struct_instance]
PRINTF32 `struct_instance.num = 0x%hx\n\x0`, [struct_instance + demo_struct.num]
PRINTF32 `struct_instance.num = 0x%hx\n\x0`, [struct_instance + x]
PRINTF32 `struct_instance.name = %c\n\x0`, [struct_instance + name]
PRINTF32 `struct_instance.name = %s\n\x0`, struct_instance + name
mov word [struct_instance + demo_struct.num], 0x5678
PRINTF32 `struct_instance.num = 0x%hx\n\x0`, [struct_instance + demo_struct.num]
mov byte [struct_instance + name], 'b'
mov byte [struct_instance + name + 1], 'u'
mov byte [struct_instance + name + 2], 'n'
mov byte [struct_instance + name + 3], 'a'
PRINTF32 `struct_instance.name = %s\n\x0`, struct_instance + name
mov dword [struct_instance + name], "bruh"
PRINTF32 `struct_instance.name = %s\n\x0`, struct_instance + name
mov ecx, demo_struct_size
xor ecx, ecx
print_struct:
cmp ecx, demo_struct_size
jz print_struct_end
PRINTF32 `struct_instance[%d] = 0x%hhx\n\x0`, ecx, [struct_instance + ecx]
inc ecx
jmp print_struct
print_struct_end:
mov ecx, len
xor eax, eax
add_odd:
mov ebx, [array + ecx * 2 - 2]
test ebx, 1
jz skip_even
PRINTF32 `arr[%d] = %hd\n\x0`, ecx, ebx
add eax, ebx
skip_even:
loop add_odd
PRINTF32 `sum = %hd\n\x0`, eax
mov dx, 0
mov ax, 37
mov bx, 5
div bx
PRINTF32 `C = %hd\n\x0`, eax
PRINTF32 `R = %hd\n\x0`, edx
mov ecx, 5
arr2_loop:
mov ebx, [arr2 + ecx * 2 - 2]
PRINTF32 `arr2[%d] = %hd\n\x0`, ecx, ebx
loop arr2_loop
xor eax, eax
leave
ret
|
src/Groupoid.agda | nad/equality | 3 | 3118 | ------------------------------------------------------------------------
-- Groupoids
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Equality
module Groupoid
{reflexive} (eq : ∀ {a p} → Equality-with-J a p reflexive) where
open import Prelude hiding (id; _∘_; _^_)
open import Bijection eq hiding (id; _∘_)
open Derived-definitions-and-properties eq
open import Integer.Basics eq as Int using (ℤ; +_; -[1+_])
import Nat eq as Nat
private
variable
a : Level
A : Type a
w x y z : A
n : ℕ
j : ℤ
-- Groupoids using _≡_ as the underlying equality.
record Groupoid o ℓ : Type (lsuc (o ⊔ ℓ)) where
infix 8 _⁻¹
infixr 7 _∘_
infix 4 _∼_
field
Object : Type o
_∼_ : Object → Object → Type ℓ
id : x ∼ x
_∘_ : y ∼ z → x ∼ y → x ∼ z
_⁻¹ : x ∼ y → y ∼ x
left-identity : (p : x ∼ y) → id ∘ p ≡ p
right-identity : (p : x ∼ y) → p ∘ id ≡ p
assoc : (p : y ∼ z) (q : x ∼ y) (r : w ∼ x) →
p ∘ (q ∘ r) ≡ (p ∘ q) ∘ r
left-inverse : (p : x ∼ y) → p ⁻¹ ∘ p ≡ id
right-inverse : (p : x ∼ y) → p ∘ p ⁻¹ ≡ id
-- Note that this definition should perhaps contain more coherence
-- properties: we have not assumed that _≡_ is proof-irrelevant.
private
variable
p p₁ p₂ q q₁ q₂ r : x ∼ y
-- Some derived properties.
abstract
-- The identity is an identity for the inverse operator as well.
identity : id {x = x} ⁻¹ ≡ id
identity =
id ⁻¹ ≡⟨ sym $ right-identity (id ⁻¹) ⟩
id ⁻¹ ∘ id ≡⟨ left-inverse id ⟩∎
id ∎
-- If p is idempotent with respect to _∘_, then p is equal to the
-- identity element.
idempotent⇒≡id : p ∘ p ≡ p → p ≡ id
idempotent⇒≡id {p = p} p∘p≡p =
p ≡⟨ sym $ left-identity _ ⟩
id ∘ p ≡⟨ cong (_∘ _) $ sym $ left-inverse _ ⟩
(p ⁻¹ ∘ p) ∘ p ≡⟨ sym $ assoc _ _ _ ⟩
p ⁻¹ ∘ (p ∘ p) ≡⟨ cong (p ⁻¹ ∘_) p∘p≡p ⟩
p ⁻¹ ∘ p ≡⟨ left-inverse _ ⟩∎
id ∎
-- Groupoids are left-cancellative and right-cancellative.
left-cancellative :
p ∘ q₁ ≡ p ∘ q₂ → q₁ ≡ q₂
left-cancellative {p = p} {q₁ = q₁} {q₂ = q₂} p∘q₁≡p∘q₂ =
q₁ ≡⟨ sym $ left-identity _ ⟩
id ∘ q₁ ≡⟨ cong (_∘ _) $ sym $ left-inverse _ ⟩
(p ⁻¹ ∘ p) ∘ q₁ ≡⟨ sym $ assoc _ _ _ ⟩
p ⁻¹ ∘ (p ∘ q₁) ≡⟨ cong (p ⁻¹ ∘_) p∘q₁≡p∘q₂ ⟩
p ⁻¹ ∘ (p ∘ q₂) ≡⟨ assoc _ _ _ ⟩
(p ⁻¹ ∘ p) ∘ q₂ ≡⟨ cong (_∘ _) $ left-inverse _ ⟩
id ∘ q₂ ≡⟨ left-identity _ ⟩∎
q₂ ∎
right-cancellative :
p₁ ∘ q ≡ p₂ ∘ q → p₁ ≡ p₂
right-cancellative {p₁ = p₁} {q = q} {p₂ = p₂} p₁∘q≡p₂∘q =
p₁ ≡⟨ sym $ right-identity _ ⟩
p₁ ∘ id ≡⟨ cong (_ ∘_) $ sym $ right-inverse _ ⟩
p₁ ∘ (q ∘ q ⁻¹) ≡⟨ assoc _ _ _ ⟩
(p₁ ∘ q) ∘ q ⁻¹ ≡⟨ cong (_∘ q ⁻¹) p₁∘q≡p₂∘q ⟩
(p₂ ∘ q) ∘ q ⁻¹ ≡⟨ sym $ assoc _ _ _ ⟩
p₂ ∘ (q ∘ q ⁻¹) ≡⟨ cong (_ ∘_) $ right-inverse _ ⟩
p₂ ∘ id ≡⟨ right-identity _ ⟩∎
p₂ ∎
-- The inverse operator is involutive.
involutive : (p : x ∼ y) → p ⁻¹ ⁻¹ ≡ p
involutive p =
p ⁻¹ ⁻¹ ≡⟨ sym $ right-identity (p ⁻¹ ⁻¹) ⟩
p ⁻¹ ⁻¹ ∘ id ≡⟨ sym $ cong (_∘_ (p ⁻¹ ⁻¹)) (left-inverse p) ⟩
p ⁻¹ ⁻¹ ∘ (p ⁻¹ ∘ p) ≡⟨ assoc _ _ _ ⟩
(p ⁻¹ ⁻¹ ∘ p ⁻¹) ∘ p ≡⟨ cong (λ q → q ∘ p) (left-inverse (p ⁻¹)) ⟩
id ∘ p ≡⟨ left-identity p ⟩∎
p ∎
-- A lemma that can be used to move something from one side of an
-- equality to the other.
⁻¹∘≡→≡∘ : p ⁻¹ ∘ q ≡ r → q ≡ p ∘ r
⁻¹∘≡→≡∘ {p = p} {q = q} {r = r} hyp =
q ≡⟨ sym $ left-identity _ ⟩
id ∘ q ≡⟨ cong (_∘ _) $ sym $ right-inverse _ ⟩
(p ∘ p ⁻¹) ∘ q ≡⟨ sym $ assoc _ _ _ ⟩
p ∘ (p ⁻¹ ∘ q) ≡⟨ cong (_ ∘_) hyp ⟩∎
p ∘ r ∎
-- A corollary.
⁻¹∘≡id→≡ : p ⁻¹ ∘ q ≡ id → q ≡ p
⁻¹∘≡id→≡ {p = p} {q = q} hyp =
q ≡⟨ ⁻¹∘≡→≡∘ hyp ⟩
p ∘ id ≡⟨ right-identity _ ⟩∎
p ∎
-- Another lemma that can be used to move something from one side
-- of an equality to the other.
∘⁻¹≡→≡∘ : p ∘ q ⁻¹ ≡ r → p ≡ r ∘ q
∘⁻¹≡→≡∘ {p = p} {q = q} {r = r} hyp =
p ≡⟨ sym $ right-identity _ ⟩
p ∘ id ≡⟨ cong (_ ∘_) $ sym $ left-inverse _ ⟩
p ∘ (q ⁻¹ ∘ q) ≡⟨ assoc _ _ _ ⟩
(p ∘ q ⁻¹) ∘ q ≡⟨ cong (_∘ _) hyp ⟩∎
r ∘ q ∎
-- A corollary.
∘⁻¹≡id→≡ : p ∘ q ⁻¹ ≡ id → p ≡ q
∘⁻¹≡id→≡ {p = p} {q = q} hyp =
p ≡⟨ ∘⁻¹≡→≡∘ hyp ⟩
id ∘ q ≡⟨ left-identity _ ⟩∎
q ∎
-- A lemma relating _∘_ and _⁻¹.
∘⁻¹ : (p ∘ q) ⁻¹ ≡ q ⁻¹ ∘ p ⁻¹
∘⁻¹ {p = p} {q = q} = right-cancellative
((p ∘ q) ⁻¹ ∘ (p ∘ q) ≡⟨ left-inverse _ ⟩
id ≡⟨ sym $ left-inverse _ ⟩
q ⁻¹ ∘ q ≡⟨ cong (q ⁻¹ ∘_) $ sym $ left-identity _ ⟩
q ⁻¹ ∘ (id ∘ q) ≡⟨ cong (q ⁻¹ ∘_) $ cong (_∘ _) $ sym $ left-inverse _ ⟩
q ⁻¹ ∘ ((p ⁻¹ ∘ p) ∘ q) ≡⟨ cong (q ⁻¹ ∘_) $ sym $ assoc _ _ _ ⟩
q ⁻¹ ∘ (p ⁻¹ ∘ (p ∘ q)) ≡⟨ assoc _ _ _ ⟩∎
(q ⁻¹ ∘ p ⁻¹) ∘ (p ∘ q) ∎)
-- If p ∘ q is equal to id, then q is equal to p ⁻¹.
⁻¹-unique-right : p ∘ q ≡ id → q ≡ p ⁻¹
⁻¹-unique-right {p = p} {q = q} ∘≡id = ⁻¹∘≡id→≡
(p ⁻¹ ⁻¹ ∘ q ≡⟨ cong (_∘ _) $ involutive _ ⟩
p ∘ q ≡⟨ ∘≡id ⟩∎
id ∎)
-- If p ∘ q is equal to id, then p is equal to q ⁻¹.
⁻¹-unique-left : p ∘ q ≡ id → p ≡ q ⁻¹
⁻¹-unique-left {p = p} {q = q} ∘≡id = ∘⁻¹≡id→≡
(p ∘ q ⁻¹ ⁻¹ ≡⟨ cong (_ ∘_) $ involutive _ ⟩
p ∘ q ≡⟨ ∘≡id ⟩∎
id ∎)
-- The inverse operator is a bijection.
⁻¹-bijection : x ∼ y ↔ y ∼ x
⁻¹-bijection = record
{ surjection = record
{ logical-equivalence = record
{ to = _⁻¹
; from = _⁻¹
}
; right-inverse-of = involutive
}
; left-inverse-of = involutive
}
-- Exponentiation.
infixl 8 _^+_
infixr 8 _^_
_^+_ : x ∼ x → ℕ → x ∼ x
p ^+ 0 = id
p ^+ suc n = p ∘ p ^+ n
_^_ : x ∼ x → ℤ → x ∼ x
p ^ + n = p ^+ n
p ^ -[1+ n ] = (p ⁻¹) ^+ suc n
-- _^+_ is homomorphic with respect to _∘_/_+_.
^+∘^+ : ∀ m → p ^+ m ∘ p ^+ n ≡ p ^+ (m + n)
^+∘^+ {p = p} {n = n} zero =
id ∘ p ^+ n ≡⟨ left-identity _ ⟩∎
p ^+ n ∎
^+∘^+ {p = p} {n = n} (suc m) =
(p ∘ p ^+ m) ∘ p ^+ n ≡⟨ sym $ assoc _ _ _ ⟩
p ∘ (p ^+ m ∘ p ^+ n) ≡⟨ cong (_ ∘_) $ ^+∘^+ m ⟩∎
p ∘ p ^+ (m + n) ∎
-- Some rearrangement lemmas for _^+_.
∘^+≡^+∘ :
p ∘ q ≡ q ∘ p →
∀ n → p ∘ q ^+ n ≡ q ^+ n ∘ p
∘^+≡^+∘ {p = p} _ zero =
p ∘ id ≡⟨ right-identity _ ⟩
p ≡⟨ sym $ left-identity _ ⟩∎
id ∘ p ∎
∘^+≡^+∘ {p = p} {q = q} comm (suc n) =
p ∘ (q ∘ q ^+ n) ≡⟨ assoc _ _ _ ⟩
(p ∘ q) ∘ q ^+ n ≡⟨ cong (_∘ q ^+ n) comm ⟩
(q ∘ p) ∘ q ^+ n ≡⟨ sym $ assoc _ _ _ ⟩
q ∘ (p ∘ q ^+ n) ≡⟨ cong (q ∘_) $ ∘^+≡^+∘ comm n ⟩
q ∘ (q ^+ n ∘ p) ≡⟨ assoc _ _ _ ⟩∎
(q ∘ q ^+ n) ∘ p ∎
^+∘^+≡^+∘^+ : ∀ m n → p ^+ m ∘ p ^+ n ≡ p ^+ n ∘ p ^+ m
^+∘^+≡^+∘^+ {p = p} m n =
p ^+ m ∘ p ^+ n ≡⟨ ^+∘^+ m ⟩
p ^+ (m + n) ≡⟨ cong (p ^+_) $ Nat.+-comm m ⟩
p ^+ (n + m) ≡⟨ sym $ ^+∘^+ n ⟩∎
p ^+ n ∘ p ^+ m ∎
private
-- Some lemmas which are used to define ^∘^ below.
lemma₁ : ∀ n → (p ∘ p ^+ n) ∘ (p ⁻¹ ∘ q) ≡ p ^+ n ∘ q
lemma₁ {p = p} {q = q} n =
(p ∘ p ^+ n) ∘ (p ⁻¹ ∘ q) ≡⟨ cong (_∘ (p ⁻¹ ∘ q)) $ ∘^+≡^+∘ (refl _) n ⟩
(p ^+ n ∘ p) ∘ (p ⁻¹ ∘ q) ≡⟨ sym $ assoc _ _ _ ⟩
p ^+ n ∘ (p ∘ (p ⁻¹ ∘ q)) ≡⟨ cong (p ^+ n ∘_) $ assoc _ _ _ ⟩
p ^+ n ∘ ((p ∘ p ⁻¹) ∘ q) ≡⟨ cong (p ^+ n ∘_) $ cong (_∘ q) $ right-inverse _ ⟩
p ^+ n ∘ (id ∘ q) ≡⟨ cong (p ^+ n ∘_) $ left-identity _ ⟩∎
p ^+ n ∘ q ∎
lemma₂ : ∀ n → (p ⁻¹ ∘ (p ⁻¹) ^+ n) ∘ (p ∘ q) ≡ (p ⁻¹) ^+ n ∘ q
lemma₂ {p = p} {q = q} n =
(p ⁻¹ ∘ (p ⁻¹) ^+ n) ∘ (p ∘ q) ≡⟨ cong (λ r → (p ⁻¹ ∘ (p ⁻¹) ^+ n) ∘ (r ∘ q)) $ sym $ involutive _ ⟩
(p ⁻¹ ∘ (p ⁻¹) ^+ n) ∘ (p ⁻¹ ⁻¹ ∘ q) ≡⟨ lemma₁ n ⟩∎
(p ⁻¹) ^+ n ∘ q ∎
lemma₃ : ∀ m n → p ^+ m ∘ (p ⁻¹) ^+ suc n ≡ p ^ Int.+ m +-[1+ n ]
lemma₃ {p = p} zero n =
id ∘ (p ⁻¹) ^+ suc n ≡⟨ left-identity _ ⟩∎
(p ⁻¹) ^+ suc n ∎
lemma₃ {p = p} (suc m) zero =
(p ∘ p ^+ m) ∘ p ⁻¹ ∘ id ≡⟨ lemma₁ m ⟩
p ^+ m ∘ id ≡⟨ right-identity _ ⟩∎
p ^+ m ∎
lemma₃ {p = p} (suc m) (suc n) =
(p ∘ p ^+ m) ∘ (p ⁻¹ ∘ (p ⁻¹) ^+ suc n) ≡⟨ lemma₁ m ⟩
p ^+ m ∘ (p ⁻¹) ^+ suc n ≡⟨ lemma₃ m n ⟩∎
p ^ Int.+ m +-[1+ n ] ∎
lemma₄ : ∀ m n → (p ⁻¹) ^+ suc m ∘ p ^+ n ≡ p ^ Int.+ n +-[1+ m ]
lemma₄ {p = p} m zero =
(p ⁻¹) ^+ suc m ∘ id ≡⟨ right-identity _ ⟩∎
(p ⁻¹) ^+ suc m ∎
lemma₄ {p = p} zero (suc n) =
(p ⁻¹ ∘ id) ∘ p ∘ p ^+ n ≡⟨ lemma₂ zero ⟩
id ∘ p ^+ n ≡⟨ left-identity _ ⟩∎
p ^+ n ∎
lemma₄ {p = p} (suc m) (suc n) =
(p ⁻¹ ∘ (p ⁻¹) ^+ suc m) ∘ (p ∘ p ^+ n) ≡⟨ lemma₂ (suc m) ⟩
(p ⁻¹) ^+ suc m ∘ p ^+ n ≡⟨ lemma₄ m n ⟩∎
p ^ Int.+ n +-[1+ m ] ∎
-- _^_ is homomorphic with respect to _∘_/Int._+_.
^∘^ : ∀ i → p ^ i ∘ p ^ j ≡ p ^ (i Int.+ j)
^∘^ {j = + _} (+ m) = ^+∘^+ m
^∘^ {j = -[1+ n ]} (+ m) = lemma₃ m n
^∘^ {j = + n} -[1+ m ] = lemma₄ m n
^∘^ {p = p} {j = -[1+ n ]} -[1+ m ] =
(p ⁻¹) ^+ suc m ∘ (p ⁻¹) ^+ suc n ≡⟨ ^+∘^+ (suc m) ⟩
(p ⁻¹) ^+ (suc m + suc n) ≡⟨ cong ((p ⁻¹) ^+_) $ cong suc $ sym $ Nat.suc+≡+suc m ⟩∎
(p ⁻¹) ^+ (2 + m + n) ∎
-- _^+ n commutes with _⁻¹.
^+⁻¹ : ∀ n → (p ^+ n) ⁻¹ ≡ (p ⁻¹) ^+ n
^+⁻¹ zero = identity
^+⁻¹ {p = p} (suc n) =
(p ∘ p ^+ n) ⁻¹ ≡⟨ ∘⁻¹ ⟩
(p ^+ n) ⁻¹ ∘ p ⁻¹ ≡⟨ cong (_∘ p ⁻¹) $ ^+⁻¹ n ⟩
(p ⁻¹) ^+ n ∘ p ⁻¹ ≡⟨ sym $ ∘^+≡^+∘ (refl _) n ⟩∎
p ⁻¹ ∘ (p ⁻¹) ^+ n ∎
-- _^ i commutes with _⁻¹.
^⁻¹ : ∀ i → (p ^ i) ⁻¹ ≡ (p ⁻¹) ^ i
^⁻¹ (+ n) = ^+⁻¹ n
^⁻¹ -[1+ n ] = ^+⁻¹ (suc n)
-- Any power of id is equal to id.
id^+ : ∀ n → id ^+ n ≡ id {x = x}
id^+ zero = refl _
id^+ (suc n) =
id ∘ id ^+ n ≡⟨ left-identity _ ⟩
id ^+ n ≡⟨ id^+ n ⟩∎
id ∎
id^ : ∀ i → id ^ i ≡ id {x = x}
id^ (+ n) = id^+ n
id^ -[1+ n ] =
(id ⁻¹) ^+ suc n ≡⟨ sym $ ^+⁻¹ (suc n) ⟩
(id ^+ suc n) ⁻¹ ≡⟨ cong _⁻¹ $ id^+ (suc n) ⟩
id ⁻¹ ≡⟨ identity ⟩∎
id ∎
private
lemma₅ : ∀ m n → p ^+ suc m ^+ n ≡ p ^+ n ∘ p ^+ m ^+ n
lemma₅ _ zero =
id ≡⟨ sym $ left-identity _ ⟩∎
id ∘ id ∎
lemma₅ {p = p} m (suc n) =
p ^+ suc m ∘ p ^+ suc m ^+ n ≡⟨ cong (p ^+ suc m ∘_) $ lemma₅ m n ⟩
p ^+ suc m ∘ (p ^+ n ∘ p ^+ m ^+ n) ≡⟨ assoc _ _ _ ⟩
(p ^+ suc m ∘ p ^+ n) ∘ p ^+ m ^+ n ≡⟨⟩
((p ∘ p ^+ m) ∘ p ^+ n) ∘ p ^+ m ^+ n ≡⟨ cong (_∘ p ^+ m ^+ n) $ sym $ assoc _ _ _ ⟩
(p ∘ p ^+ m ∘ p ^+ n) ∘ p ^+ m ^+ n ≡⟨ cong (_∘ p ^+ m ^+ n) $ cong (p ∘_) $ ^+∘^+≡^+∘^+ m n ⟩
(p ∘ p ^+ n ∘ p ^+ m) ∘ p ^+ m ^+ n ≡⟨ cong (_∘ p ^+ m ^+ n) $ assoc _ _ _ ⟩
((p ∘ p ^+ n) ∘ p ^+ m) ∘ p ^+ m ^+ n ≡⟨ sym $ assoc _ _ _ ⟩∎
(p ∘ p ^+ n) ∘ p ^+ m ∘ p ^+ m ^+ n ∎
-- More rearrangement lemmas for _^+_.
^+^+≡^+* : ∀ m → p ^+ m ^+ n ≡ p ^+ (m * n)
^+^+≡^+* {n = n} zero =
id ^+ n ≡⟨ id^+ n ⟩∎
id ∎
^+^+≡^+* {p = p} {n = n} (suc m) =
p ^+ suc m ^+ n ≡⟨ lemma₅ m n ⟩
p ^+ n ∘ p ^+ m ^+ n ≡⟨ cong (p ^+ n ∘_) $ ^+^+≡^+* m ⟩
p ^+ n ∘ p ^+ (m * n) ≡⟨ ^+∘^+ n ⟩
p ^+ (n + m * n) ≡⟨⟩
p ^+ (suc m * n) ∎
∘^+≡^+∘^+ :
p ∘ q ≡ q ∘ p →
∀ n →
(p ∘ q) ^+ n ≡ p ^+ n ∘ q ^+ n
∘^+≡^+∘^+ _ zero =
id ≡⟨ sym $ left-identity _ ⟩∎
id ∘ id ∎
∘^+≡^+∘^+ {p = p} {q = q} comm (suc n) =
(p ∘ q) ^+ suc n ≡⟨⟩
(p ∘ q) ∘ (p ∘ q) ^+ n ≡⟨ cong ((p ∘ q) ∘_) $ ∘^+≡^+∘^+ comm n ⟩
(p ∘ q) ∘ (p ^+ n ∘ q ^+ n) ≡⟨ sym $ assoc _ _ _ ⟩
p ∘ (q ∘ p ^+ n ∘ q ^+ n) ≡⟨ cong (p ∘_) $ assoc _ _ _ ⟩
p ∘ ((q ∘ p ^+ n) ∘ q ^+ n) ≡⟨ cong (p ∘_) $ cong (_∘ (q ^+ n)) $ ∘^+≡^+∘ (sym comm) n ⟩
p ∘ ((p ^+ n ∘ q) ∘ q ^+ n) ≡⟨ cong (p ∘_) $ sym $ assoc _ _ _ ⟩
p ∘ (p ^+ n ∘ q ∘ q ^+ n) ≡⟨ assoc _ _ _ ⟩
(p ∘ p ^+ n) ∘ q ∘ q ^+ n ≡⟨⟩
p ^+ suc n ∘ q ^+ suc n ∎
|
programs/oeis/153/A153260.asm | karttu/loda | 0 | 246697 | <gh_stars>0
; A153260: a(n) = n^3 - 3*(n+3)^2.
; -27,-47,-67,-81,-83,-67,-27,43,149,297,493,743,1053,1429,1877,2403,3013,3713,4509,5407,6413,7533,8773,10139,11637,13273,15053,16983,19069,21317,23733,26323,29093,32049,35197,38543,42093,45853,49829,54027,58453,63113,68013,73159,78557,84213,90133,96323,102789,109537,116573,123903,131533,139469,147717,156283,165173,174393,183949,193847,204093,214693,225653,236979,248677,260753,273213,286063,299309,312957,327013,341483,356373,371689,387437,403623,420253,437333,454869,472867,491333,510273,529693,549599,569997,590893,612293,634203,656629,679577,703053,727063,751613,776709,802357,828563,855333,882673,910589,939087,968173,997853,1028133,1059019,1090517,1122633,1155373,1188743,1222749,1257397,1292693,1328643,1365253,1402529,1440477,1479103,1518413,1558413,1599109,1640507,1682613,1725433,1768973,1813239,1858237,1903973,1950453,1997683,2045669,2094417,2143933,2194223,2245293,2297149,2349797,2403243,2457493,2512553,2568429,2625127,2682653,2741013,2800213,2860259,2921157,2982913,3045533,3109023,3173389,3238637,3304773,3371803,3439733,3508569,3578317,3648983,3720573,3793093,3866549,3940947,4016293,4092593,4169853,4248079,4327277,4407453,4488613,4570763,4653909,4738057,4823213,4909383,4996573,5084789,5174037,5264323,5355653,5448033,5541469,5635967,5731533,5828173,5925893,6024699,6124597,6225593,6327693,6430903,6535229,6640677,6747253,6854963,6963813,7073809,7184957,7297263,7410733,7525373,7641189,7758187,7876373,7995753,8116333,8238119,8361117,8485333,8610773,8737443,8865349,8994497,9124893,9256543,9389453,9523629,9659077,9795803,9933813,10073113,10213709,10355607,10498813,10643333,10789173,10936339,11084837,11234673,11385853,11538383,11692269,11847517,12004133,12162123,12321493,12482249,12644397,12807943,12972893,13139253,13307029,13476227,13646853,13818913,13992413,14167359,14343757,14521613,14700933,14881723,15063989,15247737
mov $1,121
mov $2,4
sub $2,$0
mov $3,1
mov $5,$0
add $0,1
lpb $0,1
mov $0,0
add $2,$3
cmp $1,$2
add $1,8
sub $2,$1
mov $1,1
sub $1,$2
sub $1,2
mov $4,3
mul $4,$2
mul $3,$4
mul $3,$1
add $3,$4
lpe
mov $1,$3
mov $6,$5
mul $6,$5
mul $6,$5
add $1,$6
|
src/cobs-stream-decoder.adb | Fabien-Chouteau/COBS | 0 | 5927 | package body COBS.Stream.Decoder is
subtype Dispatch is Instance'Class;
--------------
-- Do_Flush --
--------------
procedure Do_Flush (This : in out Instance) is
begin
if This.Out_Index > This.Buffer'First then
Dispatch (This).Flush
(This.Buffer (This.Buffer'First .. This.Out_Index - 1));
end if;
This.Out_Index := This.Buffer'First;
end Do_Flush;
----------
-- Push --
----------
procedure Push (This : in out Instance; Data : Storage_Element) is
begin
if This.Start_Of_Frame then
This.Code := Data;
This.Last_Code := This.Code;
This.Start_Of_Frame := False;
if This.Code = 0 then
raise Program_Error;
end if;
elsif This.Code > 1 then
This.Buffer (This.Out_Index) := Data;
This.Out_Index := This.Out_Index + 1;
This.Code := This.Code - 1;
else
if Data /= 0 and then This.Last_Code /= 16#FF# then
This.Buffer (This.Out_Index) := 0;
This.Out_Index := This.Out_Index + 1;
end if;
This.Code := Data;
This.Last_Code := This.Code;
This.Do_Flush;
if Data = 0 then
Dispatch (This).End_Of_Frame;
This.Start_Of_Frame := True;
end if;
end if;
end Push;
end COBS.Stream.Decoder;
|
stm32f1/stm32gd-timer.ads | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 19048 | with STM32_SVD.TIM;
with STM32_SVD; use STM32_SVD;
package STM32GD.Timer is
type Timer_Callback_Type is access procedure;
type Timer_Type is (Timer_2, Timer_3, Timer_4, Timer_5,
Timer_14, Timer_15, Timer_16, Timer_17);
end STM32GD.Timer;
|
programs/oeis/071/A071121.asm | karttu/loda | 0 | 86071 | <reponame>karttu/loda<filename>programs/oeis/071/A071121.asm
; A071121: a(n) = a(n-1) + sum of decimal digits of n^3.
; 1,9,18,28,36,45,55,63,81,82,90,108,127,144,162,181,198,216,244,252,270,289,306,324,343,369,396,415,441,450,478,504,531,550,576,603,622,648,675,685,711,738,766,792,810,838,855,873,901,909,927,946,981,1008
mov $5,$0
mov $7,$0
add $7,1
lpb $7,1
clr $0,5
mov $0,$5
sub $7,1
sub $0,$7
add $2,$0
add $2,1
cal $2,4164 ; Sum of digits of n^3.
add $6,$2
lpe
mov $1,$6
|
programs/oeis/214/A214493.asm | neoneye/loda | 22 | 1717 | <filename>programs/oeis/214/A214493.asm
; A214493: Numbers of the form ((6k+5)^2+9)/2 or 2(3k+4)^2-9.
; 17,23,65,89,149,191,269,329,425,503,617,713,845,959,1109,1241,1409,1559,1745,1913,2117,2303,2525,2729,2969,3191,3449,3689,3965,4223,4517,4793,5105,5399,5729,6041,6389,6719,7085,7433,7817,8183,8585,8969,9389,9791,10229,10649,11105,11543,12017,12473,12965,13439,13949
mov $1,$0
pow $0,2
lpb $1
add $0,5
sub $1,1
sub $0,$1
sub $1,1
lpe
mul $0,6
add $0,17
|
src/boot.asm | krzem5/Assembly-32bit_OS_Simple_Kernel | 0 | 243084 | <filename>src/boot.asm<gh_stars>0
section .boot
[bits 16]
[org 0x7c00]
BOOT_DRIVE db 0
boot16:
mov [BOOT_DRIVE], dl
mov bp, 0x9000
mov sp, bp
mov bx, 0x1000
mov dh, 2
mov dl, [BOOT_DRIVE]
pusha
push dx
mov ah, 0x02
mov al, dh
mov cl, 0x02
mov ch, 0
mov dh, 0
int 0x13
jc err
pop dx
cmp al, dh
jne err
popa
cli
lgdt [gdt_pointer]
mov eax, cr0
or eax, 0x01
mov cr0, eax
jmp (gdt_code-gdt_start):boot32
err:
jmp $
gdt_start:
dq 0x00
gdt_code:
dw 0xffff
dw 0x00
db 0x00
db 0x9a
db 0xcf
db 0x00
gdt_data:
dw 0xffff
dw 0x00
db 0x00
db 0x92
db 0xcf
db 0x00
gdt_end:
gdt_pointer:
dw gdt_end-gdt_start
dd gdt_start
disk:
db 0x00
[bits 32]
boot32:
mov ax, (gdt_data-gdt_start)
mov ds, ax
mov ss, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ebp, 0x90000
mov esp, ebp
call 0x1000
jmp $
times 510-($-$$) db 0
dw 0xaa55
global boot16
|
programs/oeis/033/A033394.asm | karttu/loda | 1 | 163198 | <reponame>karttu/loda<gh_stars>1-10
; A033394: [ 74/n ].
; 74,37,24,18,14,12,10,9,8,7,6,6,5,5,4,4,4,4,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
add $0,1
mov $1,74
div $1,$0
|
thirdparty/adasdl/thin/adasdl/AdaSDL/binding/sdl-thread.ads | Lucretia/old_nehe_ada95 | 0 | 3176 |
-- ----------------------------------------------------------------- --
-- AdaSDL --
-- Binding to Simple Direct Media Layer --
-- Copyright (C) 2001 A.M.F.Vargas --
-- <NAME> --
-- Ponta Delgada - Azores - Portugal --
-- http://www.adapower.net/~avargas --
-- E-mail: <EMAIL> --
-- ----------------------------------------------------------------- --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-- ----------------------------------------------------------------- --
-- **************************************************************** --
-- This is an Ada binding to SDL ( Simple DirectMedia Layer from --
-- Sam Lantinga - www.libsld.org ) --
-- **************************************************************** --
-- In order to help the Ada programmer, the comments in this file --
-- are, in great extent, a direct copy of the original text in the --
-- SDL header files. --
-- **************************************************************** --
with System;
with Interfaces.C;
with SDL.Types; use SDL.Types;
package SDL.Thread is
-- The SDL thread structure, defined in SDL_thread.c
type SDL_Thread_ptr is new System.Address;
null_SDL_Thread_ptr : constant SDL_Thread_ptr :=
SDL_Thread_ptr (System.Null_Address);
type Thread_Func_Type is
access function (param_ptr : System.Address)
return C.int;
pragma Convention (C, Thread_Func_Type);
-- Create a thread
function CreateThread (
fn : Thread_Func_Type;
data : System.Address)
return SDL_Thread_ptr;
pragma Import (C, CreateThread, "SDL_CreateThread");
-- Get the 32-bit thread identifier for the current thread
function ThreadID return Uint32;
pragma Import (C, ThreadID, "SDL_ThreadID");
-- Get the 32-bit thread identifier for the specified thread,
-- equivalent to ThreadID if the specified thread is NULL.
function GetThreadID (thread : SDL_Thread_ptr) return Uint32;
pragma Import (C, GetThreadID, "SDL_GetThreadID");
-- Wait for a thread to finish.
-- The return code for the thread function is placed in the area
-- pointed to by 'status', if 'status' is not NULL.
procedure WaitThread (
thread : SDL_Thread_ptr;
status : int_ptr);
pragma Import (C, WaitThread, "SDL_WaitThread");
-- Forcefully kill a thread without worrying about its state
procedure KillThread (thread : SDL_Thread_ptr);
pragma Import (C, KillThread, "SDL_KillThread");
end SDL.Thread;
|
regtests/stemmer-tests.ads | stcarrez/ada-stemmer | 3 | 5315 | -----------------------------------------------------------------------
-- stemmer-tests -- Tests for stemmer
-- Copyright (C) 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
with Stemmer.Factory;
package Stemmer.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Verify (T : in out Test;
L : in Stemmer.Factory.Language_Type;
S : in String;
R : in String);
procedure Verify (T : in out Test;
L : in Factory.Language_Type;
Source : in String);
-- Stem on French words.
procedure Test_Stem_French (T : in out Test);
-- Stem on English words.
procedure Test_Stem_English (T : in out Test);
-- Stem on Greek words.
procedure Test_Stem_Greek (T : in out Test);
-- Stem on Spanish words.
procedure Test_Stem_Spanish (T : in out Test);
-- Stem on Swedish words.
procedure Test_Stem_Swedish (T : in out Test);
-- Stem on Russian words.
procedure Test_Stem_Russian (T : in out Test);
-- Stem on Serbian words.
procedure Test_Stem_Serbian (T : in out Test);
-- Stem on French word using the reference file.
procedure Test_Stem_French_Reference_File (T : in out Test);
-- Stem on Spanish word using the reference file.
procedure Test_Stem_Spanish_Reference_File (T : in out Test);
-- Stem on English word using the reference file.
procedure Test_Stem_English_Reference_File (T : in out Test);
-- Stem on Swedish word using the reference file.
procedure Test_Stem_Swedish_Reference_File (T : in out Test);
-- Stem on Russian word using the reference file.
procedure Test_Stem_Russian_Reference_File (T : in out Test);
-- Stem on Serbian word using the reference file.
procedure Test_Stem_Serbian_Reference_File (T : in out Test);
-- Stem on German word using the reference file.
procedure Test_Stem_German_Reference_File (T : in out Test);
-- Stem on Italian word using the reference file.
procedure Test_Stem_Italian_Reference_File (T : in out Test);
-- Stem on Greek word using the reference file.
procedure Test_Stem_Greek_Reference_File (T : in out Test);
-- Stem on Danish word using the reference file.
procedure Test_Stem_Danish_Reference_File (T : in out Test);
-- Stem on Dutch word using the reference file.
procedure Test_Stem_Dutch_Reference_File (T : in out Test);
-- Stem on Basque word using the reference file.
procedure Test_Stem_Basque_Reference_File (T : in out Test);
-- Stem on Catalan word using the reference file.
procedure Test_Stem_Catalan_Reference_File (T : in out Test);
-- Stem on Finnish word using the reference file.
procedure Test_Stem_Finnish_Reference_File (T : in out Test);
-- Stem on Hindi word using the reference file.
procedure Test_Stem_Hindi_Reference_File (T : in out Test);
-- Stem on Hungaria word using the reference file.
procedure Test_Stem_Hungarian_Reference_File (T : in out Test);
-- Stem on Irish word using the reference file.
procedure Test_Stem_Irish_Reference_File (T : in out Test);
-- Stem on Indonesian word using the reference file.
procedure Test_Stem_Indonesian_Reference_File (T : in out Test);
-- Stem on Nepali word using the reference file.
procedure Test_Stem_Nepali_Reference_File (T : in out Test);
-- Stem on Norwegian word using the reference file.
procedure Test_Stem_Norwegian_Reference_File (T : in out Test);
-- Stem on Portuguese word using the reference file.
procedure Test_Stem_Portuguese_Reference_File (T : in out Test);
-- Stem on Romanian word using the reference file.
procedure Test_Stem_Romanian_Reference_File (T : in out Test);
-- Stem on English Porter word using the reference file.
procedure Test_Stem_Porter_Reference_File (T : in out Test);
-- Stem on Tamil word using the reference file.
procedure Test_Stem_Tamil_Reference_File (T : in out Test);
-- Stem on Turkish word using the reference file.
procedure Test_Stem_Turkish_Reference_File (T : in out Test);
-- Stem on Lithuanian word using the reference file.
procedure Test_Stem_Lithuanian_Reference_File (T : in out Test);
-- Stem on Arabic word using the reference file.
procedure Test_Stem_Arabic_Reference_File (T : in out Test);
end Stemmer.Tests;
|
programs/oeis/165/A165394.asm | neoneye/loda | 22 | 10079 | ; A165394: Number of slanted 2 X n (i=1..2) X (j=i..n+i-1) 1..4 arrays with all 1s connected, all 2s connected, all 3s connected, all 4s connected, 1 in the upper left corner, 2 in the upper right corner, 3 in the lower left corner, 4 in the lower right corner, and with no element having more than 3 neighbors with the same value.
; 1,9,37,105,241,481,869,1457,2305,3481,5061,7129,9777,13105,17221,22241,28289,35497,44005,53961,65521,78849,94117,111505,131201,153401,178309,206137,237105,271441,309381,351169,397057,447305,502181,561961,626929,697377,773605,855921,944641,1040089,1142597,1252505,1370161,1495921,1630149,1773217,1925505,2087401,2259301,2441609,2634737,2839105,3055141,3283281,3523969,3777657,4044805,4325881,4621361,4931729,5257477,5599105,5957121,6332041,6724389,7134697,7563505,8011361,8478821,8966449,9474817,10004505,10556101,11130201,11727409,12348337,12993605,13663841,14359681,15081769,15830757,16607305,17412081,18245761,19109029,20002577,20927105,21883321,22871941,23893689,24949297,26039505,27165061,28326721,29525249,30761417
sub $2,$0
add $0,4
bin $2,2
add $0,$2
mul $0,$2
div $0,3
mul $0,4
add $0,1
|
test/Fail/Issue5531.agda | cruhland/agda | 1,989 | 9153 | <filename>test/Fail/Issue5531.agda
{-# OPTIONS --type-in-type --rewriting #-}
open import Agda.Builtin.Sigma
open import Agda.Builtin.Equality
coe : {A B : Set} → A ≡ B → A → B
coe refl x = x
{-# BUILTIN REWRITE _≡_ #-}
Tel = Set
U = Set
variable
Δ : Tel
A B : Δ → U
δ₀ δ₁ : Δ
postulate
IdTel : (Δ : Tel)(δ₀ δ₁ : Δ) → Tel
Id : (A : Δ → U){δ₀ δ₁ : Δ}(δ₂ : IdTel Δ δ₀ δ₁) → A δ₀ → A δ₁ → U
ap : {A : Δ → U}(a : (δ : Δ) → A δ)
→ {δ₀ δ₁ : Δ}(δ₂ : IdTel Δ δ₀ δ₁) → Id A δ₂ (a δ₀) (a δ₁)
idTel-sigma : {a₀ : A δ₀}{a₁ : A δ₁}
→ IdTel (Σ Δ A) (δ₀ , a₀) (δ₁ , a₁)
≡ Σ (IdTel Δ δ₀ δ₁) (λ δ₂ → Id A δ₂ a₀ a₁)
{-# REWRITE idTel-sigma #-}
id-u : {A₀ A₁ : U}{δ₂ : IdTel Δ δ₀ δ₁}
→ Id {Δ = Δ}(λ _ → U) δ₂ A₀ A₁ ≡ (A₀ → A₁ → U)
{-# REWRITE id-u #-}
id-ap : {δ₂ : IdTel Δ δ₀ δ₁}{a₀ : A δ₀}{a₁ : A δ₁}
→ Id A δ₂ a₀ a₁ ≡ ap {A = λ _ → U} A δ₂ a₀ a₁
ap-sigma : {δ₂ : IdTel Δ δ₀ δ₁}{a₀ : A δ₀}{a₁ : A δ₁}
{B : (δ : Δ) → A δ → U}
{b₀ : B δ₀ a₀}{b₁ : B δ₁ a₁}→
ap {Δ = Δ}{A = λ _ → U} (λ δ → Σ (A δ) (B δ))
δ₂ (a₀ , b₀) (a₁ , b₁) ≡
Σ (Id A δ₂ a₀ a₁) λ a₂ → Id {Δ = Σ Δ A} (λ (δ , a) → B δ a) (δ₂ , a₂) b₀ b₁
{-# REWRITE ap-sigma #-}
{-# REWRITE id-ap #-}
ap-proj₁ : {δ₂ : IdTel Δ δ₀ δ₁}
{B : (δ : Δ) → A δ → U}
{ab : (δ : Δ) → Σ (A δ) (B δ)}
→ ap {Δ = Δ}{A = A}(λ δ → fst (ab δ)) δ₂
≡ fst (ap ab δ₂)
|
Type/Equiv.agda | Lolirofle/stuff-in-agda | 6 | 7945 | <filename>Type/Equiv.agda<gh_stars>1-10
module Type.Equiv where
open import Function.Proofs
open import Logic.Predicate
import Lvl
open import Structure.Function
open import Structure.Function.Domain
open import Structure.Setoid
open import Type
private variable ℓ ℓ₁ ℓ₂ ℓₑ₁ ℓₑ₂ : Lvl.Level
-- Invertible function existence.
-- The standard equivalence/isomorphism for types.
_≍_ : (A : Type{ℓ₁}) → (B : Type{ℓ₂}) → ⦃ equiv-A : Equiv{ℓₑ₁}(A) ⦄ ⦃ equiv-B : Equiv{ℓₑ₂}(B) ⦄ → Type
A ≍ B = ∃(InversePair{A = A}{B = B})
open import Logic.Propositional.Theorems using ([↔]-reflexivity ; [↔]-symmetry ; [↔]-transitivity)
open import Structure.Relator.Equivalence
open import Structure.Relator.Properties
module _ {ℓ ℓₑ} ⦃ equiv : ∀{T : Type{ℓ}} → Equiv{ℓₑ}(T) ⦄ where
[≍]-reflexivity : Reflexivity{T = Type{ℓ}}(\A B → (A ≍ B))
Reflexivity.proof [≍]-reflexivity = [∃]-intro _ ⦃ id-inversePair ⦄
[≍]-symmetry : Symmetry{T = Type{ℓ}}(\A B → (A ≍ B))
Symmetry.proof [≍]-symmetry _ = [∃]-intro _ ⦃ sym-inversePair ⦄
module _ ⦃ func : ∀{A B : Type{ℓ}}{f : A → B} → Function(f) ⦄ where
[≍]-transitivity : Transitivity{T = Type{ℓ}}(\A B → (A ≍ B))
Transitivity.proof [≍]-transitivity ([∃]-intro xy ⦃ p ⦄) ([∃]-intro yz ⦃ q ⦄) = [∃]-intro _ ⦃ trans-inversePair ⦃ inv₁ = p ⦄ ⦃ inv₂ = q ⦄ ⦄
[≍]-equivalence : Equivalence{T = Type{ℓ}}(\A B → (A ≍ B))
[≍]-equivalence = intro ⦃ [≍]-reflexivity ⦄ ⦃ [≍]-symmetry ⦄ ⦃ [≍]-transitivity ⦄
|
basic/basic.asm | paulscottrobson/cosmac-vip-replica | 0 | 4488 |
r2 = 2
r3 = 3
r4 = 4
cpu 1802
org 8000h
ldi 080h
phi r2
ldi 008h
plo r2
sex r2
sep r2
out 4
idl
sex r2
ldi s1/256
phi r4
ldi s1&255
plo r4
sep r4
s1:
ldi 01
phi r2
ldi 00
plo r2
Variables = 0D00h
return macro ; allows subroutine returns to disable/enable interrupts as you want.
dis ; this program uses MARK-subroutines
endm
;
; $80-$8F Operators : $80:@ $81:? $82:~ $83:!
; (Unary)
; $90-$9F Operators : $90:== $91:!= $92:< $93: >= $94:<= $95:> $96:- $97:+
; (Binary) $98:* $99:/ $9A:% $9B: & $9C:| $9D:^
;
; $A0-$BE Variable. Value is 2 * offset + Variables, type is 16 bit address
;
; $BF A string constant. String constants are ended by bit 7 being set to '1'.
;
; $C0-$FE Represents constant values from -2 to 60
;
; $FF ll hh Constant value outside the C0..FE range
;
; TODO: $80-$9E nn Short array access e.g. CC4 (unsigned)
;
; r15 : current value on the top of the stack.
; r14 : .0 type of value in r15 : 0=constant 1=address of 16 bit LL:HH 2=address of 8 bit.
; .1 temporary register
; r13 : RPN calculation stack. Starts with lower 4 bits zero ; one dummy value at start
; (r13) points to the LSB of the 2nd stack value, (r13+1) is the MSB. Expands down.
; r12 : Code being evaluated
; r11 : Code routine address for evaluation.
rxRoutine = 11
rxCode = 12
rxRPNStack = 13
rxType = 14
rxTOS = 15
ERR_Underflow = 081h ; Underflow of stack.
Setup:
ldi 000h
phi rxRPNStack
ldi 010h
plo rxRPNStack
ldi TestCode/256
phi rxCode
ldi TestCode&255
plo rxCode
ldi Evaluate/256
phi r3
ldi Evaluate&255
plo r3
mark
sep r3
dec r2
end1:br end1
TestCode:
db 0FFh,081h,4
db 0FFh,082h,1
db 096h
db 000h
org 8100h
; ************************************************************************************************
;
; Set up the 'dummy' stack top value, constant zero.
;
; ************************************************************************************************
Evaluate:
ldi 0 ; First up, put a dummy value in for the current TOS
plo rxTOS ; which is zero, constant type zero.
phi rxTOS
plo rxType
; ************************************************************************************************
;
; Main Loop Here. If the following item is not part of an expression, we return, but
; possibly with a L-Expression in rxTOS/rxType. If we want an r-expr we can re-enter.
;
; ************************************************************************************************
__EVMainLoop:
sex r2 ; use R2 as index for this bit.
ldn rxCode ; look at next item
shl ; is it an expression part token ($80-$FF)
bdf __EVNoExit1 ; if so skip this exit
ldi 0 ; return code 0 (no error)
inc r2 ; at this point we may have an l-expression
return ; so we reenter to make sure it's an r-expression.
; ************************************************************************************************
;
; If the current value in the TOS registers is an 8 or 16 bit indirection, do that look up.
;
; ************************************************************************************************
__EVNoExit1:
glo rxType ; if type is zero, no indirection required.
bz __EVIsRExpr
xri 2 ; if type is one, it's an 8 bit indirection.
bz __EV8BitIndirection
lda rxTOS ; read the low byte.
plo rxType
ldn rxTOS ; read high
phi rxTOS ; copy into rTOS
glo rxType
plo rxTOS
ldi 0
plo rxType
br __EVIsRExpr
__EV8BitIndirection:
ldn rxTOS ; byte read
plo rxTOS ; put in low byte
ldi 0
phi rxTOS ; zero high byte and type.
plo rxType
; ************************************************************************************************
;
; We now have an R-Expr in the TOS registers. If we've reached the end of the expression
; tokens, we can now exit with that.
;
; ************************************************************************************************
__EVIsRExpr:
ldn rxCode ; look at next item
shl ; is it an expression part token ($80-$FF)
bdf __EVNoExit2 ; if so skip this exit
inc r2 ; at this point, we *know* we have an r-expr
return ; so we can make it re-entrant
br Evaluate
; ************************************************************************************************
;
; Now we have either operators or values. Firstly we do values. We have a new value, so we
; push the old TOS value, now an r-expr definitely, on the stack, and get a new value in the
; TOS *registers*.
;
; There are four values : a variable, a short constant, a long constant, and a bit7 string.
;
; ************************************************************************************************
__EVNoExit2:
ldn rxCode ; look at next item
adi 060h ; DF will be set for A0-FF which are values.
bnf __EVIsOperator
dec rxRPNStack ; push current TOS value onto the stack
ghi rxTOS
str rxRPNStack ; high first, then low.
dec rxRPNStack
glo rxTOS ; the new value can go in the registers.
str rxRPNStack
ldi 0 ; zero the type - most of the values are constants
plo rxType ; the exception being variables which are l-exprs.
phi rxTOS ; zero TOS.1
;
; Check for short constant C0-FE and long constant FF low high
;
lda rxCode ; read and advance the code pointer.
adi 40h ; DF set if C0-FF, D is 00-3F
bnf __EVNotConstant
plo rxTOS ; save as top of stack
dec rxTOS ; fix up as C0 is -2
dec rxTOS
xri 3Fh ; check it was 3F, which is the long constant
bnz __EVMainLoop
lda rxCode ; read LSB/MSB in
plo rxTOS
lda rxCode
phi rxTOS
br __EVMainLoop
;
; It must now be in the range A0-BF. Variable handler.
;
__EVNotConstant:
adi 20h ; put into range 00-1F
xri 1Fh ; if the value was BF it's a string
bz __EVIsString
xri 1Fh ; fix back.
shl ; double A
plo rxTOS ; point to variable.
ldi Variables/256
phi rxTOS
inc rxType ; set type to 1 (16 bit indirect)
br __EVMainLoop
;
; String BF <string> terminated by bit 7 high
;
__EVIsString:
glo rxCode ; code pointer = string address
plo rxTOS
ghi rxCode
phi rxTOS
__EVSkipString:
lda rxCode
shl
bnf __EVSkipString
br __EVMainLoop
; ************************************************************************************************
;
; We have found a Unary Operator (80-8F) or Binary Operator (90-9F)
;
; ************************************************************************************************
__EVIsOperator:
ldn rxCode ; get the code.
adi 70h ; set DF if it is a binary operator.
glo rxRPNStack ; look at LS Nibble of RPN Stack
ani 0Fh
bz __EVStackUnderflow ; there's not at least one entry.
bnf __EVDispatch ; if unary operator, go to dispatch.
xri 0Eh ; binary operator, so 0E is a bad value
bz __EVStackUnderflow
ldn rxCode ; get code.
adi 0FFh - 096h ; values >= 097 will produce a DF
bdf __EVDispatch ; $90-$96 (compares and subtract) all start
; with subtraction so we precalculate that.
sex rxRPNStack ; now do the subtraction throwing the stack value.
glo rxTOS
sd
plo rxTOS
inc rxRPNStack
ghi rxTOS
sdb
phi rxTOS
inc rxRPNStack
ldi 0 ; put DF into D
rshl
phi rxType ; and save in rxType.1 (for comparisons)
br __EVDispatch ; go to the dispatcher
;
__EVStackUnderflow:
ldi ERR_Underflow ; fail evaluaition on stack underflow.
inc r2
return
; ************************************************************************************************
;
; Actually execute a unary/binary operand
;
; ************************************************************************************************
__EVDispatch:
lda rxCode ; get the code again, and skip it.
shl ; double it, also losing bit 7.
adi __EVDispatchTable&255
plo rxRoutine ; make rxRoutine point into the table
ldi __EVDispatchTable/256
phi rxRoutine
lda rxRoutine ; read high byte
phi rxType
ldn rxRoutine ; read low byte and fix up
plo rxRoutine
ghi rxType
phi rxRoutine
sex r2 ; call the routine
mark
sep rxRoutine
dec r2
br __EVMainLoop ; go round again.
; ************************************************************************************************
;
; Vectors for operators. Note that the ASL assembler outputs this data in
; high/low order.
;
; ************************************************************************************************
__EVDispatchTable:
dw 0 ; $80 @
dw 0 ; $81 ?
dw 0 ; $82 ~
dw 0 ; $83 !
dw 0,0,0,0,0,0,0,0,0,0,0,0 ; $84-$8F are unused.
dw 0 ; $90 == (these are precalculated)
dw 0 ; $91 !=
dw 0 ; $92 <
dw 0 ; $93 >=
dw 0 ; $94 <=
dw 0 ; $95 >
dw __EVSubtract ; $96 - (which is already done)
dw __EVAdd ; $97 +
dw 0 ; $98 *
dw 0 ; $99 /
dw 0 ; $9A %
dw __EVAnd ; $9B &
dw __EVOr ; $9C |
dw __EVXor ; $9D ^
dw 0,0 ; $9E-$9F are unused.
; ************************************************************************************************
;
; 16 bit Addition
;
; ************************************************************************************************
__EVAdd:
sex rxRPNStack ; Addition of TOS + (stack)
glo rxTOS
add
plo rxTOS
inc rxRPNStack
ghi rxTOS
adc
phi rxTOS
inc rxRPNStack ; and fall through, subtraction precalculated
; ************************************************************************************************
;
; 16 bit Subtraction
;
; ************************************************************************************************
__EVOpExit1:
__EVSubtract: ; Subtraction is precalculated so do nothing.
sex r2
inc r2
return
; ************************************************************************************************
;
; 16 bit Bitwise AND
;
; ************************************************************************************************
__EVAnd:
sex rxRPNStack ; Addition of TOS + (stack)
glo rxTOS
and
plo rxTOS
inc rxRPNStack
ghi rxTOS
and
phi rxTOS
inc rxRPNStack
br __EVOpExit1
; ************************************************************************************************
;
; 16 bit Bitwise OR
;
; ************************************************************************************************
__EVOr:
sex rxRPNStack ; Addition of TOS + (stack)
glo rxTOS
or
plo rxTOS
inc rxRPNStack
ghi rxTOS
or
phi rxTOS
inc rxRPNStack
__EVOpExit2:
sex r2
inc r2
return
; ************************************************************************************************
;
; 16 bit Bitwise XOR
;
; ************************************************************************************************
__EVXor:
sex rxRPNStack ; Addition of TOS + (stack)
glo rxTOS
xor
plo rxTOS
inc rxRPNStack
ghi rxTOS
xor
phi rxTOS
inc rxRPNStack
br __EVOpExit2
|
alloy4fun_models/trashltl/models/1/vdyFS6uHLKMQTM2aA.als | Kaixi26/org.alloytools.alloy | 0 | 3771 | open main
pred idvdyFS6uHLKMQTM2aA_prop2 {
no File
eventually some File
}
pred __repair { idvdyFS6uHLKMQTM2aA_prop2 }
check __repair { idvdyFS6uHLKMQTM2aA_prop2 <=> prop2o } |
wof/lcs/enemy/E.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 88602 | copyright zengfr site:http://github.com/zengfr/romhack
0010D0 rts [123p+ C, 123p+ E, enemy+ C, enemy+ E]
001590 lea ($20,A0), A0
007D44 move.b #$4, ($2a,A0) [123p+ C, 123p+ E, enemy+ C, enemy+ E]
011CEE clr.l ($c,A0) [123p+ 40, enemy+40]
011CF2 addq.b #2, ($2b,A0) [123p+ C, 123p+ E, enemy+ C, enemy+ E]
011D1E jsr $2470.w [123p+ C, 123p+ E, enemy+ C, enemy+ E]
011DD0 clr.l ($c,A0) [enemy+4A]
011DD4 addq.b #2, ($2b,A0) [enemy+ C, enemy+ E]
011F12 clr.l ($c,A0) [enemy+40]
011F16 addq.b #2, ($2b,A0) [enemy+ C, enemy+ E]
011F4C tst.w ($32,A0) [enemy+ C, enemy+ E]
012082 jsr $2470.w
012252 move.l (A2)+, (A3)+ [enemy+ 8, enemy+ A]
012254 move.l (A2)+, (A3)+
01A75E dbra D4, $1a75c
0256E8 move.l D0, ($c,A0)
0256EC jsr $62fe.w
0295D0 move.l D0, ($c,A0)
0295D4 jsr $62fe.w
029840 move.l D0, ($c,A0)
029844 jsr $62fe.w
02A98C move.l D0, ($c,A0)
02A990 jsr $62fe.w
02ABF0 move.l D0, ($c,A0)
02ABF4 jsr $62fe.w
02BDB6 move.l D0, ($c,A0)
02BDBA jsr $62fe.w
0330DE move.l D0, ($c,A0)
0330E2 jsr $62fe.w
036F70 jsr $62fe.w [enemy+ C, enemy+ E]
copyright zengfr site:http://github.com/zengfr/romhack
|
.oh-my-zsh/custom/applescript/new_terminal.scpt | JannikWibker/dots | 2 | 346 | if application "iTerm2" is running then
tell application "iTerm"
create window with default profile
end tell
else
activate application "iTerm"
end if
|
programs/oeis/020/A020871.asm | jmorken/loda | 1 | 100505 | <reponame>jmorken/loda
; A020871: Number of spanning trees in a Moebius ladder M_n with 2n vertices.
; 0,3,16,81,392,1815,8112,35301,150544,632043,2620880,10759353,43804824,177105279,711809392,2846259405,11330543648,44929049811,177540878736,699402223137,2747583822760,10766828545767,42095796462896,164244726238389,639620518118448,2486558615814075
mov $2,$0
lpb $0
sub $0,1
add $3,$2
add $1,$3
add $1,2
add $3,$2
add $2,$3
lpe
|
programs/oeis/127/A127752.asm | neoneye/loda | 22 | 9827 | ; A127752: Row sums of inverse of number triangle A(n,k) = 1/(3n+1) if k <= n <= 2k, 0 otherwise.
; 1,4,3,7,3,6,3,10,3,6,3,9,3,6,3,13,3,6,3,9,3,6,3,12,3,6,3,9,3,6,3,16,3,6,3,9,3,6,3,12,3,6,3,9,3,6,3,15,3,6,3,9,3,6,3,12,3,6,3,9,3,6,3,19,3,6,3,9,3,6,3,12,3,6,3,9,3,6,3,15,3,6,3,9,3,6,3,12,3,6,3,9,3,6,3,18,3,6,3,9
mov $2,$0
lpb $0
mod $0,2
add $1,2
add $1,$0
div $2,2
mul $0,$2
lpe
add $1,1
mov $0,$1
|
gcc-gcc-7_3_0-release/gcc/ada/a-synbar.adb | best08618/asylo | 7 | 10940 | <reponame>best08618/asylo<filename>gcc-gcc-7_3_0-release/gcc/ada/a-synbar.adb
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S Y N C H R O N O U S _ B A R R I E R S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body Ada.Synchronous_Barriers is
protected body Synchronous_Barrier is
-- The condition "Wait'Count = Release_Threshold" opens the barrier when
-- the required number of tasks is reached. The condition "Keep_Open"
-- leaves the barrier open while there are queued tasks. While there are
-- tasks in the queue no new task will be queued (no new protected
-- action can be started on a protected object while another protected
-- action on the same protected object is underway, RM 9.5.1 (4)),
-- guaranteeing that the barrier will remain open only for those tasks
-- already inside the queue when the barrier was open.
entry Wait (Notified : out Boolean)
when Keep_Open or else Wait'Count = Release_Threshold
is
begin
-- If we are executing the entry it means that the required number of
-- tasks have been queued in the entry. Keep_Open barrier will remain
-- true until all queued tasks are out.
Keep_Open := Wait'Count > 0;
-- The last released task will close the barrier and get the Notified
-- token.
Notified := Wait'Count = 0;
end Wait;
end Synchronous_Barrier;
----------------------
-- Wait_For_Release --
----------------------
procedure Wait_For_Release
(The_Barrier : in out Synchronous_Barrier;
Notified : out Boolean)
is
begin
The_Barrier.Wait (Notified);
end Wait_For_Release;
end Ada.Synchronous_Barriers;
|
programs/oeis/259/A259110.asm | karttu/loda | 1 | 18328 | ; A259110: 2*A000447(n).
; 0,2,20,70,168,330,572,910,1360,1938,2660,3542,4600,5850,7308,8990,10912,13090,15540,18278,21320,24682,28380,32430,36848,41650,46852,52470,58520,65018,71980,79422,87360,95810,104788,114310,124392,135050,146300,158158,170640,183762,197540,211990,227128,242970,259532,276830,294880,313698,333300,353702,374920,396970,419868,443630,468272,493810,520260,547638,575960,605242,635500,666750,699008,732290,766612,801990,838440,875978,914620,954382,995280,1037330,1080548,1124950,1170552,1217370,1265420,1314718,1365280,1417122,1470260,1524710,1580488,1637610,1696092,1755950,1817200,1879858,1943940,2009462,2076440,2144890,2214828,2286270,2359232,2433730,2509780,2587398,2666600,2747402,2829820,2913870,2999568,3086930,3175972,3266710,3359160,3453338,3549260,3646942,3746400,3847650,3950708,4055590,4162312,4270890,4381340,4493678,4607920,4724082,4842180,4962230,5084248,5208250,5334252,5462270,5592320,5724418,5858580,5994822,6133160,6273610,6416188,6560910,6707792,6856850,7008100,7161558,7317240,7475162,7635340,7797790,7962528,8129570,8298932,8470630,8644680,8821098,8999900,9181102,9364720,9550770,9739268,9930230,10123672,10319610,10518060,10719038,10922560,11128642,11337300,11548550,11762408,11978890,12198012,12419790,12644240,12871378,13101220,13333782,13569080,13807130,14047948,14291550,14537952,14787170,15039220,15294118,15551880,15812522,16076060,16342510,16611888,16884210,17159492,17437750,17719000,18003258,18290540,18580862,18874240,19170690,19470228,19772870,20078632,20387530,20699580,21014798,21333200,21654802,21979620,22307670,22638968,22973530,23311372,23652510,23996960,24344738,24695860,25050342,25408200,25769450,26134108,26502190,26873712,27248690,27627140,28009078,28394520,28783482,29175980,29572030,29971648,30374850,30781652,31192070,31606120,32023818,32445180,32870222,33298960,33731410,34167588,34607510,35051192,35498650,35949900,36404958,36863840,37326562,37793140,38263590,38737928,39216170,39698332,40184430,40674480,41168498
mul $0,2
add $0,1
bin $0,3
mul $0,2
mov $1,$0
|
parser/DIDLexer.g4 | zkung/ic-py | 65 | 2670 | <gh_stars>10-100
lexer grammar DIDLexer;
BlockComment: '/*' .*? '*/' -> skip;
LineComment: '//' ~[\r\n]* -> skip;
S: [ \t\r\n] -> skip;
Type: 'type';
Query: 'query';
Oneway: 'oneway';
PrimType:
NumType
| 'bool'
| 'text'
| 'null'
| 'reserved'
| 'empty'
| 'principal';
NumType:
'nat'
| 'nat8'
| 'nat16'
| 'nat32'
| 'nat64'
| 'int'
| 'int8'
| 'int16'
| 'int32'
| 'int64'
| 'float32'
| 'float64';
OPT: 'opt';
VEC: 'vec';
RECORD: 'record';
VARIANT: 'variant';
Service: 'service';
FUNC: 'func';
fragment Letter: [A-Za-z];
fragment DIGIT: [0-9];
fragment NameChar: NameStartChar | '_' | DIGIT;
fragment NameStartChar: [_a-zA-Z];
Name: '"'? NameStartChar NameChar* '"'?;
LeftP: '(';
RightP: ')';
LeftB: '{';
RightB: '}';
Arrow: '->';
Colon: ':';
Semicolon: ';';
Eq: '=';
Comma: ',';
|
BCK.agda | oisdk/agda-playground | 6 | 5226 | {-# OPTIONS --cubical --safe #-}
module BCK where
open import Prelude hiding (B; C)
infixl 4 _$$_
data BCK : Type where
_$$_ : BCK → BCK → BCK
B C K : BCK
open import Data.List
stack : BCK → Maybe BCK
stack xs = go xs []
where
go : BCK → List BCK → Maybe BCK
go (f $$ x) xs = go f (x ∷ xs)
go B (f ∷ g ∷ x ∷ xs) = just (foldl _$$_ (f $$ (g $$ x)) xs)
go C (f ∷ x ∷ y ∷ xs) = just (foldl _$$_ (f $$ y $$ x) xs)
go K (x ∷ y ∷ xs) = just (foldl _$$_ x xs)
go _ _ = nothing
|
libsrc/_DEVELOPMENT/adt/w_vector/c/sccz80/w_vector_erase.asm | jpoikela/z88dk | 640 | 89666 | <reponame>jpoikela/z88dk<gh_stars>100-1000
; size_t w_vector_erase(w_vector_t *v, size_t idx)
SECTION code_clib
SECTION code_adt_w_vector
PUBLIC w_vector_erase
EXTERN w_array_erase
defc w_vector_erase = w_array_erase
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _w_vector_erase
defc _w_vector_erase = w_vector_erase
ENDIF
|
src/Bijection.agda | nad/equality | 3 | 5465 | <reponame>nad/equality
------------------------------------------------------------------------
-- Bijections
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Equality
module Bijection
{reflexive} (eq : ∀ {a p} → Equality-with-J a p reflexive) where
open Derived-definitions-and-properties eq
open import Equality.Decision-procedures eq
open import H-level eq
open import Injection eq using (Injective; _↣_)
open import Logical-equivalence using (_⇔_)
open import Prelude as P hiding (id) renaming (_∘_ to _⊚_)
open import Surjection eq as Surjection using (_↠_; module _↠_)
------------------------------------------------------------------------
-- Bijections
infix 0 _↔_
record _↔_ {f t} (From : Type f) (To : Type t) : Type (f ⊔ t) where
field
surjection : From ↠ To
open _↠_ surjection
field
left-inverse-of : ∀ x → from (to x) ≡ x
injective : Injective to
injective {x = x} {y = y} to-x≡to-y =
x ≡⟨ sym (left-inverse-of x) ⟩
from (to x) ≡⟨ cong from to-x≡to-y ⟩
from (to y) ≡⟨ left-inverse-of y ⟩∎
y ∎
injection : From ↣ To
injection = record
{ to = to
; injective = injective
}
-- A lemma.
to-from : ∀ {x y} → to x ≡ y → from y ≡ x
to-from {x} {y} to-x≡y =
from y ≡⟨ cong from $ sym to-x≡y ⟩
from (to x) ≡⟨ left-inverse-of x ⟩∎
x ∎
-- Every right inverse of to is pointwise equal to from.
right-inverse-unique :
(f : To → From) →
(∀ x → to (f x) ≡ x) →
(∀ x → f x ≡ from x)
right-inverse-unique _ right x = sym $ to-from (right x)
-- Every left inverse of from is pointwise equal to to.
left-inverse-of-from-unique :
(f : From → To) →
(∀ x → f (from x) ≡ x) →
(∀ x → f x ≡ to x)
left-inverse-of-from-unique f left x =
f x ≡⟨ cong f $ sym $ left-inverse-of _ ⟩
f (from (to x)) ≡⟨ left _ ⟩∎
to x ∎
open _↠_ surjection public
-- The type of quasi-inverses of a function (as defined in the HoTT
-- book).
Has-quasi-inverse :
∀ {a b} {A : Type a} {B : Type b} →
(A → B) → Type (a ⊔ b)
Has-quasi-inverse {A = A} {B = B} to =
∃ λ (from : B → A) →
(∀ x → to (from x) ≡ x) ×
(∀ x → from (to x) ≡ x)
-- An alternative characterisation of bijections.
↔-as-Σ :
∀ {a b} {A : Type a} {B : Type b} →
(A ↔ B) ↔ ∃ λ (f : A → B) → Has-quasi-inverse f
↔-as-Σ = record
{ surjection = record
{ logical-equivalence = record
{ to = λ A↔B → _↔_.to A↔B
, _↔_.from A↔B
, _↔_.right-inverse-of A↔B
, _↔_.left-inverse-of A↔B
; from = λ (t , f , r , l) → record
{ surjection = record
{ logical-equivalence = record
{ to = t
; from = f
}
; right-inverse-of = r
}
; left-inverse-of = l
}
}
; right-inverse-of = refl
}
; left-inverse-of = refl
}
------------------------------------------------------------------------
-- Equivalence
-- _↔_ is an equivalence relation.
id : ∀ {a} {A : Type a} → A ↔ A
id = record
{ surjection = Surjection.id
; left-inverse-of = refl
}
inverse : ∀ {a b} {A : Type a} {B : Type b} → A ↔ B → B ↔ A
inverse A↔B = record
{ surjection = record
{ logical-equivalence = Logical-equivalence.inverse
logical-equivalence
; right-inverse-of = left-inverse-of
}
; left-inverse-of = right-inverse-of
} where open _↔_ A↔B
infixr 9 _∘_
_∘_ : ∀ {a b c} {A : Type a} {B : Type b} {C : Type c} →
B ↔ C → A ↔ B → A ↔ C
f ∘ g = record
{ surjection = Surjection._∘_ (surjection f) (surjection g)
; left-inverse-of = from∘to
}
where
open _↔_
from∘to : ∀ x → from g (from f (to f (to g x))) ≡ x
from∘to = λ x →
from g (from f (to f (to g x))) ≡⟨ cong (from g) (left-inverse-of f (to g x)) ⟩
from g (to g x) ≡⟨ left-inverse-of g x ⟩∎
x ∎
-- "Equational" reasoning combinators.
infix -1 finally-↔
infixr -2 step-↔
-- For an explanation of why step-↔ is defined in this way, see
-- Equality.step-≡.
step-↔ : ∀ {a b c} (A : Type a) {B : Type b} {C : Type c} →
B ↔ C → A ↔ B → A ↔ C
step-↔ _ = _∘_
syntax step-↔ A B↔C A↔B = A ↔⟨ A↔B ⟩ B↔C
finally-↔ : ∀ {a b} (A : Type a) (B : Type b) → A ↔ B → A ↔ B
finally-↔ _ _ A↔B = A↔B
syntax finally-↔ A B A↔B = A ↔⟨ A↔B ⟩□ B □
------------------------------------------------------------------------
-- One can replace either of the functions with an extensionally equal
-- function
with-other-function :
∀ {a b} {A : Type a} {B : Type b}
(A↔B : A ↔ B) (f : A → B) →
(∀ x → _↔_.to A↔B x ≡ f x) →
A ↔ B
with-other-function A↔B f ≡f = record
{ surjection = record
{ logical-equivalence = record
{ to = f
; from = _↔_.from A↔B
}
; right-inverse-of = λ x →
f (_↔_.from A↔B x) ≡⟨ sym $ ≡f _ ⟩
_↔_.to A↔B (_↔_.from A↔B x) ≡⟨ _↔_.right-inverse-of A↔B _ ⟩∎
x ∎
}
; left-inverse-of = λ x →
_↔_.from A↔B (f x) ≡⟨ cong (_↔_.from A↔B) $ sym $ ≡f _ ⟩
_↔_.from A↔B (_↔_.to A↔B x) ≡⟨ _↔_.left-inverse-of A↔B _ ⟩∎
x ∎
}
with-other-inverse :
∀ {a b} {A : Type a} {B : Type b}
(A↔B : A ↔ B) (f : B → A) →
(∀ x → _↔_.from A↔B x ≡ f x) →
A ↔ B
with-other-inverse A↔B f ≡f =
inverse $ with-other-function (inverse A↔B) f ≡f
private
-- The two functions above compute in the right way.
to∘with-other-function :
∀ {a b} {A : Type a} {B : Type b}
(A↔B : A ↔ B) (f : A → B)
(to≡f : ∀ x → _↔_.to A↔B x ≡ f x) →
_↔_.to (with-other-function A↔B f to≡f) ≡ f
to∘with-other-function _ _ _ = refl _
from∘with-other-function :
∀ {a b} {A : Type a} {B : Type b}
(A↔B : A ↔ B) (f : A → B)
(to≡f : ∀ x → _↔_.to A↔B x ≡ f x) →
_↔_.from (with-other-function A↔B f to≡f) ≡ _↔_.from A↔B
from∘with-other-function _ _ _ = refl _
to∘with-other-inverse :
∀ {a b} {A : Type a} {B : Type b}
(A↔B : A ↔ B) (g : B → A)
(from≡g : ∀ x → _↔_.from A↔B x ≡ g x) →
_↔_.to (with-other-inverse A↔B g from≡g) ≡ _↔_.to A↔B
to∘with-other-inverse _ _ _ = refl _
from∘with-other-inverse :
∀ {a b} {A : Type a} {B : Type b}
(A↔B : A ↔ B) (g : B → A)
(from≡g : ∀ x → _↔_.from A↔B x ≡ g x) →
_↔_.from (with-other-inverse A↔B g from≡g) ≡ g
from∘with-other-inverse _ _ _ = refl _
------------------------------------------------------------------------
-- More lemmas
-- Uninhabited types are isomorphic to the empty type.
⊥↔uninhabited : ∀ {a ℓ} {A : Type a} → ¬ A → ⊥ {ℓ = ℓ} ↔ A
⊥↔uninhabited ¬A = record
{ surjection = record
{ logical-equivalence = record
{ to = ⊥-elim
; from = ⊥-elim ⊚ ¬A
}
; right-inverse-of = ⊥-elim ⊚ ¬A
}
; left-inverse-of = λ ()
}
-- A lifted set is isomorphic to the underlying one.
↑↔ : ∀ {a b} {A : Type a} → ↑ b A ↔ A
↑↔ {b = b} {A} = record
{ surjection = record
{ logical-equivalence = record
{ to = lower
; from = lift
}
; right-inverse-of = refl
}
; left-inverse-of = refl
}
-- Equality between pairs can be expressed as a pair of equalities.
Σ-≡,≡↔≡ : ∀ {a b} {A : Type a} {B : A → Type b} {p₁ p₂ : Σ A B} →
(∃ λ (p : proj₁ p₁ ≡ proj₁ p₂) →
subst B p (proj₂ p₁) ≡ proj₂ p₂) ↔
(p₁ ≡ p₂)
Σ-≡,≡↔≡ {A = A} {B} {p₁} {p₂} = record
{ surjection = record
{ logical-equivalence = record
{ to = to
; from = from
}
; right-inverse-of = to∘from
}
; left-inverse-of = from∘to
}
where
from-P = λ {p₁ p₂ : Σ A B} (_ : p₁ ≡ p₂) →
∃ λ (p : proj₁ p₁ ≡ proj₁ p₂) →
subst B p (proj₂ p₁) ≡ proj₂ p₂
from : {p₁ p₂ : Σ A B} →
p₁ ≡ p₂ →
∃ λ (p : proj₁ p₁ ≡ proj₁ p₂) →
subst B p (proj₂ p₁) ≡ proj₂ p₂
from = Σ-≡,≡←≡
to : {p₁ p₂ : Σ A B} →
(∃ λ (p : proj₁ p₁ ≡ proj₁ p₂) →
subst B p (proj₂ p₁) ≡ proj₂ p₂) →
p₁ ≡ p₂
to = uncurry Σ-≡,≡→≡
abstract
to∘from : ∀ eq → to (from {p₁ = p₁} {p₂ = p₂} eq) ≡ eq
to∘from = elim (λ p≡q → to (from p≡q) ≡ p≡q) λ x →
let lem = subst-refl B (proj₂ x) in
to (from (refl x)) ≡⟨ cong to (elim-refl from-P _) ⟩
to (refl (proj₁ x) , lem) ≡⟨ Σ-≡,≡→≡-reflˡ _ ⟩
cong (_,_ (proj₁ x)) (trans (sym lem) lem) ≡⟨ cong (cong (_,_ (proj₁ x))) $ trans-symˡ lem ⟩
cong (_,_ (proj₁ x)) (refl (proj₂ x)) ≡⟨ cong-refl (_,_ (proj₁ x)) ⟩∎
refl x ∎
from∘to : ∀ p → from (to {p₁ = p₁} {p₂ = p₂} p) ≡ p
from∘to p = elim
(λ {x₁ x₂} x₁≡x₂ →
∀ {y₁ y₂} (y₁′≡y₂ : subst B x₁≡x₂ y₁ ≡ y₂) →
from (to (x₁≡x₂ , y₁′≡y₂)) ≡ (x₁≡x₂ , y₁′≡y₂))
(λ x {y₁} y₁′≡y₂ → elim
(λ {y₁ y₂} (y₁≡y₂ : y₁ ≡ y₂) →
(y₁′≡y₂ : subst B (refl x) y₁ ≡ y₂) →
y₁≡y₂ ≡ trans (sym $ subst-refl B y₁) y₁′≡y₂ →
from (to (refl x , y₁′≡y₂)) ≡ (refl x , y₁′≡y₂))
(λ y y′≡y eq →
let lem = subst-refl B y in
from (to (refl x , y′≡y)) ≡⟨ cong from $ Σ-≡,≡→≡-reflˡ _ ⟩
from (cong (_,_ x) (trans (sym lem) y′≡y)) ≡⟨ cong (from ⊚ cong (_,_ x)) $ sym eq ⟩
from (cong (_,_ x) (refl y)) ≡⟨ cong from $ cong-refl (_,_ x) ⟩
from (refl (x , y)) ≡⟨ elim-refl from-P _ ⟩
(refl x , lem) ≡⟨ cong (_,_ (refl x)) (
lem ≡⟨ sym $ trans-reflʳ _ ⟩
trans lem (refl _) ≡⟨ cong (trans lem) eq ⟩
trans lem (trans (sym lem) y′≡y) ≡⟨ sym $ trans-assoc _ _ _ ⟩
trans (trans lem (sym lem)) y′≡y ≡⟨ cong (λ p → trans p y′≡y) $ trans-symʳ lem ⟩
trans (refl _) y′≡y ≡⟨ trans-reflˡ _ ⟩∎
y′≡y ∎) ⟩∎
(refl x , y′≡y) ∎)
(trans (sym $ subst-refl B y₁) y₁′≡y₂)
y₁′≡y₂
(refl _))
(proj₁ p) (proj₂ p)
-- Equalities are closed, in a strong sense, under applications of
-- certain injections (at least inj₁ and inj₂).
≡↔inj₁≡inj₁ : ∀ {a b} {A : Type a} {B : Type b} {x y : A} →
(x ≡ y) ↔ _≡_ {A = A ⊎ B} (inj₁ x) (inj₁ y)
≡↔inj₁≡inj₁ {A = A} {B} {x} {y} = record
{ surjection = record
{ logical-equivalence = record
{ to = to
; from = from
}
; right-inverse-of = to∘from
}
; left-inverse-of = from∘to
}
where
to : x ≡ y → _≡_ {A = A ⊎ B} (inj₁ x) (inj₁ y)
to = cong inj₁
from = ⊎.cancel-inj₁
abstract
to∘from : ∀ ix≡iy → to (from ix≡iy) ≡ ix≡iy
to∘from ix≡iy =
cong inj₁ (⊎.cancel-inj₁ ix≡iy) ≡⟨ cong-∘ inj₁ [ P.id , const x ] ix≡iy ⟩
cong f ix≡iy ≡⟨ cong-roughly-id f p ix≡iy _ _ f≡id ⟩
trans (refl _) (trans ix≡iy $ sym (refl _)) ≡⟨ trans-reflˡ _ ⟩
trans ix≡iy (sym $ refl _) ≡⟨ cong (trans ix≡iy) sym-refl ⟩
trans ix≡iy (refl _) ≡⟨ trans-reflʳ _ ⟩∎
ix≡iy ∎
where
f : A ⊎ B → A ⊎ B
f = inj₁ ⊚ [ P.id , const x ]
p : A ⊎ B → Bool
p = if_then true else false
f≡id : ∀ z → T (p z) → f z ≡ z
f≡id (inj₁ x) = const (refl (inj₁ x))
f≡id (inj₂ y) = ⊥-elim
from∘to : ∀ x≡y → from (to x≡y) ≡ x≡y
from∘to x≡y =
cong [ P.id , const x ] (cong inj₁ x≡y) ≡⟨ cong-∘ [ P.id , const x ] inj₁ _ ⟩
cong P.id x≡y ≡⟨ sym $ cong-id _ ⟩∎
x≡y ∎
≡↔inj₂≡inj₂ : ∀ {a b} {A : Type a} {B : Type b} {x y : B} →
(x ≡ y) ↔ _≡_ {A = A ⊎ B} (inj₂ x) (inj₂ y)
≡↔inj₂≡inj₂ {A = A} {B} {x} {y} = record
{ surjection = record
{ logical-equivalence = record
{ to = to
; from = from
}
; right-inverse-of = to∘from
}
; left-inverse-of = from∘to
}
where
to : x ≡ y → _≡_ {A = A ⊎ B} (inj₂ x) (inj₂ y)
to = cong inj₂
from = ⊎.cancel-inj₂
abstract
to∘from : ∀ ix≡iy → to (from ix≡iy) ≡ ix≡iy
to∘from ix≡iy =
cong inj₂ (⊎.cancel-inj₂ ix≡iy) ≡⟨ cong-∘ inj₂ [ const x , P.id ] ix≡iy ⟩
cong f ix≡iy ≡⟨ cong-roughly-id f p ix≡iy _ _ f≡id ⟩
trans (refl _) (trans ix≡iy $ sym (refl _)) ≡⟨ trans-reflˡ _ ⟩
trans ix≡iy (sym $ refl _) ≡⟨ cong (trans ix≡iy) sym-refl ⟩
trans ix≡iy (refl _) ≡⟨ trans-reflʳ _ ⟩∎
ix≡iy ∎
where
f : A ⊎ B → A ⊎ B
f = inj₂ ⊚ [ const x , P.id ]
p : A ⊎ B → Bool
p = if_then false else true
f≡id : ∀ z → T (p z) → f z ≡ z
f≡id (inj₁ x) = ⊥-elim
f≡id (inj₂ y) = const (refl (inj₂ y))
from∘to : ∀ x≡y → from (to x≡y) ≡ x≡y
from∘to x≡y =
cong [ const x , P.id ] (cong inj₂ x≡y) ≡⟨ cong-∘ [ const x , P.id ] inj₂ _ ⟩
cong P.id x≡y ≡⟨ sym $ cong-id _ ⟩∎
x≡y ∎
-- An alternative characterisation of equality for binary sums.
Equality-⊎ : ∀ {a b} {A : Type a} {B : Type b} →
A ⊎ B → A ⊎ B → Type (a ⊔ b)
Equality-⊎ {b = b} (inj₁ x) (inj₁ y) = ↑ b (x ≡ y)
Equality-⊎ (inj₁ x) (inj₂ y) = ⊥
Equality-⊎ (inj₂ x) (inj₁ y) = ⊥
Equality-⊎ {a = a} (inj₂ x) (inj₂ y) = ↑ a (x ≡ y)
≡↔⊎ : ∀ {a b} {A : Type a} {B : Type b} {x y : A ⊎ B} →
x ≡ y ↔ Equality-⊎ x y
≡↔⊎ {x = inj₁ x} {inj₁ y} = inj₁ x ≡ inj₁ y ↔⟨ inverse ≡↔inj₁≡inj₁ ⟩
x ≡ y ↔⟨ inverse ↑↔ ⟩□
↑ _ (x ≡ y) □
≡↔⊎ {x = inj₁ x} {inj₂ y} = inj₁ x ≡ inj₂ y ↔⟨ inverse (⊥↔uninhabited ⊎.inj₁≢inj₂) ⟩□
⊥ □
≡↔⊎ {x = inj₂ x} {inj₁ y} = inj₂ x ≡ inj₁ y ↔⟨ inverse (⊥↔uninhabited (⊎.inj₁≢inj₂ ⊚ sym)) ⟩□
⊥ □
≡↔⊎ {x = inj₂ x} {inj₂ y} = inj₂ x ≡ inj₂ y ↔⟨ inverse ≡↔inj₂≡inj₂ ⟩
x ≡ y ↔⟨ inverse ↑↔ ⟩□
↑ _ (x ≡ y) □
-- Decidable equality respects bijections.
decidable-equality-respects :
∀ {a b} {A : Type a} {B : Type b} →
A ↔ B → Decidable-equality A → Decidable-equality B
decidable-equality-respects A↔B _≟A_ x y =
⊎-map (_↔_.injective (inverse A↔B))
(λ from-x≢from-y → from-x≢from-y ⊚ cong from)
(from x ≟A from y)
where open _↔_ A↔B
-- All contractible types are isomorphic.
contractible-isomorphic :
∀ {a b} {A : Type a} {B : Type b} →
Contractible A → Contractible B → A ↔ B
contractible-isomorphic {A} {B} cA cB = record
{ surjection = record
{ logical-equivalence = record
{ to = const (proj₁ cB)
; from = const (proj₁ cA)
}
; right-inverse-of = proj₂ cB
}
; left-inverse-of = proj₂ cA
}
-- Implicit and explicit Π's are isomorphic.
implicit-Π↔Π : ∀ {a b} {A : Type a} {B : A → Type b} →
({x : A} → B x) ↔ ((x : A) → B x)
implicit-Π↔Π = record
{ surjection = record
{ logical-equivalence = record
{ to = λ f x → f {x}
; from = λ f {x} → f x
}
; right-inverse-of = refl
}
; left-inverse-of = refl
}
-- Implicit and explicit Π's with erased domains are isomorphic.
implicit-Πᴱ↔Πᴱ :
∀ {a b} {A : Type a} {B : A → Type b} →
({@0 x : A} → B x) ↔ ((@0 x : A) → B x)
implicit-Πᴱ↔Πᴱ = record
{ surjection = record
{ logical-equivalence = record
{ to = λ f x → f {x}
; from = λ f {x} → f x
}
; right-inverse-of = refl
}
; left-inverse-of = refl
}
-- A variant of implicit-Πᴱ↔Πᴱ.
implicit-Πᴱ↔Πᴱ′ :
∀ {a b} {@0 A : Type a} {B : @0 A → Type b} →
({@0 x : A} → B x) ↔ ((@0 x : A) → B x)
implicit-Πᴱ↔Πᴱ′ {A = A} {B = B} = record
{ surjection = record
{ logical-equivalence = record
{ to = λ f x → f {x}
; from = λ f {x} → f x
}
; right-inverse-of = refl {A = (@0 x : A) → B x}
}
; left-inverse-of = refl {A = {@0 x : A} → B x}
}
-- Σ is associative.
Σ-assoc : ∀ {a b c}
{A : Type a} {B : A → Type b} {C : (x : A) → B x → Type c} →
(Σ A λ x → Σ (B x) (C x)) ↔ Σ (Σ A B) (uncurry C)
Σ-assoc = record
{ surjection = record
{ logical-equivalence = record
{ to = λ { (x , (y , z)) → (x , y) , z }
; from = λ { ((x , y) , z) → x , (y , z) }
}
; right-inverse-of = refl
}
; left-inverse-of = refl
}
-- Π and Σ commute (in a certain sense).
ΠΣ-comm :
∀ {a b c} {A : Type a} {B : A → Type b} {C : (x : A) → B x → Type c} →
(∀ x → ∃ λ (y : B x) → C x y)
↔
(∃ λ (f : ∀ x → B x) → ∀ x → C x (f x))
ΠΣ-comm = record
{ surjection = record
{ logical-equivalence = record
{ to = λ f → proj₁ ⊚ f , proj₂ ⊚ f
; from = λ { (f , g) x → f x , g x }
}
; right-inverse-of = refl
}
; left-inverse-of = refl
}
-- Equality is commutative.
≡-comm :
∀ {a} {A : Type a} {x y : A} →
x ≡ y ↔ y ≡ x
≡-comm = record
{ surjection = record
{ logical-equivalence = record { to = sym }
; right-inverse-of = sym-sym
}
; left-inverse-of = sym-sym
}
-- Families of functions that satisfy a kind of involution property
-- can be turned into bijections.
bijection-from-involutive-family :
∀ {a b} {A : Type a} {B : A → Type b} →
(f : ∀ a₁ a₂ → B a₁ → B a₂) →
(∀ a₁ a₂ (x : B a₁) → f _ _ (f _ a₂ x) ≡ x) →
∀ a₁ a₂ → B a₁ ↔ B a₂
bijection-from-involutive-family f f-involutive _ _ = record
{ surjection = record
{ logical-equivalence = record
{ to = f _ _
; from = f _ _
}
; right-inverse-of = f-involutive _ _
}
; left-inverse-of = f-involutive _ _
}
abstract
-- An equality rearrangement lemma.
trans-to-to≡to-trans :
∀ {a b} {A : Type a} {B : Type b} {f : A → B}
(iso : ∀ x y → f x ≡ f y ↔ x ≡ y) →
(∀ x → _↔_.from (iso x x) (refl x) ≡ refl (f x)) →
∀ {x y z p q} →
trans (_↔_.to (iso x y) p) (_↔_.to (iso y z) q) ≡
_↔_.to (iso x z) (trans p q)
trans-to-to≡to-trans {f = f} iso iso-refl {x} {y} {z} {p} {q} =
trans (_↔_.to (iso x y) p) (_↔_.to (iso y z) q) ≡⟨ elim₁ (λ {x} p → trans p (_↔_.to (iso y z) q) ≡
_↔_.to (iso x z) (trans (_↔_.from (iso x y) p) q)) (
trans (refl y) (_↔_.to (iso y z) q) ≡⟨ trans-reflˡ _ ⟩
_↔_.to (iso y z) q ≡⟨ cong (_↔_.to (iso y z)) $ sym $ trans-reflˡ _ ⟩
_↔_.to (iso y z) (trans (refl (f y)) q) ≡⟨ cong (_↔_.to (iso y z) ⊚ flip trans _) $ sym $ iso-refl y ⟩∎
_↔_.to (iso y z) (trans (_↔_.from (iso y y) (refl y)) q) ∎)
(_↔_.to (iso x y) p) ⟩
_↔_.to (iso x z)
(trans (_↔_.from (iso x y) (_↔_.to (iso x y) p)) q) ≡⟨ cong (_↔_.to (iso x z) ⊚ flip trans _) $
_↔_.left-inverse-of (iso _ _) _ ⟩∎
_↔_.to (iso x z) (trans p q) ∎
|
etc/applescripts/omnifocus-task-randomizer.applescript | romkatv/dotfiles | 2 | 414 | <reponame>romkatv/dotfiles
#!/usr/bin/osascript
property tagName : "Randomizer"
set theResult to {}
tell application "OmniFocus"
tell default document
set theTag to (first flattened tag whose name is tagName)
tell theTag
set taskCount to count tasks
if taskCount is 0
display notification "No Tasks"
copy ("No Tasks") to stdout
return stdout
end if
repeat with theTask in tasks
set theResult to theResult & {name of theTask}
end repeat
end tell
end tell
end tell
set resultTask to some item of theResult
display notification with title "Task Randomizer" subtitle resultTask
copy ("Result : " & resultTask) to stdout
|
oeis/073/A073718.asm | neoneye/loda-programs | 11 | 91961 | <filename>oeis/073/A073718.asm
; A073718: Powers of 2 with composite exponents.
; Submitted by <NAME>
; 16,64,256,512,1024,4096,16384,32768,65536,262144,1048576,2097152,4194304,16777216,33554432,67108864,134217728,268435456,1073741824,4294967296,8589934592,17179869184,34359738368,68719476736
seq $0,72668 ; Numbers one less than composite numbers.
seq $0,51 ; a(n) = 2^n + 1.
sub $0,9
mul $0,2
add $0,16
|
oeis/206/A206809.asm | neoneye/loda-programs | 11 | 18910 | <reponame>neoneye/loda-programs
; A206809: Sum_{0<j<k<=n} k^3-j^3.
; 7,52,208,608,1463,3080,5880,10416,17391,27676,42328,62608,89999,126224,173264,233376,309111,403332,519232,660352,830599,1034264,1276040,1561040,1894815,2283372,2733192,3251248,3845023,4522528,5292320,6163520,7145831,8249556,9485616,10865568,12401623,14106664,15994264,18078704,20374991,22898876,25666872,28696272,32005167,35612464,39537904,43802080,48426455,53433380,58846112,64688832,70986663,77765688,85052968,92876560,101265535,110249996,119861096,130131056,141093183,152781888,165232704
lpb $0
mov $2,$0
sub $0,1
seq $2,206808 ; Sum_{0<j<n} n^3-j^3.
add $1,$2
lpe
add $1,7
mov $0,$1
|
Library/Pref/Prefvid/prefvidDeviceList.asm | steakknife/pcgeos | 504 | 168525 | <gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: prefvidDeviceList.asm
AUTHOR: <NAME>
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 5/ 4/93 Initial version.
DESCRIPTION:
$Id: prefvidDeviceList.asm,v 1.1 97/04/05 01:36:19 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefVidDeviceListLoadOptions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION:
PASS: *ds:si - PrefVidDeviceListClass object
ds:di - PrefVidDeviceListClass instance data
es - dgroup
RETURN:
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 2/ 8/93 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefVidDeviceListLoadOptions method dynamic PrefVidDeviceListClass,
MSG_GEN_LOAD_OPTIONS
;
; See if the key exists in the .INI file
;
push cx,dx,bp,ds,si,es
sub sp, GEODE_MAX_DEVICE_NAME_SIZE
mov di, sp
mov cx, ss
mov es, cx
mov ds, cx
lea si, ss:[bp].GOP_category
lea dx, ss:[bp].GOP_key
mov bp, GEODE_MAX_DEVICE_NAME_SIZE
call InitFileReadString
lea sp, ss:[di][GEODE_MAX_DEVICE_NAME_SIZE]
pop cx,dx,bp,ds,si,es
jc notFound
;
; Just call the superclass -- it knows what to do.
;
mov di, offset PrefVidDeviceListClass
GOTO ObjCallSuperNoLock
;----------------------------------------
notFound:
;
; There's no .INI key, so ask the driver which device it's
; running.
;
push ds, si
mov ax, GDDT_VIDEO
call GeodeGetDefaultDriver
mov_tr bx, ax
call GeodeInfoDriver ; ds:si - strategy routine
mov bx, ds:[si].DEIS_resource ; lmem block
; containing device names
mov di, ds:[si].VDI_device ; current device
call MemLock
mov es, ax
mov bp, es:[DEIT_nameTable]
mov di, es:[bp][di] ; device name
pop ds, si
mov cx, es
mov dx, es:[di]
clr bp
mov ax, MSG_PREF_DYNAMIC_LIST_FIND_ITEM
call ObjCallInstanceNoLock
mov_tr cx, ax ; cx <- item #
;
; Unlock the device name block
;
call MemUnlock
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
clr dx
GOTO ObjCallInstanceNoLock
PrefVidDeviceListLoadOptions endm
|
extensions/xada-dispatching-tts.adb | rocher/TTS-Runtime-Ravenscar | 2 | 10734 | ------------------------------------------------------------
--
-- GNAT RUN-TIME EXTENSIONS
--
-- XADA . DISPATCHING . TIME-TRIGGERED SCHEDULING
--
-- @file x-distts.adb / xada-dispatching-tts.adb
--
-- @package XAda.Dispatching.TTS (BODY)
--
-- @author <NAME> <<EMAIL>>
-- @author <NAME> <<EMAIL>>
--
------------------------------------------------------------
with Ada.Task_Identification; use Ada.Task_Identification;
with Ada.Synchronous_Task_Control; use Ada.Synchronous_Task_Control;
with Ada.Real_Time; use Ada.Real_Time;
with Ada.Real_Time.Timing_Events; use Ada.Real_Time.Timing_Events;
with Ada.Text_IO; use Ada.Text_IO;
with System.BB.Threads; use System.BB.Threads;
with System.TTS_Support; use System.TTS_Support;
package body XAda.Dispatching.TTS is
-- Conservative bound of measured overhead on a STM32F4 Discovery
-- Since release jitter is very predictable in this platform (between
-- 23 and 24 us) we charge that overhead at the end of the slot, by
-- effectively advancing the slot start time by the Overhead time.
-- This reduces the release jitter even further for TT tasks, to about 3 us
Overhead : constant Time_Span := Microseconds (0);
-- Run time TT work info
type Work_Control_Block is record
Has_Completed : Boolean := True; -- TT part has completed
Is_Waiting : Boolean := False; -- Task is waiting for release
Is_Sliced : Boolean := False; -- Task is in a sliced sequence
Work_Thread_Id : Thread_Id := Null_Thread_Id; -- Underlying thread id
Last_Release : Time := Time_Last; -- Time of last release
end record;
-- Array of Work_Control_Blocks
WCB : array (TT_Work_Id) of aliased Work_Control_Block;
-- Array of suspension objects for TT tasks to wait for activation
Release_Point : array (TT_Work_Id) of Suspension_Object;
-- Run time TT sync info
type Sync_Control_Block is record
Sync_Thread_Id : Thread_Id := Null_Thread_Id; -- Underlying thread id
Last_Release : Time := Time_Last; -- Time of last release
end record;
-- Array of Work_Control_Blocks
SCB : array (TT_Sync_Id) of aliased Sync_Control_Block;
-- Array of suspension objects for ET tasks to wait for synchronization
Sync_Point : array (TT_Sync_Id) of Suspension_Object;
----------------
-- Set_Plan --
----------------
procedure Set_Plan (TTP : Time_Triggered_Plan_Access) is
begin
Time_Triggered_Scheduler.Set_Plan (TTP);
end Set_Plan;
--------------------------
-- Wait_For_Activation --
--------------------------
procedure Wait_For_Activation
(Work_Id : TT_Work_Id;
When_Was_Released : out Time) is
begin
-- Raise own priority, before getting blocked. This is to recover the TT
-- priority when the calling task has previuosly called Leave_TT_Level
Set_Priority (TT_Priority);
-- Inform the TT scheduler the task is going to wait for activation
Time_Triggered_Scheduler.Prepare_For_Activation (Work_Id);
-- Suspend until the next slot for Work_Id starts
Suspend_Until_True (Release_Point (Work_Id));
-- Scheduler updated Last_Release when it released the worker task
When_Was_Released := WCB (Work_Id).Last_Release;
end Wait_For_Activation;
---------------------
-- Continue_Sliced --
---------------------
procedure Continue_Sliced is
begin
Time_Triggered_Scheduler.Continue_Sliced;
end Continue_Sliced;
--------------------
-- Leave_TT_Level --
--------------------
procedure Leave_TT_Level is
begin
Time_Triggered_Scheduler.Leave_TT_Level;
end Leave_TT_Level;
----------------------------
-- Get_First_Plan_Release --
----------------------------
function Get_First_Plan_Release return Ada.Real_Time.Time is
begin
return Time_Triggered_Scheduler.Get_First_Plan_Release;
end Get_First_Plan_Release;
---------------------------
-- Get_Last_Plan_Release --
---------------------------
function Get_Last_Plan_Release return Ada.Real_Time.Time is
begin
return Time_Triggered_Scheduler.Get_Last_Plan_Release;
end Get_Last_Plan_Release;
--------------------
-- Wait_For_Sync --
--------------------
procedure Wait_For_Sync
(Sync_Id : TT_Sync_Id;
When_Was_Released : out Time) is
begin
-- Inform the TT scheduler the ET task has reached the sync point
Time_Triggered_Scheduler.Prepare_For_Sync (Sync_Id);
-- Suspend until the next sync slot for Sync_Id starts
-- If the sync point has been already reached in the plan,
-- the SO is open and the ET task will not suspend
Suspend_Until_True (Sync_Point (Sync_Id));
-- Scheduler updated Last_Release when it released the sync'ed task
When_Was_Released := SCB (Sync_Id).Last_Release;
end Wait_For_Sync;
------------------------------
-- Time_Triggered_Scheduler --
------------------------------
protected body Time_Triggered_Scheduler is
--------------
-- Set_Plan --
--------------
procedure Set_Plan (TTP : Time_Triggered_Plan_Access) is
Now : constant Time := Clock;
begin
-- Take note of next plan to execute
Next_Plan := TTP;
-- Start new plan now if none is set. Otherwise, the scheduler will
-- change to the Next_Plan at the end of the next mode change slot
if Current_Plan = null then
-- The extra 'overhead' delay is to bypass the exception we get
-- if we don't add it. We still have to debug this. Note that the
-- delay only affects the first mode change, because Current_Plan
-- is null.
Change_Plan (Now + Milliseconds(1));
elsif Current_Plan (Current_Slot_Index).all in Mode_Change_Slot'Class then
-- Accept Set_Plan requests during a mode change slot (coming
-- from PB tasks) and enforce the mode change at the end of it.
Change_Plan (Next_Slot_Release);
end if;
end Set_Plan;
----------------------------
-- Prepare_For_Activation --
----------------------------
procedure Prepare_For_Activation (Work_Id : TT_Work_Id) is
Current_Slot : Time_Slot_Access;
Current_Work_Slot : Work_Slot_Access;
Cancelled : Boolean;
begin
-- Register the Work_Id with the first task using it.
-- Use of the Work_Id by another task breaks the model and causes PE
if WCB (Work_Id).Work_Thread_Id = Null_Thread_Id then
-- First time WFA called with this Work_Id -> Register caller
-- WCB (Work_Id).Work_Task_Id := Current_Task;
WCB (Work_Id).Work_Thread_Id := Thread_Self;
elsif WCB (Work_Id).Work_Thread_Id /= Thread_Self then
-- Caller was not registered with this Work_Id
raise Program_Error with ("Work_Id misuse");
end if;
if Current_Plan /= null then
Current_Slot := Current_Plan (Current_Slot_Index);
if Current_Slot.all in Work_Slot'Class then
Current_Work_Slot := Work_Slot_Access(Current_Slot);
-- If the invoking thread is the owner of the current Work Slot
-- then the slot is considered completed.
if WCB (Current_Work_Slot.Work_Id).Work_Thread_Id = Thread_Self then
WCB (Current_Work_Slot.Work_Id).Has_Completed := True;
end if;
end if;
end if;
-- Work has been completed and the caller is about to be suspended
WCB (Work_Id).Is_Waiting := True;
Hold_Event.Cancel_Handler(Cancelled);
-- The task has to execute Suspend_Until_True after this point
end Prepare_For_Activation;
---------------------
-- Continue_Sliced --
---------------------
procedure Continue_Sliced is
Current_Slot : constant Time_Slot_Access :=
Current_Plan (Current_Slot_Index);
Current_Work_Slot : Work_Slot_Access;
begin
if Current_Slot.all not in Work_Slot'Class then
raise Program_Error
with ("Continue_Sliced called from a non-TT task");
end if;
Current_Work_Slot := Work_Slot_Access(Current_Slot);
if WCB (Current_Work_Slot.Work_Id).Work_Thread_Id /= Thread_Self then
raise Program_Error
with ("Running Task does not correspond to Work_Id " &
Current_Work_Slot.Work_Id'Image);
end if;
WCB (Current_Work_Slot.Work_Id).Is_Sliced := True;
if Current_Work_Slot.Padding > Time_Span_Zero then
Hold_Event.Set_Handler (Next_Slot_Release - Current_Work_Slot.Padding,
Hold_Handler_Access);
end if;
end Continue_Sliced;
--------------------
-- Leave_TT_Level --
--------------------
procedure Leave_TT_Level is -- (Work_Id : Regular_Work_Id) is
Current_Slot : constant Time_Slot_Access :=
Current_Plan (Current_Slot_Index);
Current_Work_Slot : Work_Slot_Access;
Base_Priority : System.Priority;
Cancelled : Boolean;
begin
if Current_Slot.all not in Work_Slot'Class then
raise Program_Error
with ("Leave_TT_Level called from a non-TT task");
end if;
Current_Work_Slot := Work_Slot_Access(Current_Slot);
if WCB (Current_Work_Slot.Work_Id).Work_Thread_Id /= Thread_Self then
raise Program_Error
with ("Leave_TT_Level called from Work_Id different to " &
Current_Work_Slot.Work_Id'Image);
end if;
WCB (Current_Work_Slot.Work_Id).Has_Completed := True;
Hold_Event.Cancel_Handler(Cancelled);
Base_Priority :=
WCB (Current_Work_Slot.Work_Id).Work_Thread_Id.Base_Priority;
Set_Priority (Base_Priority);
end Leave_TT_Level;
-----------------
-- Change_Plan --
-----------------
procedure Change_Plan (At_Time : Time) is
begin
Current_Plan := Next_Plan;
Next_Plan := null;
-- Setting both Current_ and Next_Slot_Index to 'First is consistent
-- with the new slot TE handler for the first slot of a new plan.
Current_Slot_Index := Current_Plan.all'First;
Next_Slot_Index := Current_Plan.all'First;
Next_Slot_Release := At_Time;
Plan_Start_Pending := True;
NS_Event.Set_Handler (At_Time - Overhead, NS_Handler_Access);
end Change_Plan;
----------------------------
-- Get_Last_First_Release --
----------------------------
function Get_First_Plan_Release return Ada.Real_Time.Time is
begin
return First_Plan_Release;
end Get_First_Plan_Release;
---------------------------
-- Get_Last_Plan_Release --
---------------------------
function Get_Last_Plan_Release return Ada.Real_Time.Time is
begin
return First_Slot_Release;
end Get_Last_Plan_Release;
----------------------
-- Prepare_For_Sync --
----------------------
procedure Prepare_For_Sync (Sync_Id : TT_Sync_Id) is
Current_Slot : Time_Slot_Access;
Current_Work_Slot : Work_Slot_Access;
begin
-- Register the Sync_Id with the first task using it.
-- Use of the Sync_Id by another task breaks the model and causes PE
if SCB (Sync_Id).Sync_Thread_Id = Null_Thread_Id then
-- First time WFS called with this Sync_Id -> Register caller
-- SCB (Sync_Id).Work_Task_Id := Current_Task;
SCB (Sync_Id).Sync_Thread_Id := Thread_Self;
elsif SCB (Sync_Id).Sync_Thread_Id /= Thread_Self then
-- Caller was not registered with this Sync_Id
raise Program_Error with ("Sync_Id misuse");
end if;
if Current_Plan /= null then
Current_Slot := Current_Plan (Current_Slot_Index);
if Current_Slot.all in Work_Slot'Class then
Current_Work_Slot := Work_Slot_Access(Current_Slot);
-- If the invoking thread is the owner of the current Work Slot
-- then the slot is considered completed.
if WCB (Current_Work_Slot.Work_Id).Work_Thread_Id = Thread_Self then
WCB (Current_Work_Slot.Work_Id).Has_Completed := True;
end if;
end if;
end if;
-- The task has to execute Suspend_Until_True after this point
end Prepare_For_Sync;
------------------
-- Hold_Handler --
------------------
procedure Hold_Handler (Event : in out Timing_Event) is
pragma Unreferenced (Event);
Current_Slot : constant Time_Slot_Access :=
Current_Plan (Current_Slot_Index);
Current_Work_Slot : Work_Slot_Access;
Current_WCB : Work_Control_Block;
Current_Thread_Id : Thread_Id;
begin
if Current_Slot.all not in Work_Slot'Class then
raise Program_Error
with ("Hold handler called for a non-TT task");
end if;
Current_Work_Slot := Work_Slot_Access(Current_Slot);
Current_WCB := WCB (Current_Work_Slot.Work_Id);
Current_Thread_Id := Current_WCB.Work_Thread_Id;
if not Current_WCB.Has_Completed then
Hold (Current_Thread_Id);
end if;
end Hold_Handler;
----------------
-- NS_Handler --
----------------
procedure NS_Handler (Event : in out Timing_Event) is
pragma Unreferenced (Event);
Current_Slot : Time_Slot_Access;
Current_Work_Slot : Work_Slot_Access;
Current_WCB : Work_Control_Block;
Current_Sync_Slot : Sync_Slot_Access;
Current_Thread_Id : Thread_Id;
Now : Time;
begin
-- This is the current time, according to the plan
Now := Next_Slot_Release;
--------------------------
-- PROCESS ENDING SLOT --
--------------------------
-- Check for overrun in the ending slot, if it is a TT_Work_Slot.
-- If this happens to be the first slot after a plan change, then
-- we come from a mode-change slot, so there is no overrun to check,
-- because it was checked before that mode-change slot
Current_Slot := Current_Plan (Current_Slot_Index);
-- Nothing to be done unless the ending slot was a TT_Work_Slot
if Current_Slot.all in Work_Slot'Class then
Current_Work_Slot := Work_Slot_Access(Current_Slot);
Current_WCB := WCB (Current_Work_Slot.Work_Id);
if not Current_WCB.Has_Completed then
-- Possible overrun detected, unless task is running sliced.
-- First check that all is going well
Current_Thread_Id := Current_WCB.Work_Thread_Id;
-- Check whether the task is running sliced or this is
-- a real overrun situation
if Current_WCB.Is_Sliced then
if Current_Work_Slot.Padding > Time_Span_Zero then
if Current_Thread_Id.Hold_Signaled then
raise Program_Error
with ("Overrun in PA of Sliced TT task " &
Current_Work_Slot.Work_Id'Image);
end if;
else
-- Thread_Self is the currently running thread on this CPU.
-- If this assertion fails, the running TT task is using a
-- wrong slot, which should never happen
pragma Assert (Current_Thread_Id = Thread_Self);
Hold (Current_Thread_Id, True);
end if;
-- Context switch occurs after executing this handler
else
-- Overrun detected, raise Program_Error
raise Program_Error
with ("Overrun in TT task " &
Current_Work_Slot.Work_Id'Image);
end if;
end if;
end if;
---------------------------
-- PROCESS STARTING SLOT --
---------------------------
-- Update current slot index
Current_Slot_Index := Next_Slot_Index;
if Current_Slot_Index = Current_Plan.all'First then
First_Slot_Release := Now;
if Plan_Start_Pending then
First_Plan_Release := Now;
Plan_Start_Pending := False;
end if;
end if;
-- Obtain next slot index. The plan is repeated circularly
if Next_Slot_Index < Current_Plan.all'Last then
Next_Slot_Index := Next_Slot_Index + 1;
else
Next_Slot_Index := Current_Plan.all'First;
end if;
-- Obtain current slot
Current_Slot := Current_Plan (Current_Slot_Index);
-- Compute next slot start time
Next_Slot_Release := Now + Current_Slot.Slot_Duration;
if Current_Slot.all in Mode_Change_Slot'Class then
----------------------------------
-- Process a Mode_Change_Slot --
----------------------------------
if Next_Plan /= null then
-- There's a pending plan change.
-- It takes effect at the end of the MC slot
Change_Plan (Next_Slot_Release);
else
-- Set the handler for the next scheduling point
NS_Event.Set_Handler (Next_Slot_Release - Overhead,
NS_Handler_Access);
end if;
elsif Current_Slot.all in Empty_Slot'Class then
-----------------------------
-- Process an Empty_Slot --
-----------------------------
-- Just set the handler for the next scheduling point
NS_Event.Set_Handler (Next_Slot_Release - Overhead,
NS_Handler_Access);
elsif Current_Slot.all in Sync_Slot'Class then
----------------------------
-- Process a Sync_Slot --
----------------------------
Current_Sync_Slot := Sync_Slot_Access(Current_Slot);
SCB (Current_Sync_Slot.Sync_Id).Last_Release := Now;
Set_True (Sync_Point (Current_Sync_Slot.Sync_Id));
-- Set the handler for the next scheduling point
NS_Event.Set_Handler (Next_Slot_Release - Overhead,
NS_Handler_Access);
elsif Current_Slot.all in Work_Slot'Class then
-----------------------------
-- Process a Work_Slot --
-----------------------------
Current_Work_Slot := Work_Slot_Access(Current_Slot);
Current_WCB := WCB (Current_Work_Slot.Work_Id);
Current_Thread_Id := Current_WCB.Work_Thread_Id;
-- Check what needs be done to the TT task of the new slot
if Current_WCB.Has_Completed then
-- The TT task has abandoned the TT level or has called
-- Wait_For_Activation
if Current_WCB.Is_Sliced then
-- The completed TT task was running sliced and it has
-- completed, so this slot is not needed by the task.
null;
elsif Current_WCB.Is_Waiting then
-- TT task is waiting in Wait_For_Activation
-- Update WCB and release TT task
WCB (Current_Work_Slot.Work_Id).Last_Release := Now;
WCB (Current_Work_Slot.Work_Id).Has_Completed := False;
WCB (Current_Work_Slot.Work_Id).Is_Waiting := False;
Set_True (Release_Point (Current_Work_Slot.Work_Id));
if Current_Work_Slot.Is_Continuation and then
Current_Work_Slot.Padding > Time_Span_Zero then
Hold_Event.Set_Handler (Next_Slot_Release -
Current_Work_Slot.Padding,
Hold_Handler_Access);
end if;
elsif Current_Work_Slot.all in Optional_Slot'Class then
-- If the slot is optional, it is not an error if the TT
-- task has not invoked Wait_For_Activation
null;
else
-- Task is not waiting for its next activation.
-- It must have abandoned the TT Level or it is waiting in
-- a different work slot
raise Program_Error
with ("Task is late to next activation for Work_Id " &
Current_Work_Slot.Work_Id'Image);
end if;
else
-- The TT task has not completed and no overrun has been
-- detected so far, so it must be running sliced and is
-- currently held from a previous exhausted slot, so it
-- must be resumed
pragma Assert (Current_WCB.Is_Sliced);
-- Change thread state to runnable and insert it at the tail
-- of its active priority, which here implies that the
-- thread will be the next to execute
Continue (Current_Thread_Id);
if Current_Work_Slot.Is_Continuation and then
Current_Work_Slot.Padding > Time_Span_Zero then
Hold_Event.Set_Handler (Next_Slot_Release -
Current_Work_Slot.Padding,
Hold_Handler_Access);
end if;
end if;
-- Common actions to process the new slot --
-- The work inherits its Is_Sliced condition from the
-- Is_Continuation property of the new slot
WCB (Current_Work_Slot.Work_Id).Is_Sliced :=
Current_Work_Slot.Is_Continuation;
-- Set timing event for the next scheduling point
NS_Event.Set_Handler (Next_Slot_Release - Overhead,
NS_Handler_Access);
end if;
end NS_Handler;
end Time_Triggered_Scheduler;
end XAda.Dispatching.TTS;
|
libsrc/graphics/tiki100/w_line.asm | grancier/z180 | 0 | 13653 | INCLUDE "graphics/grafix.inc"
PUBLIC w_line
EXTERN w_line_r
EXTERN __gfx_coords
;
; $Id: w_line.asm,v 1.2 2016/07/02 09:01:36 dom Exp $
;
; ******************************************************************************
;
; Draw a pixel line from (x0,y0) defined in COORDS (word,word) - the starting point coordinate,
; to the end point (HL,DE).
;
; Wide resolution (16 bit parameters) version by <NAME>
;
.w_line
ex de,hl
ld bc,(__gfx_coords+2)
or a
sbc hl,bc
ex de,hl
ld bc,(__gfx_coords)
or a
sbc hl,bc
.nocrossx
jp w_line_r
|
test/asm/scas.asm | nigelperks/BasicAssembler | 0 | 173706 | IDEAL
SEGMENT SEG1
ASSUME CS:SEG1,DS:SEG1,ES:SEG1,SS:SEG1
ORG 100h
start:
jmp over ; force resize pass
; source: SI
; destination: AL
scas [byte di]
scas [byte es:di]
scas [word di]
scas [word es:di]
over:
int 20h
ENDS SEG1
END start
|
data/prizes.asm | etdv-thevoid/pokemon-rgb-enhanced | 1 | 18231 | <filename>data/prizes.asm<gh_stars>1-10
PrizeDifferentMenuPtrs:
dw PrizeMenuMon1Entries
dw PrizeMenuMon1Cost
dw PrizeMenuMon2Entries
dw PrizeMenuMon2Cost
dw PrizeMenuTMsEntries
dw PrizeMenuTMsCost
NoThanksText:
db "NO THANKS@"
PrizeMenuMon1Entries:
db ABRA
db CLEFAIRY
db DRATINI
db "@"
PrizeMenuMon1Cost:
coins 250
coins 1000
coins 2750
db "@"
PrizeMenuMon2Entries:
db EEVEE
IF DEF(_RED)
db MAGMAR
ENDC
IF DEF(_GREEN)
db ELECTABUZZ
ENDC
IF DEF(_BLUE)
db JYNX
ENDC
db PORYGON
db "@"
PrizeMenuMon2Cost:
coins 4400
coins 6600
coins 8800
db "@"
PrizeMenuTMsEntries:
db TM_36
db TM_15
db TM_50
db "@"
PrizeMenuTMsCost:
coins 3300
coins 5500
coins 7700
db "@"
|
test/Fail/Issue1012.agda | shlevy/agda | 3 | 3090 |
open import Common.Prelude
open import Common.Reflection
id : {A : Set} → A → A
id x = x
idTerm : Term
idTerm = lam visible (abs "x" (def (quote id) (arg₁ ∷ arg₂ ∷ [])))
where
arg₁ = arg (argInfo hidden relevant) (def (quote Nat) [])
arg₂ = arg (argInfo visible relevant) (var 0 [])
-- Should fail since idTerm "λ z → id {Nat} z"
id₂ : {A : Set} → A → A
id₂ = unquote (give idTerm)
|
source/oasis/program-elements-known_discriminant_parts.ads | optikos/oasis | 0 | 16917 | <gh_stars>0
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Definitions;
with Program.Lexical_Elements;
with Program.Elements.Discriminant_Specifications;
package Program.Elements.Known_Discriminant_Parts is
pragma Pure (Program.Elements.Known_Discriminant_Parts);
type Known_Discriminant_Part is
limited interface and Program.Elements.Definitions.Definition;
type Known_Discriminant_Part_Access is
access all Known_Discriminant_Part'Class with Storage_Size => 0;
not overriding function Discriminants
(Self : Known_Discriminant_Part)
return Program.Elements.Discriminant_Specifications
.Discriminant_Specification_Vector_Access is abstract;
type Known_Discriminant_Part_Text is limited interface;
type Known_Discriminant_Part_Text_Access is
access all Known_Discriminant_Part_Text'Class with Storage_Size => 0;
not overriding function To_Known_Discriminant_Part_Text
(Self : aliased in out Known_Discriminant_Part)
return Known_Discriminant_Part_Text_Access is abstract;
not overriding function Left_Bracket_Token
(Self : Known_Discriminant_Part_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Right_Bracket_Token
(Self : Known_Discriminant_Part_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Known_Discriminant_Parts;
|
oeis/342/A342912.asm | neoneye/loda-programs | 11 | 94992 | ; A342912: a(n) = [x^n] (1 - 2*x - sqrt((1 - 3*x)/(1 + x)))/(2*x^3).
; Submitted by <NAME>
; 1,1,3,6,15,36,91,232,603,1585,4213,11298,30537,83097,227475,625992,1730787,4805595,13393689,37458330,105089229,295673994,834086421,2358641376,6684761125,18985057351,54022715451,154000562758,439742222071,1257643249140,3602118427251
add $0,3
mov $1,1
mov $3,$0
mov $4,1
lpb $3
sub $3,1
div $4,-1
mul $4,$3
add $5,$1
add $1,1
mod $1,2
div $4,$5
add $2,$4
lpe
mov $0,$2
add $0,1
|
ioq3/build/release-js-js/baseq3/game/g_team.asm | RawTechnique/quake-port | 1 | 244981 | export Team_InitGame
code
proc Team_InitGame 0 12
ADDRGP4 teamgame
ARGP4
CNSTI4 0
ARGI4
CNSTU4 36
ARGU4
ADDRGP4 qk_memset
CALLP4
pop
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 4
EQI4 $57
ADDRGP4 $55
JUMPV
LABELV $57
ADDRGP4 teamgame+8
CNSTI4 -1
ASGNI4
CNSTI4 1
ARGI4
CNSTI4 0
ARGI4
ADDRGP4 Team_SetFlagStatus
CALLV
pop
ADDRGP4 teamgame+12
CNSTI4 -1
ASGNI4
CNSTI4 2
ARGI4
CNSTI4 0
ARGI4
ADDRGP4 Team_SetFlagStatus
CALLV
pop
LABELV $55
LABELV $53
endproc Team_InitGame 0 12
export OtherTeam
proc OtherTeam 0 0
ADDRFP4 0
INDIRI4
CNSTI4 1
NEI4 $61
CNSTI4 2
RETI4
ADDRGP4 $60
JUMPV
LABELV $61
ADDRFP4 0
INDIRI4
CNSTI4 2
NEI4 $63
CNSTI4 1
RETI4
ADDRGP4 $60
JUMPV
LABELV $63
ADDRFP4 0
INDIRI4
RETI4
LABELV $60
endproc OtherTeam 0 0
export TeamName
proc TeamName 0 0
ADDRFP4 0
INDIRI4
CNSTI4 1
NEI4 $66
ADDRGP4 $68
RETP4
ADDRGP4 $65
JUMPV
LABELV $66
ADDRFP4 0
INDIRI4
CNSTI4 2
NEI4 $69
ADDRGP4 $71
RETP4
ADDRGP4 $65
JUMPV
LABELV $69
ADDRFP4 0
INDIRI4
CNSTI4 3
NEI4 $72
ADDRGP4 $74
RETP4
ADDRGP4 $65
JUMPV
LABELV $72
ADDRGP4 $75
RETP4
LABELV $65
endproc TeamName 0 0
export TeamColorString
proc TeamColorString 0 0
ADDRFP4 0
INDIRI4
CNSTI4 1
NEI4 $77
ADDRGP4 $79
RETP4
ADDRGP4 $76
JUMPV
LABELV $77
ADDRFP4 0
INDIRI4
CNSTI4 2
NEI4 $80
ADDRGP4 $82
RETP4
ADDRGP4 $76
JUMPV
LABELV $80
ADDRFP4 0
INDIRI4
CNSTI4 3
NEI4 $83
ADDRGP4 $85
RETP4
ADDRGP4 $76
JUMPV
LABELV $83
ADDRGP4 $86
RETP4
LABELV $76
endproc TeamColorString 0 0
proc PrintMsg 1048 16
ADDRLP4 1028
ADDRFP4 4+4
ASGNP4
ADDRLP4 4
ARGP4
CNSTU4 1024
ARGU4
ADDRFP4 4
INDIRP4
ARGP4
ADDRLP4 1028
INDIRP4
ARGP4
ADDRLP4 1032
ADDRGP4 qk_vsnprintf
CALLI4
ASGNI4
ADDRLP4 1032
INDIRI4
CVIU4 4
CNSTU4 1024
LTU4 $89
ADDRGP4 $91
ARGP4
ADDRGP4 G_Error
CALLV
pop
LABELV $89
ADDRLP4 1028
CNSTP4 0
ASGNP4
ADDRGP4 $93
JUMPV
LABELV $92
ADDRLP4 0
INDIRP4
CNSTI1 39
ASGNI1
LABELV $93
ADDRLP4 4
ARGP4
CNSTI4 34
ARGI4
ADDRLP4 1036
ADDRGP4 qk_strchr
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 1036
INDIRP4
ASGNP4
ADDRLP4 1036
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $92
ADDRGP4 $96
ARGP4
ADDRLP4 4
ARGP4
ADDRLP4 1044
ADDRGP4 va
CALLP4
ASGNP4
ADDRFP4 0
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $97
ADDRLP4 1040
CNSTI4 -1
ASGNI4
ADDRGP4 $98
JUMPV
LABELV $97
ADDRLP4 1040
ADDRFP4 0
INDIRP4
CVPU4 4
ADDRGP4 g_entities
CVPU4 4
SUBU4
CVUI4 4
CNSTI4 804
DIVI4
ASGNI4
LABELV $98
ADDRLP4 1040
INDIRI4
ARGI4
ADDRLP4 1044
INDIRP4
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
LABELV $87
endproc PrintMsg 1048 16
export AddTeamScore
proc AddTeamScore 16 8
ADDRFP4 0
INDIRP4
ARGP4
CNSTI4 47
ARGI4
ADDRLP4 4
ADDRGP4 G_TempEntity
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 8
ADDRLP4 0
INDIRP4
CNSTI4 424
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRI4
CNSTI4 32
BORI4
ASGNI4
ADDRFP4 4
INDIRI4
CNSTI4 1
NEI4 $100
ADDRGP4 level+44+4
INDIRI4
ADDRFP4 8
INDIRI4
ADDI4
ADDRGP4 level+44+8
INDIRI4
NEI4 $102
ADDRLP4 0
INDIRP4
CNSTI4 184
ADDP4
CNSTI4 12
ASGNI4
ADDRGP4 $101
JUMPV
LABELV $102
ADDRGP4 level+44+4
INDIRI4
ADDRGP4 level+44+8
INDIRI4
GTI4 $108
ADDRGP4 level+44+4
INDIRI4
ADDRFP4 8
INDIRI4
ADDI4
ADDRGP4 level+44+8
INDIRI4
LEI4 $108
ADDRLP4 0
INDIRP4
CNSTI4 184
ADDP4
CNSTI4 10
ASGNI4
ADDRGP4 $101
JUMPV
LABELV $108
ADDRLP4 0
INDIRP4
CNSTI4 184
ADDP4
CNSTI4 8
ASGNI4
ADDRGP4 $101
JUMPV
LABELV $100
ADDRGP4 level+44+8
INDIRI4
ADDRFP4 8
INDIRI4
ADDI4
ADDRGP4 level+44+4
INDIRI4
NEI4 $118
ADDRLP4 0
INDIRP4
CNSTI4 184
ADDP4
CNSTI4 12
ASGNI4
ADDRGP4 $119
JUMPV
LABELV $118
ADDRGP4 level+44+8
INDIRI4
ADDRGP4 level+44+4
INDIRI4
GTI4 $124
ADDRGP4 level+44+8
INDIRI4
ADDRFP4 8
INDIRI4
ADDI4
ADDRGP4 level+44+4
INDIRI4
LEI4 $124
ADDRLP4 0
INDIRP4
CNSTI4 184
ADDP4
CNSTI4 11
ASGNI4
ADDRGP4 $125
JUMPV
LABELV $124
ADDRLP4 0
INDIRP4
CNSTI4 184
ADDP4
CNSTI4 9
ASGNI4
LABELV $125
LABELV $119
LABELV $101
ADDRLP4 12
ADDRFP4 4
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+44
ADDP4
ASGNP4
ADDRLP4 12
INDIRP4
ADDRLP4 12
INDIRP4
INDIRI4
ADDRFP4 8
INDIRI4
ADDI4
ASGNI4
LABELV $99
endproc AddTeamScore 16 8
export OnSameTeam
proc OnSameTeam 16 0
ADDRLP4 0
CNSTI4 516
ASGNI4
ADDRLP4 4
CNSTU4 0
ASGNU4
ADDRFP4 0
INDIRP4
ADDRLP4 0
INDIRI4
ADDP4
INDIRP4
CVPU4 4
ADDRLP4 4
INDIRU4
EQU4 $138
ADDRFP4 4
INDIRP4
ADDRLP4 0
INDIRI4
ADDP4
INDIRP4
CVPU4 4
ADDRLP4 4
INDIRU4
NEU4 $136
LABELV $138
CNSTI4 0
RETI4
ADDRGP4 $135
JUMPV
LABELV $136
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 3
GEI4 $139
CNSTI4 0
RETI4
ADDRGP4 $135
JUMPV
LABELV $139
ADDRLP4 8
CNSTI4 516
ASGNI4
ADDRLP4 12
CNSTI4 616
ASGNI4
ADDRFP4 0
INDIRP4
ADDRLP4 8
INDIRI4
ADDP4
INDIRP4
ADDRLP4 12
INDIRI4
ADDP4
INDIRI4
ADDRFP4 4
INDIRP4
ADDRLP4 8
INDIRI4
ADDP4
INDIRP4
ADDRLP4 12
INDIRI4
ADDP4
INDIRI4
NEI4 $142
CNSTI4 1
RETI4
ADDRGP4 $135
JUMPV
LABELV $142
CNSTI4 0
RETI4
LABELV $135
endproc OnSameTeam 16 0
data
align 1
LABELV ctfFlagStatusRemap
byte 1 48
byte 1 49
byte 1 42
byte 1 42
byte 1 50
align 1
LABELV oneFlagStatusRemap
byte 1 48
byte 1 49
byte 1 50
byte 1 51
byte 1 52
export Team_SetFlagStatus
code
proc Team_SetFlagStatus 16 8
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRLP4 4
ADDRFP4 0
INDIRI4
ASGNI4
ADDRLP4 4
INDIRI4
CNSTI4 0
EQI4 $157
ADDRLP4 4
INDIRI4
CNSTI4 1
EQI4 $147
ADDRLP4 4
INDIRI4
CNSTI4 2
EQI4 $152
ADDRGP4 $145
JUMPV
LABELV $147
ADDRGP4 teamgame+8
INDIRI4
ADDRFP4 4
INDIRI4
EQI4 $146
ADDRGP4 teamgame+8
ADDRFP4 4
INDIRI4
ASGNI4
ADDRLP4 0
CNSTI4 1
ASGNI4
ADDRGP4 $146
JUMPV
LABELV $152
ADDRGP4 teamgame+12
INDIRI4
ADDRFP4 4
INDIRI4
EQI4 $146
ADDRGP4 teamgame+12
ADDRFP4 4
INDIRI4
ASGNI4
ADDRLP4 0
CNSTI4 1
ASGNI4
ADDRGP4 $146
JUMPV
LABELV $157
ADDRGP4 teamgame+16
INDIRI4
ADDRFP4 4
INDIRI4
EQI4 $146
ADDRGP4 teamgame+16
ADDRFP4 4
INDIRI4
ASGNI4
ADDRLP4 0
CNSTI4 1
ASGNI4
LABELV $145
LABELV $146
ADDRLP4 0
INDIRI4
CNSTI4 0
EQI4 $162
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 4
NEI4 $164
ADDRLP4 12
ADDRGP4 ctfFlagStatusRemap
ASGNP4
ADDRLP4 8
ADDRGP4 teamgame+8
INDIRI4
ADDRLP4 12
INDIRP4
ADDP4
INDIRI1
ASGNI1
ADDRLP4 8+1
ADDRGP4 teamgame+12
INDIRI4
ADDRLP4 12
INDIRP4
ADDP4
INDIRI1
ASGNI1
ADDRLP4 8+2
CNSTI1 0
ASGNI1
ADDRGP4 $165
JUMPV
LABELV $164
ADDRLP4 8
ADDRGP4 teamgame+16
INDIRI4
ADDRGP4 oneFlagStatusRemap
ADDP4
INDIRI1
ASGNI1
ADDRLP4 8+1
CNSTI1 0
ASGNI1
LABELV $165
CNSTI4 23
ARGI4
ADDRLP4 8
ARGP4
ADDRGP4 trap_SetConfigstring
CALLV
pop
LABELV $162
LABELV $144
endproc Team_SetFlagStatus 16 8
export Team_CheckDroppedItem
proc Team_CheckDroppedItem 0 8
ADDRFP4 0
INDIRP4
CNSTI4 800
ADDP4
INDIRP4
CNSTI4 40
ADDP4
INDIRI4
CNSTI4 7
NEI4 $174
CNSTI4 1
ARGI4
CNSTI4 4
ARGI4
ADDRGP4 Team_SetFlagStatus
CALLV
pop
ADDRGP4 $175
JUMPV
LABELV $174
ADDRFP4 0
INDIRP4
CNSTI4 800
ADDP4
INDIRP4
CNSTI4 40
ADDP4
INDIRI4
CNSTI4 8
NEI4 $176
CNSTI4 2
ARGI4
CNSTI4 4
ARGI4
ADDRGP4 Team_SetFlagStatus
CALLV
pop
ADDRGP4 $177
JUMPV
LABELV $176
ADDRFP4 0
INDIRP4
CNSTI4 800
ADDP4
INDIRP4
CNSTI4 40
ADDP4
INDIRI4
CNSTI4 9
NEI4 $178
CNSTI4 0
ARGI4
CNSTI4 4
ARGI4
ADDRGP4 Team_SetFlagStatus
CALLV
pop
LABELV $178
LABELV $177
LABELV $175
LABELV $173
endproc Team_CheckDroppedItem 0 8
export Team_ForceGesture
proc Team_ForceGesture 12 0
ADDRFP4 0
ADDRFP4 0
INDIRI4
ASGNI4
ADDRLP4 4
CNSTI4 0
ASGNI4
LABELV $181
ADDRLP4 0
CNSTI4 804
ADDRLP4 4
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
NEI4 $185
ADDRGP4 $182
JUMPV
LABELV $185
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $187
ADDRGP4 $182
JUMPV
LABELV $187
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ADDRFP4 0
INDIRI4
EQI4 $189
ADDRGP4 $182
JUMPV
LABELV $189
ADDRLP4 8
ADDRLP4 0
INDIRP4
CNSTI4 536
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRI4
CNSTI4 32768
BORI4
ASGNI4
LABELV $182
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 4
INDIRI4
CNSTI4 64
LTI4 $181
LABELV $180
endproc Team_ForceGesture 12 0
export Team_FragBonuses
proc Team_FragBonuses 288 16
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 8
ADDRFP4 8
INDIRP4
ASGNP4
ADDRLP4 4
CNSTP4 0
ASGNP4
ADDRLP4 68
CNSTI4 516
ASGNI4
ADDRLP4 72
CNSTU4 0
ASGNU4
ADDRFP4 0
INDIRP4
ADDRLP4 68
INDIRI4
ADDP4
INDIRP4
CVPU4 4
ADDRLP4 72
INDIRU4
EQU4 $196
ADDRFP4 8
INDIRP4
ADDRLP4 68
INDIRI4
ADDP4
INDIRP4
CVPU4 4
ADDRLP4 72
INDIRU4
EQU4 $196
ADDRFP4 0
INDIRP4
CVPU4 4
ADDRFP4 8
INDIRP4
CVPU4 4
EQU4 $196
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 8
INDIRP4
ARGP4
ADDRLP4 80
ADDRGP4 OnSameTeam
CALLI4
ASGNI4
ADDRLP4 80
INDIRI4
CNSTI4 0
EQI4 $192
LABELV $196
ADDRGP4 $191
JUMPV
LABELV $192
ADDRLP4 84
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
ASGNP4
ADDRLP4 88
CNSTI4 616
ASGNI4
ADDRLP4 56
ADDRLP4 84
INDIRP4
INDIRP4
ADDRLP4 88
INDIRI4
ADDP4
INDIRI4
ASGNI4
ADDRLP4 84
INDIRP4
INDIRP4
ADDRLP4 88
INDIRI4
ADDP4
INDIRI4
ARGI4
ADDRLP4 92
ADDRGP4 OtherTeam
CALLI4
ASGNI4
ADDRLP4 20
ADDRLP4 92
INDIRI4
ASGNI4
ADDRLP4 20
INDIRI4
CNSTI4 0
GEI4 $197
ADDRGP4 $191
JUMPV
LABELV $197
ADDRLP4 56
INDIRI4
CNSTI4 1
NEI4 $199
ADDRLP4 16
CNSTI4 7
ASGNI4
ADDRLP4 60
CNSTI4 8
ASGNI4
ADDRGP4 $200
JUMPV
LABELV $199
ADDRLP4 16
CNSTI4 8
ASGNI4
ADDRLP4 60
CNSTI4 7
ASGNI4
LABELV $200
ADDRLP4 96
CNSTI4 0
ASGNI4
ADDRLP4 52
ADDRLP4 96
INDIRI4
ASGNI4
ADDRLP4 60
INDIRI4
CNSTI4 2
LSHI4
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 312
ADDP4
ADDP4
INDIRI4
ADDRLP4 96
INDIRI4
EQI4 $201
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 600
ADDP4
ADDRGP4 level+32
INDIRI4
CVIF4 4
ASGNF4
ADDRFP4 8
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
CNSTI4 2
ARGI4
ADDRGP4 AddScore
CALLV
pop
ADDRLP4 100
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 580
ADDP4
ASGNP4
ADDRLP4 100
INDIRP4
ADDRLP4 100
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 56
INDIRI4
ARGI4
ADDRLP4 104
ADDRGP4 TeamName
CALLP4
ASGNP4
CNSTP4 0
ARGP4
ADDRGP4 $204
ARGP4
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 512
ADDP4
ARGP4
ADDRLP4 104
INDIRP4
ARGP4
ADDRGP4 PrintMsg
CALLV
pop
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $208
JUMPV
LABELV $205
ADDRLP4 12
CNSTI4 804
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ASGNP4
ADDRLP4 12
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
EQI4 $210
ADDRLP4 12
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ADDRLP4 20
INDIRI4
NEI4 $210
ADDRLP4 12
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 588
ADDP4
CNSTF4 0
ASGNF4
LABELV $210
LABELV $206
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $208
ADDRLP4 0
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
LTI4 $205
ADDRGP4 $191
JUMPV
LABELV $201
ADDRLP4 52
INDIRI4
CNSTI4 0
EQI4 $212
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 600
ADDP4
ADDRGP4 level+32
INDIRI4
CVIF4 4
ASGNF4
ADDRFP4 8
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
ADDRLP4 52
INDIRI4
CNSTI4 1
LSHI4
ADDRLP4 52
INDIRI4
MULI4
ARGI4
ADDRGP4 AddScore
CALLV
pop
ADDRLP4 104
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 580
ADDP4
ASGNP4
ADDRLP4 104
INDIRP4
ADDRLP4 104
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 56
INDIRI4
ARGI4
ADDRLP4 108
ADDRGP4 TeamName
CALLP4
ASGNP4
CNSTP4 0
ARGP4
ADDRGP4 $215
ARGP4
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 512
ADDP4
ARGP4
ADDRLP4 108
INDIRP4
ARGP4
ADDRGP4 PrintMsg
CALLV
pop
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $219
JUMPV
LABELV $216
ADDRLP4 12
CNSTI4 804
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ASGNP4
ADDRLP4 12
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
EQI4 $221
ADDRLP4 12
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ADDRLP4 20
INDIRI4
NEI4 $221
ADDRLP4 12
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 588
ADDP4
CNSTF4 0
ASGNF4
LABELV $221
LABELV $217
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $219
ADDRLP4 0
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
LTI4 $216
ADDRGP4 $191
JUMPV
LABELV $212
ADDRLP4 100
CNSTI4 516
ASGNI4
ADDRLP4 104
ADDRFP4 0
INDIRP4
ADDRLP4 100
INDIRI4
ADDP4
INDIRP4
CNSTI4 588
ADDP4
INDIRF4
ASGNF4
ADDRLP4 104
INDIRF4
CNSTF4 0
EQF4 $223
ADDRGP4 level+32
INDIRI4
CVIF4 4
ADDRLP4 104
INDIRF4
SUBF4
CNSTF4 1174011904
GEF4 $223
ADDRLP4 16
INDIRI4
CNSTI4 2
LSHI4
ADDRFP4 8
INDIRP4
ADDRLP4 100
INDIRI4
ADDP4
INDIRP4
CNSTI4 312
ADDP4
ADDP4
INDIRI4
CNSTI4 0
NEI4 $223
ADDRFP4 8
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
CNSTI4 2
ARGI4
ADDRGP4 AddScore
CALLV
pop
ADDRLP4 108
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 572
ADDP4
ASGNP4
ADDRLP4 108
INDIRP4
ADDRLP4 108
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 588
ADDP4
CNSTF4 0
ASGNF4
ADDRLP4 112
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 292
ADDP4
ASGNP4
ADDRLP4 112
INDIRP4
ADDRLP4 112
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 116
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 116
INDIRP4
ADDRLP4 116
INDIRP4
INDIRI4
CNSTI4 -231497
BANDI4
ASGNI4
ADDRLP4 120
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 120
INDIRP4
ADDRLP4 120
INDIRP4
INDIRI4
CNSTI4 65536
BORI4
ASGNI4
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 744
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 2000
ADDI4
ASGNI4
ADDRGP4 $191
JUMPV
LABELV $223
ADDRLP4 108
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 588
ADDP4
INDIRF4
ASGNF4
ADDRLP4 108
INDIRF4
CNSTF4 0
EQF4 $227
ADDRGP4 level+32
INDIRI4
CVIF4 4
ADDRLP4 108
INDIRF4
SUBF4
CNSTF4 1174011904
GEF4 $227
ADDRFP4 8
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
CNSTI4 2
ARGI4
ADDRGP4 AddScore
CALLV
pop
ADDRLP4 112
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 572
ADDP4
ASGNP4
ADDRLP4 112
INDIRP4
ADDRLP4 112
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 588
ADDP4
CNSTF4 0
ASGNF4
ADDRLP4 116
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 292
ADDP4
ASGNP4
ADDRLP4 116
INDIRP4
ADDRLP4 116
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 120
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 120
INDIRP4
ADDRLP4 120
INDIRP4
INDIRI4
CNSTI4 -231497
BANDI4
ASGNI4
ADDRLP4 124
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 124
INDIRP4
ADDRLP4 124
INDIRP4
INDIRI4
CNSTI4 65536
BORI4
ASGNI4
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 744
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 2000
ADDI4
ASGNI4
ADDRGP4 $191
JUMPV
LABELV $227
ADDRLP4 112
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ASGNI4
ADDRLP4 112
INDIRI4
CNSTI4 1
EQI4 $234
ADDRLP4 112
INDIRI4
CNSTI4 2
EQI4 $236
ADDRGP4 $191
JUMPV
LABELV $234
ADDRLP4 24
ADDRGP4 $235
ASGNP4
ADDRGP4 $232
JUMPV
LABELV $236
ADDRLP4 24
ADDRGP4 $237
ASGNP4
LABELV $232
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $241
JUMPV
LABELV $238
ADDRLP4 4
CNSTI4 804
ADDRLP4 0
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ASGNP4
ADDRLP4 124
CNSTI4 0
ASGNI4
ADDRLP4 4
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
ADDRLP4 124
INDIRI4
EQI4 $243
ADDRLP4 16
INDIRI4
CNSTI4 2
LSHI4
ADDRLP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 312
ADDP4
ADDP4
INDIRI4
ADDRLP4 124
INDIRI4
EQI4 $243
ADDRGP4 $240
JUMPV
LABELV $243
ADDRLP4 4
CNSTP4 0
ASGNP4
LABELV $239
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $241
ADDRLP4 0
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
LTI4 $238
LABELV $240
ADDRLP4 8
CNSTP4 0
ASGNP4
ADDRGP4 $246
JUMPV
LABELV $245
ADDRLP4 8
INDIRP4
CNSTI4 536
ADDP4
INDIRI4
CNSTI4 4096
BANDI4
CNSTI4 0
NEI4 $248
ADDRGP4 $247
JUMPV
LABELV $248
LABELV $246
ADDRLP4 8
INDIRP4
ARGP4
CNSTI4 524
ARGI4
ADDRLP4 24
INDIRP4
ARGP4
ADDRLP4 120
ADDRGP4 G_Find
CALLP4
ASGNP4
ADDRLP4 8
ADDRLP4 120
INDIRP4
ASGNP4
ADDRLP4 120
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $245
LABELV $247
ADDRLP4 8
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $250
ADDRGP4 $191
JUMPV
LABELV $250
ADDRLP4 128
CNSTI4 488
ASGNI4
ADDRLP4 28
ADDRFP4 0
INDIRP4
ADDRLP4 128
INDIRI4
ADDP4
INDIRF4
ADDRLP4 8
INDIRP4
ADDRLP4 128
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 136
CNSTI4 492
ASGNI4
ADDRLP4 28+4
ADDRFP4 0
INDIRP4
ADDRLP4 136
INDIRI4
ADDP4
INDIRF4
ADDRLP4 8
INDIRP4
ADDRLP4 136
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 140
CNSTI4 496
ASGNI4
ADDRLP4 28+8
ADDRFP4 0
INDIRP4
ADDRLP4 140
INDIRI4
ADDP4
INDIRF4
ADDRLP4 8
INDIRP4
ADDRLP4 140
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 148
CNSTI4 488
ASGNI4
ADDRLP4 40
ADDRFP4 8
INDIRP4
ADDRLP4 148
INDIRI4
ADDP4
INDIRF4
ADDRLP4 8
INDIRP4
ADDRLP4 148
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 156
CNSTI4 492
ASGNI4
ADDRLP4 40+4
ADDRFP4 8
INDIRP4
ADDRLP4 156
INDIRI4
ADDP4
INDIRF4
ADDRLP4 8
INDIRP4
ADDRLP4 156
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 160
CNSTI4 496
ASGNI4
ADDRLP4 40+8
ADDRFP4 8
INDIRP4
ADDRLP4 160
INDIRI4
ADDP4
INDIRF4
ADDRLP4 8
INDIRP4
ADDRLP4 160
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 28
ARGP4
ADDRLP4 164
ADDRGP4 VectorLength
CALLF4
ASGNF4
ADDRLP4 164
INDIRF4
CNSTF4 1148846080
GEF4 $259
ADDRLP4 168
CNSTI4 488
ASGNI4
ADDRLP4 8
INDIRP4
ADDRLP4 168
INDIRI4
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
ADDRLP4 168
INDIRI4
ADDP4
ARGP4
ADDRLP4 172
ADDRGP4 trap_InPVS
CALLI4
ASGNI4
ADDRLP4 172
INDIRI4
CNSTI4 0
NEI4 $258
LABELV $259
ADDRLP4 40
ARGP4
ADDRLP4 176
ADDRGP4 VectorLength
CALLF4
ASGNF4
ADDRLP4 176
INDIRF4
CNSTF4 1148846080
GEF4 $256
ADDRLP4 180
CNSTI4 488
ASGNI4
ADDRLP4 8
INDIRP4
ADDRLP4 180
INDIRI4
ADDP4
ARGP4
ADDRFP4 8
INDIRP4
ADDRLP4 180
INDIRI4
ADDP4
ARGP4
ADDRLP4 184
ADDRGP4 trap_InPVS
CALLI4
ASGNI4
ADDRLP4 184
INDIRI4
CNSTI4 0
EQI4 $256
LABELV $258
ADDRLP4 188
CNSTI4 516
ASGNI4
ADDRLP4 192
CNSTI4 616
ASGNI4
ADDRFP4 8
INDIRP4
ADDRLP4 188
INDIRI4
ADDP4
INDIRP4
ADDRLP4 192
INDIRI4
ADDP4
INDIRI4
ADDRFP4 0
INDIRP4
ADDRLP4 188
INDIRI4
ADDP4
INDIRP4
ADDRLP4 192
INDIRI4
ADDP4
INDIRI4
EQI4 $256
ADDRFP4 8
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
CNSTI4 1
ARGI4
ADDRGP4 AddScore
CALLV
pop
ADDRLP4 196
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 568
ADDP4
ASGNP4
ADDRLP4 196
INDIRP4
ADDRLP4 196
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 200
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 292
ADDP4
ASGNP4
ADDRLP4 200
INDIRP4
ADDRLP4 200
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 204
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 204
INDIRP4
ADDRLP4 204
INDIRP4
INDIRI4
CNSTI4 -231497
BANDI4
ASGNI4
ADDRLP4 208
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 208
INDIRP4
ADDRLP4 208
INDIRP4
INDIRI4
CNSTI4 65536
BORI4
ASGNI4
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 744
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 2000
ADDI4
ASGNI4
ADDRGP4 $191
JUMPV
LABELV $256
ADDRLP4 196
ADDRLP4 4
INDIRP4
CVPU4 4
ASGNU4
ADDRLP4 196
INDIRU4
CNSTU4 0
EQU4 $261
ADDRLP4 196
INDIRU4
ADDRFP4 8
INDIRP4
CVPU4 4
EQU4 $261
ADDRLP4 204
CNSTI4 488
ASGNI4
ADDRLP4 28
ADDRFP4 0
INDIRP4
ADDRLP4 204
INDIRI4
ADDP4
INDIRF4
ADDRLP4 4
INDIRP4
ADDRLP4 204
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 212
CNSTI4 492
ASGNI4
ADDRLP4 28+4
ADDRFP4 0
INDIRP4
ADDRLP4 212
INDIRI4
ADDP4
INDIRF4
ADDRLP4 4
INDIRP4
ADDRLP4 212
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 216
CNSTI4 496
ASGNI4
ADDRLP4 28+8
ADDRFP4 0
INDIRP4
ADDRLP4 216
INDIRI4
ADDP4
INDIRF4
ADDRLP4 4
INDIRP4
ADDRLP4 216
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 224
CNSTI4 488
ASGNI4
ADDRLP4 28
ADDRFP4 8
INDIRP4
ADDRLP4 224
INDIRI4
ADDP4
INDIRF4
ADDRLP4 4
INDIRP4
ADDRLP4 224
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 232
CNSTI4 492
ASGNI4
ADDRLP4 28+4
ADDRFP4 8
INDIRP4
ADDRLP4 232
INDIRI4
ADDP4
INDIRF4
ADDRLP4 4
INDIRP4
ADDRLP4 232
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 236
CNSTI4 496
ASGNI4
ADDRLP4 28+8
ADDRFP4 8
INDIRP4
ADDRLP4 236
INDIRI4
ADDP4
INDIRF4
ADDRLP4 4
INDIRP4
ADDRLP4 236
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 28
ARGP4
ADDRLP4 240
ADDRGP4 VectorLength
CALLF4
ASGNF4
ADDRLP4 240
INDIRF4
CNSTF4 1148846080
GEF4 $270
ADDRLP4 244
CNSTI4 488
ASGNI4
ADDRLP4 4
INDIRP4
ADDRLP4 244
INDIRI4
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
ADDRLP4 244
INDIRI4
ADDP4
ARGP4
ADDRLP4 248
ADDRGP4 trap_InPVS
CALLI4
ASGNI4
ADDRLP4 248
INDIRI4
CNSTI4 0
NEI4 $269
LABELV $270
ADDRLP4 40
ARGP4
ADDRLP4 252
ADDRGP4 VectorLength
CALLF4
ASGNF4
ADDRLP4 252
INDIRF4
CNSTF4 1148846080
GEF4 $267
ADDRLP4 256
CNSTI4 488
ASGNI4
ADDRLP4 4
INDIRP4
ADDRLP4 256
INDIRI4
ADDP4
ARGP4
ADDRFP4 8
INDIRP4
ADDRLP4 256
INDIRI4
ADDP4
ARGP4
ADDRLP4 260
ADDRGP4 trap_InPVS
CALLI4
ASGNI4
ADDRLP4 260
INDIRI4
CNSTI4 0
EQI4 $267
LABELV $269
ADDRLP4 264
CNSTI4 516
ASGNI4
ADDRLP4 268
CNSTI4 616
ASGNI4
ADDRFP4 8
INDIRP4
ADDRLP4 264
INDIRI4
ADDP4
INDIRP4
ADDRLP4 268
INDIRI4
ADDP4
INDIRI4
ADDRFP4 0
INDIRP4
ADDRLP4 264
INDIRI4
ADDP4
INDIRP4
ADDRLP4 268
INDIRI4
ADDP4
INDIRI4
EQI4 $267
ADDRFP4 8
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
CNSTI4 1
ARGI4
ADDRGP4 AddScore
CALLV
pop
ADDRLP4 272
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 572
ADDP4
ASGNP4
ADDRLP4 272
INDIRP4
ADDRLP4 272
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 276
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 292
ADDP4
ASGNP4
ADDRLP4 276
INDIRP4
ADDRLP4 276
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 280
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 280
INDIRP4
ADDRLP4 280
INDIRP4
INDIRI4
CNSTI4 -231497
BANDI4
ASGNI4
ADDRLP4 284
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 284
INDIRP4
ADDRLP4 284
INDIRP4
INDIRI4
CNSTI4 65536
BORI4
ASGNI4
ADDRFP4 8
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 744
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 2000
ADDI4
ASGNI4
LABELV $267
LABELV $261
LABELV $191
endproc Team_FragBonuses 288 16
export Team_CheckHurtCarrier
proc Team_CheckHurtCarrier 36 0
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 4
ADDRFP4 4
INDIRP4
ASGNP4
ADDRLP4 4
CNSTI4 516
ASGNI4
ADDRLP4 8
CNSTU4 0
ASGNU4
ADDRFP4 0
INDIRP4
ADDRLP4 4
INDIRI4
ADDP4
INDIRP4
CVPU4 4
ADDRLP4 8
INDIRU4
EQU4 $275
ADDRFP4 4
INDIRP4
ADDRLP4 4
INDIRI4
ADDP4
INDIRP4
CVPU4 4
ADDRLP4 8
INDIRU4
NEU4 $273
LABELV $275
ADDRGP4 $272
JUMPV
LABELV $273
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
CNSTI4 1
NEI4 $276
ADDRLP4 0
CNSTI4 8
ASGNI4
ADDRGP4 $277
JUMPV
LABELV $276
ADDRLP4 0
CNSTI4 7
ASGNI4
LABELV $277
ADDRLP4 12
CNSTI4 516
ASGNI4
ADDRLP4 16
ADDRFP4 0
INDIRP4
ADDRLP4 12
INDIRI4
ADDP4
INDIRP4
ASGNP4
ADDRLP4 0
INDIRI4
CNSTI4 2
LSHI4
ADDRLP4 16
INDIRP4
CNSTI4 312
ADDP4
ADDP4
INDIRI4
CNSTI4 0
EQI4 $278
ADDRLP4 20
CNSTI4 616
ASGNI4
ADDRLP4 16
INDIRP4
ADDRLP4 20
INDIRI4
ADDP4
INDIRI4
ADDRFP4 4
INDIRP4
ADDRLP4 12
INDIRI4
ADDP4
INDIRP4
ADDRLP4 20
INDIRI4
ADDP4
INDIRI4
EQI4 $278
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 588
ADDP4
ADDRGP4 level+32
INDIRI4
CVIF4 4
ASGNF4
LABELV $278
ADDRLP4 24
CNSTI4 516
ASGNI4
ADDRLP4 28
ADDRFP4 0
INDIRP4
ADDRLP4 24
INDIRI4
ADDP4
INDIRP4
ASGNP4
ADDRLP4 28
INDIRP4
CNSTI4 440
ADDP4
INDIRI4
CNSTI4 0
EQI4 $281
ADDRLP4 32
CNSTI4 616
ASGNI4
ADDRLP4 28
INDIRP4
ADDRLP4 32
INDIRI4
ADDP4
INDIRI4
ADDRFP4 4
INDIRP4
ADDRLP4 24
INDIRI4
ADDP4
INDIRP4
ADDRLP4 32
INDIRI4
ADDP4
INDIRI4
EQI4 $281
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 588
ADDP4
ADDRGP4 level+32
INDIRI4
CVIF4 4
ASGNF4
LABELV $281
LABELV $272
endproc Team_CheckHurtCarrier 36 0
export Team_ResetFlag
proc Team_ResetFlag 20 12
ADDRLP4 8
CNSTP4 0
ASGNP4
ADDRLP4 12
ADDRFP4 0
INDIRI4
ASGNI4
ADDRLP4 12
INDIRI4
CNSTI4 0
EQI4 $289
ADDRLP4 12
INDIRI4
CNSTI4 1
EQI4 $287
ADDRLP4 12
INDIRI4
CNSTI4 2
EQI4 $288
ADDRGP4 $285
JUMPV
LABELV $287
ADDRLP4 4
ADDRGP4 $235
ASGNP4
ADDRGP4 $286
JUMPV
LABELV $288
ADDRLP4 4
ADDRGP4 $237
ASGNP4
ADDRGP4 $286
JUMPV
LABELV $289
ADDRLP4 4
ADDRGP4 $290
ASGNP4
ADDRGP4 $286
JUMPV
LABELV $285
CNSTP4 0
RETP4
ADDRGP4 $284
JUMPV
LABELV $286
ADDRLP4 0
CNSTP4 0
ASGNP4
ADDRGP4 $292
JUMPV
LABELV $291
ADDRLP4 0
INDIRP4
CNSTI4 536
ADDP4
INDIRI4
CNSTI4 4096
BANDI4
CNSTI4 0
EQI4 $294
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 G_FreeEntity
CALLV
pop
ADDRGP4 $295
JUMPV
LABELV $294
ADDRLP4 8
ADDRLP4 0
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 RespawnItem
CALLV
pop
LABELV $295
LABELV $292
ADDRLP4 0
INDIRP4
ARGP4
CNSTI4 524
ARGI4
ADDRLP4 4
INDIRP4
ARGP4
ADDRLP4 16
ADDRGP4 G_Find
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 16
INDIRP4
ASGNP4
ADDRLP4 16
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $291
ADDRFP4 0
INDIRI4
ARGI4
CNSTI4 0
ARGI4
ADDRGP4 Team_SetFlagStatus
CALLV
pop
ADDRLP4 8
INDIRP4
RETP4
LABELV $284
endproc Team_ResetFlag 20 12
export Team_ResetFlags
proc Team_ResetFlags 0 4
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 4
NEI4 $297
CNSTI4 1
ARGI4
ADDRGP4 Team_ResetFlag
CALLP4
pop
CNSTI4 2
ARGI4
ADDRGP4 Team_ResetFlag
CALLP4
pop
LABELV $297
LABELV $296
endproc Team_ResetFlags 0 4
export Team_ReturnFlagSound
proc Team_ReturnFlagSound 12 8
ADDRFP4 0
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $301
ADDRGP4 $303
ARGP4
ADDRGP4 G_Printf
CALLV
pop
ADDRGP4 $300
JUMPV
LABELV $301
ADDRFP4 0
INDIRP4
CNSTI4 24
ADDP4
ARGP4
CNSTI4 47
ARGI4
ADDRLP4 4
ADDRGP4 G_TempEntity
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ASGNP4
ADDRFP4 4
INDIRI4
CNSTI4 2
NEI4 $304
ADDRLP4 0
INDIRP4
CNSTI4 184
ADDP4
CNSTI4 2
ASGNI4
ADDRGP4 $305
JUMPV
LABELV $304
ADDRLP4 0
INDIRP4
CNSTI4 184
ADDP4
CNSTI4 3
ASGNI4
LABELV $305
ADDRLP4 8
ADDRLP4 0
INDIRP4
CNSTI4 424
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRI4
CNSTI4 32
BORI4
ASGNI4
LABELV $300
endproc Team_ReturnFlagSound 12 8
export Team_TakeFlagSound
proc Team_TakeFlagSound 16 8
ADDRFP4 0
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $307
ADDRGP4 $309
ARGP4
ADDRGP4 G_Printf
CALLV
pop
ADDRGP4 $306
JUMPV
LABELV $307
ADDRLP4 4
ADDRFP4 4
INDIRI4
ASGNI4
ADDRLP4 4
INDIRI4
CNSTI4 1
EQI4 $312
ADDRLP4 4
INDIRI4
CNSTI4 2
EQI4 $322
ADDRGP4 $310
JUMPV
LABELV $312
ADDRGP4 teamgame+12
INDIRI4
CNSTI4 0
EQI4 $313
ADDRGP4 teamgame+24
INDIRI4
ADDRGP4 level+32
INDIRI4
CNSTI4 10000
SUBI4
LEI4 $316
ADDRGP4 $306
JUMPV
LABELV $316
LABELV $313
ADDRGP4 teamgame+24
ADDRGP4 level+32
INDIRI4
ASGNI4
ADDRGP4 $311
JUMPV
LABELV $322
ADDRGP4 teamgame+8
INDIRI4
CNSTI4 0
EQI4 $323
ADDRGP4 teamgame+20
INDIRI4
ADDRGP4 level+32
INDIRI4
CNSTI4 10000
SUBI4
LEI4 $326
ADDRGP4 $306
JUMPV
LABELV $326
LABELV $323
ADDRGP4 teamgame+20
ADDRGP4 level+32
INDIRI4
ASGNI4
LABELV $310
LABELV $311
ADDRFP4 0
INDIRP4
CNSTI4 24
ADDP4
ARGP4
CNSTI4 47
ARGI4
ADDRLP4 8
ADDRGP4 G_TempEntity
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 8
INDIRP4
ASGNP4
ADDRFP4 4
INDIRI4
CNSTI4 2
NEI4 $332
ADDRLP4 0
INDIRP4
CNSTI4 184
ADDP4
CNSTI4 4
ASGNI4
ADDRGP4 $333
JUMPV
LABELV $332
ADDRLP4 0
INDIRP4
CNSTI4 184
ADDP4
CNSTI4 5
ASGNI4
LABELV $333
ADDRLP4 12
ADDRLP4 0
INDIRP4
CNSTI4 424
ADDP4
ASGNP4
ADDRLP4 12
INDIRP4
ADDRLP4 12
INDIRP4
INDIRI4
CNSTI4 32
BORI4
ASGNI4
LABELV $306
endproc Team_TakeFlagSound 16 8
export Team_CaptureFlagSound
proc Team_CaptureFlagSound 12 8
ADDRFP4 0
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $335
ADDRGP4 $337
ARGP4
ADDRGP4 G_Printf
CALLV
pop
ADDRGP4 $334
JUMPV
LABELV $335
ADDRFP4 0
INDIRP4
CNSTI4 24
ADDP4
ARGP4
CNSTI4 47
ARGI4
ADDRLP4 4
ADDRGP4 G_TempEntity
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ASGNP4
ADDRFP4 4
INDIRI4
CNSTI4 2
NEI4 $338
ADDRLP4 0
INDIRP4
CNSTI4 184
ADDP4
CNSTI4 1
ASGNI4
ADDRGP4 $339
JUMPV
LABELV $338
ADDRLP4 0
INDIRP4
CNSTI4 184
ADDP4
CNSTI4 0
ASGNI4
LABELV $339
ADDRLP4 8
ADDRLP4 0
INDIRP4
CNSTI4 424
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRI4
CNSTI4 32
BORI4
ASGNI4
LABELV $334
endproc Team_CaptureFlagSound 12 8
export Team_ReturnFlag
proc Team_ReturnFlag 8 12
ADDRFP4 0
ADDRFP4 0
INDIRI4
ASGNI4
ADDRFP4 0
INDIRI4
ARGI4
ADDRLP4 0
ADDRGP4 Team_ResetFlag
CALLP4
ASGNP4
ADDRLP4 0
INDIRP4
ARGP4
ADDRFP4 0
INDIRI4
ARGI4
ADDRGP4 Team_ReturnFlagSound
CALLV
pop
ADDRFP4 0
INDIRI4
CNSTI4 0
NEI4 $341
CNSTP4 0
ARGP4
ADDRGP4 $343
ARGP4
ADDRGP4 PrintMsg
CALLV
pop
ADDRGP4 $342
JUMPV
LABELV $341
ADDRFP4 0
INDIRI4
ARGI4
ADDRLP4 4
ADDRGP4 TeamName
CALLP4
ASGNP4
CNSTP4 0
ARGP4
ADDRGP4 $344
ARGP4
ADDRLP4 4
INDIRP4
ARGP4
ADDRGP4 PrintMsg
CALLV
pop
LABELV $342
LABELV $340
endproc Team_ReturnFlag 8 12
export Team_FreeEntity
proc Team_FreeEntity 0 4
ADDRFP4 0
INDIRP4
CNSTI4 800
ADDP4
INDIRP4
CNSTI4 40
ADDP4
INDIRI4
CNSTI4 7
NEI4 $346
CNSTI4 1
ARGI4
ADDRGP4 Team_ReturnFlag
CALLV
pop
ADDRGP4 $347
JUMPV
LABELV $346
ADDRFP4 0
INDIRP4
CNSTI4 800
ADDP4
INDIRP4
CNSTI4 40
ADDP4
INDIRI4
CNSTI4 8
NEI4 $348
CNSTI4 2
ARGI4
ADDRGP4 Team_ReturnFlag
CALLV
pop
ADDRGP4 $349
JUMPV
LABELV $348
ADDRFP4 0
INDIRP4
CNSTI4 800
ADDP4
INDIRP4
CNSTI4 40
ADDP4
INDIRI4
CNSTI4 9
NEI4 $350
CNSTI4 0
ARGI4
ADDRGP4 Team_ReturnFlag
CALLV
pop
LABELV $350
LABELV $349
LABELV $347
LABELV $345
endproc Team_FreeEntity 0 4
export Team_DroppedFlagThink
proc Team_DroppedFlagThink 8 8
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 800
ADDP4
INDIRP4
CNSTI4 40
ADDP4
INDIRI4
CNSTI4 7
NEI4 $353
ADDRLP4 0
CNSTI4 1
ASGNI4
ADDRGP4 $354
JUMPV
LABELV $353
ADDRFP4 0
INDIRP4
CNSTI4 800
ADDP4
INDIRP4
CNSTI4 40
ADDP4
INDIRI4
CNSTI4 8
NEI4 $355
ADDRLP4 0
CNSTI4 2
ASGNI4
ADDRGP4 $356
JUMPV
LABELV $355
ADDRFP4 0
INDIRP4
CNSTI4 800
ADDP4
INDIRP4
CNSTI4 40
ADDP4
INDIRI4
CNSTI4 9
NEI4 $357
ADDRLP4 0
CNSTI4 0
ASGNI4
LABELV $357
LABELV $356
LABELV $354
ADDRLP4 0
INDIRI4
ARGI4
ADDRLP4 4
ADDRGP4 Team_ResetFlag
CALLP4
ASGNP4
ADDRLP4 4
INDIRP4
ARGP4
ADDRLP4 0
INDIRI4
ARGI4
ADDRGP4 Team_ReturnFlagSound
CALLV
pop
LABELV $352
endproc Team_DroppedFlagThink 8 8
export Team_TouchOurFlag
proc Team_TouchOurFlag 68 16
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 4
ADDRFP4 4
INDIRP4
ASGNP4
ADDRFP4 8
ADDRFP4 8
INDIRI4
ASGNI4
ADDRLP4 8
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
ASGNP4
ADDRLP4 8
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
CNSTI4 1
NEI4 $360
ADDRLP4 12
CNSTI4 8
ASGNI4
ADDRGP4 $361
JUMPV
LABELV $360
ADDRLP4 12
CNSTI4 7
ASGNI4
LABELV $361
ADDRFP4 0
INDIRP4
CNSTI4 536
ADDP4
INDIRI4
CNSTI4 4096
BANDI4
CNSTI4 0
EQI4 $362
ADDRFP4 8
INDIRI4
ARGI4
ADDRLP4 16
ADDRGP4 TeamName
CALLP4
ASGNP4
CNSTP4 0
ARGP4
ADDRGP4 $364
ARGP4
ADDRLP4 8
INDIRP4
CNSTI4 512
ADDP4
ARGP4
ADDRLP4 16
INDIRP4
ARGP4
ADDRGP4 PrintMsg
CALLV
pop
ADDRFP4 4
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
CNSTI4 1
ARGI4
ADDRGP4 AddScore
CALLV
pop
ADDRLP4 20
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 576
ADDP4
ASGNP4
ADDRLP4 20
INDIRP4
ADDRLP4 20
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 592
ADDP4
ADDRGP4 level+32
INDIRI4
CVIF4 4
ASGNF4
ADDRFP4 8
INDIRI4
ARGI4
ADDRLP4 24
ADDRGP4 Team_ResetFlag
CALLP4
ASGNP4
ADDRLP4 24
INDIRP4
ARGP4
ADDRFP4 8
INDIRI4
ARGI4
ADDRGP4 Team_ReturnFlagSound
CALLV
pop
CNSTI4 0
RETI4
ADDRGP4 $359
JUMPV
LABELV $362
ADDRLP4 12
INDIRI4
CNSTI4 2
LSHI4
ADDRLP4 8
INDIRP4
CNSTI4 312
ADDP4
ADDP4
INDIRI4
CNSTI4 0
NEI4 $366
CNSTI4 0
RETI4
ADDRGP4 $359
JUMPV
LABELV $366
ADDRFP4 8
INDIRI4
ARGI4
ADDRLP4 16
ADDRGP4 OtherTeam
CALLI4
ASGNI4
ADDRLP4 16
INDIRI4
ARGI4
ADDRLP4 20
ADDRGP4 TeamName
CALLP4
ASGNP4
CNSTP4 0
ARGP4
ADDRGP4 $368
ARGP4
ADDRLP4 8
INDIRP4
CNSTI4 512
ADDP4
ARGP4
ADDRLP4 20
INDIRP4
ARGP4
ADDRGP4 PrintMsg
CALLV
pop
ADDRLP4 12
INDIRI4
CNSTI4 2
LSHI4
ADDRLP4 8
INDIRP4
CNSTI4 312
ADDP4
ADDP4
CNSTI4 0
ASGNI4
ADDRGP4 teamgame
ADDRGP4 level+32
INDIRI4
CVIF4 4
ASGNF4
ADDRGP4 teamgame+4
ADDRFP4 8
INDIRI4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ARGI4
CNSTI4 1
ARGI4
ADDRGP4 AddTeamScore
CALLV
pop
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ARGI4
ADDRGP4 Team_ForceGesture
CALLV
pop
ADDRLP4 24
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 564
ADDP4
ASGNP4
ADDRLP4 24
INDIRP4
ADDRLP4 24
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 28
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 28
INDIRP4
ADDRLP4 28
INDIRP4
INDIRI4
CNSTI4 -231497
BANDI4
ASGNI4
ADDRLP4 32
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 32
INDIRP4
ADDRLP4 32
INDIRP4
INDIRI4
CNSTI4 2048
BORI4
ASGNI4
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 744
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 2000
ADDI4
ASGNI4
ADDRLP4 36
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 304
ADDP4
ASGNP4
ADDRLP4 36
INDIRP4
ADDRLP4 36
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRFP4 4
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
CNSTI4 5
ARGI4
ADDRGP4 AddScore
CALLV
pop
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 8
INDIRI4
ARGI4
ADDRGP4 Team_CaptureFlagSound
CALLV
pop
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRGP4 $375
JUMPV
LABELV $372
ADDRLP4 0
CNSTI4 804
ADDRLP4 4
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
EQI4 $379
ADDRLP4 0
INDIRP4
CVPU4 4
ADDRFP4 4
INDIRP4
CVPU4 4
NEU4 $377
LABELV $379
ADDRGP4 $373
JUMPV
LABELV $377
ADDRLP4 44
CNSTI4 616
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
ADDRLP4 44
INDIRI4
ADDP4
INDIRI4
ADDRLP4 8
INDIRP4
ADDRLP4 44
INDIRI4
ADDP4
INDIRI4
EQI4 $380
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 588
ADDP4
CNSTF4 3231711232
ASGNF4
ADDRGP4 $381
JUMPV
LABELV $380
ADDRLP4 48
CNSTI4 616
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
ADDRLP4 48
INDIRI4
ADDP4
INDIRI4
ADDRLP4 8
INDIRP4
ADDRLP4 48
INDIRI4
ADDP4
INDIRI4
NEI4 $382
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 592
ADDP4
INDIRF4
CNSTF4 1176256512
ADDF4
ADDRGP4 level+32
INDIRI4
CVIF4 4
LEF4 $384
ADDRLP4 0
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
CNSTI4 1
ARGI4
ADDRGP4 AddScore
CALLV
pop
ADDRLP4 52
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 584
ADDP4
ASGNP4
ADDRLP4 52
INDIRP4
ADDRLP4 52
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 56
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 296
ADDP4
ASGNP4
ADDRLP4 56
INDIRP4
ADDRLP4 56
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 60
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 60
INDIRP4
ADDRLP4 60
INDIRP4
INDIRI4
CNSTI4 -231497
BANDI4
ASGNI4
ADDRLP4 64
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 64
INDIRP4
ADDRLP4 64
INDIRP4
INDIRI4
CNSTI4 131072
BORI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 744
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 2000
ADDI4
ASGNI4
LABELV $384
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 600
ADDP4
INDIRF4
CNSTF4 1176256512
ADDF4
ADDRGP4 level+32
INDIRI4
CVIF4 4
LEF4 $388
ADDRLP4 0
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
CNSTI4 2
ARGI4
ADDRGP4 AddScore
CALLV
pop
ADDRLP4 52
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 584
ADDP4
ASGNP4
ADDRLP4 52
INDIRP4
ADDRLP4 52
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 56
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 296
ADDP4
ASGNP4
ADDRLP4 56
INDIRP4
ADDRLP4 56
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 60
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 60
INDIRP4
ADDRLP4 60
INDIRP4
INDIRI4
CNSTI4 -231497
BANDI4
ASGNI4
ADDRLP4 64
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 64
INDIRP4
ADDRLP4 64
INDIRP4
INDIRI4
CNSTI4 131072
BORI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 744
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 2000
ADDI4
ASGNI4
LABELV $388
LABELV $382
LABELV $381
LABELV $373
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $375
ADDRLP4 4
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
LTI4 $372
ADDRGP4 Team_ResetFlags
CALLV
pop
ADDRGP4 CalculateRanks
CALLV
pop
CNSTI4 0
RETI4
LABELV $359
endproc Team_TouchOurFlag 68 16
export Team_TouchEnemyFlag
proc Team_TouchEnemyFlag 8 16
ADDRFP4 8
ADDRFP4 8
INDIRI4
ASGNI4
ADDRLP4 0
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
ASGNP4
ADDRFP4 8
INDIRI4
ARGI4
ADDRLP4 4
ADDRGP4 TeamName
CALLP4
ASGNP4
CNSTP4 0
ARGP4
ADDRGP4 $393
ARGP4
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 512
ADDP4
ARGP4
ADDRLP4 4
INDIRP4
ARGP4
ADDRGP4 PrintMsg
CALLV
pop
ADDRFP4 8
INDIRI4
CNSTI4 1
NEI4 $394
ADDRLP4 0
INDIRP4
CNSTI4 340
ADDP4
CNSTI4 2147483647
ASGNI4
ADDRGP4 $395
JUMPV
LABELV $394
ADDRLP4 0
INDIRP4
CNSTI4 344
ADDP4
CNSTI4 2147483647
ASGNI4
LABELV $395
ADDRFP4 8
INDIRI4
ARGI4
CNSTI4 1
ARGI4
ADDRGP4 Team_SetFlagStatus
CALLV
pop
ADDRLP4 0
INDIRP4
CNSTI4 596
ADDP4
ADDRGP4 level+32
INDIRI4
CVIF4 4
ASGNF4
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 8
INDIRI4
ARGI4
ADDRGP4 Team_TakeFlagSound
CALLV
pop
CNSTI4 -1
RETI4
LABELV $392
endproc Team_TouchEnemyFlag 8 16
export Pickup_Team
proc Pickup_Team 20 12
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 4
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 524
ADDP4
INDIRP4
ARGP4
ADDRGP4 $235
ARGP4
ADDRLP4 8
ADDRGP4 qk_strcmp
CALLI4
ASGNI4
ADDRLP4 8
INDIRI4
CNSTI4 0
NEI4 $398
ADDRLP4 0
CNSTI4 1
ASGNI4
ADDRGP4 $399
JUMPV
LABELV $398
ADDRFP4 0
INDIRP4
CNSTI4 524
ADDP4
INDIRP4
ARGP4
ADDRGP4 $237
ARGP4
ADDRLP4 12
ADDRGP4 qk_strcmp
CALLI4
ASGNI4
ADDRLP4 12
INDIRI4
CNSTI4 0
NEI4 $400
ADDRLP4 0
CNSTI4 2
ASGNI4
ADDRGP4 $401
JUMPV
LABELV $400
ADDRFP4 4
INDIRP4
ARGP4
ADDRGP4 $402
ARGP4
ADDRGP4 PrintMsg
CALLV
pop
CNSTI4 0
RETI4
ADDRGP4 $397
JUMPV
LABELV $401
LABELV $399
ADDRLP4 0
INDIRI4
ADDRLP4 4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
NEI4 $403
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 4
INDIRP4
ARGP4
ADDRLP4 0
INDIRI4
ARGI4
ADDRLP4 16
ADDRGP4 Team_TouchOurFlag
CALLI4
ASGNI4
ADDRLP4 16
INDIRI4
RETI4
ADDRGP4 $397
JUMPV
LABELV $403
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 4
INDIRP4
ARGP4
ADDRLP4 0
INDIRI4
ARGI4
ADDRLP4 16
ADDRGP4 Team_TouchEnemyFlag
CALLI4
ASGNI4
ADDRLP4 16
INDIRI4
RETI4
LABELV $397
endproc Pickup_Team 20 12
export Team_GetLocation
proc Team_GetLocation 48 8
ADDRLP4 24
CNSTP4 0
ASGNP4
ADDRLP4 20
CNSTF4 1296039936
ASGNF4
ADDRLP4 4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
INDIRB
ASGNB 12
ADDRLP4 0
ADDRGP4 level+9172
INDIRP4
ASGNP4
ADDRGP4 $409
JUMPV
LABELV $406
ADDRLP4 32
ADDRLP4 4
INDIRF4
ADDRLP4 0
INDIRP4
CNSTI4 488
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 36
ADDRLP4 0
INDIRP4
CNSTI4 492
ADDP4
INDIRF4
ASGNF4
ADDRLP4 40
ADDRLP4 0
INDIRP4
CNSTI4 496
ADDP4
INDIRF4
ASGNF4
ADDRLP4 16
ADDRLP4 32
INDIRF4
ADDRLP4 32
INDIRF4
MULF4
ADDRLP4 4+4
INDIRF4
ADDRLP4 36
INDIRF4
SUBF4
ADDRLP4 4+4
INDIRF4
ADDRLP4 36
INDIRF4
SUBF4
MULF4
ADDF4
ADDRLP4 4+8
INDIRF4
ADDRLP4 40
INDIRF4
SUBF4
ADDRLP4 4+8
INDIRF4
ADDRLP4 40
INDIRF4
SUBF4
MULF4
ADDF4
ASGNF4
ADDRLP4 16
INDIRF4
ADDRLP4 20
INDIRF4
LEF4 $415
ADDRGP4 $407
JUMPV
LABELV $415
ADDRLP4 4
ARGP4
ADDRLP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
ADDRLP4 44
ADDRGP4 trap_InPVS
CALLI4
ASGNI4
ADDRLP4 44
INDIRI4
CNSTI4 0
NEI4 $417
ADDRGP4 $407
JUMPV
LABELV $417
ADDRLP4 20
ADDRLP4 16
INDIRF4
ASGNF4
ADDRLP4 24
ADDRLP4 0
INDIRP4
ASGNP4
LABELV $407
ADDRLP4 0
ADDRLP4 0
INDIRP4
CNSTI4 604
ADDP4
INDIRP4
ASGNP4
LABELV $409
ADDRLP4 0
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $406
ADDRLP4 24
INDIRP4
RETP4
LABELV $405
endproc Team_GetLocation 48 8
export Team_GetLocationMsg
proc Team_GetLocationMsg 12 24
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 4
ADDRGP4 Team_GetLocation
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $420
CNSTI4 0
RETI4
ADDRGP4 $419
JUMPV
LABELV $420
ADDRLP4 0
INDIRP4
CNSTI4 756
ADDP4
INDIRI4
CNSTI4 0
EQI4 $422
ADDRLP4 0
INDIRP4
CNSTI4 756
ADDP4
INDIRI4
CNSTI4 0
GEI4 $424
ADDRLP4 0
INDIRP4
CNSTI4 756
ADDP4
CNSTI4 0
ASGNI4
LABELV $424
ADDRLP4 0
INDIRP4
CNSTI4 756
ADDP4
INDIRI4
CNSTI4 7
LEI4 $426
ADDRLP4 0
INDIRP4
CNSTI4 756
ADDP4
CNSTI4 7
ASGNI4
LABELV $426
ADDRFP4 4
INDIRP4
ARGP4
ADDRFP4 8
INDIRI4
ARGI4
ADDRGP4 $428
ARGP4
CNSTI4 94
ARGI4
ADDRLP4 0
INDIRP4
CNSTI4 756
ADDP4
INDIRI4
CNSTI4 48
ADDI4
ARGI4
ADDRLP4 0
INDIRP4
CNSTI4 636
ADDP4
INDIRP4
ARGP4
ADDRGP4 Com_sprintf
CALLI4
pop
ADDRGP4 $423
JUMPV
LABELV $422
ADDRFP4 4
INDIRP4
ARGP4
ADDRFP4 8
INDIRI4
ARGI4
ADDRGP4 $429
ARGP4
ADDRLP4 0
INDIRP4
CNSTI4 636
ADDP4
INDIRP4
ARGP4
ADDRGP4 Com_sprintf
CALLI4
pop
LABELV $423
CNSTI4 1
RETI4
LABELV $419
endproc Team_GetLocationMsg 12 24
export SelectRandomTeamSpawnPoint
proc SelectRandomTeamSpawnPoint 152 12
ADDRFP4 0
INDIRI4
CNSTI4 0
NEI4 $431
ADDRFP4 4
INDIRI4
CNSTI4 1
NEI4 $433
ADDRLP4 8
ADDRGP4 $435
ASGNP4
ADDRGP4 $432
JUMPV
LABELV $433
ADDRFP4 4
INDIRI4
CNSTI4 2
NEI4 $436
ADDRLP4 8
ADDRGP4 $438
ASGNP4
ADDRGP4 $432
JUMPV
LABELV $436
CNSTP4 0
RETP4
ADDRGP4 $430
JUMPV
LABELV $431
ADDRFP4 4
INDIRI4
CNSTI4 1
NEI4 $439
ADDRLP4 8
ADDRGP4 $441
ASGNP4
ADDRGP4 $440
JUMPV
LABELV $439
ADDRFP4 4
INDIRI4
CNSTI4 2
NEI4 $442
ADDRLP4 8
ADDRGP4 $444
ASGNP4
ADDRGP4 $443
JUMPV
LABELV $442
CNSTP4 0
RETP4
ADDRGP4 $430
JUMPV
LABELV $443
LABELV $440
LABELV $432
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRLP4 0
CNSTP4 0
ASGNP4
ADDRGP4 $446
JUMPV
LABELV $445
ADDRLP4 0
INDIRP4
ARGP4
ADDRLP4 144
ADDRGP4 SpotWouldTelefrag
CALLI4
ASGNI4
ADDRLP4 144
INDIRI4
CNSTI4 0
EQI4 $448
ADDRGP4 $446
JUMPV
LABELV $448
ADDRLP4 4
INDIRI4
CNSTI4 2
LSHI4
ADDRLP4 12
ADDP4
ADDRLP4 0
INDIRP4
ASGNP4
ADDRLP4 148
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 4
ADDRLP4 148
INDIRI4
ASGNI4
ADDRLP4 148
INDIRI4
CNSTI4 32
NEI4 $450
ADDRGP4 $447
JUMPV
LABELV $450
LABELV $446
ADDRLP4 0
INDIRP4
ARGP4
CNSTI4 524
ARGI4
ADDRLP4 8
INDIRP4
ARGP4
ADDRLP4 144
ADDRGP4 G_Find
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 144
INDIRP4
ASGNP4
ADDRLP4 144
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $445
LABELV $447
ADDRLP4 4
INDIRI4
CNSTI4 0
NEI4 $452
CNSTP4 0
ARGP4
CNSTI4 524
ARGI4
ADDRLP4 8
INDIRP4
ARGP4
ADDRLP4 148
ADDRGP4 G_Find
CALLP4
ASGNP4
ADDRLP4 148
INDIRP4
RETP4
ADDRGP4 $430
JUMPV
LABELV $452
ADDRLP4 148
ADDRGP4 qk_rand
CALLI4
ASGNI4
ADDRLP4 140
ADDRLP4 148
INDIRI4
ADDRLP4 4
INDIRI4
MODI4
ASGNI4
ADDRLP4 140
INDIRI4
CNSTI4 2
LSHI4
ADDRLP4 12
ADDP4
INDIRP4
RETP4
LABELV $430
endproc SelectRandomTeamSpawnPoint 152 12
export SelectCTFSpawnPoint
proc SelectCTFSpawnPoint 12 16
ADDRFP4 4
INDIRI4
ARGI4
ADDRFP4 0
INDIRI4
ARGI4
ADDRLP4 4
ADDRGP4 SelectRandomTeamSpawnPoint
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $455
ADDRGP4 vec3_origin
ARGP4
ADDRFP4 8
INDIRP4
ARGP4
ADDRFP4 12
INDIRP4
ARGP4
ADDRFP4 16
INDIRI4
ARGI4
ADDRLP4 8
ADDRGP4 SelectSpawnPoint
CALLP4
ASGNP4
ADDRLP4 8
INDIRP4
RETP4
ADDRGP4 $454
JUMPV
LABELV $455
ADDRFP4 8
INDIRP4
ADDRLP4 0
INDIRP4
CNSTI4 92
ADDP4
INDIRB
ASGNB 12
ADDRLP4 8
ADDRFP4 8
INDIRP4
CNSTI4 8
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRF4
CNSTF4 1091567616
ADDF4
ASGNF4
ADDRFP4 12
INDIRP4
ADDRLP4 0
INDIRP4
CNSTI4 116
ADDP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
RETP4
LABELV $454
endproc SelectCTFSpawnPoint 12 16
proc SortClients 0 0
ADDRFP4 0
INDIRP4
INDIRI4
ADDRFP4 4
INDIRP4
INDIRI4
SUBI4
RETI4
LABELV $457
endproc SortClients 0 0
export TeamplayInfoMessage
proc TeamplayInfoMessage 9408 36
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 612
ADDP4
INDIRI4
CNSTI4 0
NEI4 $459
ADDRGP4 $458
JUMPV
LABELV $459
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
CNSTI4 3
NEI4 $461
ADDRLP4 9376
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
ASGNP4
ADDRLP4 9376
INDIRP4
CNSTI4 624
ADDP4
INDIRI4
CNSTI4 2
NEI4 $465
ADDRLP4 9376
INDIRP4
CNSTI4 628
ADDP4
INDIRI4
CNSTI4 0
GEI4 $463
LABELV $465
ADDRGP4 $458
JUMPV
LABELV $463
ADDRLP4 12
CNSTI4 804
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 628
ADDP4
INDIRI4
MULI4
ADDRGP4 g_entities+516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ASGNI4
ADDRGP4 $462
JUMPV
LABELV $461
ADDRLP4 12
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ASGNI4
LABELV $462
ADDRLP4 12
INDIRI4
CNSTI4 1
EQI4 $467
ADDRLP4 12
INDIRI4
CNSTI4 2
EQI4 $467
ADDRGP4 $458
JUMPV
LABELV $467
ADDRLP4 9380
CNSTI4 0
ASGNI4
ADDRLP4 4
ADDRLP4 9380
INDIRI4
ASGNI4
ADDRLP4 8
ADDRLP4 9380
INDIRI4
ASGNI4
ADDRGP4 $472
JUMPV
LABELV $469
ADDRLP4 0
CNSTI4 804
ADDRLP4 4
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 level+84
ADDP4
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
EQI4 $475
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ADDRLP4 12
INDIRI4
NEI4 $475
ADDRLP4 9388
ADDRLP4 8
INDIRI4
ASGNI4
ADDRLP4 8
ADDRLP4 9388
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 9392
CNSTI4 2
ASGNI4
ADDRLP4 9388
INDIRI4
ADDRLP4 9392
INDIRI4
LSHI4
ADDRLP4 9248
ADDP4
ADDRLP4 4
INDIRI4
ADDRLP4 9392
INDIRI4
LSHI4
ADDRGP4 level+84
ADDP4
INDIRI4
ASGNI4
LABELV $475
LABELV $470
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $472
ADDRLP4 4
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
GEI4 $478
ADDRLP4 8
INDIRI4
CNSTI4 32
LTI4 $469
LABELV $478
ADDRLP4 9248
ARGP4
ADDRLP4 8
INDIRI4
CVIU4 4
ARGU4
CNSTU4 4
ARGU4
ADDRGP4 SortClients
ARGP4
ADDRGP4 qk_qsort
CALLV
pop
ADDRLP4 1056
CNSTI1 0
ASGNI1
ADDRLP4 9384
CNSTI4 0
ASGNI4
ADDRLP4 1048
ADDRLP4 9384
INDIRI4
ASGNI4
ADDRLP4 4
ADDRLP4 9384
INDIRI4
ASGNI4
ADDRLP4 8
ADDRLP4 9384
INDIRI4
ASGNI4
ADDRGP4 $482
JUMPV
LABELV $479
ADDRLP4 0
CNSTI4 804
ADDRLP4 4
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
EQI4 $484
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ADDRLP4 12
INDIRI4
NEI4 $484
ADDRLP4 9392
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
ASGNP4
ADDRLP4 1040
ADDRLP4 9392
INDIRP4
INDIRP4
CNSTI4 184
ADDP4
INDIRI4
ASGNI4
ADDRLP4 1044
ADDRLP4 9392
INDIRP4
INDIRP4
CNSTI4 196
ADDP4
INDIRI4
ASGNI4
ADDRLP4 1040
INDIRI4
CNSTI4 0
GEI4 $486
ADDRLP4 1040
CNSTI4 0
ASGNI4
LABELV $486
ADDRLP4 1044
INDIRI4
CNSTI4 0
GEI4 $488
ADDRLP4 1044
CNSTI4 0
ASGNI4
LABELV $488
ADDRLP4 16
ARGP4
CNSTI4 1024
ARGI4
ADDRGP4 $490
ARGP4
ADDRLP4 4
INDIRI4
ARGI4
ADDRLP4 9400
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
ASGNP4
ADDRLP4 9400
INDIRP4
CNSTI4 560
ADDP4
INDIRI4
ARGI4
ADDRLP4 1040
INDIRI4
ARGI4
ADDRLP4 1044
INDIRI4
ARGI4
ADDRLP4 9400
INDIRP4
CNSTI4 144
ADDP4
INDIRI4
ARGI4
ADDRLP4 0
INDIRP4
CNSTI4 188
ADDP4
INDIRI4
ARGI4
ADDRGP4 Com_sprintf
CALLI4
pop
ADDRLP4 16
ARGP4
ADDRLP4 9404
ADDRGP4 qk_strlen
CALLU4
ASGNU4
ADDRLP4 1052
ADDRLP4 9404
INDIRU4
CVUI4 4
ASGNI4
ADDRLP4 1048
INDIRI4
ADDRLP4 1052
INDIRI4
ADDI4
CVIU4 4
CNSTU4 8192
LTU4 $491
ADDRGP4 $481
JUMPV
LABELV $491
ADDRLP4 1048
INDIRI4
ADDRLP4 1056
ADDP4
ARGP4
ADDRLP4 16
ARGP4
ADDRGP4 qk_strcpy
CALLP4
pop
ADDRLP4 1048
ADDRLP4 1048
INDIRI4
ADDRLP4 1052
INDIRI4
ADDI4
ASGNI4
ADDRLP4 8
ADDRLP4 8
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $484
LABELV $480
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $482
ADDRLP4 4
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
GEI4 $493
ADDRLP4 8
INDIRI4
CNSTI4 32
LTI4 $479
LABELV $493
LABELV $481
ADDRGP4 $494
ARGP4
ADDRLP4 8
INDIRI4
ARGI4
ADDRLP4 1056
ARGP4
ADDRLP4 9388
ADDRGP4 va
CALLP4
ASGNP4
ADDRFP4 0
INDIRP4
CVPU4 4
ADDRGP4 g_entities
CVPU4 4
SUBU4
CVUI4 4
CNSTI4 804
DIVI4
ARGI4
ADDRLP4 9388
INDIRP4
ARGP4
ADDRGP4 trap_SendServerCommand
CALLV
pop
LABELV $458
endproc TeamplayInfoMessage 9408 36
export CheckTeamStatus
proc CheckTeamStatus 24 4
ADDRGP4 level+32
INDIRI4
ADDRGP4 level+60
INDIRI4
SUBI4
CNSTI4 1000
LEI4 $496
ADDRGP4 level+60
ADDRGP4 level+32
INDIRI4
ASGNI4
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRGP4 $505
JUMPV
LABELV $502
ADDRLP4 0
CNSTI4 804
ADDRLP4 4
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
EQI4 $507
ADDRGP4 $503
JUMPV
LABELV $507
ADDRLP4 0
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
EQI4 $509
ADDRLP4 16
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ASGNI4
ADDRLP4 16
INDIRI4
CNSTI4 1
EQI4 $511
ADDRLP4 16
INDIRI4
CNSTI4 2
NEI4 $509
LABELV $511
ADDRLP4 0
INDIRP4
ARGP4
ADDRLP4 20
ADDRGP4 Team_GetLocation
CALLP4
ASGNP4
ADDRLP4 8
ADDRLP4 20
INDIRP4
ASGNP4
ADDRLP4 8
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $512
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 560
ADDP4
ADDRLP4 8
INDIRP4
CNSTI4 728
ADDP4
INDIRI4
ASGNI4
ADDRGP4 $513
JUMPV
LABELV $512
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 560
ADDP4
CNSTI4 0
ASGNI4
LABELV $513
LABELV $509
LABELV $503
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $505
ADDRLP4 4
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
LTI4 $502
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRGP4 $517
JUMPV
LABELV $514
ADDRLP4 0
CNSTI4 804
ADDRLP4 4
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 468
ADDP4
INDIRI4
CNSTI4 2
EQI4 $519
ADDRGP4 $515
JUMPV
LABELV $519
ADDRLP4 0
INDIRP4
CNSTI4 520
ADDP4
INDIRI4
CNSTI4 0
EQI4 $521
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 TeamplayInfoMessage
CALLV
pop
LABELV $521
LABELV $515
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $517
ADDRLP4 4
INDIRI4
ADDRGP4 g_maxclients+12
INDIRI4
LTI4 $514
LABELV $496
LABELV $495
endproc CheckTeamStatus 24 4
export SP_team_CTF_redplayer
proc SP_team_CTF_redplayer 0 0
LABELV $523
endproc SP_team_CTF_redplayer 0 0
export SP_team_CTF_blueplayer
proc SP_team_CTF_blueplayer 0 0
LABELV $524
endproc SP_team_CTF_blueplayer 0 0
export SP_team_CTF_redspawn
proc SP_team_CTF_redspawn 0 0
LABELV $525
endproc SP_team_CTF_redspawn 0 0
export SP_team_CTF_bluespawn
proc SP_team_CTF_bluespawn 0 0
LABELV $526
endproc SP_team_CTF_bluespawn 0 0
bss
export neutralObelisk
align 4
LABELV neutralObelisk
skip 4
export teamgame
align 4
LABELV teamgame
skip 36
import trap_SnapVector
import trap_GeneticParentsAndChildSelection
import trap_BotResetWeaponState
import trap_BotFreeWeaponState
import trap_BotAllocWeaponState
import trap_BotLoadWeaponWeights
import trap_BotGetWeaponInfo
import trap_BotChooseBestFightWeapon
import trap_BotAddAvoidSpot
import trap_BotInitMoveState
import trap_BotFreeMoveState
import trap_BotAllocMoveState
import trap_BotPredictVisiblePosition
import trap_BotMovementViewTarget
import trap_BotReachabilityArea
import trap_BotResetLastAvoidReach
import trap_BotResetAvoidReach
import trap_BotMoveInDirection
import trap_BotMoveToGoal
import trap_BotResetMoveState
import trap_BotFreeGoalState
import trap_BotAllocGoalState
import trap_BotMutateGoalFuzzyLogic
import trap_BotSaveGoalFuzzyLogic
import trap_BotInterbreedGoalFuzzyLogic
import trap_BotFreeItemWeights
import trap_BotLoadItemWeights
import trap_BotUpdateEntityItems
import trap_BotInitLevelItems
import trap_BotSetAvoidGoalTime
import trap_BotAvoidGoalTime
import trap_BotGetLevelItemGoal
import trap_BotGetMapLocationGoal
import trap_BotGetNextCampSpotGoal
import trap_BotItemGoalInVisButNotVisible
import trap_BotTouchingGoal
import trap_BotChooseNBGItem
import trap_BotChooseLTGItem
import trap_BotGetSecondGoal
import trap_BotGetTopGoal
import trap_BotGoalName
import trap_BotDumpGoalStack
import trap_BotDumpAvoidGoals
import trap_BotEmptyGoalStack
import trap_BotPopGoal
import trap_BotPushGoal
import trap_BotResetAvoidGoals
import trap_BotRemoveFromAvoidGoals
import trap_BotResetGoalState
import trap_BotSetChatName
import trap_BotSetChatGender
import trap_BotLoadChatFile
import trap_BotReplaceSynonyms
import trap_UnifyWhiteSpaces
import trap_BotMatchVariable
import trap_BotFindMatch
import trap_StringContains
import trap_BotGetChatMessage
import trap_BotEnterChat
import trap_BotChatLength
import trap_BotReplyChat
import trap_BotNumInitialChats
import trap_BotInitialChat
import trap_BotNumConsoleMessages
import trap_BotNextConsoleMessage
import trap_BotRemoveConsoleMessage
import trap_BotQueueConsoleMessage
import trap_BotFreeChatState
import trap_BotAllocChatState
import trap_Characteristic_String
import trap_Characteristic_BInteger
import trap_Characteristic_Integer
import trap_Characteristic_BFloat
import trap_Characteristic_Float
import trap_BotFreeCharacter
import trap_BotLoadCharacter
import trap_EA_ResetInput
import trap_EA_GetInput
import trap_EA_EndRegular
import trap_EA_View
import trap_EA_Move
import trap_EA_DelayedJump
import trap_EA_Jump
import trap_EA_SelectWeapon
import trap_EA_MoveRight
import trap_EA_MoveLeft
import trap_EA_MoveBack
import trap_EA_MoveForward
import trap_EA_MoveDown
import trap_EA_MoveUp
import trap_EA_Crouch
import trap_EA_Respawn
import trap_EA_Use
import trap_EA_Attack
import trap_EA_Talk
import trap_EA_Gesture
import trap_EA_Action
import trap_EA_Command
import trap_EA_SayTeam
import trap_EA_Say
import trap_AAS_PredictClientMovement
import trap_AAS_Swimming
import trap_AAS_AlternativeRouteGoals
import trap_AAS_PredictRoute
import trap_AAS_EnableRoutingArea
import trap_AAS_AreaTravelTimeToGoalArea
import trap_AAS_AreaReachability
import trap_AAS_IntForBSPEpairKey
import trap_AAS_FloatForBSPEpairKey
import trap_AAS_VectorForBSPEpairKey
import trap_AAS_ValueForBSPEpairKey
import trap_AAS_NextBSPEntity
import trap_AAS_PointContents
import trap_AAS_TraceAreas
import trap_AAS_PointReachabilityAreaIndex
import trap_AAS_PointAreaNum
import trap_AAS_Time
import trap_AAS_PresenceTypeBoundingBox
import trap_AAS_Initialized
import trap_AAS_EntityInfo
import trap_AAS_AreaInfo
import trap_AAS_BBoxAreas
import trap_BotUserCommand
import trap_BotGetServerCommand
import trap_BotGetSnapshotEntity
import trap_BotLibTest
import trap_BotLibUpdateEntity
import trap_BotLibLoadMap
import trap_BotLibStartFrame
import trap_BotLibDefine
import trap_BotLibVarGet
import trap_BotLibVarSet
import trap_BotLibShutdown
import trap_BotLibSetup
import trap_DebugPolygonDelete
import trap_DebugPolygonCreate
import trap_GetEntityToken
import trap_GetUsercmd
import trap_BotFreeClient
import trap_BotAllocateClient
import trap_EntityContact
import trap_EntitiesInBox
import trap_UnlinkEntity
import trap_LinkEntity
import trap_AreasConnected
import trap_AdjustAreaPortalState
import trap_InPVSIgnorePortals
import trap_InPVS
import trap_PointContents
import trap_Trace
import trap_SetBrushModel
import trap_GetServerinfo
import trap_SetUserinfo
import trap_GetUserinfo
import trap_GetConfigstring
import trap_SetConfigstring
import trap_SendServerCommand
import trap_DropClient
import trap_LocateGameData
import trap_Cvar_VariableStringBuffer
import trap_Cvar_VariableValue
import trap_Cvar_VariableIntegerValue
import trap_Cvar_Set
import trap_Cvar_Update
import trap_Cvar_Register
import trap_SendConsoleCommand
import trap_FS_Seek
import trap_FS_GetFileList
import trap_FS_FCloseFile
import trap_FS_Write
import trap_FS_Read
import trap_FS_FOpenFile
import trap_Args
import trap_Argv
import trap_Argc
import trap_RealTime
import trap_Milliseconds
import trap_Error
import trap_Print
import g_proxMineTimeout
import g_singlePlayer
import g_enableBreath
import g_enableDust
import g_rankings
import pmove_msec
import pmove_fixed
import g_smoothClients
import g_blueteam
import g_redteam
import g_cubeTimeout
import g_obeliskRespawnDelay
import g_obeliskRegenAmount
import g_obeliskRegenPeriod
import g_obeliskHealth
import g_filterBan
import g_banIPs
import g_teamForceBalance
import g_teamAutoJoin
import g_allowVote
import g_blood
import g_doWarmup
import g_warmup
import g_motd
import g_synchronousClients
import g_weaponTeamRespawn
import g_weaponRespawn
import g_debugDamage
import g_debugAlloc
import g_debugMove
import g_inactivity
import g_forcerespawn
import g_quadfactor
import g_knockback
import g_speed
import g_gravity
import g_needpass
import g_password
import g_friendlyFire
import g_capturelimit
import g_timelimit
import g_fraglimit
import g_dmflags
import g_restarted
import g_maxGameClients
import g_maxclients
import g_cheats
import g_dedicated
import g_gametype
import g_entities
import level
import BotTestAAS
import BotAIStartFrame
import BotAIShutdownClient
import BotAISetupClient
import BotAILoadMap
import BotAIShutdown
import BotAISetup
import BotInterbreedEndMatch
import Svcmd_BotList_f
import Svcmd_AddBot_f
import G_BotConnect
import G_RemoveQueuedBotBegin
import G_CheckBotSpawn
import G_GetBotInfoByName
import G_GetBotInfoByNumber
import G_InitBots
import Svcmd_AbortPodium_f
import SpawnModelsOnVictoryPads
import UpdateTournamentInfo
import G_WriteSessionData
import G_InitWorldSession
import G_InitSessionData
import G_ReadSessionData
import Svcmd_GameMem_f
import G_InitMemory
import G_Alloc
import CheckObeliskAttack
import G_RunClient
import ClientEndFrame
import ClientThink
import ClientCommand
import ClientBegin
import ClientDisconnect
import ClientUserinfoChanged
import ClientConnect
import G_Error
import G_Printf
import SendScoreboardMessageToAllClients
import G_LogPrintf
import AddTournamentQueue
import G_RunThink
import CheckTeamLeader
import SetLeader
import FindIntermissionPoint
import MoveClientToIntermission
import DeathmatchScoreboardMessage
import FireWeapon
import G_FilterPacket
import G_ProcessIPBans
import ConsoleCommand
import SpotWouldTelefrag
import CalculateRanks
import AddScore
import player_die
import ClientSpawn
import InitBodyQue
import BeginIntermission
import ClientRespawn
import CopyToBodyQue
import SelectSpawnPoint
import SetClientViewAngle
import PickTeam
import TeamLeader
import TeamCount
import Weapon_HookThink
import Weapon_HookFree
import CheckGauntletAttack
import SnapVectorTowards
import CalcMuzzlePoint
import LogAccuracyHit
import TeleportPlayer
import trigger_teleporter_touch
import Touch_DoorTrigger
import G_RunMover
import fire_grapple
import fire_bfg
import fire_rocket
import fire_grenade
import fire_plasma
import G_RunMissile
import TossClientCubes
import TossClientItems
import body_die
import G_InvulnerabilityEffect
import G_RadiusDamage
import G_Damage
import CanDamage
import BuildShaderStateConfig
import AddRemap
import G_SetOrigin
import G_AddEvent
import G_AddPredictableEvent
import vectoyaw
import vtos
import tv
import G_TouchTriggers
import G_EntitiesFree
import G_FreeEntity
import G_Sound
import G_TempEntity
import G_Spawn
import G_InitGentity
import G_SetMovedir
import G_UseTargets
import G_PickTarget
import G_Find
import G_KillBox
import G_TeamCommand
import G_SoundIndex
import G_ModelIndex
import SaveRegisteredItems
import RegisterItem
import ClearRegisteredItems
import Touch_Item
import Add_Ammo
import ArmorIndex
import Think_Weapon
import FinishSpawningItem
import G_SpawnItem
import SetRespawn
import LaunchItem
import Drop_Item
import PrecacheItem
import UseHoldableItem
import RespawnItem
import G_RunItem
import G_CheckTeamItems
import Cmd_FollowCycle_f
import SetTeam
import BroadcastTeamChange
import StopFollowing
import Cmd_Score_f
import G_NewString
import G_SpawnEntitiesFromString
import G_SpawnVector
import G_SpawnInt
import G_SpawnFloat
import G_SpawnString
import BG_PlayerTouchesItem
import BG_PlayerStateToEntityStateExtraPolate
import BG_PlayerStateToEntityState
import BG_TouchJumpPad
import BG_AddPredictableEventToPlayerstate
import BG_EvaluateTrajectoryDelta
import BG_EvaluateTrajectory
import BG_CanItemBeGrabbed
import BG_FindItemForHoldable
import BG_FindItemForPowerup
import BG_FindItemForWeapon
import BG_FindItem
import bg_numItems
import bg_itemlist
import Pmove
import PM_UpdateViewAngles
import Com_Printf
import Com_Error
import Info_NextPair
import Info_Validate
import Info_SetValueForKey_Big
import Info_SetValueForKey
import Info_RemoveKey_Big
import Info_RemoveKey
import Info_ValueForKey
import Com_TruncateLongString
import va
import Q_CountChar
import Q_CleanStr
import Q_PrintStrlen
import Q_strcat
import Q_strncpyz
import Q_stristr
import Q_strupr
import Q_strlwr
import Q_stricmpn
import Q_strncmp
import Q_stricmp
import Q_isintegral
import Q_isanumber
import Q_isalpha
import Q_isupper
import Q_islower
import Q_isprint
import Com_RandomBytes
import Com_SkipCharset
import Com_SkipTokens
import Com_sprintf
import Com_HexStrToInt
import Parse3DMatrix
import Parse2DMatrix
import Parse1DMatrix
import SkipRestOfLine
import SkipBracedSection
import COM_MatchToken
import COM_ParseWarning
import COM_ParseError
import COM_Compress
import COM_ParseExt
import COM_Parse
import COM_GetCurrentParseLine
import COM_BeginParseSession
import COM_DefaultExtension
import COM_CompareExtension
import COM_StripExtension
import COM_GetExtension
import COM_SkipPath
import Com_Clamp
import PerpendicularVector
import AngleVectors
import MatrixMultiply
import MakeNormalVectors
import RotateAroundDirection
import RotatePointAroundVector
import ProjectPointOnPlane
import PlaneFromPoints
import AngleDelta
import AngleNormalize180
import AngleNormalize360
import AnglesSubtract
import AngleSubtract
import LerpAngle
import AngleMod
import BoundsIntersectPoint
import BoundsIntersectSphere
import BoundsIntersect
import BoxOnPlaneSide
import SetPlaneSignbits
import AxisCopy
import AxisClear
import AnglesToAxis
import vectoangles
import Q_crandom
import Q_random
import Q_rand
import Q_acos
import Q_log2
import VectorRotate
import Vector4Scale
import VectorNormalize2
import VectorNormalize
import CrossProduct
import VectorInverse
import VectorNormalizeFast
import DistanceSquared
import Distance
import VectorLengthSquared
import VectorLength
import VectorCompare
import AddPointToBounds
import ClearBounds
import RadiusFromBounds
import NormalizeColor
import ColorBytes4
import ColorBytes3
import _VectorMA
import _VectorScale
import _VectorCopy
import _VectorAdd
import _VectorSubtract
import _DotProduct
import ByteToDir
import DirToByte
import ClampShort
import ClampChar
import Q_rsqrt
import Q_fabs
import Q_isnan
import axisDefault
import vec3_origin
import g_color_table
import colorDkGrey
import colorMdGrey
import colorLtGrey
import colorWhite
import colorCyan
import colorMagenta
import colorYellow
import colorBlue
import colorGreen
import colorRed
import colorBlack
import bytedirs
import Hunk_AllocDebug
import FloatSwap
import LongSwap
import ShortSwap
import CopyLongSwap
import CopyShortSwap
import qk_acos
import qk_fabs
import qk_abs
import qk_tan
import qk_atan2
import qk_cos
import qk_sin
import qk_sqrt
import qk_floor
import qk_ceil
import qk_memcpy
import qk_memset
import qk_memmove
import qk_sscanf
import qk_vsnprintf
import qk_strtol
import qk_atoi
import qk_strtod
import qk_atof
import qk_toupper
import qk_tolower
import qk_strncpy
import qk_strstr
import qk_strrchr
import qk_strchr
import qk_strcmp
import qk_strcpy
import qk_strcat
import qk_strlen
import qk_rand
import qk_srand
import qk_qsort
lit
align 1
LABELV $494
byte 1 116
byte 1 105
byte 1 110
byte 1 102
byte 1 111
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 115
byte 1 0
align 1
LABELV $490
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 105
byte 1 32
byte 1 37
byte 1 105
byte 1 0
align 1
LABELV $444
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 95
byte 1 67
byte 1 84
byte 1 70
byte 1 95
byte 1 98
byte 1 108
byte 1 117
byte 1 101
byte 1 115
byte 1 112
byte 1 97
byte 1 119
byte 1 110
byte 1 0
align 1
LABELV $441
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 95
byte 1 67
byte 1 84
byte 1 70
byte 1 95
byte 1 114
byte 1 101
byte 1 100
byte 1 115
byte 1 112
byte 1 97
byte 1 119
byte 1 110
byte 1 0
align 1
LABELV $438
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 95
byte 1 67
byte 1 84
byte 1 70
byte 1 95
byte 1 98
byte 1 108
byte 1 117
byte 1 101
byte 1 112
byte 1 108
byte 1 97
byte 1 121
byte 1 101
byte 1 114
byte 1 0
align 1
LABELV $435
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 95
byte 1 67
byte 1 84
byte 1 70
byte 1 95
byte 1 114
byte 1 101
byte 1 100
byte 1 112
byte 1 108
byte 1 97
byte 1 121
byte 1 101
byte 1 114
byte 1 0
align 1
LABELV $429
byte 1 37
byte 1 115
byte 1 0
align 1
LABELV $428
byte 1 37
byte 1 99
byte 1 37
byte 1 99
byte 1 37
byte 1 115
byte 1 94
byte 1 55
byte 1 0
align 1
LABELV $402
byte 1 68
byte 1 111
byte 1 110
byte 1 39
byte 1 116
byte 1 32
byte 1 107
byte 1 110
byte 1 111
byte 1 119
byte 1 32
byte 1 119
byte 1 104
byte 1 97
byte 1 116
byte 1 32
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 32
byte 1 116
byte 1 104
byte 1 101
byte 1 32
byte 1 102
byte 1 108
byte 1 97
byte 1 103
byte 1 32
byte 1 105
byte 1 115
byte 1 32
byte 1 111
byte 1 110
byte 1 46
byte 1 10
byte 1 0
align 1
LABELV $393
byte 1 37
byte 1 115
byte 1 94
byte 1 55
byte 1 32
byte 1 103
byte 1 111
byte 1 116
byte 1 32
byte 1 116
byte 1 104
byte 1 101
byte 1 32
byte 1 37
byte 1 115
byte 1 32
byte 1 102
byte 1 108
byte 1 97
byte 1 103
byte 1 33
byte 1 10
byte 1 0
align 1
LABELV $368
byte 1 37
byte 1 115
byte 1 94
byte 1 55
byte 1 32
byte 1 99
byte 1 97
byte 1 112
byte 1 116
byte 1 117
byte 1 114
byte 1 101
byte 1 100
byte 1 32
byte 1 116
byte 1 104
byte 1 101
byte 1 32
byte 1 37
byte 1 115
byte 1 32
byte 1 102
byte 1 108
byte 1 97
byte 1 103
byte 1 33
byte 1 10
byte 1 0
align 1
LABELV $364
byte 1 37
byte 1 115
byte 1 94
byte 1 55
byte 1 32
byte 1 114
byte 1 101
byte 1 116
byte 1 117
byte 1 114
byte 1 110
byte 1 101
byte 1 100
byte 1 32
byte 1 116
byte 1 104
byte 1 101
byte 1 32
byte 1 37
byte 1 115
byte 1 32
byte 1 102
byte 1 108
byte 1 97
byte 1 103
byte 1 33
byte 1 10
byte 1 0
align 1
LABELV $344
byte 1 84
byte 1 104
byte 1 101
byte 1 32
byte 1 37
byte 1 115
byte 1 32
byte 1 102
byte 1 108
byte 1 97
byte 1 103
byte 1 32
byte 1 104
byte 1 97
byte 1 115
byte 1 32
byte 1 114
byte 1 101
byte 1 116
byte 1 117
byte 1 114
byte 1 110
byte 1 101
byte 1 100
byte 1 33
byte 1 10
byte 1 0
align 1
LABELV $343
byte 1 84
byte 1 104
byte 1 101
byte 1 32
byte 1 102
byte 1 108
byte 1 97
byte 1 103
byte 1 32
byte 1 104
byte 1 97
byte 1 115
byte 1 32
byte 1 114
byte 1 101
byte 1 116
byte 1 117
byte 1 114
byte 1 110
byte 1 101
byte 1 100
byte 1 33
byte 1 10
byte 1 0
align 1
LABELV $337
byte 1 87
byte 1 97
byte 1 114
byte 1 110
byte 1 105
byte 1 110
byte 1 103
byte 1 58
byte 1 32
byte 1 32
byte 1 78
byte 1 85
byte 1 76
byte 1 76
byte 1 32
byte 1 112
byte 1 97
byte 1 115
byte 1 115
byte 1 101
byte 1 100
byte 1 32
byte 1 116
byte 1 111
byte 1 32
byte 1 84
byte 1 101
byte 1 97
byte 1 109
byte 1 95
byte 1 67
byte 1 97
byte 1 112
byte 1 116
byte 1 117
byte 1 114
byte 1 101
byte 1 70
byte 1 108
byte 1 97
byte 1 103
byte 1 83
byte 1 111
byte 1 117
byte 1 110
byte 1 100
byte 1 10
byte 1 0
align 1
LABELV $309
byte 1 87
byte 1 97
byte 1 114
byte 1 110
byte 1 105
byte 1 110
byte 1 103
byte 1 58
byte 1 32
byte 1 32
byte 1 78
byte 1 85
byte 1 76
byte 1 76
byte 1 32
byte 1 112
byte 1 97
byte 1 115
byte 1 115
byte 1 101
byte 1 100
byte 1 32
byte 1 116
byte 1 111
byte 1 32
byte 1 84
byte 1 101
byte 1 97
byte 1 109
byte 1 95
byte 1 84
byte 1 97
byte 1 107
byte 1 101
byte 1 70
byte 1 108
byte 1 97
byte 1 103
byte 1 83
byte 1 111
byte 1 117
byte 1 110
byte 1 100
byte 1 10
byte 1 0
align 1
LABELV $303
byte 1 87
byte 1 97
byte 1 114
byte 1 110
byte 1 105
byte 1 110
byte 1 103
byte 1 58
byte 1 32
byte 1 32
byte 1 78
byte 1 85
byte 1 76
byte 1 76
byte 1 32
byte 1 112
byte 1 97
byte 1 115
byte 1 115
byte 1 101
byte 1 100
byte 1 32
byte 1 116
byte 1 111
byte 1 32
byte 1 84
byte 1 101
byte 1 97
byte 1 109
byte 1 95
byte 1 82
byte 1 101
byte 1 116
byte 1 117
byte 1 114
byte 1 110
byte 1 70
byte 1 108
byte 1 97
byte 1 103
byte 1 83
byte 1 111
byte 1 117
byte 1 110
byte 1 100
byte 1 10
byte 1 0
align 1
LABELV $290
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 95
byte 1 67
byte 1 84
byte 1 70
byte 1 95
byte 1 110
byte 1 101
byte 1 117
byte 1 116
byte 1 114
byte 1 97
byte 1 108
byte 1 102
byte 1 108
byte 1 97
byte 1 103
byte 1 0
align 1
LABELV $237
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 95
byte 1 67
byte 1 84
byte 1 70
byte 1 95
byte 1 98
byte 1 108
byte 1 117
byte 1 101
byte 1 102
byte 1 108
byte 1 97
byte 1 103
byte 1 0
align 1
LABELV $235
byte 1 116
byte 1 101
byte 1 97
byte 1 109
byte 1 95
byte 1 67
byte 1 84
byte 1 70
byte 1 95
byte 1 114
byte 1 101
byte 1 100
byte 1 102
byte 1 108
byte 1 97
byte 1 103
byte 1 0
align 1
LABELV $215
byte 1 37
byte 1 115
byte 1 94
byte 1 55
byte 1 32
byte 1 102
byte 1 114
byte 1 97
byte 1 103
byte 1 103
byte 1 101
byte 1 100
byte 1 32
byte 1 37
byte 1 115
byte 1 39
byte 1 115
byte 1 32
byte 1 115
byte 1 107
byte 1 117
byte 1 108
byte 1 108
byte 1 32
byte 1 99
byte 1 97
byte 1 114
byte 1 114
byte 1 105
byte 1 101
byte 1 114
byte 1 33
byte 1 10
byte 1 0
align 1
LABELV $204
byte 1 37
byte 1 115
byte 1 94
byte 1 55
byte 1 32
byte 1 102
byte 1 114
byte 1 97
byte 1 103
byte 1 103
byte 1 101
byte 1 100
byte 1 32
byte 1 37
byte 1 115
byte 1 39
byte 1 115
byte 1 32
byte 1 102
byte 1 108
byte 1 97
byte 1 103
byte 1 32
byte 1 99
byte 1 97
byte 1 114
byte 1 114
byte 1 105
byte 1 101
byte 1 114
byte 1 33
byte 1 10
byte 1 0
align 1
LABELV $96
byte 1 112
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 32
byte 1 34
byte 1 37
byte 1 115
byte 1 34
byte 1 0
align 1
LABELV $91
byte 1 80
byte 1 114
byte 1 105
byte 1 110
byte 1 116
byte 1 77
byte 1 115
byte 1 103
byte 1 32
byte 1 111
byte 1 118
byte 1 101
byte 1 114
byte 1 114
byte 1 117
byte 1 110
byte 1 0
align 1
LABELV $86
byte 1 94
byte 1 55
byte 1 0
align 1
LABELV $85
byte 1 94
byte 1 51
byte 1 0
align 1
LABELV $82
byte 1 94
byte 1 52
byte 1 0
align 1
LABELV $79
byte 1 94
byte 1 49
byte 1 0
align 1
LABELV $75
byte 1 70
byte 1 82
byte 1 69
byte 1 69
byte 1 0
align 1
LABELV $74
byte 1 83
byte 1 80
byte 1 69
byte 1 67
byte 1 84
byte 1 65
byte 1 84
byte 1 79
byte 1 82
byte 1 0
align 1
LABELV $71
byte 1 66
byte 1 76
byte 1 85
byte 1 69
byte 1 0
align 1
LABELV $68
byte 1 82
byte 1 69
byte 1 68
byte 1 0
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/nested_subtype_byref.ads | best08618/asylo | 7 | 9314 |
package Nested_Subtype_Byref is
procedure Check;
end;
|
test/Succeed/SizedTypesMergeSort.agda | redfish64/autonomic-agda | 3 | 14767 | -- {-# OPTIONS -v tc.size:100 #-}
module SizedTypesMergeSort where
open import Common.Size
open import Common.Prelude using (Bool; true; false; if_then_else_)
open import Common.Product
module Old where
-- sized lists
data List (A : Set) : {_ : Size} -> Set where
[] : {size : Size} -> List A {↑ size}
_::_ : {size : Size} -> A -> List A {size} -> List A {↑ size}
-- CPS split (non-size increasing)
split : {A : Set}{i : Size} -> List A {i} ->
{C : Set} -> (List A {i} -> List A {i} -> C) -> C
split [] k = k [] []
split (x :: xs) k = split xs (\ l r -> k (x :: r) l)
module Sort (A : Set) (compare : A -> A -> {B : Set} -> B -> B -> B) where
-- Andreas, 4 Sep 2008
-- the size indices i and j should not be necessary here
-- but without them, the termination checker does not recognise that
-- the pattern x :: xs is equal to the term x :: xs
-- I suspect that _::_ {∞} x xs is not equal to itself since ∞ is a term
-- not a constructor or variable
merge : {i j : Size} -> List A {i} -> List A {j} -> List A
merge [] ys = ys
merge xs [] = xs
merge (x :: xs) (y :: ys) =
compare x y (x :: merge xs (y :: ys))
(y :: merge (x :: xs) ys)
sort : {i : Size} -> List A {i} -> List A
sort [] = []
sort (x :: []) = x :: []
sort (x :: (y :: xs)) = split xs (\ l r -> merge (sort (x :: l))
(sort (y :: r)))
module New where
-- sized lists
data List A {i} : Set where
[] : List A
_::_ : {i' : Size< i} → A → List A {i'} → List A
module CPS where
-- CPS split (non-size increasing)
split : ∀ {A i} → List A {i} →
{C : Set} → (List A {i} → List A {i} → C) → C
split [] k = k [] []
split (x :: xs) k = split xs (\ l r → k (x :: r) l)
module Sort (A : Set) (compare : A → A → {B : Set} → B → B → B) where
merge : List A → List A → List A
merge [] ys = ys
merge xs [] = xs
merge (x :: xs) (y :: ys) =
compare x y (x :: merge xs (y :: ys))
(y :: merge (x :: xs) ys)
sort : {i : Size} → List A {i} → List A
sort [] = []
sort (x :: []) = x :: []
sort (x :: (y :: xs)) = split xs (\ l r → merge (sort (x :: l))
(sort (y :: r)))
module Direct where
split : ∀ {A i} → List A {i} → List A {i} × List A {i}
split [] = [] , []
split (x :: xs) = let l , r = split xs in (x :: r) , l
module Sort (A : Set) (_≤_ : A → A → Bool) where
merge : List A → List A → List A
merge [] ys = ys
merge xs [] = xs
merge (x :: xs) (y :: ys) =
if x ≤ y then (x :: merge xs (y :: ys))
else (y :: merge (x :: xs) ys)
sort : {i : Size} → List A {i} → List A
sort [] = []
sort (x :: []) = x :: []
sort (x :: (y :: xs)) = let l , r = split xs in merge (sort (x :: l))
(sort (y :: r))
|
oeis/071/A071799.asm | neoneye/loda-programs | 11 | 104010 | ; A071799: Number of lattice paths in the lattice [0..2n] X [0..2n] which do not pass through the point (n,n).
; Submitted by <NAME>
; 2,34,524,7970,121252,1850380,28337976,435443490,6711230900,103711749284,1606464657096,24935144010764,387746052588104,6039349005200440,94203136553911024,1471326505700038434,23007323485217888340,360154459563530689204,5643332975601670914600
mov $3,2
add $3,$0
add $3,$0
lpb $0
mov $2,$3
bin $2,$0
sub $0,1
pow $2,2
add $1,$2
lpe
mov $0,$1
mul $0,2
add $0,2
|
45/beef/cw/user/editmgr1.asm | minblock/msdos | 0 | 25762 | <gh_stars>0
;*
;* COW : Character Oriented Windows
;*
;* editmgr1.asm : Multi-line edit manager (part1)
;* (included by editmgr.asm)
cProc InternalEditWndProc,<FAR,PUBLIC>,<SI,DI>
parmW pwnd
parmW message
parmW wParam
parmD lParam
localW oln
localW olnT
localW ob
localW clnT
localW ptMouseX
localW ptMouseY
localB fGrabFocus
localW olnFirst
localW olnLast
localW obFirst
localW obLast
localW fOk
cBegin
;
; We are not re-entrant!!!
; If we are in the middle of a big edit we could be re-entered
; because the text manager may put up a dialog box.
; If this happens, just ignore the messages
;
test [emFlags],EMF_IN_EDITMGR
jz NotReEntering
cmp [message],WM_PAINT
jne @F
ifdef PROJECT_LQB
mov [pdCur.pd_oln],-1 ;edit buffer may be new
endif ;PROJECT_LQB
cCall RefreshScreen ; We can redraw the screen
@@:
mov [fOk],FALSE
jmp QuickExitEditMgr
NotReEntering:
or [emFlags],EMF_IN_EDITMGR
mov [fGrabFocus],FALSE
mov [fOk],TRUE
NoUpdate:
mov bx,[pwnd] ;pwnd
mov pwndEditCur, bx ;bx = pwnd
mov ax,[bx].pefExtra ; pwnd->pef = pwnd->pefExtra
mov [pefCur],ax
xor ax,ax
mov al,[bx].arcClipping.axRightArc
sub al,[bx].arcClipping.axLeftArc
mov [cColumnsCur],ax
mov al,[bx].arcClipping.ayBottomArc
sub al,[bx].arcClipping.ayTopArc
mov [cLinesCur],ax
mov bx,[pefCur]
mov ax,[bx].EF_attrCur
mov [CurattrCur],ax
mov al,[bx].EF_Style
mov [emState],al
mov fResetAnchor,FALSE
; !!! change later to a single big move !!!
mov ax,[bx.EF_ipCur.ip_ob] ;transfer insertion to local var.
mov dx,[bx.EF_ipCur.ip_oln]
mov ipCur.ip_ob, ax
mov ipCur.ip_oln, dx
mov ipStart.ip_ob, ax ;local start for text selection
mov ipStart.ip_oln, dx
mov ax, [bx.EF_ipAnchor.ip_ob];
mov dx, [bx.EF_ipAnchor.ip_oln];
mov ipAnchor.ip_ob, ax
mov ipAnchor.ip_oln, dx
mov ipAnchorStart.ip_ob, ax
mov ipAnchorStart.ip_oln, dx
mov di,OFFSET DGROUP:ldCur ;get pefCur.ldCur
mov si,[bx.EF_pldCur] ;restore current line descriptor
push ds
pop es
movsw
movsw
movsw
movsb
mov di,OFFSET DGROUP:pdCur ;get pefCur.pdCur
lea si,[bx.EF_pdCur]
push ds
pop es
movsw
movsw
movsw
cCall EMRefreshCache
;
; Make sure the window is not past the end of the buffer
;
mov ax, [clnCur]
cmp ax, [pdCur.pd_olntop]
jae @F
mov [pdCur.pd_olntop], ax
@@:
;
; Make sure the cursor is not past the end of the buffer
;
cmp ax, [ipCur.ip_oln]
jae @F
mov [ipCur.ip_oln], ax
@@:
cmp ax, [ipAnchor.ip_oln]
jae @F
mov [ipAnchor.ip_oln], ax
@@:
push ds
push [ldCur.ld_prgch]
call fstrlen
mov bx, [ldCur.ld_cbMax]
cmp ax, bx ; brif ldCur.cb < ldCur.cbMax
jb @F
mov ax, bx
dec ax
@@:
mov [ldCur.LD_cb], ax
mov [fRefreshScreen],0
; Finished initializing editor state
; Start case statement for message
mov ax,[message] ;message
;jump for primary (message)
;case WM_SETFOCUS
$SetFocus:
cmp ax, WM_SETFOCUS
jne FlushFocus
mov [pdCur.pd_oln],-1 ;edit buffer may be new even
; though pwndEditCur is same
; which would cause EditMgr entry
; to not reset pdCur.pd_oln to -1
;; a-emoryh - Don't screw ES_NOSELECT if in QHelp mode
test [cmdSwitches],CMD_SW_QHELP
jnz QHelpSkip1
and [emState], NOT ES_NOSELECT
QHelpSkip1:
cCall RefreshSelection
mov ax,1
cCall EnableCursor,<[pwndEditCur],ax> ;make sure cursor in on now that we
test [emState], ES_MULTILINE
jnz NotSingleline
mov ax, ldCur.ld_cb ;for single line make end of line
mov ipCur.ip_ob,ax ;current ip position
mov ipAnchor.ip_ob,0 ;Anchor to start so whole line selected
NotSingleline:
cCall DisplayCurPos ;force recal of current postion
jmp ExitMainCase
;case WM_FLUSHFOCUS
FlushFocus:
cmp ax, WM_FLUSHFOCUS
jne WantFocus
cCall UpdateLine
mov [pdCur.pd_oln],-1
jmp ExitMainCase
;case WM_WANTFOCUS
WantFocus:
cmp ax, WM_WANTFOCUS
jne KillFocus
mov bx,[pwnd]
mov ax, word ptr [bx].stfWnd
and ax,MASK fEnabledStf
mov [fOk],ax
jmp ExitMainCase
;case WM_KILLFOCUS
KillFocus:
cmp ax, WM_KILLFOCUS
jne SetReDraw
;; a-emoryh - Don't screw ES_NOSELECT if in QHelp mode
test [cmdSwitches],CMD_SW_QHELP
jnz QHelpSkip2
or [emState], ES_NOSELECT
QHelpSkip2:
cCall UpdateLine ;make sure text buffer is correct
cCall RefreshSelection
test [emState],EF_TRACKING_MOUSE
je NoTrack_1 ;brif not tracking the mouse
cCall ReleaseCapture ;if so make sure others get mouse
and [emState],NOT EF_TRACKING_MOUSE
NoTrack_1:
xor ax, ax
cCall EnableCursor,<[pwndEditCur],ax> ;turn cursor off
test [emState], ES_MULTILINE
jnz Multiline_2 ;brif multiline edit
mov ipCur.ip_ob,0 ;reset position for single line case
mov pdCur.pd_obleft,0 ;and offset into line
Multiline_2:
cCall DisplayCurPos
jmp ExitMainCase
;case WM_SETREDRAW
SetReDraw:
cmp ax, WM_SETREDRAW
jne Paint
mov cx,[wParam]
jcxz NoRedraw
and [emState], NOT ES_NOREDRAW
inc [fRefreshScreen]
cCall DisplayCurPos
jmp ExitMainCase
NoRedraw:
or [emState], ES_NOREDRAW
jmp ExitMainCase
;case WM_PAINT
Paint:
cmp ax, WM_PAINT
jne SetText
mov ax,[cColumnsCur]
add ax,WORD PTR pdCur.pd_obleft
cmp ax,ldCur.ld_cbMax
jb NoRecalc
mov ax,ldCur.ld_cbMax ;change in border forces recalc of
sub ax,[cColumnsCur]
dec ax
mov WORD PTR pdCur.pd_obleft,ax
cCall DisplayCurPos
NoRecalc:
inc [fRefreshScreen]
jmp ExitMainCase
; case WM_SETTEXT
DEBPUBLIC SetText
SetText:
cmp ax, WM_SETTEXT
jne GetText
push ds ; Destination for fstrcpy
push [ldCur.LD_prgch]
push word ptr [lParam+2] ; Source for fstrcpy
push word ptr [lParam]
call fstrcpy
push ds
push [ldCur.LD_prgch]
call fstrlen
mov [ldCur.LD_cb],ax
cCall GetFocus ;if Focus is this window
cmp ax,[pwndEditCur] ; then select the line
jne @F ; otherwise don't
mov ax,[ldCur.LD_cb]
mov ipCur.ip_ob,ax ;current ip position
mov ipAnchor.ip_ob,0 ;Anchor to start so whole line selected
@@:
cmp [wParam],0
jz SetNoRefresh
cCall DisplayCurPos
cCall RefreshLine,<ipCur.IP_oln>
SetNoRefresh:
jmp ExitMainCase2
;case WM_GETTEXT
DEBPUBLIC GetText
GetText:
cmp ax,WM_GETTEXT
je DoGetText
jmp $Undo
DoGetText:
test [emState], ES_MULTILINE
jnz MultiLineGetText
mov ax, [ldCur.LD_cb]
mov bx,[wParam]
dec bx ; ensure enough room for null.
cmp ax,bx
jbe LenOk
xchg ax,bx ; ax := wParam
LenOk:
mov [fOk],ax ; Save for return value
push ds ; Source for bltbytex
mov si,[ldCur.LD_prgch] ; Source for bltbytex
mov es,[seg_lParam] ; Destination for bltbytex
mov di,[off_lParam] ; Destination for bltbytex
mov bx,ax ; bx = count
add bx,di ; bx = offset of dest. end
mov byte ptr es:[bx],0 ; NULL terminate destination.
cCall bltbytex,<ds,si,es,di,ax>
jmp ExitMainCase1
MultiLineGetText:
mov bx,[pefCur]
test [bx.EF_fSelection],0ffH
jz NoTextToGet
lea ax,[olnFirst]
lea bx,[obFirst]
lea cx,[olnLast]
lea dx,[obLast]
cCall BuildSelection,<ax,bx,cx,dx>
; Line 206
mov ax,[olnLast]
cmp [olnFirst],ax
jne NoTextToGet
push [olnFirst]
push [obFirst]
push [obLast]
push word ptr [lParam+2]
push word ptr [lParam]
push [wParam]
call CopyChars
mov [fOk],ax
jmp short ExitGetText
NoTextToGet:
xor ax,ax
les bx, [lParam]
mov byte ptr [bx], 0
mov [fOk],ax
ExitGetText:
jmp ExitMainCase1
;case WM_UNDO
$Undo:
cmp ax, WM_UNDO
jne $Clear
cCall Undo
jmp ExitMainCase
;case WM_CLEAR
$Clear:
cmp ax, WM_CLEAR
jne $Cut
xor ax,ax
jmp short DoCut
;case WM_CUT
$Cut:
cmp ax, WM_CUT
jne $Copy
mov ax,1
DoCut:
mov bx,[pefCur]
cmp [bx.EF_fSelection],0
je NoSel
cCall Cut,<ax>
cCall DisplayCurPos
jmp ExitMainCase
NoSel: ;with no selection Del key is a delete
cCall Del
jmp ExitMainCase
;case WM_COPY
$Copy:
cmp ax, WM_COPY
jne $Paste
cCall Copy
jmp ExitMainCase
;case WM_PASTE
$Paste:
cmp ax, WM_PASTE
jne ReplaceSel
DoPaste:
cCall Paste,<wParam>
cCall DisplayCurPos
jmp ExitMainCase
;case EM_REPLACESEL
ReplaceSel:
cmp ax, EM_REPLACESEL
jne GetLineSel
cCall Paste,<wParam>
cCall UpdateLine
jmp ExitMainCase
;case EM_GETLINESEL
GetLineSel:
cmp ax, EM_GETLINESEL
jne GetSel
; Get the current selection (lines)
; wParam points to an array of two words.
; The numbers of the first and the last lines in the selection are stored here.
; Return the number of lines selected.
lea ax, [olnFirst]
lea bx, [obFirst]
lea cx, [olnLast]
lea dx, [obLast]
cCall BuildSelection,<ax,bx,cx,dx>
mov bx, [olnFirst]
mov cx, [obLast]
mov dx, [olnLast]
xor ax,ax
cmp bx,dx
je yyy2
dec dx
jcxz yyy1
inc dx
yyy1:
mov ax,dx
sub ax, bx
inc ax
mov [fOk],ax
yyy2:
mov si, [wParam]
mov [si], bx
mov [si+2], dx
jmp ExitMainCase
; case EM_GETSEL
GetSel:
cmp ax, EM_GETSEL
jne SetSel
mov ax,[ipAnchor.ip_ob]
mov dx,[ipCur.ip_ob]
jmp ExitMainCase
; case EM_SETSEL
DEBPUBLIC SetSel
SetSel:
cmp ax, EM_SETSEL
jne SelChars
mov [wParam],0
jmp short StartSel
SelChars:
cmp ax, EM_SELCHARS
jne DoChar
StartSel:
;; a-emoryh - Don't screw ES_NOSELECT if in QHelp mode
test [cmdSwitches],CMD_SW_QHELP
jnz QHelpSkip3
and [emState], NOT ES_NOSELECT
QHelpSkip3:
mov ax,[wParam]
cmp ax,[ipCur.ip_oln]
je @F
cCall UpdateLine
cCall NoSelection
cCall RefreshLine,<[ipCur.ip_oln]>
; wParm == Line
; HIWORD(lParam) = start column
; LOWORD(lParam) = end column + 1
@@:
mov bx, [clnCur]
mov ax, [wParam]
cmp ax, bx
jbe SelChars1
xchg ax, bx
SelChars1:
mov [ipCur.ip_oln], ax
mov [ipAnchor.ip_oln], ax
;
; First make ipAnchor.ob visible.
; then make ipCur.ob visible.
; Note: DisplayCurPos makes ipCur.ob visible, so first set ipCur.ob
; to what ipAnchor.ob will be, then swap ipCur.ob and ipAnchor.ob
;
mov ax, [off_lParam]
mov [ipAnchor.ip_ob], ax
mov ax, [seg_lParam]
mov [ipCur.ip_ob], ax
cCall DisplayCurPos
mov ax, [ipCur.ip_ob]
xchg ax, [ipAnchor.ip_ob]
xchg ax, [ipCur.ip_ob]
cCall DisplayCurPos
inc [fRefreshScreen]
jmp ExitMainCase
;case WM_CHAR
DEBPUBLIC DoChar
DoChar:
cmp ax, WM_CHAR
jne VScroll
ifdef KANJI
cmp [fCharIsDbcs],0
jz CheckCharIsDbcs
inc [fCharIsDbcs]
jmp SHORT EndCharIsDbcs
CheckCharIsDbcs:
cCall FIsDbcsChar,<[wParam]>
mov [fCharIsDbcs],al
EndCharIsDbcs:
endif ; KANJI
mov ax,[seg_lParam]
mov bx,ax
ifndef MULTIPLE_ACTION
test ax,KK_ALT
jz NotMenu
mov [fOk],FALSE
jmp ExitMainCase
endif ; !MULTIPLE_ACTION
NotMenu:
and ax,KK_SHIFT
and bx,KK_CONTROL
mov dx,[wParam]
cmp dx,VK_MIN
jae CHAR_DoKey
cCall EditMgrDoChar,<dx,ax>
jmp ExitMainCase
CHAR_DoKey:
cCall EditMgrDoKey,<dx,ax,bx>
jmp ExitMainCase
;case WM_VSCROLL
VScroll:
cmp ax, WM_VSCROLL
jne HScroll
;Vertical Scroll case
;new case statement on wParam
mov ax,[wParam]
;case SB_LINEUP
VLineUp:
cmp ax, SB_LINEUP
jne VLineDown
cCall ScrollUp
jmp ExitVScrollCase
;case SB_LINEDOWN
VLineDown:
cmp ax, SB_LINEDOWN
jne VPageUp
cCall ScrollDown
jmp ExitVScrollCase
;case SB_PAGEUP
VPageUp:
cmp ax, SB_PAGEUP
jne VPageDown
cCall PageUp
jmp ExitVScrollCase
;case SB_PAGEDOWN
VPageDown:
cmp ax, SB_PAGEDOWN
jne VThumbPosition
cCall PageDown
jmp ExitVScrollCase
;case SB_THUMBPOSITION
VThumbPosition:
cmp ax, SB_THUMBPOSITION
jne DefaultVScrollCase
cCall UpdateLine
mov cx, [clnCur]
mov ax, word ptr [lParam]
cmp cx, ax ;is new position past end of file?
ja @F
mov ax, cx
jcxz @F
dec ax ;move line position within file range
@@:
mov pdCur.pd_olntop,ax
mov ipCur.ip_oln,ax
inc [fRefreshScreen]
ExitVScrollCase:
mov fResetAnchor,1
jmp ExitMainCase
DefaultVScrollCase:
jmp ExitEditMgr ;Must do this, otherwise we mess up tracking
;End Vertical Scroll inner case
; Line 256
$SC237:
HScroll:
;case WM_HSCROLL
cmp ax, WM_HSCROLL
je HScroll1
jmp LButtonDblClk
HScroll1: ;out of range!
;New case for Horizonal Scroll
;new case statement for (wParam)
mov ax,[wParam]
;case SB_LINEUP
HLineUp:
cmp ax, SB_LINEUP
jne HLineDown
mov ax,1
cCall PageLeft,<shiftWidth,ax>
; Line 260
jmp ExitHScrollCase
;case SB_LINEDOWN
HLineDown:
; Line 263
cmp ax, SB_LINEDOWN
jne HPageUp
mov ax,1
cCall PageRight,<shiftWidth,ax>
jmp ExitHScrollCase
;case SB_PAGEUP
HPageUp:
cmp ax, SB_PAGEUP
jne HPageDown
mov ax,1
cCall PageLeft,<[cColumnsCur],ax>
jmp ExitHScrollCase
;case SB_PAGEDOWN
HPageDown:
cmp ax, SB_PAGEDOWN
jne HThumbPosition
mov ax,1
cCall PageRight,<[cColumnsCur],ax>
jmp ExitHScrollCase
;case SB_THUMBPOSITION
HThumbPosition:
cmp ax, SB_THUMBPOSITION
jne DefaultHScrollCase
mov dx,ldCur.ld_cbMax ;dx = get cbMax (max line size)
sub dx,[cColumnsCur] ;dx = cbMax - cColumns
mov ax, word ptr [lParam] ;lParam (low word) new position
cmp ax, dx
jb HInRange ;new col. position out of range?
mov ax, dx
HInRange:
mov pdCur.pd_obleft,ax
mov ipCur.ip_ob,ax
inc [fRefreshScreen]
ExitHScrollCase:
mov fResetAnchor,1
jmp ExitMainCase
DefaultHScrollCase:
jmp ExitEditMgr ;Must do this, otherwise we mess up tracking
;End Horizonal Scroll inner case
;case WM_LBUTTONDBLCLK
LButtonDblClk:
cmp ax, WM_LBUTTONDBLCLK
jne LButtonDown
cCall GetCurLine
cCall obGetFirst ;ax = ob offset to first non-space char
mov bx,ipCur.ip_ob ;bx = column offset for insertion point
cmp bx, ax ;clicking to left of start of line
jbe Dbl1 ;ipCur.ob < ob
cCall FOnWord ;if at start of word, no need to move left
jz Dbl0
cCall FAfterWord
jz Dbl2
Dbl0:
cCall LeftToWordStart ;if not then move left one word
jmp Dbl2 ; this will adjust ipCur
Dbl1:
mov ipCur.ip_ob,ax ;assume ipCur.ob < ob
Dbl2:
;adjust anchor and ipcur to equal i.e. remove text selection
cCall ResetAnchor ;set ipAnchor to ip
cCall RightPastWordEnd ;select word
mov ax,ipAnchor.ip_oln ;
cmp ipCur.ip_oln,ax ;was it a multi-line selection?
je Dbl3 ;brif ipCur.oln == ipAnchor.oln
mov ipCur.ip_oln,ax
cCall GetCurLine
mov ax,ldCur.ld_cb ;ldCur.cb
mov ipCur.ip_ob,ax ;ipCur.ob set ip to end of line
Dbl3:
cCall DisplayCurPos
or [emState],EF_TRACKING_MOUSE OR EF_WORD_SELECTING OR EF_IN_WINDOW
cCall SetCapture,<[pwndEditCur]>
jmp ExitMainCase
;case WM_LBUTTONDOWN
LButtonDown:
cmp ax, WM_LBUTTONDOWN
je LButtonDown0
jmp LButtonUp
LButtonDown0:
mov [fGrabFocus],TRUE
;ptMouse.x and ptMouse.y in low word (lParam)
mov cx,word ptr [lParam]
mov al,cl ;ptMouse.x in low byte
cbw
or ax,ax ;Check if negative
jns @F ;If it is
xor ax,ax ; then clear value
@@:
mov dx,[cColumnsCur]
dec dx
cmp ax,dx ; See if ptMouse.x is out of range
jna @F ; If so
xchg ax,dx ; then ptMouse.x = cColumnsCur-1
@@:
mov [ptMouseX],ax ;ptMouse.x = rx
mov al,ch ;ptMouse.y in low byte
cbw
or ax,ax ;Check if negative
jns @F ;If it is
xor ax,ax ; then clear value
@@:
mov dx,[cLinesCur]
dec dx
cmp ax,dx ; See if ptMouse.y is out of range
jna @F ; If so
xchg ax,dx ; then ptMouse.y = cLinesCur-1
@@:
mov [ptMouseY],ax ;ptMouse.y = ry
add ax,pdCur.pd_olntop ;ptMouse.y + pdCur.olntop
mov bx, ax ;save as temp
mov ax,ipCur.ip_oln
cmp bx,ax ;olnT to ipCur.oln
je LButtonDown1 ;don't distroy undo unless need be
push bx
cCall UpdateLine
pop bx
mov ipCur.ip_oln,bx ;ipCur.oln = ptMouse.y + pdCur.olntop
LButtonDown1:
mov ax,[ptMouseX] ;ptMouse
add ax,pdCur.pd_obleft ;ptMouse.x + pdCur.obleft
mov bx, [ldCur.ld_cbMax]
cmp ax, bx
jb LButtonDown1a
xchg ax, bx ; really mov ax,bx
dec ax
LButtonDown1a:
mov ipCur.ip_ob,ax ;ipCur.ob
mov cx,ax ; save for later
mov ax, [clnCur]
or ax,ax
jz LButtonDown1c
cmp ax,ipCur.ip_oln ;check if of end of file
ja LButtonDown2 ;brif (file size) >= ipCur.oln
jne LButtonDown1b
jcxz LButtonDown1c
LButtonDown1b:
dec ax
LButtonDown1c:
mov ipCur.ip_oln,ax ;set to bottom of file is so
LButtonDown2:
mov al,0 ;prepare fResetAnchor=!(wParam&MK_SHIFT)
test byte ptr [wParam],MK_SHIFT;wParam test if shift key down
jne LButtonDown3
mov al,1
LButtonDown3:
mov fResetAnchor,al
mov al,[emState]
or al,EF_IN_WINDOW OR EF_TRACKING_MOUSE
and al,NOT EF_WORD_SELECTING
mov [emState],al
cCall SetCapture,<[pwndEditCur]>
jmp ExitMainCase
;case WM_LBUTTONUP
LButtonUp:
cmp ax, WM_LBUTTONUP
jne MouseMove
DoLButtonUp:
mov al,[emState]
test al,EF_TRACKING_MOUSE
jz LButtonUp1
and al,NOT EF_TRACKING_MOUSE
mov [emState],al
cCall ReleaseCapture
LButtonUp1:
jmp ExitMainCase
;case WM_ALARM
;case WM_MOUSEMOVE
MouseMove:
cmp ax, WM_MOUSEMOVE
je MouseMove1
cmp ax, WM_ALARM
je MouseMove1
jmp CheckGetWord
MouseMove1:
xor bx,bx
xor dx,dx
;ptMouse.x and ptMouse.y in low word (lParam)
mov cx,word ptr [lParam]
mov al,cl ;ptMouse.x in low byte
cbw
xchg dx,ax
mov [ptMouseX],dx ;ptMouse.x = rx
mov al,ch ;ptMouse.y in low byte
cbw
xchg bx,ax
mov [ptMouseY],bx ;ptMouse.y = ry
;fInWindow= (ptMouse.x>=0 && ptMouse.x<pwnd->cColumns
;&& ptMouse.y>=0 && ptMouse.y < pwnd->cLines)
;set flag if mouse motion within window
;dx = ptMouse.x, bx = ptMouse.y
mov al,[emState]
mov cx,[cColumnsCur];cx = pwnd->cColumns
cmp dx, 0 ;
jl OutOfWindow ;brif ptMouse.x < 0
cmp dx, cx
jge OutOfWindow ;brif ptMouse.x > pwnd->cColumns
mov cx, [cLinesCur] ;cx = pwnd->cLines
cmp bx, 0
jl OutOfWindow ;brif ptMouse.y < 0
cmp bx, cx
jge OutOfWindow ;brif ptMouse.y >= pwnd->cColumns
or al,EF_IN_WINDOW
jmp InWindow
OutOfWindow:
and al,NOT EF_IN_WINDOW
InWindow:
mov [emState],al
test al,EF_TRACKING_MOUSE
jnz InWindow1
mov [fOk],False
jmp ExitEditMgr ;brif if not tracking
InWindow1:
test [wParam], MK_LBUTTON
jz DoLButtonUp
test al,EF_IN_WINDOW
jz MouseMove9 ;brif if not in window
;we are both tracking and within window boundaries
;update insertion line position
;bx = ptMouse.y from above
add bx,pdCur.pd_olntop
mov ipCur.ip_oln,bx ;ipCur.oln = pdCur.oln + ptMouse.y
mov ax,[ptMouseX] ;ptMouse.x
add ax,pdCur.pd_obleft
mov ipCur.ip_ob,ax ;ipCur.ob = pdCur.obleft + ptMouse.x
mov cx,ax
mov ax, [clnCur]
or ax,ax
jz MM_3b
cmp ax,ipCur.ip_oln ;is new insertion point off file?
ja MouseMove4
jne MM_3a
jcxz MM_3b
MM_3a:
dec ax
MM_3b:
mov ipCur.ip_oln,ax
MouseMove4:
test [emState],EF_WORD_SELECTING
jz MouseMove8 ;brif not selecting a word
cCall GetCurLine
cCall FOnWord
jz MouseMove8
mov ax, [ipCur.ip_ob]
cmp ax, [ipAnchor.ip_ob]
je MouseMove8
jb MouseMove5
cCall RightPastWordEnd
jmp short MouseMove8
MouseMove5:
cCall FAfterWord
jz MouseMove8
cCall LeftToWordStart
MouseMove8:
cCall DisplayCurPos
jmp ExitMainCase
MouseMove9:
;check for scrolling
cmp [ptMouseX],0
jge NoLeftScroll ;brif ptMouse.x is not at left border
mov ax,1 ;scroll to left
cCall PageLeft,<shiftWidth,ax>
jmp CheckAlarm
NoLeftScroll:
;check for right border scroll
mov ax,[ptMouseX]
cmp [cColumnsCur],ax
ja NoRightScroll ;brif ptMouse.x is not to right border
mov ax,1
cCall PageRight,<shiftWidth,ax>
jmp CheckAlarm
NoRightScroll:
cmp [ptMouseY],0
jge NoUpScroll
;now check for top/bottom of window scroll
cCall LineUp
jmp CheckAlarm
NoUpScroll:
mov ax,[ptMouseY]
cmp [cLinesCur],ax
ja CheckAlarm
cCall LineDown
CheckAlarm:
mov ax,2
cCall SetAlarm,<[pwnd],ax>
; Line 385
jmp ExitMainCase
; case EM_GETWORD
CheckGetWord:
cmp ax, EM_GETWORD
jne NoMsgMatch
push word ptr [lParam+2]
push word ptr [lParam]
push [wParam]
cCall EMGetWord
mov [fOk],ax
jmp ExitEditMgr
NoMsgMatch:
mov [fOk],FALSE
ExitMainCase:
;end of EditMgr
ExitMainCase1:
cmp fResetAnchor,0
je $I284
;reset insertion point for no selection
cCall ResetAnchor ;set Anchor to ip (remove sel.)
$I284:
cCall HiliteSelection
ExitMainCase2:
cmp fRefreshScreen,0
je $I286
cCall RefreshScreen
$I286:
test [emState], ES_NOREDRAW
jz @F
J_DoneRedraw:
jmp DoneRedraw
@@:
cCall GetFocus
cmp ax,[pwndEditCur]
jne J_DoneRedraw
;In case cursor has been moved reset to correct position
ifdef KANJI
cCall DbcsAdjCursor
else ; !KANJI
mov ax,[ipCur.ip_ob]
endif ; KANJI
sub ax,[pdCur.pd_obleft]
mov cx,[ipCur.ip_oln]
sub cx,[pdCur.pd_olntop]
cCall MoveCursor,<[pwndEditCur],ax,cx>
sub di,di
mov si,pefCur
cmp [si].ef_pwndScrollV,di ;Do scroll if neccessary
je AdjustHorizontalScroll
mov ax,[clnCur]
or ax,ax
jnz @F
inc ax
@@:
cCall SetScrollRange,<[si].ef_pwndScrollV, di, ax, di>
mov dx,[ipCur.ip_oln]
cmp dx,[clnCur]
ja AdjustHorizontalScroll
mov ax,1
cCall SetScrollPos,<[si].ef_pwndScrollV, dx, ax>
AdjustHorizontalScroll:
cmp [si].ef_pwndScrollH,di ;Do scroll if necessary
je DoneRedraw
mov ax,[ldCur.ld_cbmax]
sub ax,[cColumnsCur]
jbe DoneRedraw
cCall SetScrollRange,<[si].ef_pwndScrollH, di, ax, di>
mov ax,1
cCall SetScrollPos,<[si].ef_pwndScrollH, [pdCur.pd_obleft], ax>
DoneRedraw:
mov bx,[pefCur]
mov al,[emState]
mov [bx].EF_Style,al
mov bx,ldCur.ld_cb
mov si,ldCur.ld_prgch
mov BYTE PTR [bx][si],0
; Reset values for edit field
mov bx,[pefCur]
mov ax,hBuffer
mov [bx].EF_hBuffer,ax
mov ax,ipCur.ip_ob
mov dx,ipCur.ip_oln
mov [bx].EF_ipCur.ip_ob,ax
mov [bx].EF_ipCur.ip_oln,dx
mov ax,ipAnchor.ip_ob
mov dx,ipAnchor.ip_oln
mov [bx].EF_ipAnchor.ip_ob,ax
mov [bx].EF_ipAnchor.ip_oln,dx
mov di,[bx].EF_pldCur
mov si,OFFSET DGROUP:ldCur
push ds
pop es
movsw
movsw
movsw
movsb
lea di,[bx].EF_pdCur
mov si,OFFSET DGROUP:pdCur.pd_olntop
push ds
pop es
movsw
movsw
movsw
;
; See if the cursor has moved.
;
mov ax,[ipCur.IP_oln]
cmp ax,[ipStart.IP_oln]
jne NotifyCursorMoved
mov ax,[ipCur.IP_ob]
cmp ax,[ipStart.IP_ob]
je NoCursorMove
NotifyCursorMoved:
mov bx, [pwndEditCur]
mov ax, [bx].pwndParent
or ax,ax
jz NoCursorMove
push ax
mov ax, WM_COMMAND
push ax
mov ax, EN_CURSORMOVED
push ax
mov ax, [bx].idWnd
push ax
push bx
cCall SendMessage
NoCursorMove:
ExitEditMgr:
and [emFlags],NOT EMF_IN_EDITMGR
;
; See if we want the focus
;
test [fGrabFocus],0ffH
jz NoGrabFocus
cCall SetFocus,<pwnd>
NoGrabFocus:
QuickExitEditMgr:
mov ax,[fOk]
xor dx,dx
cEnd
cProc EMRefreshCache,<NEAR>,<SI>
cBegin
mov si, [pefCur]
mov ax, [si].EF_hBuffer
mov [hBuffer], ax
cCall LinesInBuf,<ax>
mov [clnCur], ax
mov bx, [si].ef_pldCur
mov ax, [bx].ld_cbMax
mov [ldCur.ld_cbMax], ax
mov ax, [bx].ld_prgch
mov [ldCur.ld_prgch], ax
cEnd
ifdef EDIT_USE_TABLES
EDITFUNCTION macro a
iFn&a dw User_EditOFFSET a
endm
MainEditTable macro name
db (iFn&name - EditIndexTable)
endm
SecondEditTable macro ch,name
dw ch
db (iFn&name - EditIndexTable)
endm
KeyTableEntry macro key,name
dw key
db (iFn&name - EditIndexTable)
endm
else ; ! EDIT_USE_TABLES
EDITFUNCTION macro a
endm
MainEditTable macro name
dw User_EditOFFSET name
endm
SecondEditTable macro ch,name
db ch
dw User_EditOFFSET name
endm
KeyTableEntry macro key,name
dw key, User_EditOFFSET name
endm
endif ; EDIT_USE_TABLES
include editfuns.inc
ifdef EDIT_USE_TABLES
sEnd USER_EDIT
sBegin DATA
LabelW pEditTbls
pCharTable dw dataOFFSET DoCharDispatch
pPrefixTable dw dataOFFSET PrefixTable
pVkTable dw 0
pVkCtrlTable dw 0
StaticB DoCharDispatch,0,33 ;* Control characters + DEL
StaticW PrefixTable,0,32 ;* Control characters only
StaticW pDoVkDispatch,0 ;* Pointer to VkDispatch Table
GlobalB SzActionPrim,0,20 ;* Name of action key
GlobalB SzCancelPrim,0,20 ;* Name of cancel key
externW vkActionPrim
externW vkActionSec
externW vkCancelPrim
externW vkCancelSec
sEnd DATA
externFP PpvAllocCb ;* Local memory manager - (used incorrectly)
sBegin INIT
assumes CS,INIT
endif ; EDIT_USE_TABLES
include edittbls.inc
ifdef EDIT_USE_TABLES
LabelW pDefaultEditTbls
dw initOFFSET KeyDispatch, (CtrlKeyDispatch - KeyDispatch)
dw initOFFSET CtrlKeyDispatch, (pDefaultEditTbls - CtrlKeyDispatch)
dw initOFFSET CtrlQDispatch, (CtrlKDispatch - CtrlQDispatch)
dw initOFFSET CtrlKDispatch, (KeyDispatch - CtrlKDispatch)
dw 0,0
include editinit.asm
sEnd INIT
sBegin USER_EDIT
assumes CS,User_Edit
endif ; EDIT_USE_TABLES
cProc EditMgrDoChar,<NEAR,PUBLIC>
parmW wParam
parmW fShift
cBegin
mov ax,[wParam] ;wParam, ax = character code
mov dx,[fShift] ;* If shift is not down then we
or dx,dx ;* need to reset the anchor
jnz EMDC_NoResetAnchor ;* when we finish this character
mov [fResetAnchor],TRUE
EMDC_NoResetAnchor:
ifdef EDIT_USE_TABLES
else ; !EDIT_USE_TABLES
cmp al, '' ;* Hardcoded edit command -- Reset
je EMDC_ResetState
endif ; EDIT_USE_TABLES
jmp [EditMgrDoCharState] ;* Jump to controller for this state
EMDC_InitialState:
ifdef EDIT_USE_TABLES
cmp al, '' ;* Hard coded edit command --- DEL
je DoDel
cmp ax,' ' ;* Is character >= space?
jae DefaultEditMgrDoChar ;* Yes -- do the default action
mov bx,ax ;* No -- look up and do the
DoDel2:
add bx,pEditTbls[0] ;* Add offset of Table
mov bl,[bx] ;* Load the function index
xor bh,bh ;* Clear high end
call EditIndexTable[bx] ;* for this character
jmp ExitEditMgrDoChar
DoDel:
mov bx,32 ;* Last entry in table
jmp short DoDel2 ;* Normal dispatch now
else ; ! EDIT_USE_TABLES
cmp al, '' ;* Hard coded edit command --- DEL
je Do_DelRight
cmp al, '' ;* Hard coded edit command --- ESC
je DoEsc
cmp ax,'Z' - 'A' + 1
ja DefaultEditMgrDoChar
mov bx,ax
add bx,bx
call WORD PTR cs:DoCharDispatch[bx]
jmp ExitEditMgrDoChar
endif ; EDIT_USE_TABLES
ifdef EDIT_USE_TABLES
EMDC_SecondState:
mov bx, SecondDispatch
cCall DispatchAX
jmp short EMDC_ResetState
QuoteCharacter:
else ; !EDIT_USE_TABLES
EMDC_CtrlQState:
cmp al, '0'
jb EMDC_DispatchCtrlQ
cmp al, '3'
ja EMDC_DispatchCtrlQ
cCall GotoBookmark
jmp short EMDC_ResetState
EMDC_DispatchCtrlQ:
mov bx, User_EditOFFSET CtrlQDispatch
cCall DispatchAL
jmp short EMDC_ResetState
EMDC_CtrlKState:
cmp al, '0'
jb EMDC_ResetState
cmp al, '3'
ja EMDC_ResetState
cCall SetBookmark
jmp short EMDC_ResetState
EMDC_CtrlPState:
endif ; EDIT_USE_TABLES
cmp al, 0dH ; Carriage return?
je EMDC_Beep
cmp al, 0aH ; Line Feed?
je EMDC_Beep
or al,al ; Null?
je EMDC_Beep
DefaultEditMgrDoChar:
cCall InsertKey,<wParam>
ifndef EDIT_USE_TABLES
DoEsc:
endif ; EDIT_USE_TABLES
mov fResetAnchor,1
jmp short EMDC_ResetState
EMDC_Beep:
cCall NearBeep
jmp short EMDC_ResetState
ifndef EDIT_USE_TABLES
Do_DelRight:
cCall Del
endif ; EDIT_USE_TABLES
EMDC_ResetState:
cCall SetEMDC_InitialState
ExitEditMgrDoChar:
cEnd
ifdef EDIT_USE_TABLES
cProc ResetState,<NEAR>
cBegin
cCall SetEMDC_InitialState
cEnd
cProc DoEsc,<NEAR>
cBegin
mov fResetAnchor,1
cCall SetEMDC_InitialState
cEnd
cProc DoQuoteCharacter,<NEAR>
cBegin
mov ax,User_EditOFFSET QuoteCharacter ;* Routine to use on next
mov [EditMgrDoCharState],ax ;* character when recieved
cEnd
cProc DoPrefixTable,<NEAR>
cBegin
mov [chEditMgrState], al ;* Setup status line display
mov bx,ax ;* Move into an index register
shl bx,1 ;* Convert to byte offset
add bx,pPrefixTable ;* .. From the beginning of table
mov ax,[bx] ;* Load next dispatch table
mov [SecondDispatch],ax ;* And save it away
mov ax,User_EditOFFSET EMDC_SecondState ;* Secondary dispatch routine
mov [EditMgrDoCharState],ax ;*
cCall DrawToggles ;* Update status line
cEnd
cProc DoVkPrefixTable,<NEAR>
cBegin
mov bx,pDoVkDispatch ;* Set of dispatch tables
@@:
cmp word ptr [bx],0 ;* End of table?
je DVPT_01 ;* Yes - Fail
cmp ax,[bx] ;* Match?
je @F ;* Yes dispatch routine
add bx,4 ;* Move to next table entry
jmp short @B
@@:
mov [chEditMgrState], al ;* Setup status line display
mov ax,[bx] ;* Get Table Pointer
mov [SecondDispatch],ax ;* Load next dispatch table
mov ax,User_EditOFFSET EMDC_SecondState ;* Secondary dispatch routine
mov [EditMgrDoCharState],ax ;*
cCall DrawToggles ;* Update status line
DVPT_02:
cEnd
DVPT_01:
cCall NearBeep ;* Complain
jmp short DVPT_02 ;*
else ; !EDIT_USE_TABLES
cProc CtrlPState,<NEAR>
cBegin
ifndef KANJI
mov [chEditMgrState], al ;* Setup status line display
mov ax,User_EditOFFSET EMDC_CtrlPState ;* Secondary dispatch routine
mov [EditMgrDoCharState],ax ;*
cCall DrawToggles ;* Update status line
endif ; !KANJI
cEnd
cProc CtrlKState,<NEAR>
cBegin
mov [chEditMgrState], al
mov ax, User_EditOFFSET EMDC_CtrlKState
mov [EditMgrDoCharState], ax
cCall DrawToggles
cEnd
cProc CtrlQState,<NEAR>
cBegin
mov [chEditMgrState], al
mov ax, User_EditOFFSET EMDC_CtrlQState
mov [EditMgrDoCharState], ax
cCall DrawToggles
mov [fResetAnchor], 0
cEnd
endif ; EDIT_USE_TABLES
cProc GetEditMgrState,<FAR,PUBLIC>
cBegin
mov al, [chEditMgrState]
xor ah,ah
cEnd
cProc IgnoreChar,<NEAR>
cBegin
mov fResetAnchor,0
cCall SetEMDC_InitialState
cEnd
cProc SetEMDC_InitialState,<NEAR>
cBegin
xor al,al
mov [chEditMgrState], al
mov ax, User_EditOFFSET EMDC_InitialState
mov [EditMgrDoCharState], ax
cCall DrawToggles
cEnd
cProc DispatchFind,<NEAR>
cBegin
mov cx, WM_SEARCHFIND
jmp short SendParentMsg
cEnd <NOGEN>
cProc DispatchChange,<NEAR>
cBegin
mov cx, WM_SEARCHCHANGE
SendParentMsg:
xor ax,ax
SendParentMsgWithWParam:
xor dx,dx
mov bx, [pwndEditCur]
cCall PostMessage,<[bx.pwndParent], cx, ax, dx, dx>
mov [fResetAnchor], 0
cEnd
;*******************************************************************************
;SetBookmark - Set bookmark to current cursor position
;
;Purpose:
;Entry:
; AL - Which bookmark to set
; Ascii number '0' through '3'
;Exit:
;Uses:
;Exceptions:
;*******************************************************************************
ifdef EDIT_USE_TABLES
SetBookmark0:
mov al,'0'
jmp short SetBookmark
SetBookmark1:
mov al,'1'
jmp short SetBookmark
SetBookmark2:
mov al,'2'
jmp short SetBookmark
SetBookmark3:
mov al,'3'
; jmp short SetBookmark
endif ; EDIT_USE_TABLES
cProc SetBookmark,<NEAR>
cBegin
mov cx, WM_SETBOOKMARK
xor ah,ah
jmp short SendParentMsgWithWParam
cEnd <NOGEN>
;*******************************************************************************
;GotoBookmark - Moves cursor to previously set bookmark
;
;Purpose:
;Entry:
; AL - Which bookmark to goto
; Ascii number '0' through '3'
;Exit:
;Uses:
;Exceptions:
;*******************************************************************************
ifdef EDIT_USE_TABLES
GotoBookmark0:
mov al,'0'
jmp short GotoBookmark
GotoBookmark1:
mov al,'1'
jmp short GotoBookmark
GotoBookmark2:
mov al,'2'
jmp short GotoBookmark
GotoBookmark3:
mov al,'3'
; jmp short GotoBookmark
endif ; EDIT_USE_TABLES
cProc GotoBookmark,<NEAR>
cBegin
mov cx, WM_GOTOBOOKMARK
xor ah,ah
jmp short SendParentMsgWithWParam
cEnd <NOGEN>
ifdef EDIT_USE_TABLES
;*******************************************************************************
;SearchNext - Send a WM_SEARCHNEXT message to the parent window to continue
; a search previously started
;
;ENTRY
;Exit:
;Uses:
;Exceptions:
;*******************************************************************************
cProc SearchNext,<NEAR>
cBegin
mov cx,WM_SEARCHNEXT
xor ax,ax
jmp short SendParentMsgWithWParam
cEnd
;*******************************************************************************
;MatchBrace - Send a WM_MATCHBRACE message to the parent window
;
;ENTRY
;Exit:
;Uses:
;Exceptions:
;*******************************************************************************
cProc MatchBrace,<NEAR>
cBegin
mov cx,WM_MATCHBRACE
xor ax,ax
jmp short SendParentMsgWithWParam
cEnd
endif ; EDIT_USE_TABLES
;*******************************************************************************
;DispatchAX - Dispatch to a routine based on AX and table.
;
;Purpose:
;Entry:
; AX - Value to dispatch on
; DS:BX - points to table
; Table is word pairs (match, routine)
; All other registers are passed to the routine unchanged.
;Exit:
;Uses:
;Exceptions:
;*******************************************************************************
cProc DispatchAX,<NEAR,PUBLIC>
cBegin
TD_1:
ifdef EDIT_USE_TABLES
cmp word ptr [bx],0 ; End of table?
je TD_2 ; Yes - Dispatch default routine
cmp ax, [bx] ; Match?
je TD_2 ; Yes - Dispatch routine.
add bx, 3 ; Move to next table entry
jmp short TD_1
else ; !EDIT_USE_TABLES
cmp word ptr cs:[bx],0 ; End of table?
je TD_2 ; Yes - Dispatch default routine
cmp ax, cs:[bx] ; Match?
je TD_2 ; Yes - Dispatch routine.
add bx, 4 ; Move to next table entry
jmp short TD_1
endif ; EDIT_USE_TABLES
TD_2:
ifdef EDIT_USE_TABLES
mov bl,BYTE PTR [bx+2] ;* Get Function Index
xor bh,bh ;* Clear hi byte
call EditIndexTable[bx] ;* Call function
else ; !EDIT_USE_TABLES
call cs:[bx+2]
endif ; EDIT_USE_TABLES
cEnd
ifndef EDIT_USE_TABLES
;*******************************************************************************
;DispatchAL - Dispatch to a routine based on AL and table.
;
;Purpose:
;Entry:
; AL - Value to dispatch on
; CS:BX - points to table
; Table is word pairs (match, routine)
; All other registers are passed to the routine unchanged.
;Exit:
;Uses:
;Exceptions:
;*******************************************************************************
cProc DispatchAL,<NEAR,PUBLIC>
cBegin
DAL_1:
cmp byte ptr cs:[bx],0 ; End of table?
je DAL_2 ; Yes - Dispatch default routine
cmp al, cs:[bx] ; Match?
je DAL_2 ; Yes - Dispatch routine.
add bx, 3 ; Move to next table entry
jmp short DAL_1
DAL_2:
call cs:[bx+1]
cEnd
endif ; !EDIT_USE_TABLES
cProc EditMgrDoKey,<NEAR,PUBLIC>
parmW wParam
parmW fShift
parmW fCtrlKey
cBegin
mov dx,[fShift]
or dx,dx
jnz DoKeyNoResetAnchor
mov [fResetAnchor],TRUE
DoKeyNoResetAnchor:
ifdef EDIT_USE_TABLES
mov bx, 0 ; Assume Ctrl not down
cmp [fCtrlKey],0
je DoKeyNoCtrl ;brif control key is not down
add bx, 2 ;If Control Key down!
DoKeyNoCtrl:
mov bx,pVkTable[bx]
else ; !EDIT_USE_TABLES
mov bx, User_EditOFFSET KeyDispatch ; Assume Ctrl not down
cmp [fCtrlKey],0
je DoKeyDispatch ;brif control key is not down
mov bx, User_EditOFFSET CtrlKeyDispatch ;If Control Key down!
DoKeyDispatch:
endif ; EDIT_USE_TABLES
push bx ;?????
mov cx, [cColumnsCur]
pop bx ;?????
mov ax, [wParam]
cCall DispatchAX
ExitEditMgrDoKey:
cEnd
cProc IgnoreKey,<NEAR>
cBegin
mov [fResetAnchor], 0
mov [fOk],FALSE
cEnd
cProc FullPageLeft,<NEAR>
cBegin
mov ax, 1
cCall PageLeft,<cx,ax>
cEnd
cProc FullPageRight,<NEAR>
cBegin
mov ax, 1
cCall PageRight,<cx,ax>
cEnd
;*******************************************************************************
;_HiliteSelection
;
;Purpose:
; The current selection region defined by the delta for ipCur and
; ipAnchor is rewritten to reflect and changes since entering the
; EditMgr. The initial setting is in ipCurStart and ipAnchorStart.
;Entry:
; ipCur - Current insertion point
; ipAnchor - End of selection region if any
; pefCur.ef_fSelection - flag if selection is know to be active
; ?? under what conditions can this be false a selection is present
;Exit:
; pefCur.ef_fSelection set to selection state.
;Uses:
; cl - fSelection - selection flag at start of call
; ax, dx, cx
;Exceptions:
; none
;
;*******************************************************************************
cProc HiliteSelection,<NEAR,PUBLIC>
cBegin
mov bx,pefCur
mov cl,[bx.ef_fSelection]
mov ax, ipCur.ip_oln ;check for any current selection
mov dx, ipCur.ip_ob
xor ax, ipAnchor.ip_oln
xor dx, ipAnchor.ip_ob
or ax, dx
or al, ah
;al = state of current selection (ef_fSelection)
;bx = pefCur
;cl = state of selection to start with
mov [bx.ef_fSelection],al ;note state of selection
or al, cl
jz Hilite16 ; There was no selection, and there
; is no selection so do nothing
;Here if either fWasSelection or current have a selection
Hilite8:
;Check if our current position has moved from the starting position
mov ax, ipStart.ip_oln
mov cx, ipCur.ip_ob
cmp ipCur.ip_oln, ax
jne Hilite10 ;brif move off of starting line
cmp ipStart.ip_ob, cx
je Hilite12 ;brif have not moved off start offset
;Here if current position is not the same as the starting position
Hilite10:
cCall RefreshLines,<ax,ipCur.ip_oln>
;Here if have selection but the start and current points were equal
Hilite12:
mov ax, ipAnchorStart.ip_oln
mov cx, ipAnchor.ip_ob
cmp ipAnchor.ip_oln,ax
jne Hilite14 ;brif Anchor has moved
cmp ipAnchorStart.ip_ob, cx
je Hilite16 ;brif Anchor has not moved
;Here if Anchor has moved from it's starting position
Hilite14:
cCall RefreshSelection
Hilite16:
cEnd
cProc RefreshSelection,<NEAR,PUBLIC>
cBegin
cCall RefreshLines,<[ipAnchorStart.ip_oln],[ipStart.ip_oln]>
cEnd
;*******************************************************************************
;_NoSelection
;
;Purpose:
; Removes any selection present on screen and resets ipAnchor to ipCu
;Entry:
; ipCur
; ipAnchor
;Exit:
; ipAnchor set to ipCur
;Uses:
; none.
;Exceptions:
; none
;*******************************************************************************
cProc NoSelection,<NEAR,PUBLIC>
cBegin
cCall ResetAnchor
cCall HiliteSelection
cEnd
;*******************************************************************************
;_BuildSelection
;
;Purpose:
; Takes the current selection region defined by ipAnchor and ipCur and
; returns an ordered pair of positions (ob, oln) that defines the
; current selected region.
;Entry:
; Parameters
; polnFirst - pointer to lowest oln for selected region
; pobFirst - pointer to left most ob for selected region
; polnLast - pointer to highest oln
; pobLast - pointer to right most ob
;
; register di = polnLast
; register si = polnFirst
;
;Exit:
;
;Uses:
; ax, bx, cx, dx, si, di
;Exceptions:
; none
;*******************************************************************************
cProc BuildSelection,<NEAR,PUBLIC>,<SI,DI>
parmDP polnFirst
parmDP pobFirst
parmDP polnLast
parmDP pobLast
cBegin
;assume multi-line selection
mov ax,[ipCur.ip_oln]
mov bx,[ipCur.ip_ob]
mov cx,[ipAnchor.ip_oln]
mov dx,[ipAnchor.ip_ob]
cmp ax, cx ;check if multiline
jne BuildSel10
;Single line case
cmp bx, dx
jb BuildAssign ;brif ip < anchor
xchg bx, dx ;reverse ob's
jmp SHORT BuildAssign
;Here for multi-line case (ip.oln <> anchor.oln)
BuildSel10:
cmp ax, cx
jb BuildAssign ;brif ip < anchor
xchg ax, cx
xchg bx, dx
BuildAssign:
mov si,[pobFirst]
mov di,[pobLast]
mov [si],bx
mov [di],dx
mov si,[polnFirst]
mov di,[polnLast]
mov [si],ax
mov [di],cx
;Check that selection is not off end of file
mov ax, [clnCur] ;ax = last line number in file
mov bx, [si] ;bx = olnFirst
mov cx, [di] ;cx = olnLast
cmp bx, ax
jbe BuildSel20 ;brif first <= end of file
mov [si], ax ;set first to end of file
BuildSel20:
cmp cx, ax
jbe BuildSel22 ;brif last <= end of file
mov [di], ax
BuildSel22:
xor dx, dx
cmp cx, ax
jne BuildSel24 ;brif last <> end of file
mov di, [pobFirst]
mov [di], dx ;at bottom make start of sel. at 0
BuildSel24:
cmp bx, ax
jne BuildSel26 ;brif first <> end of file
mov si, [pobLast]
mov [si], dx
BuildSel26:
cEnd
;*******************************************************************************
;fCheckReadOnly
;
;Purpose:
; Check if the buffer is read only, and sound alarm if it is
;Entry:
;Exit:
; Returns TRUE if the buffer is read only.
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc fCheckReadOnly,<NEAR,PUBLIC>
cBegin
xor ax,ax
test [emState], ES_MULTILINE
jz ExitCheckRO ; return FALSE
cCall fReadOnlyBuf,<[hBuffer]>
or ax,ax
jz ExitCheckRO ; return FALSE
push ax
cCall NearBeep
pop ax
ExitCheckRO:
or ax,ax
cEnd
;*******************************************************************************
;_ModifyLine
;
;Purpose:
; Fetch the current line at ipCur.oln into the line descripter ldCur.
; Mark the line in ldCur as dirty. This will cause UpdateLine
; to replace the line in the buffer when called.
;Entry:
; ldCur
;Exit:
; ldCur.ld_fDirty - set to TRUE
;Uses:
; none.
;Exceptions:
;
;*******************************************************************************
cProc ModifyLine,<NEAR,PUBLIC>
cBegin
cCall GetCurLine
cCall fCheckReadOnly
jz DoModifyLine
xor ax,ax
jmp SHORT ExitModifyLine
DoModifyLine:
or [ldCur.ld_flags],LD_fDirty
inc ax
ExitModifyLine:
cEnd
;*******************************************************************************
;cbGetLine
;
;Purpose:
; Same as cbGetLineBuf followed by EMRefreshCache
;Entry:
;Exit:
;Uses:
;Exceptions:
;*******************************************************************************
cProc cbGetLine,<NEAR,PUBLIC>
parmW oln
parmW cbMax
parmDP prgch
cBegin
cCall cbGetLineBuf,<[hBuffer], [oln], [cbMax], [prgch]>
push ax ; save return value
cCall EMRefreshCache
pop ax ; restore return value
cEnd
;*******************************************************************************
;_GetLine
;
;Purpose:
; Get the specified line offset (ipCur.oln) into ldCur. If it is already
; in ldCur then do nothing. If in multi-line mode then don't get anything
;Entry:
; fMultiline - flag if in multi-line or single-line mode
; pdCur.oln - line offset currently in ldCur
; pefCur.ef_fFocus - flag if edit field has focus
; hBuffer - handle to source buffer
;Exit:
; ldCur
;Uses:
; oln - line offset to fetch
; register si - oln
; bx
;Exceptions:
; none
;*******************************************************************************
cProc GetLine,<NEAR,PUBLIC>,<SI>
parmW oln
cBegin
mov si,[oln] ;oln
test [emState], ES_MULTILINE ;If not multi-line nothing to get
jz $I405 ;brif not multi-line
mov ax,si ;si - oln (line to get)
cmp ax,pdCur.pd_oln ;check line already in ldCur
jne $I406 ;brif if line no current line
cCall GetFocus ; Current Focus in ax
cmp ax,[pwndEditCur]
je $I405 ;brif we do have focus
$I406:
cCall UpdateLine ;make sure current line is back is src.
mov ax, [clnCur]
cmp ax,si ;si - current line
jne $I407 ;brif not at end of file
cCall fCheckReadOnly ;if read only
jnz $I405 ; then don't insert line
;for get at end of file (1 past last line) we insert a blank line
;so that a new line is added to end of file
sub ax,ax
cCall InsertLineBuf,<hBuffer,si,ax,ldCur.ld_prgch>
cCall EMRefreshCache
mov ldCur.ld_cb,0 ;make line is zero width
;Here if line is not 1 past last line or eof
$I407:
cCall cbGetLine,<si,ldCur.ld_cbMax,ldCur.ld_prgch>
mov ldCur.ld_cb,ax
;Here after either inserting line or get line
$I408:
mov pdCur.pd_oln,si ;make it official line in ldCur
$I405:
cEnd
;*******************************************************************************
;_GetCurLine
;
;Purpose:
; Fetch the current line offset (ipCur.oln) into ldCur.
; Same as GetLine but line offset is not specified.
;Entry:
; ipCur
;Exit:
; ldCur
;Uses:
; none.
;Exceptions:
; none
;*******************************************************************************
cProc GetCurLine,<NEAR>
cBegin
cCall GetLine,<ipCur.ip_oln>
cEnd
;*******************************************************************************
;GetLineScratch
;
;Purpose:
; Like GetLine, but into ldEMScratch
;Entry:
; oln
;Exit:
; ldEMScratch
;Uses:
;Exceptions:
;*******************************************************************************
cProc GetLineScratch,<NEAR>
parmW oln
cBegin
xor ax, ax
mov [ldEMScratch.LD_cb],ax
mov ax, [oln]
cmp ax, [clnCur]
ja GLS_Exit
test [emState], ES_MULTILINE
jz GLS1
test [ldCur.ld_flags], LD_fDirty
jz GLS2
cmp ax, [pdCur.pd_oln]
jne GLS2
GLS1:
mov ax, [ldCur.ld_cb]
mov [ldEMScratch.ld_cb], ax
inc ax
ifdef PROJECT_QB
push [ldCur.ld_prgch]
push [ldEMScratch.ld_prgch]
push ax
call bltbyte ; pascal Calling convention
else ;PROJECT_QB
push ax
push [ldCur.ld_prgch]
push [ldEMScratch.ld_prgch]
call _memmove ; C Calling convention
add sp, 6
endif ;PROJECT_QB
mov ax, [ldCur.ld_flags]
mov [ldEMScratch.ld_flags], ax
jmp short GLS_Exit
GLS2:
xor bx, bx
cmp ax, [clnCur]
xchg ax,bx
jae GLS3
cCall cbGetLine,<bx,[ldEMScratch.ld_cbMax],[ldEMScratch.ld_prgch]>
GLS3:
mov [ldEMScratch.ld_cb], ax
xor ax,ax
mov [ldEMScratch.ld_flags],ax
GLS_Exit:
cEnd
cProc GetLineScratchPad,<NEAR>
parmW oln
cBegin
cCall GetLineScratch,<[oln]>
;
; Pad line with spaces
;
mov ax,[ldEMScratch.LD_cbMax]
sub ax,[ldEMScratch.LD_cb]
push ax
mov ax,' '
push ax
mov ax,[ldEMScratch.LD_cb]
add ax,[ldEMScratch.LD_prgch]
push ax
call _memset
add sp,6
cEnd
;*******************************************************************************
;_UpdateLine
;
;Purpose:
; Use ldCur to replace the current buffer line. The line offset is
; in pdCur.oln. Line is only replace if ldCur is marked as Dirty.
; If out of memory to replace line old line is refetched and update
; fails. Text manager will report error.
;Entry:
; ldCur
; pdCur
; hBuffer
;Exit:
; none
;Uses:
; ax
;Exceptions:
; none
;*******************************************************************************
cProc UpdateLine,<NEAR,PUBLIC>
cBegin
mov ax, 1
push ax ; Default Return value of TRUE
test ldCur.ld_flags,ld_fDirty
je $I413 ;brif current line not modified
mov ax, [clnCur]
cmp ax,pdCur.pd_oln ;only happens for out of memory
jbe $I413 ;brif if current ld past eof
pop ax ; Throw away default return value
and ldCur.ld_flags, not ld_fDirty ;current line no longer dirty
cCall ReplaceLineBuf,<hBuffer,pdCur.pd_oln,ldCur.ld_cb,ldCur.ld_prgch>
push ax ; Save return value
cCall EMRefreshCache
mov ax,-1
xchg ax,[pdCur.PD_oln]
cCall RefreshLine,<ax>
mov [pdCur.pd_oln], -1
$I413:
pop ax ; restore return value.
or ax,ax
cEnd
cProc MaybeToggleInsertMode,<NEAR>
cBegin
or dl,dl
jnz MTIM_Exit
cCall ToggleInsertMode
MTIM_Exit:
cEnd
cProc ToggleInsertMode,<NEAR>
cBegin
xor ax,ax
xor cx,cx
mov [fResetAnchor],al
inc ax
mov cl,[fInsertMode]
xor ax,cx
mov [fInsertMode],al
cCall SetCursorBlock,<cx>
cEnd
;*******************************************************************************
; JoinLine - merge two consecative lines
; Description:
; Merge lines at ip and previous line. The current line is copied into
; a temperary buffer. The previous line is fetched. A check is made to
; see if the current line ipCur.oln and the previous line will fit into
; a single buffer (ldCur.cbMax). If so then the temperary buffer is copied
; into ldCur.prgch after the previous line. The current line is then
; deleted.
;
; Checks are made to see if any special updating is needed such as
; paging left or right.
;
; Should be called when backspace at start of line.
;
; Input:
; fBelow - TRUE Join ipCur.oln with ipCur.oln + 1
; FALSE Join ipCur.oln with ipCur.oln - 1;
; Output:
;
;*******************************************************************************
cProc JoinLine,<NEAR,PUBLIC>,<SI,DI>
parmB fBelow
localW saveIpOln
localW saveIpOb
cBegin
test [emState], ES_MULTILINE
jnz JL2
JL1:
cCall NearBeep
J_JL_Exit:
jmp JL_Exit
JL2:
cCall fCheckReadOnly
jnz J_JL_Exit
;
; Save ipCur in case we have to restore it.
;
mov ax,[ipCur.IP_oln]
mov [saveIpOln],ax
mov ax,[ipCur.IP_ob]
mov [saveIpOb],ax
;
; Get the top line into ldCur
; Get the bottom line into ldEMScratch.
; Warning: Be very carefull here. ldCur.fDirty may be true
; but we don't want to update the current line yet.
;
cCall GetCurLine
cmp [fBelow],0 ;fBelow
je JL3
mov ax,[ipCur.IP_oln]
inc ax
cCall GetLineScratch,<ax>
mov ax, [ldEMScratch.ld_cb]
inc ax ; error if ldEMScratch.cb == -1
jnz JL4
jmp SHORT JL1
JL3:
ifdef PROJECT_QB
push [ldCur.LD_prgch]
push [ldEMScratch.LD_prgch]
push [ldCur.LD_cb]
call bltbyte ; pascal Calling convention
else ;PROJECT_QB
push [ldCur.LD_cb]
push [ldCur.LD_prgch]
push [ldEMScratch.LD_prgch]
call _memmove
add sp,6
endif ;PROJECT_QB
mov ax,[ldCur.LD_cb]
mov [ldEMScratch.LD_cb],ax
dec [ipCur.IP_oln]
cCall cbGetLine,<ipCur.ip_oln,ldCur.ld_cbMax,ldCur.ld_prgch>
mov [ldCur.LD_cb],ax
JL4:
;
; Pad the top line to the cursor position.
;
mov ax, [ipCur.IP_ob]
sub ax, [ldCur.LD_cb]
jbe JL4a
push ax ; cb - for memset
mov ax, ' '
push ax ; ch - for memset
mov ax, [ldCur.LD_prgch]
add ax, [ldCur.LD_cb]
push ax ; pb - for memset
call _memset ; C calling convention
add sp, 6
mov ax, [ipCur.IP_ob]
mov [ldCur.LD_cb], ax
JL4a:
;
; Move ip to end of the top line.
;
mov ax,[ldCur.LD_cb]
mov [ipCur.IP_ob],ax
;
; Get rid of leading spaces in the bottom line.
;
; UNDONE - This can be optimised with scasb
mov si,[ldEMScratch.LD_cb]
sub di,di
mov bx,[ldEMScratch.LD_prgch]
JL5:
or si,si
jz JL6
cmp BYTE PTR [bx][di],' '
jne JL6
inc di
dec si
jmp short JL5
JL6:
;
; Check if both lines will fit on the max line
;
mov ax,si
add ax,[ldCur.LD_cb]
mov cx,[ldCur.LD_cbMax]
dec cx
cmp ax,cx
jbe JL8
;
; If fBelow then restore ldCur from ldEMScratch
;
cmp [fBelow],0
jne JL7
ifdef PROJECT_QB
push [ldEMScratch.LD_prgch]
push [ldCur.LD_prgch]
push [ldEMScratch.LD_cb]
call bltbyte ; pascal Calling convention
else ;PROJECT_QB
push [ldEMScratch.LD_cb]
push [ldEMScratch.LD_prgch]
push [ldCur.LD_prgch]
call _memmove
add sp,6
endif ;PROJECT_QB
mov ax,[ldEMScratch.LD_cb]
mov [ldCur.LD_cb],ax
JL7:
;
; Restore ipCur
;
mov ax,[saveIpOln]
mov [ipCur.IP_oln],ax
mov ax,[saveIpOb]
mov [ipCur.IP_ob],ax
jmp JL1
;
; Append the bottom line to the top line.
;
JL8:
or si,si
je JL9
ifdef PROJECT_QB
mov ax,[ldEMScratch.LD_prgch]
add ax,di
push ax
mov ax,[ldCur.LD_cb]
add ax,[ldCur.LD_prgch]
push ax
push si
call bltbyte ; pascal Calling convention
else ;PROJECT_QB
push si
mov ax,[ldEMScratch.LD_prgch]
add ax,di
push ax
mov ax,[ldCur.LD_cb]
add ax,[ldCur.LD_prgch]
push ax
call _memmove
add sp,6
endif ;PROJECT_QB
JL9:
add [ldCur.LD_cb],si
cCall StartBigEdit
mov ax,2
cCall DeleteLinesBuf,<hBuffer,ipCur.ip_oln,ax>
cCall EMRefreshCache
cCall InsertLineBuf,<hBuffer,ipCur.ip_oln,ldCur.ld_cb,ldCur.ld_prgch>
cCall EMRefreshCache
and [ldCur.ld_flags], not ld_fDirty
mov [pdCur.PD_oln],-1
cCall EndBigEdit
cCall EMRefreshCache
;
; Determine what has to be redrawn
;
cCall NoSelection
JL10:
cCall DisplayCurPos
JL11:
cmp fRefreshScreen,0
jne JL_Exit
mov ax,-1
cCall RefreshLines,<ipCur.ip_oln,ax>
JL_Exit:
cEnd
;*******************************************************************************
; DoNewLine - Create a new line
; Description:
; Create a new line of text at ip and display. The current line is
; terminated at ipCur.ob. If ipCur.ob is past the end of the line
; the line is spaced filled out to ipCur.ob. If their was remaining
; text on the line such as for a line split the truncated line is
; inserted for the current line and a new line created consisting
; of the remaining fragment.
;
; Should be called on carriage return.
; Input:
;
;
; Output:
;
;*******************************************************************************
cProc DoNewLine,<NEAR,PUBLIC>,<SI>
parmB fMoveCursor
localW obFirst
localW obSave
localW olnSave
cBegin
cCall fCheckReadOnly
jnz J_NL_Exit
test [emState], ES_MULTILINE
jnz NL0
NL_Beep:
cCall NearBeep
J_NL_EXIT:
jmp NL_Exit
NL0:
mov ax, [ipCur.ip_ob] ; Save current ip in case
mov [obSave], ax ; it must be restored.
mov ax, [ipCur.ip_oln]
mov [olnSave], ax
cCall NoSelection
cCall ModifyLine
jz J_NL_Exit
mov ax,[ldCur.LD_cb]
cmp [ipCur.IP_ob],ax
jb NL1
push ax ; Save ldCur.ld_cb
cCall InsertLineBelow
pop cx ; Restore ldCur.ld_cb
jz NL_Beep
test [fMoveCursor], 0ffH
jz J_NL10
jcxz NL_0a ; Don't change ob for blank lines
cCall AutoIndent
NL_0a:
inc [ipCur.ip_oln]
if 1
jmp NL5a
else
cCall AdjustAfterInsertLine
jmp NL_Exit
endif
J_NL10:
jmp NL10
;
; Scan for first non-space
; UNDONE - optimise with scasb
;
NL1:
mov bx,[ipCur.IP_ob]
mov si,[ldCur.LD_prgch]
NL2:
cmp bx,[ldCur.LD_cb]
jnb NL3
cmp BYTE PTR [bx][si],' '
jne NL3
inc bx
jmp NL2
NL3:
mov [ipCur.IP_ob],bx
;
; Save start of line for autoindent
;
cCall obGetFirst
mov [obFirst],ax
cCall StartBigEdit
;
; Delete (logically - not really) to end of line.
;
; Warning: ReplaceLineBuf MUST not tamper with ldCur.prgch
;
cCall ReplaceLineBuf,<hBuffer,pdCur.pd_oln,ipCur.ip_ob,ldCur.ld_prgch>
cCall EMRefreshCache
;
; Delete (really) from begining of line to cursor
;
cmp [ipCur.IP_ob],0
je NL4
mov ax,[ipCur.IP_ob]
cCall DelCh,<ax,ax>
;
; Auto indent.
;
NL4:
mov [ipCur.IP_ob],0
cmp [obFirst],0
je NL5
mov ax, ' '
cCall InsCh,<obFirst,ax, ax> ; InsCh( obFirst, ' ', TRUE );
NL5:
mov ax,[obFirst]
mov [ipCur.IP_ob],ax
inc [ipCur.IP_oln]
cCall InsertLineBuf,<hBuffer,ipCur.ip_oln,ldCur.ld_cb,ldCur.ld_prgch>
cCall EMRefreshCache
and [ldCur.ld_flags], not ld_fDirty
mov [pdCur.PD_oln],-1
cCall EndBigEdit
cCall EMRefreshCache
test [fMoveCursor], 0ffH
jnz NL5a
mov ax, [obSave]
mov [ipCur.ip_ob], ax
mov ax, [olnSave]
mov [ipCur.ip_oln], ax
jmp short NL10
NL5a:
;
; Ok - Now let's see what has to be redrawn
;
mov ax,[cLinesCur]
add ax,[pdCur.PD_olnTop]
cmp ax,[ipCur.IP_oln]
ja NL7
inc [pdCur.PD_olnTop]
cCall DisplayCurPos
NL6:
inc [fRefreshScreen]
jmp short NL_Exit
NL7:
mov ax,[pdCur.PD_obLeft]
cmp [ipCur.IP_ob],ax
jge NL10
mov ax,[ipCur.IP_ob]
mov [pdCur.PD_obLeft],ax
mov ax,[cColumnsCur]
shr ax,1
cmp ax,[pdCur.PD_obLeft]
jbe NL9
NL8:
mov [pdCur.PD_obLeft],0
jmp SHORT NL6
NL9:
cmp [pdCur.PD_obLeft],5
jle NL8
sub [pdCur.PD_obLeft],5
jmp SHORT NL6
NL10:
mov bx,-1
mov cx,[ipCur.IP_oln]
jcxz NL11
dec cx
NL11:
cCall RefreshLines,<cx,bx>
NL_Exit:
mov [fResetAnchor], 1
cEnd
cProc NewLine,<NEAR,PUBLIC>
cBegin
mov ax, 1
cCall DoNewLine,<ax>
cEnd
cProc SplitLine,<NEAR,PUBLIC>
cBegin
xor ax,ax
cCall DoNewLine,<ax>
cEnd
cProc NextLine,<NEAR,PUBLIC>
cBegin
cCall LineDown
cCall GetCurLine
mov ax, [ldCur.ld_cb]
or ax,ax
je NxL_1
cCall HomeLine
jmp short NxL_Exit
NxL_1:
mov [ipCur.ip_ob], -1
cCall obGetPrev
mov [ipCur.ip_ob], ax
cCall DisplayCurPos
NxL_Exit:
cEnd
cProc BegLine,<NEAR>
cBegin
mov [ipCur.ip_ob], 0
cCall DisplayCurPos
cEnd
;*******************************************************************************
;_InsertLineBelow
;
;Purpose:
; Insert a blank line in the text buffer.
;Entry:
; ldCur
; ipCur
; pdCur
; hBuffer
;Exit:
; none
;Uses:
;Exceptions:
;*******************************************************************************
cProc InsertLineBelow,<NEAR,PUBLIC>,<SI,DI>
cBegin
cCall fCheckReadOnly
mov al, 0 ; mov does NOT affect flags
jnz ExitInsertLineBelow
cCall UpdateLine ;make sure current line is in text buf.
mov al, 1 ; Return TRUE even if above failed.
jz ExitInsertLineBelow
cCall NoSelection ;turn off any selected region
mov [ldCur.ld_cb],0 ;make blank line
mov [pdCur.PD_oln],-1 ;
mov ax, [ipCur.ip_oln]
inc ax
cCall InsertLineBuf,<hBuffer,ax,ldCur.ld_cb,ldCur.ld_prgch>
push ax ; Save until after this call
cCall EMRefreshCache
pop ax ; restore result of InsertLineBuf
ExitInsertLineBelow:
or al,al ; Return Z or NZ.
cEnd
cProc AdjustAfterInsertLine,<NEAR>
cBegin
mov ax, [ipCur.ip_ob]
mov bx, [pdCur.pd_obleft]
cmp ax, bx
jae AAIL_1
mov [ipCur.ip_ob], bx
AAIL_1:
mov ax,[cLinesCur] ;pwndEditCur.cLines (lines on screen)
add ax,[pdCur.pd_olntop] ;set olnBottom 1 above last line on
dec ax ;screen di - olnBottom
cmp [ipCur.ip_oln],ax ;ax - olnBottom
jbe AAIL_2 ;brif ip is above bottom
inc [pdCur.pd_olntop] ;move top of screen up 1 line
inc [fRefreshScreen]
jmp SHORT AAIL_Exit
AAIL_2:
mov bx,[ipCur.IP_oln]
dec bx
cCall RefreshLines,<bx,ax>
AAIL_Exit:
cEnd
cProc InsertLine,<NEAR,PUBLIC>
cBegin
test [emState], ES_MULTILINE
jnz IL_1
IL_Beep:
cCall NearBeep
jmp IL_Exit
IL_1:
cCall InsertLineBelow
jz IL_Beep
cCall GetCurLine
mov cx, [ldCur.ld_cb]
jcxz IL_2
cCall AutoIndent
inc [ipCur.ip_oln]
IL_2:
cCall AdjustAfterInsertLine
IL_Exit:
cEnd
;*******************************************************************************
;_KillLine
;
;Purpose:
; Delete the current line from the text buffer. The current line is
; first selected and the a distructive cut is done.
;Entry:
; fMultiLine
; hBuffer
; pefCur.ef_fSelection
; ipCur
;Exit:
; ldCur
;Uses:
; none.
;Exceptions:
; none
;*******************************************************************************
cProc KillLine,<NEAR,PUBLIC>
cBegin
test [emState], ES_MULTILINE ;don't delete line if only single line
jz $I471 ;brif not multiline
;also don't delete if last line in text
mov ax, [clnCur] ;buffer
cmp ax,ipCur.ip_oln
jne $I470 ;brif ip not last line in text buffer
;Here if not ok to delete line
$I471:
cCall NearBeep ;warn user
jmp SHORT $EX469 ;return
;Here if ok to delete line
$I470:
cCall fCheckReadOnly
jnz $EX469
cCall StartBigEdit ; Don't parse the dirty line
cCall UpdateLine
cCall EndBigEdit
cCall EMRefreshCache
cCall NoSelection ;remove any selection
inc ipCur.ip_oln ;Delete by forcing full selection
mov ipCur.ip_ob,0 ;of line. ipAnchor is still at old spot
cCall HiliteSelection ;hilite whole line
mov bx,pefCur ;set flag that we do have selection
mov [bx].ef_fSelection,TRUE
mov ax,TRUE
cCall Cut,<ax> ;do cut. This will force old line
;into scrap for later recovery
cCall DisplayCurPos ;recal. ip screen state
$EX469:
cEnd
;*******************************************************************************
;_EraseEol
;
;Purpose:
; Delete characters from ip to end of line. Line is refreshed.
; Deletion is done by selecting and then cutting.
;Entry:
; ipCur
; ldCur
; pefCur.ef_fSelection
;Exit:
; ldCur
;Uses:
; none.
;Exceptions:
;
;*******************************************************************************
cProc EraseEol,<NEAR,PUBLIC>
cBegin
cCall fCheckReadOnly
jnz ExitEraseEol
cCall NoSelection ;remove any selection
cCall GetCurLine ;get the line in ld
mov ax,ldCur.ld_cb
mov ipAnchor.ip_ob,ax ;move anchor to eol
cCall HiliteSelection ;hilite from ip to eol
;!!! This code can be shared with Kill Line
mov bx,pefCur ;set selection true
mov [bx].ef_fSelection,TRUE
mov ax,TRUE
cCall Cut,<ax>
ExitEraseEol:
cEnd
;*******************************************************************************
;DelWord
;
;Purpose:
; If the cursor is on a word then delete to the end of the word
; else do Del().
;
;Entry:
;Exit:
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc DelWord,<NEAR,PUBLIC>,<SI>
cBegin
cCall NoSelection
cCall ModifyLine
jz DW_Exit
mov si, [ipCur.ip_ob]
cmp si, [ldCur.ld_cb]
jae DW_0 ; Cursor is past end of line
; do Del which will do JoinLine
cCall FOnSpace
jz DW_1 ; Cursor is on a space
cCall FOnWord ; Is cursor on a word char?
jnz DW_2 ; Yes - Delete word
DW_0:
;
; Cursor is not on a word and not on a space.
; So just delete one character (or JoinLine).
;
cCall Del
jmp short DW_Exit
DW_1:
;
; Cursor is on a space. So delete all white space after cursor
;
inc [ipCur.ip_ob]
cCall FOnSpace
jz DW_1
jmp short DW_3
DW_2:
;
; Cursor is on a word so delete to the end of the word.
;
cCall RightPastWordEnd ; Find end of word
DW_3:
mov ax, [ipCur.ip_ob]
mov bx, ax
mov [ipCur.ip_ob], si
sub ax, si ; How many chars to delete
cCall DelCh,<ax,bx>
cCall RefreshLine,<ipCur.ip_oln>
DW_Exit:
cEnd
;*******************************************************************************
;FOnSpace
;
;Purpose:
; Checks if the cursor is on a space
;
;
;Entry:
;Exit:
; Return Z if cursor is on a space.
;
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc FOnSpace,<NEAR>
cBegin
mov bx, [ldCur.ld_prgch]
add bx, [ipCur.ip_ob]
mov al,[bx]
cmp al, ' '
cEnd
;*******************************************************************************
;_InsertKey
;
;Purpose:
; Insert the specfied character at the current ip
;Entry:
; InsertCh - character to insert
; ipCur
; pdCur
; ldCur
; pwndEditCur.cColumns
; fRedraw
;Exit:
; ldCur
; ipCur
;Uses:
; si, di, cx, bx
;Exceptions:
;
;*******************************************************************************
cProc InsertKey,<NEAR,PUBLIC>,<SI,DI>
parmB InsertCh
cBegin
cCall fCheckReadOnly
jnz J_ExitInsertKey
cmp [InsertCh],0
jne @F ;if not null contine
J_ExitInsertKey:
jmp ExitInsertKey ;if null don't insert key
;Here if key ok to insert
@@:
sub ax,ax ;first cut any selection
cCall Cut,<ax> ;so that insertion replaces text
cCall ModifyLine ;mark line as modified
mov di,ldCur.ld_cbMax
dec di
cmp [fInsertMode],0 ; Can always insert another char when
jnz @F ; not in insert mode
ifdef KANJI
mov si,[ldCur.LD_prgch] ;If we are in overwrite, then
cCall DbcsAdjCursor
add si,ax
cCall FIsDbcsChar,<[si]> ; See if current char is DBCS
or ax,ax
jz SkipInsertSpace
inc si ; if so,
mov byte ptr [si],' ' ; put a space at next byte
SkipInsertSpace:
endif ; KANJI
jmp SHORT DoInsertKey
@@:
cmp di,ldCur.ld_cb ;if line almost full don't insert
je NoInsertKey ;alway leave 1 InsertCh space
;Here if room to insert key
DoInsertKey:
cmp di, [ipCur.ip_ob] ;beep if cursor past cbMax
jbe NoInsertKey
mov al,[InsertCh]
cbw
mov bx,1 ;insert only 1 copy of character
mov cl, [fInsertMode]
cCall InsCh,<bx,ax, cx> ;insert into ldCur
or ax,ax ;test if insert successfull
je NoInsertKey ;brif if not
inc ipCur.ip_ob ;move to right on screen
mov si,[cColumnsCur] ;pwndEditCur.cColumns
add si,pdCur.pd_obleft
cmp ipCur.ip_ob,si ;compute max. right position
jl @F ;brif if new position to right of max
;Here if new position if off right end of screen
sub ax,ax
cCall PageRight,<shiftWidth,ax> ;page 1 to right
jmp SHORT ExitInsertKey
;Here if new position is still on screen
@@:
ifdef KANJI
cmp [fCharIsDbcs],0
jnz SHORT ExitInsertKey
endif ; KANJI
cCall RefreshLine,<ipCur.ip_oln>
jmp SHORT ExitInsertKey
;Here if insert can't be done
NoInsertKey:
cCall NearBeep
ExitInsertKey:
cEnd
;*****************************************************************************
|
tysos/x86_64/switcher.asm | jncronin/tysos | 5 | 95377 | global _ZN11tysos#2Edll14tysos#2Ex86_6412TaskSwitcher_16do_x86_64_switch_Rv_P5yU5tysos6Threadyyy:function
_ZN11tysos#2Edll14tysos#2Ex86_6412TaskSwitcher_16do_x86_64_switch_Rv_P5yU5tysos6Threadyyy:
; static void do_x86_64_switch(ulong cur_thread_pointer,
; Thread next_thread,
; ulong tsi_offset_within_thread,
; ulong rsp_offset_within_tsi,
; ulong fs_base_within_tsi);
pushfq
push rax
push rbx
push rcx
push rdx
push rsi
push rdi
push rbp
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
; for now, just save the entire xmm registers. Later, we will do it demand-based.
sub rsp, 128
movq [rsp], xmm0
movq [rsp + 8], xmm1
movq [rsp + 16], xmm2
movq [rsp + 24], xmm3
movq [rsp + 32], xmm4
movq [rsp + 40], xmm5
movq [rsp + 48], xmm6
movq [rsp + 56], xmm7
movq [rsp + 64], xmm8
movq [rsp + 72], xmm9
movq [rsp + 80], xmm10
movq [rsp + 88], xmm11
movq [rsp + 96], xmm12
movq [rsp + 104], xmm13
movq [rsp + 112], xmm14
movq [rsp + 120], xmm15
; cur_thread_pointer = rdx
; next_thread = rsi
; tsi_offset_within_thread = rdx
; rsp_offset_within_tsi = rcx
; fsbase_within_tsi = r8
mov rax, [rdi] ; cur_thread
cmp rax, 0 ; if current thread is null, don't save the current rsp
je .dontsave
; if cur_thread != null
mov rbx, [rax + rdx] ; cur_thread_tsi
mov [rbx + rcx], rsp ; store rsp to rsp within current thread
.dontsave:
; load rsp from the new thread
mov rbx, [rsi + rdx] ; next_thread_tsi
mov rsp, [rbx + rcx] ; load rsp from next thread
; load fsbase from the new thread
mov rax, [rbx + r8]
mov rdx, rax ; get to eax:edx
shr rdx, 32
mov rcx, 0xc0000100 ; ia32_fs_base
wrmsr
; change the cur_thread pointer
mov [rdi], rsi
; restore state
movq xmm0, [rsp]
movq xmm1, [rsp + 8]
movq xmm2, [rsp + 16]
movq xmm3, [rsp + 24]
movq xmm4, [rsp + 32]
movq xmm5, [rsp + 40]
movq xmm6, [rsp + 48]
movq xmm7, [rsp + 56]
movq xmm8, [rsp + 64]
movq xmm9, [rsp + 72]
movq xmm10, [rsp + 80]
movq xmm11, [rsp + 88]
movq xmm12, [rsp + 96]
movq xmm13, [rsp + 104]
movq xmm14, [rsp + 112]
movq xmm15, [rsp + 120]
add rsp, 128
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rbp
pop rdi
pop rsi
pop rdx
pop rcx
pop rbx
pop rax
popfq
ret
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/test_8bitlong_overflow.adb | best08618/asylo | 7 | 21617 | <gh_stars>1-10
-- { dg-do run }
-- { dg-options "-gnato" }
procedure Test_8bitlong_Overflow is
pragma Unsuppress (Overflow_Check);
generic
type T is range <>;
package G is
LO : T := T'first;
ONE : T := T(1);
type A2 is array(T range <>) of T;
subtype SA2 is A2(LO..4*ONE);
ARRAY_AGGR : SA2 := SA2'(others=>LO + 1);
POS_1 : T := T'pos(LO*ONE);
end;
type T is new LONG_INTEGER range -1..10;
for T'size use 8;
package P is new G (T);
begin
null;
end;
|
data/test_bit.asm | colinw7/C6502 | 0 | 96929 | LDA #$37
BIT $44
OUT A
|
programs/oeis/113/A113841.asm | jmorken/loda | 1 | 89521 | <reponame>jmorken/loda
; A113841: a(n) = a(n-1) + 2^A047240(n) for n>1, a(1)=1.
; 1,3,7,71,199,455,4551,12743,29127,291271,815559,1864135,18641351,52195783,119304647,1193046471,3340530119,7635497415,76354974151,213793927623,488671834567,4886718345671,13682811367879,31274997412295,312749974122951,875699927544263,2001599834386887
mov $23,$0
mov $25,$0
add $25,1
lpb $25
clr $0,23
mov $0,$23
sub $25,1
sub $0,$25
mov $20,$0
mov $22,$0
add $22,1
lpb $22
clr $0,20
mov $0,$20
sub $22,1
sub $0,$22
mov $17,$0
mov $19,$0
add $19,1
lpb $19
mov $0,$17
sub $19,1
sub $0,$19
mov $13,$0
mov $15,2
lpb $15
mov $0,$13
sub $15,1
add $0,$15
sub $0,1
mov $9,$0
mov $11,2
lpb $11
mov $0,$9
sub $11,1
add $0,$11
sub $0,1
mov $2,$0
trn $0,2
mov $7,$2
add $7,5
mov $3,$7
lpb $0
trn $0,3
add $3,3
lpe
mov $2,2
pow $2,$3
mov $1,$2
mov $12,$11
lpb $12
mov $10,$1
sub $12,1
lpe
lpe
lpb $9
mov $9,0
sub $10,$1
lpe
mov $1,$10
mov $16,$15
lpb $16
mov $14,$1
sub $16,1
lpe
lpe
lpb $13
mov $13,0
sub $14,$1
lpe
mov $1,$14
div $1,32
add $18,$1
lpe
add $21,$18
lpe
add $24,$21
lpe
mov $1,$24
|
test/Fail/AttributeUnparenthesized.agda | shlevy/agda | 1,989 | 1411 | -- Andreas, 2018-06-09, issue #2513, parsing attributes
postulate
fail : ∀ @0 A → A → A
-- Should fail.
|
s-inmaop.ads | ytomino/gnat4drake | 0 | 21894 | <reponame>ytomino/gnat4drake<filename>s-inmaop.ads
pragma License (Unrestricted);
package System.Interrupt_Management.Operations is
procedure Set_Interrupt_Mask (Mask : access Interrupt_Mask);
procedure Set_Interrupt_Mask (
Mask : access Interrupt_Mask;
OMask : access Interrupt_Mask);
procedure Get_Interrupt_Mask (Mask : access Interrupt_Mask);
procedure Fill_Interrupt_Mask (Mask : access Interrupt_Mask);
procedure Add_To_Interrupt_Mask (
Mask : access Interrupt_Mask;
Interrupt : Interrupt_ID);
procedure Copy_Interrupt_Mask (
X : out Interrupt_Mask;
Y : Interrupt_Mask);
end System.Interrupt_Management.Operations;
|
Projetos/F-Assembly/src/nasm/factorial.nasm | LiuSeeker/Z01-Coldzera | 1 | 246120 | <gh_stars>1-10
; Arquivo: Factorial.nasm
; Curso: Elementos de Sistemas
; Criado por: <NAME>
; Data: 27/03/2017
; Calcula o fatorial do número em R0 e armazena o valor em R1.
leaw $R0, %A
movw (%A), %D
movw (%A), %S
decw %D
decw %D
leaw $R1, %A
movw %D, (%A)
leaw $R0, %A
addw (%A), %S, %S
leaw $R2, %A
movw %S, (%A)
decw %D
leaw $7,%A
jg
nop
leaw $R1, %A
movw (%A), %D
leaw $R0, %A
movw %S, (%A)
decw %D
leaw $R1, %A
movw %D, (%A)
leaw $7, %A
jg
nop
leaw $2, %A
movw (%A), %D
leaw $31, %A
jg
nop
incw %D
leaw $1, %A
movw %D, (%A) |
Programming for Embedded Systems/Labs/Lab 1/Assembler/Assembler/main.asm | sathwikkannam/courses-HKR | 0 | 98561 | <reponame>sathwikkannam/courses-HKR
;
; Assembler.asm
;
; Created: 2022-02-09 13:51:50
; Author : SAKA0191
;
.INCLUDE "m48def.inc"
LDI R16, 3
LDI R17, 10
LDI R18, 2
MOV R2, R18
MOV R1, R17
START:
ADD R1, R2
DEC R16
BRNE start
OUT PORTD, R1
FOREVER:
RJMP FOREVER
|
experiments/test-suite/mutation-based/10/1/balancedBST.als | kaiyuanw/AlloyFLCore | 1 | 3634 | pred test80 {
some disj BinaryTree0: BinaryTree {some disj Node0: Node {
BinaryTree = BinaryTree0
root = BinaryTree0->Node0
Node = Node0
left = Node0->Node0
no right
elem = Node0->1
}}
}
run test80 for 4 expect 0
pred test78 {
some disj BinaryTree0: BinaryTree {some disj Node0, Node1: Node {
BinaryTree = BinaryTree0
root = BinaryTree0->Node1
Node = Node0 + Node1
left = Node1->Node0
no right
elem = Node0->7 + Node1->6
Depth[Node1] = 1
}}
}
run test78 for 4 expect 1
pred test31 {
some disj BinaryTree0: BinaryTree {some disj Node0, Node1: Node {
BinaryTree = BinaryTree0
root = BinaryTree0->Node1
Node = Node0 + Node1
left = Node1->Node0
no right
elem = Node0->6 + Node1->-8
Sorted[]
}}
}
run test31 for 4 expect 0
pred test26 {
some disj BinaryTree0: BinaryTree {some disj Node0, Node1: Node {
BinaryTree = BinaryTree0
root = BinaryTree0->Node1
Node = Node0 + Node1
left = Node1->Node0
no right
elem = Node0->4 + Node1->5
Sorted[]
}}
}
run test26 for 4 expect 1
pred test95 {
some disj BinaryTree0: BinaryTree {some disj Node0, Node1, Node2: Node {
BinaryTree = BinaryTree0
root = BinaryTree0->Node2
Node = Node0 + Node1 + Node2
left = Node0->Node1
right = Node2->Node0
elem = Node0->7 + Node1->6 + Node2->3
}}
}
run test95 for 4 expect 1
pred test105 {
some disj BinaryTree0: BinaryTree {some disj Node0, Node1, Node2: Node {
BinaryTree = BinaryTree0
root = BinaryTree0->Node2
Node = Node0 + Node1 + Node2
left = Node2->Node0
right = Node0->Node1 + Node2->Node0
elem = Node0->7 + Node1->6 + Node2->5
}}
}
run test105 for 4 expect 0
pred test94 {
some disj BinaryTree0: BinaryTree {some disj Node0: Node {
BinaryTree = BinaryTree0
root = BinaryTree0->Node0
Node = Node0
no left
no right
elem = Node0->-4
}}
}
run test94 for 4 expect 1
pred test44 {
some disj BinaryTree0: BinaryTree {some disj Node0, Node1: Node {
BinaryTree = BinaryTree0
root = BinaryTree0->Node1
Node = Node0 + Node1
no left
right = Node1->Node0
elem = Node0->1 + Node1->1
Sorted[]
}}
}
run test44 for 4 expect 0
pred test29 {
some disj BinaryTree0: BinaryTree {some disj Node0, Node1, Node2, Node3: Node {
BinaryTree = BinaryTree0
root = BinaryTree0->Node3
Node = Node0 + Node1 + Node2 + Node3
left = Node0->Node2 + Node1->Node0
right = Node3->Node1
elem = Node0->7 + Node1->6 + Node2->4 + Node3->3
Sorted[]
}}
}
run test29 for 4 expect 0
pred test9 {
some disj BinaryTree0: BinaryTree {some disj Node0: Node {
BinaryTree = BinaryTree0
root = BinaryTree0->Node0
Node = Node0
no left
no right
no elem
}}
}
run test9 for 4 expect 0
pred test7 {
some disj BinaryTree0: BinaryTree {some disj Node0, Node1, Node2: Node {
BinaryTree = BinaryTree0
root = BinaryTree0->Node2
Node = Node0 + Node1 + Node2
left = Node0->Node1 + Node2->Node0
no right
elem = Node0->7 + Node1->3 + Node2->2
}}
}
run test7 for 4 expect 1
|
stressfs.asm | jhsie007/xv6 | 0 | 8011 |
_stressfs: file format elf32-i386
Disassembly of section .text:
00001000 <main>:
#include "fs.h"
#include "fcntl.h"
int
main(int argc, char *argv[])
{
1000: 55 push %ebp
1001: 89 e5 mov %esp,%ebp
1003: 83 e4 f0 and $0xfffffff0,%esp
1006: 81 ec 30 02 00 00 sub $0x230,%esp
int fd, i;
char path[] = "stressfs0";
100c: c7 84 24 1e 02 00 00 movl $0x65727473,0x21e(%esp)
1013: 73 74 72 65
1017: c7 84 24 22 02 00 00 movl $0x73667373,0x222(%esp)
101e: 73 73 66 73
1022: 66 c7 84 24 26 02 00 movw $0x30,0x226(%esp)
1029: 00 30 00
char data[512];
printf(1, "stressfs starting\n");
102c: c7 44 24 04 05 1c 00 movl $0x1c05,0x4(%esp)
1033: 00
1034: c7 04 24 01 00 00 00 movl $0x1,(%esp)
103b: e8 84 05 00 00 call 15c4 <printf>
memset(data, 'a', sizeof(data));
1040: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
1047: 00
1048: c7 44 24 04 61 00 00 movl $0x61,0x4(%esp)
104f: 00
1050: 8d 44 24 1e lea 0x1e(%esp),%eax
1054: 89 04 24 mov %eax,(%esp)
1057: e8 13 02 00 00 call 126f <memset>
for(i = 0; i < 4; i++)
105c: c7 84 24 2c 02 00 00 movl $0x0,0x22c(%esp)
1063: 00 00 00 00
1067: eb 13 jmp 107c <main+0x7c>
if(fork() > 0)
1069: e8 a6 03 00 00 call 1414 <fork>
106e: 85 c0 test %eax,%eax
1070: 7e 02 jle 1074 <main+0x74>
break;
1072: eb 12 jmp 1086 <main+0x86>
char data[512];
printf(1, "stressfs starting\n");
memset(data, 'a', sizeof(data));
for(i = 0; i < 4; i++)
1074: 83 84 24 2c 02 00 00 addl $0x1,0x22c(%esp)
107b: 01
107c: 83 bc 24 2c 02 00 00 cmpl $0x3,0x22c(%esp)
1083: 03
1084: 7e e3 jle 1069 <main+0x69>
if(fork() > 0)
break;
printf(1, "write %d\n", i);
1086: 8b 84 24 2c 02 00 00 mov 0x22c(%esp),%eax
108d: 89 44 24 08 mov %eax,0x8(%esp)
1091: c7 44 24 04 18 1c 00 movl $0x1c18,0x4(%esp)
1098: 00
1099: c7 04 24 01 00 00 00 movl $0x1,(%esp)
10a0: e8 1f 05 00 00 call 15c4 <printf>
path[8] += i;
10a5: 0f b6 84 24 26 02 00 movzbl 0x226(%esp),%eax
10ac: 00
10ad: 89 c2 mov %eax,%edx
10af: 8b 84 24 2c 02 00 00 mov 0x22c(%esp),%eax
10b6: 01 d0 add %edx,%eax
10b8: 88 84 24 26 02 00 00 mov %al,0x226(%esp)
fd = open(path, O_CREATE | O_RDWR);
10bf: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
10c6: 00
10c7: 8d 84 24 1e 02 00 00 lea 0x21e(%esp),%eax
10ce: 89 04 24 mov %eax,(%esp)
10d1: e8 86 03 00 00 call 145c <open>
10d6: 89 84 24 28 02 00 00 mov %eax,0x228(%esp)
for(i = 0; i < 20; i++)
10dd: c7 84 24 2c 02 00 00 movl $0x0,0x22c(%esp)
10e4: 00 00 00 00
10e8: eb 27 jmp 1111 <main+0x111>
// printf(fd, "%d\n", i);
write(fd, data, sizeof(data));
10ea: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
10f1: 00
10f2: 8d 44 24 1e lea 0x1e(%esp),%eax
10f6: 89 44 24 04 mov %eax,0x4(%esp)
10fa: 8b 84 24 28 02 00 00 mov 0x228(%esp),%eax
1101: 89 04 24 mov %eax,(%esp)
1104: e8 33 03 00 00 call 143c <write>
printf(1, "write %d\n", i);
path[8] += i;
fd = open(path, O_CREATE | O_RDWR);
for(i = 0; i < 20; i++)
1109: 83 84 24 2c 02 00 00 addl $0x1,0x22c(%esp)
1110: 01
1111: 83 bc 24 2c 02 00 00 cmpl $0x13,0x22c(%esp)
1118: 13
1119: 7e cf jle 10ea <main+0xea>
// printf(fd, "%d\n", i);
write(fd, data, sizeof(data));
close(fd);
111b: 8b 84 24 28 02 00 00 mov 0x228(%esp),%eax
1122: 89 04 24 mov %eax,(%esp)
1125: e8 1a 03 00 00 call 1444 <close>
printf(1, "read\n");
112a: c7 44 24 04 22 1c 00 movl $0x1c22,0x4(%esp)
1131: 00
1132: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1139: e8 86 04 00 00 call 15c4 <printf>
fd = open(path, O_RDONLY);
113e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1145: 00
1146: 8d 84 24 1e 02 00 00 lea 0x21e(%esp),%eax
114d: 89 04 24 mov %eax,(%esp)
1150: e8 07 03 00 00 call 145c <open>
1155: 89 84 24 28 02 00 00 mov %eax,0x228(%esp)
for (i = 0; i < 20; i++)
115c: c7 84 24 2c 02 00 00 movl $0x0,0x22c(%esp)
1163: 00 00 00 00
1167: eb 27 jmp 1190 <main+0x190>
read(fd, data, sizeof(data));
1169: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
1170: 00
1171: 8d 44 24 1e lea 0x1e(%esp),%eax
1175: 89 44 24 04 mov %eax,0x4(%esp)
1179: 8b 84 24 28 02 00 00 mov 0x228(%esp),%eax
1180: 89 04 24 mov %eax,(%esp)
1183: e8 ac 02 00 00 call 1434 <read>
close(fd);
printf(1, "read\n");
fd = open(path, O_RDONLY);
for (i = 0; i < 20; i++)
1188: 83 84 24 2c 02 00 00 addl $0x1,0x22c(%esp)
118f: 01
1190: 83 bc 24 2c 02 00 00 cmpl $0x13,0x22c(%esp)
1197: 13
1198: 7e cf jle 1169 <main+0x169>
read(fd, data, sizeof(data));
close(fd);
119a: 8b 84 24 28 02 00 00 mov 0x228(%esp),%eax
11a1: 89 04 24 mov %eax,(%esp)
11a4: e8 9b 02 00 00 call 1444 <close>
wait();
11a9: e8 76 02 00 00 call 1424 <wait>
exit();
11ae: e8 69 02 00 00 call 141c <exit>
11b3: 90 nop
000011b4 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
11b4: 55 push %ebp
11b5: 89 e5 mov %esp,%ebp
11b7: 57 push %edi
11b8: 53 push %ebx
asm volatile("cld; rep stosb" :
11b9: 8b 4d 08 mov 0x8(%ebp),%ecx
11bc: 8b 55 10 mov 0x10(%ebp),%edx
11bf: 8b 45 0c mov 0xc(%ebp),%eax
11c2: 89 cb mov %ecx,%ebx
11c4: 89 df mov %ebx,%edi
11c6: 89 d1 mov %edx,%ecx
11c8: fc cld
11c9: f3 aa rep stos %al,%es:(%edi)
11cb: 89 ca mov %ecx,%edx
11cd: 89 fb mov %edi,%ebx
11cf: 89 5d 08 mov %ebx,0x8(%ebp)
11d2: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
11d5: 5b pop %ebx
11d6: 5f pop %edi
11d7: 5d pop %ebp
11d8: c3 ret
000011d9 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
11d9: 55 push %ebp
11da: 89 e5 mov %esp,%ebp
11dc: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
11df: 8b 45 08 mov 0x8(%ebp),%eax
11e2: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
11e5: 90 nop
11e6: 8b 45 08 mov 0x8(%ebp),%eax
11e9: 8d 50 01 lea 0x1(%eax),%edx
11ec: 89 55 08 mov %edx,0x8(%ebp)
11ef: 8b 55 0c mov 0xc(%ebp),%edx
11f2: 8d 4a 01 lea 0x1(%edx),%ecx
11f5: 89 4d 0c mov %ecx,0xc(%ebp)
11f8: 0f b6 12 movzbl (%edx),%edx
11fb: 88 10 mov %dl,(%eax)
11fd: 0f b6 00 movzbl (%eax),%eax
1200: 84 c0 test %al,%al
1202: 75 e2 jne 11e6 <strcpy+0xd>
;
return os;
1204: 8b 45 fc mov -0x4(%ebp),%eax
}
1207: c9 leave
1208: c3 ret
00001209 <strcmp>:
int
strcmp(const char *p, const char *q)
{
1209: 55 push %ebp
120a: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
120c: eb 08 jmp 1216 <strcmp+0xd>
p++, q++;
120e: 83 45 08 01 addl $0x1,0x8(%ebp)
1212: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
1216: 8b 45 08 mov 0x8(%ebp),%eax
1219: 0f b6 00 movzbl (%eax),%eax
121c: 84 c0 test %al,%al
121e: 74 10 je 1230 <strcmp+0x27>
1220: 8b 45 08 mov 0x8(%ebp),%eax
1223: 0f b6 10 movzbl (%eax),%edx
1226: 8b 45 0c mov 0xc(%ebp),%eax
1229: 0f b6 00 movzbl (%eax),%eax
122c: 38 c2 cmp %al,%dl
122e: 74 de je 120e <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
1230: 8b 45 08 mov 0x8(%ebp),%eax
1233: 0f b6 00 movzbl (%eax),%eax
1236: 0f b6 d0 movzbl %al,%edx
1239: 8b 45 0c mov 0xc(%ebp),%eax
123c: 0f b6 00 movzbl (%eax),%eax
123f: 0f b6 c0 movzbl %al,%eax
1242: 29 c2 sub %eax,%edx
1244: 89 d0 mov %edx,%eax
}
1246: 5d pop %ebp
1247: c3 ret
00001248 <strlen>:
uint
strlen(char *s)
{
1248: 55 push %ebp
1249: 89 e5 mov %esp,%ebp
124b: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
124e: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
1255: eb 04 jmp 125b <strlen+0x13>
1257: 83 45 fc 01 addl $0x1,-0x4(%ebp)
125b: 8b 55 fc mov -0x4(%ebp),%edx
125e: 8b 45 08 mov 0x8(%ebp),%eax
1261: 01 d0 add %edx,%eax
1263: 0f b6 00 movzbl (%eax),%eax
1266: 84 c0 test %al,%al
1268: 75 ed jne 1257 <strlen+0xf>
;
return n;
126a: 8b 45 fc mov -0x4(%ebp),%eax
}
126d: c9 leave
126e: c3 ret
0000126f <memset>:
void*
memset(void *dst, int c, uint n)
{
126f: 55 push %ebp
1270: 89 e5 mov %esp,%ebp
1272: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
1275: 8b 45 10 mov 0x10(%ebp),%eax
1278: 89 44 24 08 mov %eax,0x8(%esp)
127c: 8b 45 0c mov 0xc(%ebp),%eax
127f: 89 44 24 04 mov %eax,0x4(%esp)
1283: 8b 45 08 mov 0x8(%ebp),%eax
1286: 89 04 24 mov %eax,(%esp)
1289: e8 26 ff ff ff call 11b4 <stosb>
return dst;
128e: 8b 45 08 mov 0x8(%ebp),%eax
}
1291: c9 leave
1292: c3 ret
00001293 <strchr>:
char*
strchr(const char *s, char c)
{
1293: 55 push %ebp
1294: 89 e5 mov %esp,%ebp
1296: 83 ec 04 sub $0x4,%esp
1299: 8b 45 0c mov 0xc(%ebp),%eax
129c: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
129f: eb 14 jmp 12b5 <strchr+0x22>
if(*s == c)
12a1: 8b 45 08 mov 0x8(%ebp),%eax
12a4: 0f b6 00 movzbl (%eax),%eax
12a7: 3a 45 fc cmp -0x4(%ebp),%al
12aa: 75 05 jne 12b1 <strchr+0x1e>
return (char*)s;
12ac: 8b 45 08 mov 0x8(%ebp),%eax
12af: eb 13 jmp 12c4 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
12b1: 83 45 08 01 addl $0x1,0x8(%ebp)
12b5: 8b 45 08 mov 0x8(%ebp),%eax
12b8: 0f b6 00 movzbl (%eax),%eax
12bb: 84 c0 test %al,%al
12bd: 75 e2 jne 12a1 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
12bf: b8 00 00 00 00 mov $0x0,%eax
}
12c4: c9 leave
12c5: c3 ret
000012c6 <gets>:
char*
gets(char *buf, int max)
{
12c6: 55 push %ebp
12c7: 89 e5 mov %esp,%ebp
12c9: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
12cc: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
12d3: eb 4c jmp 1321 <gets+0x5b>
cc = read(0, &c, 1);
12d5: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
12dc: 00
12dd: 8d 45 ef lea -0x11(%ebp),%eax
12e0: 89 44 24 04 mov %eax,0x4(%esp)
12e4: c7 04 24 00 00 00 00 movl $0x0,(%esp)
12eb: e8 44 01 00 00 call 1434 <read>
12f0: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
12f3: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
12f7: 7f 02 jg 12fb <gets+0x35>
break;
12f9: eb 31 jmp 132c <gets+0x66>
buf[i++] = c;
12fb: 8b 45 f4 mov -0xc(%ebp),%eax
12fe: 8d 50 01 lea 0x1(%eax),%edx
1301: 89 55 f4 mov %edx,-0xc(%ebp)
1304: 89 c2 mov %eax,%edx
1306: 8b 45 08 mov 0x8(%ebp),%eax
1309: 01 c2 add %eax,%edx
130b: 0f b6 45 ef movzbl -0x11(%ebp),%eax
130f: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
1311: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1315: 3c 0a cmp $0xa,%al
1317: 74 13 je 132c <gets+0x66>
1319: 0f b6 45 ef movzbl -0x11(%ebp),%eax
131d: 3c 0d cmp $0xd,%al
131f: 74 0b je 132c <gets+0x66>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1321: 8b 45 f4 mov -0xc(%ebp),%eax
1324: 83 c0 01 add $0x1,%eax
1327: 3b 45 0c cmp 0xc(%ebp),%eax
132a: 7c a9 jl 12d5 <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
132c: 8b 55 f4 mov -0xc(%ebp),%edx
132f: 8b 45 08 mov 0x8(%ebp),%eax
1332: 01 d0 add %edx,%eax
1334: c6 00 00 movb $0x0,(%eax)
return buf;
1337: 8b 45 08 mov 0x8(%ebp),%eax
}
133a: c9 leave
133b: c3 ret
0000133c <stat>:
int
stat(char *n, struct stat *st)
{
133c: 55 push %ebp
133d: 89 e5 mov %esp,%ebp
133f: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
1342: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1349: 00
134a: 8b 45 08 mov 0x8(%ebp),%eax
134d: 89 04 24 mov %eax,(%esp)
1350: e8 07 01 00 00 call 145c <open>
1355: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
1358: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
135c: 79 07 jns 1365 <stat+0x29>
return -1;
135e: b8 ff ff ff ff mov $0xffffffff,%eax
1363: eb 23 jmp 1388 <stat+0x4c>
r = fstat(fd, st);
1365: 8b 45 0c mov 0xc(%ebp),%eax
1368: 89 44 24 04 mov %eax,0x4(%esp)
136c: 8b 45 f4 mov -0xc(%ebp),%eax
136f: 89 04 24 mov %eax,(%esp)
1372: e8 fd 00 00 00 call 1474 <fstat>
1377: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
137a: 8b 45 f4 mov -0xc(%ebp),%eax
137d: 89 04 24 mov %eax,(%esp)
1380: e8 bf 00 00 00 call 1444 <close>
return r;
1385: 8b 45 f0 mov -0x10(%ebp),%eax
}
1388: c9 leave
1389: c3 ret
0000138a <atoi>:
int
atoi(const char *s)
{
138a: 55 push %ebp
138b: 89 e5 mov %esp,%ebp
138d: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
1390: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
1397: eb 25 jmp 13be <atoi+0x34>
n = n*10 + *s++ - '0';
1399: 8b 55 fc mov -0x4(%ebp),%edx
139c: 89 d0 mov %edx,%eax
139e: c1 e0 02 shl $0x2,%eax
13a1: 01 d0 add %edx,%eax
13a3: 01 c0 add %eax,%eax
13a5: 89 c1 mov %eax,%ecx
13a7: 8b 45 08 mov 0x8(%ebp),%eax
13aa: 8d 50 01 lea 0x1(%eax),%edx
13ad: 89 55 08 mov %edx,0x8(%ebp)
13b0: 0f b6 00 movzbl (%eax),%eax
13b3: 0f be c0 movsbl %al,%eax
13b6: 01 c8 add %ecx,%eax
13b8: 83 e8 30 sub $0x30,%eax
13bb: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
13be: 8b 45 08 mov 0x8(%ebp),%eax
13c1: 0f b6 00 movzbl (%eax),%eax
13c4: 3c 2f cmp $0x2f,%al
13c6: 7e 0a jle 13d2 <atoi+0x48>
13c8: 8b 45 08 mov 0x8(%ebp),%eax
13cb: 0f b6 00 movzbl (%eax),%eax
13ce: 3c 39 cmp $0x39,%al
13d0: 7e c7 jle 1399 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
13d2: 8b 45 fc mov -0x4(%ebp),%eax
}
13d5: c9 leave
13d6: c3 ret
000013d7 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
13d7: 55 push %ebp
13d8: 89 e5 mov %esp,%ebp
13da: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
13dd: 8b 45 08 mov 0x8(%ebp),%eax
13e0: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
13e3: 8b 45 0c mov 0xc(%ebp),%eax
13e6: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
13e9: eb 17 jmp 1402 <memmove+0x2b>
*dst++ = *src++;
13eb: 8b 45 fc mov -0x4(%ebp),%eax
13ee: 8d 50 01 lea 0x1(%eax),%edx
13f1: 89 55 fc mov %edx,-0x4(%ebp)
13f4: 8b 55 f8 mov -0x8(%ebp),%edx
13f7: 8d 4a 01 lea 0x1(%edx),%ecx
13fa: 89 4d f8 mov %ecx,-0x8(%ebp)
13fd: 0f b6 12 movzbl (%edx),%edx
1400: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
1402: 8b 45 10 mov 0x10(%ebp),%eax
1405: 8d 50 ff lea -0x1(%eax),%edx
1408: 89 55 10 mov %edx,0x10(%ebp)
140b: 85 c0 test %eax,%eax
140d: 7f dc jg 13eb <memmove+0x14>
*dst++ = *src++;
return vdst;
140f: 8b 45 08 mov 0x8(%ebp),%eax
}
1412: c9 leave
1413: c3 ret
00001414 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
1414: b8 01 00 00 00 mov $0x1,%eax
1419: cd 40 int $0x40
141b: c3 ret
0000141c <exit>:
SYSCALL(exit)
141c: b8 02 00 00 00 mov $0x2,%eax
1421: cd 40 int $0x40
1423: c3 ret
00001424 <wait>:
SYSCALL(wait)
1424: b8 03 00 00 00 mov $0x3,%eax
1429: cd 40 int $0x40
142b: c3 ret
0000142c <pipe>:
SYSCALL(pipe)
142c: b8 04 00 00 00 mov $0x4,%eax
1431: cd 40 int $0x40
1433: c3 ret
00001434 <read>:
SYSCALL(read)
1434: b8 05 00 00 00 mov $0x5,%eax
1439: cd 40 int $0x40
143b: c3 ret
0000143c <write>:
SYSCALL(write)
143c: b8 10 00 00 00 mov $0x10,%eax
1441: cd 40 int $0x40
1443: c3 ret
00001444 <close>:
SYSCALL(close)
1444: b8 15 00 00 00 mov $0x15,%eax
1449: cd 40 int $0x40
144b: c3 ret
0000144c <kill>:
SYSCALL(kill)
144c: b8 06 00 00 00 mov $0x6,%eax
1451: cd 40 int $0x40
1453: c3 ret
00001454 <exec>:
SYSCALL(exec)
1454: b8 07 00 00 00 mov $0x7,%eax
1459: cd 40 int $0x40
145b: c3 ret
0000145c <open>:
SYSCALL(open)
145c: b8 0f 00 00 00 mov $0xf,%eax
1461: cd 40 int $0x40
1463: c3 ret
00001464 <mknod>:
SYSCALL(mknod)
1464: b8 11 00 00 00 mov $0x11,%eax
1469: cd 40 int $0x40
146b: c3 ret
0000146c <unlink>:
SYSCALL(unlink)
146c: b8 12 00 00 00 mov $0x12,%eax
1471: cd 40 int $0x40
1473: c3 ret
00001474 <fstat>:
SYSCALL(fstat)
1474: b8 08 00 00 00 mov $0x8,%eax
1479: cd 40 int $0x40
147b: c3 ret
0000147c <link>:
SYSCALL(link)
147c: b8 13 00 00 00 mov $0x13,%eax
1481: cd 40 int $0x40
1483: c3 ret
00001484 <mkdir>:
SYSCALL(mkdir)
1484: b8 14 00 00 00 mov $0x14,%eax
1489: cd 40 int $0x40
148b: c3 ret
0000148c <chdir>:
SYSCALL(chdir)
148c: b8 09 00 00 00 mov $0x9,%eax
1491: cd 40 int $0x40
1493: c3 ret
00001494 <dup>:
SYSCALL(dup)
1494: b8 0a 00 00 00 mov $0xa,%eax
1499: cd 40 int $0x40
149b: c3 ret
0000149c <getpid>:
SYSCALL(getpid)
149c: b8 0b 00 00 00 mov $0xb,%eax
14a1: cd 40 int $0x40
14a3: c3 ret
000014a4 <sbrk>:
SYSCALL(sbrk)
14a4: b8 0c 00 00 00 mov $0xc,%eax
14a9: cd 40 int $0x40
14ab: c3 ret
000014ac <sleep>:
SYSCALL(sleep)
14ac: b8 0d 00 00 00 mov $0xd,%eax
14b1: cd 40 int $0x40
14b3: c3 ret
000014b4 <uptime>:
SYSCALL(uptime)
14b4: b8 0e 00 00 00 mov $0xe,%eax
14b9: cd 40 int $0x40
14bb: c3 ret
000014bc <clone>:
SYSCALL(clone)
14bc: b8 16 00 00 00 mov $0x16,%eax
14c1: cd 40 int $0x40
14c3: c3 ret
000014c4 <texit>:
SYSCALL(texit)
14c4: b8 17 00 00 00 mov $0x17,%eax
14c9: cd 40 int $0x40
14cb: c3 ret
000014cc <tsleep>:
SYSCALL(tsleep)
14cc: b8 18 00 00 00 mov $0x18,%eax
14d1: cd 40 int $0x40
14d3: c3 ret
000014d4 <twakeup>:
SYSCALL(twakeup)
14d4: b8 19 00 00 00 mov $0x19,%eax
14d9: cd 40 int $0x40
14db: c3 ret
000014dc <thread_yield>:
SYSCALL(thread_yield)
14dc: b8 1a 00 00 00 mov $0x1a,%eax
14e1: cd 40 int $0x40
14e3: c3 ret
000014e4 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
14e4: 55 push %ebp
14e5: 89 e5 mov %esp,%ebp
14e7: 83 ec 18 sub $0x18,%esp
14ea: 8b 45 0c mov 0xc(%ebp),%eax
14ed: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
14f0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
14f7: 00
14f8: 8d 45 f4 lea -0xc(%ebp),%eax
14fb: 89 44 24 04 mov %eax,0x4(%esp)
14ff: 8b 45 08 mov 0x8(%ebp),%eax
1502: 89 04 24 mov %eax,(%esp)
1505: e8 32 ff ff ff call 143c <write>
}
150a: c9 leave
150b: c3 ret
0000150c <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
150c: 55 push %ebp
150d: 89 e5 mov %esp,%ebp
150f: 56 push %esi
1510: 53 push %ebx
1511: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
1514: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
151b: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
151f: 74 17 je 1538 <printint+0x2c>
1521: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
1525: 79 11 jns 1538 <printint+0x2c>
neg = 1;
1527: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
152e: 8b 45 0c mov 0xc(%ebp),%eax
1531: f7 d8 neg %eax
1533: 89 45 ec mov %eax,-0x14(%ebp)
1536: eb 06 jmp 153e <printint+0x32>
} else {
x = xx;
1538: 8b 45 0c mov 0xc(%ebp),%eax
153b: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
153e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
1545: 8b 4d f4 mov -0xc(%ebp),%ecx
1548: 8d 41 01 lea 0x1(%ecx),%eax
154b: 89 45 f4 mov %eax,-0xc(%ebp)
154e: 8b 5d 10 mov 0x10(%ebp),%ebx
1551: 8b 45 ec mov -0x14(%ebp),%eax
1554: ba 00 00 00 00 mov $0x0,%edx
1559: f7 f3 div %ebx
155b: 89 d0 mov %edx,%eax
155d: 0f b6 80 e0 1f 00 00 movzbl 0x1fe0(%eax),%eax
1564: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
1568: 8b 75 10 mov 0x10(%ebp),%esi
156b: 8b 45 ec mov -0x14(%ebp),%eax
156e: ba 00 00 00 00 mov $0x0,%edx
1573: f7 f6 div %esi
1575: 89 45 ec mov %eax,-0x14(%ebp)
1578: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
157c: 75 c7 jne 1545 <printint+0x39>
if(neg)
157e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
1582: 74 10 je 1594 <printint+0x88>
buf[i++] = '-';
1584: 8b 45 f4 mov -0xc(%ebp),%eax
1587: 8d 50 01 lea 0x1(%eax),%edx
158a: 89 55 f4 mov %edx,-0xc(%ebp)
158d: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
1592: eb 1f jmp 15b3 <printint+0xa7>
1594: eb 1d jmp 15b3 <printint+0xa7>
putc(fd, buf[i]);
1596: 8d 55 dc lea -0x24(%ebp),%edx
1599: 8b 45 f4 mov -0xc(%ebp),%eax
159c: 01 d0 add %edx,%eax
159e: 0f b6 00 movzbl (%eax),%eax
15a1: 0f be c0 movsbl %al,%eax
15a4: 89 44 24 04 mov %eax,0x4(%esp)
15a8: 8b 45 08 mov 0x8(%ebp),%eax
15ab: 89 04 24 mov %eax,(%esp)
15ae: e8 31 ff ff ff call 14e4 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
15b3: 83 6d f4 01 subl $0x1,-0xc(%ebp)
15b7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
15bb: 79 d9 jns 1596 <printint+0x8a>
putc(fd, buf[i]);
}
15bd: 83 c4 30 add $0x30,%esp
15c0: 5b pop %ebx
15c1: 5e pop %esi
15c2: 5d pop %ebp
15c3: c3 ret
000015c4 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
15c4: 55 push %ebp
15c5: 89 e5 mov %esp,%ebp
15c7: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
15ca: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
15d1: 8d 45 0c lea 0xc(%ebp),%eax
15d4: 83 c0 04 add $0x4,%eax
15d7: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
15da: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
15e1: e9 7c 01 00 00 jmp 1762 <printf+0x19e>
c = fmt[i] & 0xff;
15e6: 8b 55 0c mov 0xc(%ebp),%edx
15e9: 8b 45 f0 mov -0x10(%ebp),%eax
15ec: 01 d0 add %edx,%eax
15ee: 0f b6 00 movzbl (%eax),%eax
15f1: 0f be c0 movsbl %al,%eax
15f4: 25 ff 00 00 00 and $0xff,%eax
15f9: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
15fc: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1600: 75 2c jne 162e <printf+0x6a>
if(c == '%'){
1602: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
1606: 75 0c jne 1614 <printf+0x50>
state = '%';
1608: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
160f: e9 4a 01 00 00 jmp 175e <printf+0x19a>
} else {
putc(fd, c);
1614: 8b 45 e4 mov -0x1c(%ebp),%eax
1617: 0f be c0 movsbl %al,%eax
161a: 89 44 24 04 mov %eax,0x4(%esp)
161e: 8b 45 08 mov 0x8(%ebp),%eax
1621: 89 04 24 mov %eax,(%esp)
1624: e8 bb fe ff ff call 14e4 <putc>
1629: e9 30 01 00 00 jmp 175e <printf+0x19a>
}
} else if(state == '%'){
162e: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
1632: 0f 85 26 01 00 00 jne 175e <printf+0x19a>
if(c == 'd'){
1638: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
163c: 75 2d jne 166b <printf+0xa7>
printint(fd, *ap, 10, 1);
163e: 8b 45 e8 mov -0x18(%ebp),%eax
1641: 8b 00 mov (%eax),%eax
1643: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
164a: 00
164b: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
1652: 00
1653: 89 44 24 04 mov %eax,0x4(%esp)
1657: 8b 45 08 mov 0x8(%ebp),%eax
165a: 89 04 24 mov %eax,(%esp)
165d: e8 aa fe ff ff call 150c <printint>
ap++;
1662: 83 45 e8 04 addl $0x4,-0x18(%ebp)
1666: e9 ec 00 00 00 jmp 1757 <printf+0x193>
} else if(c == 'x' || c == 'p'){
166b: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
166f: 74 06 je 1677 <printf+0xb3>
1671: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
1675: 75 2d jne 16a4 <printf+0xe0>
printint(fd, *ap, 16, 0);
1677: 8b 45 e8 mov -0x18(%ebp),%eax
167a: 8b 00 mov (%eax),%eax
167c: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
1683: 00
1684: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
168b: 00
168c: 89 44 24 04 mov %eax,0x4(%esp)
1690: 8b 45 08 mov 0x8(%ebp),%eax
1693: 89 04 24 mov %eax,(%esp)
1696: e8 71 fe ff ff call 150c <printint>
ap++;
169b: 83 45 e8 04 addl $0x4,-0x18(%ebp)
169f: e9 b3 00 00 00 jmp 1757 <printf+0x193>
} else if(c == 's'){
16a4: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
16a8: 75 45 jne 16ef <printf+0x12b>
s = (char*)*ap;
16aa: 8b 45 e8 mov -0x18(%ebp),%eax
16ad: 8b 00 mov (%eax),%eax
16af: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
16b2: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
16b6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
16ba: 75 09 jne 16c5 <printf+0x101>
s = "(null)";
16bc: c7 45 f4 28 1c 00 00 movl $0x1c28,-0xc(%ebp)
while(*s != 0){
16c3: eb 1e jmp 16e3 <printf+0x11f>
16c5: eb 1c jmp 16e3 <printf+0x11f>
putc(fd, *s);
16c7: 8b 45 f4 mov -0xc(%ebp),%eax
16ca: 0f b6 00 movzbl (%eax),%eax
16cd: 0f be c0 movsbl %al,%eax
16d0: 89 44 24 04 mov %eax,0x4(%esp)
16d4: 8b 45 08 mov 0x8(%ebp),%eax
16d7: 89 04 24 mov %eax,(%esp)
16da: e8 05 fe ff ff call 14e4 <putc>
s++;
16df: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
16e3: 8b 45 f4 mov -0xc(%ebp),%eax
16e6: 0f b6 00 movzbl (%eax),%eax
16e9: 84 c0 test %al,%al
16eb: 75 da jne 16c7 <printf+0x103>
16ed: eb 68 jmp 1757 <printf+0x193>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
16ef: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
16f3: 75 1d jne 1712 <printf+0x14e>
putc(fd, *ap);
16f5: 8b 45 e8 mov -0x18(%ebp),%eax
16f8: 8b 00 mov (%eax),%eax
16fa: 0f be c0 movsbl %al,%eax
16fd: 89 44 24 04 mov %eax,0x4(%esp)
1701: 8b 45 08 mov 0x8(%ebp),%eax
1704: 89 04 24 mov %eax,(%esp)
1707: e8 d8 fd ff ff call 14e4 <putc>
ap++;
170c: 83 45 e8 04 addl $0x4,-0x18(%ebp)
1710: eb 45 jmp 1757 <printf+0x193>
} else if(c == '%'){
1712: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
1716: 75 17 jne 172f <printf+0x16b>
putc(fd, c);
1718: 8b 45 e4 mov -0x1c(%ebp),%eax
171b: 0f be c0 movsbl %al,%eax
171e: 89 44 24 04 mov %eax,0x4(%esp)
1722: 8b 45 08 mov 0x8(%ebp),%eax
1725: 89 04 24 mov %eax,(%esp)
1728: e8 b7 fd ff ff call 14e4 <putc>
172d: eb 28 jmp 1757 <printf+0x193>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
172f: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
1736: 00
1737: 8b 45 08 mov 0x8(%ebp),%eax
173a: 89 04 24 mov %eax,(%esp)
173d: e8 a2 fd ff ff call 14e4 <putc>
putc(fd, c);
1742: 8b 45 e4 mov -0x1c(%ebp),%eax
1745: 0f be c0 movsbl %al,%eax
1748: 89 44 24 04 mov %eax,0x4(%esp)
174c: 8b 45 08 mov 0x8(%ebp),%eax
174f: 89 04 24 mov %eax,(%esp)
1752: e8 8d fd ff ff call 14e4 <putc>
}
state = 0;
1757: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
175e: 83 45 f0 01 addl $0x1,-0x10(%ebp)
1762: 8b 55 0c mov 0xc(%ebp),%edx
1765: 8b 45 f0 mov -0x10(%ebp),%eax
1768: 01 d0 add %edx,%eax
176a: 0f b6 00 movzbl (%eax),%eax
176d: 84 c0 test %al,%al
176f: 0f 85 71 fe ff ff jne 15e6 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
1775: c9 leave
1776: c3 ret
1777: 90 nop
00001778 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
1778: 55 push %ebp
1779: 89 e5 mov %esp,%ebp
177b: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
177e: 8b 45 08 mov 0x8(%ebp),%eax
1781: 83 e8 08 sub $0x8,%eax
1784: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
1787: a1 00 20 00 00 mov 0x2000,%eax
178c: 89 45 fc mov %eax,-0x4(%ebp)
178f: eb 24 jmp 17b5 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
1791: 8b 45 fc mov -0x4(%ebp),%eax
1794: 8b 00 mov (%eax),%eax
1796: 3b 45 fc cmp -0x4(%ebp),%eax
1799: 77 12 ja 17ad <free+0x35>
179b: 8b 45 f8 mov -0x8(%ebp),%eax
179e: 3b 45 fc cmp -0x4(%ebp),%eax
17a1: 77 24 ja 17c7 <free+0x4f>
17a3: 8b 45 fc mov -0x4(%ebp),%eax
17a6: 8b 00 mov (%eax),%eax
17a8: 3b 45 f8 cmp -0x8(%ebp),%eax
17ab: 77 1a ja 17c7 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
17ad: 8b 45 fc mov -0x4(%ebp),%eax
17b0: 8b 00 mov (%eax),%eax
17b2: 89 45 fc mov %eax,-0x4(%ebp)
17b5: 8b 45 f8 mov -0x8(%ebp),%eax
17b8: 3b 45 fc cmp -0x4(%ebp),%eax
17bb: 76 d4 jbe 1791 <free+0x19>
17bd: 8b 45 fc mov -0x4(%ebp),%eax
17c0: 8b 00 mov (%eax),%eax
17c2: 3b 45 f8 cmp -0x8(%ebp),%eax
17c5: 76 ca jbe 1791 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
17c7: 8b 45 f8 mov -0x8(%ebp),%eax
17ca: 8b 40 04 mov 0x4(%eax),%eax
17cd: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
17d4: 8b 45 f8 mov -0x8(%ebp),%eax
17d7: 01 c2 add %eax,%edx
17d9: 8b 45 fc mov -0x4(%ebp),%eax
17dc: 8b 00 mov (%eax),%eax
17de: 39 c2 cmp %eax,%edx
17e0: 75 24 jne 1806 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
17e2: 8b 45 f8 mov -0x8(%ebp),%eax
17e5: 8b 50 04 mov 0x4(%eax),%edx
17e8: 8b 45 fc mov -0x4(%ebp),%eax
17eb: 8b 00 mov (%eax),%eax
17ed: 8b 40 04 mov 0x4(%eax),%eax
17f0: 01 c2 add %eax,%edx
17f2: 8b 45 f8 mov -0x8(%ebp),%eax
17f5: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
17f8: 8b 45 fc mov -0x4(%ebp),%eax
17fb: 8b 00 mov (%eax),%eax
17fd: 8b 10 mov (%eax),%edx
17ff: 8b 45 f8 mov -0x8(%ebp),%eax
1802: 89 10 mov %edx,(%eax)
1804: eb 0a jmp 1810 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
1806: 8b 45 fc mov -0x4(%ebp),%eax
1809: 8b 10 mov (%eax),%edx
180b: 8b 45 f8 mov -0x8(%ebp),%eax
180e: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
1810: 8b 45 fc mov -0x4(%ebp),%eax
1813: 8b 40 04 mov 0x4(%eax),%eax
1816: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
181d: 8b 45 fc mov -0x4(%ebp),%eax
1820: 01 d0 add %edx,%eax
1822: 3b 45 f8 cmp -0x8(%ebp),%eax
1825: 75 20 jne 1847 <free+0xcf>
p->s.size += bp->s.size;
1827: 8b 45 fc mov -0x4(%ebp),%eax
182a: 8b 50 04 mov 0x4(%eax),%edx
182d: 8b 45 f8 mov -0x8(%ebp),%eax
1830: 8b 40 04 mov 0x4(%eax),%eax
1833: 01 c2 add %eax,%edx
1835: 8b 45 fc mov -0x4(%ebp),%eax
1838: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
183b: 8b 45 f8 mov -0x8(%ebp),%eax
183e: 8b 10 mov (%eax),%edx
1840: 8b 45 fc mov -0x4(%ebp),%eax
1843: 89 10 mov %edx,(%eax)
1845: eb 08 jmp 184f <free+0xd7>
} else
p->s.ptr = bp;
1847: 8b 45 fc mov -0x4(%ebp),%eax
184a: 8b 55 f8 mov -0x8(%ebp),%edx
184d: 89 10 mov %edx,(%eax)
freep = p;
184f: 8b 45 fc mov -0x4(%ebp),%eax
1852: a3 00 20 00 00 mov %eax,0x2000
}
1857: c9 leave
1858: c3 ret
00001859 <morecore>:
static Header*
morecore(uint nu)
{
1859: 55 push %ebp
185a: 89 e5 mov %esp,%ebp
185c: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
185f: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
1866: 77 07 ja 186f <morecore+0x16>
nu = 4096;
1868: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
186f: 8b 45 08 mov 0x8(%ebp),%eax
1872: c1 e0 03 shl $0x3,%eax
1875: 89 04 24 mov %eax,(%esp)
1878: e8 27 fc ff ff call 14a4 <sbrk>
187d: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
1880: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
1884: 75 07 jne 188d <morecore+0x34>
return 0;
1886: b8 00 00 00 00 mov $0x0,%eax
188b: eb 22 jmp 18af <morecore+0x56>
hp = (Header*)p;
188d: 8b 45 f4 mov -0xc(%ebp),%eax
1890: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
1893: 8b 45 f0 mov -0x10(%ebp),%eax
1896: 8b 55 08 mov 0x8(%ebp),%edx
1899: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
189c: 8b 45 f0 mov -0x10(%ebp),%eax
189f: 83 c0 08 add $0x8,%eax
18a2: 89 04 24 mov %eax,(%esp)
18a5: e8 ce fe ff ff call 1778 <free>
return freep;
18aa: a1 00 20 00 00 mov 0x2000,%eax
}
18af: c9 leave
18b0: c3 ret
000018b1 <malloc>:
void*
malloc(uint nbytes)
{
18b1: 55 push %ebp
18b2: 89 e5 mov %esp,%ebp
18b4: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
18b7: 8b 45 08 mov 0x8(%ebp),%eax
18ba: 83 c0 07 add $0x7,%eax
18bd: c1 e8 03 shr $0x3,%eax
18c0: 83 c0 01 add $0x1,%eax
18c3: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
18c6: a1 00 20 00 00 mov 0x2000,%eax
18cb: 89 45 f0 mov %eax,-0x10(%ebp)
18ce: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
18d2: 75 23 jne 18f7 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
18d4: c7 45 f0 f8 1f 00 00 movl $0x1ff8,-0x10(%ebp)
18db: 8b 45 f0 mov -0x10(%ebp),%eax
18de: a3 00 20 00 00 mov %eax,0x2000
18e3: a1 00 20 00 00 mov 0x2000,%eax
18e8: a3 f8 1f 00 00 mov %eax,0x1ff8
base.s.size = 0;
18ed: c7 05 fc 1f 00 00 00 movl $0x0,0x1ffc
18f4: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
18f7: 8b 45 f0 mov -0x10(%ebp),%eax
18fa: 8b 00 mov (%eax),%eax
18fc: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
18ff: 8b 45 f4 mov -0xc(%ebp),%eax
1902: 8b 40 04 mov 0x4(%eax),%eax
1905: 3b 45 ec cmp -0x14(%ebp),%eax
1908: 72 4d jb 1957 <malloc+0xa6>
if(p->s.size == nunits)
190a: 8b 45 f4 mov -0xc(%ebp),%eax
190d: 8b 40 04 mov 0x4(%eax),%eax
1910: 3b 45 ec cmp -0x14(%ebp),%eax
1913: 75 0c jne 1921 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
1915: 8b 45 f4 mov -0xc(%ebp),%eax
1918: 8b 10 mov (%eax),%edx
191a: 8b 45 f0 mov -0x10(%ebp),%eax
191d: 89 10 mov %edx,(%eax)
191f: eb 26 jmp 1947 <malloc+0x96>
else {
p->s.size -= nunits;
1921: 8b 45 f4 mov -0xc(%ebp),%eax
1924: 8b 40 04 mov 0x4(%eax),%eax
1927: 2b 45 ec sub -0x14(%ebp),%eax
192a: 89 c2 mov %eax,%edx
192c: 8b 45 f4 mov -0xc(%ebp),%eax
192f: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
1932: 8b 45 f4 mov -0xc(%ebp),%eax
1935: 8b 40 04 mov 0x4(%eax),%eax
1938: c1 e0 03 shl $0x3,%eax
193b: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
193e: 8b 45 f4 mov -0xc(%ebp),%eax
1941: 8b 55 ec mov -0x14(%ebp),%edx
1944: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
1947: 8b 45 f0 mov -0x10(%ebp),%eax
194a: a3 00 20 00 00 mov %eax,0x2000
return (void*)(p + 1);
194f: 8b 45 f4 mov -0xc(%ebp),%eax
1952: 83 c0 08 add $0x8,%eax
1955: eb 38 jmp 198f <malloc+0xde>
}
if(p == freep)
1957: a1 00 20 00 00 mov 0x2000,%eax
195c: 39 45 f4 cmp %eax,-0xc(%ebp)
195f: 75 1b jne 197c <malloc+0xcb>
if((p = morecore(nunits)) == 0)
1961: 8b 45 ec mov -0x14(%ebp),%eax
1964: 89 04 24 mov %eax,(%esp)
1967: e8 ed fe ff ff call 1859 <morecore>
196c: 89 45 f4 mov %eax,-0xc(%ebp)
196f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1973: 75 07 jne 197c <malloc+0xcb>
return 0;
1975: b8 00 00 00 00 mov $0x0,%eax
197a: eb 13 jmp 198f <malloc+0xde>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
197c: 8b 45 f4 mov -0xc(%ebp),%eax
197f: 89 45 f0 mov %eax,-0x10(%ebp)
1982: 8b 45 f4 mov -0xc(%ebp),%eax
1985: 8b 00 mov (%eax),%eax
1987: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
198a: e9 70 ff ff ff jmp 18ff <malloc+0x4e>
}
198f: c9 leave
1990: c3 ret
1991: 66 90 xchg %ax,%ax
1993: 90 nop
00001994 <xchg>:
asm volatile("sti");
}
static inline uint
xchg(volatile uint *addr, uint newval)
{
1994: 55 push %ebp
1995: 89 e5 mov %esp,%ebp
1997: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
199a: 8b 55 08 mov 0x8(%ebp),%edx
199d: 8b 45 0c mov 0xc(%ebp),%eax
19a0: 8b 4d 08 mov 0x8(%ebp),%ecx
19a3: f0 87 02 lock xchg %eax,(%edx)
19a6: 89 45 fc mov %eax,-0x4(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
19a9: 8b 45 fc mov -0x4(%ebp),%eax
}
19ac: c9 leave
19ad: c3 ret
000019ae <lock_init>:
#include "x86.h"
#include "proc.h"
unsigned long rands = 1;
void lock_init(lock_t *lock){
19ae: 55 push %ebp
19af: 89 e5 mov %esp,%ebp
lock->locked = 0;
19b1: 8b 45 08 mov 0x8(%ebp),%eax
19b4: c7 00 00 00 00 00 movl $0x0,(%eax)
}
19ba: 5d pop %ebp
19bb: c3 ret
000019bc <lock_acquire>:
void lock_acquire(lock_t *lock){
19bc: 55 push %ebp
19bd: 89 e5 mov %esp,%ebp
19bf: 83 ec 08 sub $0x8,%esp
while(xchg(&lock->locked,1) != 0);
19c2: 90 nop
19c3: 8b 45 08 mov 0x8(%ebp),%eax
19c6: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
19cd: 00
19ce: 89 04 24 mov %eax,(%esp)
19d1: e8 be ff ff ff call 1994 <xchg>
19d6: 85 c0 test %eax,%eax
19d8: 75 e9 jne 19c3 <lock_acquire+0x7>
}
19da: c9 leave
19db: c3 ret
000019dc <lock_release>:
void lock_release(lock_t *lock){
19dc: 55 push %ebp
19dd: 89 e5 mov %esp,%ebp
19df: 83 ec 08 sub $0x8,%esp
xchg(&lock->locked,0);
19e2: 8b 45 08 mov 0x8(%ebp),%eax
19e5: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
19ec: 00
19ed: 89 04 24 mov %eax,(%esp)
19f0: e8 9f ff ff ff call 1994 <xchg>
}
19f5: c9 leave
19f6: c3 ret
000019f7 <thread_create>:
void *thread_create(void(*start_routine)(void*), void *arg){
19f7: 55 push %ebp
19f8: 89 e5 mov %esp,%ebp
19fa: 83 ec 28 sub $0x28,%esp
int tid;
void * stack = malloc(2 * 4096);
19fd: c7 04 24 00 20 00 00 movl $0x2000,(%esp)
1a04: e8 a8 fe ff ff call 18b1 <malloc>
1a09: 89 45 f4 mov %eax,-0xc(%ebp)
void *garbage_stack = stack;
1a0c: 8b 45 f4 mov -0xc(%ebp),%eax
1a0f: 89 45 f0 mov %eax,-0x10(%ebp)
// printf(1,"start routine addr : %d\n",(uint)start_routine);
if((uint)stack % 4096){
1a12: 8b 45 f4 mov -0xc(%ebp),%eax
1a15: 25 ff 0f 00 00 and $0xfff,%eax
1a1a: 85 c0 test %eax,%eax
1a1c: 74 14 je 1a32 <thread_create+0x3b>
stack = stack + (4096 - (uint)stack % 4096);
1a1e: 8b 45 f4 mov -0xc(%ebp),%eax
1a21: 25 ff 0f 00 00 and $0xfff,%eax
1a26: 89 c2 mov %eax,%edx
1a28: b8 00 10 00 00 mov $0x1000,%eax
1a2d: 29 d0 sub %edx,%eax
1a2f: 01 45 f4 add %eax,-0xc(%ebp)
}
if (stack == 0){
1a32: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1a36: 75 1b jne 1a53 <thread_create+0x5c>
printf(1,"malloc fail \n");
1a38: c7 44 24 04 2f 1c 00 movl $0x1c2f,0x4(%esp)
1a3f: 00
1a40: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1a47: e8 78 fb ff ff call 15c4 <printf>
return 0;
1a4c: b8 00 00 00 00 mov $0x0,%eax
1a51: eb 6f jmp 1ac2 <thread_create+0xcb>
}
tid = clone((uint)stack,PSIZE,(uint)start_routine,(int)arg);
1a53: 8b 4d 0c mov 0xc(%ebp),%ecx
1a56: 8b 55 08 mov 0x8(%ebp),%edx
1a59: 8b 45 f4 mov -0xc(%ebp),%eax
1a5c: 89 4c 24 0c mov %ecx,0xc(%esp)
1a60: 89 54 24 08 mov %edx,0x8(%esp)
1a64: c7 44 24 04 00 10 00 movl $0x1000,0x4(%esp)
1a6b: 00
1a6c: 89 04 24 mov %eax,(%esp)
1a6f: e8 48 fa ff ff call 14bc <clone>
1a74: 89 45 ec mov %eax,-0x14(%ebp)
if(tid < 0){
1a77: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1a7b: 79 1b jns 1a98 <thread_create+0xa1>
printf(1,"clone fails\n");
1a7d: c7 44 24 04 3d 1c 00 movl $0x1c3d,0x4(%esp)
1a84: 00
1a85: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1a8c: e8 33 fb ff ff call 15c4 <printf>
return 0;
1a91: b8 00 00 00 00 mov $0x0,%eax
1a96: eb 2a jmp 1ac2 <thread_create+0xcb>
}
if(tid > 0){
1a98: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1a9c: 7e 05 jle 1aa3 <thread_create+0xac>
//store threads on thread table
return garbage_stack;
1a9e: 8b 45 f0 mov -0x10(%ebp),%eax
1aa1: eb 1f jmp 1ac2 <thread_create+0xcb>
}
if(tid == 0){
1aa3: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1aa7: 75 14 jne 1abd <thread_create+0xc6>
printf(1,"tid = 0 return \n");
1aa9: c7 44 24 04 4a 1c 00 movl $0x1c4a,0x4(%esp)
1ab0: 00
1ab1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ab8: e8 07 fb ff ff call 15c4 <printf>
}
// wait();
// free(garbage_stack);
return 0;
1abd: b8 00 00 00 00 mov $0x0,%eax
}
1ac2: c9 leave
1ac3: c3 ret
00001ac4 <random>:
// generate 0 -> max random number exclude max.
int random(int max){
1ac4: 55 push %ebp
1ac5: 89 e5 mov %esp,%ebp
rands = rands * 1664525 + 1013904233;
1ac7: a1 f4 1f 00 00 mov 0x1ff4,%eax
1acc: 69 c0 0d 66 19 00 imul $0x19660d,%eax,%eax
1ad2: 05 69 f3 6e 3c add $0x3c6ef369,%eax
1ad7: a3 f4 1f 00 00 mov %eax,0x1ff4
return (int)(rands % max);
1adc: a1 f4 1f 00 00 mov 0x1ff4,%eax
1ae1: 8b 4d 08 mov 0x8(%ebp),%ecx
1ae4: ba 00 00 00 00 mov $0x0,%edx
1ae9: f7 f1 div %ecx
1aeb: 89 d0 mov %edx,%eax
}
1aed: 5d pop %ebp
1aee: c3 ret
1aef: 90 nop
00001af0 <init_q>:
#include "queue.h"
#include "types.h"
#include "user.h"
void init_q(struct queue *q){
1af0: 55 push %ebp
1af1: 89 e5 mov %esp,%ebp
q->size = 0;
1af3: 8b 45 08 mov 0x8(%ebp),%eax
1af6: c7 00 00 00 00 00 movl $0x0,(%eax)
q->head = 0;
1afc: 8b 45 08 mov 0x8(%ebp),%eax
1aff: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
q->tail = 0;
1b06: 8b 45 08 mov 0x8(%ebp),%eax
1b09: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
1b10: 5d pop %ebp
1b11: c3 ret
00001b12 <add_q>:
void add_q(struct queue *q, int v){
1b12: 55 push %ebp
1b13: 89 e5 mov %esp,%ebp
1b15: 83 ec 28 sub $0x28,%esp
struct node * n = malloc(sizeof(struct node));
1b18: c7 04 24 08 00 00 00 movl $0x8,(%esp)
1b1f: e8 8d fd ff ff call 18b1 <malloc>
1b24: 89 45 f4 mov %eax,-0xc(%ebp)
n->next = 0;
1b27: 8b 45 f4 mov -0xc(%ebp),%eax
1b2a: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
n->value = v;
1b31: 8b 45 f4 mov -0xc(%ebp),%eax
1b34: 8b 55 0c mov 0xc(%ebp),%edx
1b37: 89 10 mov %edx,(%eax)
if(q->head == 0){
1b39: 8b 45 08 mov 0x8(%ebp),%eax
1b3c: 8b 40 04 mov 0x4(%eax),%eax
1b3f: 85 c0 test %eax,%eax
1b41: 75 0b jne 1b4e <add_q+0x3c>
q->head = n;
1b43: 8b 45 08 mov 0x8(%ebp),%eax
1b46: 8b 55 f4 mov -0xc(%ebp),%edx
1b49: 89 50 04 mov %edx,0x4(%eax)
1b4c: eb 0c jmp 1b5a <add_q+0x48>
}else{
q->tail->next = n;
1b4e: 8b 45 08 mov 0x8(%ebp),%eax
1b51: 8b 40 08 mov 0x8(%eax),%eax
1b54: 8b 55 f4 mov -0xc(%ebp),%edx
1b57: 89 50 04 mov %edx,0x4(%eax)
}
q->tail = n;
1b5a: 8b 45 08 mov 0x8(%ebp),%eax
1b5d: 8b 55 f4 mov -0xc(%ebp),%edx
1b60: 89 50 08 mov %edx,0x8(%eax)
q->size++;
1b63: 8b 45 08 mov 0x8(%ebp),%eax
1b66: 8b 00 mov (%eax),%eax
1b68: 8d 50 01 lea 0x1(%eax),%edx
1b6b: 8b 45 08 mov 0x8(%ebp),%eax
1b6e: 89 10 mov %edx,(%eax)
}
1b70: c9 leave
1b71: c3 ret
00001b72 <empty_q>:
int empty_q(struct queue *q){
1b72: 55 push %ebp
1b73: 89 e5 mov %esp,%ebp
if(q->size == 0)
1b75: 8b 45 08 mov 0x8(%ebp),%eax
1b78: 8b 00 mov (%eax),%eax
1b7a: 85 c0 test %eax,%eax
1b7c: 75 07 jne 1b85 <empty_q+0x13>
return 1;
1b7e: b8 01 00 00 00 mov $0x1,%eax
1b83: eb 05 jmp 1b8a <empty_q+0x18>
else
return 0;
1b85: b8 00 00 00 00 mov $0x0,%eax
}
1b8a: 5d pop %ebp
1b8b: c3 ret
00001b8c <pop_q>:
int pop_q(struct queue *q){
1b8c: 55 push %ebp
1b8d: 89 e5 mov %esp,%ebp
1b8f: 83 ec 28 sub $0x28,%esp
int val;
struct node *destroy;
if(!empty_q(q)){
1b92: 8b 45 08 mov 0x8(%ebp),%eax
1b95: 89 04 24 mov %eax,(%esp)
1b98: e8 d5 ff ff ff call 1b72 <empty_q>
1b9d: 85 c0 test %eax,%eax
1b9f: 75 5d jne 1bfe <pop_q+0x72>
val = q->head->value;
1ba1: 8b 45 08 mov 0x8(%ebp),%eax
1ba4: 8b 40 04 mov 0x4(%eax),%eax
1ba7: 8b 00 mov (%eax),%eax
1ba9: 89 45 f4 mov %eax,-0xc(%ebp)
destroy = q->head;
1bac: 8b 45 08 mov 0x8(%ebp),%eax
1baf: 8b 40 04 mov 0x4(%eax),%eax
1bb2: 89 45 f0 mov %eax,-0x10(%ebp)
q->head = q->head->next;
1bb5: 8b 45 08 mov 0x8(%ebp),%eax
1bb8: 8b 40 04 mov 0x4(%eax),%eax
1bbb: 8b 50 04 mov 0x4(%eax),%edx
1bbe: 8b 45 08 mov 0x8(%ebp),%eax
1bc1: 89 50 04 mov %edx,0x4(%eax)
free(destroy);
1bc4: 8b 45 f0 mov -0x10(%ebp),%eax
1bc7: 89 04 24 mov %eax,(%esp)
1bca: e8 a9 fb ff ff call 1778 <free>
q->size--;
1bcf: 8b 45 08 mov 0x8(%ebp),%eax
1bd2: 8b 00 mov (%eax),%eax
1bd4: 8d 50 ff lea -0x1(%eax),%edx
1bd7: 8b 45 08 mov 0x8(%ebp),%eax
1bda: 89 10 mov %edx,(%eax)
if(q->size == 0){
1bdc: 8b 45 08 mov 0x8(%ebp),%eax
1bdf: 8b 00 mov (%eax),%eax
1be1: 85 c0 test %eax,%eax
1be3: 75 14 jne 1bf9 <pop_q+0x6d>
q->head = 0;
1be5: 8b 45 08 mov 0x8(%ebp),%eax
1be8: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
q->tail = 0;
1bef: 8b 45 08 mov 0x8(%ebp),%eax
1bf2: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
return val;
1bf9: 8b 45 f4 mov -0xc(%ebp),%eax
1bfc: eb 05 jmp 1c03 <pop_q+0x77>
}
return -1;
1bfe: b8 ff ff ff ff mov $0xffffffff,%eax
}
1c03: c9 leave
1c04: c3 ret
|
P6/data_P6_2/MDTest52.asm | alxzzhou/BUAA_CO_2020 | 1 | 16170 | <filename>P6/data_P6_2/MDTest52.asm
ori $ra,$ra,0xf
div $4,$ra
sll $6,$1,22
sb $5,14($0)
mult $5,$4
addu $4,$4,$2
lui $5,30477
mthi $3
lui $1,7599
multu $5,$5
multu $3,$4
mthi $3
mtlo $0
ori $5,$4,25195
mflo $1
mfhi $4
lb $6,11($0)
srav $2,$4,$2
mfhi $4
addiu $6,$2,-17947
sll $5,$1,31
mfhi $2
divu $5,$ra
ori $2,$5,38631
divu $1,$ra
addu $0,$0,$2
mthi $4
divu $5,$ra
mflo $4
addu $2,$2,$0
srav $4,$0,$3
lb $3,16($0)
divu $6,$ra
addiu $3,$3,-28645
mthi $6
srav $1,$5,$3
divu $4,$ra
divu $1,$ra
divu $5,$ra
sb $1,2($0)
divu $4,$ra
multu $4,$5
mflo $1
mfhi $1
multu $1,$5
sb $4,15($0)
div $4,$ra
srav $5,$5,$4
divu $1,$ra
lui $5,41980
addu $1,$2,$2
sb $5,3($0)
srav $0,$0,$0
sll $5,$2,0
divu $2,$ra
lui $4,49868
mthi $1
sb $4,0($0)
ori $1,$1,47436
mult $2,$2
sll $4,$1,8
lui $5,1301
mthi $2
ori $5,$2,49651
mfhi $5
lb $4,16($0)
srav $5,$1,$1
div $4,$ra
lui $1,1787
mflo $6
divu $1,$ra
mfhi $4
mtlo $5
sb $6,4($0)
addiu $5,$1,29074
multu $5,$4
mfhi $4
mthi $4
mthi $4
sb $5,9($0)
mult $1,$1
sll $4,$2,13
srav $5,$3,$3
mthi $2
ori $1,$5,56168
mtlo $5
lb $4,6($0)
srav $5,$1,$4
multu $0,$5
lui $5,35672
sb $4,13($0)
mfhi $6
sb $5,9($0)
sll $3,$1,16
addiu $5,$4,15110
multu $5,$4
lui $5,13896
mfhi $5
mtlo $1
multu $4,$2
ori $5,$4,13104
mthi $5
addiu $1,$1,-15574
mthi $6
sll $4,$6,1
div $6,$ra
addu $2,$1,$2
multu $5,$5
sll $4,$2,26
div $5,$ra
divu $5,$ra
srav $4,$4,$4
mfhi $1
addiu $5,$5,-6033
lb $0,15($0)
mthi $4
divu $5,$ra
mthi $4
addiu $2,$2,-22378
div $2,$ra
addu $4,$0,$4
mflo $1
mult $2,$2
mtlo $3
mthi $4
sll $1,$5,2
addu $4,$5,$4
srav $6,$6,$6
sll $6,$6,19
mult $5,$5
divu $1,$ra
div $4,$ra
sb $4,0($0)
addu $1,$1,$1
mult $5,$0
mfhi $3
addiu $5,$4,-14607
mult $0,$0
mtlo $5
divu $3,$ra
sb $1,4($0)
sll $5,$4,21
mult $4,$5
sll $5,$5,5
mtlo $2
divu $5,$ra
sb $5,2($0)
multu $4,$5
srav $2,$2,$6
sll $5,$4,8
multu $5,$6
mthi $1
addiu $5,$6,5296
addu $0,$5,$1
mflo $6
lb $3,4($0)
mthi $4
mult $3,$1
addiu $5,$3,30859
lui $1,44134
srav $5,$5,$5
sb $4,10($0)
ori $4,$4,1000
sb $4,5($0)
mult $4,$2
lb $1,3($0)
addu $1,$1,$1
mult $5,$4
srav $4,$0,$0
mfhi $3
lui $1,1684
mtlo $4
mthi $2
mtlo $5
mfhi $1
lui $5,1787
lui $4,6535
sll $5,$5,5
ori $5,$4,33183
divu $2,$ra
mfhi $6
mthi $5
mtlo $1
sll $0,$4,7
addu $4,$4,$4
sll $0,$0,18
mtlo $4
addiu $5,$5,29657
mflo $6
div $6,$ra
mthi $3
mthi $1
mflo $0
multu $4,$1
sb $1,4($0)
mfhi $1
div $2,$ra
mfhi $5
lb $6,9($0)
sll $5,$4,14
ori $0,$1,55499
lb $1,1($0)
mfhi $5
mflo $5
ori $4,$2,43209
ori $5,$5,33063
srav $0,$0,$5
addiu $6,$6,2623
sll $4,$4,7
mthi $4
multu $0,$4
sb $4,10($0)
addiu $5,$2,-30382
sb $4,1($0)
addu $4,$6,$5
addu $4,$2,$2
multu $5,$1
lui $6,58779
addiu $4,$5,-26210
divu $1,$ra
lb $5,5($0)
ori $6,$6,34842
lui $1,53279
lui $5,21725
lui $6,25562
sll $5,$5,13
multu $2,$1
lb $1,11($0)
mflo $5
sb $4,11($0)
mflo $4
div $5,$ra
divu $1,$ra
lui $4,11704
sb $5,5($0)
multu $1,$1
addiu $0,$6,-19941
multu $1,$2
addu $5,$1,$1
lui $0,39196
multu $3,$3
mthi $0
mult $1,$6
divu $4,$ra
mult $0,$2
addu $1,$5,$2
mult $0,$4
mtlo $2
lb $2,16($0)
sb $4,0($0)
mthi $0
mfhi $6
sb $1,4($0)
mult $5,$2
sb $6,10($0)
multu $4,$5
mthi $1
addu $3,$2,$3
sll $5,$3,4
ori $1,$2,11387
mflo $6
mtlo $3
addiu $4,$2,-6693
mult $1,$1
divu $6,$ra
mthi $6
lui $5,48429
mult $4,$4
multu $0,$1
srav $4,$4,$4
lui $4,9646
multu $5,$5
divu $6,$ra
ori $2,$2,62971
sll $3,$3,10
addu $0,$4,$5
mtlo $1
mtlo $1
mult $4,$6
lui $2,57517
div $5,$ra
mflo $6
mult $4,$2
mthi $4
lb $5,6($0)
mfhi $4
ori $6,$3,52813
mult $0,$0
addu $1,$5,$4
mflo $5
srav $2,$4,$2
lb $3,1($0)
addiu $1,$2,88
div $3,$ra
divu $5,$ra
mflo $1
mtlo $3
div $4,$ra
div $5,$ra
mflo $3
addu $4,$4,$4
sll $5,$2,21
mflo $1
mult $1,$1
divu $2,$ra
addu $4,$1,$5
sll $2,$2,7
ori $2,$0,13841
ori $6,$0,40185
ori $2,$2,64237
srav $5,$5,$5
mtlo $4
sll $4,$4,26
mflo $6
mtlo $5
multu $3,$5
mtlo $5
divu $4,$ra
addiu $4,$2,28950
ori $5,$2,25612
divu $6,$ra
lui $6,35741
mtlo $6
sb $5,0($0)
divu $6,$ra
multu $1,$4
lb $1,12($0)
addiu $5,$6,32111
sb $5,1($0)
addiu $1,$2,14073
lui $4,36409
multu $3,$2
sll $5,$5,28
addiu $4,$0,-4039
mfhi $2
lui $1,47999
ori $4,$0,64333
mtlo $4
div $6,$ra
ori $6,$5,25744
ori $4,$1,37106
srav $6,$3,$3
mthi $2
lui $5,26544
mult $3,$3
sll $1,$4,19
multu $1,$5
lb $3,0($0)
srav $2,$2,$2
sll $4,$2,6
sll $4,$4,4
lb $3,10($0)
mthi $4
mfhi $6
mfhi $6
lui $4,19931
sll $0,$4,29
mfhi $4
addu $4,$1,$4
mfhi $4
mult $2,$2
addiu $5,$6,16916
ori $4,$4,37942
ori $0,$0,45513
div $5,$ra
mtlo $1
addu $2,$2,$2
mult $1,$4
mthi $4
sll $4,$2,21
ori $0,$0,60492
ori $6,$2,28235
sll $6,$4,26
ori $4,$4,42992
lui $1,14615
lui $0,6418
divu $4,$ra
mflo $4
mtlo $0
mult $0,$4
multu $6,$6
mthi $5
mfhi $4
multu $4,$6
addiu $3,$1,18603
sll $4,$4,21
multu $3,$3
mult $2,$2
srav $5,$5,$5
mtlo $1
sb $6,0($0)
mult $4,$2
mfhi $5
srav $5,$5,$5
srav $1,$4,$4
mult $1,$5
mult $5,$1
addiu $3,$3,-24460
div $1,$ra
ori $1,$1,28078
lb $6,8($0)
addu $4,$4,$2
ori $2,$2,56843
addu $5,$1,$5
div $1,$ra
lui $4,1590
addiu $2,$1,5700
mflo $4
sb $3,3($0)
mtlo $5
ori $2,$2,11475
mthi $1
mult $6,$2
mfhi $6
addiu $1,$4,-10295
srav $5,$4,$6
multu $0,$1
multu $5,$2
div $5,$ra
mtlo $4
lb $4,11($0)
sb $4,4($0)
sb $2,14($0)
mult $0,$4
multu $1,$5
mfhi $5
mthi $1
ori $5,$4,48676
addu $6,$2,$1
sll $3,$3,21
mfhi $1
divu $3,$ra
mflo $1
ori $1,$2,2737
divu $1,$ra
sll $3,$3,30
mflo $1
addiu $4,$0,26998
lui $4,33655
sb $3,7($0)
mtlo $4
mfhi $4
mtlo $1
sb $4,3($0)
multu $4,$4
mthi $5
mthi $2
srav $2,$2,$2
div $1,$ra
mfhi $4
div $1,$ra
lui $5,19867
divu $4,$ra
ori $5,$3,8393
ori $0,$5,45922
addu $1,$5,$1
divu $5,$ra
divu $1,$ra
ori $4,$5,17319
sll $4,$2,23
mfhi $1
mthi $6
div $2,$ra
ori $1,$2,61066
multu $3,$3
mult $1,$0
sb $4,1($0)
lb $5,14($0)
mflo $4
mtlo $1
mthi $5
multu $4,$2
sll $4,$1,18
mtlo $1
lui $1,35019
addiu $4,$4,9804
multu $6,$0
div $1,$ra
mult $0,$1
mthi $1
mthi $5
srav $4,$2,$4
addu $4,$4,$1
mfhi $6
lb $6,12($0)
mflo $5
mthi $4
mflo $2
multu $6,$2
mthi $4
lb $4,11($0)
multu $1,$1
srav $4,$1,$4
ori $0,$0,30269
mult $4,$2
mfhi $4
mtlo $4
srav $4,$2,$2
divu $6,$ra
srav $1,$4,$4
ori $4,$2,37111
lui $2,55874
div $5,$ra
addiu $1,$2,19173
addiu $2,$2,-30781
srav $5,$4,$4
addiu $6,$2,9095
addiu $4,$4,-13678
mflo $4
lui $4,32962
ori $2,$2,637
mult $4,$2
mthi $6
multu $4,$4
addu $1,$4,$4
addiu $4,$6,-13107
divu $4,$ra
addu $1,$1,$2
div $4,$ra
mfhi $0
mfhi $2
addiu $3,$1,-19892
div $5,$ra
sll $4,$4,22
ori $2,$2,34865
addiu $1,$2,3584
divu $6,$ra
ori $6,$0,64031
srav $0,$0,$4
mult $5,$0
addiu $2,$2,-4790
addiu $1,$1,30331
ori $2,$2,13049
sll $4,$6,24
addu $4,$4,$4
mflo $5
multu $3,$3
mflo $5
ori $4,$4,15881
mtlo $4
ori $6,$4,1481
multu $4,$4
mult $1,$1
sll $4,$2,1
addiu $3,$3,-21991
div $5,$ra
mtlo $0
sll $6,$5,15
div $3,$ra
mflo $1
addu $5,$0,$1
addiu $4,$4,19578
mflo $4
divu $6,$ra
sll $5,$5,3
div $0,$ra
lb $4,5($0)
mflo $6
addiu $4,$2,26498
addu $1,$6,$5
sb $1,6($0)
div $6,$ra
ori $4,$1,250
srav $5,$1,$5
ori $2,$2,18780
div $6,$ra
mthi $3
sll $5,$2,2
multu $1,$1
mtlo $4
mthi $4
div $5,$ra
mtlo $5
multu $5,$4
ori $4,$4,62536
mflo $3
mult $6,$2
mfhi $6
sll $3,$3,23
div $5,$ra
lui $1,9274
srav $1,$5,$4
addu $2,$2,$6
sll $1,$6,31
addiu $1,$1,-9053
div $1,$ra
lb $2,15($0)
ori $4,$2,23394
srav $3,$3,$3
sll $0,$0,11
sll $0,$0,22
mtlo $5
lb $0,16($0)
mtlo $0
ori $1,$0,50708
sb $1,5($0)
sll $4,$4,23
multu $0,$4
multu $4,$4
addiu $5,$1,-11792
mult $5,$4
addu $4,$0,$4
mflo $3
divu $6,$ra
sll $2,$5,20
addu $6,$1,$5
div $4,$ra
mthi $1
div $6,$ra
addiu $5,$5,-29045
multu $5,$5
mfhi $3
mthi $1
mflo $4
mtlo $3
addu $5,$2,$2
mult $4,$2
mfhi $5
div $1,$ra
sb $4,11($0)
lb $4,16($0)
addiu $1,$1,-25978
multu $0,$5
lb $1,14($0)
mthi $4
mthi $3
lui $4,40311
addiu $5,$5,-16829
ori $1,$1,22700
mfhi $2
multu $4,$1
multu $5,$0
lui $2,64996
sb $0,0($0)
addu $2,$2,$2
mflo $5
divu $5,$ra
addiu $1,$1,-10928
srav $1,$4,$1
mthi $6
mult $4,$2
mthi $0
div $4,$ra
mthi $1
addiu $2,$2,-18822
addiu $2,$5,6502
mult $5,$4
mflo $6
div $5,$ra
mflo $4
mult $6,$4
addu $0,$5,$0
lb $4,8($0)
ori $4,$2,48848
addu $1,$1,$3
mflo $1
sll $3,$3,22
addu $5,$4,$2
multu $3,$1
mfhi $4
sb $1,0($0)
lb $4,7($0)
mtlo $1
mfhi $4
addiu $4,$4,10267
lb $2,7($0)
mult $3,$5
sb $3,16($0)
sb $6,11($0)
addiu $5,$1,-9571
sb $4,12($0)
mult $3,$4
lb $4,12($0)
divu $4,$ra
mtlo $2
addu $4,$4,$4
mflo $3
sb $4,3($0)
lb $1,16($0)
div $5,$ra
mult $1,$1
addu $1,$4,$5
div $6,$ra
multu $1,$2
mult $3,$3
mult $5,$1
addu $1,$5,$2
srav $2,$2,$2
mfhi $0
srav $5,$2,$4
mtlo $4
srav $3,$1,$3
mult $1,$2
addiu $1,$4,-7090
mtlo $5
mflo $0
div $1,$ra
sb $1,8($0)
lb $1,3($0)
sb $4,3($0)
lui $4,47862
div $4,$ra
mflo $1
srav $1,$1,$3
mtlo $2
mflo $4
multu $0,$0
addiu $1,$2,27759
addiu $4,$4,31539
mfhi $6
mtlo $0
sb $1,2($0)
mflo $1
lui $4,48536
mult $4,$4
divu $4,$ra
mtlo $3
div $0,$ra
mflo $5
divu $4,$ra
mtlo $2
addu $4,$2,$3
mult $5,$6
srav $4,$2,$4
addiu $1,$3,25599
lb $1,3($0)
lb $5,6($0)
addiu $6,$3,25072
mfhi $4
lui $6,36778
sb $5,6($0)
lui $5,5286
sb $4,16($0)
mult $1,$1
addu $4,$4,$4
mthi $4
addu $3,$4,$3
sb $5,4($0)
mflo $0
lb $5,4($0)
addiu $5,$1,17826
mthi $4
mult $4,$4
addiu $4,$5,-8096
mult $1,$5
mthi $4
div $4,$ra
div $3,$ra
sll $1,$1,12
mflo $0
mthi $1
mfhi $5
mthi $1
multu $5,$2
ori $4,$5,63235
ori $4,$4,21842
sll $1,$0,8
sll $1,$2,0
srav $1,$0,$4
div $1,$ra
mult $5,$5
div $6,$ra
mult $5,$1
addiu $6,$4,-32614
addu $5,$3,$3
lui $5,61107
mthi $3
lui $0,12861
mtlo $0
lui $1,15349
lb $5,12($0)
srav $0,$0,$1
mult $0,$3
div $0,$ra
addu $2,$1,$2
mflo $5
sb $4,1($0)
addiu $1,$1,-16838
sll $1,$1,6
addiu $2,$2,-23499
mfhi $6
addiu $5,$5,-6663
addu $6,$4,$4
lui $0,42395
mtlo $0
addiu $5,$2,23112
addiu $6,$6,-25531
div $1,$ra
mflo $2
srav $1,$1,$4
ori $5,$4,45904
mfhi $1
srav $3,$2,$3
div $4,$ra
srav $0,$2,$5
sb $6,6($0)
addu $6,$1,$2
mult $0,$3
addu $5,$3,$3
divu $3,$ra
lb $2,9($0)
div $3,$ra
addiu $4,$4,30928
addu $4,$1,$1
ori $4,$4,4435
sll $1,$5,5
addu $5,$0,$4
divu $0,$ra
divu $5,$ra
lb $4,7($0)
sb $4,1($0)
srav $0,$4,$4
mflo $4
mthi $4
ori $5,$5,39581
mthi $6
mfhi $4
sll $5,$1,6
srav $0,$4,$4
mtlo $1
sb $6,3($0)
mflo $4
addu $4,$4,$4
mfhi $5
sb $0,15($0)
srav $6,$0,$3
mthi $4
ori $4,$2,62357
lb $4,5($0)
lb $2,10($0)
mflo $4
sb $1,10($0)
mthi $1
mult $1,$4
mflo $4
ori $5,$3,52289
mflo $4
divu $1,$ra
lui $0,8897
mthi $2
sll $4,$0,19
mfhi $1
addiu $4,$4,-4439
sll $5,$4,21
addiu $5,$4,-17649
mthi $4
addiu $4,$4,-2362
srav $2,$2,$2
lui $4,38050
sll $4,$0,24
div $6,$ra
div $5,$ra
sb $5,6($0)
div $1,$ra
addiu $1,$2,15365
sll $5,$2,6
multu $2,$2
srav $4,$2,$1
div $5,$ra
lui $2,61617
srav $6,$0,$4
mult $2,$2
mtlo $4
sll $4,$4,23
sb $1,9($0)
mfhi $1
addiu $4,$5,14146
divu $4,$ra
divu $4,$ra
sb $4,8($0)
sb $4,14($0)
srav $0,$3,$3
addiu $5,$1,-1031
ori $4,$1,18602
sll $4,$2,15
divu $5,$ra
mfhi $0
addu $5,$3,$3
div $6,$ra
mflo $4
divu $5,$ra
addu $4,$5,$1
lb $3,0($0)
lb $1,14($0)
divu $6,$ra
sll $4,$5,11
mtlo $1
sb $2,11($0)
multu $4,$1
|
xv6-pdx/date.asm | budiwa/CS333 | 0 | 5981 | <gh_stars>0
_date: file format elf32-i386
Disassembly of section .text:
00000000 <dayofweek>:
static char *days[] = {"Sun", "Mon", "Tue", "Wed",
"Thu", "Fri", "Sat"};
int
dayofweek(int y, int m, int d)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
return (d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7;
4: 83 7d 0c 02 cmpl $0x2,0xc(%ebp)
8: 7f 0b jg 15 <dayofweek+0x15>
a: 8b 45 08 mov 0x8(%ebp),%eax
d: 8d 50 ff lea -0x1(%eax),%edx
10: 89 55 08 mov %edx,0x8(%ebp)
13: eb 06 jmp 1b <dayofweek+0x1b>
15: 8b 45 08 mov 0x8(%ebp),%eax
18: 83 e8 02 sub $0x2,%eax
1b: 01 45 10 add %eax,0x10(%ebp)
1e: 8b 45 0c mov 0xc(%ebp),%eax
21: 6b c8 17 imul $0x17,%eax,%ecx
24: ba 39 8e e3 38 mov $0x38e38e39,%edx
29: 89 c8 mov %ecx,%eax
2b: f7 ea imul %edx
2d: d1 fa sar %edx
2f: 89 c8 mov %ecx,%eax
31: c1 f8 1f sar $0x1f,%eax
34: 29 c2 sub %eax,%edx
36: 8b 45 10 mov 0x10(%ebp),%eax
39: 01 d0 add %edx,%eax
3b: 8d 48 04 lea 0x4(%eax),%ecx
3e: 8b 45 08 mov 0x8(%ebp),%eax
41: 8d 50 03 lea 0x3(%eax),%edx
44: 85 c0 test %eax,%eax
46: 0f 48 c2 cmovs %edx,%eax
49: c1 f8 02 sar $0x2,%eax
4c: 8d 1c 01 lea (%ecx,%eax,1),%ebx
4f: 8b 4d 08 mov 0x8(%ebp),%ecx
52: ba 1f 85 eb 51 mov $0x51eb851f,%edx
57: 89 c8 mov %ecx,%eax
59: f7 ea imul %edx
5b: c1 fa 05 sar $0x5,%edx
5e: 89 c8 mov %ecx,%eax
60: c1 f8 1f sar $0x1f,%eax
63: 29 c2 sub %eax,%edx
65: 89 d0 mov %edx,%eax
67: 29 c3 sub %eax,%ebx
69: 8b 4d 08 mov 0x8(%ebp),%ecx
6c: ba 1f 85 eb 51 mov $0x51eb851f,%edx
71: 89 c8 mov %ecx,%eax
73: f7 ea imul %edx
75: c1 fa 07 sar $0x7,%edx
78: 89 c8 mov %ecx,%eax
7a: c1 f8 1f sar $0x1f,%eax
7d: 29 c2 sub %eax,%edx
7f: 89 d0 mov %edx,%eax
81: 8d 0c 03 lea (%ebx,%eax,1),%ecx
84: ba 93 24 49 92 mov $0x92492493,%edx
89: 89 c8 mov %ecx,%eax
8b: f7 ea imul %edx
8d: 8d 04 0a lea (%edx,%ecx,1),%eax
90: c1 f8 02 sar $0x2,%eax
93: 89 c2 mov %eax,%edx
95: 89 c8 mov %ecx,%eax
97: c1 f8 1f sar $0x1f,%eax
9a: 29 c2 sub %eax,%edx
9c: 89 d0 mov %edx,%eax
9e: 89 c2 mov %eax,%edx
a0: c1 e2 03 shl $0x3,%edx
a3: 29 c2 sub %eax,%edx
a5: 89 c8 mov %ecx,%eax
a7: 29 d0 sub %edx,%eax
}
a9: 5b pop %ebx
aa: 5d pop %ebp
ab: c3 ret
000000ac <main>:
int
main(int argc, char *argv[])
{
ac: 8d 4c 24 04 lea 0x4(%esp),%ecx
b0: 83 e4 f0 and $0xfffffff0,%esp
b3: ff 71 fc pushl -0x4(%ecx)
b6: 55 push %ebp
b7: 89 e5 mov %esp,%ebp
b9: 51 push %ecx
ba: 83 ec 24 sub $0x24,%esp
int day;
struct rtcdate r;
if (date(&r)) {
bd: 83 ec 0c sub $0xc,%esp
c0: 8d 45 dc lea -0x24(%ebp),%eax
c3: 50 push %eax
c4: e8 e6 04 00 00 call 5af <date>
c9: 83 c4 10 add $0x10,%esp
cc: 85 c0 test %eax,%eax
ce: 74 1b je eb <main+0x3f>
printf(2,"Error: date call failed. %s at line %d\n",
d0: 6a 1c push $0x1c
d2: 68 e5 0a 00 00 push $0xae5
d7: 68 ec 0a 00 00 push $0xaec
dc: 6a 02 push $0x2
de: e8 fb 05 00 00 call 6de <printf>
e3: 83 c4 10 add $0x10,%esp
__FILE__, __LINE__);
exit();
e6: e8 1c 04 00 00 call 507 <exit>
}
day = dayofweek(r.year, r.month, r.day);
eb: 8b 45 e8 mov -0x18(%ebp),%eax
ee: 89 c1 mov %eax,%ecx
f0: 8b 45 ec mov -0x14(%ebp),%eax
f3: 89 c2 mov %eax,%edx
f5: 8b 45 f0 mov -0x10(%ebp),%eax
f8: 83 ec 04 sub $0x4,%esp
fb: 51 push %ecx
fc: 52 push %edx
fd: 50 push %eax
fe: e8 fd fe ff ff call 0 <dayofweek>
103: 83 c4 10 add $0x10,%esp
106: 89 45 f4 mov %eax,-0xc(%ebp)
printf(1, "%s %s %d", days[day], months[r.month], r.day);
109: 8b 4d e8 mov -0x18(%ebp),%ecx
10c: 8b 45 ec mov -0x14(%ebp),%eax
10f: 8b 14 85 e0 0d 00 00 mov 0xde0(,%eax,4),%edx
116: 8b 45 f4 mov -0xc(%ebp),%eax
119: 8b 04 85 14 0e 00 00 mov 0xe14(,%eax,4),%eax
120: 83 ec 0c sub $0xc,%esp
123: 51 push %ecx
124: 52 push %edx
125: 50 push %eax
126: 68 14 0b 00 00 push $0xb14
12b: 6a 01 push $0x1
12d: e8 ac 05 00 00 call 6de <printf>
132: 83 c4 20 add $0x20,%esp
printf(1, " ");
135: 83 ec 08 sub $0x8,%esp
138: 68 1d 0b 00 00 push $0xb1d
13d: 6a 01 push $0x1
13f: e8 9a 05 00 00 call 6de <printf>
144: 83 c4 10 add $0x10,%esp
if (r.hour < 10) printf(1, "0");
147: 8b 45 e4 mov -0x1c(%ebp),%eax
14a: 83 f8 09 cmp $0x9,%eax
14d: 77 12 ja 161 <main+0xb5>
14f: 83 ec 08 sub $0x8,%esp
152: 68 1f 0b 00 00 push $0xb1f
157: 6a 01 push $0x1
159: e8 80 05 00 00 call 6de <printf>
15e: 83 c4 10 add $0x10,%esp
printf(1, "%d:", r.hour);
161: 8b 45 e4 mov -0x1c(%ebp),%eax
164: 83 ec 04 sub $0x4,%esp
167: 50 push %eax
168: 68 21 0b 00 00 push $0xb21
16d: 6a 01 push $0x1
16f: e8 6a 05 00 00 call 6de <printf>
174: 83 c4 10 add $0x10,%esp
if (r.minute < 10) printf(1, "0");
177: 8b 45 e0 mov -0x20(%ebp),%eax
17a: 83 f8 09 cmp $0x9,%eax
17d: 77 12 ja 191 <main+0xe5>
17f: 83 ec 08 sub $0x8,%esp
182: 68 1f 0b 00 00 push $0xb1f
187: 6a 01 push $0x1
189: e8 50 05 00 00 call 6de <printf>
18e: 83 c4 10 add $0x10,%esp
printf(1, "%d:", r.minute);
191: 8b 45 e0 mov -0x20(%ebp),%eax
194: 83 ec 04 sub $0x4,%esp
197: 50 push %eax
198: 68 21 0b 00 00 push $0xb21
19d: 6a 01 push $0x1
19f: e8 3a 05 00 00 call 6de <printf>
1a4: 83 c4 10 add $0x10,%esp
if (r.second < 10) printf(1, "0");
1a7: 8b 45 dc mov -0x24(%ebp),%eax
1aa: 83 f8 09 cmp $0x9,%eax
1ad: 77 12 ja 1c1 <main+0x115>
1af: 83 ec 08 sub $0x8,%esp
1b2: 68 1f 0b 00 00 push $0xb1f
1b7: 6a 01 push $0x1
1b9: e8 20 05 00 00 call 6de <printf>
1be: 83 c4 10 add $0x10,%esp
printf(1, "%d UTC %d\n", r.second, r.year);
1c1: 8b 55 f0 mov -0x10(%ebp),%edx
1c4: 8b 45 dc mov -0x24(%ebp),%eax
1c7: 52 push %edx
1c8: 50 push %eax
1c9: 68 25 0b 00 00 push $0xb25
1ce: 6a 01 push $0x1
1d0: e8 09 05 00 00 call 6de <printf>
1d5: 83 c4 10 add $0x10,%esp
exit();
1d8: e8 2a 03 00 00 call 507 <exit>
000001dd <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
1dd: 55 push %ebp
1de: 89 e5 mov %esp,%ebp
1e0: 57 push %edi
1e1: 53 push %ebx
asm volatile("cld; rep stosb" :
1e2: 8b 4d 08 mov 0x8(%ebp),%ecx
1e5: 8b 55 10 mov 0x10(%ebp),%edx
1e8: 8b 45 0c mov 0xc(%ebp),%eax
1eb: 89 cb mov %ecx,%ebx
1ed: 89 df mov %ebx,%edi
1ef: 89 d1 mov %edx,%ecx
1f1: fc cld
1f2: f3 aa rep stos %al,%es:(%edi)
1f4: 89 ca mov %ecx,%edx
1f6: 89 fb mov %edi,%ebx
1f8: 89 5d 08 mov %ebx,0x8(%ebp)
1fb: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
1fe: 90 nop
1ff: 5b pop %ebx
200: 5f pop %edi
201: 5d pop %ebp
202: c3 ret
00000203 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
203: 55 push %ebp
204: 89 e5 mov %esp,%ebp
206: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
209: 8b 45 08 mov 0x8(%ebp),%eax
20c: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
20f: 90 nop
210: 8b 45 08 mov 0x8(%ebp),%eax
213: 8d 50 01 lea 0x1(%eax),%edx
216: 89 55 08 mov %edx,0x8(%ebp)
219: 8b 55 0c mov 0xc(%ebp),%edx
21c: 8d 4a 01 lea 0x1(%edx),%ecx
21f: 89 4d 0c mov %ecx,0xc(%ebp)
222: 0f b6 12 movzbl (%edx),%edx
225: 88 10 mov %dl,(%eax)
227: 0f b6 00 movzbl (%eax),%eax
22a: 84 c0 test %al,%al
22c: 75 e2 jne 210 <strcpy+0xd>
;
return os;
22e: 8b 45 fc mov -0x4(%ebp),%eax
}
231: c9 leave
232: c3 ret
00000233 <strcmp>:
int
strcmp(const char *p, const char *q)
{
233: 55 push %ebp
234: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
236: eb 08 jmp 240 <strcmp+0xd>
p++, q++;
238: 83 45 08 01 addl $0x1,0x8(%ebp)
23c: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
240: 8b 45 08 mov 0x8(%ebp),%eax
243: 0f b6 00 movzbl (%eax),%eax
246: 84 c0 test %al,%al
248: 74 10 je 25a <strcmp+0x27>
24a: 8b 45 08 mov 0x8(%ebp),%eax
24d: 0f b6 10 movzbl (%eax),%edx
250: 8b 45 0c mov 0xc(%ebp),%eax
253: 0f b6 00 movzbl (%eax),%eax
256: 38 c2 cmp %al,%dl
258: 74 de je 238 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
25a: 8b 45 08 mov 0x8(%ebp),%eax
25d: 0f b6 00 movzbl (%eax),%eax
260: 0f b6 d0 movzbl %al,%edx
263: 8b 45 0c mov 0xc(%ebp),%eax
266: 0f b6 00 movzbl (%eax),%eax
269: 0f b6 c0 movzbl %al,%eax
26c: 29 c2 sub %eax,%edx
26e: 89 d0 mov %edx,%eax
}
270: 5d pop %ebp
271: c3 ret
00000272 <strlen>:
uint
strlen(char *s)
{
272: 55 push %ebp
273: 89 e5 mov %esp,%ebp
275: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
278: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
27f: eb 04 jmp 285 <strlen+0x13>
281: 83 45 fc 01 addl $0x1,-0x4(%ebp)
285: 8b 55 fc mov -0x4(%ebp),%edx
288: 8b 45 08 mov 0x8(%ebp),%eax
28b: 01 d0 add %edx,%eax
28d: 0f b6 00 movzbl (%eax),%eax
290: 84 c0 test %al,%al
292: 75 ed jne 281 <strlen+0xf>
;
return n;
294: 8b 45 fc mov -0x4(%ebp),%eax
}
297: c9 leave
298: c3 ret
00000299 <memset>:
void*
memset(void *dst, int c, uint n)
{
299: 55 push %ebp
29a: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
29c: 8b 45 10 mov 0x10(%ebp),%eax
29f: 50 push %eax
2a0: ff 75 0c pushl 0xc(%ebp)
2a3: ff 75 08 pushl 0x8(%ebp)
2a6: e8 32 ff ff ff call 1dd <stosb>
2ab: 83 c4 0c add $0xc,%esp
return dst;
2ae: 8b 45 08 mov 0x8(%ebp),%eax
}
2b1: c9 leave
2b2: c3 ret
000002b3 <strchr>:
char*
strchr(const char *s, char c)
{
2b3: 55 push %ebp
2b4: 89 e5 mov %esp,%ebp
2b6: 83 ec 04 sub $0x4,%esp
2b9: 8b 45 0c mov 0xc(%ebp),%eax
2bc: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
2bf: eb 14 jmp 2d5 <strchr+0x22>
if(*s == c)
2c1: 8b 45 08 mov 0x8(%ebp),%eax
2c4: 0f b6 00 movzbl (%eax),%eax
2c7: 3a 45 fc cmp -0x4(%ebp),%al
2ca: 75 05 jne 2d1 <strchr+0x1e>
return (char*)s;
2cc: 8b 45 08 mov 0x8(%ebp),%eax
2cf: eb 13 jmp 2e4 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
2d1: 83 45 08 01 addl $0x1,0x8(%ebp)
2d5: 8b 45 08 mov 0x8(%ebp),%eax
2d8: 0f b6 00 movzbl (%eax),%eax
2db: 84 c0 test %al,%al
2dd: 75 e2 jne 2c1 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
2df: b8 00 00 00 00 mov $0x0,%eax
}
2e4: c9 leave
2e5: c3 ret
000002e6 <gets>:
char*
gets(char *buf, int max)
{
2e6: 55 push %ebp
2e7: 89 e5 mov %esp,%ebp
2e9: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
2ec: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
2f3: eb 42 jmp 337 <gets+0x51>
cc = read(0, &c, 1);
2f5: 83 ec 04 sub $0x4,%esp
2f8: 6a 01 push $0x1
2fa: 8d 45 ef lea -0x11(%ebp),%eax
2fd: 50 push %eax
2fe: 6a 00 push $0x0
300: e8 1a 02 00 00 call 51f <read>
305: 83 c4 10 add $0x10,%esp
308: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
30b: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
30f: 7e 33 jle 344 <gets+0x5e>
break;
buf[i++] = c;
311: 8b 45 f4 mov -0xc(%ebp),%eax
314: 8d 50 01 lea 0x1(%eax),%edx
317: 89 55 f4 mov %edx,-0xc(%ebp)
31a: 89 c2 mov %eax,%edx
31c: 8b 45 08 mov 0x8(%ebp),%eax
31f: 01 c2 add %eax,%edx
321: 0f b6 45 ef movzbl -0x11(%ebp),%eax
325: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
327: 0f b6 45 ef movzbl -0x11(%ebp),%eax
32b: 3c 0a cmp $0xa,%al
32d: 74 16 je 345 <gets+0x5f>
32f: 0f b6 45 ef movzbl -0x11(%ebp),%eax
333: 3c 0d cmp $0xd,%al
335: 74 0e je 345 <gets+0x5f>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
337: 8b 45 f4 mov -0xc(%ebp),%eax
33a: 83 c0 01 add $0x1,%eax
33d: 3b 45 0c cmp 0xc(%ebp),%eax
340: 7c b3 jl 2f5 <gets+0xf>
342: eb 01 jmp 345 <gets+0x5f>
cc = read(0, &c, 1);
if(cc < 1)
break;
344: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
345: 8b 55 f4 mov -0xc(%ebp),%edx
348: 8b 45 08 mov 0x8(%ebp),%eax
34b: 01 d0 add %edx,%eax
34d: c6 00 00 movb $0x0,(%eax)
return buf;
350: 8b 45 08 mov 0x8(%ebp),%eax
}
353: c9 leave
354: c3 ret
00000355 <stat>:
int
stat(char *n, struct stat *st)
{
355: 55 push %ebp
356: 89 e5 mov %esp,%ebp
358: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
35b: 83 ec 08 sub $0x8,%esp
35e: 6a 00 push $0x0
360: ff 75 08 pushl 0x8(%ebp)
363: e8 df 01 00 00 call 547 <open>
368: 83 c4 10 add $0x10,%esp
36b: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
36e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
372: 79 07 jns 37b <stat+0x26>
return -1;
374: b8 ff ff ff ff mov $0xffffffff,%eax
379: eb 25 jmp 3a0 <stat+0x4b>
r = fstat(fd, st);
37b: 83 ec 08 sub $0x8,%esp
37e: ff 75 0c pushl 0xc(%ebp)
381: ff 75 f4 pushl -0xc(%ebp)
384: e8 d6 01 00 00 call 55f <fstat>
389: 83 c4 10 add $0x10,%esp
38c: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
38f: 83 ec 0c sub $0xc,%esp
392: ff 75 f4 pushl -0xc(%ebp)
395: e8 95 01 00 00 call 52f <close>
39a: 83 c4 10 add $0x10,%esp
return r;
39d: 8b 45 f0 mov -0x10(%ebp),%eax
}
3a0: c9 leave
3a1: c3 ret
000003a2 <atoi>:
int
atoi(const char *s)
{
3a2: 55 push %ebp
3a3: 89 e5 mov %esp,%ebp
3a5: 83 ec 10 sub $0x10,%esp
int n, sign;
n = 0;
3a8: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while (*s == ' ') s++;
3af: eb 04 jmp 3b5 <atoi+0x13>
3b1: 83 45 08 01 addl $0x1,0x8(%ebp)
3b5: 8b 45 08 mov 0x8(%ebp),%eax
3b8: 0f b6 00 movzbl (%eax),%eax
3bb: 3c 20 cmp $0x20,%al
3bd: 74 f2 je 3b1 <atoi+0xf>
sign = (*s == '-') ? -1 : 1;
3bf: 8b 45 08 mov 0x8(%ebp),%eax
3c2: 0f b6 00 movzbl (%eax),%eax
3c5: 3c 2d cmp $0x2d,%al
3c7: 75 07 jne 3d0 <atoi+0x2e>
3c9: b8 ff ff ff ff mov $0xffffffff,%eax
3ce: eb 05 jmp 3d5 <atoi+0x33>
3d0: b8 01 00 00 00 mov $0x1,%eax
3d5: 89 45 f8 mov %eax,-0x8(%ebp)
if (*s == '+' || *s == '-')
3d8: 8b 45 08 mov 0x8(%ebp),%eax
3db: 0f b6 00 movzbl (%eax),%eax
3de: 3c 2b cmp $0x2b,%al
3e0: 74 0a je 3ec <atoi+0x4a>
3e2: 8b 45 08 mov 0x8(%ebp),%eax
3e5: 0f b6 00 movzbl (%eax),%eax
3e8: 3c 2d cmp $0x2d,%al
3ea: 75 2b jne 417 <atoi+0x75>
s++;
3ec: 83 45 08 01 addl $0x1,0x8(%ebp)
while('0' <= *s && *s <= '9')
3f0: eb 25 jmp 417 <atoi+0x75>
n = n*10 + *s++ - '0';
3f2: 8b 55 fc mov -0x4(%ebp),%edx
3f5: 89 d0 mov %edx,%eax
3f7: c1 e0 02 shl $0x2,%eax
3fa: 01 d0 add %edx,%eax
3fc: 01 c0 add %eax,%eax
3fe: 89 c1 mov %eax,%ecx
400: 8b 45 08 mov 0x8(%ebp),%eax
403: 8d 50 01 lea 0x1(%eax),%edx
406: 89 55 08 mov %edx,0x8(%ebp)
409: 0f b6 00 movzbl (%eax),%eax
40c: 0f be c0 movsbl %al,%eax
40f: 01 c8 add %ecx,%eax
411: 83 e8 30 sub $0x30,%eax
414: 89 45 fc mov %eax,-0x4(%ebp)
n = 0;
while (*s == ' ') s++;
sign = (*s == '-') ? -1 : 1;
if (*s == '+' || *s == '-')
s++;
while('0' <= *s && *s <= '9')
417: 8b 45 08 mov 0x8(%ebp),%eax
41a: 0f b6 00 movzbl (%eax),%eax
41d: 3c 2f cmp $0x2f,%al
41f: 7e 0a jle 42b <atoi+0x89>
421: 8b 45 08 mov 0x8(%ebp),%eax
424: 0f b6 00 movzbl (%eax),%eax
427: 3c 39 cmp $0x39,%al
429: 7e c7 jle 3f2 <atoi+0x50>
n = n*10 + *s++ - '0';
return sign*n;
42b: 8b 45 f8 mov -0x8(%ebp),%eax
42e: 0f af 45 fc imul -0x4(%ebp),%eax
}
432: c9 leave
433: c3 ret
00000434 <atoo>:
int
atoo(const char *s)
{
434: 55 push %ebp
435: 89 e5 mov %esp,%ebp
437: 83 ec 10 sub $0x10,%esp
int n, sign;
n = 0;
43a: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while (*s == ' ') s++;
441: eb 04 jmp 447 <atoo+0x13>
443: 83 45 08 01 addl $0x1,0x8(%ebp)
447: 8b 45 08 mov 0x8(%ebp),%eax
44a: 0f b6 00 movzbl (%eax),%eax
44d: 3c 20 cmp $0x20,%al
44f: 74 f2 je 443 <atoo+0xf>
sign = (*s == '-') ? -1 : 1;
451: 8b 45 08 mov 0x8(%ebp),%eax
454: 0f b6 00 movzbl (%eax),%eax
457: 3c 2d cmp $0x2d,%al
459: 75 07 jne 462 <atoo+0x2e>
45b: b8 ff ff ff ff mov $0xffffffff,%eax
460: eb 05 jmp 467 <atoo+0x33>
462: b8 01 00 00 00 mov $0x1,%eax
467: 89 45 f8 mov %eax,-0x8(%ebp)
if (*s == '+' || *s == '-')
46a: 8b 45 08 mov 0x8(%ebp),%eax
46d: 0f b6 00 movzbl (%eax),%eax
470: 3c 2b cmp $0x2b,%al
472: 74 0a je 47e <atoo+0x4a>
474: 8b 45 08 mov 0x8(%ebp),%eax
477: 0f b6 00 movzbl (%eax),%eax
47a: 3c 2d cmp $0x2d,%al
47c: 75 27 jne 4a5 <atoo+0x71>
s++;
47e: 83 45 08 01 addl $0x1,0x8(%ebp)
while('0' <= *s && *s <= '7')
482: eb 21 jmp 4a5 <atoo+0x71>
n = n*8 + *s++ - '0';
484: 8b 45 fc mov -0x4(%ebp),%eax
487: 8d 0c c5 00 00 00 00 lea 0x0(,%eax,8),%ecx
48e: 8b 45 08 mov 0x8(%ebp),%eax
491: 8d 50 01 lea 0x1(%eax),%edx
494: 89 55 08 mov %edx,0x8(%ebp)
497: 0f b6 00 movzbl (%eax),%eax
49a: 0f be c0 movsbl %al,%eax
49d: 01 c8 add %ecx,%eax
49f: 83 e8 30 sub $0x30,%eax
4a2: 89 45 fc mov %eax,-0x4(%ebp)
n = 0;
while (*s == ' ') s++;
sign = (*s == '-') ? -1 : 1;
if (*s == '+' || *s == '-')
s++;
while('0' <= *s && *s <= '7')
4a5: 8b 45 08 mov 0x8(%ebp),%eax
4a8: 0f b6 00 movzbl (%eax),%eax
4ab: 3c 2f cmp $0x2f,%al
4ad: 7e 0a jle 4b9 <atoo+0x85>
4af: 8b 45 08 mov 0x8(%ebp),%eax
4b2: 0f b6 00 movzbl (%eax),%eax
4b5: 3c 37 cmp $0x37,%al
4b7: 7e cb jle 484 <atoo+0x50>
n = n*8 + *s++ - '0';
return sign*n;
4b9: 8b 45 f8 mov -0x8(%ebp),%eax
4bc: 0f af 45 fc imul -0x4(%ebp),%eax
}
4c0: c9 leave
4c1: c3 ret
000004c2 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
4c2: 55 push %ebp
4c3: 89 e5 mov %esp,%ebp
4c5: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
4c8: 8b 45 08 mov 0x8(%ebp),%eax
4cb: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
4ce: 8b 45 0c mov 0xc(%ebp),%eax
4d1: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
4d4: eb 17 jmp 4ed <memmove+0x2b>
*dst++ = *src++;
4d6: 8b 45 fc mov -0x4(%ebp),%eax
4d9: 8d 50 01 lea 0x1(%eax),%edx
4dc: 89 55 fc mov %edx,-0x4(%ebp)
4df: 8b 55 f8 mov -0x8(%ebp),%edx
4e2: 8d 4a 01 lea 0x1(%edx),%ecx
4e5: 89 4d f8 mov %ecx,-0x8(%ebp)
4e8: 0f b6 12 movzbl (%edx),%edx
4eb: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
4ed: 8b 45 10 mov 0x10(%ebp),%eax
4f0: 8d 50 ff lea -0x1(%eax),%edx
4f3: 89 55 10 mov %edx,0x10(%ebp)
4f6: 85 c0 test %eax,%eax
4f8: 7f dc jg 4d6 <memmove+0x14>
*dst++ = *src++;
return vdst;
4fa: 8b 45 08 mov 0x8(%ebp),%eax
}
4fd: c9 leave
4fe: c3 ret
000004ff <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
4ff: b8 01 00 00 00 mov $0x1,%eax
504: cd 40 int $0x40
506: c3 ret
00000507 <exit>:
SYSCALL(exit)
507: b8 02 00 00 00 mov $0x2,%eax
50c: cd 40 int $0x40
50e: c3 ret
0000050f <wait>:
SYSCALL(wait)
50f: b8 03 00 00 00 mov $0x3,%eax
514: cd 40 int $0x40
516: c3 ret
00000517 <pipe>:
SYSCALL(pipe)
517: b8 04 00 00 00 mov $0x4,%eax
51c: cd 40 int $0x40
51e: c3 ret
0000051f <read>:
SYSCALL(read)
51f: b8 05 00 00 00 mov $0x5,%eax
524: cd 40 int $0x40
526: c3 ret
00000527 <write>:
SYSCALL(write)
527: b8 10 00 00 00 mov $0x10,%eax
52c: cd 40 int $0x40
52e: c3 ret
0000052f <close>:
SYSCALL(close)
52f: b8 15 00 00 00 mov $0x15,%eax
534: cd 40 int $0x40
536: c3 ret
00000537 <kill>:
SYSCALL(kill)
537: b8 06 00 00 00 mov $0x6,%eax
53c: cd 40 int $0x40
53e: c3 ret
0000053f <exec>:
SYSCALL(exec)
53f: b8 07 00 00 00 mov $0x7,%eax
544: cd 40 int $0x40
546: c3 ret
00000547 <open>:
SYSCALL(open)
547: b8 0f 00 00 00 mov $0xf,%eax
54c: cd 40 int $0x40
54e: c3 ret
0000054f <mknod>:
SYSCALL(mknod)
54f: b8 11 00 00 00 mov $0x11,%eax
554: cd 40 int $0x40
556: c3 ret
00000557 <unlink>:
SYSCALL(unlink)
557: b8 12 00 00 00 mov $0x12,%eax
55c: cd 40 int $0x40
55e: c3 ret
0000055f <fstat>:
SYSCALL(fstat)
55f: b8 08 00 00 00 mov $0x8,%eax
564: cd 40 int $0x40
566: c3 ret
00000567 <link>:
SYSCALL(link)
567: b8 13 00 00 00 mov $0x13,%eax
56c: cd 40 int $0x40
56e: c3 ret
0000056f <mkdir>:
SYSCALL(mkdir)
56f: b8 14 00 00 00 mov $0x14,%eax
574: cd 40 int $0x40
576: c3 ret
00000577 <chdir>:
SYSCALL(chdir)
577: b8 09 00 00 00 mov $0x9,%eax
57c: cd 40 int $0x40
57e: c3 ret
0000057f <dup>:
SYSCALL(dup)
57f: b8 0a 00 00 00 mov $0xa,%eax
584: cd 40 int $0x40
586: c3 ret
00000587 <getpid>:
SYSCALL(getpid)
587: b8 0b 00 00 00 mov $0xb,%eax
58c: cd 40 int $0x40
58e: c3 ret
0000058f <sbrk>:
SYSCALL(sbrk)
58f: b8 0c 00 00 00 mov $0xc,%eax
594: cd 40 int $0x40
596: c3 ret
00000597 <sleep>:
SYSCALL(sleep)
597: b8 0d 00 00 00 mov $0xd,%eax
59c: cd 40 int $0x40
59e: c3 ret
0000059f <uptime>:
SYSCALL(uptime)
59f: b8 0e 00 00 00 mov $0xe,%eax
5a4: cd 40 int $0x40
5a6: c3 ret
000005a7 <halt>:
SYSCALL(halt)
5a7: b8 16 00 00 00 mov $0x16,%eax
5ac: cd 40 int $0x40
5ae: c3 ret
000005af <date>:
SYSCALL(date)
5af: b8 17 00 00 00 mov $0x17,%eax
5b4: cd 40 int $0x40
5b6: c3 ret
000005b7 <getuid>:
SYSCALL(getuid)
5b7: b8 18 00 00 00 mov $0x18,%eax
5bc: cd 40 int $0x40
5be: c3 ret
000005bf <getgid>:
SYSCALL(getgid)
5bf: b8 19 00 00 00 mov $0x19,%eax
5c4: cd 40 int $0x40
5c6: c3 ret
000005c7 <getppid>:
SYSCALL(getppid)
5c7: b8 1a 00 00 00 mov $0x1a,%eax
5cc: cd 40 int $0x40
5ce: c3 ret
000005cf <setuid>:
SYSCALL(setuid)
5cf: b8 1b 00 00 00 mov $0x1b,%eax
5d4: cd 40 int $0x40
5d6: c3 ret
000005d7 <setgid>:
SYSCALL(setgid)
5d7: b8 1c 00 00 00 mov $0x1c,%eax
5dc: cd 40 int $0x40
5de: c3 ret
000005df <getprocs>:
SYSCALL(getprocs)
5df: b8 1d 00 00 00 mov $0x1d,%eax
5e4: cd 40 int $0x40
5e6: c3 ret
000005e7 <setpriority>:
SYSCALL(setpriority)
5e7: b8 1e 00 00 00 mov $0x1e,%eax
5ec: cd 40 int $0x40
5ee: c3 ret
000005ef <chmod>:
SYSCALL(chmod)
5ef: b8 1f 00 00 00 mov $0x1f,%eax
5f4: cd 40 int $0x40
5f6: c3 ret
000005f7 <chown>:
SYSCALL(chown)
5f7: b8 20 00 00 00 mov $0x20,%eax
5fc: cd 40 int $0x40
5fe: c3 ret
000005ff <chgrp>:
SYSCALL(chgrp)
5ff: b8 21 00 00 00 mov $0x21,%eax
604: cd 40 int $0x40
606: c3 ret
00000607 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
607: 55 push %ebp
608: 89 e5 mov %esp,%ebp
60a: 83 ec 18 sub $0x18,%esp
60d: 8b 45 0c mov 0xc(%ebp),%eax
610: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
613: 83 ec 04 sub $0x4,%esp
616: 6a 01 push $0x1
618: 8d 45 f4 lea -0xc(%ebp),%eax
61b: 50 push %eax
61c: ff 75 08 pushl 0x8(%ebp)
61f: e8 03 ff ff ff call 527 <write>
624: 83 c4 10 add $0x10,%esp
}
627: 90 nop
628: c9 leave
629: c3 ret
0000062a <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
62a: 55 push %ebp
62b: 89 e5 mov %esp,%ebp
62d: 53 push %ebx
62e: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
631: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
638: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
63c: 74 17 je 655 <printint+0x2b>
63e: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
642: 79 11 jns 655 <printint+0x2b>
neg = 1;
644: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
64b: 8b 45 0c mov 0xc(%ebp),%eax
64e: f7 d8 neg %eax
650: 89 45 ec mov %eax,-0x14(%ebp)
653: eb 06 jmp 65b <printint+0x31>
} else {
x = xx;
655: 8b 45 0c mov 0xc(%ebp),%eax
658: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
65b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
662: 8b 4d f4 mov -0xc(%ebp),%ecx
665: 8d 41 01 lea 0x1(%ecx),%eax
668: 89 45 f4 mov %eax,-0xc(%ebp)
66b: 8b 5d 10 mov 0x10(%ebp),%ebx
66e: 8b 45 ec mov -0x14(%ebp),%eax
671: ba 00 00 00 00 mov $0x0,%edx
676: f7 f3 div %ebx
678: 89 d0 mov %edx,%eax
67a: 0f b6 80 30 0e 00 00 movzbl 0xe30(%eax),%eax
681: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
685: 8b 5d 10 mov 0x10(%ebp),%ebx
688: 8b 45 ec mov -0x14(%ebp),%eax
68b: ba 00 00 00 00 mov $0x0,%edx
690: f7 f3 div %ebx
692: 89 45 ec mov %eax,-0x14(%ebp)
695: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
699: 75 c7 jne 662 <printint+0x38>
if(neg)
69b: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
69f: 74 2d je 6ce <printint+0xa4>
buf[i++] = '-';
6a1: 8b 45 f4 mov -0xc(%ebp),%eax
6a4: 8d 50 01 lea 0x1(%eax),%edx
6a7: 89 55 f4 mov %edx,-0xc(%ebp)
6aa: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
6af: eb 1d jmp 6ce <printint+0xa4>
putc(fd, buf[i]);
6b1: 8d 55 dc lea -0x24(%ebp),%edx
6b4: 8b 45 f4 mov -0xc(%ebp),%eax
6b7: 01 d0 add %edx,%eax
6b9: 0f b6 00 movzbl (%eax),%eax
6bc: 0f be c0 movsbl %al,%eax
6bf: 83 ec 08 sub $0x8,%esp
6c2: 50 push %eax
6c3: ff 75 08 pushl 0x8(%ebp)
6c6: e8 3c ff ff ff call 607 <putc>
6cb: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
6ce: 83 6d f4 01 subl $0x1,-0xc(%ebp)
6d2: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
6d6: 79 d9 jns 6b1 <printint+0x87>
putc(fd, buf[i]);
}
6d8: 90 nop
6d9: 8b 5d fc mov -0x4(%ebp),%ebx
6dc: c9 leave
6dd: c3 ret
000006de <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
6de: 55 push %ebp
6df: 89 e5 mov %esp,%ebp
6e1: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
6e4: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
6eb: 8d 45 0c lea 0xc(%ebp),%eax
6ee: 83 c0 04 add $0x4,%eax
6f1: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
6f4: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
6fb: e9 59 01 00 00 jmp 859 <printf+0x17b>
c = fmt[i] & 0xff;
700: 8b 55 0c mov 0xc(%ebp),%edx
703: 8b 45 f0 mov -0x10(%ebp),%eax
706: 01 d0 add %edx,%eax
708: 0f b6 00 movzbl (%eax),%eax
70b: 0f be c0 movsbl %al,%eax
70e: 25 ff 00 00 00 and $0xff,%eax
713: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
716: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
71a: 75 2c jne 748 <printf+0x6a>
if(c == '%'){
71c: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
720: 75 0c jne 72e <printf+0x50>
state = '%';
722: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
729: e9 27 01 00 00 jmp 855 <printf+0x177>
} else {
putc(fd, c);
72e: 8b 45 e4 mov -0x1c(%ebp),%eax
731: 0f be c0 movsbl %al,%eax
734: 83 ec 08 sub $0x8,%esp
737: 50 push %eax
738: ff 75 08 pushl 0x8(%ebp)
73b: e8 c7 fe ff ff call 607 <putc>
740: 83 c4 10 add $0x10,%esp
743: e9 0d 01 00 00 jmp 855 <printf+0x177>
}
} else if(state == '%'){
748: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
74c: 0f 85 03 01 00 00 jne 855 <printf+0x177>
if(c == 'd'){
752: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
756: 75 1e jne 776 <printf+0x98>
printint(fd, *ap, 10, 1);
758: 8b 45 e8 mov -0x18(%ebp),%eax
75b: 8b 00 mov (%eax),%eax
75d: 6a 01 push $0x1
75f: 6a 0a push $0xa
761: 50 push %eax
762: ff 75 08 pushl 0x8(%ebp)
765: e8 c0 fe ff ff call 62a <printint>
76a: 83 c4 10 add $0x10,%esp
ap++;
76d: 83 45 e8 04 addl $0x4,-0x18(%ebp)
771: e9 d8 00 00 00 jmp 84e <printf+0x170>
} else if(c == 'x' || c == 'p'){
776: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
77a: 74 06 je 782 <printf+0xa4>
77c: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
780: 75 1e jne 7a0 <printf+0xc2>
printint(fd, *ap, 16, 0);
782: 8b 45 e8 mov -0x18(%ebp),%eax
785: 8b 00 mov (%eax),%eax
787: 6a 00 push $0x0
789: 6a 10 push $0x10
78b: 50 push %eax
78c: ff 75 08 pushl 0x8(%ebp)
78f: e8 96 fe ff ff call 62a <printint>
794: 83 c4 10 add $0x10,%esp
ap++;
797: 83 45 e8 04 addl $0x4,-0x18(%ebp)
79b: e9 ae 00 00 00 jmp 84e <printf+0x170>
} else if(c == 's'){
7a0: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
7a4: 75 43 jne 7e9 <printf+0x10b>
s = (char*)*ap;
7a6: 8b 45 e8 mov -0x18(%ebp),%eax
7a9: 8b 00 mov (%eax),%eax
7ab: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
7ae: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
7b2: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
7b6: 75 25 jne 7dd <printf+0xff>
s = "(null)";
7b8: c7 45 f4 30 0b 00 00 movl $0xb30,-0xc(%ebp)
while(*s != 0){
7bf: eb 1c jmp 7dd <printf+0xff>
putc(fd, *s);
7c1: 8b 45 f4 mov -0xc(%ebp),%eax
7c4: 0f b6 00 movzbl (%eax),%eax
7c7: 0f be c0 movsbl %al,%eax
7ca: 83 ec 08 sub $0x8,%esp
7cd: 50 push %eax
7ce: ff 75 08 pushl 0x8(%ebp)
7d1: e8 31 fe ff ff call 607 <putc>
7d6: 83 c4 10 add $0x10,%esp
s++;
7d9: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
7dd: 8b 45 f4 mov -0xc(%ebp),%eax
7e0: 0f b6 00 movzbl (%eax),%eax
7e3: 84 c0 test %al,%al
7e5: 75 da jne 7c1 <printf+0xe3>
7e7: eb 65 jmp 84e <printf+0x170>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
7e9: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
7ed: 75 1d jne 80c <printf+0x12e>
putc(fd, *ap);
7ef: 8b 45 e8 mov -0x18(%ebp),%eax
7f2: 8b 00 mov (%eax),%eax
7f4: 0f be c0 movsbl %al,%eax
7f7: 83 ec 08 sub $0x8,%esp
7fa: 50 push %eax
7fb: ff 75 08 pushl 0x8(%ebp)
7fe: e8 04 fe ff ff call 607 <putc>
803: 83 c4 10 add $0x10,%esp
ap++;
806: 83 45 e8 04 addl $0x4,-0x18(%ebp)
80a: eb 42 jmp 84e <printf+0x170>
} else if(c == '%'){
80c: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
810: 75 17 jne 829 <printf+0x14b>
putc(fd, c);
812: 8b 45 e4 mov -0x1c(%ebp),%eax
815: 0f be c0 movsbl %al,%eax
818: 83 ec 08 sub $0x8,%esp
81b: 50 push %eax
81c: ff 75 08 pushl 0x8(%ebp)
81f: e8 e3 fd ff ff call 607 <putc>
824: 83 c4 10 add $0x10,%esp
827: eb 25 jmp 84e <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
829: 83 ec 08 sub $0x8,%esp
82c: 6a 25 push $0x25
82e: ff 75 08 pushl 0x8(%ebp)
831: e8 d1 fd ff ff call 607 <putc>
836: 83 c4 10 add $0x10,%esp
putc(fd, c);
839: 8b 45 e4 mov -0x1c(%ebp),%eax
83c: 0f be c0 movsbl %al,%eax
83f: 83 ec 08 sub $0x8,%esp
842: 50 push %eax
843: ff 75 08 pushl 0x8(%ebp)
846: e8 bc fd ff ff call 607 <putc>
84b: 83 c4 10 add $0x10,%esp
}
state = 0;
84e: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
855: 83 45 f0 01 addl $0x1,-0x10(%ebp)
859: 8b 55 0c mov 0xc(%ebp),%edx
85c: 8b 45 f0 mov -0x10(%ebp),%eax
85f: 01 d0 add %edx,%eax
861: 0f b6 00 movzbl (%eax),%eax
864: 84 c0 test %al,%al
866: 0f 85 94 fe ff ff jne 700 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
86c: 90 nop
86d: c9 leave
86e: c3 ret
0000086f <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
86f: 55 push %ebp
870: 89 e5 mov %esp,%ebp
872: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
875: 8b 45 08 mov 0x8(%ebp),%eax
878: 83 e8 08 sub $0x8,%eax
87b: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
87e: a1 4c 0e 00 00 mov 0xe4c,%eax
883: 89 45 fc mov %eax,-0x4(%ebp)
886: eb 24 jmp 8ac <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
888: 8b 45 fc mov -0x4(%ebp),%eax
88b: 8b 00 mov (%eax),%eax
88d: 3b 45 fc cmp -0x4(%ebp),%eax
890: 77 12 ja 8a4 <free+0x35>
892: 8b 45 f8 mov -0x8(%ebp),%eax
895: 3b 45 fc cmp -0x4(%ebp),%eax
898: 77 24 ja 8be <free+0x4f>
89a: 8b 45 fc mov -0x4(%ebp),%eax
89d: 8b 00 mov (%eax),%eax
89f: 3b 45 f8 cmp -0x8(%ebp),%eax
8a2: 77 1a ja 8be <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8a4: 8b 45 fc mov -0x4(%ebp),%eax
8a7: 8b 00 mov (%eax),%eax
8a9: 89 45 fc mov %eax,-0x4(%ebp)
8ac: 8b 45 f8 mov -0x8(%ebp),%eax
8af: 3b 45 fc cmp -0x4(%ebp),%eax
8b2: 76 d4 jbe 888 <free+0x19>
8b4: 8b 45 fc mov -0x4(%ebp),%eax
8b7: 8b 00 mov (%eax),%eax
8b9: 3b 45 f8 cmp -0x8(%ebp),%eax
8bc: 76 ca jbe 888 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
8be: 8b 45 f8 mov -0x8(%ebp),%eax
8c1: 8b 40 04 mov 0x4(%eax),%eax
8c4: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
8cb: 8b 45 f8 mov -0x8(%ebp),%eax
8ce: 01 c2 add %eax,%edx
8d0: 8b 45 fc mov -0x4(%ebp),%eax
8d3: 8b 00 mov (%eax),%eax
8d5: 39 c2 cmp %eax,%edx
8d7: 75 24 jne 8fd <free+0x8e>
bp->s.size += p->s.ptr->s.size;
8d9: 8b 45 f8 mov -0x8(%ebp),%eax
8dc: 8b 50 04 mov 0x4(%eax),%edx
8df: 8b 45 fc mov -0x4(%ebp),%eax
8e2: 8b 00 mov (%eax),%eax
8e4: 8b 40 04 mov 0x4(%eax),%eax
8e7: 01 c2 add %eax,%edx
8e9: 8b 45 f8 mov -0x8(%ebp),%eax
8ec: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
8ef: 8b 45 fc mov -0x4(%ebp),%eax
8f2: 8b 00 mov (%eax),%eax
8f4: 8b 10 mov (%eax),%edx
8f6: 8b 45 f8 mov -0x8(%ebp),%eax
8f9: 89 10 mov %edx,(%eax)
8fb: eb 0a jmp 907 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
8fd: 8b 45 fc mov -0x4(%ebp),%eax
900: 8b 10 mov (%eax),%edx
902: 8b 45 f8 mov -0x8(%ebp),%eax
905: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
907: 8b 45 fc mov -0x4(%ebp),%eax
90a: 8b 40 04 mov 0x4(%eax),%eax
90d: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
914: 8b 45 fc mov -0x4(%ebp),%eax
917: 01 d0 add %edx,%eax
919: 3b 45 f8 cmp -0x8(%ebp),%eax
91c: 75 20 jne 93e <free+0xcf>
p->s.size += bp->s.size;
91e: 8b 45 fc mov -0x4(%ebp),%eax
921: 8b 50 04 mov 0x4(%eax),%edx
924: 8b 45 f8 mov -0x8(%ebp),%eax
927: 8b 40 04 mov 0x4(%eax),%eax
92a: 01 c2 add %eax,%edx
92c: 8b 45 fc mov -0x4(%ebp),%eax
92f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
932: 8b 45 f8 mov -0x8(%ebp),%eax
935: 8b 10 mov (%eax),%edx
937: 8b 45 fc mov -0x4(%ebp),%eax
93a: 89 10 mov %edx,(%eax)
93c: eb 08 jmp 946 <free+0xd7>
} else
p->s.ptr = bp;
93e: 8b 45 fc mov -0x4(%ebp),%eax
941: 8b 55 f8 mov -0x8(%ebp),%edx
944: 89 10 mov %edx,(%eax)
freep = p;
946: 8b 45 fc mov -0x4(%ebp),%eax
949: a3 4c 0e 00 00 mov %eax,0xe4c
}
94e: 90 nop
94f: c9 leave
950: c3 ret
00000951 <morecore>:
static Header*
morecore(uint nu)
{
951: 55 push %ebp
952: 89 e5 mov %esp,%ebp
954: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
957: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
95e: 77 07 ja 967 <morecore+0x16>
nu = 4096;
960: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
967: 8b 45 08 mov 0x8(%ebp),%eax
96a: c1 e0 03 shl $0x3,%eax
96d: 83 ec 0c sub $0xc,%esp
970: 50 push %eax
971: e8 19 fc ff ff call 58f <sbrk>
976: 83 c4 10 add $0x10,%esp
979: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
97c: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
980: 75 07 jne 989 <morecore+0x38>
return 0;
982: b8 00 00 00 00 mov $0x0,%eax
987: eb 26 jmp 9af <morecore+0x5e>
hp = (Header*)p;
989: 8b 45 f4 mov -0xc(%ebp),%eax
98c: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
98f: 8b 45 f0 mov -0x10(%ebp),%eax
992: 8b 55 08 mov 0x8(%ebp),%edx
995: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
998: 8b 45 f0 mov -0x10(%ebp),%eax
99b: 83 c0 08 add $0x8,%eax
99e: 83 ec 0c sub $0xc,%esp
9a1: 50 push %eax
9a2: e8 c8 fe ff ff call 86f <free>
9a7: 83 c4 10 add $0x10,%esp
return freep;
9aa: a1 4c 0e 00 00 mov 0xe4c,%eax
}
9af: c9 leave
9b0: c3 ret
000009b1 <malloc>:
void*
malloc(uint nbytes)
{
9b1: 55 push %ebp
9b2: 89 e5 mov %esp,%ebp
9b4: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
9b7: 8b 45 08 mov 0x8(%ebp),%eax
9ba: 83 c0 07 add $0x7,%eax
9bd: c1 e8 03 shr $0x3,%eax
9c0: 83 c0 01 add $0x1,%eax
9c3: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
9c6: a1 4c 0e 00 00 mov 0xe4c,%eax
9cb: 89 45 f0 mov %eax,-0x10(%ebp)
9ce: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
9d2: 75 23 jne 9f7 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
9d4: c7 45 f0 44 0e 00 00 movl $0xe44,-0x10(%ebp)
9db: 8b 45 f0 mov -0x10(%ebp),%eax
9de: a3 4c 0e 00 00 mov %eax,0xe4c
9e3: a1 4c 0e 00 00 mov 0xe4c,%eax
9e8: a3 44 0e 00 00 mov %eax,0xe44
base.s.size = 0;
9ed: c7 05 48 0e 00 00 00 movl $0x0,0xe48
9f4: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
9f7: 8b 45 f0 mov -0x10(%ebp),%eax
9fa: 8b 00 mov (%eax),%eax
9fc: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
9ff: 8b 45 f4 mov -0xc(%ebp),%eax
a02: 8b 40 04 mov 0x4(%eax),%eax
a05: 3b 45 ec cmp -0x14(%ebp),%eax
a08: 72 4d jb a57 <malloc+0xa6>
if(p->s.size == nunits)
a0a: 8b 45 f4 mov -0xc(%ebp),%eax
a0d: 8b 40 04 mov 0x4(%eax),%eax
a10: 3b 45 ec cmp -0x14(%ebp),%eax
a13: 75 0c jne a21 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
a15: 8b 45 f4 mov -0xc(%ebp),%eax
a18: 8b 10 mov (%eax),%edx
a1a: 8b 45 f0 mov -0x10(%ebp),%eax
a1d: 89 10 mov %edx,(%eax)
a1f: eb 26 jmp a47 <malloc+0x96>
else {
p->s.size -= nunits;
a21: 8b 45 f4 mov -0xc(%ebp),%eax
a24: 8b 40 04 mov 0x4(%eax),%eax
a27: 2b 45 ec sub -0x14(%ebp),%eax
a2a: 89 c2 mov %eax,%edx
a2c: 8b 45 f4 mov -0xc(%ebp),%eax
a2f: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
a32: 8b 45 f4 mov -0xc(%ebp),%eax
a35: 8b 40 04 mov 0x4(%eax),%eax
a38: c1 e0 03 shl $0x3,%eax
a3b: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
a3e: 8b 45 f4 mov -0xc(%ebp),%eax
a41: 8b 55 ec mov -0x14(%ebp),%edx
a44: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
a47: 8b 45 f0 mov -0x10(%ebp),%eax
a4a: a3 4c 0e 00 00 mov %eax,0xe4c
return (void*)(p + 1);
a4f: 8b 45 f4 mov -0xc(%ebp),%eax
a52: 83 c0 08 add $0x8,%eax
a55: eb 3b jmp a92 <malloc+0xe1>
}
if(p == freep)
a57: a1 4c 0e 00 00 mov 0xe4c,%eax
a5c: 39 45 f4 cmp %eax,-0xc(%ebp)
a5f: 75 1e jne a7f <malloc+0xce>
if((p = morecore(nunits)) == 0)
a61: 83 ec 0c sub $0xc,%esp
a64: ff 75 ec pushl -0x14(%ebp)
a67: e8 e5 fe ff ff call 951 <morecore>
a6c: 83 c4 10 add $0x10,%esp
a6f: 89 45 f4 mov %eax,-0xc(%ebp)
a72: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
a76: 75 07 jne a7f <malloc+0xce>
return 0;
a78: b8 00 00 00 00 mov $0x0,%eax
a7d: eb 13 jmp a92 <malloc+0xe1>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
a7f: 8b 45 f4 mov -0xc(%ebp),%eax
a82: 89 45 f0 mov %eax,-0x10(%ebp)
a85: 8b 45 f4 mov -0xc(%ebp),%eax
a88: 8b 00 mov (%eax),%eax
a8a: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
a8d: e9 6d ff ff ff jmp 9ff <malloc+0x4e>
}
a92: c9 leave
a93: c3 ret
|
source/slim-menu_models.ads | reznikmm/slimp | 0 | 18557 | <reponame>reznikmm/slimp<gh_stars>0
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with League.Strings;
with Slim.Menu_Commands;
package Slim.Menu_Models is
type Menu_Path is private;
type Menu_Model is limited interface;
type Menu_Model_Access is access all Menu_Model'Class;
function Root (Self : Menu_Model'Class) return Menu_Path
with Inline;
function Next
(Self : Menu_Model'Class;
Path : in out Menu_Path) return Boolean
with Inline;
function Previous
(Self : Menu_Model'Class;
Path : in out Menu_Path) return Boolean
with Inline;
function Parent
(Self : Menu_Model'Class;
Path : Menu_Path) return Menu_Path
with Inline;
function Child
(Self : Menu_Model'Class;
Path : in out Menu_Path) return Boolean
with Inline;
not overriding function Label
(Self : Menu_Model;
Path : Menu_Path) return League.Strings.Universal_String is abstract;
not overriding function Item_Count
(Self : Menu_Model;
Path : Menu_Path) return Natural is abstract;
not overriding function Enter_Command
(Self : Menu_Model;
Path : Menu_Path) return Slim.Menu_Commands.Menu_Command_Access
is abstract;
not overriding function Play_Command
(Self : Menu_Model;
Path : Menu_Path) return Slim.Menu_Commands.Menu_Command_Access
is abstract;
private
type Menu_Index_Array is array (Positive range <>) of Positive;
subtype Menu_Depth is Natural range 0 .. 5;
type Menu_Path (Length : Menu_Depth := 0) is record
List : Menu_Index_Array (1 .. Length);
end record;
function Starts_With
(Self : Menu_Path;
Prefix : Menu_Path) return Boolean
with Inline;
function Suffix
(Self : Menu_Path;
Prefix : Menu_Path) return Menu_Path
with Inline;
end Slim.Menu_Models;
|
source/amf/uml/amf-uml-redefinable_elements.ads | svn2github/matreshka | 24 | 17360 | <reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A redefinable element is an element that, when defined in the context of a
-- classifier, can be redefined more specifically or differently in the
-- context of another classifier that specializes (directly or indirectly)
-- the context classifier.
------------------------------------------------------------------------------
limited with AMF.UML.Classifiers.Collections;
with AMF.UML.Named_Elements;
limited with AMF.UML.Redefinable_Elements.Collections;
package AMF.UML.Redefinable_Elements is
pragma Preelaborate;
type UML_Redefinable_Element is limited interface
and AMF.UML.Named_Elements.UML_Named_Element;
type UML_Redefinable_Element_Access is
access all UML_Redefinable_Element'Class;
for UML_Redefinable_Element_Access'Storage_Size use 0;
not overriding function Get_Is_Leaf
(Self : not null access constant UML_Redefinable_Element)
return Boolean is abstract;
-- Getter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
not overriding procedure Set_Is_Leaf
(Self : not null access UML_Redefinable_Element;
To : Boolean) is abstract;
-- Setter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
not overriding function Get_Redefined_Element
(Self : not null access constant UML_Redefinable_Element)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is abstract;
-- Getter of RedefinableElement::redefinedElement.
--
-- The redefinable element that is being redefined by this element.
not overriding function Get_Redefinition_Context
(Self : not null access constant UML_Redefinable_Element)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is abstract;
-- Getter of RedefinableElement::redefinitionContext.
--
-- References the contexts that this element may be redefined from.
not overriding function Is_Consistent_With
(Self : not null access constant UML_Redefinable_Element;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is abstract;
-- Operation RedefinableElement::isConsistentWith.
--
-- The query isConsistentWith() specifies, for any two RedefinableElements
-- in a context in which redefinition is possible, whether redefinition
-- would be logically consistent. By default, this is false; this
-- operation must be overridden for subclasses of RedefinableElement to
-- define the consistency conditions.
not overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Redefinable_Element;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is abstract;
-- Operation RedefinableElement::isRedefinitionContextValid.
--
-- The query isRedefinitionContextValid() specifies whether the
-- redefinition contexts of this RedefinableElement are properly related
-- to the redefinition contexts of the specified RedefinableElement to
-- allow this element to redefine the other. By default at least one of
-- the redefinition contexts of this element must be a specialization of
-- at least one of the redefinition contexts of the specified element.
end AMF.UML.Redefinable_Elements;
|
programs/oeis/015/A015441.asm | neoneye/loda | 22 | 4967 | ; A015441: Generalized Fibonacci numbers.
; 0,1,1,7,13,55,133,463,1261,4039,11605,35839,105469,320503,953317,2876335,8596237,25854247,77431669,232557151,697147165,2092490071,6275373061,18830313487,56482551853,169464432775,508359743893,1525146340543,4575304803901,13726182847159,41178011670565,123535108753519,370603178776909,1111813831298023,3335432903959477,10006315891747615,30018913315504477,90056808665990167,270170288559017029,810511140554958031,2431532871909060205,7294599715238808391,21883796946693169621,65651395238126019967,196954176918285037693,590862548347041157495,1772587609856751383653,5317762899938998328623,15953288559079506630541,47859865958713496602279,143579597313190536385525,430738793065471515999199,1292216376944614734312349,3876649135337443830307543,11629947397005132236181637,34889842209029795218026895,104669526591060588635116717,314008579845239359943278087,942025739391602891753978389,2826077218463039051413646911,8478231654812656401937517245,25434694965590890710419398711,76304084894466829122044502181,228912254688012173384560894447,686736764054813148116827907533,2060210292182886188424193274215,6180630876511765077125160719413,18541892629609082207670320364703,55625677888679672670421284681181,166877033666334165916443206869399,500631100998412201938970914956485,1501893302996417197437630156172879,4505679908986890409071455645911789,13517039726965393593697236582949063,40551119180886736048125970458419797,121653357542679097610309389956114175,364960072627999513899065212706632957
add $0,1
mov $1,5
mov $3,9
lpb $0
sub $0,1
trn $2,4
add $3,$1
mov $1,$2
add $1,1
sub $3,1
mov $2,$3
mul $2,6
lpe
div $1,74
mov $0,$1
|
experiments/realbugs/fsm2.als | saiema/ARepair | 5 | 1232 | <reponame>saiema/ARepair
one sig FSM {
start: set State,
stop: set State
}
sig State {
transition: set State
}
// Part (a)
fact OneStartAndStop {
// FSM only has one start state.
#FSM.start = 1
// FSM only has one stop state.
#FSM.stop = 1
}
// Part (b)
fact ValidStartAndStop {
// A state cannot be both a start state and a stop state.
FSM.start != FSM.stop
// No transition ends at the start state.
// Fix: replace "!=" with "!in". If we consider all facts together, then this fix is sufficient.
all s:State | FSM.start != s.transition
// No transition begins at the stop state.
no FSM.stop.transition
}
// Part (c)
fact Reachability {
// All states are reachable from the start state.
State = FSM.start.*transition
// The stop state is reachable from any state.
all s:(State - FSM.stop) | FSM.stop in s.*transition
}
run {} for 5
|
learn-assembly/asm101/asm101-04.asm | hailehong95/Practice-Coding | 0 | 173996 | ; asm101-04: Xuat chuoi ky tu
.model small
.stack 100h
.data
tb1 db "Le <NAME>$"
.code
main proc
; Khoi tao thanh ghi ds
mov ax, @data
mov ds, ax
; Doan in ra chuoi tb1
mov ah, 09h
lea dx, tb1
int 21h
; Ket thuc chuong trinh
mov ah, 4ch
int 21h
main endp
end main
; Note:
; - mov ah, 09h: Goi ham 9, gia tri 9 luu vao ah, Ham 9 de hien thi chuoi tb1 ra man hinh
|
fish.asm | mgr-inz-rafal/wytyczne-rybne | 0 | 246887 | opt m+r+
; Selected ATARI registes
icl 'atari.inc'
pstart equ $2000
scr_rowsize equ 40
scr_lines equ 96
scr_lastb equ scr_mem_0+scr_rowsize*(scr_lines-1)+(scr_rowsize-1)
scr_size equ scr_lastb-scr_mem_0+1
fishdimx equ 32 ; Horizontal dimension of fish (in pixels)
fishdimy equ 32 ; Vertical dimension of fish (in pixels)
fishpxperb equ 4 ; Pixels per byte (ie. 10 00 10 11)
fishbperrow equ fishdimx/fishpxperb ; Bytes for each row
fishsize equ fishbperrow*fishdimy ; Bytes per fish
fishtpspprt equ 5 ; Fish types per part (ie. 5 heads, 5 tails, etc.)
fishparts equ 4 ; Head, Upper body, Lower body, Tail
fishestotal equ fishtpspprt*fishparts ; Total number of fishes
fishtotbts equ fishestotal*fishsize ; Total bytes for all fishes
fish_maxy equ scr_lines-fishdimy ; Maximum vertical fish position
fish_maxx equ scr_rowsize-fishbperrow ; Maximum horizontal fish position
fishchain_x equ 0
fishchain_len equ 5
fishslot_x equ fishbperrow
fishslot_y equ fishdimy*2
fishslot_len equ 4
fish_color_0 equ 21
fish_color_1 equ 98
fish_color_2 equ 207
fish_color_bg equ 0
busted_color_0 equ 49
busted_color_1 equ 54
busted_color_2 equ $00
busted_color_bg equ $0f
congra_color_0 equ 117
congra_color_1 equ 123
congra_color_2 equ $00
congra_color_bg equ $0f
tool_init_y equ $20
tool_init_x equ $2b
tool_color equ $0f
tool_apart equ $a2
tool_height equ 64
tool_at_bottom equ tool_height+tool_init_y-2
funnel_init_x equ fishbperrow*2
funnel_y equ fishdimy
funnel_at_left equ fishbperrow
funnel_at_right equ fishbperrow*fishparts
slots_y equ fishdimy*2
number_count equ fishslot_len ; 3, 2, 1, 0
count_delay equ 50
level_count equ 20
level_delay_inc equ 13
busted_count equ 4 ; 4 segments of "BUSTED" text
busted_width equ 111 ; Pixels
congrats_count equ 5 ; 5 segments of "CONGRATULATIONS" text
titlefish_count equ 4 ; 4 segments of the title fish graphics
titlefish_width equ 125 ; Pixels
lives_count equ 4
; Fish chain states
.zpvar fcstate .byte
FC_STATIONARY equ 0
FC_MOVINGLEFT equ 1
FC_MOVINGRIGHT equ 2
FC_DROPPING equ 3 ; Fish going into funnel
FC_CONSTRUCTING equ 4 ; Fish going from funnel to slot
; Game states
.zpvar gstate .byte
GS_GUIDELINES equ 0 ; Fish guidelines are shown
GS_CUNTDOWN equ 1 ; C(o)untdown before the guidelines ;-)
GS_CONSTRUCTION equ 2 ; Player is constructing the fish
GS_GAME_OVER equ 3 ; The game is over
; Tool states
.zpvar tstate .byte
TS_STATIONARY equ 0
TS_MOVING_DOWN equ 1
TS_MOVING_UP equ 2
; Funnel states
.zpvar fstate .byte
FU_STATIONARY equ 0
FU_MOVINGLEFT equ 1
FU_MOVINGRIGHT equ 2
.zpvar fishdry .byte ; Used when moving fish vertically
.zpvar erase_r .byte ; Used by rectangle draving routine...
.zpvar erase_l .byte ; ...to check whether rightmost or...
; ...leftmost column should get erased
.zpvar funnl_x .byte ; Horizontal position of funnel
.zpvar tool_y .byte ; Current vertical position of tool
.zpvar pscr .word ; Pointer to current screen
.zpvar pnscr .word ; Pointer to next screen
.zpvar ffeedof .byte ; Fish feeding offset
.zpvar fishmov .byte ; Fish move counters,
; when =0 fish chain is aligned
; (used also for funnel movement)
.zpvar ptr0 .word ; General purpose pointers
.zpvar ptr1 .word ; ...
.zpvar ptr2 .word ; ...ditto
.zpvar cntr0 .byte ; General purpose counter
.zpvar drf_x .byte ; Used by fish-drawing routine...
.zpvar drf_y .byte ; ...to draw at given coordinates
.zpvar tmp0 .byte ; General purpose temporary value
.zpvar tmp1 .byte ; ...
.zpvar tmp2 .byte ; ...
.zpvar tmp3 .byte ; ...
.zpvar tmp4 .byte ; ...ditto
.zpvar delayt .byte ; Delay time, used by delay routine
.zpvar delayt2 .byte ; ...ditto
.zpvar level .byte ; Current level
.zpvar lives .byte ; Number of lives
.zpvar english .byte ; If 1 then english version
.zpvar silence .byte ; If 1 then no music
.zpvar crunched .byte ; If 1 then no more decrunching
; Here we begin!
org pstart
.align $1000
scr_mem_0
ins "graphics/backgrnd.sra"
tab_fish_ypos_0 ; Y-coordinate tabs for screen 0
.rept fish_maxy+1
dta a(scr_mem_0+scr_rowsize*#)
.endr
tab_fish_ypos_0_len equ *-tab_fish_ypos_0
.align $1000
scr_mem_1
ins "graphics/backgrnd.sra"
tab_fish_ypos_1 ; Y-coordinate tabs for screen 1
.rept fish_maxy+1
dta a(scr_mem_1+scr_rowsize*#)
.endr
tab_fish_ypos_1_len equ *-tab_fish_ypos_1
fishdata
.rept fishestotal, #/fishtpspprt, #%fishtpspprt
.if :2=0
fishparts_:1
.endif
fish_:1_:2
ins "graphics/p:1_:2.sra"
.endr
funnel_data
ins "graphics/funnel.sra"
empty_data
ins "graphics/empty.sra"
.rept number_count, 3-#
numbitmap_:1
ins "graphics/no:1.sra"
.endr
level_data
.rept level_count, #+1
ins "graphics/level:1.sra"
.endr
lives_data
.rept lives_count, 3-#
ins "graphics/lives:1.sra"
.endr
busted_data
.rept busted_count, #+1
ins "graphics/busted:1.sra"
.endr
congrats_data
.rept congrats_count, #+1
ins "graphics/congrat:1.sra"
.endr
titlefish_data
.rept titlefish_count, #+1
ins "graphics/fish:1.sra"
.endr
badfish_data
ins "graphics/badfish.sra"
goodfish_data
ins "graphics/goodfish.sra"
run_here
cld
ldx #1
stx silence
dex
stx crunched
ldy <vbi_routine
ldx >vbi_routine
lda #7
jsr SETVBV
run_again mwa #scr_mem_0 pscr
mwa #scr_mem_1 pnscr
jsr title_screen
jsr disable_antic
mwa #scr_size ptr2
lda #0
jsr fill_screen
jsr flip_screens
mwa #scr_size ptr2
lda #0
jsr fill_screen
jsr game_init
jsr enable_antic
jsr gfx_init
jsr game_loop
; Unreachable :)
chuj jmp chuj
disable_antic
lda SDMCTL
sta tmp4
lda #0
sta SDMCTL
rts
enable_antic
lda tmp4
sta SDMCTL
rts
title_dli_routine
phr
lda VCOUNT
; Fish picture
cmp #$0f
bne tdr_a
lda #216
ldx #221
ldy #$79
sta WSYNC
sta COLPF0
stx COLPF1
sty COLPF2
lda #0
sta COLPF3
sta COLBK
jmp tdr_x
; Shade of water #1
tdr_a cmp #$17
bne tdr_b
ldy #$77
sta WSYNC
sty COLPF2
jmp tdr_x
; Shade of water #2
tdr_b cmp #$1e
bne tdr_c
ldy #$75
sta WSYNC
sty COLPF2
jmp tdr_x
; Shade of water #3
tdr_c cmp #$25
bne tdr_0
ldy #$73
sta WSYNC
sty COLPF2
jmp tdr_x
; Main title text
tdr_0 cmp #$33
bne tdr_1
lda #>pmg_base
sta CHBASE
lda #$7a
ldx #$ba
ldy #$5a
sta WSYNC
sta COLPF0
stx COLPF1
sty COLPF2
lda #0
sta COLPF3
sta COLBK
:8 sta WSYNC
lda #$77
ldx #$b7
ldy #$57
sta WSYNC
sta COLPF0
stx COLPF1
sty COLPF2
jmp tdr_x
; Title separator
tdr_1 cmp #$3b
bne tdr_2
lda #$00
ldx #$06
ldy #$b2
;sta WSYNC
sta COLPF0
stx COLPF1
sty COLPF2
lda #0
sta COLPF3
sta COLBK
jmp tdr_x
; First subtitle line
tdr_2 cmp #$3f
bne tdr_3
lda #>(pmg_base+512)
sta CHBASE
lda #223
ldx #223
ldy #$00
sta WSYNC
sta COLPF0
stx COLPF1
sty COLPF2
lda #0
sta COLPF3
sta COLBK
jmp tdr_x
; Second subtitle line
tdr_3 cmp #$43
bne tdr_4
lda #216
ldx #216
ldy #$00
sta WSYNC
sta COLPF0
stx COLPF1
sty COLPF2
lda #0
sta COLPF3
sta COLBK
jmp tdr_x
; Main text
tdr_4 cmp #$4b
bne tdr_5
lda #>pmg_base
sta CHBASE
lda #$00
ldx #$0f
ldy #$22
; sta WSYNC
sta COLPF0
stx COLPF1
sty COLPF2
lda #0
sta COLPF3
sta COLBK
jmp tdr_x
; Separator after main text
tdr_5 cmp #$63
bne tdr_6
lda #$00
ldx #$00
ldy #$00
sta WSYNC
sta COLPF0
stx COLPF1
sty COLPF2
lda #0
sta COLPF3
sta COLBK
:5 sta WSYNC
; First footer line
lda #$00
ldx #$0f
ldy #$42
sta WSYNC
sta COLPF0
stx COLPF1
sty COLPF2
lda #0
sta COLPF3
sta COLBK
:7 sta WSYNC
; Second footer line
lda #$00
ldx #$07
ldy #$82
sta WSYNC
sta COLPF0
stx COLPF1
sty COLPF2
lda #0
sta COLPF3
sta COLBK
jmp tdr_x
tdr_6
tdr_x plr
rti
decrunch_dli_routine
phr
lda VCOUNT
; Fish picture
cmp #$0f
bne dddr_a
lda #216
ldx #221
ldy #$79
sta WSYNC
sta COLPF0
stx COLPF1
sty COLPF2
lda #0
sta COLPF3
sta COLBK
jmp dddr_x
; Shade of water #1
dddr_a cmp #$17
bne dddr_b
ldy #$77
sta WSYNC
sty COLPF2
jmp dddr_x
; Shade of water #2
dddr_b cmp #$1e
bne dddr_c
ldy #$75
sta WSYNC
sty COLPF2
jmp dddr_x
; Shade of water #3
dddr_c cmp #$25
bne dddr_0
ldy #$73
sta WSYNC
sty COLPF2
jmp dddr_x
; White text on black screen
dddr_0 cmp #$33
bne dddr_x
lda #$ff
ldy #$00
sta WSYNC
sta COLPF0
sty COLPF2
dddr_6
dddr_x plr
rti
; Sets up the title screen
title_screen
jsr disable_antic
lda #$ff
sta CH
lda #$00
sta COLOR0
sta COLOR1
sta COLOR2
sta COLOR3
sta COLOR4
; Setup display list
ldx <dlist_title
ldy >dlist_title
stx SDLSTL
sty SDLSTL+1
; Setup font
lda #>pmg_base
sta CHBAS
; Clear graphical part of the screen
mwa #scr_rowsize*fishdimy ptr2
lda #%11111111
jsr fill_screen
jsr draw_title_fish
lda crunched
cmp #1
beq @+
jsr decrunching ;-)
; Init DLI
lda <title_dli_routine
sta VDSLST
lda >title_dli_routine
sta VDSLST+1
lda #%11000000
sta NMIEN
@ jsr draw_title_content
jsr enable_antic
jsr play_title_music
; Protect agains accidental game startup
jsr short_delay
ts_1 lda HELPFG
sta ATRACT
cmp #0
beq ts_0
jsr switch_language
ts_0 lda STRIG0
cmp #1
beq ts_1
jsr stop_music
rts
; Switches the current language
switch_language
lda #0
sta HELPFG
inc english
jsr draw_title_content
jsr short_delay
rts
; Provides short delay
short_delay
lda #50
sta delayt
lda #0
sta delayt2
jsr delay
rts
; Provides very short delay
very_short_delay
lda #15
sta delayt
lda #0
sta delayt2
jsr delay
rts
; Draws the content of the title screen
draw_title_content
mwa #scr_mem_1+scr_rowsize*fishdimy ptr0
lda english
and #%00000001
cmp #0
beq dtc_2
mwa #title_content_data_EN ptr1
jmp dtc_3
dtc_2 mwa #title_content_data_PL ptr1
dtc_3 ldy #0
dtc_1 lda (ptr1),y
cmp #$ff
beq dtc_0 ; Done
sta (ptr0),y
inw ptr0
inw ptr1
jmp dtc_1
dtc_0 rts
title_content_data_EN
dta d' F'
dta d'i'
dta d'S'*
dta d'H'
dta d'y '
dta d'g'
dta d'U'*
dta d'I'
dta d'd'
dta d'E'*
dta d'L'
dta d'i'
dta d'N'*
dta d'E'
dta d's '
:20 dta b(126),b(127)
dta d' mgr in'
dta b(24)
dta b(32)
dta d' '
dta b(8)
dta d'afa'
dta b(59)
dta d' '
dta d' music by '
dta b(84)
dta d'n'
dta b(85)
dta d' '
dta d'This is the game about joining fishes '
dta d'that had been sliced apart by using the '
dta d'moving pipe with arrow. Remember the '
dta d'target fish, find correct pieces and '
dta d'reunite them! Time to remember the fish '
dta d'decreases with each level. '
dta d' '
dta d'GAME-COMPO ENTRY for WAP-NIAK 2016 PARTY'*
dta b(74)
dta d'HELP'*
dta b(74+128)
dta d' - polish version v1.1'
dta b($ff)
title_content_data_PL
dta d' W'
dta d'y'
dta d'T'*
dta d'Y'
dta d'c'
dta d'Z'*
dta d'N'
dta d'e '
dta d'R'*
dta d'Y'
dta d'b'
dta d'N'*
dta d'E '
:20 dta b(126),b(127)
dta d' mgr in'
dta b(24)
dta b(32)
dta d' '
dta b(8)
dta d'afa'
dta b(59)
dta d' '
dta d' music by '
dta b(84)
dta d'n'
dta b(85)
dta d' '
dta d'Jest to gra o '
dta b(123)
dta b(81)
dta d'czeniu poszatkowanych '
dta d'ryb w ca'
dta b(123)
dta d'o'
dta b(87)
dta b(86)
dta d' za pomoc'
dta b(81)
dta d' je'
dta b(88)
dta d'd'
dta b(88)
dta b(81)
dta d'cej rury. '
dta d'Zapami'
dta b(68)
dta d'taj kszta'
dta b(123)
dta d't ryby, poszukaj odpo- '
dta d'wiednich cz'
dta b(68)
dta b(87)
dta d'ci i z'
dta b(123)
dta b(80)
dta b(88)
dta d' ca'
dta b(123)
dta d'o'
dta b(87)
dta b(86)
dta d' do kupy. '
dta d'W miar'
dta b(68)
dta d' post'
dta b(68)
dta d'pu prac czas na zapami'
dta b(68)
dta d'ta- '
dta d'nie dok'
dta b(123)
dta d'adnego kszta'
dta b(123)
dta d'tu ulega skr'
dta b(80)
dta d'ceniu.'
dta d' '
dta d'GAME-COMPO ENTRY for WAP-NIAK 2016 PARTY'*
dta b(74)
dta d'HELP'*
dta b(74+128)
dta d' - english version v1.1'
dta b($ff) ; End
; Initializes graphics subsystem
gfx_init
; Setup display list
ldx <dlist
ldy >dlist
stx SDLSTL
sty SDLSTL+1
jsr init_sprites
jsr setup_colors
rts
setup_colors
; Border
lda #$00
sta COLOR4
; Other elements
lda #fish_color_0
sta COLOR0
lda #fish_color_1
sta COLOR1
lda #fish_color_2
sta COLOR2
rts
process_fishchain_state
lda fcstate
cmp #FC_STATIONARY
beq pfcs_2
cmp #FC_MOVINGLEFT
bne pfcs_1
jsr move_fish_chain_left
rts
pfcs_1 cmp #FC_MOVINGRIGHT
bne pfcs_0
jsr move_fish_chain_right
rts
pfcs_0 cmp #FC_DROPPING
bne pfcs_2
jsr drop_current_fish
pfcs_2 rts
; When fish part is being dropped
; this routine will draw an empty
; slot in the place of the fish
; part being dropped
draw_empty_fish_slot
lda funnl_x
sta drf_x
lda #0
sta drf_y
mwa #empty_data ptr1
jsr draw_data_rectangle
rts
; Sets the ptr1 to indicate the fish
; part that is located above the funnel
; Additional:
; - Stores ptr0 also in tmp1/tmp2, because
; the fish drawing routine will destroy
; ptr0. The caller can restore it
; from the temporary values
; - Stores the pointer to appropriate
; fish chain data in ptr2, so at the end
; of the movement it can be replaced with
; empty fish block
prepare_correct_fish_data
jsr funnel_pos_to_ptr
sta tmp0
mwa #tab_fishchain ptr0
lda ptr0
clc
adc tmp0
sta ptr0
sta ptr2
lda ptr0+1
adc #0
sta ptr0+1
sta ptr2+1
ldy #0
lda (ptr0),y
sta ptr1
sta tmp1
iny
lda (ptr0),y
sta ptr1+1
sta tmp2
rts
; Moves into the funnel the fish part
; that is located directly above it
drop_current_fish
jsr draw_empty_fish_slot
jsr prepare_correct_fish_data
; Are we dropping an empty block?
lda ptr1
cmp #<empty_data
bne dcf_1
lda ptr1+1
cmp #>empty_data
bne dcf_1
; Yes. Do not drop.
lda #FC_STATIONARY
sta fcstate
rts
; Now ptr1 = pointer to rectangle
; data representing correct fish part
dcf_1 lda funnl_x
sta drf_x
lda fishdry
sta drf_y
:2 inc fishdry
jsr draw_data_rectangle
jsr draw_funnel
jsr flip_screens
; Is fish part down an the slot?
lda fishdry
cmp #slots_y+2
bne dcf_0
; Yes.
jsr handle_fish_part_in_slot
dcf_0 rts
; Performs all actions that need to be
; executed after the fish part has been
; dropped into the slot
handle_fish_part_in_slot
; Stop the movement
lda #FC_STATIONARY
sta fcstate
:2 dec fishdry
; Recover ptr1 used to draw the rectangle
; from temporary values
lda tmp1
sta ptr1
lda tmp2
sta ptr1+1
; Draw funnel
lda funnl_x
sta drf_x
lda fishdry
sta drf_y
jsr draw_data_rectangle
jsr flip_screens
; Once again, recover ptr1
; from temporary values
lda tmp1
sta ptr1
lda tmp2
sta ptr1+1
; Setup pointers in chain and in slots
jsr adapt_for_empty_block
jsr adapt_dropped_fish
; Check if fish is completed
jsr check_fish_completion
cpx #0
beq hfpis_1
; Validate constructed fish
jsr validate_fish
cpx #0
beq hfpis_0
; The fish is good
jsr good_fish
rts
hfpis_0 jsr bad_fish
hfpis_1 rts
; Draws the image of the bad fish
draw_bad_fish
lda #0
sta drf_x
lda #funnel_y
sta drf_y
mwa #badfish_data ptr1
jsr draw_data_rectangle
rts
; Draws the image of the good fish
draw_good_fish
lda #0
sta drf_x
lda #funnel_y
sta drf_y
mwa #goodfish_data ptr1
jsr draw_data_rectangle
rts
; Called when constructed fish is incorrect
bad_fish
jsr stop_music
dec lives
jsr draw_bad_fish
jsr flip_screens
jsr wait_for_fire
lda lives
cmp #0
beq bf_0
; Still more lives
jsr draw_lives
jsr flip_screens
jsr draw_lives
jsr initialize_target_fish
lda #GS_CUNTDOWN
sta gstate
rts
bf_0 ; No more lives
jsr handle_game_over
rts
; Called when constructed fish is correct
good_fish
jsr stop_music
inc level
jsr draw_good_fish
jsr flip_screens
jsr wait_for_fire
lda level
cmp #level_count+1
beq gf_0
; Still more levels
jsr draw_level
jsr draw_lives
jsr flip_screens
jsr draw_level
jsr draw_lives
jsr initialize_target_fish
lda #GS_CUNTDOWN
sta gstate
rts
gf_0 ; No more levels
jsr handle_congrats
rts
; Performs all actions required to handle
; the finished game process
handle_congrats
lda #GS_GAME_OVER
sta gstate
mwa #scr_size ptr2
lda #$ff
jsr fill_screen
jsr draw_congrats
; Set appropriate colors
lda #congra_color_0
sta COLOR0
lda #congra_color_1
sta COLOR1
lda #congra_color_2
sta COLOR3
lda #congra_color_bg
sta COLOR2
; Hide tool
lda #0
sta HPOSP0
sta HPOSP1
jsr flip_screens
rts
; Performs all actions required to handle
; the game over process
handle_game_over
lda #GS_GAME_OVER
sta gstate
mwa #scr_size ptr2
lda #$ff
jsr fill_screen
jsr draw_busted
; Set appropriate colors
lda #busted_color_0
sta COLOR0
lda #busted_color_1
sta COLOR1
lda #busted_color_2
sta COLOR3
lda #busted_color_bg
sta COLOR2
; Hide tool
lda #0
sta HPOSP0
sta HPOSP1
jsr flip_screens
rts
; Fills the screen with the byte
; stored in A
; Precondition:
; - "ptr2" stores the count of bytes
; that should be cleared
fill_screen
sta tmp0
mwa #0 ptr1
mwa pnscr ptr0
fs_1 lda tmp0
ldy #0
sta (ptr0),y
adw ptr0 #1
inw ptr1
#if .word ptr1 = ptr2
jmp fs_0
#end
jmp fs_1
fs_0 rts
; Draws the "BUSTED" message
draw_busted
ldx #busted_count
lda #(scr_rowsize-(busted_width/fishpxperb))/2
sta drf_x
pha
lda #funnel_y
sta drf_y
mwa #busted_data ptr1
db_3 jsr draw_data_rectangle
dex
cpx #0
beq db_0
pla
clc
adc #fishbperrow
sta drf_x
pha
jmp db_3
db_0 pla
rts
; Draws the "CONGRATS" message
draw_congrats
ldx #congrats_count
lda #0
sta drf_x
pha
lda #funnel_y
sta drf_y
mwa #congrats_data ptr1
dc_3 jsr draw_data_rectangle
dex
cpx #0
beq dc_0
pla
clc
adc #fishbperrow
sta drf_x
pha
jmp dc_3
dc_0 pla
rts
; Draws the title fish
draw_title_fish
ldx #titlefish_count
lda #(scr_rowsize-(titlefish_width/fishpxperb))/2
sta drf_x
pha
lda #0
sta drf_y
mwa #titlefish_data ptr1
dtf_3 jsr draw_data_rectangle
dex
cpx #0
beq dtf_0
pla
clc
adc #fishbperrow
sta drf_x
pha
jmp dtf_3
dtf_0 pla
rts
; Waits until the joystick button is pressed
wait_for_fire
@ lda STRIG0
cmp #1
beq @-
rts
; Checks whether slots are filled
; with correct fish parts
; Retrun:
; X = 0 - fish not valid
; X = 1 - fish valid
validate_fish
ldx #0
.rept fishslot_len, #*2
#if .word tab_fishslots+:1 <> tab_fishguidelines+:1
rts
#end
.endr
inx
rts
; Checks whether all slots are filled
; with fish parts.
; Retrun:
; X = 0 - fish not completed
; X = 1 - fish completed
check_fish_completion
ldx #0
; If any slot is empty
; fish is not completed
.rept fishslot_len, #*2
#if .word tab_fishslots+:1 = #empty_data
rts
#end
.endr
inx
rts
; Converts funnel position
; to the array index
funnel_pos_to_ptr
lda funnl_x
lsr
lsr
rts
; Fills the appropriate slot with the
; fish that has been dropped into it
; Precondition:
; - "ptr1" still valid (pointing to fish
; part being dropped)
adapt_dropped_fish
jsr funnel_pos_to_ptr
sec
sbc #2 ; Skip position #0 since
; it is not used in slots
tay
lda ptr1
sta tab_fishslots,y
iny
lda ptr1+1
sta tab_fishslots,y
rts
; At the end of the fish drop
; this routine modifies the content
; of the fish chain (it inserts
; the pointer to empty block in the
; correct pleace, precalculated in ptr2)
adapt_for_empty_block
ldy #0
lda #<empty_data
sta (ptr2),y
iny
lda #>empty_data
sta (ptr2),y
rts
process_tool_state
lda tstate
cmp #TS_STATIONARY
beq pts_0
cmp #TS_MOVING_DOWN
bne pts_1
jsr move_tool_down
rts
pts_1 cmp #TS_MOVING_UP
bne pts_0
jsr move_tool_up
pts_0 rts
process_funnel_state
lda fstate
cmp #FU_STATIONARY
beq pfs_0
cmp #FU_MOVINGLEFT
bne pfs_1
jsr move_funnel_left
rts
pfs_1 cmp #FC_MOVINGRIGHT
bne pfs_0
jsr move_funnel_right
pfs_0 rts
move_funnel_left
jsr is_funnel_movement_finished
dec funnl_x
inc erase_r
jsr draw_funnel
jsr flip_screens
jsr draw_funnel
dec erase_r
rts
move_funnel_right
jsr is_funnel_movement_finished
inc funnl_x
inc erase_l
jsr draw_funnel
jsr flip_screens
jsr draw_funnel
dec erase_l
rts
move_tool_up
ldx #0
lda tool_y
clc
adc #2
tay
@ lda pmg_p0,y
dey
sta pmg_p0,y
iny
lda pmg_p1,y
dey
sta pmg_p1,y
iny
iny
inx
cpx #tool_height+1
bne @-
dec tool_y
; At the top?
lda tool_y
cmp #tool_init_y-2
bne mtu_0 ; No
lda #TS_STATIONARY ; Yes
sta tstate
mtu_0 rts
move_tool_down
lda tool_y
clc
adc #tool_height
tay
iny
@ lda pmg_p0,y
iny
sta pmg_p0,y
dey
lda pmg_p1,y
iny
sta pmg_p1,y
dey
dey
cpy tool_y
bne @-
inc tool_y
; At the bottom?
lda tool_y
cmp #tool_at_bottom
bne mtd_0 ; No
lda #TS_STATIONARY ; Yes
sta tstate
mtd_0 rts
; Short delay used during countdown
countdown_delay
lda #count_delay
sta delayt
lda #0
sta delayt2
jsr delay
rts
; Shows the countdown sequence
process_countdown
jsr countdown_delay
.rept number_count, 3-#, #*2
jsr play_lo_beep
mwa #numbitmap_:1 tab_fishslots+:2
jsr draw_fish_slots
jsr flip_screens
jsr countdown_delay
.endr
lda #GS_GUIDELINES
sta gstate
rts
; Pauses for the amount of time
; appropriate to the current level
provide_guidelines_delay
ldy level
dey
lda delay_tab_1,y
sta delayt
lda delay_tab_0,y
sta delayt2
jsr delay
; Clear accidental key presses
; made during waiting time
lda #$ff
sta CH
rts
delay_tab_0
:level_count dta b(level_delay_inc*(level_count-#)/256)
delay_tab_1
:level_count dta b(level_delay_inc*(level_count-#)-((level_delay_inc*(level_count-#)/256)*256))
; Shows the fish to be constructed
process_guidelines
ldy #0
pg_0 lda tab_fishguidelines,y
sta tab_fishslots,y
iny
cpy #(fishslot_len*2)
bne pg_0
jsr draw_fish_slots
jsr flip_screens
jsr play_hi_beep
jsr provide_guidelines_delay
; Hide the guidelines
:fishslot_len mwa #empty_data tab_fishslots+#*2
jsr draw_fish_slots
jsr flip_screens
jsr draw_fish_slots
; Begin construction
jsr play_game_music
lda #GS_CONSTRUCTION
sta gstate
rts
; Processes all machine states
; used during the game
process_game_state
lda CH
cmp #$1c ; ESC
bne pgs_4
; Returning to the title screen
; Clear stack, so we can jmp out
; and start from scratch
pla
pla
pla
pla
; Hide tool
lda #0
sta HPOSP0
sta HPOSP1
jmp run_again
pgs_4 lda gstate
cmp #GS_CUNTDOWN
bne pgs_0
jsr process_countdown
rts
pgs_0 cmp #GS_CONSTRUCTION
bne pgs_1
jsr process_fishchain_state
jsr process_tool_state
jsr process_funnel_state
rts
pgs_1 cmp #GS_GUIDELINES
bne pgs_2
jsr process_guidelines
rts
pgs_2 cmp #GS_GAME_OVER
bne pgs_3
jsr process_game_over
pgs_3 rts
; Waits for fire and returns to title screen
process_game_over
jsr wait_for_fire
; Clear stack, so we can jmp out
; and start from scratch
pla
pla
pla
pla
pla
pla
jmp run_again
game_init_common_tasks
mwa #scr_size ptr2
lda #$00
jsr fill_screen
jsr draw_fish_chain
jsr draw_fish_slots
jsr draw_funnel
jsr draw_level
jsr draw_lives
rts
game_init
; Variables
lda #funnel_init_x
sta funnl_x
lda #0
sta erase_l
sta erase_r
lda #1
sta level
lda #lives_count
sta lives
; Initial position and colors
lda #tool_init_x
sta HPOSP0
clc
adc #tool_apart
sta HPOSP1
lda #tool_color
sta PCOLR0
sta PCOLR1
; Fish species to be built
jsr initialize_target_fish
; Reset empty slots
:fishslot_len mwa #empty_data tab_fishslots+#*2
; Draw initial graphics
; on both screens
jsr randomize_fish_chain
jsr game_init_common_tasks
jsr flip_screens
jsr game_init_common_tasks
; Setup state machines
lda #FC_STATIONARY
sta fcstate
lda #GS_CUNTDOWN
sta gstate
lda #TS_STATIONARY
sta tstate
lda #FU_STATIONARY
sta fstate
rts
; Draws the tile with level number
draw_level
mwa #level_data ptr1
ldx level
dl_1 dex
cpx #0
beq dl_0
adw ptr1 #fishsize
jmp dl_1
dl_0 lda #0
sta drf_x
lda #slots_y
sta drf_y
jsr draw_data_rectangle
rts
; Draws the lives indicator
draw_lives
mwa #lives_data ptr1
ldx lives
dli_1 dex
cpx #0
beq dli_0
adw ptr1 #fishsize
jmp dli_1
dli_0 lda #0
sta drf_x
lda #funnel_y
sta drf_y
jsr draw_data_rectangle
rts
; Calls "prepare_target_fish" for each part
initialize_target_fish
.rept fishparts, #, #*2
mwa #fishparts_:1 ptr0
ldy #:2
jsr prepare_target_fish
.endr
rts
; Randomizes each part of the target fish
; Precondition:
; - "ptr0" contains the base of the fish
; part to be generated
; - Y contains the target pointer offset
; where generated fish should be stored
prepare_target_fish
; Put random number [0 to 4] in X
lda RANDOM
and #%00111111
tax
lda prepare_fish_lut,x
tax
; Apply random shift to the offset
ptf3 cpx #0
beq ptf1
adw ptr0 #fishsize
dex
jmp ptf3
ptf1 ; Store in appropriate pointer
mwa ptr0 tab_fishguidelines,y
rts
; LUT for fast fish randomization
prepare_fish_lut
:$100/2/2 dta(#%fishtpspprt)
init_sprites
lda #>pmg_base
sta PMBASE
lda #%00000001
sta GPRIOR
lda #%00000011
sta GRACTL
lda SDMCTL
ora #%00011100
sta SDMCTL
lda #0
sta SIZEP0
sta SIZEP1
rts
draw_funnel
mwa #funnel_data ptr1
lda funnl_x
sta drf_x
lda #funnel_y
sta drf_y
jsr draw_data_rectangle
rts
; Flips the screen buffer
flip_screens
jsr synchro
lda pscr
pha
lda pscr+1
pha
lda pnscr
sta pscr
sta scr_mem_antic
lda pnscr+1
sta pscr+1
sta scr_mem_antic+1
pla
sta pnscr+1
pla
sta pnscr
rts
game_loop
jsr process_game_state
lda STICK0
sta ATRACT
cmp #7
beq stick_right
lda STICK0
cmp #11
beq stick_left
lda STICK0
cmp #13
beq stick_down
lda STICK0
cmp #14
beq stick_up
lda STRIG0
cmp #0
beq button_down
jmp game_loop
stick_right
jsr stick_moved_right
jmp game_loop
stick_left
jsr stick_moved_left
jmp game_loop
stick_down
jsr init_tool_move_down
jmp game_loop
stick_up
jsr init_tool_move_up
jmp game_loop
button_down
jsr init_fish_drop
jmp game_loop
init_fish_drop
; Fish chain must be stopped
lda fcstate
cmp #FC_STATIONARY
bne ifd_0
; Funnel must be stopped
lda fstate
cmp #FU_STATIONARY
bne ifd_0
lda #FC_DROPPING
sta fcstate
lda #2
sta fishdry
ifd_0 rts
stick_moved_left
; Tool at the bottom?
lda tool_y
cmp #tool_at_bottom
bne sml_0 ; No
; Yes - check if funnel can move further
lda funnl_x
cmp #funnel_at_left
beq sml_1
; Check if fish part is not being dropped
lda fcstate
cmp #FC_STATIONARY
bne sml_1
lda #FU_MOVINGLEFT
sta tmp0
jsr init_funnel_move
sml_1 rts
sml_0 lda #FC_MOVINGLEFT
sta tmp0
jsr init_fish_chain_move
rts
stick_moved_right
; Tool at the bottom?
lda tool_y
cmp #tool_at_bottom
bne smr_0 ; No
; Yes - check if funnel can move further
lda funnl_x
cmp #funnel_at_right
beq smr_1
; Check if fish part is not being dropped
lda fcstate
cmp #FC_STATIONARY
bne smr_1
lda #FU_MOVINGRIGHT
sta tmp0
jsr init_funnel_move
smr_1 rts
smr_0 lda #FC_MOVINGRIGHT
sta tmp0
jsr init_fish_chain_move
rts
init_tool_move_down
; Don't move if at the bottom
lda tool_y
cmp #tool_at_bottom
beq itmd_0
; Don't move if fish chain is moving
lda fcstate
cmp #FC_STATIONARY
bne itmd_0
lda #TS_MOVING_DOWN
sta tstate
itmd_0 rts
init_tool_move_up
; Don't move if at the top
lda tool_y
cmp #tool_init_y-2
beq itmu_0
; Don't move if fish chain is moving
lda fcstate
cmp #FC_STATIONARY
bne itmu_0
lda #TS_MOVING_UP
sta tstate
itmu_0 rts
; Fills the initial fish chain
; with random fish-parts
randomize_fish_chain
mwa #tab_fishchain ptr1
ldx #fishchain_len
rfc_1 jsr pick_random_fish_part
ldy #0
mwa ptr0 (ptr1),y
dex
cpx #0
beq rfc_0
adw ptr1 #2
jmp rfc_1
rfc_0 jsr randomize_approaching_fish_segment
rts
; Randomly picks the new fish segment
; to be scrolled in into the chain
randomize_approaching_fish_segment
jsr pick_random_fish_part
mwa ptr0 tab_fish_random
rts
; Picks one random fish part
; and points "ptr0" to it
pick_random_fish_part
ldy RANDOM
lda random_fish_chain_table,y
tay
mwa #fishdata ptr0
prfp_1 cpy #0
beq prfp_0
adw ptr0 #fishsize
dey
jmp prfp_1
prfp_0 rts
; Helper for randomizing the fish chain
random_fish_chain_table
:$100 dta b(:1 % fishestotal)
; Modifies the fishchain data pointers
; to reflect situation after movement
adapt_fish_chain_data
lda tmp0
cmp #FC_MOVINGLEFT
bne afcd_0
; Adapt to the left
:fishchain_len-1 mwa tab_fishchain+#*2+2 tab_fishchain+#*2
mwa tab_fish_random tab_fishchain+((fishchain_len-1)*2)
rts
afcd_0 ; Adapt to the right
:fishchain_len-1 mwa tab_fishchain+(((fishchain_len-2)-#)*2) tab_fishchain+(((fishchain_len-2)-#)*2)+2
mwa tab_fish_random tab_fishchain
rts
; Inits the move of a fish chain
; accordingly to the content of "tmp0" (direction)
init_fish_chain_move
lda fcstate
cmp #FC_STATIONARY
bne ifcml_0
jsr adapt_fish_chain_data
lda #(0-1)
sta fishmov
lda #0
sta ffeedof
lda tmp0
sta fcstate
ifcml_0 rts
; Inits the move of a funnel
; accordingly to the content of "tmp0" (direction)
init_funnel_move
lda fstate
cmp #FU_STATIONARY
bne ifm_0
lda #(0-1)
sta fishmov
lda tmp0
sta fstate
ifm_0 rts
move_fish_chain_right
jsr is_movement_finished
; Continue moving
mfcr_3 lda #0
sta tmp0
mwa pscr ptr0
mwa pnscr ptr2
ldx #0
mfcr_1 ldy #(scr_rowsize-2)
mfcr_0 lda #0
lda (ptr0),y
iny
sta (ptr2),y
dey
dey
cpy #(0-1)
bne mfcr_0
inx
cpx #fishdimy
beq mfcr_2
adw ptr0 #scr_rowsize
adw ptr2 #scr_rowsize
jmp mfcr_1
mfcr_2
; Feed newly appearing column with
; data of the random fish
mwa pnscr ptr0
mwa tab_fish_random ptr1
ldx ffeedof
mfcr_7 cpx #0
beq mfcr_6
sbw ptr1 #1
dex
jmp mfcr_7
mfcr_6 ldx #0
mfcr_5 ldy #(fishbperrow-1)
lda (ptr1),y
ldy #0
sta (ptr0),y
inx
cpx #fishdimy
beq mfcr_4
jsr modify_fish_chain_movement_pointers
jmp mfcr_5
mfcr_4 inc ffeedof
jsr flip_screens
rts
move_fish_chain_left
jsr is_movement_finished
; Continue moving
mfcl_3 lda #0
sta tmp0
mwa pscr ptr0
mwa pnscr ptr2
ldx #0
mfcl_1 ldy #1
mfcl_0 lda (ptr0),y
dey
sta (ptr2),y
iny
iny
cpy #scr_rowsize
bne mfcl_0
inx
cpx #fishdimy
beq mfcl_2
adw ptr0 #scr_rowsize
adw ptr2 #scr_rowsize
jmp mfcl_1
mfcl_2
; Feed newly appearing column with
; data of the random fish
mwa pnscr ptr0
adw ptr0 #(scr_rowsize-1)
mwa tab_fish_random ptr1
ldx ffeedof
mfcl_7 cpx #0
beq mfcl_6
adw ptr1 #1
dex
jmp mfcl_7
mfcl_6 ldx #0
mfcl_5 ldy #0
lda (ptr1),y
sta (ptr0),y
inx
cpx #fishdimy
beq mfcl_4
jsr modify_fish_chain_movement_pointers
jmp mfcl_5
mfcl_4 inc ffeedof
jsr flip_screens
rts
; If full move of the funnel is finished
; this routine will move to next state
is_funnel_movement_finished
inc fishmov
lda fishmov
cmp #fishbperrow
bne ifmf_0
lda #FU_STATIONARY
sta fstate
pla
pla
; Make sure funnel position
; is consistent over two
; screens
jsr draw_funnel
jsr flip_screens
ifmf_0 rts
; If full move-segment of the fish chain is finished
; this routine will move to next state
is_movement_finished
inc fishmov
lda fishmov
cmp #fishbperrow
bne @+
; Segment moved
lda #FC_STATIONARY
sta fcstate
jsr randomize_approaching_fish_segment
jsr draw_fish_chain
jsr flip_screens
pla
pla
; Continue moving
@ rts
modify_fish_chain_movement_pointers
adw ptr1 #fishbperrow
adw ptr0 #scr_rowsize
rts
; Draws the entire fish chain
; accordingly to the "tab_fishchain" content
draw_fish_chain
; tmp3 stores the Y-position of the
; chain. Required by "draw_chains_internal"
lda #0
sta tmp3
mwa #(tab_fishchain-2) ptr2
lda #(fishchain_x-8)
sta tmp1
lda #fishchain_len
jsr draw_chains_internal
rts
; Array of pointers representing
; the current content of the fish chain
tab_fishchain
:fishchain_len dta a($0000)
; Random fish part that will be spawned
; when fish chain is moved
tab_fish_random
dta a($0000)
; Draws the full set of fish slots
draw_fish_slots
; tmp3 stores the Y-position of the
; chain. Required by "draw_chains_internal"
lda #fishslot_y
sta tmp3
mwa #(tab_fishslots-2) ptr2
lda #(fishslot_x-8)
sta tmp1
lda #fishslot_len
jsr draw_chains_internal
rts
; Array of pointers representing
; the current content of the fish slots
tab_fishslots
:fishslot_len dta a($0000)
; Array of pointers representing
; the target fish species to be built
tab_fishguidelines
:fishslot_len dta a($0000)
; Helper routine used by
; "draw_fish_chain" and "draw_fish_slots".
; Iterates through pointers to rectangles
; and draws them at the specified position
draw_chains_internal
sta tmp2
@ adw ptr2 #2
lda tmp1
clc
adc #fishbperrow
sta tmp1
sta drf_x
lda tmp3
sta drf_y
ldy #0
lda (ptr2),y
sta ptr1
iny
lda (ptr2),y
sta ptr1+1
jsr draw_data_rectangle
dec tmp2
lda tmp2
cmp #0
bne @-
rts
; Initializes the source rectangle data pointer
; accordinlgy to the selected y-location.
; Preservers "ptr1"
draw_data_rectangle_initpos
lda ptr1
pha
lda ptr1+1
pha
; Tables with Y-coordinates
; are located directly after
; the screen memory
mwa pnscr ptr1
adw ptr1 #scr_size
lda drf_y
asl
tay
lda (ptr1),y
sta ptr0
iny
lda (ptr1),y
sta ptr0+1
pla
sta ptr1+1
pla
sta ptr1
rts
; Draws a data rectangle on the specified location
; drf_x - Horizontal position (4 pixels precision)
; drf_y - Vertical position (1 pixel precision)
; ptr1 - Pointer to rectangle data
; erase_r - Should the rightmost column be erased?
; erase_l - Should the leftmost column be erased?
draw_data_rectangle
mva #0 cntr0
jsr draw_data_rectangle_initpos
ddr_1 ldy #0
ddr_0 lda (ptr1),y
sty tmp0
ldy drf_x
sta (ptr0),y
inc drf_x
ldy tmp0
iny
cpy #fishbperrow
bne ddr_0
; Erase rightmost column if necessary
lda erase_r
cmp #0
beq ddr_4
lda #0
ldy drf_x
sta (ptr0),y
; Erase leftmost column if necessary
ddr_4 lda erase_l
cmp #0
beq ddr_3
lda drf_x
sec
sbc #fishbperrow+1
tay
lda #0
sta (ptr0),y
ddr_3 adw ptr0 #scr_rowsize
adw ptr1 #fishbperrow
inc cntr0
lda cntr0
cmp #fishdimy
bne ddr_2
rts
ddr_2 lda drf_x
sec
sbc #fishbperrow
sta drf_x
jmp ddr_1
delay
inc CDTMF4
lda delayt
sta CDTMV4
lda delayt2
sta CDTMV4+1
@ lda CDTMF4
bne @-
rts
synchro
lda PAL
cmp #1
bne synchr1
lda #145 ; PAL
jmp synchr2
synchr1 lda #120 ; NTSC
synchr2 cmp VCOUNT
bne synchr2
rts
vbi_routine
lda silence
cmp #0
bne @+
jsr RASTERMUSICTRACKER+3
@ jmp XITVBV
stop_music
lda #1
sta silence
jsr RASTERMUSICTRACKER+9
rts
play_music_common
lda #0
sta silence
ldx #<MODUL
ldy #>MODUL
rts
play_lo_beep
jsr play_music_common
lda #05
jsr RASTERMUSICTRACKER ;Init
rts
play_hi_beep
jsr play_music_common
lda #$0d
jsr RASTERMUSICTRACKER ;Init
rts
play_title_music
jsr play_music_common
lda #07
jsr RASTERMUSICTRACKER ;Init
rts
play_game_music
jsr play_music_common
lda #00
jsr RASTERMUSICTRACKER ;Init
rts
play_error_music
jsr play_music_common
lda #$0f
jsr RASTERMUSICTRACKER ;Init
rts
; Align to 2k for single-line resolution sprites
.align $800
pmg_base
:$800 dta b(0)
pmg_p0 equ pmg_base+$400
pmg_p1 equ pmg_base+$500
pmg_p2 equ pmg_base+$600
pmg_p3 equ pmg_base+$700
org pmg_p0+tool_init_y
:2 dta b(15)
:2 dta b(31)
:56 dta b(48)
:2 dta b(31)
:2 dta b(15)
org pmg_p1+tool_init_y
:2 dta b(240)
:2 dta b(248)
:56 dta b(12)
:2 dta b(248)
:2 dta b(240)
.align $400
dlist
:3 dta b($70)
dta b($4d)
scr_mem_antic
dta a($0000)
:95 dta b($0d)
dta b($41),a(dlist)
dlist_title
:2 dta b($70)
dta b($f0) ; DLI - before fish (VCOUNT=$0f)
dta b($4d)
dta a(scr_mem_1)
:6 dta b($0d)
dta b($8d) ; DLI - shades of water (VCOUNT=$17)
:6 dta b($0d)
dta b($8d) ; DLI - shades of water (VCOUNT=$1e)
:6 dta b($0d)
dta b($8d) ; DLI - shades of water (VCOUNT=$25)
:10 dta b($0d)
dta b($f0) ; DLI - before title line (VCOUNT=$33)
dta b($87) ; DLI - before title separator (VCOUNT=$3b)
dta b($82) ; DLI - before first subtitle (VCOUNT=$3f)
dta b($86) ; DLI - before second subtitle (VCOUNT=$43)
dta b($06)
dta b($f0) ; DLI - before text (VCOUNT=$4b)
:5 dta b($02)
dta b($82) ; DLI - after last text line (VCOUNT=$63)
dta b($02)
dta b($02)
dta b($02)
dta b($41),a(dlist)
MODUL equ $a100
org MODUL
opt h-
ins "music/musA100.rmt"
opt h+
MUSICPLAYER equ $b000
org MUSICPLAYER
icl "rmtplayr.a65"
clear_decrunch_panel
mwa #scr_mem_1+scr_rowsize*fishdimy ptr0
mwa #0 ptr1
ldy #0
cdp_0 lda #0
sta (ptr0),y
adw ptr0 #1
adw ptr1 #1
lda ptr1+1
cmp #1
bne cdp_0
lda ptr1
cmp #204
bne cdp_0
rts
write_decrunch_line
adw ptr0 tmp0
ldy #0
wdl_1 lda (ptr2),y
cmp #$9b
beq wdl_0
sta (ptr0),y
iny
jmp wdl_1
wdl_0 rts
decrunching
inc crunched
jsr play_game_music
; Init DLI
lda <decrunch_dli_routine
sta VDSLST
lda >decrunch_dli_routine
sta VDSLST+1
lda #%11000000
sta NMIEN
jsr clear_decrunch_panel
jsr enable_antic
mwa #scr_mem_1+scr_rowsize*fishdimy ptr0
; Draw decrunching text and initial progress bar
mwa #text_decrunch ptr2
mva #113 tmp0
jsr write_decrunch_line
; Paint decrunching progrsss
mwa #text_decrunch_progress ptr2
mva #71 tmp0
jsr write_decrunch_line
; Animate progress
ldx #0
ldy #1
dec_4 lda #94
sta (ptr0),y
jsr very_short_delay
iny
inx
cpx #7
beq dec_5
cpx #12
beq dec_5
cpx #21
beq dec_5
cpx #30
beq dec_6
cpx #44
beq dec_7
jmp dec_4
dec_5
:2 jsr short_delay
jmp dec_4
dec_6
:4 jsr short_delay
jmp dec_4
dec_7
:4 jsr short_delay
; Draw error text
ldx #0
ldy #76
dec_9 lda text_chuj,x
cmp #$9b
beq dec_8
sta (ptr0),y
iny
inx
jmp dec_9
dec_8
jsr play_error_music
:3 jsr short_delay
jsr stop_music
; Back to the normal program
jsr disable_antic
:6 jsr short_delay
rts
text_decrunch
dta d"Decrunching...",b($9b)
text_decrunch_progress
dta b(92)
:30 dta b(93)
dta b(95)
dta b($9b)
text_chuj
dta d" ERROR W CHUJ !!! "*,b($9b)
; Fit font into unused space of PMG memory
org pmg_base
ins "font.fnt"
; Start with polish version
org english
dta b(0)
; Init tool position on load only
org tool_y
dta b(tool_init_y-2)
org RUNAD
dta a(run_here)
|
collision_detection.asm | DavidR86/c64-pong | 0 | 23542 | /* This file handles collision detection. It
does NOT work in the following circumstances:
Sprites very big (Should not happen)
Sprites very close to x=255
*/
#import "data_exchange.asm"
.var spr9th = $d010 //00000000
.var spr0_x = $d000 //spr0 is right paddle
.var spr0_y = $d001
.var spr1_x = $d002 //spr1 is left
.var spr1_y = $d003
.var spr2_x = $d004 //spr2 is ball
.var spr2_y = $d005
.var paddle_height = 21*2 //paddle height is multiplied by 2
.var paddle_half_height = 21
.var paddle_width = 6
.var paddle_half_width = 3
.var ball_height = 7
.var ball_half_height = 3
.var ball_width = 10
.var ball_half_width = 5
coll_func_vars: .fill 9, 0
.var x1 = coll_func_vars //position of segment 1
.var x2 = coll_func_vars + 1 //pos of segment 2
.var x91 = coll_func_vars + 2 //9th bit of pos segment 1
.var x92 = coll_func_vars + 3 //9th bit of pos segment 2
.var d1 = coll_func_vars + 4 //dimension 1
.var d2 = coll_func_vars + 5 //dimension 2
.var r1 = coll_func_vars + 6 //result
.var r2 = coll_func_vars + 7 //result 2
.var tmp = coll_func_vars + 8 //working variable
detect_collisions:
jsr clear_vars //set all variable to 0
jsr detect_ball_lpad //jump to subroutine to detect collision between ball and left paddle
lda r1 // load result into A register
and #%00000010 // isolate 2nd bit
sta r2 // store A register into r2
lda collisions // load collisions variable into A register
ora r2 // bitwise OR in order to mark new collision as on without affecting other bits
sta collisions //sets bit in collision if necessary
jsr clear_vars //set all variable to 0
sta x92 // set x92 to 0
jsr detect_ball_rpad //jump to subroutine to detect collision between ball and right paddle
lda r1 // load result into A register
and #%00000001 // isolate 1st bit
sta r2 // store A register into r2
lda collisions // load collisions variable into A register
ora r2 // bitwise OR in order to mark new collision as on without affecting other bits
sta collisions //sets bit in collision if necessary
jsr clear_vars //set all variable to 0
jsr detect_ball_upper_border // jump to subroutine to detect collision between ball and upper border
lda r1 // load result into A register
and #%00000100 // isolate 3rd bit
sta r2 // store A register into r2
lda collisions // load collisions variable into A register
ora r2 // bitwise OR in order to mark new collision as on without affecting other bits
sta collisions //sets bit in collision if necessary
jsr clear_vars //set all variable to 0
jsr detect_ball_lower_border // jump to subroutine to detect collision between ball and lower border
lda r1 // load result into A register
and #%00001000 // isolate 4th bit
sta r2 // store A register into r2
lda collisions // load collisions variable into A register
ora r2 // bitwise OR in order to mark new collision as on without affecting other bits
sta collisions //sets bit in collision if necessary
jsr clear_vars //set all variable to 0
jsr detect_ball_left_border // jump to subroutine to detect collision between ball and left border
lda r1 // load result into A register
and #%00100000 // isolate 6th bit
sta r2 // store A register into r2
lda collisions // load collisions variable into A register
ora r2 // bitwise OR in order to mark new collision as on without affecting other bits
sta collisions //sets bit in collision if necessary
jsr clear_vars //set all variable to 0
jsr detect_ball_right_border // jump to subroutine to detect collision between ball and lower border
lda r1 // load result into A register
and #%00010000 // isolate 5th bit
sta r2 // store A register into r2
lda collisions // load collisions variable into A register
ora r2 // bitwise OR in order to mark new collision as on without affecting other bits
sta collisions //sets bit in collision if necessary
rts // returns from subroutine
detect_ball_right_border: //detects if ball has collided with the right border
lda #%00000100
and spr9th
bne d_b_r_b_1 //if 9th bit is 1, branch
rts
d_b_r_b_1:
lda spr2_x
cmp #$4e
bcs d_b_r_b_2 //if $4e <= position, branch
rts
d_b_r_b_2:
lda #$FF
sta r1
rts
rts
detect_ball_left_border: //detects if the ball has collided with the left border of the screen
lda #%00000100
and spr9th
beq d_b_le_b_1 //if 9th bit of ball is 0, branch
rts
d_b_le_b_1:
lda #$18
cmp spr2_x
bcs d_b_le_b_2 // if position <= $18, branch
rts
d_b_le_b_2:
lda #$FF
sta r1
rts
detect_ball_upper_border: //detects if the ball has collided with the upper border
lda #00
sta r1
lda #$33
cmp spr2_y
bcs d_b_u_b_1 // if position <= $33, branch
rts
d_b_u_b_1:
lda #$FF
sta r1
rts
detect_ball_lower_border: //detects if ball has collided with lower border
lda #00
sta r1
lda spr2_y
cmp #$f3
bcs d_b_l_b_1 // if $f3 <= position, branch
rts
d_b_l_b_1:
lda #$FF
sta r1
rts
detect_ball_lpad:
lda spr1_x
clc
adc #paddle_half_width // add half the width, to find center of object
sta x1
lda x91
adc #$00 //add the carry of the last operation to 9th bit in case it overflowed
sta x91
lda spr9th
clc
ror
and #$01 //Isolate 9th bit
clc //need to clear, as ror might have set carry
adc x91
sta x91
lda #paddle_width
sta d1
jsr load_ball_x
jsr detect_dimension_collision //Detect if x-coordinate collides
lda r1
sta r2
lda spr1_y
clc
adc #paddle_half_height
sta x1
lda #$00
sta x91
lda #paddle_height
sta d1
jsr load_ball_y
jsr detect_dimension_collision
lda r1
and r2 // if both results were $FF, then a will contain $FF
sta r1
rts
detect_ball_rpad: //checks whether a collision exists between the ball and right paddle, sets r1 to $FF if true
lda spr0_x // load x coordinate of sprite 0 into A register
clc // clear carry flag
adc #paddle_half_width // add half the width, to find center of object
sta x1 // store A register into x1 variable
lda x91 // load contents of x91 variable into A register
adc #$00 //add the carry of the last operation to 9th bit in case it overflowed
sta x91 // store A register into x91 variable
lda spr9th // load spr9th into A register, where the 9th bit of the sprites' x-coordinates are stored
and #$01 //Isolate 9th bit
adc x91 // add x91 unto A register and store in A register
sta x91 // store A register into x91
lda #paddle_width // load paddle width constant into A register
sta d1 // store A register in first dimension variable
jsr load_ball_x // jump to subroutine that loads ball's (sprite 2) x variables
jsr detect_dimension_collision //Jump to subroutine that detects whether there is a collision in the x dimension
lda r1 // load collision detection result into A register
sta r2 // load A register into r2
lda spr0_y // load sprite 0 y coordinate into A register
clc // clear carry flag
adc #paddle_half_height // add paddle half height constant, to get coordinate of center of the paddle
sta x1 // store result into x1
lda #$00 // load 0 into A register
sta x91 // store A register into x91
lda #paddle_height // load paddle height constant into A register
sta d1 // store A register into dimension 1 variable
jsr load_ball_y //jump into subroutine to load variables for ball (sprite 2) y coordinates
jsr detect_dimension_collision // detect collision in the y dimension
lda r1 // load y dimension collision test result
and r2 // bitwise AND with previous result, if both results were $FF, then a will contain $FF
sta r1 // store final result into r1
rts // return from subroutine
load_ball_x:
lda spr2_x // load sprite 2 x coordinate into A register
clc // clear carry flag
adc #ball_half_width //add half width constant, in order to get center coordinate of ball
sta x2 //store into x2 variable
lda x92 //load x92 into A register
adc #$00 // If there was an overflow, add 1 to A register
sta x92 // Store A register into x92
lda spr9th // load spr9th into A register
clc // clear carry flag
ror // Bitwise shift right of A register
clc // clear carry flag
ror // bitwise shift right
and #$01 //Isolate 9th bit of ball only
adc x92 // set 9th bit of sprite 2 in x92 variable
sta x92 // store A in x92
lda #ball_width // load ball width constant into A register
sta d2 // store A register into dimension 2 variable
rts
detect_dimension_collision: // finds if 9th bit is the same, if so continue
//TODO: Make collision work even if 9th bit is different on each sprite
lda x91 // load x91 into A register
cmp x92 // compare x92 with A register
beq detect_dimension_collision_2 //if first sprite 9th bit is equal to second sprite 9th bit, jump to label
rts
detect_dimension_collision_2: //finds whether it is possible for the objects to collide in the given dimension, must be given paramenters, returns $FF in A register if true
lda #$00 // load 0 into A
sta r1 //load preliminary result
jsr ensure_dimension // jump to subroutine to make sure the first dimension is greater than the second
sec // set carry flag
lda x1 // load x1 into A register
sbc x2 //subtract x2 from x1, getting distance between points
clc // clear carry flag
sta tmp // store A register into tmp
adc tmp // multiply a by 2, by adding it unto itself
bcc d_d_1 // if no overflow was found, jump to label
rts //carry was set, number too large to possibly be close enough, as there was an overflow
d_d_1: tay // transfer A register into Y register
lda d1 // load d1 into A register
clc // clear carry flag
adc d2 //add both dimension sizes together
sty tmp //store distance*2 in tmp
cmp tmp // compare distance*2 with width1+width2
bcs d_d_2 //if distance*2 < width1+width2, jump to label
rts // return from subroutine
d_d_2: lda #$FF // load 255 into A register
sta r1 // store A register into r1, meaning the dimension does collide
rts //return from subroutine
load_ball_y:
lda spr2_y
adc #ball_half_height
sta x2
lda #$00
sta x92
lda #ball_height
sta d2
rts
ensure_dimension: //Makes sure the first dimension is greater than the second
lda x1
sec
sbc x2
lda x91
sbc x92
bcc swap_d //x1<x2, swap numbers
rts
swap_d:
lda x1
ldx x2
sta x2
txa
sta x1 //swap x1 and x2
lda x91
ldx x92
sta x92
txa
sta x91 //swap x91 and x92
lda d1
ldx d2
sta d2
txa
sta d1 //swap d1 and d2
clc
rts
clear_vars:
lda #$00
sta x1
sta x2
sta x91
sta x92
sta d1
sta d2
sta r1
sta r2
rts
|
software/hal/boards/common/hil/hil-clock.ads | TUM-EI-RCS/StratoX | 12 | 23577 | -- Institution: Technische Universität München
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
--
-- Authors: <NAME> (<EMAIL>)
with HIL.Devices;
with Ada.Real_Time;
-- @summary
-- Target-independent specification for HIL of Clocks
package HIL.Clock with
SPARK_Mode
is
procedure configure;
-- get number of systicks since POR
function getSysTick return Natural;
-- get system time since POR
function getSysTime return Ada.Real_Time.Time;
end HIL.Clock;
|
V2/src/ASH VGA/Old/ASH_VGA_BITEST.z80.asm | anjennings/Tom80 | 55 | 47 | <reponame>anjennings/Tom80
;ASH - Aidan's SHell (VGA Output Only Test)
STACK equ 0xFFF0
OUTPUT_SEL equ STACK+1 ;Indicates if output is via serial or VGA
PROP_ENABLED equ STACK+2 ;Set to 0 if Prop is detected at boot
PROP_WRITE_FLAG equ STACK+3
PROP_READ_FLAG equ STACK+4
;First byte of term buf is the size of the term buf
TERM_BUF equ 0x8000
;Maximum size of the buffer
TERM_BUF_MAX equ 256
;Baud Rate Divisor (115200)
BAUD_DIV_HIGH equ 0
BAUD_DIV_LOW equ 8
;////////////////
;UART Registers
;////////////////
UART_DHR equ 0x10 ;UART Data R/W register
UART_IER equ 0x11 ;Interrupt Enable Register
UART_IFR equ 0x12 ;Interrupt ID Reg (READ), FIFO Control Reg (WRITE)
UART_LCR equ 0x13 ;Line Control Register
UART_MCR equ 0x14 ;Modem Control
UART_LSR equ 0x15 ;Line Status Register
UART_MSR equ 0x16 ;Modem Status (Unused)
UART_SCR equ 0x17 ;Arbitrary data can be stored here
;According to the datasheet:
;8 Databits, No parity, 1 Stop
;///////////
;Charactars
;///////////
CHAR_NEWLINE equ 0xA
CHAR_RETURN equ 0xD
CHAR_EOT equ 0x3
CHAR_SPACE equ 0x20
CHAR_NULL equ 0x0
SYM_READ equ ":"
SYM_WRITE equ "<"
SYM_EXE equ "@"
SYM_HELP equ "?"
;//////////////////////////////////////
;PIO REGISTERS
;//////////////////////////////////////
PIO_BASE equ 0x0
PIO_PORTA_DAT equ (PIO_BASE)
PIO_PORTB_DAT equ (PIO_BASE+1)
PIO_PORTA_CON equ (PIO_BASE+2)
PIO_PORTB_CON equ (PIO_BASE+3)
;Interrupt Vector
PIO_INT_HIGH equ 0x08
PIO_INT_LOW equ 0x00 ;LSB is disregarded by PIO
PIO_INT equ ((PIO_INT_HIGH*256) + (PIO_INT_LOW))
PIO_INT_VECT_A equ (PIO_INT_LOW & 0xFE)
PIO_INT_VECT_B equ (PIO_INT_LOW+2 & 0xFE)
;Mode Control Words
MODE_OUT equ 0x0F ;MODE 0
MODE_IN equ 0x4F ;MODE 1
MODE_BI equ 0x8F ;MODE 2
MODE_CON equ 0xCF ;MODE 3
;Must be sent after setting mode 3
PIO_B_CON_IO equ 0x00 ;Set PB0, all of port B to outputs
;Interrupt Contro Words
PIO_INT_EN_A equ 0x87 ;Enable interrupt for mode 0-2
PIO_INT_EN_B equ 0x97 ;Enable interrupt for mode 3, mask follows
PIO_INT_DE equ 0x07 ;Disable interrupt for all modes
PIO_MASK equ 0xFF ;Must follow Int enable on mode 3
OUTPUT_SERIAL equ 'S'
OUTPUT_VGA equ 'V'
org PIO_INT
dw (PIO_INT_HANDLER_OUT)
dw (PIO_INT_HANDLER_IN)
;/////////////////
;Code Starts HERE
;/////////////////
org 0000h
BOOT:
;Wait a few clocks
DI
NOP
NOP
JP INIT
org 08h
CALL GETCH
RET
org 10h
CALL GETSTR
RET
org 18h
CALL PRINTCH
RET
org 20h
CALL WRITE_STR
RET
org 28h
RET
org 30h
RET
;//////////////////
;Interrupt Routine
;//////////////////
org 0038h
RETI
INIT:
;Set up Stack
LD HL, STACK
LD SP, HL
;Set up output check
LD HL, OUTPUT_SEL
LD (HL), 0
;Set up UART
CALL UART_INIT
;Set up PIO
CALL PIO_INIT
INIT_DETECT_PIO:
CALL PIO_DETECT
LD HL, PROP_ENABLED
LD A, (HL)
CP 0
JP Z, INIT_OUTPUT_SET
;If Prop is disabled, set to serial
LD HL, OUTPUT_SEL
LD (HL), OUTPUT_SERIAL
JP MAIN
INIT_OUTPUT_SET:
CALL GETCH ;Wait until user presses a button to do anything
LD HL, OUTPUT_MSG
CALL WRITE_STR
CALL OUTPUT_CHECK
MAIN:
CALL GETCH
;Print Boot Screen
LD HL, BOOT_MSG
CALL WRITE_STR
;Do PIO Test Here
CALL PIO_TEST
CALL PRINTCH
LD HL, PIO_TEST_STR
CALL WRITE_STR
MAIN_LOOP:
CALL MONITOR
JP MAIN_LOOP
MONITOR:
PUSH AF
PUSH HL
;Clear Terminal Buffer
LD HL, TERM_BUF
LD A, 0
LD (HL), A
;Print Prompt
LD HL, PROMPT
CALL WRITE_STR
;Get the user input and evaluate
CALL GETSTR
CALL EVALUATE_STMT
POP HL
POP AF
RET
;//////////////////////
;//////Functions///////
;//////////////////////
;//////////////////////////////////////
;PIO Functions
;//////////////////////////////////////
PIO_INIT:
PUSH AF
DI
;Set interrupt page
LD A, PIO_INT_HIGH
LD I, A
;Set Interrupt Vector on port A and B to be the same (they can be different)
LD A, PIO_INT_VECT_A
OUT PIO_PORTA_CON, A
LD A, PIO_INT_VECT_B
OUT PIO_PORTB_CON, A
;Set port B as manual control
LD A, MODE_CON
OUT PIO_PORTB_CON, A
LD A, PIO_B_CON_IO
OUT PIO_PORTB_CON, A
;Set Interrupt Enable on Port B
LD A, PIO_INT_EN_B
OUT PIO_PORTB_CON, A
LD A, PIO_MASK ;No pins generate interrupts
OUT PIO_PORTB_CON, A
;Put port B in a known state
LD A, 0xFF
OUT PIO_PORTB_DAT, A
;Set port A as bi-directional
LD A, MODE_BI
OUT PIO_PORTA_CON, A
;Set Interrupt Enable on Port A
LD A, PIO_INT_EN_A
OUT PIO_PORTA_CON, A
;Clear input register
IN A, PIO_PORTA_DAT
POP AF
IM 2
;EI
RET
;This is run when the PIO is written to
PIO_INT_HANDLER_OUT:
EX AF, AF'
EXX
;Indicate that prop is enabled
LD HL, PROP_ENABLED
LD (HL), 0
EX AF, AF'
EXX
RETI
;Runs when PIO returns data to CPU
PIO_INT_HANDLER_IN:
RETI
;Send command to PIO
;Expects A to be command
;Halt until interrupt response
PIO_SEND_CMD:
PUSH AF
;Write to PIO (Check status beforehand?)
OUT PIO_PORTA_DAT, A
EI
HALT ;Wait for Prop to acknowledge write
DI
;Read data from PIO
;IN A, PIO_PORTA_DAT
POP AF
RET
;Wait for interrupt to break out of loop
;Read data from register
PIO_GET_DATA:
EI
HALT
DI
IN A, PIO_PORTA_DAT
RET
;Send command to PIO and wait for reply
;If nothing comes through assume prop is disabled
;Returns 0 if Prop is running
PIO_DETECT:
PUSH AF
PUSH BC
PUSH HL
;Send data
LD A, 0
OUT PIO_PORTA_DAT, A
EI
;Set flag
LD HL, PROP_ENABLED
LD A, 0xFF
LD (HL), A
LD A, 0
EI
DETECT_LOOP:
INC A
LD B, A ;Save A
LD A, (HL)
CP 0 ;Check if flag has changed
JP Z, DETECT_END
LD A, B
CP 0 ;Check if count has rolled over
JP NZ, DETECT_LOOP
DETECT_END:
DI
POP HL
POP BC
POP AF
RET
;Get a character and set output mode based on value
OUTPUT_CHECK:
PUSH AF
PUSH HL
LD HL, OUTPUT_SEL
CHECK:
CALL GETCH
CHECK_SERIAL:
CP OUTPUT_SERIAL
JP NZ, CHECK_VIDEO
LD (HL), OUTPUT_SERIAL
JP OUTPUT_CHECK_END
CHECK_VIDEO:
CP OUTPUT_VGA
JP NZ, CHECK
LD (HL), OUTPUT_VGA
OUTPUT_CHECK_END:
POP HL
POP AF
RET
PIO_TEST:
LD A, 0x80
CALL PIO_SEND_CMD ;Send command
CALL PIO_GET_DATA ;Get reply
RET ;Return with value
;//////////////////////////////////////
;UART Functions
;//////////////////////////////////////
UART_INIT:
PUSH AF
CALL UART_CLEAR_DLAB
CALL UART_DISABLE_FIFO
CALL UART_SET_LINE_CONTROL
CALL UART_TOGGLE_OUT1
CALL UART_TOGGLE_OUT2
CALL UART_CLEAR_LSR
CALL UART_SET_DLAB
CALL UART_SET_BAUD
CALL UART_CLEAR_DLAB
POP AF
RET
UART_CLEAR_DLAB:
PUSH AF
IN A, (UART_LCR)
AND 0x7F
OUT (UART_LCR), A
POP AF
RET
UART_SET_DLAB:
PUSH AF
IN A, (UART_LCR)
OR 0x80
OUT (UART_LCR), A
POP AF
RET
UART_SET_LINE_CONTROL:
PUSH AF
LD A, 0x3 ;8 Bit word, 1 stop, no parity
OUT (UART_LCR), A
POP AF
RET
UART_DISABLE_FIFO:
PUSH AF
LD A, 0x6
OUT (UART_IFR), A
POP AF
RET
UART_SET_BAUD:
PUSH AF
;115200
LD A, BAUD_DIV_LOW
OUT (UART_DHR), A
LD A, BAUD_DIV_HIGH
OUT (UART_IER), A
POP AF
RET
UART_CLEAR_LSR:
PUSH AF
;Clear Line Status Reg Errors (Page 21)
IN A, (UART_LSR)
POP AF
RET
UART_TOGGLE_OUT1:
PUSH AF
IN A, (UART_MCR)
XOR 0x4
OUT (UART_MCR), A
POP AF
RET
UART_TOGGLE_OUT2:
PUSH AF
IN A, (UART_MCR)
XOR 0x8
OUT (UART_MCR), A
POP AF
RET
;//////////////////////////////////////
;Get a character from the FIFO, add to write buffer and echo to screen
;Value is returned in A
;//////////////////////////////////////
GETCH:
PUSH BC
CALL UART_CLEAR_DLAB
GETCH_LOOP:
;Read Line Status Reg
IN A, (UART_LSR)
;If only bit 1 is set then FIFO has new data
AND 0x1F
CP 1
JP NZ, GETCH_LOOP
;Get next char from data holding register
IN A, (UART_DHR)
CALL WRITE_BUFFER
CALL UART_TOGGLE_OUT2
GETCH_END:
POP BC
RET
;//////////////////////////////////////
;Get a line of text from the FIFO, until a return or newline is recieved
;//////////////////////////////////////
GETSTR:
PUSH AF
GETSTR_LOOP:
CALL GETCH
CP CHAR_RETURN
JP NZ, GETSTR_LOOP
POP AF
RET
;///////////////////////////////////////
;Write a charactar to the terminal buffer, and echo to screen
;expects A to be the character
;//////////////////////////////////////
WRITE_BUFFER:
PUSH AF
PUSH BC
PUSH DE
;Save character in D
LD D, A
;Load address of terminal buffer
LD BC, TERM_BUF
;Get size of terminal buffer
LD A, (BC)
;Add 1
INC A
;Write new length to start of buffer
LD (BC), A
;Add A and C for new offset (C should be 0 but just in case)
ADD A, C
;Put A into C
LD C, A
;Put char back into A
LD A, D
;Write to buffer
LD (BC), A
CALL PRINTCH
POP DE
POP BC
POP AF
RET
;/////////////////////////////////////////
;Assumes that A is the charactar to write
;/////////////////////////////////////////
PRINTCH:
PUSH AF
PUSH BC
PUSH HL
;Save char into B
LD B, A
LD HL, OUTPUT_SEL
LD A, (HL)
CP OUTPUT_VGA
JP Z, PRINTCH_VIDEO
PRINTCH_SERIAL:
CALL UART_CLEAR_DLAB
PRINTCH_LOOP:
;Read transmit register status in line status register (LSR) See page 22
;Wait if not empty
IN A, (UART_LSR)
AND 0x60
CP 0x60
JP NZ, PRINTCH_LOOP
;Write Char to UART
LD A, B
OUT (UART_DHR), A
LD HL, OUTPUT_SEL
LD A, (HL)
CP 'S'
JP Z, PRINTCH_EXIT
PRINTCH_VIDEO:
LD A, B
;AND 0x7F
;CALL PIO_SEND_CMD
CALL PRINTCH_VGA
PRINTCH_EXIT:
POP HL
POP BC
POP AF
RET
PRINTCH_VGA:
PUSH AF
AND 0x7F
CALL PIO_SEND_CMD
POP AF
RET
;////////////////////////////////////////
;Writes a string via IO
;Expects HL to be the address of a string
;////////////////////////////////////////
WRITE_STR:
PUSH AF
PUSH HL
WRITE_START:
LD A, (HL)
CP CHAR_EOT
JP Z, WRITE_CLOSE
CALL PRINTCH
INC HL
JP WRITE_START
WRITE_CLOSE:
CALL UART_TOGGLE_OUT1
POP HL
POP AF
RET
;Main function to tokenize, parse, and execute user entered expressions
;Assume AF has return values
EVALUATE_STMT:
PUSH AF
PUSH HL
;Tokenizes and checks for invalid characters
CALL TOKENIZE_BUFFER
JP C, EVALUATE_STMT_TOKEN_FAIL
;Checks syntax and prepares for execution
CALL PARSE_BUFFER
JP C, EVALUATE_STMT_SYNTAX_FAIL
;Execute the commands found in the buffer
CALL EXECUTE_BUFFER
JP C, EVALUATE_STMT_EXE_FAIL
;If all three functions return then jump to end
JP EVALUATE_STMT_RETURN
EVALUATE_STMT_TOKEN_FAIL:
LD HL, TOKEN_ERROR
CALL WRITE_STR
JP EVALUATE_STMT_RETURN
EVALUATE_STMT_SYNTAX_FAIL:
LD HL, SYNTAX_ERROR
CALL WRITE_STR
JP EVALUATE_STMT_RETURN
EVALUATE_STMT_EXE_FAIL:
LD HL, EXE_ERROR
CALL WRITE_STR
EVALUATE_STMT_RETURN:
POP HL
POP AF
RET
;////////////////////////////////////////////////////////////////
;There are 5 types of symbols - LITERAL, @, :, <, ?
;Returns status in register A
;0x00 - Good
;0xFF - Bad
;////////////////////////////////////////////////////////////////
;Buffer for tokens, first byte is size of buffer
TOKEN_BUF equ 0x8100
;Token Symbols in token buffer
TOKEN_EF equ 0 ;End of buffer size 1
TOKEN_LT equ 1 ;ABCDEF0123<PASSWORD> size 2
TOKEN_EX equ 2 ;@ size 1
TOKEN_RD equ 3 ;: size 1
TOKEN_WR equ 4 ;< size 1
TOKEN_HE equ 5 ;? size 1
TOKEN_WD equ 6 ;Full Word, size 3
;////////////////////////////////////////////////////////////////
TOKENIZE_BUFFER:
PUSH BC
PUSH DE
;Clear parse buffer
LD DE, TOKEN_BUF
LD A, 0
LD (DE), A
;Get start of terminal buffer
LD DE, TERM_BUF
;For instruction tokens or newlines
;Load the token code into C and pass that to the tokenize function
;If its a hex letter or number
;The value is in B already and the tokenize function expects that
;Basically, for every byte in the buffer:
;is it a newline? if so then exit
;is it a number? if so then convert to hex and tokenize
;is it a a hex char? convert to hex and tokenize
;is it an instruction? put the propper token
;is it whitespace? ignore
TOKENIZE_BUFFER_LOOP:
;Get next character
INC DE
LD A, (DE)
;Save character
LD B, A
;/////////////////////
;Check if return
;/////////////////////
LD C, TOKEN_EF
CP CHAR_RETURN
CALL Z, TOKENIZE_INSTR
;Return to start of loop if return is FF
CP 0xFF
JP Z, TOKENIZE_BUFFER_RETURN_SUCCESS
;/////////////////////
;Check if a number
;/////////////////////
SUB 0x30
CP 0xA
CALL C, TOKENIZE_NUMBERS
;Return to start of loop if return is FF
CP 0xFF
JP Z, TOKENIZE_BUFFER_LOOP
;Return original character
LD A, B
;/////////////////////
;Check if a hex character
;/////////////////////
SUB 0x41
CP 0x6
CALL C, TOKENIZE_CHAR
;Return to start of loop if return is FF
CP 0xF
JP Z, TOKENIZE_BUFFER_LOOP
;Return original character
LD A, B
;/////////////////////
;Check if a ?
;/////////////////////
LD C, TOKEN_HE
CP SYM_HELP
CALL Z, TOKENIZE_INSTR
;Return to start of loop if return is FF
CP 0xFF
JP Z, TOKENIZE_BUFFER_LOOP
;Return original character
LD A, B
;/////////////////////
;Check if a :
;/////////////////////
LD C, TOKEN_RD
CP SYM_READ
CALL Z, TOKENIZE_INSTR
;Return to start of loop if return is FF
CP 0xFF
JP Z, TOKENIZE_BUFFER_LOOP
;Return original character
LD A, B
;/////////////////////
;Check if a <
;/////////////////////
LD C, TOKEN_WR
CP SYM_WRITE
CALL Z, TOKENIZE_INSTR
;Return to start of loop if return is FF
CP 0xFF
JP Z, TOKENIZE_BUFFER_LOOP
;Return original character
LD A, B
;/////////////////////
;Check if a @
;/////////////////////
LD C, TOKEN_EX
CP SYM_EXE
CALL Z, TOKENIZE_INSTR
;Return to start of loop if return is FF
CP 0xFF
JP Z, TOKENIZE_BUFFER_LOOP
;/////////////////////
;Check if whitespace (ignore) (maybe shouldn't ignore?)
;/////////////////////
CP 0x20
JP Z, TOKENIZE_BUFFER_LOOP
;If the program gets to this point there is an error
SCF
JP TOKENIZE_BUFFER_RETURN
TOKENIZE_BUFFER_RETURN_SUCCESS:
;Signal that the program returned successful!
SCF
CCF
TOKENIZE_BUFFER_RETURN:
POP DE
POP BC
RET
;Expects C to be the token value
;Return 0xFF in A when complete
TOKENIZE_INSTR:
PUSH BC
PUSH DE
PUSH HL
;Get size of token buffer
LD HL, TOKEN_BUF
LD A, (HL)
;Save in D
LD D, A
;Increment token buffer size
INC A
LD (HL), A
;Add the new size to the pointer so that it points to the next open spot
LD A, D
ADD A, L
INC A
LD L, A
;Put Instruction Token at the next open spot
LD (HL), C
INC L ;TODO: ???
POP HL
POP DE
POP BC
LD A, 0xFF
RET
;Expects B to hold next char value
;Write token symbol and value (if needed) to TOKEN_BUF
TOKENIZE_NUMBERS:
PUSH BC
PUSH DE
PUSH HL
;Get size of token buffer
LD HL, TOKEN_BUF
LD A, (HL)
;Save in C
LD C, A
;Increment by 2
ADD A, 2
LD (HL), A
;Add size to the buffer pointer to get the next available spot
LD A, C
ADD A, L
INC A
LD L, A
;Put Number Token
LD (HL), TOKEN_LT
INC L
;Put Token Value
LD A, B
SUB 0x30
LD (HL), A
POP HL
POP DE
POP BC
LD A, 0xFF
RET
;Expects B to be the Char value
;Write token symbol and value to TOKEN_BUF
;Returns an F instead of FF because of an error with @
TOKENIZE_CHAR:
PUSH BC
PUSH DE
PUSH HL
;Get size of token buffer
LD HL, TOKEN_BUF
LD A, (HL)
;Save in C
LD C, A
;Increment by 2
ADD A, 2
LD (HL), A
;Goto next free spot
LD A, C
ADD A, L
INC A
LD L, A
;Put Number Token
LD (HL), TOKEN_LT
INC L
;Put Token Value
LD A, B
SUB 0x37
LD (HL), A
POP HL
POP DE
POP BC
LD A, 0xF
RET
;TODO: Can this just write over the other buffers?
;Buffer for Parser
PARSE_RAM equ 0x8200
;Current and next token for parser
PARSE_CUR equ 0x8200
PARSE_NEXT equ 0x8201
;Location of state for FSM
PARSE_STATE equ 0x8202
;Incrementor location for parser
PARSE_INC equ 0x8203
;High and low values for literals
PARSE_LIT_H equ 0x8204
PARSE_LIT_L equ 0x8205
PARSE_BUF equ 0x8210
;This should organize each token into a fully readable form
;I'm using the term 'Parse' very loosely
;Return 0x00 on success
PARSE_BUFFER:
PUSH BC
PUSH DE
PUSH HL
;Get start of token buffer
LD HL, TOKEN_BUF
;Get size of buffer
LD A, (HL)
;Return if its empty
CP 0
JP Z, PARSE_BUFFER_RETUN_SUCCESS
;Clear literal storage
LD HL, PARSE_LIT_L
LD (HL), 0
LD HL, PARSE_LIT_H
LD (HL), 0
;Set state to be start
;LD HL, PARSE_STATE
;LD (HL), STATE_START
;Set size of buffer to be 0
LD HL, PARSE_BUF
LD (HL), 0
;Set incrementor
LD HL, PARSE_INC
LD (HL), 1
PARSE_BUFFER_LOOP:
;Get incrementor
LD HL, PARSE_INC
LD A, (HL)
;Go to next location in token buffer
LD HL, TOKEN_BUF
ADD A, L
LD L, A
;Get Token, save to A and B
LD A, (HL)
LD B, A
;Check if its the end of the buffer
CP TOKEN_EF
CALL Z, PARSE_INST
CP 0xFF
JP Z, PARSE_BUFFER_RETUN_SUCCESS
;Check if current token is a single literal value
CP TOKEN_LT
CALL Z, PARSE_LITERAL
CP 0xFF
JP Z, PARSE_BUFFER_LOOP
;Check if current token is an @ symbol
CP TOKEN_EX
CALL Z, PARSE_INST
CP 0xFF
JP Z, PARSE_BUFFER_LOOP
;Check if current token is an : symbol
CP TOKEN_RD
CALL Z, PARSE_INST
CP 0xFF
JP Z, PARSE_BUFFER_LOOP
;Check if current token is an < symbol
CP TOKEN_WR
CALL Z, PARSE_INST
CP 0xFF
JP Z, PARSE_BUFFER_LOOP
;Check if current token is an ? symbol
CP TOKEN_HE
CALL Z, PARSE_INST
CP 0xFF
JP Z, PARSE_BUFFER_LOOP
;If parser reaches this point there is an invalid token
;LD A, 0xFF
;Set carry flag
SCF
JP PARSE_BUFFER_RETURN
PARSE_BUFFER_RETUN_SUCCESS:
;Clear carry flag
SCF
CCF
PARSE_BUFFER_RETURN:
POP HL
POP DE
POP BC
RET
;HL should be location of next token
;A should be the token
PARSE_LITERAL:
PUSH BC
PUSH DE
PUSH HL
PARSE_LITERAL_LOOP:
;Check if this is a literal token
;TODO jump to an error state, not save
CP TOKEN_LT
JP NZ, PARSE_LITERAL_SAVE
;The goal of this next section is to shift the current token into two 8 bit values to create a single 16 bit value
;This is horrible and ugly but im too tired to make it better right now
;Get value
INC L
LD A, (HL)
;Save HL for later
PUSH HL
;Save value into E
LD E, A
;Get high literal value
LD HL, PARSE_LIT_H
LD A, (HL)
;Rotate A by 4 to the left (may have to rotate 5 times?) so now low bytes are high
RLCA
RLCA
RLCA
RLCA
;Zero out lower bytes
AND 0xF0
;Save rotated high byte into B
LD B, A
;Get Low literal value
LD HL, PARSE_LIT_L
LD A, (HL)
;Rotate A by 4 to the left (so now low and high bytes are swapped)
RLCA
RLCA
RLCA
RLCA
;Save into C
LD C, A
;Zero out high bytes
AND 0x0F
;Now A should contain the HIGH byte
OR B
LD HL, PARSE_LIT_H
LD (HL), A
;Now get the value of the token
LD A, C
;Put the new token (stored in E) into the low bytes of A
AND 0xF0
OR E
;Save
LD HL, PARSE_LIT_L
LD (HL), A
;Get TOKEN incrementor
LD HL, PARSE_INC
LD A, (HL)
ADD A, 2
LD (HL), A
;Increment pointer and return to start
POP HL
INC L
LD A, (HL)
JP PARSE_LITERAL_LOOP
PARSE_LITERAL_SAVE:
;First, save this token and the full value
;Get size of parse buffer
;HL Holds the location of the next (non literal) token
PUSH HL
LD HL, PARSE_BUF
LD A, (HL)
;Go to next empty spot
ADD A, L
INC A
LD L, A
;First put word token
LD (HL), TOKEN_WD
INC L
;Next Put High Byte
LD DE, PARSE_LIT_H
LD A, (DE)
LD (HL), A
INC L
;Next put low byte
LD DE, PARSE_LIT_L
LD A, (DE)
LD (HL), A
INC L
;Clear literal storage NEWNEWNEW
LD HL, PARSE_LIT_L
LD (HL), 0
LD HL, PARSE_LIT_H
LD (HL), 0
;Go back to start of buffer, get size
LD HL, PARSE_BUF
LD A, (HL)
;Increment by size of token
ADD A, 0x3
LD (HL), A
POP HL
PARSE_LITERAL_RETURN_SUCCESS:
LD A, 0xFF
PARSE_LITERAL_RETURN:
POP HL
POP DE
POP BC
RET
;A should just be the instruciton token, no additional work needed
PARSE_INST:
PUSH BC
PUSH DE
PUSH HL
;Save token into B
LD B, A
LD HL, PARSE_BUF
LD A, (HL)
;Go to next empty spot
ADD A, L
INC A
LD L, A
;Put token
LD (HL), B
;Go back to start of buffer, get size
LD HL, PARSE_BUF
LD A, (HL)
;Increment by size of token
INC A
LD (HL), A
;Update TOKEN incrementor
LD HL, PARSE_INC
LD A, (HL)
INC A
LD (HL), A
;Set return value
LD A, 0xFF
POP HL
POP DE
POP BC
RET
;This is essentially a big case statement depending on which token appears
;first in the parse buffer, each case has a corresponding subroutine
;it shouldn't be hard to add extra functions later if needed
EXECUTE_BUFFER:
PUSH BC
PUSH DE
PUSH HL
;Go to first token in parse buffer
LD HL, PARSE_BUF
INC HL
;Get token
LD A, (HL)
EXECUTE_BUFFER_EF:
;Check if its the end of the buffer (no instruction)
CP TOKEN_EF
JP Z, EXECUTE_BUFFER_RETURN_SUCCESS
EXECUTE_BUFFER_WD:
;Check if current token is a Word Value
CP TOKEN_WD
JP NZ, EXECUTE_BUFFER_EXE ;If not, jump to the next
CALL EVAL_LITERAL
CP 0 ;Expect a return value of 0
JP Z, EXECUTE_BUFFER_RETURN_SUCCESS
EXECUTE_BUFFER_EXE:
;Check if current token is an @ symbol
CP TOKEN_EX
JP NZ, EXECUTE_BUFFER_HE
CALL EVAL_EXE
CP 0
JP Z, EXECUTE_BUFFER_RETURN_SUCCESS
EXECUTE_BUFFER_HE:
;Check if current token is an ? symbol
CP TOKEN_HE
CALL Z, EVAL_HELP
CP 0
JP Z, EXECUTE_BUFFER_RETURN_SUCCESS
;More actions could be added here
EXECUTE_BUFFER_FAIL:
;If parser reaches this point then there is an invalid instruction
;LD A, 0xFF
SCF
JP EXECUTE_BUFFER_RETURN
EXECUTE_BUFFER_RETURN_SUCCESS:
;I don't think this is needed because A should already be 0
;LD A, 0x00
SCF
CCF
EXECUTE_BUFFER_RETURN:
POP HL
POP DE
POP BC
RET
EVAL_LITERAL:
PUSH HL
PUSH DE
;Get First Two Bytes
LD HL, PARSE_BUF
LD A, L
ADD A, 2
LD L, A
;Get the top byte
LD A, (HL)
;Store into D
LD D, A
;Get the bottom byte
INC HL
LD A, (HL)
;Store into E
LD E, A
;Get the instruction token
INC HL
LD A, (HL)
;See if A is a read instruction
EVAL_LITERAL_READ:
CP TOKEN_RD
JP NZ, EVAL_LITERAL_WRITE
CALL EVAL_READ
CP 0 ;Check for error
JP Z, EVAL_LITERAL_SUCCESS
EVAL_LITERAL_WRITE:
CP TOKEN_WR
JP NZ, EVAL_LITERAL_FAIL
CALL EVAL_WRITE
CP 0 ;Check for error
JP Z, EVAL_LITERAL_SUCCESS
;Other instrucitons could be added here...
EVAL_LITERAL_FAIL:
LD A, 0xFF
EVAL_LITERAL_SUCCESS:
POP DE
POP HL
RET
EVAL_EXE:
PUSH HL
PUSH DE
;Clear DE
LD D, 0
LD E, 0
;Get look at the location of the second token in the buffer
LD HL, PARSE_BUF
LD A, L
ADD A, 2
LD L, A
;Get the token
LD A, (HL)
;Make sure its a WORD token
CP TOKEN_WD
JP NZ, EVAL_EXE_FAILURE
;Get the literal
INC HL
LD A, (HL)
;Assume 1 Byte at first
LD D, A
;Get next token
INC HL
LD A, (HL)
LD E, A
;Set Up Return Address so that RET can be called
LD HL, EVAL_EXE_SUCCESS
PUSH HL
LD H, D
LD L, E
;Jump to new, arbitrary location
JP (HL)
EVAL_EXE_FAILURE:
LD A, 0xFF
JP EVAL_EXE_EXIT
EVAL_EXE_SUCCESS:
LD A, 0
EVAL_EXE_EXIT:
POP DE
POP HL
RET
EVAL_READ:
;DE is the literal value
;HL should be pointing to the read token
PUSH HL
PUSH DE
PUSH BC
;get next token
INC HL
LD A, (HL)
;check that it is a word
CP TOKEN_WD
JP NZ, EVAL_READ_FAIL
;Get the 8 bit value
INC HL
INC HL
LD A, (HL)
;Put the target address in HL
LD H, D
LD L, E
;Use B to count when a newline is needed
LD B, 0
;Loop over each value at the location
EVAL_READ_LOOP:
;Save the pointer, and the incrementor
PUSH AF
PUSH HL
;Is a newline needed?
LD A, B
AND 0x0F
CP 0
JP NZ, EVAL_READ_LOOP_L1
LD A, CHAR_NEWLINE
CALL PRINTCH
LD A, CHAR_RETURN
CALL PRINTCH
EVAL_READ_LOOP_L1:
;Convert the hex to ascii
LD A, (HL)
CALL HTOA
;Print the first char
LD A, H
CALL PRINTCH
;Print the second char
LD A, L
CALL PRINTCH
;Print a space
LD A, CHAR_SPACE
CALL PRINTCH
;Get the pointer and the incrementor back
POP HL
POP AF
;Decrement counter and return if A is not 0
INC HL
INC B
DEC A
CP 0
JP NZ, EVAL_READ_LOOP
;A is already 0, just jump to end
JP EVAL_READ_EXIT
EVAL_READ_FAIL:
LD A, 0xFF
EVAL_READ_EXIT:
POP BC
POP DE
POP HL
RET
EVAL_WRITE:
;DE is the literal value
;HL should not have been modified from before
PUSH HL
PUSH DE
;Look now for the final Literal
INC HL
LD A, (HL)
;Check that next token is a word, even though we only use the lower byte
CP TOKEN_WD
JP NZ, EVAL_WRITE_FAIL
;Get value to write
INC HL
INC HL
LD A, (HL)
;Write the value
LD H, D
LD L, E
LD (HL), A
;SUCCESS!
LD A, 0
JP EVAL_WRITE_RETURN
EVAL_WRITE_FAIL:
LD A, 0xFF
EVAL_WRITE_RETURN:
POP DE
POP HL
RET
;Just print out the help text
EVAL_HELP:
PUSH HL
LD HL, HELP_TEXT
CALL WRITE_STR
LD A, 0
POP HL
RET
;HEX to ASCII
;Convert hex value to 2 ascii characters
;Expects A to be the hex value
;Returns 2 chars in HL
HTOA:
PUSH AF
PUSH BC
;High Nibble First, save into H
;Copy A into B
LD B, A
HTOA_HIGH:
;Rotate right
RR A
RR A
RR A
RR A
;Clear high bits
AND 0x0F
;Is this A-F?
HTOA_HEX_1:
CP 0xA
JP C, HTOA_INT_1
ADD A, 0x37
LD H, A
JP HTOA_LOW
;Is this 0-9?
HTOA_INT_1:
ADD A, 0x30
LD H, A
;Next do the low nibble, save into E
HTOA_LOW:
;Copy B back into A
LD A, B
AND 0x0F
;Is this A-F?
HTOA_HEX_2:
CP 0xA
JP C, HTOA_INT_2
ADD A, 0x37
LD L, A
JP HTOA_EXIT
;Is this 0-9?
HTOA_INT_2:
ADD A, 0x30
LD L, A
HTOA_EXIT:
POP BC
POP AF
RET
;//////////////////////
;/////////DATA/////////
;//////////////////////
BOOT_MSG:
db CHAR_NEWLINE, CHAR_RETURN, "ASH v0.5", CHAR_NEWLINE, CHAR_RETURN, "(C) 2021 by <NAME>"
db CHAR_NEWLINE, CHAR_RETURN, "ZILOG Z80 32k EEPROM, 64k SRAM", CHAR_NEWLINE, CHAR_RETURN, CHAR_EOT
SYNTAX_ERROR:
db CHAR_NEWLINE, CHAR_RETURN, "SYNTAX ERROR", CHAR_NEWLINE, CHAR_EOT
TOKEN_ERROR:
db CHAR_NEWLINE, CHAR_RETURN, "INVALID TOKEN", CHAR_NEWLINE, CHAR_EOT
EXE_ERROR:
db CHAR_NEWLINE, CHAR_RETURN, "EXECUTION ERROR", CHAR_NEWLINE, CHAR_EOT
HELP_TEXT:
db CHAR_NEWLINE, CHAR_RETURN, "INSTRUCTIONS : ", CHAR_NEWLINE, CHAR_RETURN, "1FFF : 10 - READ 16 BYTES STARTING AT LOCATION 0x1FFF", CHAR_NEWLINE, CHAR_RETURN, "1FFF < 10 - WRITE 0x10 TO LOCAITON 0x1FFF", CHAR_NEWLINE, CHAR_RETURN, "@1FFF - BEGIN EXECUTION AT LOCATION 0x1FFF", CHAR_NEWLINE, CHAR_RETURN, "? - DISPLAY HELP MESSAGE", CHAR_NEWLINE, CHAR_EOT
PROMPT:
db CHAR_NEWLINE, CHAR_RETURN, "[Tom80]:~$ ", CHAR_EOT
OUTPUT_MSG:
db CHAR_NEWLINE, CHAR_RETURN, "(S)erial or (V)ideo?", CHAR_NEWLINE, CHAR_RETURN, CHAR_EOT
PIO_TEST_STR:
db " << I got this from the PIO", CHAR_NEWLINE, CHAR_NEWLINE, CHAR_RETURN, CHAR_EOT |
oeis/016/A016273.asm | neoneye/loda-programs | 11 | 2056 | <reponame>neoneye/loda-programs
; A016273: Expansion of 1/((1-2x)(1-3x)(1-5x)).
; Submitted by <NAME>
; 1,10,69,410,2261,11970,61909,315850,1598421,8050130,40425749,202656090,1014866581,5079099490,25409813589,127092049130,635589254741,3178333432050,15892828897429,79467630222970,397348609370901,1986774423719810,9933966253389269
mov $1,1
mov $2,1
mov $3,2
lpb $0
sub $0,1
mul $1,5
mul $3,3
add $3,2
add $1,$3
mul $2,2
add $2,1
sub $1,$2
lpe
mov $0,$1
|
Rings/Examples/Proofs.agda | Smaug123/agdaproofs | 4 | 135 | <reponame>Smaug123/agdaproofs
{-# OPTIONS --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Functions.Definition
open import Groups.Groups
open import Groups.Definition
open import Rings.Definition
open import Numbers.Naturals.Semiring
open import Numbers.Naturals.Naturals
open import Numbers.Naturals.Order
open import Numbers.Naturals.Order.Lemmas
open import Numbers.Integers.Integers
open import Numbers.Primes.PrimeNumbers
open import Numbers.Modulo.Definition
open import Numbers.Modulo.Group
open import Numbers.Naturals.EuclideanAlgorithm
open import Orders.Total.Definition
module Rings.Examples.Proofs where
nToZn' : (n : ℕ) (pr : 0 <N n) (x : ℕ) → ℤn n pr
nToZn' 0 ()
nToZn' (succ n) pr x with divisionAlg (succ n) x
nToZn' (succ n) pr1 x | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl thing ; quotSmall = quotSmall } = record { x = rem ; xLess = thing }
nToZn' (succ n) pr1 x | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inr () ; quotSmall = quotSmall }
mod' : (n : ℕ) → (pr : 0 <N n) → ℤ → ℤn n pr
mod' zero () a
mod' (succ n) pr (nonneg x) = nToZn' (succ n) pr x
mod' (succ n) pr (negSucc x) = Group.inverse (ℤnGroup (succ n) pr) (nToZn' (succ n) pr (succ x))
subtractionEquiv : (a : ℕ) → {b c : ℕ} → (c<b : c <N b) → a +N c ≡ b → a ≡ subtractionNResult.result (-N (inl c<b))
subtractionEquiv 0 {b} {c} c<b pr rewrite pr = exFalso (TotalOrder.irreflexive ℕTotalOrder c<b)
subtractionEquiv (succ a) {b} {c} c<b pr = equivalentSubtraction 0 b (succ a) c (succIsPositive a) c<b (equalityCommutative pr)
modNExampleSurjective' : (n : ℕ) → (pr : 0 <N n) → Surjection (mod' n pr)
modNExampleSurjective' zero ()
modNExampleSurjective' (succ n) pr record { x = x ; xLess = xLess } with divisionAlg (succ n) x
modNExampleSurjective' (succ n) p record { x = x ; xLess = xLess } | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl remIsSmall ; quotSmall = q } = nonneg x , lhs'
where
rs' : rem ≡ x
rs' = modIsUnique (record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl remIsSmall ; quotSmall = q }) (record { quot = 0 ; rem = x ; pr = blah ; remIsSmall = inl (<NProp xLess) ; quotSmall = inl (succIsPositive n) })
where
blah : n *N 0 +N x ≡ x
blah rewrite multiplicationNIsCommutative n 0 = refl
lhs : nToZn' (succ n) p x ≡ record { x = rem ; xLess = remIsSmall }
lhs with divisionAlg (succ n) x
lhs | record { quot = quot' ; rem = rem' ; pr = pr' ; remIsSmall = inl t ; quotSmall = quotSmall } = equalityZn (equalityCommutative rs)
where
rs : rem ≡ rem'
rs = modIsUnique (record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl remIsSmall; quotSmall = q }) (record { quot = quot' ; rem = rem' ; pr = pr' ; remIsSmall = inl t ; quotSmall = quotSmall })
lhs | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inr () ; quotSmall = quotSmall }
lhs' : nToZn' (succ n) p x ≡ record { x = x ; xLess = xLess }
lhs' = transitivity lhs (equalityZn rs')
modNExampleSurjective' (succ n) p record { x = x ; xLess = xLess } | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inr () ; quotSmall = quotSmall }
{-
modNExampleGroupHom' : (n : ℕ) → (pr : 0 <N n) → GroupHom ℤGroup (ℤnGroup n pr) (mod' n pr)
modNExampleGroupHom' 0 ()
GroupHom.wellDefined (modNExampleGroupHom' (succ n) pr) {x} {.x} refl = refl
GroupHom.groupHom (modNExampleGroupHom' (succ n) _) {nonneg a} {nonneg b} with divisionAlg (succ n) a
GroupHom.groupHom (modNExampleGroupHom' (succ n) _) {nonneg a} {nonneg b} | record { quot = quotA ; rem = remA ; pr = prA ; remIsSmall = inl remA<sn ; quotSmall = quotSmallA } with divisionAlg (succ n) b
GroupHom.groupHom (modNExampleGroupHom' (succ n) _) {nonneg a} {nonneg b} | record { quot = quotA ; rem = remA ; pr = prA ; remIsSmall = inl remA<sn ; quotSmall = quotSmallA } | record { quot = quotB ; rem = remB ; pr = prB ; remIsSmall = inl remB<sn ; quotSmall = quotSmallB } with orderIsTotal (remA +N remB) (succ n)
GroupHom.groupHom (modNExampleGroupHom' (succ n) pr1) {nonneg a} {nonneg b} | record { quot = quotA ; rem = remA ; pr = prA ; remIsSmall = inl remA<sn ; quotSmall = _ } | record { quot = quotB ; rem = remB ; pr = prB ; remIsSmall = inl remB<sn ; quotSmall = _ } | inl (inl rarb<sn) rewrite addingNonnegIsHom a b = equalityZn _ _ lemma
where
lemma : ℤn.x (nToZn' (succ n) pr1 (a +N b)) ≡ remA +N remB
lemma with divisionAlg (succ n) (a +N b)
lemma | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl x ; quotSmall = inl _ } = equalityCommutative thing5
where
thing : ((succ n) *N quotA +N remA) +N ((succ n) *N quotB +N remB) ≡ a +N b
thing rewrite prA | prB = refl
thing2 : ((succ n) *N quotA +N remA) +N ((succ n) *N quotB +N remB) ≡ (succ n) *N quot +N rem
thing2 rewrite pr = thing
thing3 : (((succ n) *N quotA) +N ((succ n) *N quotB)) +N (remA +N remB) ≡ (succ n) *N quot +N rem
thing3 rewrite equalityCommutative (additionNIsAssociative (((succ n) *N quotA) +N ((succ n) *N quotB)) remA remB) | additionNIsAssociative ((succ n) *N quotA) ((succ n) *N quotB) remA | additionNIsCommutative ((succ n) *N quotB) remA | equalityCommutative (additionNIsAssociative ((succ n) *N quotA) remA ((succ n) *N quotB)) | additionNIsAssociative ((succ n) *N quotA +N remA) ((succ n) *N quotB) remB = thing2
thing4 : (succ n) *N (quotA +N quotB) +N (remA +N remB) ≡ (succ n) *N quot +N rem
thing4 rewrite productDistributes (succ n) quotA quotB = thing3
thing5 : remA +N remB ≡ rem
thing5 = modUniqueLemma {remA +N remB} {rem} {succ n} (quotA +N quotB) quot rarb<sn x thing4
lemma | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl x ; quotSmall = inr () }
lemma | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inr () ; quotSmall = quotSmall }
GroupHom.groupHom (modNExampleGroupHom' (succ n) pr1) {nonneg a} {nonneg b} | record { quot = quotA ; rem = remA ; pr = prA ; remIsSmall = inl remA<sn } | record { quot = quotB ; rem = remB ; pr = prB ; remIsSmall = inl remB<sn } | inl (inr sn<rarb) rewrite addingNonnegIsHom a b = equalityZn _ _ lemma
where
lemma : ℤn.x (nToZn' (succ n) pr1 (a +N b)) ≡ subtractionNResult.result (-N (inl sn<rarb))
lemma with divisionAlg (succ n) (a +N b)
lemma | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl x ; quotSmall = q } = modIsUnique record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl x ; quotSmall = q } record { quot = succ quotA +N quotB ; rem = subtractionNResult.result (-N (inl sn<rarb)) ; pr = answer ; remIsSmall = inl remSmall ; quotSmall = inl (succIsPositive n) }
where
transform : (a : ℕ) → {b c : ℕ} → (p : b <N c) → c <N a +N b → subtractionNResult.result (-N (inl p)) <N a
transform a {b} {c} pr (le y proof1) with addIntoSubtraction (succ y) {b} {c} (inl pr)
... | bl = le y (transitivity bl (equalityCommutative (subtractionEquiv a (orderIsTransitive pr (addingIncreases c y)) (equalityCommutative (identityOfIndiscernablesLeft _ _ _ _≡_ proof1 (additionNIsCommutative (succ y) c))))))
thing : ((succ n) *N quotA +N remA) +N ((succ n) *N quotB +N remB) ≡ a +N b
thing rewrite prA | prB = refl
thing2 : (((succ n) *N quotA) +N ((succ n) *N quotB)) +N (remA +N remB) ≡ a +N b
thing2 = identityOfIndiscernablesLeft _ _ _ _≡_ thing (transitivity (equalityCommutative (additionNIsAssociative ((quotA +N n *N quotA) +N remA) (succ n *N quotB) remB)) (transitivity (applyEquality (λ i → i +N remB) (additionNIsAssociative (quotA +N n *N quotA) remA (quotB +N n *N quotB))) (transitivity (applyEquality (λ i → ((quotA +N n *N quotA) +N i) +N remB) (additionNIsCommutative remA (quotB +N n *N quotB))) (transitivity (applyEquality (λ i → i +N remB) (equalityCommutative (additionNIsAssociative (quotA +N n *N quotA) (quotB +N n *N quotB) remA))) (additionNIsAssociative _ remA remB)))))
thing3 : (succ n) *N (quotA +N quotB) +N (remA +N remB) ≡ a +N b
thing3 = identityOfIndiscernablesLeft _ _ _ _≡_ thing2 (equalityCommutative (applyEquality (λ i → i +N (remA +N remB)) (productDistributes (succ n) (quotA) quotB)))
answer : (succ n *N succ (quotA +N quotB)) +N subtractionNResult.result (-N (inl sn<rarb)) ≡ a +N b
answer with addIntoSubtraction (succ n *N succ (quotA +N quotB)) (inl sn<rarb)
... | bl = transitivity bl (moveOneSubtraction' {a<=b = inl (orderIsTransitive sn<rarb (addingIncreases (remA +N remB) ((quotA +N quotB) +N n *N succ (quotA +N quotB))))} answer')
where
snTimes1 : succ n ≡ succ n *N 1
snTimes1 rewrite multiplicationNIsCommutative (succ n) 1 | additionNIsCommutative (succ n) 0 = refl
q' : succ n *N succ (quotA +N quotB) ≡ succ n +N (succ n *N (quotA +N quotB))
q' rewrite additionNIsCommutative (succ n) (succ n *N (quotA +N quotB)) | snTimes1 | equalityCommutative (productDistributes (succ n) (quotA +N quotB) 1) = applyEquality (λ i → (succ n) *N i) (succIsAddOne (quotA +N quotB))
answer'' : (succ n *N succ (quotA +N quotB)) +N (remA +N remB) ≡ (succ n) +N ((succ n *N (quotA +N quotB)) +N (remA +N remB))
answer'' rewrite equalityCommutative (additionNIsAssociative (succ n) (succ n *N (quotA +N quotB)) (remA +N remB)) = applyEquality (λ i → i +N (remA +N remB)) q'
answer' : (remA +N remB) +N (succ n *N succ (quotA +N quotB)) ≡ succ n +N (a +N b)
answer' rewrite equalityCommutative thing3 = transitivity (additionNIsCommutative (remA +N remB) (succ n *N succ (quotA +N quotB))) answer''
remSmall : subtractionNResult.result (-N (inl sn<rarb)) <N succ n
remSmall = transform (succ n) sn<rarb (addStrongInequalities remA<sn remB<sn)
lemma | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inr () ; quotSmall = quotSmall }
GroupHom.groupHom (modNExampleGroupHom' (succ n) pr1) {nonneg a} {nonneg b} | record { quot = quotA ; rem = remA ; pr = prA ; remIsSmall = inl remA<sn } | record { quot = quotB ; rem = remB ; pr = prB ; remIsSmall = inl remB<sn } | inr rarb=sn rewrite addingNonnegIsHom a b = equalityZn _ _ lemma
where
lemma : ℤn.x (nToZn' (succ n) pr1 (a +N b)) ≡ 0
lemma with divisionAlg (succ n) (a +N b)
lemma | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl x } = equalityCommutative (modUniqueLemma ((quotA +N quotB) +N 1) quot pr1 x thing7)
where
thing : ((succ n) *N quotA +N remA) +N ((succ n) *N quotB +N remB) ≡ a +N b
thing rewrite prA | prB = refl
thing2 : ((succ n) *N quotA +N remA) +N ((succ n) *N quotB +N remB) ≡ (succ n) *N quot +N rem
thing2 rewrite pr = thing
thing3 : (((succ n) *N quotA) +N ((succ n) *N quotB)) +N (remA +N remB) ≡ (succ n) *N quot +N rem
thing3 rewrite equalityCommutative (additionNIsAssociative (((succ n) *N quotA) +N ((succ n) *N quotB)) remA remB) | additionNIsAssociative ((succ n) *N quotA) ((succ n) *N quotB) remA | additionNIsCommutative ((succ n) *N quotB) remA | equalityCommutative (additionNIsAssociative ((succ n) *N quotA) remA ((succ n) *N quotB)) | additionNIsAssociative ((succ n) *N quotA +N remA) ((succ n) *N quotB) remB = thing2
thing4 : (succ n) *N (quotA +N quotB) +N (remA +N remB) ≡ (succ n) *N quot +N rem
thing4 rewrite productDistributes (succ n) quotA quotB = thing3
thing5 : (succ n) *N (quotA +N quotB) +N (succ n) ≡ (succ n) *N quot +N rem
thing5 rewrite equalityCommutative rarb=sn = thing4
thing6 : (succ n) *N ((quotA +N quotB) +N 1) ≡ (succ n) *N quot +N rem
thing6 rewrite productDistributes (succ n) (quotA +N quotB) 1 | multiplicationNIsCommutative n 1 | additionNIsCommutative n 0 = thing5
thing7 : (succ n) *N ((quotA +N quotB) +N 1) +N 0 ≡ (succ n) *N quot +N rem
thing7 = identityOfIndiscernablesLeft _ _ _ _≡_ thing6 (additionNIsCommutative 0 _)
lemma | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inr () ; quotSmall = quotSmall }
GroupHom.groupHom (modNExampleGroupHom' (succ n) _) {nonneg a} {nonneg b} | record { quot = quotA ; rem = remA ; pr = prA ; remIsSmall = inl remA<sn ; quotSmall = quotSmallA } | record { quot = quotB ; rem = remB ; pr = prB ; remIsSmall = inr () ; quotSmall = quotSmallB }
GroupHom.groupHom (modNExampleGroupHom' (succ n) _) {nonneg a} {nonneg b} | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inr () ; quotSmall = quotSmall }
GroupHom.groupHom (modNExampleGroupHom' (succ n) _) {nonneg a} {negSucc b} with divisionAlg (succ n) a
GroupHom.groupHom (modNExampleGroupHom' (succ n) _) {nonneg a} {negSucc b} | record { quot = quotA ; rem = remA ; pr = prA ; remIsSmall = remIsSmallA ; quotSmall = quotSmallA } = {!!}
GroupHom.groupHom (modNExampleGroupHom' (succ n) _) {negSucc x} {nonneg b} with divisionAlg (succ n) (succ x)
... | bl = {!!}
GroupHom.groupHom (modNExampleGroupHom' (succ n) _) {negSucc x} {negSucc b} with divisionAlg (succ n) (succ x)
... | bl = {!!}
-}
|
tools-src/gnu/gcc/gcc/ada/sem_elim.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 17966 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S E M _ E L I M --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1997 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the routines used to process the Eliminate pragma
with Types; use Types;
package Sem_Elim is
procedure Initialize;
-- Initialize for new main souce program
procedure Process_Eliminate_Pragma
(Arg_Unit_Name : Node_Id;
Arg_Entity : Node_Id;
Arg_Parameter_Types : Node_Id;
Arg_Result_Type : Node_Id);
-- Process eliminate pragma. The number of arguments has been checked,
-- as well as possible optional identifiers, but no other checks have
-- been made. This subprogram completes the checking, and then if the
-- pragma is well formed, makes appropriate entries in the internal
-- tables used to keep track of Eliminate pragmas. The four arguments
-- are the possible pragma arguments (set to Empty if not present).
procedure Check_Eliminated (E : Entity_Id);
-- Checks if entity E is eliminated, and if so sets the Is_Eliminated
-- flag on the given entity.
end Sem_Elim;
|
core/support/src/main/antlr/au/com/dius/pact/core/support/Version.g4 | psliwa/pact-jvm | 127 | 3744 | grammar Version;
@header {
package au.com.dius.pact.core.support;
}
version returns [ Version v ] :
{ Integer major, minor, patch = null; }
INT { major = $INT.int; } '.' INT { minor = $INT.int; } ('.' INT { patch = $INT.int; })? EOF {
if (patch != null) {
$v = new Version(major, minor, patch);
} else {
$v = new Version(major, minor);
}
}
;
INT : DIGIT+ ;
fragment DIGIT : [0-9] ;
|
8085_programming/YT/p3_add_n_nos_with_carry.asm | SayanGhoshBDA/code-backup | 16 | 24702 | <filename>8085_programming/YT/p3_add_n_nos_with_carry.asm
MVI C,09
MVI E,00
LXI H,2060
MOV A,M
L1: INX H
MOV B,M
ADD B
JC L2
L3: DCR C
JNZ L1
STA 2070
MOV A,E
STA 2071
HLT
L2: INR E
STC
CMC
JMP L3
// to store the memory contents
# ORG 2060H
# DB 01H,03H,01H,01H,01H,01H,01H,02H,F1H,FFH
|
src/libYARP_dev/56f807/cotroller_dc/Support/DSP56800_xromxram.asm | robotology-legacy/yarp1 | 0 | 3191 | <reponame>robotology-legacy/yarp1
; metrowerks sample code
; this __romCopy copies xROM to xRAM
; define which __romCopy routine to assemble
; see alternative routine below
; use the software loop routine
; if you have more than 8191 elements to zero
; use the hardware loop routine
; if you have less than 8191 elements to zero
; 56800 loop LC register is 13-bits
; to handle the general case
; DSP56800 stationery default clearBSS is software loop
DEFINE useSoftwareLoop ''
section startup
; these variables are defined in the linker command file (LCF)
XREF F_rom_to_ram
XREF F_data_size
XREF F_data_RAM_addr
XREF F_data_ROM_addr
org p:
GLOBAL F__romCopy
; SUBROUTINE "F__romCopy",F__romCopy,F__romCopyEND-F__romCopy
F__romCopy:
; optional check for xROM-xRAM copy request
; DSP56800 Stationery LCF sets variable F_rom_to_ram
; comment this test out if target's LCF is always set for xROM-xRAM
move #F_rom_to_ram,x0 ; optional check
tstw x0
beq end_romCopy ; if no xROM-to-xRAM, then exit
IF @DEF('useSoftwareLoop')
; xROM-to-xRAM software loop
move #F_data_size,y0 ; set count
tstw y0 ; optional zero count test
beq end_romCopy ; if zero count, then exit
move #F_data_ROM_addr,r3 ; src address -- ROM data start
move #F_data_RAM_addr,r1 ; dest address -- RAM data start
nop
loop_romCopy:
move x:(r3)+,x0 ; fetch value at x address r3
move x0,x:(r1)+ ; stash value at x address r1
dec y0 ; decrement count and test
bne loop_romCopy ; if not zero, continue loop
ELSE
; xROM-to-xRAM hardware loop
move #F_data_size,r2 ; set count
; hardware loop falls through if zero
move #F_data_ROM_addr,r3 ; src address -- ROM data start
move #F_data_RAM_addr,r1 ; dest address -- RAM data start
nop
do r2,end_romCopy ; copy for r2 times
move x:(r3)+,x0 ; fetch value at address r3
move x0,x:(r1)+ ; stash value at address r1
ENDIF
end_romCopy:
rts
F__romCopyEND:
endsec
end
|
src/pygamer-time.adb | Fabien-Chouteau/pygamer-bsp | 0 | 14313 | with Cortex_M.Systick;
with System.Machine_Code; use System.Machine_Code;
package body PyGamer.Time is
package Systick renames Cortex_M.Systick;
Clock_Ms : Time_Ms := 0 with Volatile;
Period_Ms : constant Time_Ms := 1;
Subscribers : array (1 .. 10) of Tick_Callback := (others => null);
procedure Initialize;
procedure SysTick_Handler;
pragma Export (C, SysTick_Handler, "__gnat_sys_tick_trap");
----------------
-- Initialize --
----------------
procedure Initialize is
Reload : constant := 120_000_000 / 1_000;
begin
-- Configure for 1kH tick
Systick.Configure (Source => Systick.CPU_Clock,
Generate_Interrupt => True,
Reload_Value => Reload);
Systick.Enable;
end Initialize;
---------------------
-- SysTick_Handler --
---------------------
procedure SysTick_Handler is
begin
Clock_Ms := Clock_Ms + Period_Ms;
for Subs of Subscribers loop
if Subs /= null then
-- Call the subscriber
Subs.all;
end if;
end loop;
end SysTick_Handler;
-----------
-- Clock --
-----------
function Clock return Time_Ms
is (Clock_Ms);
--------------
-- Delay_Ms --
--------------
procedure Delay_Ms (Milliseconds : UInt64) is
begin
Delay_Until (Clock + Milliseconds);
end Delay_Ms;
-----------------
-- Delay_Until --
-----------------
procedure Delay_Until (Wakeup_Time : Time_Ms) is
begin
while Wakeup_Time > Clock loop
Asm (Template => "wfi", -- Wait for interrupt
Volatile => True);
end loop;
end Delay_Until;
-----------------
-- Tick_Period --
-----------------
function Tick_Period return Time_Ms is
begin
return Period_Ms;
end Tick_Period;
---------------------
-- Tick_Subscriber --
---------------------
function Tick_Subscriber (Callback : not null Tick_Callback) return Boolean
is
begin
for Subs of Subscribers loop
if Subs = Callback then
return True;
end if;
end loop;
return False;
end Tick_Subscriber;
--------------------
-- Tick_Subscribe --
--------------------
function Tick_Subscribe (Callback : not null Tick_Callback) return Boolean
is
begin
for Subs of Subscribers loop
if Subs = null then
Subs := Callback;
return True;
end if;
end loop;
return False;
end Tick_Subscribe;
----------------------
-- Tick_Unsubscribe --
----------------------
function Tick_Unsubscribe (Callback : not null Tick_Callback) return Boolean
is
begin
for Subs of Subscribers loop
if Subs = Callback then
Subs := null;
return True;
end if;
end loop;
return False;
end Tick_Unsubscribe;
---------------
-- HAL_Delay --
---------------
Delay_Instance : aliased PG_Delays;
function HAL_Delay return not null HAL.Time.Any_Delays is
begin
return Delay_Instance'Access;
end HAL_Delay;
------------------------
-- Delay_Microseconds --
------------------------
overriding
procedure Delay_Microseconds
(This : in out PG_Delays;
Us : Integer)
is
pragma Unreferenced (This);
begin
Delay_Ms (UInt64 (Us / 1000));
end Delay_Microseconds;
------------------------
-- Delay_Milliseconds --
------------------------
overriding
procedure Delay_Milliseconds
(This : in out PG_Delays;
Ms : Integer)
is
pragma Unreferenced (This);
begin
Delay_Ms (UInt64 (Ms));
end Delay_Milliseconds;
-------------------
-- Delay_Seconds --
-------------------
overriding
procedure Delay_Seconds (This : in out PG_Delays;
S : Integer)
is
pragma Unreferenced (This);
begin
Delay_Ms (UInt64 (S * 1000));
end Delay_Seconds;
begin
Initialize;
end PyGamer.Time;
|
src/ada_containers_indefinite_holders.ads | egilhh/Futures-in-Ada | 1 | 1953 | with Ada.Finalization;
generic
type Element_Type(<>) is private;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada_Containers_Indefinite_Holders is
pragma Preelaborate(Ada_Containers_Indefinite_Holders);
type Holder is tagged private;
pragma Preelaborable_Initialization (Holder);
-- Empty_Holder : constant Holder;
-- function "=" (Left, Right : Holder) return Boolean;
-- function To_Holder (New_Item : Element_Type) return Holder;
function Is_Empty (Container : Holder) return Boolean;
-- procedure Clear (Container : in out Holder);
function Element (Container : Holder) return Element_Type;
procedure Replace_Element (Container : in out Holder;
New_Item : in Element_Type);
private
type Element_Access is access all Element_Type;
type Holder is new Ada.Finalization.Controlled with record
Element : Element_Access;
end record;
overriding procedure Adjust(Self : in out Holder);
overriding procedure Finalize(Self : in out Holder);
end Ada_Containers_Indefinite_Holders;
|
test/Fail/Issue2840.agda | cruhland/agda | 1,989 | 16663 | <reponame>cruhland/agda
-- Andreas, 2017-11-06, issue #2840 reported by wenkokke
Id : (F : Set → Set) → Set → Set
Id F = F
data D (A : Set) : Set where
c : Id _ A
-- WAS: internal error in positivity checker
-- EXPECTED: success, or
-- The target of a constructor must be the datatype applied to its
-- parameters, _F_2 A isn't
-- when checking the constructor c in the declaration of D
|
src/stm32-gpio.ads | damaki/EVB1000 | 9 | 27408 | -- This spec has been automatically generated from STM32F105xx.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with System;
package STM32.GPIO is
pragma Preelaborate;
---------------
-- Registers --
---------------
------------------
-- CRL_Register --
------------------
subtype CRL_MODE0_Field is STM32.UInt2;
subtype CRL_CNF0_Field is STM32.UInt2;
subtype CRL_MODE1_Field is STM32.UInt2;
subtype CRL_CNF1_Field is STM32.UInt2;
subtype CRL_MODE2_Field is STM32.UInt2;
subtype CRL_CNF2_Field is STM32.UInt2;
subtype CRL_MODE3_Field is STM32.UInt2;
subtype CRL_CNF3_Field is STM32.UInt2;
subtype CRL_MODE4_Field is STM32.UInt2;
subtype CRL_CNF4_Field is STM32.UInt2;
subtype CRL_MODE5_Field is STM32.UInt2;
subtype CRL_CNF5_Field is STM32.UInt2;
subtype CRL_MODE6_Field is STM32.UInt2;
subtype CRL_CNF6_Field is STM32.UInt2;
subtype CRL_MODE7_Field is STM32.UInt2;
subtype CRL_CNF7_Field is STM32.UInt2;
-- Port configuration register low (GPIOn_CRL)
type CRL_Register is record
-- Port n.0 mode bits
MODE0 : CRL_MODE0_Field := 16#0#;
-- Port n.0 configuration bits
CNF0 : CRL_CNF0_Field := 16#1#;
-- Port n.1 mode bits
MODE1 : CRL_MODE1_Field := 16#0#;
-- Port n.1 configuration bits
CNF1 : CRL_CNF1_Field := 16#1#;
-- Port n.2 mode bits
MODE2 : CRL_MODE2_Field := 16#0#;
-- Port n.2 configuration bits
CNF2 : CRL_CNF2_Field := 16#1#;
-- Port n.3 mode bits
MODE3 : CRL_MODE3_Field := 16#0#;
-- Port n.3 configuration bits
CNF3 : CRL_CNF3_Field := 16#1#;
-- Port n.4 mode bits
MODE4 : CRL_MODE4_Field := 16#0#;
-- Port n.4 configuration bits
CNF4 : CRL_CNF4_Field := 16#1#;
-- Port n.5 mode bits
MODE5 : CRL_MODE5_Field := 16#0#;
-- Port n.5 configuration bits
CNF5 : CRL_CNF5_Field := 16#1#;
-- Port n.6 mode bits
MODE6 : CRL_MODE6_Field := 16#0#;
-- Port n.6 configuration bits
CNF6 : CRL_CNF6_Field := 16#1#;
-- Port n.7 mode bits
MODE7 : CRL_MODE7_Field := 16#0#;
-- Port n.7 configuration bits
CNF7 : CRL_CNF7_Field := 16#1#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CRL_Register use record
MODE0 at 0 range 0 .. 1;
CNF0 at 0 range 2 .. 3;
MODE1 at 0 range 4 .. 5;
CNF1 at 0 range 6 .. 7;
MODE2 at 0 range 8 .. 9;
CNF2 at 0 range 10 .. 11;
MODE3 at 0 range 12 .. 13;
CNF3 at 0 range 14 .. 15;
MODE4 at 0 range 16 .. 17;
CNF4 at 0 range 18 .. 19;
MODE5 at 0 range 20 .. 21;
CNF5 at 0 range 22 .. 23;
MODE6 at 0 range 24 .. 25;
CNF6 at 0 range 26 .. 27;
MODE7 at 0 range 28 .. 29;
CNF7 at 0 range 30 .. 31;
end record;
------------------
-- CRH_Register --
------------------
subtype CRH_MODE8_Field is STM32.UInt2;
subtype CRH_CNF8_Field is STM32.UInt2;
subtype CRH_MODE9_Field is STM32.UInt2;
subtype CRH_CNF9_Field is STM32.UInt2;
subtype CRH_MODE10_Field is STM32.UInt2;
subtype CRH_CNF10_Field is STM32.UInt2;
subtype CRH_MODE11_Field is STM32.UInt2;
subtype CRH_CNF11_Field is STM32.UInt2;
subtype CRH_MODE12_Field is STM32.UInt2;
subtype CRH_CNF12_Field is STM32.UInt2;
subtype CRH_MODE13_Field is STM32.UInt2;
subtype CRH_CNF13_Field is STM32.UInt2;
subtype CRH_MODE14_Field is STM32.UInt2;
subtype CRH_CNF14_Field is STM32.UInt2;
subtype CRH_MODE15_Field is STM32.UInt2;
subtype CRH_CNF15_Field is STM32.UInt2;
-- Port configuration register high (GPIOn_CRL)
type CRH_Register is record
-- Port n.8 mode bits
MODE8 : CRH_MODE8_Field := 16#0#;
-- Port n.8 configuration bits
CNF8 : CRH_CNF8_Field := 16#1#;
-- Port n.9 mode bits
MODE9 : CRH_MODE9_Field := 16#0#;
-- Port n.9 configuration bits
CNF9 : CRH_CNF9_Field := 16#1#;
-- Port n.10 mode bits
MODE10 : CRH_MODE10_Field := 16#0#;
-- Port n.10 configuration bits
CNF10 : CRH_CNF10_Field := 16#1#;
-- Port n.11 mode bits
MODE11 : CRH_MODE11_Field := 16#0#;
-- Port n.11 configuration bits
CNF11 : CRH_CNF11_Field := 16#1#;
-- Port n.12 mode bits
MODE12 : CRH_MODE12_Field := 16#0#;
-- Port n.12 configuration bits
CNF12 : CRH_CNF12_Field := 16#1#;
-- Port n.13 mode bits
MODE13 : CRH_MODE13_Field := 16#0#;
-- Port n.13 configuration bits
CNF13 : CRH_CNF13_Field := 16#1#;
-- Port n.14 mode bits
MODE14 : CRH_MODE14_Field := 16#0#;
-- Port n.14 configuration bits
CNF14 : CRH_CNF14_Field := 16#1#;
-- Port n.15 mode bits
MODE15 : CRH_MODE15_Field := 16#0#;
-- Port n.15 configuration bits
CNF15 : CRH_CNF15_Field := 16#1#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CRH_Register use record
MODE8 at 0 range 0 .. 1;
CNF8 at 0 range 2 .. 3;
MODE9 at 0 range 4 .. 5;
CNF9 at 0 range 6 .. 7;
MODE10 at 0 range 8 .. 9;
CNF10 at 0 range 10 .. 11;
MODE11 at 0 range 12 .. 13;
CNF11 at 0 range 14 .. 15;
MODE12 at 0 range 16 .. 17;
CNF12 at 0 range 18 .. 19;
MODE13 at 0 range 20 .. 21;
CNF13 at 0 range 22 .. 23;
MODE14 at 0 range 24 .. 25;
CNF14 at 0 range 26 .. 27;
MODE15 at 0 range 28 .. 29;
CNF15 at 0 range 30 .. 31;
end record;
------------------
-- IDR_Register --
------------------
-------------
-- IDR.IDR --
-------------
-- IDR array element
subtype IDR_Element is STM32.Bit;
-- IDR array
type IDR_Field_Array is array (0 .. 15) of IDR_Element
with Component_Size => 1, Size => 16;
-- Type definition for IDR
type IDR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- IDR as a value
Val : STM32.Short;
when True =>
-- IDR as an array
Arr : IDR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for IDR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Port input data register (GPIOn_IDR)
type IDR_Register is record
-- Read-only. Port input data
IDR : IDR_Field;
-- unspecified
Reserved_16_31 : STM32.Short;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IDR_Register use record
IDR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- ODR_Register --
------------------
-------------
-- ODR.ODR --
-------------
-- ODR array element
subtype ODR_Element is STM32.Bit;
-- ODR array
type ODR_Field_Array is array (0 .. 15) of ODR_Element
with Component_Size => 1, Size => 16;
-- Type definition for ODR
type ODR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ODR as a value
Val : STM32.Short;
when True =>
-- ODR as an array
Arr : ODR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for ODR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Port output data register (GPIOn_ODR)
type ODR_Register is record
-- Port output data
ODR : ODR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ODR_Register use record
ODR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- BSRR_Register --
-------------------
-------------
-- BSRR.BS --
-------------
-- BSRR_BS array element
subtype BSRR_BS_Element is STM32.Bit;
-- BSRR_BS array
type BSRR_BS_Field_Array is array (0 .. 15) of BSRR_BS_Element
with Component_Size => 1, Size => 16;
-- Type definition for BSRR_BS
type BSRR_BS_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BS as a value
Val : STM32.Short;
when True =>
-- BS as an array
Arr : BSRR_BS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BSRR_BS_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-------------
-- BSRR.BR --
-------------
-- BSRR_BR array element
subtype BSRR_BR_Element is STM32.Bit;
-- BSRR_BR array
type BSRR_BR_Field_Array is array (0 .. 15) of BSRR_BR_Element
with Component_Size => 1, Size => 16;
-- Type definition for BSRR_BR
type BSRR_BR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BR as a value
Val : STM32.Short;
when True =>
-- BR as an array
Arr : BSRR_BR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BSRR_BR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Port bit set/reset register (GPIOn_BSRR)
type BSRR_Register is record
-- Write-only. Set bit 0
BS : BSRR_BS_Field := (As_Array => False, Val => 16#0#);
-- Write-only. Reset bit 0
BR : BSRR_BR_Field := (As_Array => False, Val => 16#0#);
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BSRR_Register use record
BS at 0 range 0 .. 15;
BR at 0 range 16 .. 31;
end record;
------------------
-- BRR_Register --
------------------
------------
-- BRR.BR --
------------
-- BRR_BR array element
subtype BRR_BR_Element is STM32.Bit;
-- BRR_BR array
type BRR_BR_Field_Array is array (0 .. 15) of BRR_BR_Element
with Component_Size => 1, Size => 16;
-- Type definition for BRR_BR
type BRR_BR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BR as a value
Val : STM32.Short;
when True =>
-- BR as an array
Arr : BRR_BR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BRR_BR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Port bit reset register (GPIOn_BRR)
type BRR_Register is record
-- Write-only. Reset bit 0
BR : BRR_BR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BRR_Register use record
BR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- LCKR_Register --
-------------------
--------------
-- LCKR.LCK --
--------------
-- LCKR_LCK array element
subtype LCKR_LCK_Element is STM32.Bit;
-- LCKR_LCK array
type LCKR_LCK_Field_Array is array (0 .. 15) of LCKR_LCK_Element
with Component_Size => 1, Size => 16;
-- Type definition for LCKR_LCK
type LCKR_LCK_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- LCK as a value
Val : STM32.Short;
when True =>
-- LCK as an array
Arr : LCKR_LCK_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for LCKR_LCK_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
subtype LCKR_LCKK_Field is STM32.Bit;
-- Port configuration lock register
type LCKR_Register is record
-- Port A Lock bit 0
LCK : LCKR_LCK_Field := (As_Array => False, Val => 16#0#);
-- Lock key
LCKK : LCKR_LCKK_Field := 16#0#;
-- unspecified
Reserved_17_31 : STM32.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for LCKR_Register use record
LCK at 0 range 0 .. 15;
LCKK at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- General purpose I/O
type GPIO_Peripheral is record
-- Port configuration register low (GPIOn_CRL)
CRL : CRL_Register;
-- Port configuration register high (GPIOn_CRL)
CRH : CRH_Register;
-- Port input data register (GPIOn_IDR)
IDR : IDR_Register;
-- Port output data register (GPIOn_ODR)
ODR : ODR_Register;
-- Port bit set/reset register (GPIOn_BSRR)
BSRR : BSRR_Register;
-- Port bit reset register (GPIOn_BRR)
BRR : BRR_Register;
-- Port configuration lock register
LCKR : LCKR_Register;
end record
with Volatile;
for GPIO_Peripheral use record
CRL at 0 range 0 .. 31;
CRH at 4 range 0 .. 31;
IDR at 8 range 0 .. 31;
ODR at 12 range 0 .. 31;
BSRR at 16 range 0 .. 31;
BRR at 20 range 0 .. 31;
LCKR at 24 range 0 .. 31;
end record;
-- General purpose I/O
GPIOA_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOA_Base;
-- General purpose I/O
GPIOB_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOB_Base;
-- General purpose I/O
GPIOC_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOC_Base;
-- General purpose I/O
GPIOD_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOD_Base;
-- General purpose I/O
GPIOE_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOE_Base;
end STM32.GPIO;
|
oeis/277/A277253.asm | neoneye/loda-programs | 11 | 98509 | <filename>oeis/277/A277253.asm<gh_stars>10-100
; A277253: a(n) = a(n-2) + a(n-3) + a(n-4) for n>3, a(0)=1, a(1)=a(2)=0, a(3)=2.
; Submitted by <NAME>
; 1,0,0,2,1,2,3,5,6,10,14,21,30,45,65,96,140,206,301,442,647,949,1390,2038,2986,4377,6414,9401,13777,20192,29592,43370,63561,93154,136523,200085,293238,429762,629846,923085,1352846,1982693,2905777,4258624,6241316,9147094,13405717,19647034,28794127,42199845,61846878,90641006,132840850,194687729,285328734,418169585,612857313,898186048,1316355632,1929212946,2827398993,4143754626,6072967571,8900366565,13044121190,19117088762,28017455326,41061576517,60178665278,88196120605,129257697121,189436362400
add $0,2
mov $4,-2
lpb $0
sub $0,1
sub $2,$1
add $2,1
add $2,$4
add $2,2
mov $1,$2
mov $2,$3
add $2,1
sub $4,$3
add $4,$1
mov $3,$4
add $4,1
sub $4,$1
lpe
cmp $1,0
gcd $4,$1
mov $0,$4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.