max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
src/portscan.adb
kraileth/ravenadm
18
25768
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt with Ada.Strings.Hash; with Ada.Characters.Latin_1; with Ada.Directories; with Parameters; with Utilities; with GNAT.Traceback.Symbolic; package body PortScan is package LAT renames Ada.Characters.Latin_1; package DIR renames Ada.Directories; package UTL renames Utilities; package TRC renames GNAT.Traceback; -------------------------------------------------------------------------------------------- -- port_hash -------------------------------------------------------------------------------------------- function port_hash (key : HT.Text) return CON.Hash_Type is begin return Ada.Strings.Hash (HT.USS (key)); end port_hash; -------------------------------------------------------------------------------------------- -- block_ekey -------------------------------------------------------------------------------------------- function block_hash (key : port_index) return CON.Hash_Type is preresult : constant CON.Hash_Type := CON.Hash_Type (key); use type CON.Hash_Type; begin -- Equivalent to mod 128 return preresult and 2#1111111#; end block_hash; -------------------------------------------------------------------------------------------- -- block_ekey -------------------------------------------------------------------------------------------- function block_ekey (left, right : port_index) return Boolean is begin return left = right; end block_ekey; -------------------------------------- -- "<" function for ranking_crate -- -------------------------------------- function "<" (L, R : queue_record) return Boolean is begin if L.reverse_score = R.reverse_score then return R.ap_index > L.ap_index; end if; return L.reverse_score > R.reverse_score; end "<"; -------------------------------------------------------------------------------------------- -- get_bucket -------------------------------------------------------------------------------------------- function get_bucket (id : port_id) return String is begin if id = port_match_failed or else id > last_port then return "XX"; end if; return all_ports (id).bucket; end get_bucket; -------------------------------------------------------------------------------------------- -- get_port_variant #1 -------------------------------------------------------------------------------------------- function get_port_variant (PR : port_record) return String is use type portkey_crate.Cursor; begin if PR.key_cursor = portkey_crate.No_Element then return "get_port_variant: invalid key_cursor"; end if; return HT.USS (portkey_crate.Key (PR.key_cursor)); end get_port_variant; -------------------------------------------------------------------------------------------- -- get_port_variant #2 -------------------------------------------------------------------------------------------- function get_port_variant (id : port_id) return String is begin if id = port_match_failed or else id > last_port then return "Invalid port ID"; end if; return get_port_variant (all_ports (id)); end get_port_variant; -------------------------------------------------------------------------------------------- -- ignore_reason -------------------------------------------------------------------------------------------- function ignore_reason (id : port_id) return String is begin if id = port_match_failed or else id > last_port then return "Invalid port ID"; end if; return HT.USS (all_ports (id).ignore_reason); end ignore_reason; -------------------------------------------------------------------------------------------- -- valid_port_id -------------------------------------------------------------------------------------------- function valid_port_id (id : port_id) return Boolean is begin return id /= port_match_failed; end valid_port_id; -------------------------------------------------------------------------------------------- -- wipe_make_queue -------------------------------------------------------------------------------------------- procedure wipe_make_queue is begin for j in scanners'Range loop make_queue (j).Clear; end loop; end wipe_make_queue; -------------------------------------------------------------------------------------------- -- reset_ports_tree -------------------------------------------------------------------------------------------- procedure reset_ports_tree is begin for k in dim_all_ports'Range loop declare rec : port_record renames all_ports (k); begin rec.sequence_id := 0; rec.key_cursor := portkey_crate.No_Element; rec.ignore_reason := HT.blank; rec.pkgversion := HT.blank; rec.port_variant := HT.blank; rec.port_namebase := HT.blank; rec.bucket := "00"; rec.unkind_custom := False; rec.ignored := False; rec.scanned := False; rec.rev_scanned := False; rec.unlist_failed := False; rec.work_locked := False; rec.scan_locked := False; rec.use_procfs := False; rec.reverse_score := 0; rec.run_deps.Clear; rec.blocked_by.Clear; rec.blocks.Clear; rec.all_reverse.Clear; rec.options.Clear; rec.subpackages.Clear; end; end loop; ports_keys.Clear; rank_queue.Clear; lot_number := 1; lot_counter := 0; last_port := 0; prescanned := False; wipe_make_queue; for m in scanners'Range loop mq_progress (m) := 0; end loop; end reset_ports_tree; -------------------------------------------------------------------------------------------- -- queue_is_empty -------------------------------------------------------------------------------------------- function queue_is_empty return Boolean is begin return rank_queue.Is_Empty; end queue_is_empty; -------------------------------------------------------------------------------------------- -- queue_is_empty -------------------------------------------------------------------------------------------- function original_queue_size return Natural is begin return Natural (original_queue_len); end original_queue_size; -------------------------------------------------------------------------------------------- -- queue_length -------------------------------------------------------------------------------------------- function queue_length return Integer is begin return Integer (rank_queue.Length); end queue_length; -------------------------------------------------------------------------------------------- -- calculate_package_name -------------------------------------------------------------------------------------------- function calculate_package_name (id : port_id; subpackage : String) return String is namebase : constant String := HT.USS (all_ports (id).port_namebase); variant : constant String := HT.USS (all_ports (id).port_variant); pkgversion : constant String := HT.USS (all_ports (id).pkgversion); begin return namebase & "-" & subpackage & "-" & variant & "-" & pkgversion; end calculate_package_name; -------------------------------------------------------------------------------------------- -- convert_depend_origin_to_portkey -------------------------------------------------------------------------------------------- function convert_depend_origin_to_portkey (origin : String) return String is -- expected format: namebase:subpackage:variant numcolons : Natural := HT.count_char (origin, LAT.Colon); begin if numcolons < 2 then return "error"; end if; declare namebase : String := HT.specific_field (origin, 1, ":"); variant : String := HT.specific_field (origin, 3, ":"); begin return namebase & LAT.Colon & variant; end; end convert_depend_origin_to_portkey; -------------------------------------------------------------------------------------------- -- subpackage_from_pkgname -------------------------------------------------------------------------------------------- function subpackage_from_pkgname (pkgname : String) return String is -- expected format: namebase-subpackage-variant-version.tzst -- support namebase-subpackage-variant too numcolons : Natural := HT.count_char (pkgname, LAT.Hyphen); begin if numcolons < 3 then return "error"; end if; return HT.tail (HT.head (HT.head (pkgname, "-"), "-"), "-"); end subpackage_from_pkgname; -------------------------------------------------------------------------------------------- -- scan_progress -------------------------------------------------------------------------------------------- function scan_progress return String is type percent is delta 0.01 digits 5; complete : port_index := 0; pc : percent; maximum : Float := Float (last_port + 1); begin for k in scanners'Range loop complete := complete + mq_progress (k); end loop; pc := percent (100.0 * Float (complete) / maximum); return " progress:" & pc'Img & "% " & LAT.CR; end scan_progress; -------------------------------------------------------------------------------------------- -- insert_into_portlist -------------------------------------------------------------------------------------------- procedure insert_into_portlist (port_variant : String) is pv_text : HT.Text := HT.SUS (port_variant); begin if not portlist.Contains (pv_text) then portlist.Append (pv_text); dupelist.Append (pv_text); end if; end insert_into_portlist; -------------------------------------------------------------------------------------------- -- jail_port_binutils_specified -------------------------------------------------------------------------------------------- function jail_port_binutils_specified return Boolean is bukey : HT.Text := HT.SUS (default_binutils); buver : constant String := HT.USS (all_ports (ports_keys.Element (bukey)).pkgversion); begin return portlist.Contains (bukey) and then buver = binutils_version; end jail_port_binutils_specified; -------------------------------------------------------------------------------------------- -- jail_port_compiler_specified -------------------------------------------------------------------------------------------- function jail_port_compiler_specified return Boolean is compkey : HT.Text := HT.SUS (default_compiler & LAT.Colon & variant_standard); compver : constant String := HT.USS (all_ports (ports_keys.Element (compkey)).pkgversion); begin return portlist.Contains (compkey) and then compver = compiler_version; end jail_port_compiler_specified; -------------------------------------------------------------------------------------------- -- requires_procfs -------------------------------------------------------------------------------------------- function requires_procfs (id : port_id) return Boolean is begin return all_ports (id).use_procfs; end requires_procfs; -------------------------------------------------------------------------------------------- -- build_request_length -------------------------------------------------------------------------------------------- function build_request_length return Integer is begin return Integer (dupelist.Length); end build_request_length; -------------------------------------------------------------------------------------------- -- get_buildsheet_from_origin_list -------------------------------------------------------------------------------------------- function get_buildsheet_from_origin_list (index : Positive) return String is procedure search (position : string_crate.Cursor); conspiracy : constant String := HT.USS (Parameters.configuration.dir_conspiracy); unkindness : constant String := HT.USS (Parameters.configuration.dir_profile) & "/unkindness"; counter : Natural := 0; answer : HT.Text; procedure search (position : string_crate.Cursor) is begin counter := counter + 1; if counter = index then declare namebase : String := HT.part_1 (HT.USS (string_crate.Element (position)), ":"); bsheetname : String := "/bucket_" & UTL.bucket (namebase) & "/" & namebase; begin if DIR.Exists (unkindness & bsheetname) then answer := HT.SUS (unkindness & bsheetname); else answer := HT.SUS (conspiracy & bsheetname); end if; end; end if; end search; begin dupelist.Iterate (search'Access); return HT.USS (answer); end get_buildsheet_from_origin_list; -------------------------------------------------------------------------------------------- -- dump_stack -------------------------------------------------------------------------------------------- procedure dump_stack (media : TIO.File_Type) is trace : TRC.Tracebacks_Array (1 .. 2_000); trlen : Natural; begin TIO.Put_Line (media, "Dump of stack:"); TRC.Call_Chain (trace, trlen); TIO.Put_Line (media, TRC.Symbolic.Symbolic_Traceback (trace (1 .. trlen))); end dump_stack; end PortScan;
2006-spring/mp0/mp0.asm
ece291/machine-problems
3
27619
; MP0 - Your Name - Today's Date ; ; This program illustrates a (very) basic assembly program and ; the use of LIB291 input and output routines. ; By working on this code, you will have the opportunity to ; exercise the tools for this class, namely the editor, ; the Assembler (NASM), and the debugger (TD). ; Be sure to put your name in the places where it says '<NAME>' ; and also change the date where it says 'Today's Date'. ; The changes that you need to make to this program are ; described in the MP0 assignment page. BITS 16 ;====== SECTION 1: Define constants ======================================= CR EQU 0Dh LF EQU 0Ah BEL EQU 07h ;====== SECTION 2: Declare external procedures ============================ EXTERN kbdine, dspout, dspmsg, dosxit ;====== SECTION 3: Define stack segment =================================== SEGMENT stkseg STACK ; *** STACK SEGMENT *** resb 64*8 stacktop: ;====== SECTION 4: Define code segment ==================================== SEGMENT code ; *** CODE SEGMENT *** ;====== SECTION 5: Declare variables for main procedure =================== mygrade db 0 question db 'What grade would you like in ECE291? ','$' Exitmsg db CR,LF,'Good Luck!',CR,LF,'$' invalid db CR,LF,'Not a valid choice! ',CR,LF,'$' Amsg db CR,LF,'Learn all material and Submit MPs early.',CR,LF,'$' Bmsg db CR,LF,'Keep up in class and submit MPs on time.',CR,LF,'$' Dmsg db CR,LF,'Skip a few machine problems.',CR,LF,'$' Fmsg db CR,LF,'Sleep through exams.',CR,LF,'$' ;====== SECTION 6: Program initialization ================================= ..start: mov ax, cs ; Initialize Default Segment register mov ds, ax mov ax, stkseg ; Initialize Stack Segment register mov ss, ax mov sp, stacktop ; Initialize Stack Pointer register ;====== SECTION 7: Main procedure ========================================= MAIN: mov dx, question ; Prompt user with the grade question call dspmsg call kbdine mov [mygrade], al ; Save result .CheckGrade: cmp byte [mygrade], 'A' ; Check if A student jne .NotGradeA mov dx, Amsg ; Print message for A students call dspmsg jmp .mpExit .NotGradeA: cmp byte [mygrade], 'B' ; Check if B student jne .NotGradeB mov dx, Bmsg ; Print message for B students call dspmsg jmp .mpExit .NotGradeB: cmp byte [mygrade], 'D' ; Check if D student jne .NotGradeD mov dx, Dmsg ; Print message for D students call dspmsg jmp .mpExit .NotGradeD: cmp byte [mygrade], 'F' ; Check if F student jne .NotGradeF mov dx, Fmsg ; Print message for F students call dspmsg jmp .mpExit .NotGradeF: mov dl, BEL ; Ring the bell if other character call dspout mov dx, invalid ; Print invalid message call dspmsg jmp .FinalExit .mpExit: mov dx, Exitmsg ; Type out exit message call dspmsg .FinalExit: call dosxit ; Exit to DOS
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_734.asm
ljhsiun2/medusa
9
167592
<filename>Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_734.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0xeb98, %r13 nop nop nop nop dec %rdx mov (%r13), %edi add $19696, %rbp lea addresses_normal_ht+0x3f88, %rsi lea addresses_UC_ht+0x9278, %rdi nop sub $49202, %rbx mov $60, %rcx rep movsl add %rcx, %rcx lea addresses_UC_ht+0xf898, %rsi lea addresses_D_ht+0x30f8, %rdi xor $33147, %r10 mov $122, %rcx rep movsw nop nop dec %r10 lea addresses_D_ht+0x4798, %rsi lea addresses_A_ht+0x164a0, %rdi nop nop nop nop add %rdx, %rdx mov $124, %rcx rep movsb nop nop nop nop xor $54893, %rbp lea addresses_D_ht+0xd298, %rsi nop nop nop add $22674, %rdx movb $0x61, (%rsi) nop nop nop nop dec %rbp lea addresses_UC_ht+0x16198, %rbp nop nop nop xor $922, %rcx vmovups (%rbp), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %rdx nop nop nop nop add %rsi, %rsi lea addresses_A_ht+0xdb98, %rbp nop nop cmp %rdi, %rdi vmovups (%rbp), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $0, %xmm6, %rcx nop nop inc %rbp lea addresses_D_ht+0x19d98, %rsi lea addresses_WC_ht+0x17608, %rdi nop nop nop nop nop inc %rbp mov $55, %rcx rep movsb nop nop nop nop nop cmp $13219, %rsi lea addresses_A_ht+0x2c98, %rdi and $60468, %rbp mov (%rdi), %edx nop cmp %r10, %r10 lea addresses_A_ht+0x1986a, %rdi nop nop nop sub %rbx, %rbx mov (%rdi), %edx nop nop nop nop sub %rcx, %rcx lea addresses_A_ht+0x6d98, %rsi lea addresses_WT_ht+0x1568a, %rdi nop nop nop cmp %rbp, %rbp mov $44, %rcx rep movsb nop add $62606, %r13 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r8 push %r9 push %rbp push %rcx push %rsi // Store lea addresses_A+0x15ab8, %rsi nop and $21775, %r9 mov $0x5152535455565758, %r8 movq %r8, %xmm5 movups %xmm5, (%rsi) // Exception!!! nop nop nop nop nop mov (0), %rsi nop nop nop add %r9, %r9 // Store lea addresses_WT+0x1ab98, %rbp nop nop nop nop cmp %rcx, %rcx mov $0x5152535455565758, %r9 movq %r9, (%rbp) nop nop sub $12954, %rbp // Faulty Load lea addresses_WC+0xf598, %r10 add $5954, %r8 mov (%r10), %rsi lea oracles, %r13 and $0xff, %rsi shlq $12, %rsi mov (%r13,%rsi,1), %rsi pop %rsi pop %rcx pop %rbp pop %r9 pop %r8 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 8}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 3}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': True, 'AVXalign': False, 'congruent': 8}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 4}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 1}} {'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 */
DHP-Mars45/TestFiles/output/swap.asm
sollybr/college-projects-2020
0
243602
<filename>DHP-Mars45/TestFiles/output/swap.asm sll $t1,$a1,2 add $t1,$a0,$t1 lw $t0,0x0($t1) lw $t2,0x4($t1) sw $t2,0x0($t1) sw $t0,0x4($t1)
vpnsetupwithDUO.applescript
andrewb3000/CiscoVPNSetup
0
1284
<filename>vpnsetupwithDUO.applescript -- originally based on halocardina's script at https://gist.github.com/halocaridina/99466e4b1d08e57fb9dd -- AnyConnect now refered to as targetApp set targetApp to "Cisco AnyConnect Secure Mobility Client" -- Determine if AnyConnect is currently running tell application "System Events" set processExists to exists process targetApp end tell -- Close connection if running; else start connection and fill in password if processExists is true then tell application targetApp quit end tell else tell application targetApp activate end tell tell application "System Events" -- Wait for first window to open. Do nothing. repeat until (window 1 of process targetApp exists) delay 1 end repeat -- You may need to uncomment below if your OpenConnect implementation requires a keystroke to accept the default VPN delay 2 tell process targetApp keystroke return end tell -- Wait for second window to open and then automatically enter password extracted from your Keychain repeat until (window 2 of process targetApp exists) delay 8 end repeat tell process targetApp -- This is where the the password in the Keychain is accessed for use as input rather than being hardcoded as plain text in other versions of this script out in the wild delay 6 keystroke "YOUR_USERNAME" as text keystroke tab set inString to "cisco_vpn" set PSWD to do shell script "/usr/bin/security find-generic-password -wl " & quoted form of inString keystroke PSWD as text keystroke return end tell -- Autoclick on "Accept" of AnyConnect Banner window. If you have no welcome banner that needs acceptance, comment out these lines to the first "end tell" below repeat until (window "Cisco AnyConnect - Banner" of process targetApp exists) delay 2 end repeat tell process targetApp keystroke return end tell end tell end if
Etapa 02/Aula 10 - Subrotinas/codes/a10e05.asm
bellorini/unioeste
6
4104
<filename>Etapa 02/Aula 10 - Subrotinas/codes/a10e05.asm ; Aula 10 - Subprogramas ; arquivo: a10e05.asm ; objetivo: demonstrar chamada de funções externas printf ; nasm -f elf64 a10e05.asm ; gcc -m64 -no-pie a10e05.o -o a10e05.x %define _exit 60 section .data strCtrl : db "%s, is a science fiction television series that premiered in the United States and Canada on September %d, %d", 10, 0 ; null-terminated str1 : db "Firefly", 0 ; null-terminated day : dd 20 year : dd 2002 extern printf section .text global main main: ; main é função, cuidar da pilha! ; stack-frame push rbp mov rbp, rsp ; não será salvo registradores ; não será passado ponto-flutuante xor rax,rax ; número de registradores xmm0 é zero ; printf("%s, is a science fiction television series that premiered in the United States and Canada on September %d, %d", stri, day, year); ; carrega parâmetros da esquerda para direita nos registradores ; RDI, RSI, RDX, RCX mov rdi, strCtrl ; string de controle para printf lea rsi, [str1] ; endereço para string 'umaStr' mov edx, [day] ; conteúdo do inteiro 'day' mov ecx, [year]; condeúdo do inteiro 'year' call printf fim: ; "destack-frame!" mov rsp, rbp pop rbp mov rax, _exit mov rdi, 0 syscall
asm/PrintNum.asm
artrag/voicenc_scc
4
21117
<reponame>artrag/voicenc_scc<gh_stars>1-10 ;--------------------------------------------------------- ; method that prints hl on screen ; to address de ;--------------------------------------------------------- PrintNum: ld a,e out (99h),a ld a,d and 3Fh or 40h out (99h),a push hl ex de,hl ld a,d rlca rlca rlca rlca and 15 ld b,0 ld c,a ld hl,Numbers add hl,bc ld a,(hl) out (98h),a ld a,d and 15 ld b,0 ld c,a ld hl,Numbers add hl,bc ld a,(hl) out (98h),a ld a,e rlca rlca rlca rlca and 15 ld b,0 ld c,a ld hl,Numbers add hl,bc ld a,(hl) out (98h),a ld a,e and 15 ld b,0 ld c,a ld hl,Numbers add hl,bc ld a,(hl) out (98h),a pop hl ret Numbers: db "0123456789ABCDEF"
45/runtime/herc/fmakeres.asm
minblock/msdos
0
94920
; TITLE FMAKERES - Command entry point for MSHERC. ;*** ;FMAKERES ; ; Copyright <C> 1987 - 1990, Microsoft Corporation ; ;Purpose: ; Assumes control upon entry of MSHERC.COM to initialize the driver ; and install the INT 10 hook. Then terminate and stay resident. ; ;****************************************************************************** include hgcdefs.inc code segment para public 'code' assume cs:code,ds:code Public Save_Old_Int10h Extrn Start_Of_New_Routine:word ;offset of start of HGC INT 10H Extrn Old_Int10h_Routine:dword ;old INT 10H address Extrn GetHGCStatus:near Extrn ConfigMode:byte ;[1] FULL or HALF Save_Old_Int10h: ; Parse the command line first, so that we can display ; help if it is needed. cld ;[2] make sure scanning forward mov si,81h ;[2] start at begining of Cmd Line GetNextByte: ;[2] lodsb ;[2] Grab a character cmp al,' ' ;[2] is it a space? je GetNextByte ;[2] brif so, this is valid seperator cmp al,9 ;[2] is it a tab? je GetNextByte ;[2] brif so, also a valid seperator cmp al,0dh ;[2] cmd line terminator? je Parsed ;[2] brif so, done parsing cmp al,'/' ;[2] is this a switch char? jne GiveHelp ;[2] brif not, give help lodsb ;[2] get switch character and al,0DFh ;[2] convert to upper case mov [ConfigMode],HALF ;[2] assume it is /H cmp al,'H' ;[2] is it /H je SwitchEnd ;[2] brif so, parsed successful GiveHelp: mov dx, offset HelpMsg ;[2] point to the help message jmp short DontLoadIt ;[2] go print it and exit ; Skip to the end of the current switch. We could also ; make sure that it is /HALF or some subset of it, but ; that would be inconsistent with previous versions and ; would probably take more code. SwitchEnd: ;[2] lodsb ;[2] get next character cmp al,0dh ;[2] end of cmd line? je Parsed ;[2] brif so, end of switch cmp al,' ' ;[2] seperator character? je GetNextByte ;[2] brif so, end of switch cmp al,9 ;[2] seperator character je GetNextByte ;[2] brif so, end of switch jmp short SwitchEnd ;[2] keep looking for end of switch Parsed: ;[2] ;first confirm that our INT 10h has not already been loaded mov dl,-1 ;DL will not change if no driver mov ah,InquireFuncNo ;test for Hercules INT10 driver int 10H cmp dl,-1 ;DL returns -1 if no driver mov dx,offset already ;Fetch offset of string jne DontLoadIt ;there is driver, don't load it call GetHGCStatus ;status request cmp dl,-1 ;DL returns -1 if no HGC card jne LoadIt ;there is an HGC, go load it mov dx,offset noHGC ;Fetch offset of string ;announce that int 10h has already been installed DontLoadIt: mov ah,9 ;print string DOS function int 21H xor ax,ax ;terminate int 20H ;------- save the original interrupt routine LoadIt: push es xor ax,ax mov es,ax mov bx, es:[INT10HVECTOR_OFFSET] mov word ptr Old_Int10h_Routine,bx mov bx, es:[INT10HVECTOR_SEGMENT] mov word ptr Old_Int10h_Routine[2],bx ;------- point to this interrupt routine cli mov word ptr es:[INT10HVECTOR_OFFSET],offset Start_Of_New_Routine mov es:[INT10HVECTOR_SEGMENT],cs sti pop es ;------ Write the HGC INT 10H Message------ mov ah,9 mov dx,offset sign_on ;Fetch offset of string int 21H ;Write the string ;------- make this routine resident mov dx, offset Save_Old_Int10h mov cl,4 shr dx,cl inc dx mov ax,3100h int 21h sign_on db 'Hercules Resident Video Support Routines. Version 1.12' db 0DH,0AH,'$' already db 'Hercules Video Support Routines are already installed.' db 0DH,0AH,'$' noHGC db 'Hercules Video Card not present.',0DH,0AH db 'Hercules Video Support Routines not installed.' db 0DH,0AH,'$' HelpMsg db 'Install MSHERC.COM before running programs with graphics requiring', 0DH, 0AH db 'the Hercules graphics card.', 0DH, 0AH, 0DH, 0AH db 'MSHERC [/HALF]', 0DH, 0AH db ' /HALF Required when a color adapter is also installed.', 0DH, 0AH, '$' code ends end
src/natools-s_expressions-generic_caches.ads
faelys/natools
0
392
------------------------------------------------------------------------------ -- Copyright (c) 2013-2019, <NAME> -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.S_Expressions.Generic_Caches provides a simple memory container -- -- for S-expressions. The container is append-only, and provides cursors to -- -- replay it from start. -- -- This is a generic package that allow client-selected storage pools. An -- -- instance with default storage pools is provided in -- -- Natools.S_Expressions.Caches. -- -- The intended usage is efficient caching of S-expressions in memory. For -- -- more flexible in-memory S-expression objects, -- -- see Natools.S_Expressions.Holders. -- ------------------------------------------------------------------------------ with System.Storage_Pools; with Natools.S_Expressions.Lockable; with Natools.S_Expressions.Printers; with Natools.S_Expressions.Replayable; private with Ada.Finalization; private with Ada.Unchecked_Deallocation; private with Natools.References; generic Atom_Pool : in out System.Storage_Pools.Root_Storage_Pool'Class; Counter_Pool : in out System.Storage_Pools.Root_Storage_Pool'Class; Structure_Pool : in out System.Storage_Pools.Root_Storage_Pool'Class; package Natools.S_Expressions.Generic_Caches is pragma Preelaborate (Generic_Caches); type Reference is new Printers.Printer with private; pragma Preelaborable_Initialization (Reference); overriding procedure Open_List (Output : in out Reference); overriding procedure Append_Atom (Output : in out Reference; Data : in Atom); overriding procedure Close_List (Output : in out Reference); function Duplicate (Cache : Reference) return Reference; -- Create a new copy of the S-expression held in Cache and return it function Move (Source : in out S_Expressions.Descriptor'Class) return Reference; -- Build a new cache by (destructively) reading Original type Cursor is new Lockable.Descriptor and Replayable.Descriptor with private; pragma Preelaborable_Initialization (Cursor); overriding function Current_Event (Object : in Cursor) return Events.Event; overriding function Current_Atom (Object : in Cursor) return Atom; overriding function Current_Level (Object : in Cursor) return Natural; overriding procedure Query_Atom (Object : in Cursor; Process : not null access procedure (Data : in Atom)); overriding procedure Read_Atom (Object : in Cursor; Data : out Atom; Length : out Count); overriding procedure Next (Object : in out Cursor; Event : out Events.Event); overriding procedure Lock (Object : in out Cursor; State : out Lockable.Lock_State); overriding procedure Unlock (Object : in out Cursor; State : in out Lockable.Lock_State; Finish : in Boolean := True); overriding function Duplicate (Object : Cursor) return Cursor; function First (Cache : Reference'Class) return Cursor; -- Create a new Cursor pointing at the beginning of Cache function Move (Source : in out S_Expressions.Descriptor'Class) return Cursor is (Move (Source).First); -- Return a cursor holding a copy of Original (which is -- destructively read) function Conditional_Move (Source : in out S_Expressions.Descriptor'Class) return Cursor is (if Source in Cursor then Cursor (Source) else Move (Source).First); -- Return a copy of Source, with cheap copy if possible, -- otherwise with destructive Move private type Atom_Access is access Atom; for Atom_Access'Storage_Pool use Atom_Pool; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Atom, Atom_Access); type Node; type Node_Access is access Node; for Node_Access'Storage_Pool use Structure_Pool; type Node_Kind is (Atom_Node, List_Node); type Node (Kind : Node_Kind) is record Parent : Node_Access; Next : Node_Access; case Kind is when Atom_Node => Data : Atom_Access; when List_Node => Child : Node_Access; end case; end record; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Node, Node_Access); type Tree is new Ada.Finalization.Limited_Controlled with record Root : Node_Access := null; Last : Node_Access := null; Opening : Boolean := False; end record; procedure Append (Exp : in out Tree; Kind : in Node_Kind; Data : in Atom_Access := null); -- Append a new node of the given Kind to Exp procedure Close_List (Exp : in out Tree); -- Close innermost list function Create_Tree return Tree; -- Create a new empty Tree function Duplicate (Source : Tree) return Tree; -- Deep copy of a Tree object overriding procedure Finalize (Object : in out Tree); -- Release all nodes contained in Object package Trees is new References (Tree, Structure_Pool, Counter_Pool); type Reference is new Printers.Printer with record Exp : Trees.Reference; end record; type Cursor is new Lockable.Descriptor and Replayable.Descriptor with record Exp : Trees.Reference; Position : Node_Access := null; Opening : Boolean := False; Stack : Lockable.Lock_Stack; Locked : Boolean := False; end record; function Absolute_Level (Object : Cursor) return Natural; end Natools.S_Expressions.Generic_Caches;
libsrc/graphics/spectrum/bkrestore.asm
jpoikela/z88dk
640
161183
<filename>libsrc/graphics/spectrum/bkrestore.asm ; ; Fast background restore ; ; ZX Spectrum version (speeded up with a row table) ; ; $Id: bkrestore.asm $ ; SECTION smc_clib PUBLIC bkrestore PUBLIC _bkrestore EXTERN pixeladdress EXTERN zx_saddrpdown EXTERN swapgfxbk EXTERN __graphics_end .bkrestore ._bkrestore ; __FASTCALL__ : sprite ptr in HL push ix call swapgfxbk push hl pop ix ld d,(ix+2) ld e,(ix+3) ld h,d ld l,e call pixeladdress ld h,d ld l,e ld (rowadr+1),hl ld a,(ix+0) ld b,(ix+1) dec a srl a srl a srl a inc a inc a ; INT ((Xsize-1)/8+2) ld (rbytes+1),a ;di .bkrestores push bc .rbytes ld b,0 .rloop ld a,(ix+4) ld (hl),a inc hl inc ix djnz rloop ; --------- .rowadr ld hl,0 ; current address call zx_saddrpdown ld (rowadr+1),hl pop bc djnz bkrestores ;ei jp __graphics_end
programs/oeis/136/A136962.asm
neoneye/loda
22
176475
; A136962: Numbers k such that k and k^2 use only the digits 0, 5, 6 and 7. ; 0,76,760,7600,76000,760000,7600000,76000000,760000000,7600000000,76000000000,760000000000,7600000000000,76000000000000,760000000000000 sub $0,1 mov $1,10 pow $1,$0 mul $1,76 mov $0,$1
Structure/Operator/Monoid/Invertible/Proofs.agda
Lolirofle/stuff-in-agda
6
10716
module Structure.Operator.Monoid.Invertible.Proofs where import Data.Tuple as Tuple import Lvl open import Logic.Propositional open import Logic.Predicate open import Structure.Operator open import Structure.Operator.Monoid open import Structure.Operator.Monoid.Invertible open import Structure.Operator.Properties hiding (InverseOperatorₗ ; InverseOperatorᵣ) open import Structure.Relator.Properties open import Structure.Setoid open import Syntax.Transitivity open import Type private variable ℓ ℓₗ ℓₑ : Lvl.Level private variable T : Type{ℓ} private variable _▫_ : T → T → T private variable _⨞_ : T → T → Type{ℓₗ} module _ ⦃ equiv : Equiv{ℓₑ}(T) ⦄ ⦃ monoid : Monoid{T = T}(_▫_) ⦄ ⦃ invRel : InverseRelationᵣ(_▫_){ℓₗ}(_⨞_) ⦄ where open Monoid(monoid) using (id) instance inverseRelationᵣ-reflexivity : Reflexivity(_⨞_) Reflexivity.proof inverseRelationᵣ-reflexivity = [↔]-to-[←] (InverseRelationᵣ.proof invRel) ([∃]-intro id ⦃ identityᵣ(_▫_)(id) ⦄) instance inverseRelationᵣ-transitivity : Transitivity(_⨞_) Transitivity.proof inverseRelationᵣ-transitivity xy yz with [∃]-intro a ⦃ pa ⦄ ← [↔]-to-[→] (InverseRelationᵣ.proof invRel) xy with [∃]-intro b ⦃ pb ⦄ ← [↔]-to-[→] (InverseRelationᵣ.proof invRel) yz = [↔]-to-[←] (InverseRelationᵣ.proof invRel) ([∃]-intro (a ▫ b) ⦃ symmetry(_≡_) (associativity(_▫_)) 🝖 congruence₂ₗ(_▫_)(b) pa 🝖 pb ⦄) inverseRelationᵣ-with-opᵣ : ∀{a x y} → (x ⨞ y) → ((a ▫ x) ⨞ (a ▫ y)) inverseRelationᵣ-with-opᵣ {a}{x}{y} xy with [∃]-intro z ⦃ xzy ⦄ ← [↔]-to-[→] (InverseRelationᵣ.proof invRel) xy = [↔]-to-[←] (InverseRelationᵣ.proof invRel) ([∃]-intro z ⦃ associativity(_▫_) 🝖 congruence₂ᵣ(_▫_)(a) xzy ⦄) inverseRelationᵣ-without-opᵣ : ⦃ cancₗ : Cancellationₗ(_▫_) ⦄ → ∀{a x y} → ((a ▫ x) ⨞ (a ▫ y)) → (x ⨞ y) inverseRelationᵣ-without-opᵣ {a}{x}{y} xy with [∃]-intro z ⦃ xzy ⦄ ← [↔]-to-[→] (InverseRelationᵣ.proof invRel) xy = [↔]-to-[←] (InverseRelationᵣ.proof invRel) ([∃]-intro z ⦃ cancellationₗ(_▫_) (symmetry(_≡_) (associativity(_▫_)) 🝖 xzy) ⦄) inverseRelationᵣ-of-idₗ : ∀{x} → (id ⨞ x) inverseRelationᵣ-of-idₗ {x} = [↔]-to-[←] (InverseRelationᵣ.proof invRel) ([∃]-intro x ⦃ identityₗ(_▫_)(id) ⦄) module _ {_⋄_ : (x : T) → (y : T) → . ⦃ inv : (y ⨞ x) ⦄ → T} ⦃ invOper : InverseOperatorᵣ(_▫_)(_⋄_) ⦄ where {-op-cancellationᵣ : ∀{a x y} → (a ⨞ x) → (a ⨞ y) → (a ▫ x ≡ a ▫ y) → (x ≡ y) op-cancellationᵣ {a}{x}{y} ax ay axay with [∃]-intro r ⦃ pr ⦄ ← [↔]-to-[→] (InverseRelationᵣ.proof invRel) ax with [∃]-intro s ⦃ ps ⦄ ← [↔]-to-[→] (InverseRelationᵣ.proof invRel) ay = x 🝖[ _≡_ ]-[ {!!} ] y 🝖-end-} inverseRelationᵣ-to-invertibleᵣ : ∀{x} → ⦃ x ⨞ id ⦄ → InvertibleElementᵣ(_▫_) ⦃ Monoid.identity-existenceᵣ(monoid) ⦄ (x) inverseRelationᵣ-to-invertibleᵣ {x} ⦃ xid ⦄ = [∃]-intro (id ⋄ x) ⦃ intro p ⦄ where p = (x ▫ (id ⋄ x)) 🝖[ _≡_ ]-[ congruence₂ᵣ(_▫_)(x) (InverseOperatorᵣ.proof invOper {id}{x}) ] (x ▫ [∃]-witness([↔]-to-[→] (InverseRelationᵣ.proof invRel) xid)) 🝖[ _≡_ ]-[ [∃]-proof([↔]-to-[→] (InverseRelationᵣ.proof invRel) xid) ] id 🝖-end {- TODO: Should this not be possible without cancellation? inverseOperator-self : ∀{x} → let instance _ = reflexivity(_⨞_) in (x ⋄ x ≡ id) inverseOperator-self {x} = let instance _ = reflexivity(_⨞_) {x} in (x ⋄ x) 🝖[ _≡_ ]-[ InverseOperatorᵣ.proof invOper {x}{x} ] [∃]-witness([↔]-to-[→] (InverseRelationᵣ.proof invRel) (reflexivity(_⨞_) {x})) 🝖[ _≡_ ]-[] ∃.witness(Tuple.right(InverseRelationᵣ.proof invRel) (reflexivity(_⨞_))) 🝖[ _≡_ ]-[ {!!} ] id 🝖-end -}
src/latin_utils/latin_utils-inflections_package-propack_record_io.adb
spr93/whitakers-words
204
3756
-- WORDS, a Latin dictionary, by <NAME> (USAF, Retired) -- -- Copyright <NAME> (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. separate (Latin_Utils.Inflections_Package) package body Propack_Record_IO is --------------------------------------------------------------------------- procedure Get (File : in File_Type; Item : out Propack_Record) is Spacer : Character := ' '; pragma Unreferenced (Spacer); begin Decn_Record_IO.Get (File, Item.Decl); Get (File, Spacer); Case_Type_IO.Get (File, Item.Of_Case); Get (File, Spacer); Number_Type_IO.Get (File, Item.Number); Get (File, Spacer); Gender_Type_IO.Get (File, Item.Gender); end Get; --------------------------------------------------------------------------- procedure Get (Item : out Propack_Record) is Spacer : Character := ' '; pragma Unreferenced (Spacer); begin Decn_Record_IO.Get (Item.Decl); Get (Spacer); Case_Type_IO.Get (Item.Of_Case); Get (Spacer); Number_Type_IO.Get (Item.Number); Get (Spacer); Gender_Type_IO.Get (Item.Gender); end Get; --------------------------------------------------------------------------- procedure Put (File : in File_Type; Item : in Propack_Record) is begin Decn_Record_IO.Put (File, Item.Decl); Put (File, ' '); Case_Type_IO.Put (File, Item.Of_Case); Put (File, ' '); Number_Type_IO.Put (File, Item.Number); Put (File, ' '); Gender_Type_IO.Put (File, Item.Gender); end Put; --------------------------------------------------------------------------- procedure Put (Item : in Propack_Record) is begin Decn_Record_IO.Put (Item.Decl); Put (' '); Case_Type_IO.Put (Item.Of_Case); Put (' '); Number_Type_IO.Put (Item.Number); Put (' '); Gender_Type_IO.Put (Item.Gender); end Put; --------------------------------------------------------------------------- procedure Get (Source : in String; Target : out Propack_Record; Last : out Integer ) is -- Used for computing lower bound of substrings Low : Integer := Source'First - 1; begin Decn_Record_IO.Get (Source (Low + 1 .. Source'Last), Target.Decl, Low); Low := Low + 1; Case_Type_IO.Get (Source (Low + 1 .. Source'Last), Target.Of_Case, Low); Low := Low + 1; Number_Type_IO.Get (Source (Low + 1 .. Source'Last), Target.Number, Low); Low := Low + 1; Gender_Type_IO.Get (Source (Low + 1 .. Source'Last), Target.Gender, Last); end Get; --------------------------------------------------------------------------- procedure Put (Target : out String; Item : in Propack_Record) is -- Used for computing bounds of substrings Low : Integer := Target'First - 1; High : Integer := 0; begin -- Put Decn_Record High := Low + Decn_Record_IO.Default_Width; Decn_Record_IO.Put (Target (Low + 1 .. High), Item.Decl); -- Put Case_Type Low := High + 1; Target (Low) := ' '; High := Low + Case_Type_IO.Default_Width; Case_Type_IO.Put (Target (Low + 1 .. High), Item.Of_Case); -- Put Number_Type Low := High + 1; Target (Low) := ' '; High := Low + Number_Type_IO.Default_Width; Number_Type_IO.Put (Target (Low + 1 .. High), Item.Number); -- Put Gender_Type Low := High + 1; Target (Low) := ' '; High := Low + Gender_Type_IO.Default_Width; Gender_Type_IO.Put (Target (Low + 1 .. High), Item.Gender); -- Fill remainder of String Target (High + 1 .. Target'Last) := (others => ' '); end Put; --------------------------------------------------------------------------- end Propack_Record_IO;
Applications/Finder/comment/set comment.applescript
looking-for-a-job/applescript-examples
1
979
<reponame>looking-for-a-job/applescript-examples #!/usr/bin/osascript set home to POSIX path of (path to home folder) set fullpath to home & ".gitignore" set posix to POSIX file fullpath tell application "Finder" set comment of (posix as alias) to "gitignore" comment of (posix as alias) end tell
src/servlet-streams.ads
My-Colaborations/ada-servlet
6
6051
----------------------------------------------------------------------- -- servlet-streams -- Print streams for servlets -- Copyright (C) 2010, 2011, 2012, 2013, 2017, 2018, 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 Ada.Streams; with Ada.Strings.Unbounded; with Ada.Strings.Wide_Wide_Unbounded; with Ada.Finalization; with Util.Streams; with Util.Streams.Texts; with Util.Streams.Buffered; with EL.Objects; package Servlet.Streams is subtype Input_Stream is Util.Streams.Buffered.Input_Buffer_Stream; type Input_Stream_Access is access all Input_Stream'Class; -- ----------------------- -- Print stream -- ----------------------- -- The <b>Print_Stream</b> is an output stream which provides helper methods -- for writing text streams. type Print_Stream is new Ada.Finalization.Limited_Controlled and Util.Streams.Output_Stream with private; procedure Initialize (Stream : in out Print_Stream; To : in Util.Streams.Texts.Print_Stream_Access); -- Initialize the stream procedure Initialize (Stream : in out Print_Stream; To : in Print_Stream'Class); -- Write an integer on the stream. procedure Write (Stream : in out Print_Stream; Item : in Integer); -- Write a string on the stream. procedure Write (Stream : in out Print_Stream; Item : in Ada.Strings.Unbounded.Unbounded_String); -- Write a string on the stream. procedure Write (Stream : in out Print_Stream; Item : in Ada.Strings.Wide_Wide_Unbounded.Unbounded_Wide_Wide_String); -- Write the object converted into a string on the stream. procedure Write (Stream : in out Print_Stream; Item : in EL.Objects.Object); -- Write the buffer array to the output stream. procedure Write (Stream : in out Print_Stream; Buffer : in Ada.Streams.Stream_Element_Array); -- Flush the buffer by writing on the output stream. -- Raises Data_Error if there is no output stream. procedure Flush (Stream : in out Print_Stream); -- Write into the text stream. procedure Write (Stream : in out Print_Stream; Print : access procedure (Into : in out Util.Streams.Texts.Print_Stream'Class)); -- Close the text stream. overriding procedure Close (Stream : in out Print_Stream); private type Print_Stream is new Ada.Finalization.Limited_Controlled and Util.Streams.Output_Stream with record Target : Util.Streams.Texts.Print_Stream_Access; end record; end Servlet.Streams;
src/Everything.agda
ajrouvoet/jvm.agda
6
10438
module Everything where -- The development can almost entirely be type-checked using --safe, -- We mark modules that use the TERMINATING pragma with (**) -- And one module that uses --rewriting with (*). -- These are the only modules that Agda does not accept ass --safe. -- # First we summarize the library we use by Rouvoet et al '20, CPP. -- -- Our work contributes various improvements to the library. -- In particular, its generalization relations whose underlying -- equivalence is not propositional equality. -- But also various additions to the parts of the library -- mentioned below. -- Core defines what a proof-relevant ternary relation (Rel₃). import Relation.Ternary.Core -- Structures defines type classes for ternary relations. -- A PRSA is a commutative monoid and should implement: -- - IsPartialMonoid <: IsPartialSemigroup -- - IsCommutative import Relation.Ternary.Structures -- The overloaded syntax of separation logic comes from: import Relation.Ternary.Structures.Syntax -- Resource aware versions of data types that we use are defined generically -- in Relation.Ternary.Data: import Relation.Ternary.Data.Bigstar -- 'Star' in figure 5 of the paper import Relation.Ternary.Data.Bigplus -- 'Plus' import Relation.Ternary.Data.ReflexiveTransitive -- 'IStar' -- The computational structures from the library that we use in the paper import Relation.Ternary.Functor import Relation.Ternary.Monad -- # We make the following additions to the library, that we describe in the paper. -- A generic PRSA for list separation modulo permutations. -- It is generic in the sense that it is parameterized in a PRSA on its elements. -- We prove that it is a PRSA, with various additional properties that are -- crucial for the model construction in the paper. import Relation.Ternary.Construct.Bag import Relation.Ternary.Construct.Bag.Properties -- A generic PRSA Exchange, that generalizes the interface composition relation. import Relation.Ternary.Construct.Exchange -- Its construction is generic in 2 PRSAs that obey some properties. -- These properties are formalized as type-classes on ternary relations import Relation.Ternary.Structures.Positive import Relation.Ternary.Structures.Crosssplit -- We added the writer monad construction described in the paper. import Relation.Ternary.Monad.Writer -- # We then formalize the typed language CF, and typed bytecode, -- and implement the typed compilation backend. -- The model: -- The bag separation implements the 'disjoint' and the 'overlapping' context -- separation from the paper, depending on how you instantiate it. -- The instantiation is done in the JVM model construction. -- Here we also instantiate Exchange to obtain interface composition. import JVM.Model -- Syntax of bytecode import JVM.Types import JVM.Syntax.Instructions import JVM.Syntax.Bytecode -- The Compiler monad import JVM.Compiler.Monad -- The source language import CF.Types import CF.Syntax -- co-contextual import CF.Syntax.Hoisted -- co-contextual without local variable introductions import CF.Syntax.DeBruijn -- contextual import CF.Transform.Hoist -- hoisting local variable declarations (**) import CF.Transform.UnCo -- contextualizing (**) import CF.Transform.Compile.Expressions -- compiling expressions import CF.Transform.Compile.Statements -- compiling statements import CF.Transform.Compile.ToJVM -- typeclass for type translation import JVM.Transform.Noooops -- bytecode optimization that removes nops import JVM.Transform.Assemble -- bytecode translation to absolute jumps (*) import JVM.Printer -- printer for co-contextual bytecode to Jasmin (not verified) (**) -- Example compilations. -- These can be run by first compiling them using `make examples`. -- The output will be in _build/bin/ import CF.Examples.Ex1 -- (*,**) import CF.Examples.Ex2 -- (*,**)
load-graphics-routines.asm
TheAnsarya/ffmq-info
3
90785
;-------------------------------------------------------------------- ; BANK $00 ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $008504 ; ROUTINE: Copy 8 Colors from $d8e4 ($008504) ; copies $8 colors ($10 bytes) ; data starts at $d8e4 ; parameters: ; A => starting color index ; X => source address offset ; directpage should be $4300 ; dma control $4350 should be set ; dma destination $4351 should be set ; dma databank $4354 should be set Copy8ColorsFromD8E4: sta $2121 ; starting color index => A ldy #$0010 sty $55 ; dma transfer size => $10 %setAXYto16bit() txa and #$00ff clc adc #$d8e4 sta $52 ; source address => X.low + $d8e4 %setAto8bit() lda #$20 sta $420b ; start dma on channel 5 rts ; exit routine ; pc should equal $008520 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $008c1b ; ROUTINE: DecompressAddress ($008c1b) ; expands the address stored in A.low ; parameters: ; A => compressed address ; returns: ; X => ((bits 3-5 of A) * 2) + (bits 0-2 of A) ; so values can be: $00 to $77 (with bit 3 always 0) ; A => decompressed address ; (((X * 2) + X) * 16) + $8000 (bottom 4 bits always 0) ; so values can be: $8000 to $9650 ; TODO: maybe rename when other address expanders are found or we figure out what this is for DecompressAddress: php ; save processor status %setAXYto16bit() and #$00ff ; discard high byte pha ; save A and #$0038 ; bits 3-5 asl a ; A => A * 2 tax ; X => A pla ; restore A ; using stack as a variable ; X is (bits 3-5 of A) * 2 and #$0007 ; bits 0-2 phx ; stack => X adc $01,s ; A += stack, is ((bits 3-5) * 2) + (bits 0-2) sta $01,s ; stack => A asl a ; A => A * 2 adc $01,s ; A += stack asl a asl a asl a asl a ; A => A * 16 adc #$8000 ; A += $8000 plx ; X => stack plp ; restore processor status rts ; exit routine ; pc should equal $008c3d pullpc ;-------------------------------------------------------------------- pushpc org $008c3d ; ROUTINE: ($008c3d) Routine008c3d: php ; save processor status to stack %setAXYto8bit() ldx !ram_1031 008c43 cpx #$ff 008c45 beq $8c81 008c47 lda #$02 008c49 and !flags_d8 008c4c beq $8c83 008c4e lda $049800,x 008c52 adc #$0a 008c54 xba 008c55 txa 008c56 and #$38 008c58 asl a 008c59 pha 008c5a txa 008c5b and #$07 008c5d ora $01,s 008c5f plx 008c60 asl a %setAXYto16bit() 008c63 sta $7f075a 008c67 inc 008c68 sta $7f075c 008c6c adc #$000f 008c6f sta $7f079a 008c73 inc 008c74 sta $7f079c 008c78 sep #$20 ; set A => 8bit 008c7a ldx #$17da 008c7d lda #$7f 008c7f bra $8c9c 008c83 lda $049800,x 008c87 asl a 008c88 asl a 008c89 sta !color_data_source_offset 008c8c rep #$10 ; set X,Y => 16bit 008c8e lda !ram_1031 008c91 jsr DecompressAddressUnlessFF 008c94 stx $00f2 008c97 ldx #$2d1a 008c9a lda #$7e 008c9c pha 008c9d lda #$04 008c9f and $00da 008ca2 beq $8cc5 008ca4 lda $0014 008ca7 dec 008ca8 beq $8cc5 008caa lda #$10 008cac and $00da 008caf bne $8cbb 008cbb plb 008cbc lda $0001,x 008cbf and #$e3 008cc1 ora #$9c 008cc3 bra $8ccd 008cc5 plb 008cc6 lda $0001,x 008cc9 and #$e3 008ccb ora #$88 008ccd xba 008cce lda !ram_1031_long 008cd2 cmp #$29 008cd4 bcc $8d11 008cd6 cmp #$2c 008cd8 beq $8d11 008cda lda $0001,x 008cdd and #$63 008cdf ora #$08 008ce1 sta $0001,x 008ce4 sta $0003,x 008ce7 lda $001030 008ceb ldy #$ffff 008cee sec 008cef iny 008cf0 sbc #$0a 008cf2 bcs $8cef 008cf4 adc #$8a 008cf6 sta $0002,x 008cf9 cpy #$0000 008cfc beq $8d06 008cfe tya 008cff adc #$7f 008d01 sta $0000,x 008d04 bra $8d20 008d11 xba 008d12 sta $0001,x 008d15 sta $0003,x 008d18 lda #$45 008d1a sta $0000,x 008d1d sta $0002,x 008d20 phk 008d21 plb 008d22 lda #$80 008d24 tsb $00d4 008d27 plp 008d28 rts ; exit routine ; pc should equal $008d29 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $008d8a ; ROUTINE: ($008d8a) ; parameters: ; A => compressed address ; if $ff then return $ffff ; returns: ; X => decompressed address ; $ffff when A is $ff DecompressAddressUnlessFF: cmp #$ff beq .IsFF .NotFF jsr DecompressAddress tax rts ; exit routine .IsFF ldx #$ffff rts ; exit routine ; pc should equal $008d97 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $008ddf ; ROUTINE: Copy tiles to VRAM ($008ddf) ; loops Y times, writing one tile to VRAM each time ; copies $10 bytes to vram, then copies $8 bytes as the low byte using the same high byte loaded from $00f0-$00f1 ; so if data for last $8 bytes is = $AA $BB $CC... and $00f0 = $5500, then the second part would write as $55AA $55BB $55CC... ; parameters: ; databank => source address bank ; X => source address offset ; Y => number of times to loop ; ram $00f0 => high byte (which is at $00f1) will be used as high byte for second half of copies ; $2115-$2117 should be set up with vram options and vram destination address CopyTilesToVRAM: php ; save processor status to stack phd ; save direct page to stack %setAXYto16bit() lda #$2100 ; tcd ; set direct page => $2100 so writes are to registers clc ; clear carry ; write a tile to vram Y times { .Loop { phy ; save counter to stack ; copy $10 bytes to vram !counter = 0 while !counter < $10 lda $0000+!counter,x sta $18 !counter #= !counter+2 endif lda $00f0 ; high byte loaded here will be kept for these next $8 writes %setAto8bit() ; read $8 bytes, write $10 bytes to vram !counter = 0 while !counter < $8 lda $0010+!counter,x tay ; copy 16bit version of A to Y sty $18 ; write 2 bytes to vram $2118 !counter #= !counter+1 endif %setAXYto16bit() txa ; set A => source address offset adc #$0018 ; increment by $18 (one tile's worth of data) tax ; set source address offset => A ply ; resore counter from stack dey ; decrement counter bne .Loop } pld ; restore direct page from stack plp ; restore processor status from stack rtl ; exit routine ; pc should equal $008e54 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $008ec4 ; ROUTINE: LoadTilesAndColors ($008ec4) ; loads tiles from $078030 ($038030 in file) ; viewable in 2bpp, 2 dimensional, 32 blocks wide in TileMolester ; the 8bit address translation causes this output ; TODO: what are we actually loading? overworld? city? title? ; text and menu outline and stuff and part of title screen ; TODO: finish code/comment cleanup ; TODO: Better label name LoadTilesAndColors: php ; save processor status to stack phd ; save direct page to stack %setAXYto16bit() lda #$2100 tcd ; direct page => $2100, so direct mode writes are to the registers %setAto8bit() ldx #$1801 ; dma control => $01, write 2 bytes each time stx $4350 ; dma destination => $18, VRAM ldx #$8030 stx $4352 ; source offset => $8030 lda #$07 sta $4354 ; source bank => $07 ldx #$1000 stx $4355 ; dma transfer size => $1000 ldx #$3000 stx $16 ; vram destination address => $6000 lda #$84 ; $84 means increment address on write high byte, translation = 8bit, increment address by 1 word sta $15 ; set video port control [VMAIN] lda #$20 sta $420b ; start dma transfer on channel 5 ; load $100 tiles from $048000 (in file: $020000) ($18 bytes each) to vram address $2000 ($20 bytes each) lda #$80 ; $80 means increment destination address by 1 word (2 bytes) on write sta $15 ; set video port control [VMAIN] %setAXYto16bit() lda #$ff00 sta $00f0 ; set high byte for second half of tile => $ff ldx #$2000 stx $16 ; set vram destination address => $2000 ; setup source => $04:8000 %setDatabank(04) ldx #$8000 ; set source address offset => $8000 ldy #$0100 ; going to copy $100 tiles jsl CopyTilesToVRAM plb ; restore databank from stack ; load $10 colors ($4 colors * $4 times) ; writes the second half of palettes $0-$1 ; TODO: what colors are these? %setAXYto8bit() %setDatabank(07) lda #$08 ; set starting color index => $08 ldx #$00 ; set source address offset => $00 jsr Copy4ColorsToCGRAM lda #$0c ; set starting color index => $0c ldx #$08 ; set source address offset => $08 jsr Copy4ColorsToCGRAM lda #$18 ; set starting color index => $18 ldx #$10 ; set source address offset => $10 jsr Copy4ColorsToCGRAM lda #$1c ; set starting color index => $1c ldx #$18 ; set source address offset => $18 jsr Copy4ColorsToCGRAM plb ; restore databank from stack ; Load the menu background color into indexes $0d and $1e ; ram $0e9c-$0e9d - 2 bytes - menu background color (chosen by player in the menu) ldx !menu_color ldy !menu_color_high lda #$0d sta $21 stx $22 sty $22 lda #$1d sta $21 stx $22 sty $22 ; load $18 colors ($8 colors * $6 times) ; TODO: what colors are these? ; writes the second half of palettes $2-$7 ; source data offset and color index increase by $10 each loop ; so source data is contiguous but index skips $8 every loop ldy #$06 ; loop counter lda #$00 ; start color index and source data offset at $00 clc %setDatabank(07) .Loop { tax ; set source offset => adc #$28 ; color indexes start at $28 sta $21 ; set starting color index ; write 16 bytes to CGRAM !counter = 0 while !counter < 16 lda $d8e4+!counter,x sta $22 !counter #= !counter+1 endif txa ; retrieve source offset adc #$10 ; advance by the $10 bytes we wrote dey ; decrement counter bne .Loop } plb ; restore databank pld ; restore direct page from stack plp ; restore processor status from stack rts ; exit routine ; pc should equal $008fb4 pullpc ;-------------------------------------------------------------------- pushpc org $008fb4 ; ROUTINE: Copy $4 colors to CGRAM ($008fb4) ; parameters: ; A => the starting color index ; X => source address offset ; direct page => $2100, so the writes are to registers ; AXY => 8bit Copy4ColorsToCGRAM: sta $21 ; set CGRAM address $2121 ; write 8 bytes to CGRAM !counter = 0 while !counter < 8 lda $8000+!counter,x sta $22 !counter #= !counter+1 endif rts ; exit routine ; pc should equal $008fdf pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $00c56b ; ROUTINE: Clear 417/$1A1 bytes at Y ($00c56b) ; fills $0d*$20 bytes ($1A0) with $00, starting at Y ; clears one additional byte, so $1A1 or 417 bytes are cleared ; the extra byte seems like an error ; parameters: ; Y => destination offset Clear417BytesAtY: ldx #$000d ; loop counter clc .Loop { ; fill $21 bytes with $00 ; NOTE: this fills $21 bytes at a time but the counter advances by $20 bytes, not $21 ; NOTE: this might be a programming mistake! %setAto8bit() lda #$00 jsr FillWithA_x11 %setAXYto16bit() tya adc #$0020 tay ; Y += $20 dex ; decrement counter bne .Loop ; loop until counter = 0 } rts ; exit routine ; pc should equal $00c581 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- ; BANK $01 ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $018336 ; ROUTINE: ($018336) Routine018336: php ; save processor status phb ; save databank phk plb ; databank => program bank %setAto8bit() %setXYto16bit() lda !ram_19a5 bmi .Exit 018343 jsr $8e06 018346 jsr WriteRamFrom195F lda #$00 xba ; clear A.high lda !ram_1a46 asl a tax ; X => !ram_1a46 * 2 jsr ($835a,x) ; TODO: rename jump table stz !ram_1a46 ; clear !ram_1a46 .Exit plb ; restore databank plp ; restore processor status rtl ; exit routine ; pc should equal $018360 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $01836c ; ROUTINE: LoadFromDataColors839e ($01836c) ; DataColors839e => $20 bytes in $4 byte chunks ; byte 0 => color index ; bytes 1-2 => source address ; byte 3 => dma transfer size ; A => 8bit, XY => 16bit LoadFromDataColors839e: ldx #$0000 ; clear X txa xba ; clear A.high .Loop { lda $839e,x sta $2121 ; color index => $839e[X] ldy #$2200 ; dma control => $00, auto increment, write twice sty $4300 ; dma destination => $22, CGRAM ldy $839f,x sty $4302 ; source offset => $839f[X] lda #$7f sta $4304 ; source bank => $7f lda $83a1,x tay sty $4305 ; dma transfer size => $83a1[X] lda #$01 sta $420b ; start dma transfer on channel 0 inx inx inx inx ; counter += 4 cpx #$0020 ; loop until counter = $20 bne .Loop } rts ; exit routine ; pc should equal $01839e pullpc ;-------------------------------------------------------------------- pushpc org $01839e ; DATA: DataColors839e ($01839e) ; $01839e-$0183bd ($20 bytes) ; $20 bytes in $4 byte chunks ; byte 0 => color index ; bytes 1-2 => source address ; byte 3 => dma transfer size DataColors839e: db $80 ; color index dw $C488 ; source address db $10 ; size db $90 ; color index dw $C4A8 ; source address db $10 ; size db $A0 ; color index dw $C4C8 ; source address db $10 ; size db $B0 ; color index dw $C4E8 ; source address db $20 ; size db $C0 ; color index dw $C508 ; source address db $10 ; size db $D0 ; color index dw $C528 ; source address db $10 ; size db $E0 ; color index dw $C548 ; source address db $10 ; size db $F0 ; color index dw $C568 ; source address db $10 ; size ; pc should equal $0183be pullpc ;-------------------------------------------------------------------- pushpc org $0183be ; ROUTINE: Copy Tilemap from WRAM to VRAM ($0183be) ; copy two sections from WRAM to VRAM through DMA (channel 0) ; each section can have 4 copys ; parameters: ; @var_1a4c => if $01 then call second copy routine TODO: verify ; ram $19fa - $1a12 => parameters for first copy ; ram $1a13 - $1a2b => parameters for second copy CopyTilemapFromWRAMToVRAM: jsr CopyTilemapFromWRAMToVRAM_1 ; skip second copy if !ram_1a4c !+= $01 lda !ram_1a4c dec bne .Exit jsr CopyTilemapFromWRAMToVRAM_2 .Exit rts ; exit routine ; pc should equal $0183cb pullpc;-------------------------------------------------------------------- pushpc org $0183cb ; ROUTINE: Copy Tilemap from WRAM to VRAM ($0183cb) ; copy from WRAM to VRAM through DMA (channel 0) up to 4 times options at $19fa ; parameters: ; $19fa => 1 byte, VMAIN flags, !tilemap_vram_control ; $19fb-$1a02 => 8 bytes, 2-byte pairs, 4 of them, each is destination address in VRAM, !tilemap_vram_destination_addresses ; $1a03-$1a0a => 8 bytes, 2-byte pairs, 4 of them, each is source address offset, !tilemap_wram_source_addresses ; $1a0b-$1a12 => 8 bytes, 2-byte pairs, 4 of them, each is DMA transfer size in bytes, !tilemap_dma_transfer_sizes ; A => 8bit, XY => 16bit CopyTilemapFromWRAMToVRAM_1: ldx #$0000 ; loop counter ; setup and run dma transfer up to 4 times { .Loop { ldy !tilemap_dma_transfer_sizes,x beq .Exit ; exit when y = $0000 (no bytes to transfer) sty $4305 ; DMA transfer size => !tilemap_dma_transfer_sizes[X] ldy #$1801 ; $18 means destination is VRAM register $2118, $01 means write 2 bytes each time sty $4300 ; write dma control and destination registers ; setup source address ldy !tilemap_wram_source_addresses,x sty $4302 ; source offset => !tilemap_wram_source_addresses[X] lda #$00 sta $4304 ; source bank => $00 ; destination setup ldy !tilemap_vram_destination_addresses,x sty $2116 ; VRAM destination address => !tilemap_vram_destination_addresses[X] lda !tilemap_vram_control sta $2115 ; VMAIN control lda #$01 sta $420b ; start dma transfer on channel 0 inx inx ; counter += 2 cpx #$0008 ; loop until counter = 8 bne .Loop } .Exit rts ; exit routine ; pc should equal $018400 pullpc;-------------------------------------------------------------------- pushpc org $018400 ; ROUTINE: ($018400) ; copy from WRAM to VRAM through DMA (channel 0) up to 4 times, options at $1a13 ; parameters: ; $1a13 => 1 byte, VMAIN flags, !tilemap_vram_control_2 ; $1a14-$1a1b => 8 bytes, 2-byte pairs, 4 of them, each is destination address in VRAM, !tilemap_vram_destination_addresses_2 ; $1a1c-$1a23 => 8 bytes, 2-byte pairs, 4 of them, each is source address offset, !tilemap_wram_source_addresses_2 ; $1a24-$1a2b => 8 bytes, 2-byte pairs, 4 of them, each is DMA transfer size in bytes, !tilemap_dma_transfer_sizes_2 ; A => 8bit, XY => 16bit CopyTilemapFromWRAMToVRAM_2: ldx #$0000 ; setup X as a counter starting at $0000 ; start of loop - setup and run dma transfer up to 4 times { .Loop { ldy !tilemap_dma_transfer_sizes_2,x beq .Exit ; exit when y = $0000 (no bytes to transfer) sty $4305 ; DMA transfer size => !tilemap_dma_transfer_sizes_2[X] ldy #$1801 ; $18 means destination is VRAM register $2118, $01 means write 2 bytes each time sty $4300 ; write dma control and destination registers ; setup source address ldy !tilemap_wram_source_addresses_2,x sty $4302 ; source offset => !tilemap_wram_source_addresses_2[X] lda #$00 sta $4304 ; source bank => $00 ; destination setup ldy !tilemap_vram_destination_addresses_2,x sty $2116 ; VRAM destination address => !tilemap_vram_destination_addresses_2[X] lda !tilemap_vram_control_2 sta $2115 ; VMAIN control lda #$01 sta $420b ; start dma transfer on channel 0 inx inx ; counter += 2 cpx #$0008 ; loop until counter = 8 bne .Loop } .Exit rts ; exit routine ; pc should equal $018435 pullpc;-------------------------------------------------------------------- pushpc org $018435 ; ROUTINE: Copy Wram 7FD274 To Vram ($018435) ; Copy $2000 bytes from WRAM $7fd274 to VRAM $0000 through DMA (channel 0) ; A => 8bit, XY => 16bit CopyWram7FD274ToVram: ldx #$0000 stx $2116 ; destination address => $0000 lda #$80 sta $2115 ; vram control => $80, auto increment by 1 word on write high ldx #$1801 ; dma control => $01, write 2 bytes each time stx $4300 ; dma destination => $18, VRAM ldx #$d274 stx $4302 ; source offset => $d274 lda #$7f sta $4304 ; source bank => $7f ldx #$2000 stx $4305 ; dma transfer size => $2000 lda #$01 sta $420b ; start DMA transfer on channel 0 rts ; exit routine ; pc should equal $01845d pullpc;-------------------------------------------------------------------- pushpc org $01845d ; ROUTINE: Copy 64 colors from c588 ($01845d) ; Copy $40 colors ($80 bytes) from WRAM $7fc588[X] to CGRAM ; parameters: ; X => source offset ; A => 8bit, XY => 16bit Copy64ColorsFrom7FC588: ldx #$c588 ; X => $c588, source offset start lda #$00 ; loop counter => $00, also color index .Loop { pha ; save counter sta $2121 ; color index => A ldy #$2200 ; dma control => $00, auto increment, write twice sty $4300 ; dma destination => $22, CGRAM stx $4302 ; source offset => X lda #$7f sta $4304 ; source bank => $7f ldy #$0010 sty $4305 ; dma transfer size => $10 lda #$01 sta $420b ; start dma transfer on channel 0 ; X += $10 %setAto16bit() txa clc adc #$0010 tax %setAto8bit() pla ; restore counter clc adc #$10 ; counter += $10 cmp #$80 ; loop until counter = $80 bne .Loop } rts ; exit routine ; pc should equal $018492 pullpc;-------------------------------------------------------------------- pushpc org $018492 ; ROUTINE: Copy wram 7f0000 to vram ($018492) ; Copy $2e00 bytes from WRAM $7f0000 to VRAM $6900 through DMA (channel 0) ; A => 8bit, XY => 16bit CopyWram7F0000ToVram: ldx #$6900 stx $2116 ; destination address => $6900 lda #$80 sta $2115 ; vram control => $80, auto increment by 1 word on write high ldx #$1801 ; dma control => $01, write 2 bytes each time stx $4300 ; dma destination => $18, VRAM stz $4302 ; source offset => $0000 ldx #$7f00 ; stx $4303 ; source bank => $7f ldx #$2e00 stx $4305 ; dma transfer size => $2e00 lda #$01 sta $420b ; start dma transfer on channel 0 rts ; exit routine ; pc should equal $0184b8 pullpc ;-------------------------------------------------------------------- pushpc org $0184b8 ; ROUTINE: ($0184b8) ; copy $0c00 bytes from WRAM $7f4000 to VRAM $6100 through DMA (channel 0) ; A => 8bit, XY => 16bit CopyWram7F4000ToVram: ldx #$6100 stx $2116 ; destination address => $6100 lda #$80 sta $2115 ; vram control => $80, auto increment by 1 word on write high ldx #$1801 ; dma control => $01, write 2 bytes each time stx $4300 ; dma destination => $18, VRAM ldx #$4000 stx $4302 ; source offset => $4000 lda #$7f sta $4304 ; source bank => $7F ldx #$0c00 stx $4305 ; dma transfer size => $0c00 lda #$01 sta $420b ; start dma transfer on channel 0 rts ; exit routine ; pc should equal $0184e0 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $01914c ; ROUTINE: ($01914c) Routine01914c: 01914c jsr $8b75 ; jump to the "Clear bits in 2 byte value at $008e using mask of $4030" routine jsl Routine0b8149 019153 jsr $c839 019156 jsr $af55 019159 jsl $0b87b9 01915d jsl $0b836a jsr CopyTileDataToWRAM 019164 jsl $0b83b8 019168 jsl $0b83f2 01916c jsr $81db 01916f jsr $fe0b 019172 jsl $0b84fb 019176 ldy $0e89 019179 jsr $fd50 01917c sty $0e89 01917f jsl $0b8223 019183 jsl $0b8560 019187 jsr $c750 01918a ldx #$0000 ; clear X 01918d stx $1908 019190 stx $190a 019193 ldx #$0008 019196 stx $1900 019199 ldx #$00f8 01919c stx $1902 01919f php ; save processor status to stack 0191a0 jsr $9fae 0191a3 plp 0191a4 jsr $a226 0191a7 ldx #$ffff 0191aa stx !ram_195f 0191ad jsr $a403 0191b0 jsr $e76a 0191b3 jsr $ab5c 0191b6 jsr $ab5c 0191b9 jsr $ab5c 0191bc jsr $c8a8 0191bf jsl $0b82aa 0191c3 lda $1cc2 0191c6 beq $91d8 ;MISSING 0191d8 jsr $94cc 0191db jsr $e61c 0191de jsr $a08a 0191e1 jsl $0c8000 0191e5 lda $0110 0191e8 bpl $91e1 0191ea lda !ram_0111 0191ed pha 0191ee stz !ram_0111 0191f1 stz $420c 0191f4 jsl $0b841d 0191f8 jsr CopyWram7FD274ToVram 0191fb jsr Copy64ColorsFrom7FC588 0191fe jsr CopyWram7F0000ToVram 019201 jsr CopyWram7F4000ToVram 019204 jsr LoadFromDataColors839e 019207 jsr $fe6b 01920a jsr $8672 01920d jsr $84e0 019210 lda $1916 019213 and #$1f 019215 sta $19ee 019218 sta $19f5 01921b lda #$26 01921d sta $19ef 019220 jsl $01b24b 019224 lda $19f6 019227 beq $9233 019229 ldx #$2502 01922c stx $19ee 01922f jsl $01b24b 019233 pla 019234 sta !ram_0111 019237 stz !ram_1a46 01923a stz $19ac 01923d lda $0e91 019240 cmp #$05 019242 beq .Exit 019244 lda #$02 019246 sta $1a45 019249 jsl $0c8000 01924d lda $1a45 019250 bne $9249 019252 ldx #$0000 019255 stx $0015 019258 stz !ram_19a5 01925b jsr $8b82 01925e lda $0e91 019261 beq .Exit 019263 jsl $009aec .Exit rts ; exit routine ; pc should equal $019268 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $019739 ; ROUTINE: WriteRamFrom195F ($019739) ; !ram_195f => destination address ; !ram_195f+2 => ; !ram_195f+4 => ; !ram_195f+6 => ; !ram_195f+8 => WriteRamFrom195F: php ; save processor status phd ; save databank ldx !ram_195f cpx #$ffff ; exit when !ram_195f = $ffff beq .Exit lda #$80 sta $2115 ; vram control => $80, auto increment by 1 word on write high pea !ram_195f pld ; databank => !ram_195f %setAXYto16bit() lda $00 sta $2116 ; destination address => !ram_195f lda $02 sta $2118 ; write !ram_195f+2 lda $04 sta $2118 ; write !ram_195f+4 lda $00 ; A => !ram_195f clc adc #$0020 sta $2116 ; destination address => A + $20 lda $06 sta $2118 ; write !ram_195f+6 lda $08 sta $2118 ; write !ram_195f+8 lda #$ffff sta $00 ; !ram_195f => $ffff .Exit pld ; restore databank plp ; restore processor status rts ; exit routine ; pc should equal $019778 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $01c839 Routine01c839: 01c839 lda #$00 01c83b xba 01c83c lda $0e91 01c83f tax 01c840 lda $06be77,x bmi .Exit 01c846 asl a 01c847 tax 01c848 php ; save processor status to stack 01c849 rep #$30 ; set A,X,Y => 16bit 01c84b lda $06bee3,x 01c84f tax 01c850 plp .Loop { 01c851 lda $06bf15,x 01c855 cmp #$ff 01c857 beq $c882 01c859 jsl $009776 01c85d beq $c87d 01c85f lda $06bf16,x 01c863 sta $19ee 01c866 lda $06bf17,x 01c86a sta $19ef 01c86d cmp #$24 01c86f beq $c883 01c871 cmp #$28 01c873 beq $c88b 01c875 ldy $19ee 01c878 cpy #$2500 01c87b beq $c8a2 01c87d inx 01c87e inx 01c87f inx bra .Loop } .Exit rts ; exit routine ; pc should equal $01c883 ; TODO: there is more to this routine, get additional code pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $01e90c ; ROUTINE: Copy one tile to WRAM ($01:e90c) ; $18 bytes from source => $20 bytes destination ; Copy the first $10 bytes, then copy each of the next $8 bytes followed by a zero byte (so AABBCC... becomes AA00BB00CC00...) ; parameters: ; Y => source address offset ; $2181-$2183 - should be set to wram destination address CopyOneTileToWRAM: phd ; save directpage to stack phx ; save X to stack ; make so writing to $80 is $2180 [WMDATA] %setDirectpage($2100) ; copy first ten bytes ldx #$0010 ; loop counter .Loop { lda $0000,y ; load the source byte iny ; increment source address sta $80 ; write byte dex ; decrement counter bne .Loop } ; copy last $8 bytes mixed with zeros ldx #$0008 ; loop counter .LoopB { lda $0000,y ; load the source byte iny ; increment source address sta $80 ; write byte stz $80 ; write $00 dex ; decrement counter bne .LoopB } plx ; restore X pld ; restore directpage rts ; exit routine ; pc should equal $01e92f pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $01e946 ; ROUTINE: Clear $20 bytes of WRAM ($01:e946) ; ; $2181-$2183 - should be set to wram destination address Clear32bytesOfWRAM: phd ; save directpage phx ; save X ; make so writing to $80 is $2180 [WMDATA] %setDirectpage($2100) ; clear $20 bytes ($4 bytes * $8 times) ldx #$0008 ; loop counter .Loop stz $80 ; Clear 4 bytes stz $80 stz $80 stz $80 dex ; decrement counter bne .Loop } plx ; restore X pld ; restore directpage rts ; exit routine ; pc should equal $01e95d pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $01f849 ; ROUTINE: ($01f849) ; parameters: ; ram $19f7 => ; TODO: name this routine!!! Routine01f849: %setAto8bit() 01f84b inc $19f7 01f84e jsr $82cf 01f851 ldx $1900 01f854 stx $1904 01f857 ldx $1902 01f85a stx $1906 01f85d lda #$07 01f85f sta $1a4c 01f862 jsr $f8a5 ldx #$0000 ; loop counter .Loop { phx ; save counter %setAto16bit() 01f86b lda $f891,x 01f86e sta $1a14 01f871 clc 01f872 adc #$0400 01f875 sta $1a16 %setAto8bit() 01f87a jsr $f8da plx ; restore counter inx inx ; counter += 2 cpx #$0014 ; loop until counter = $14 bne .Loop } 01f885 stz $1a4c 01f888 lda #$15 01f88a sta $1a4e 01f88d stz $1a4f 01f890 rts ; exit routine ; pc should equal $01f891 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $01f977 ; ROUTINE: ($01f977) ; parameters: ; @var_192d ; XY => 16bit Routine01f977: php ; save processor status %setAto8bit() ldx #$0000 ; clear X ldy $192d ; Y => @var_192d jsr $f99f plp ; restore processor status rts ; exit routine ; pc should equal $01f985 pullpc ;-------------------------------------------------------------------- pushpc org $01f985 ; ROUTINE: ($01f985) ; ; parameters: ; @var_0e89 => ; @var_19b4 => ; @var_19d7 => ; @var_1a52 => ; A => 8bit, XY => 16bit ; TODO: name this routine!!!!!! Routine01f985: ; get offset into JumpTableTilemapCopySetup[] lda $19d7 ; load @var_19d7 asl a %setAto16bit() and #$0006 tax ; x => (lower 2 bits of @var_19d7) * 2 lda $0e89 ; load @var_0e89 %setAto8bit() clc adc $88c4,x xba clc adc $88c5,x xba tay ; Y=> ; continue into the following routine ; ROUTINE: ($01f99f) ; parameters: ; X => offset into JumpTableTilemapCopySetup[] and JumpTableTilemapCopySetup_2[] ; Y => ; Routine01f985_Entry: 01f99f jsr $fd50 01f9a2 sty !ram_1a31 01f9a5 sty !ram_1a2d ldy #$0000 sty $1a2f ; clear @var_1a2f lda !ram_19b4 asl a asl a asl a asl a and #$80 sta !ram_1a33 ; !ram_1a33 => (bit 3 of @var_19b4 = 1) ? $80 : $00 lda $1a52 sta !ram_1a34 ; !ram_1a34 => @var_1a52 phx ; save X jsr (JumpTableTilemapCopySetup,x) plx ; restore X 01f9c5 lda $1a4c 01f9c8 dec 01f9c9 bne $f9fa 01f9cb lda !ram_1a2d 01f9ce clc 01f9cf adc $1a56 01f9d2 sta !ram_1a31 01f9d5 lda $1a2e 01f9d8 clc 01f9d9 adc $1a57 01f9dc sta $1a32 01f9df ldy !ram_1a31 01f9e2 jsr $fd50 01f9e5 sty !ram_1a31 01f9e8 ldy $1a4a 01f9eb sty $1a2f 01f9ee stz !ram_1a33 01f9f1 lda $1a53 01f9f4 sta !ram_1a34 jsr (JumpTableTilemapCopySetup_2,x) rts ; exit routine ; pc should equal $01f9fb pullpc ;-------------------------------------------------------------------- pushpc org $01f9fb ; pctosnes($00f9fb) ; DATA: Jump table for setting up tilemap data for writing one line ($01f9fb) JumpTableTilemapCopySetup: dw TilemapCopySetup dw TilemapCopySetupVertical dw TilemapCopySetup dw TilemapCopySetupVertical ; db $0B,$FA ; db $AE,$FA ; db $0B,$FA ; db $AE,$FA ; pc should equal $01fa03 pullpc ;-------------------------------------------------------------------- pushpc org $01fa03 ; pctosnes($00fa03) ; DATA: Jump table for setting up tilemap data for writing one line ($01fa03) JumpTableTilemapCopySetup_2: dw TilemapCopySetup_2 dw TilemapCopySetupVertical_2 dw TilemapCopySetup_2 dw TilemapCopySetupVertical_2 ; db $49,$FB ; db $EF,$FB ; db $49,$FB ; db $EF,$FB ; pc should equal $01fa0b pullpc ;-------------------------------------------------------------------- pushpc org $01fa0b ; ROUTINE: ($01fa0b) ; in JumpTableTilemapCopySetup[] ; source order: $8000,02,80,82 ; parameters: ; !ram_1924 => ; !ram_1a31 => ; !ram_1a33 => ; A => 8bit, XY => 16bit ; TODO: name this routine!!! TilemapCopySetup: ldy #$0000 ; loop counter .Loop { phy ; save Y ldy !ram_1a31 ; Y => !ram_1a31 lda !ram_1a33 ; A => !ram_1a33 jsr $fc8e ; get values for $1a3d[0..7] ply ; restore Y ; copy $1a3d[0..3] to $0800[Y] and $1a3d[4..7] to $0880[Y] %setAto16bit() lda !ram_1a3d sta !tilemap_wram_source_start,y lda !ram_1a3d+2 sta !tilemap_wram_source_start+2,y lda !ram_1a3d+4 sta !tilemap_wram_source_start+$80,y lda !ram_1a3d+6 sta !tilemap_wram_source_start+$82,y %setAto8bit() ; counter += 4 iny iny iny iny ; increment !ram_1a31 then subtract !ram_1924 if that would be positive lda !ram_1a31 ; A => !ram_1a31 inc ; A += 1 cmp !ram_1924 ; if !ram_1924 > A then skip ahead bcc .Skip sec sbc !ram_1924 ; A => A - !ram_1924 .Skip sta !ram_1a31 ; !ram_1a31 => A cpy #$0044 ; loop until counter = $44 bne .Loop } lda #$80 ; $80 means increment destination address by 1 word (2 bytes) on write of high byte sta !tilemap_vram_control %setAto16bit() lda !ram_19bd eor #$ffff and #$000f inc asl a asl a ; A => ((inversed bits 0-3 of !ram_19bd) + 1) * 4 sta !tilemap_dma_transfer_sizes sta !tilemap_dma_transfer_sizes+2 lda #$0044 sec sbc !tilemap_dma_transfer_sizes sta !tilemap_dma_transfer_sizes+4 sta !tilemap_dma_transfer_sizes+6 lda #!tilemap_wram_source_start sta !tilemap_wram_source_addresses clc adc !tilemap_dma_transfer_sizes sta !tilemap_wram_source_addresses+4 lda #!tilemap_wram_source_start+$80 sta !tilemap_wram_source_addresses+2 clc adc !tilemap_dma_transfer_sizes+2 sta !tilemap_wram_source_addresses+6 jsr CalculateTilemapVramDestination sta !tilemap_vram_destination_addresses clc adc #$0020 sta !tilemap_vram_destination_addresses+2 eor #$0400 and #$47c0 sta !tilemap_vram_destination_addresses+4 clc adc #$0020 sta !tilemap_vram_destination_addresses+6 %setAto8bit() rts ; exit routine ; pc should equal $01faae pullpc ;-------------------------------------------------------------------- pushpc org $01faae ; ROUTINE: ($01faae) ; in JumpTableTilemapCopySetup[] ; source order: $8000,80,02,82 ; parameters: ; ; A => 8bit, XY => 16bit ; TODO: name this routine!!! TilemapCopySetupVertical: ldy #$0000 ; loop counter .Loop { phy ; save Y ldy !ram_1a31 ; Y => !ram_1a31 lda !ram_1a33 ; A => !ram_1a33 jsr $fc8e ; get values for $1a3d[0..7] ply ; restore Y %setAto16bit() lda !ram_1a3d sta !tilemap_wram_source_start,y lda !ram_1a3d+2 sta !tilemap_wram_source_start+$80,y lda !ram_1a3d+4 sta !tilemap_wram_source_start+2,y lda !ram_1a3d+6 sta !tilemap_wram_source_start+$82,y %setAto8bit() ; counter += 4 iny iny iny iny ; increment !ram_1a32 then subtract !ram_1925 if that would be positive lda !ram_1a32 ; A => !ram_1a32 inc ; A += 1 cmp !ram_1925 ; if !ram_1925 > A then skip ahead bcc .Skip sec sbc !ram_1925 ; A => A - !ram_1925 .Skip sta !ram_1a32 ; !ram_1a32 => A cpy #$0040 ; loop until counter = $40 bne .Loop } lda #$81 ; $81 means increment destination address by $20 words ($40 bytes) on write of high byte sta !tilemap_vram_control %setAto16bit() lda $19bf eor #$ffff and #$000f inc asl a asl a ; A => ((inversed bits 0-3 of !ram_19bf) + 1) * 4 sta !tilemap_dma_transfer_sizes sta !tilemap_dma_transfer_sizes+2 lda #$0040 sec sbc !tilemap_dma_transfer_sizes sta !tilemap_dma_transfer_sizes+4 sta !tilemap_dma_transfer_sizes+6 lda #!tilemap_wram_source_start sta !tilemap_wram_source_addresses clc adc !tilemap_dma_transfer_sizes sta !tilemap_wram_source_addresses+4 lda #!tilemap_wram_source_start+$80 sta !tilemap_wram_source_addresses+2 clc adc !tilemap_dma_transfer_sizes+2 sta !tilemap_wram_source_addresses+6 jsr CalculateTilemapVramDestination sta !tilemap_vram_destination_addresses inc sta !tilemap_vram_destination_addresses+2 dec and #$441e ; TODO: what does this mask do sta !tilemap_vram_destination_addresses+4 inc sta !tilemap_vram_destination_addresses+6 %setAto8bit() rts ; exit routine ; pc should equal $01fb49 pullpc ;-------------------------------------------------------------------- pushpc org $01fb49 ; ROUTINE: ($01fb49) ; in JumpTableTilemapCopySetup_2[] ; source order: $9000,02,80,82 ; parameters: ; ; A => 8bit, XY => 16bit ; TODO: name this routine!!! TilemapCopySetup_2: ldy #$0000 ; loop counter .Loop { phy ; save Y ldy !ram_1a31 ; Y => !ram_1a31 lda !ram_1a33 ; A => !ram_1a33 jsr $fc8e ; get values for $1a3d[0..7] ply ; restore Y ; copy $1a3d[0..3] to $0900[Y] and $1a3d[4..7] to $0980[Y] %setAto16bit() lda !ram_1a3d sta !tilemap_wram_source_start_2,y lda !ram_1a3d+2 sta !tilemap_wram_source_start_2+2,y lda !ram_1a3d+4 sta !tilemap_wram_source_start_2+$80,y lda !ram_1a3d+6 sta !tilemap_wram_source_start_2+$82,y %setAto8bit() ; counter += 4 iny iny iny iny lda !ram_1a31 ; A => !ram_1a31 inc ; A += 1 cmp !ram_1924 ; if !ram_1924 > A then skip ahead bcc .Skip sec sbc !ram_1924 ; A => A - !ram_1924 .Skip sta !ram_1a31 ; !ram_1a31 => A cpy #$0044 ; loop until counter = $44 bne .Loop } lda #$80 ; $80 means increment destination address by 1 word (2 bytes) on write of high byte sta !tilemap_vram_control_2 %setAto16bit() lda !ram_19bd eor #$ffff and #$000f inc asl a asl a ; A => ((inversed bits 0-3 of !ram_19bd) + 1) * 4 sta !tilemap_dma_transfer_sizes_2 sta !tilemap_dma_transfer_sizes_2+2 lda #$0044 sec sbc !tilemap_dma_transfer_sizes_2 sta !tilemap_dma_transfer_sizes_2+4 sta !tilemap_dma_transfer_sizes_2+6 lda #!tilemap_wram_source_start_2 sta !tilemap_wram_source_addresses_2 clc adc !tilemap_dma_transfer_sizes_2 sta !tilemap_wram_source_addresses_2+4 lda #!tilemap_wram_source_start_2+$80 sta !tilemap_wram_source_addresses_2+2 clc adc !tilemap_dma_transfer_sizes_2+2 sta !tilemap_wram_source_addresses_2+6 jsr CalculateTilemapVramDestination ora #$0800 sta !tilemap_vram_destination_addresses_2 clc adc #$0020 sta !tilemap_vram_destination_addresses_2+2 eor #$0400 and #$4fc0 sta !tilemap_vram_destination_addresses_2+4 clc adc #$0020 sta !tilemap_vram_destination_addresses_2+6 %setAto8bit() rts ; exit routine ; pc should equal $01fbef pullpc ;-------------------------------------------------------------------- pushpc org $01fbef ; ROUTINE: ($01fbef) ; in JumpTableTilemapCopySetup_2[] ; source order: $9000,80,02,82 ; parameters: ; !ram_1a31 ; !ram_1a32 ; !ram_1a33 ; !ram_1925 ; A => 8bit, XY => 16bit ; TODO: name this routine!!! TilemapCopySetupVertical_2: ldy #$0000 ; loop counter .Loop { phy ; save Y ldy !ram_1a31 ; Y => !ram_1a31 lda !ram_1a33 ; A => !ram_1a33 jsr $fc8e ; get values for $1a3d[0..7] ply ; restore Y ; copy $1a3d[0..3] to $0900[Y] and $1a3d[4..7] to $0980[Y] TODO: fix comment %setAto16bit() lda !ram_1a3d sta !tilemap_wram_source_start_2,y lda !ram_1a3d+2 sta !tilemap_wram_source_start_2+$80,y lda !ram_1a3d+4 sta !tilemap_wram_source_start_2+2,y lda !ram_1a3d+6 sta !tilemap_wram_source_start_2+$82,y %setAto8bit() ; counter += 4 iny iny iny iny ; increment !ram_1a32 then subtract !ram_1925 if that would be positive lda !ram_1a32 ; A => !ram_1a32 inc ; A += 1 cmp !ram_1925 ; if !ram_1925 > A then skip ahead bcc .Skip sec sbc !ram_1925 ; A => A - !ram_1925 .Skip sta !ram_1a32 ; !ram_1a32 => A cpy #$0040 ; loop until counter = $40 bne .Loop } lda #$81 ; $81 means increment destination address by $20 words ($40 bytes) on write of high byte sta !tilemap_vram_control_2 %setAto16bit() lda !ram_19bf eor #$ffff and #$000f inc asl a asl a ; A => ((inversed bits 0-3 of !ram_19bf) + 1) * 4 sta !tilemap_dma_transfer_sizes_2 sta !tilemap_dma_transfer_sizes_2+2 lda #$0040 sec sbc !tilemap_dma_transfer_sizes_2 sta !tilemap_dma_transfer_sizes_2+4 sta !tilemap_dma_transfer_sizes_2+6 lda #!tilemap_wram_source_start_2 sta !tilemap_wram_source_addresses_2 clc adc !tilemap_dma_transfer_sizes_2 sta !tilemap_wram_source_addresses_2+4 lda #!tilemap_wram_source_start_2+$80 sta !tilemap_wram_source_addresses_2+2 clc adc !tilemap_dma_transfer_sizes_2+2 sta !tilemap_wram_source_addresses_2+6 jsr CalculateTilemapVramDestination ora #$0800 sta !tilemap_vram_destination_addresses_2 inc sta !tilemap_vram_destination_addresses_2+2 dec and #$4c1e ; TODO: what does this mask do clc sta !tilemap_vram_destination_addresses_2+4 inc sta !tilemap_vram_destination_addresses_2+6 %setAto8bit() rts ; exit routine ; pc should equal $01fc8e pullpc ;-------------------------------------------------------------------- pushpc org $01fc8e ; ROUTINE: ($01fc8e) ; parameters: ; A => ; Y => ; !ram_1924 => ; @var_1a2f => ; !ram_1a34 => ; $7f8000[] => ; $7fcef4[] => ; $7ff274[] => ; returns: ; ram $1a3d[] => 8 bytes ; A => 8bit, XY => 16bit ; TODO: name this routine!!!!!!!!!! Routine01fc8e: sta $1a3a ; @var_1a3a => A ; multiply Y.high * !ram_1924 %setAto16bit() tya ; A => Y %setAto8bit() xba ; A => Y.high sta $4202 ; WRMPYA => A lda !ram_1924 sta $4203 ; WRMPYB => !ram_1924 xba ; A => Y.low %setAto16bit() and #$003f ; lower 6 bits clc adc $4216 ; A => A + multiplication result clc adc $1a2f ; A => A + @var_1a2f tax ; X => A lda #$0000 %setAto8bit() lda $7f8000,x ; A => $7f8000[X] eor $1a3a ; A => A xor @var_1a3a bpl .Skip lda #$80 ; if result < 0, use $80 .Skip %setAto16bit() and #$007f ; lower 7 bits tay ; Y => A asl a asl a ; A => A * 4 tax ; X => A lda $7fcef4,x sta $1a35 ; @var_1a35 => $7fcef4[x] lda $7fcef6,x sta $1a37 ; @var_1a35[2] => $7fcef4[x+2] %setAto8bit() tyx ; X => Y lda $7fd0f4,x sta $1a39 ; @var_1a39 => $7fcef4[x] sta $1a3c ; @var_1a3c => $7fcef4[x] bpl .Skip2 and #$70 ; bits 4-6 lsr a lsr a ; A => A / 4 sta $1a3b ; @var_1a3b => A .Skip2 %setXYto8bit() ldx #$00 ; loop offset txy ; loop counter .Loop { lda $1a35,y sta $1a3d,x ; @var_1a35[Y] phx ; save X tax ; X => @var_1a35[Y] ; move bit 1 to bit 6 and clear other bits TODO: WRONG lsr $1a3c ; A => A / 2 ror a ror a ; rotate right 2 and #$40 ; bit 6 xba ; save for later lda $1a39 ; load @var_1a39 bmi .Skip3 ; skip if negative lda $7ff274,x asl a asl a sta $1a3b ; @var_1a3b => $7ff274[X] * 4 .Skip3 xba ; swap in saved byte plx ; restore X ora !ram_1a34 ; OR in !ram_1a34 ora $1a3b ; OR in @var_1a3b sta $1a3e,x ; @var_1a3d[][X+1] => A inx inx ; loop offset += 2 iny ; increment loop cpy #$04 ; loop until counter = $4 bne .Loop } %setXYto16bit() rts ; exit routine ; pc should equal $01fd24 pullpc ;-------------------------------------------------------------------- pushpc org $01fd24 ; ROUTINE: Calculate tilemap vram destination address ($01fd24) ; A => !ram_19bf * $40 + ($4000 or $4400 based on bit 4 of !ram_19bd) ; parameters: ; !ram_19bf => this * $40 is the base address ; !ram_19bd => bit 4 determines which offset to use ; returns: ; A => vram destination address CalculateTilemapVramDestination: %setAto8bit() ldx #$0000 ; X => $00 lda !ram_19bf sta $4202 ; WRMPYA => !ram_19bf lda #$40 sta $4203 ; WRMPYB => $40 lda !ram_19bd ; A => !ram_19bd bit #$10 beq .Skip ; if bit 4 = 0, then don't add 2 inx inx ; X += 2 .Skip asl a ; A => A * 2 %setAto16bit() and #$001e ; bits 1-4 clc adc.w DataCalculateTilemapVramDestination_Offset,x ; A += $fd4c[X], $fd4c is directly after this routine TODO: make sure label results in correct instructions clc adc $4216 ; A += !ram_19bf * $40 rts ; exit routine ; pc should equal $01fd4c pullpc;-------------------------------------------------------------------- pushpc org pctosnes($00fd4c) ; DATA: word is offset used above ($01fd4c) ; bit 4 of !ram_19bd determines which offset to use DataCalculateTilemapVramDestination_Offset: db $00,$40,$00,$44 ; pc should equal $01fd50 pullpc ;-------------------------------------------------------------------- pushpc org $01fd50 ; ROUTINE: ($01fd50) ; Y.high => (Y.high < 0) ? (Y.high + @var_1925) : (Y.high - @var_1925) ; Y.low => (Y.low < 0) ? (Y.low + !ram_1924) : (Y.low - !ram_1924) ; parameters: ; Y => ; !ram_1924 => ; @var_1925 => ; returns: ; Y => ; TODO: Name this routine!!!!!!!!! Routine01fd50: %setAto16bit() tya ; A => Y %setAto8bit() .SetHigh xba ; get Y.high bpl .PositiveHigh .NegativeHigh clc adc !ram_1925 ; A => A + !ram_1925 bra .SetLow .PositiveHigh cmp !ram_1925 bcc .SetLow sec sbc !ram_1925 ; A => A - !ram_1925 .SetLow xba ; get Y.low bpl .PositiveLow .NegativeLow clc adc !ram_1924 ; A => A + !ram_1924 bra .End .PositiveLow cmp !ram_1924 bcc .End sec sbc !ram_1924 ; A => A - !ram_1924 .End tay ; Y => A rts ; exit routine ; pc should equal $01fd7b pullpc ;-------------------------------------------------------------------- pushpc org $01fd7b ; ROUTINE: Copy tile data to WRAM ($01fd7b) ; Copies two sets of tiles into WRAM ; 1. destination => $7f:d274-‭$7f:f273‬ in $400 byte chunks ; when @var_control is negative, the chunk is all $00 ; else, copy tiles from source address offset => $05:8c80 + ($0300 * @var_control) ; 2. destination => $7f:f274-$7f:f373 in $20 byte chunks ; source address offset => $05:f280 + (@var_control * $10) ; bottom 3 bits of each source nibble (low then high) becomes output byte ; so $42 => $02 $04 ; and $CA => $02 $04 ; TODO: are these tiles? ; (for certain maps, like first map "Level Forest") TODO: what all calls this? ; parameters: ; ram $191a-1921 => values for @var_control ; A is 8bit ; TODO: better label? CopyTileDataToWRAM: phb ; save program bank to stack %setDatabankA(05) ; setup destination address (WRAM) ldx #$d274 stx $2181 ; set destination offset to $d274 lda #$7f sta $2183 ; set destination bank to $7f ; copy $8 blocks of $400 bytes: either copy $20 tiles or clear bytes ldx #$0000 ; loop counter .Loop { lda $191a,x ; variable: @var_control, get value from $191a+x (lowram) TODO: trace this ram value bpl .CopyTiles ; if positive => copy tiles, else => clear $400 bytes ; clear $400 bytes of wram ldy #$0020 ; loop counter .LoopA jsr Clear32bytesOfWRAM dey ; decrement counter bne .LoopA } bra .LoopEnd .CopyTiles ; determine source address offset xba ; save @var_control stz $211b lda #$03 sta $211b ; set [M7A] = $0300 xba ; swap @var_control back in sta $211c ; set [M7B] = @var_control %setAto16bit() lda #$8c80 ; source address base (label DataTiles) clc adc $2134 ; source address offset => $8c80 + ($0300 * @var_control) tay ; set source address offset %setAto8bit() ; copy $20 tiles to WRAM phx ; save loop counter ldx #$0020 ; loop counter .LoopB jsr CopyOneTileToWRAM dex ; decrement counter bne .LoopB } plx ; restore loop counter .LoopEnd inx ; increment counter cpx #$0008 ; loop until counter = $8 bne .Loop } %setDatabankA(05) ldx #$f274 stx $2181 ; set destination offset to $f274 ; write $8 * $20 = $100 bytes ldx #$0000 ; loop counter .LoopC { lda $191a,x ; variable: @var_control, get value from $191a+x (lowram) TODO: trace this ram value phx ; save loop counter ; determine source address offset sta $211b stz $211b ; set [M7A] = $00(@var_control) lda #$10 sta $211c ; set [M7B] = $10 ldy $2134 ; source address offset => @var_control * $10 ; read $10 bytes, write $20 bytes ; split upper and lower nibbles into individual bytes ldx #$0010 ; loop counter .LoopD { ; write lower nibble lda $f280,y and #$07 ; bits 0-2 sta $2180 ; write upper nibble lda $f280,y and #$70 ; bits 4-6 lsr a lsr a ; shift right lsr a ; so upper nibble lsr a ; becomes lower nibble sta $2180 iny ; increment source address offset dex ; decrement counter bne .LoopD } plx ; restore loop counter inx ; increment counter cpx #$0008 ; loop until counter = $8 bne .LoopC } plb ; restore program bank rts ; exit routine ; pc should equal $01fe0b pullpc;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $01ffc1 ; ROUTINE: ($01ffc1) ; ; parameters: ; @var_0e89 ; @var_0e8a ; A => 8bit, XY => 16bit ; TODO: Name this routine!!!!!!!!! Routine01ffc1: ; lda $0e89 ; load @var_0e89 sec sbc #$08 sta $192d ; @var_192d => @var_0e89 - $8 ; lda $0e8a ; load @var_0e8a sec sbc #$06 sta $192e ; @var_192e => @var_0e8a - $6 ; ldx #$000f stx !ram_19bf ; !ram_19bf => $000f ldx #$0000 ; loop counter stx !ram_19bd ; clear !ram_19bd .Loop { phx ; save counter 01ffe0 jsr $f977 jsr CopyTilemapFromWRAMToVRAM inc $192e ; increment @var_192e plx ; restore counter stx !ram_19bf ; !ram_19bf => counter inx ; increment counter cpx #$000d ; loop until counter = $d bne .Loop } ldx #$0000 stx !ram_19bf ; clear !ram_19bf rts ; exit routine ; pc should equal $01fffa pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- ; BANK $02 ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $02e34e ; ROUTINE: Write32ZerosToWram ($02e34e) ; $2181-$2183 should be set to wram destination address Write32ZerosToWram: php ; save processor status %setAto8bit() !counter = 0 while !counter < $20 stz $80 !counter #= !counter+1 endif plp ; restore processor status rts ; exit routine ; pc should equal $02e393 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- ; BANK $07 ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $07af3b ; pctosnes($03af3b) ; DATA: ($07af3b) ; table of 16bit offset pointers into $07b013[] ; TODO: what is this? ; TODO: does it actually consist of all $200 bytes? ; TODO: another table starts at $07b013, so cut off data there? Data07af3b: db $00,$00,$00,$00,$09,$00,$09,$00,$09,$00,$09,$00,$12,$00,$68,$00 db $0B,$01,$29,$01,$7F,$01,$C7,$01,$D7,$01,$34,$02,$B4,$02,$3B,$03 db $83,$03,$B6,$03,$0C,$04,$2A,$04,$AA,$04,$4D,$05,$D4,$05,$46,$06 db $5D,$06,$90,$06,$CA,$06,$EF,$06,$37,$07,$D3,$07,$61,$08,$B7,$08 db $1B,$09,$47,$09,$C7,$09,$63,$0A,$06,$0B,$A9,$0B,$4C,$0C,$E1,$0C db $3E,$0D,$3E,$0D,$63,$0D,$A4,$0D,$BB,$0D,$E7,$0D,$05,$0E,$38,$0E db $79,$0E,$9E,$0E,$25,$0F,$BA,$0F,$5D,$10,$AC,$10,$D1,$10,$4A,$11 db $CA,$11,$12,$12,$A7,$12,$4A,$13,$D8,$13,$6D,$14,$02,$15,$97,$15 db $D8,$15,$43,$16,$5A,$16,$86,$16,$29,$17,$CC,$17,$6F,$18,$B0,$18 db $53,$19,$BE,$19,$61,$1A,$B0,$1A,$1B,$1B,$2B,$1B,$49,$1B,$59,$1B db $FC,$1B,$9F,$1C,$42,$1D,$C9,$1D,$5E,$1E,$F3,$1E,$96,$1F,$32,$20 db $C7,$20,$5C,$21,$FF,$21,$1D,$22,$3B,$22,$59,$22,$77,$22,$95,$22 db $B3,$22,$D8,$22,$82,$23,$1E,$24,$C1,$24,$25,$25,$2E,$25,$C3,$25 db $51,$26,$ED,$26,$F6,$26,$84,$27 ; pc should equal $07b013 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $07f7c3 ; pctosnes($03f7c3) ; DATA: ($07f7c3) Data07f7c3: db $35,$7E,$0E,$23,$08,$1F,$16,$1F,$22,$19,$29,$13,$2E,$15,$37,$0F db $33,$0D,$2D,$09,$24,$10,$1F,$10,$1A,$17,$1A,$13,$1A,$0E,$0F,$0C db $09,$0C,$10,$08,$1F,$0A,$2E,$29,$33,$28,$19,$2A,$0E,$28,$12,$26 db $0E,$1E,$0E,$1A,$1C,$21,$1F,$1D,$24,$13,$30,$11,$37,$0B,$28,$18 db $2D,$0E,$2D,$06,$34,$18,$1F,$15,$1F,$1B,$1C,$1B,$15,$0C,$09,$08 db $0F,$10,$18,$08,$19,$05,$1D,$1E,$1F,$1F,$26,$1F,$28,$27,$28,$29 db $35,$23,$3B,$28,$3C,$24,$35,$1E,$31,$1E,$1C,$27,$21,$2A,$31,$1C db $1C,$28,$2A,$25 ; pc should equal $07f837 ; end of bank, fill padbyte $ff pad $07ffff ; TODO: did last byte fill? ;pad $088000 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- ; BANK $0b ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $0b8149 ; ROUTINE: ($0b8149) ; ; A is 8bit, XY is 16bit ; TODO: rename!!!!!!!! Routine0b8149: ; setup variables stz $19f6 ; @var_19f6 => $00 lda #$80 sta !ram_19a5 ; @var_19a5 => $80 lda #$01 sta $1a45 ; @var_1a45 => $01 ldx $19f1 ; load @var_19f1 stx $0e89 ; @var_0e89 => @var_19f1 lda $19f0 ; load @var_19f0 sta $0e91 ; @var_0e91 => @var_19f0 bne .IsZero ; if @var_19f0 is $0000 lda #$f2 jsl TRBWithBitMaskTo0ea8 ; set @var_0ec6 => stz $1a5b ; @var_1a5b => $00 lda $0e88 ; load @var_0e88 %setAto16bit() and #$00ff ; ignore upper byte asl a tax lda Data07f7c3,x sta $0e89 ; @var_0e89 => %setAto8bit() lda #$f3 jsl ANDBitMaskAnd0ea8ToA bne .IsZero lda #$02 sta $0e8b ; @var_0e89 => $02 ; clear $0ec8-$0ee7 and $0f28-$0f47 ldx #$0000 lda #$20 ; loop counter .Loop { stz $0ec8,x ; @var_0ec8[x] => $00 stz $0f28,x ; @var_0f28[x] => $00 inx ; increment destination offset dec ; decrement counter bne .Loop } ; clear $0ee8-$0f17 lda #$30 ; loop counter .LoopB { stz $0ec8,x ; @var_0ec8[x] => $00 inx ; increment destination offset dec ; decrement counter bne .LoopB } .IsZero ; lda $0e91 ; load @var_0e91 %setAto16bit() and #$00ff ; ignore upper byte asl a tax ; source offset => @var_0e91 * 2 lda Data07af3b,x tax ; source offset => Data07af3b[@var_0e91 * 2] %setAto8bit() stx $19b5 ; @var_19b5 => source offset ; ldy #$0000 ; loop counter .LoopC { lda Data07b013,x ; sta $1910,y ; @var_1910[y] => Data07b013[x] inx ; increment source offset iny ; increment counter cpy #$0007 ; loop until counter = $7 bne .LoopC } ; determine source address offset ; @var_1911 is source address index lda #$0a sta $211b stz $211b ; set [M7A] => $000a lda $1911 sta $211c ; set [M7B] => @var_1911 ldx $2134 stx $19b7 ; source address offset => @var_1911 * $0a ; copy $a bytes into @var_1918[] ldy #$0000 ; loop counter .LoopD { lda.l DataTilesets,x sta $1918,y ; @var_1918[y] => DataTilesets[x] inx ; increment source offset iny ; increment counter cpy #$000a ; loop until counter = $a bne .LoopD } ldx #$ffff ; default @var_19b9 value is $FFFF lda $1912 cmp #$ff beq .Skip ; skip ahead if @var_1912 is $FF %setAto16bit() and #$00ff ; ignore upper byte asl a ; A => A * 2 tax ; source address offset => @var_1912 * 2 lda.l Data0b8892,x tax %setAto8bit() .Skip stx $19b9 ; @var_19b9 => X lda $1916 ; load @var_1916 and #$e0 ; bits 5-7 lsr a lsr a ; A => A / 8 lsr a sta $1a55 ; @var_1a55 => A lda $1915 ; load @var_1915 and #$e0 ; bits 5-7 ora $1a55 ; combine with other 3 bits lsr a lsr a ; A => A / 4 sta $1a55 ; @var_1a55 => byte made of: two 0 bits, top three bits of @var_1915, top three bits of @var_1916 rtl ; exit routine ; pc should equal $0b8223 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $0b8892 ; pctosnes($058892) ; DATA: ($0b8892) Data0b8892: ; TODO: get the data ; pc should equal $ pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $0b8cd9 ; pctosnes($058CD9) ; DATA: ($0b8cd9) ; accessed in $a byte chunks ; bytes $00-$01 are ??? TODO: what are these ; bytes $2-$9 of each are indexes into tile graphics data (label = DataTiles) ; values $00-$21 are indexes, $FF means clear section ; ends up in $1918-$1921 DataTilesets: db $B0,$16,$1E,$1F,$20,$21,$FF,$FF,$FF,$FF db $B0,$17,$1E,$1F,$20,$21,$FF,$FF,$FF,$FF db $52,$11,$00,$01,$02,$03,$04,$05,$06,$07 db $73,$01,$00,$01,$02,$03,$04,$05,$06,$07 db $94,$04,$08,$09,$0A,$0B,$0C,$05,$06,$07 db $52,$03,$00,$01,$02,$03,$04,$05,$06,$07 db $75,$19,$08,$09,$0A,$0B,$0C,$1C,$15,$07 db $F1,$11,$00,$01,$02,$09,$06,$07,$11,$13 db $F6,$0A,$18,$1B,$1C,$1D,$04,$07,$FF,$FF db $FD,$0B,$08,$09,$0A,$03,$04,$18,$12,$13 db $BE,$07,$08,$09,$0A,$0B,$0C,$0D,$04,$1D db $6E,$07,$08,$09,$0A,$0B,$0C,$0D,$04,$1D db $74,$07,$08,$09,$0A,$0B,$0C,$0D,$15,$07 db $F9,$09,$1A,$1B,$0A,$10,$0C,$FF,$FF,$FF db $F9,$09,$1A,$1B,$0A,$10,$0C,$FF,$FF,$FF db $51,$0E,$00,$01,$02,$09,$06,$07,$11,$13 db $FE,$07,$08,$09,$0A,$0B,$0C,$0D,$15,$07 db $DF,$08,$18,$19,$1A,$11,$04,$FF,$FF,$07 db $FF,$08,$18,$19,$1A,$11,$04,$FF,$FF,$07 db $F5,$06,$16,$17,$18,$01,$07,$FF,$FF,$FF db $F6,$0A,$18,$1B,$1C,$1D,$04,$07,$FF,$FF db $B6,$0A,$18,$1B,$1C,$1D,$04,$07,$FF,$FF db $7D,$0B,$08,$09,$0A,$03,$04,$18,$12,$13 db $F7,$0C,$18,$1D,$02,$03,$04,$12,$13,$07 db $77,$0C,$18,$1D,$02,$03,$04,$12,$13,$07 db $F8,$0D,$04,$06,$14,$15,$11,$18,$1D,$07 db $F8,$0D,$04,$06,$14,$15,$11,$18,$1D,$07 db $FB,$14,$13,$01,$02,$03,$04,$06,$18,$09 db $51,$0E,$00,$01,$02,$09,$06,$07,$11,$13 db $5A,$0F,$00,$01,$02,$18,$04,$13,$06,$07 db $FC,$05,$0E,$0F,$10,$11,$15,$05,$FF,$FF db $FB,$12,$13,$01,$02,$03,$04,$06,$18,$11 db $EC,$05,$0E,$0F,$10,$11,$15,$05,$FF,$FF db $F7,$13,$16,$18,$02,$03,$04,$FF,$13,$07 db $F8,$0D,$04,$06,$14,$15,$11,$18,$1D,$07 db $A6,$0A,$18,$1B,$1C,$1D,$04,$07,$FF,$FF db $A7,$0C,$18,$1D,$02,$03,$04,$12,$13,$07 db $A8,$0D,$04,$06,$14,$15,$11,$18,$1D,$07 db $58,$10,$04,$06,$14,$15,$11,$18,$1D,$07 db $5D,$10,$0D,$06,$14,$15,$1B,$18,$1D,$07 db $54,$04,$08,$09,$0A,$0B,$0C,$05,$06,$07 db $5D,$10,$0D,$06,$14,$15,$1B,$18,$1D,$07 db $5E,$07,$08,$09,$0A,$0B,$0C,$0D,$04,$1D db $51,$0E,$00,$01,$02,$09,$06,$07,$11,$13 ; pc should equal $0b8e91 pullpc ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- ; BANK $0c ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- pushpc org $0c8948 ; ROUTINE: Clear OAM ($0c8948) ; fills all $220 bytes of OAM from $000c00+ on DMA channel 5 ; sets data bank to $0c ; A becomes 8bit ; known uses: ; fill OAM with $55 - moves all sprites small and to the left of the screen (can't see any sprites) ; XY => 16bit ClearOAM: %setAto8bit() ldx #$0000 stx $2102 ; destination => $0000 ldx #$0400 ; dma control => $00, auto increment, write same address twice stx $4350 ; destination => $04, OAM data register [OAMDATA] ldx #$0c00 stx $4352 ; source offset => $0c00 lda #$00 sta $4354 ; source bank => $00 ldx #$0220 stx $4355 ; dma transfer size => $220 (all of OAM will be written) lda #$20 sta $420b ; start DMA transfer on channel 5 phk plb ; databank => program bank, $0c rts ; exit routine ; pc should equal $0c896f pullpc ;--------------------------------------------------------------------
Transynther/x86/_processed/US/_zr_/i3-7100_9_0x84_notsx.log_21829_550.asm
ljhsiun2/medusa
9
82332
<reponame>ljhsiun2/medusa<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %rax push %rbx lea addresses_WT_ht+0xefc5, %r12 nop nop nop nop add %rbx, %rbx mov $0x6162636465666768, %rax movq %rax, (%r12) nop sub $34116, %rbx lea addresses_WT_ht+0x14429, %r14 nop nop nop nop xor %r12, %r12 movb $0x61, (%r14) nop nop nop nop nop sub %r13, %r13 pop %rbx pop %rax pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %r9 push %rbx push %rcx push %rdi push %rdx // Store lea addresses_UC+0x86a9, %rdx clflush (%rdx) nop nop nop nop dec %r15 movw $0x5152, (%rdx) add %r9, %r9 // Store mov $0xc29, %rdi nop sub %rbx, %rbx movw $0x5152, (%rdi) nop sub $8305, %rcx // Faulty Load lea addresses_US+0x5529, %rdi clflush (%rdi) nop inc %r9 mov (%rdi), %edx lea oracles, %r15 and $0xff, %rdx shlq $12, %rdx mov (%r15,%rdx,1), %rdx pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_US', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 7, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_P', 'same': False, 'size': 2, 'congruent': 8, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_US', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
programs/oeis/130/A130234.asm
karttu/loda
0
178855
; A130234: Minimal index k of a Fibonacci number such that Fib(k)>=n (the 'upper' Fibonacci Inverse). ; 0,1,3,4,5,5,6,6,6,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11 mov $2,$0 mov $0,8 pow $2,8 lpb $2,1 div $2,$0 add $0,4 trn $2,1 lpe add $0,1 mov $1,$0 sub $1,9 div $1,4
src/test/ref/examples/c64/crunching/test-byteboozer.asm
jbrandwood/kickc
2
86006
// Example showing how to crunch and decrunch part of a file using the KickAss Cruncher Plugins // ByteBoozer example // https://github.com/p-a/kickass-cruncher-plugins // Commodore 64 PRG executable file - with the cruncher plugin enabled .plugin "se.triad.kickass.CruncherPlugins" .file [name="test-byteboozer.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) /// The offset of the sprite pointers from the screen start address .const OFFSET_SPRITE_PTRS = $3f8 .const GREEN = 5 .const OFFSET_STRUCT_MOS6569_VICII_SPRITES_ENABLE = $15 /// Sprite X position register for sprite #0 .label SPRITES_XPOS = $d000 /// Sprite Y position register for sprite #0 .label SPRITES_YPOS = $d001 /// Sprite colors register for sprite #0 .label SPRITES_COLOR = $d027 /// The VIC-II MOS 6567/6569 .label VICII = $d000 /// Default address of screen character matrix .label DEFAULT_SCREEN = $400 // Address to decrunch the sprite to .label SPRITE = $2000 // The sprite pointers .label SPRITES_PTR = DEFAULT_SCREEN+OFFSET_SPRITE_PTRS .segment Code main: { .const toSpritePtr1_return = SPRITE/$40 // byteboozer_decrunch(CRUNCHED_SPRITE) lda #<CRUNCHED_SPRITE sta.z byteboozer_decrunch.crunched lda #>CRUNCHED_SPRITE sta.z byteboozer_decrunch.crunched+1 // Decrunch sprite file into memory jsr byteboozer_decrunch // VICII->SPRITES_ENABLE = %00000001 // Show the loaded sprite on screen lda #1 sta VICII+OFFSET_STRUCT_MOS6569_VICII_SPRITES_ENABLE // SPRITES_PTR[0] = toSpritePtr(SPRITE) lda #toSpritePtr1_return sta SPRITES_PTR // SPRITES_COLOR[0] = GREEN lda #GREEN sta SPRITES_COLOR // SPRITES_XPOS[0] = 0x15 lda #$15 sta SPRITES_XPOS // SPRITES_YPOS[0] = 0x33 lda #$33 sta SPRITES_YPOS // } rts } // Decrunch crunched data using ByteBoozer // - crunched: Pointer to the start of the crunched data // void byteboozer_decrunch(__zp(2) char * volatile crunched) byteboozer_decrunch: { .label crunched = 2 // asm ldy crunched ldx crunched+1 jsr b2.Decrunch // } rts } .segment Data // The byteboozer decruncher BYTEBOOZER: .const B2_ZP_BASE = $fc #import "byteboozer_decrunch.asm" // Array with crunched data created using inline kickasm CRUNCHED_SPRITE: .modify B2() { .pc = SPRITE .var pic = LoadPicture("sprite.png", List().add($000000, $ffffff)) .for (var y=0; y<21; y++) .for (var x=0;x<3; x++) .byte pic.getSinglecolorByte(x,y) }
gcc-gcc-7_3_0-release/gcc/ada/g-moreex.adb
best08618/asylo
7
18726
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . M O S T _ R E C E N T _ E X C E P T I O N -- -- -- -- B o d y -- -- -- -- Copyright (C) 2000-2010, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Exceptions.Is_Null_Occurrence; with System.Soft_Links; package body GNAT.Most_Recent_Exception is ---------------- -- Occurrence -- ---------------- function Occurrence return Ada.Exceptions.Exception_Occurrence is EOA : constant Ada.Exceptions.Exception_Occurrence_Access := GNAT.Most_Recent_Exception.Occurrence_Access; use type Ada.Exceptions.Exception_Occurrence_Access; begin return Result : Ada.Exceptions.Exception_Occurrence do if EOA = null then Ada.Exceptions.Save_Occurrence (Target => Result, Source => Ada.Exceptions.Null_Occurrence); else Ada.Exceptions.Save_Occurrence (Target => Result, Source => EOA.all); end if; end return; end Occurrence; ----------------------- -- Occurrence_Access -- ----------------------- function Occurrence_Access return Ada.Exceptions.Exception_Occurrence_Access is use Ada.Exceptions; EOA : constant Exception_Occurrence_Access := System.Soft_Links.Get_Current_Excep.all; begin if EOA = null then return null; elsif Is_Null_Occurrence (EOA.all) then return null; else return EOA; end if; end Occurrence_Access; end GNAT.Most_Recent_Exception;
llvm-gcc-4.2-2.9/gcc/ada/s-intman-vms.ads
vidkidz/crossbridge
1
5985
<gh_stars>1-10 ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . I N T E R R U P T _ M A N A G E M E N T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1991-2005 Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the Alpha/VMS version of this package -- This package encapsulates and centralizes information about all uses of -- interrupts (or signals), including the target-dependent mapping of -- interrupts (or signals) to exceptions. -- PLEASE DO NOT add any with-clauses to this package -- PLEASE DO NOT put any subprogram declarations with arguments of type -- Interrupt_ID into the visible part of this package. -- The type Interrupt_ID is used to derive the type in Ada.Interrupts, and -- adding more operations to that type would be illegal according to the Ada -- Reference Manual. (This is the reason why the signals sets below are -- implemented as visible arrays rather than functions.) with System.OS_Interface; -- used for Signal -- sigset_t package System.Interrupt_Management is pragma Preelaborate; type Interrupt_Mask is limited private; type Interrupt_ID is new System.OS_Interface.Signal; type Interrupt_Set is array (Interrupt_ID) of Boolean; -- The following objects serve as constants, but are initialized in the -- body to aid portability. This permits us to use more portable names for -- interrupts, where distinct names may map to the same interrupt ID -- value. For example, suppose SIGRARE is a signal that is not defined on -- all systems, but is always reserved when it is defined. If we have the -- convention that ID zero is not used for any "real" signals, and SIGRARE -- = 0 when SIGRARE is not one of the locally supported signals, we can -- write -- Reserved (SIGRARE) := true; -- Then the initialization code will be portable Abort_Task_Interrupt : Interrupt_ID; -- The interrupt that is used to implement task abort, if an interrupt is -- used for that purpose. This is one of the reserved interrupts. Keep_Unmasked : Interrupt_Set := (others => False); -- Keep_Unmasked (I) is true iff the interrupt I is one that must be kept -- unmasked at all times, except (perhaps) for short critical sections. -- This includes interrupts that are mapped to exceptions (see -- System.Interrupt_Exceptions.Is_Exception), but may also include -- interrupts (e.g. timer) that need to be kept unmasked for other -- reasons. Where interrupts are implemented as OS signals, and signal -- masking is per-task, the interrupt should be unmasked in ALL TASKS. Reserve : Interrupt_Set := (others => False); -- Reserve (I) is true iff the interrupt I is one that cannot be permitted -- to be attached to a user handler. The possible reasons are many. For -- example it may be mapped to an exception used to implement task abort. Keep_Masked : Interrupt_Set := (others => False); -- Keep_Masked (I) is true iff the interrupt I must always be masked. -- Where interrupts are implemented as OS signals, and signal masking is -- per-task, the interrupt should be masked in ALL TASKS. There might not -- be any interrupts in this class, depending on the environment. For -- example, if interrupts are OS signals and signal masking is per-task, -- use of the sigwait operation requires the signal be masked in all tasks. procedure Initialize; -- Initialize the various variables defined in this package. -- This procedure must be called before accessing any object from this -- package and can be called multiple times. private use type System.OS_Interface.unsigned_long; type Interrupt_Mask is new System.OS_Interface.sigset_t; -- Interrupts on VMS are implemented with a mailbox. A QIO read is -- registered on the Rcv channel and the interrupt occurs by registering -- a QIO write on the Snd channel. The maximum number of pending -- interrupts is arbitrarily set at 1000. One nice feature of using -- a mailbox is that it is trivially extendable to cross process -- interrupts. Rcv_Interrupt_Chan : System.OS_Interface.unsigned_short := 0; Snd_Interrupt_Chan : System.OS_Interface.unsigned_short := 0; Interrupt_Mailbox : Interrupt_ID := 0; Interrupt_Bufquo : System.OS_Interface.unsigned_long := 1000 * (Interrupt_ID'Size / 8); end System.Interrupt_Management;
src/_test/harness/apsepp_test.adb
thierr26/ada-apsepp
0
6251
<filename>src/_test/harness/apsepp_test.adb<gh_stars>0 -- Copyright (C) 2019 <NAME> <<EMAIL>> -- MIT license. Please refer to the LICENSE file. -- with GNAT.Exception_Traces; -- For debugging. with Apsepp_Test_Harness; procedure Apsepp_Test is -- use GNAT.Exception_Traces; -- For debugging. begin -- Trace_On (Every_Raise); -- For debugging. Apsepp_Test_Harness.Apsepp_Test_Procedure; -- Trace_Off; -- For debugging. end Apsepp_Test;
notes/FOT/GroupTheory/NoPatternMatchingOnRefl.agda
asr/fotc
11
10992
<reponame>asr/fotc<gh_stars>10-100 ------------------------------------------------------------------------------ -- Proving properties without using pattern matching on refl ------------------------------------------------------------------------------ {-# OPTIONS --no-pattern-matching #-} {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} module FOT.GroupTheory.NoPatternMatchingOnRefl where open import GroupTheory.Base ------------------------------------------------------------------------------ -- From GroupTheory.PropertiesI -- Congruence properties -- The propositional equality is compatible with the binary operation. ·-leftCong : ∀ {a b c} → a ≡ b → a · c ≡ b · c ·-leftCong {a} {c = c} h = subst (λ t → a · c ≡ t · c) h refl ·-rightCong : ∀ {a b c} → b ≡ c → a · b ≡ a · c ·-rightCong {a} {b} h = subst (λ t → a · b ≡ a · t) h refl -- The propositional equality is compatible with the inverse function. ⁻¹-cong : ∀ {a b} → a ≡ b → a ⁻¹ ≡ b ⁻¹ ⁻¹-cong {a} h = subst (λ t → a ⁻¹ ≡ t ⁻¹) h refl
gcc-gcc-7_3_0-release/gcc/ada/s-stchop-vxworks.adb
best08618/asylo
7
11800
<gh_stars>1-10 ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . S T A C K _ C H E C K I N G . O P E R A T I O N S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1999-2015, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 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/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the verson for VxWorks 5, VxWorks 6 Cert and VxWorks MILS -- This file should be kept synchronized with the general implementation -- provided by s-stchop.adb. pragma Restrictions (No_Elaboration_Code); -- We want to guarantee the absence of elaboration code because the -- binder does not handle references to this package. with System.Storage_Elements; use System.Storage_Elements; with System.Parameters; use System.Parameters; with Interfaces.C; package body System.Stack_Checking.Operations is -- In order to have stack checking working appropriately on VxWorks we need -- to extract the stack size information from the VxWorks kernel itself. -- For VxWorks 5 & 6 the library for showing task-related information -- needs to be linked into the VxWorks system, when using stack checking. -- The taskShow library can be linked into the VxWorks system by either: -- * defining INCLUDE_SHOW_ROUTINES in config.h when using -- configuration header files, or -- * selecting INCLUDE_TASK_SHOW when using the Tornado project -- facility. -- VxWorks MILS includes the necessary routine in taskLib, so nothing -- special needs to be done there. Stack_Limit : Address; pragma Import (C, Stack_Limit, "__gnat_stack_limit"); -- Stack_Limit contains the limit of the stack. This variable is later made -- a task variable (by calling taskVarAdd) and then correctly set to the -- stack limit of the task. Before being so initialized its value must be -- valid so that any subprogram with stack checking enabled will run. We -- use extreme values according to the direction of the stack. type Set_Stack_Limit_Proc_Acc is access procedure; pragma Convention (C, Set_Stack_Limit_Proc_Acc); Set_Stack_Limit_Hook : Set_Stack_Limit_Proc_Acc; pragma Import (C, Set_Stack_Limit_Hook, "__gnat_set_stack_limit_hook"); -- Procedure to be called when a task is created to set stack -- limit. procedure Set_Stack_Limit_For_Current_Task; pragma Convention (C, Set_Stack_Limit_For_Current_Task); -- Register Initial_SP as the initial stack pointer value for the current -- task when it starts and Size as the associated stack area size. This -- should be called once, after the soft-links have been initialized? ----------------------------- -- Initialize_Stack_Limit -- ----------------------------- procedure Initialize_Stack_Limit is begin Set_Stack_Limit_For_Current_Task; -- Will be called by every created task Set_Stack_Limit_Hook := Set_Stack_Limit_For_Current_Task'Access; end Initialize_Stack_Limit; -------------------------------------- -- Set_Stack_Limit_For_Current_Task -- -------------------------------------- procedure Set_Stack_Limit_For_Current_Task is use Interfaces.C; type OS_Stack_Info is record Size : Interfaces.C.int; Base : System.Address; Limit : System.Address; end record; pragma Convention (C, OS_Stack_Info); -- Type representing the information that we want to extract from the -- underlying kernel. procedure Get_Stack_Info (Stack : not null access OS_Stack_Info); pragma Import (C, Get_Stack_Info, "__gnat_get_stack_info"); -- Procedure that fills the stack information associated to the -- currently executing task. Stack_Info : aliased OS_Stack_Info; Limit : System.Address; begin -- Get stack bounds from VxWorks Get_Stack_Info (Stack_Info'Access); if Stack_Grows_Down then Limit := Stack_Info.Base - Storage_Offset (Stack_Info.Size) + Storage_Offset'(12_000); else Limit := Stack_Info.Base + Storage_Offset (Stack_Info.Size) - Storage_Offset'(12_000); end if; Stack_Limit := Limit; end Set_Stack_Limit_For_Current_Task; end System.Stack_Checking.Operations;
source/asis/asis-gela-instances-utils.adb
faelys/gela-asis
4
23315
<gh_stars>1-10 ------------------------------------------------------------------------------ -- G E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $: with Asis.Elements; with Asis.Expressions; with Asis.Declarations; with Asis.Gela.Lists; with Asis.Gela.Elements.Decl; with Asis.Gela.Elements.Defs; with Asis.Gela.Elements.Expr; with Asis.Gela.Element_Utils; with Asis.Gela.Elements.Assoc; package body Asis.Gela.Instances.Utils is function New_Direct_Name (Inst : Asis.Declaration; Name : Asis.Defining_Name) return Asis.Expression; function Clone_Procedure (Item : Asis.Element; Parent : Asis.Element) return Asis.Element; function Clone_Function (Item : Asis.Element; Parent : Asis.Element) return Asis.Element; function Clone_Package (Item : Asis.Element; Parent : Asis.Element) return Asis.Element; ----------------------- -- Clone_Declaration -- ----------------------- function Clone_Declaration (Item : Asis.Element; Parent : Asis.Element) return Asis.Element is use Asis.Elements; begin case Declaration_Kind (Parent) is when A_Package_Instantiation | A_Formal_Package_Declaration | A_Formal_Package_Declaration_With_Box => return Clone_Package (Item, Parent); when A_Procedure_Instantiation => return Clone_Procedure (Item, Parent); when A_Function_Instantiation => return Clone_Function (Item, Parent); when others => raise Internal_Error; end case; end Clone_Declaration; -------------------- -- Clone_Function -- -------------------- function Clone_Function (Item : Asis.Element; Parent : Asis.Element) return Asis.Element is use Asis.Gela.Elements.Decl; Result : Function_Declaration_Ptr := new Function_Declaration_Node; begin Set_Enclosing_Element (Result.all, Parent); Set_Enclosing_Compilation_Unit (Result.all, Enclosing_Compilation_Unit (Parent.all)); Set_Is_Dispatching_Operation (Result.all, Is_Dispatching_Operation (Item.all)); Set_Trait_Kind (Result.all, An_Ordinary_Trait); Set_Instance (Asis.Element (Result), Item); return Asis.Element (Result); end Clone_Function; ------------------- -- Clone_Package -- ------------------- function Clone_Package (Item : Asis.Element; Parent : Asis.Element) return Asis.Element is use Asis.Gela.Elements.Decl; Result : Package_Declaration_Ptr := new Package_Declaration_Node; begin Set_Enclosing_Element (Result.all, Parent); Set_Enclosing_Compilation_Unit (Result.all, Enclosing_Compilation_Unit (Parent.all)); Set_Instance (Asis.Element (Result), Item); return Asis.Element (Result); end Clone_Package; --------------------- -- Clone_Procedure -- --------------------- function Clone_Procedure (Item : Asis.Element; Parent : Asis.Element) return Asis.Element is use Asis.Gela.Elements.Decl; Result : Procedure_Declaration_Ptr := new Procedure_Declaration_Node; begin Set_Enclosing_Element (Result.all, Parent); Set_Enclosing_Compilation_Unit (Result.all, Enclosing_Compilation_Unit (Parent.all)); Set_Is_Dispatching_Operation (Result.all, Is_Dispatching_Operation (Item.all)); Set_Trait_Kind (Result.all, An_Ordinary_Trait); Set_Instance (Asis.Element (Result), Item); return Asis.Element (Result); end Clone_Procedure; --------------------- -- Set_Declaration -- --------------------- procedure Set_Declaration (Result : access Elements.Declaration_Node'Class; Object : in Cloner_Class; Inst : in Asis.Declaration; Name : in Asis.Defining_Name) is use Asis.Elements; use Asis.Gela.Lists; use Asis.Gela.Elements; use Asis.Gela.Elements.Decl; use Primary_Defining_Name_Lists; Name_List : Asis.Element; Formal : Asis.Declaration := Enclosing_Element (Name); Node : Package_Instantiation_Node'Class renames Package_Instantiation_Node'Class (Inst.all); begin Set_Enclosing_Element (Result.all, Inst); Set_Enclosing_Compilation_Unit (Result.all, Enclosing_Compilation_Unit (Inst.all)); Set_Declaration_Origin (Result.all, An_Explicit_Declaration); Name_List := Lists.Primary_Defining_Name_Lists.Deep_Copy ((1 => Name), Object, Asis.Element (Result)); Set_Names (Result.all, Name_List); Set_Instance (Asis.Element (Result), Formal); end Set_Declaration; --------------------- -- New_Direct_Name -- --------------------- type Base_Identifier_Access is access all Asis.Gela.Elements.Expr.Base_Identifier_Node'Class; function New_Direct_Name (Inst : Asis.Declaration; Name : Asis.Defining_Name) return Asis.Expression is use Asis.Elements; use Asis.Declarations; use Asis.Gela.Elements.Expr; Result : Base_Identifier_Access; begin case Defining_Name_Kind (Name) is when A_Defining_Identifier => Result := new Identifier_Node; when A_Defining_Operator_Symbol => Result := new Operator_Symbol_Node; Set_Operator_Kind (Operator_Symbol_Node (Result.all), Operator_Kind (Name)); when others => raise Internal_Error; end case; Set_Name_Image (Result.all, Defining_Name_Image (Name)); Set_Enclosing_Element (Result.all, Asis.Nil_Element); -- Mark the Name -- Set_Enclosing_Element (Result.all, Inst); Set_Start_Position (Result.all, (1, 1)); Set_End_Position (Result.all, Nil_Text_Position); Set_Enclosing_Compilation_Unit (Result.all, Enclosing_Compilation_Unit (Inst.all)); return Asis.Expression (Result); end New_Direct_Name; -------------------------------- -- New_Normalized_Association -- -------------------------------- procedure New_Normalized_Association (Inst : in Asis.Declaration; Name : in Asis.Defining_Name; Actual : in out Asis.Expression; With_Box : in Boolean) is use Asis.Elements; use Asis.Declarations; use Asis.Gela.Elements.Decl; use Asis.Gela.Elements.Assoc; Formal : Asis.Declaration := Enclosing_Element (Name); Result : Generic_Association_Ptr := new Generic_Association_Node; Node : Formal_Package_Declaration_With_Box_Node'Class renames Formal_Package_Declaration_With_Box_Node'Class (Inst.all); begin if Assigned (Actual) then null; elsif With_Box then declare use Asis.Gela.Elements.Expr; Node : constant Box_Expression_Ptr := new Box_Expression_Node; begin Set_Enclosing_Element (Node.all, Asis.Element (Result)); Actual := Asis.Element (Node); end; else case Declaration_Kind (Formal) is when A_Formal_Object_Declaration => Actual := Initialization_Expression (Formal); when A_Formal_Function_Declaration | A_Formal_Procedure_Declaration => case Default_Kind (Formal) is when A_Name_Default => Actual := Formal_Subprogram_Default (Formal); when A_Box_Default => Actual := New_Direct_Name (Inst, Name); when others => null; end case; when others => null; end case; Set_Is_Defaulted_Association (Result.all, True); end if; Set_Is_Normalized (Result.all, True); Set_Enclosing_Element (Result.all, Inst); Set_Enclosing_Compilation_Unit (Result.all, Enclosing_Compilation_Unit (Inst.all)); Set_Formal_Parameter (Result.all, Name); Set_Actual_Parameter (Result.all, Actual); Set_Start_Position (Result.all, (1, 1)); Set_End_Position (Result.all, Nil_Text_Position); Add_To_Normalized_Generic_Actual_Part (Node, Asis.Element (Result)); end New_Normalized_Association; ---------------------------- -- Set_Corresponding_Body -- ---------------------------- procedure Set_Corresponding_Body (Item, Source : Asis.Element) is use Asis.Gela.Elements.Decl; Node : Package_Instantiation_Node'Class renames Package_Instantiation_Node'Class (Source.all); begin Set_Corresponding_Body (Node, Item); end Set_Corresponding_Body; ----------------------------------- -- Set_Corresponding_Declaration -- ----------------------------------- procedure Set_Corresponding_Declaration (Item, Source : Asis.Element) is use Asis.Elements; use Asis.Gela.Elements.Decl; begin if Declaration_Kind (Source) = A_Formal_Package_Declaration_With_Box then declare Node : Formal_Package_Declaration_With_Box_Node renames Formal_Package_Declaration_With_Box_Node (Source.all); begin Set_Corresponding_Declaration (Node, Item); end; else declare Node : Package_Instantiation_Node'Class renames Package_Instantiation_Node'Class (Source.all); begin Set_Corresponding_Declaration (Node, Item); end; end if; end Set_Corresponding_Declaration; ------------------------ -- Set_Generic_Actual -- ------------------------ procedure Set_Generic_Actual (Cloned_Item : Asis.Declaration; Formal_Item : Asis.Declaration; Instance : Asis.Declaration) is use Asis.Elements; use Asis.Gela.Elements.Decl; Formal : Asis.Declaration; Actual : Asis.Expression; List : constant Asis.Element_List := Normalized_Generic_Actual_Part (Instance.all); begin for J in List'Range loop Formal := Enclosing_Element (Expressions.Formal_Parameter (List (J))); if Is_Equal (Formal, Formal_Item) then Actual := Expressions.Actual_Parameter (List (J)); end if; end loop; if Assigned (Actual) then case Declaration_Kind (Cloned_Item) is when A_Formal_Type_Declaration => Set_Generic_Actual (Formal_Type_Declaration_Node (Cloned_Item.all), Actual); when A_Formal_Package_Declaration | A_Formal_Package_Declaration_With_Box => Set_Generic_Actual (Formal_Package_Declaration_With_Box_Node'Class (Cloned_Item.all), Actual); when A_Formal_Procedure_Declaration | A_Formal_Function_Declaration => Set_Generic_Actual (Formal_Procedure_Declaration_Node'Class (Cloned_Item.all), Actual); when A_Formal_Object_Declaration => Set_Generic_Actual (Formal_Object_Declaration_Node (Cloned_Item.all), Actual); when others => null; end case; end if; end Set_Generic_Actual; ------------------------- -- Set_Generic_Element -- ------------------------- procedure Set_Generic_Element (Item, Source : Asis.Element) is use Asis.Gela.Elements.Expr; Node : Base_Identifier_Node'Class renames Base_Identifier_Node'Class (Item.all); begin Set_Corresponding_Generic_Element (Node, Source); Element_Utils.Set_Resolved (Item, (1 => Source)); end Set_Generic_Element; ------------------ -- Set_Instance -- ------------------ procedure Set_Instance (Item, Source : Asis.Element) is use Asis.Gela.Elements; Result : Base_Element_Ptr := Base_Element_Ptr (Item); begin Set_Is_Part_Of_Instance (Result.all, True); Set_Start_Position (Result.all, (1, 1)); Set_End_Position (Result.all, Nil_Text_Position); if Element_Kind (Item.all) = A_Defining_Name then Set_Corresponding_Generic_Element (Defining_Name_Node (Item.all), Source); end if; end Set_Instance; end Asis.Gela.Instances.Utils; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the <NAME>, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
programs/oeis/081/A081215.asm
neoneye/loda
22
20145
; A081215: a(n) = (n^(n+1)+(-1)^n)/(n+1)^2. ; 1,0,1,5,41,434,5713,90075,1657009,34867844,826446281,21794641505,633095889817,20088655029078,691413758034721,25657845139503479,1021273028302258913,43404581642184336392,1961870762757168078553,93974933643864895483389,4755446712018140589569161,253500676417573621795462010,14199269001914612973017444081,833768687493927043038482216915,51215453831050910378844728557201,3284683504808155445040330378966924,219559820418910960330196888200830313 mov $1,$0 add $1,1 pow $0,$1 add $0,1 div $0,$1 div $0,$1
Appl/Art/Decks/GeoDeck/CGADiamond5.asm
steakknife/pcgeos
504
8785
<filename>Appl/Art/Decks/GeoDeck/CGADiamond5.asm CGADiamond5 label byte word C_BLACK Bitmap <67,41,BMC_PACKBITS,BMF_MONO> db 0xf8, 0x00 db 0xf8, 0x00 db 0x08, 0x1f, 0xf0, 0x1c, 0x00, 0x00, 0x07, 0x00, 0x1c, 0x00 db 0x08, 0x18, 0x00, 0x6b, 0x00, 0x00, 0x1a, 0xc0, 0x6b, 0x00 db 0x08, 0x1f, 0xe0, 0xd5, 0x80, 0x00, 0x35, 0x60, 0xd5, 0x80 db 0x08, 0x00, 0x31, 0xaa, 0xc0, 0x00, 0x6a, 0xb0, 0x6b, 0x00 db 0x08, 0x00, 0x30, 0xd5, 0x80, 0x00, 0x35, 0x60, 0x1c, 0x00 db 0x08, 0x18, 0x30, 0x6b, 0x00, 0x00, 0x1a, 0xc0, 0x00, 0x00 db 0x05, 0x0f, 0xe0, 0x1c, 0x00, 0x00, 0x07, 0xfe, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xfd, 0x00, 0x00, 0xe0, 0xfd, 0x00 db 0xfe, 0x00, 0x01, 0x03, 0x58, 0xfd, 0x00 db 0xfe, 0x00, 0x01, 0x06, 0xac, 0xfd, 0x00 db 0xfe, 0x00, 0x01, 0x0d, 0x56, 0xfd, 0x00 db 0xfe, 0x00, 0x01, 0x06, 0xac, 0xfd, 0x00 db 0xfe, 0x00, 0x01, 0x03, 0x58, 0xfd, 0x00 db 0xfd, 0x00, 0x00, 0xe0, 0xfd, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0x08, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x07, 0x00, 0xfe, 0x00 db 0x08, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x1a, 0xc1, 0x83, 0x00 db 0x08, 0x07, 0x00, 0xd5, 0x80, 0x00, 0x35, 0x61, 0x80, 0x00 db 0x08, 0x1a, 0xc1, 0xaa, 0xc0, 0x00, 0x6a, 0xb1, 0x80, 0x00 db 0x08, 0x35, 0x60, 0xd5, 0x80, 0x00, 0x35, 0x60, 0xff, 0x00 db 0x08, 0x1a, 0xc0, 0x6b, 0x00, 0x00, 0x1a, 0xc0, 0x03, 0x00 db 0x08, 0x07, 0x00, 0x1c, 0x00, 0x00, 0x07, 0x01, 0xff, 0x00 db 0xf8, 0x00 db 0xf8, 0x00
code.asm
rng70/C-Compiler
0
160429
.MODEL SMALL .STACK 100H .DATA main_return_val DW ? a2 DW ? b2 DW ? t1 DW ? .CODE PRINT_INT PROC PUSH AX PUSH BX PUSH CX PUSH DX OR AX, AX JGE END_IF1 PUSH AX MOV DL,'-' MOV AH, 2 INT 21H POP AX NEG AX END_IF1: XOR CX, CX MOV BX, 10D REPEAT1: XOR DX, DX DIV BX PUSH DX INC CX OR AX, AX JNE REPEAT1 MOV AH, 2 PRINT_LOOP: POP DX OR DL, 30H INT 21H LOOP PRINT_LOOP MOV AH, 2 MOV DL, 10 INT 21H MOV DL, 13 INT 21H POP DX POP CX POP BX POP AX RET PRINT_INT ENDP MAIN PROC MOV AX, @DATA MOV DS ,AX MOV AX, 5 MOV a2, AX MOV AX, a2 ADD AX, 10 MOV t1, AX MOV AX, t1 MOV b2, AX MOV AX, a2 CALL PRINT_INT MOV AX, b2 CALL PRINT_INT LABEL_RETURN_main: MOV AH, 4CH INT 21H END MAIN
tests/syntax/bad/testfile-structure-2.adb
xuedong/mini-ada
0
27072
<reponame>xuedong/mini-ada with Ada.Text_IO; use Ada.Text_IO; procedure Test is Put('a'); end Test;
generated-sources/ada-server/mojang-api/src/model/com-github-asyncmc-mojang-api-ada-server-model-models.adb
AsyncMC/Mojang-API-Libs
0
20724
-- Mojang API -- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) -- -- OpenAPI spec version: 2020_06_05 -- -- -- NOTE: This package is auto generated by the swagger code generator 3.3.4. -- https://openapi-generator.tech -- Do not edit the class manually. package body com.github.asyncmc.mojang.api.ada.server.model.Models is use Swagger.Streams; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityQuestion_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("id", Value.Id); Into.Write_Entity ("question", Value.Question); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityQuestion_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityQuestion_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "id", Value.Id); Swagger.Streams.Deserialize (Object, "question", Value.Question); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityQuestion_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : SecurityQuestion_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityAnswerId_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("id", Value.Id); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityAnswerId_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityAnswerId_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "id", Value.Id); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityAnswerId_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : SecurityAnswerId_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityChallenge_Type) is begin Into.Start_Entity (Name); Serialize (Into, "question", Value.Question); Serialize (Into, "answer", Value.Answer); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityChallenge_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityChallenge_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Deserialize (Object, "question", Value.Question); Deserialize (Object, "answer", Value.Answer); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityChallenge_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : SecurityChallenge_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Error_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("error", Value.Error); Into.Write_Entity ("errorMessage", Value.Error_Message); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Error_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Error_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "error", Value.Error); Swagger.Streams.Deserialize (Object, "errorMessage", Value.Error_Message); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Error_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Error_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in CurrentPlayerIDs_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("id", Value.Id); Into.Write_Entity ("name", Value.Name); Into.Write_Entity ("legacy", Value.Legacy); Into.Write_Entity ("demo", Value.Demo); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in CurrentPlayerIDs_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out CurrentPlayerIDs_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "id", Value.Id); Swagger.Streams.Deserialize (Object, "name", Value.Name); Swagger.Streams.Deserialize (Object, "legacy", Value.Legacy); Swagger.Streams.Deserialize (Object, "demo", Value.Demo); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out CurrentPlayerIDs_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : CurrentPlayerIDs_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in NameChange_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("name", Value.Name); Serialize (Into, "changedToAt", Value.Changed_To_At); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in NameChange_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out NameChange_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "name", Value.Name); Swagger.Streams.Deserialize (Object, "changedToAt", Value.Changed_To_At); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out NameChange_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : NameChange_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SkinModel_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SkinModel_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SkinModel_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SkinModel_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : SkinModel_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ChangeSkinRequest_Type) is begin Into.Start_Entity (Name); Serialize (Into, "model", Value.Model); Into.Write_Entity ("url", Value.Url); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ChangeSkinRequest_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ChangeSkinRequest_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Deserialize (Object, "model", Value.Model); Swagger.Streams.Deserialize (Object, "url", Value.Url); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ChangeSkinRequest_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : ChangeSkinRequest_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityAnswer_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("id", Value.Id); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityAnswer_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityAnswer_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "id", Value.Id); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityAnswer_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : SecurityAnswer_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderStatisticsResponse_Type) is begin Into.Start_Entity (Name); Serialize (Into, "total", Value.Total); Serialize (Into, "last24h", Value.Last24h); Into.Write_Entity ("saleVelocityPerSeconds", Value.Sale_Velocity_Per_Seconds); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderStatisticsResponse_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderStatisticsResponse_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "total", Value.Total); Swagger.Streams.Deserialize (Object, "last24h", Value.Last24h); Swagger.Streams.Deserialize (Object, "saleVelocityPerSeconds", Value.Sale_Velocity_Per_Seconds); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderStatisticsResponse_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderStatisticsResponse_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderStatistic_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderStatistic_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderStatistic_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderStatistic_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderStatistic_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderStatisticsRequest_Type) is begin Into.Start_Entity (Name); Serialize (Into, "metricKeys", Value.Metric_Keys); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderStatisticsRequest_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderStatisticsRequest_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Deserialize (Object, "metricKeys", Value.Metric_Keys); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderStatisticsRequest_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderStatisticsRequest_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in UploadSkinRequest_Type) is begin Into.Start_Entity (Name); Serialize (Into, "model", Value.Model); Serialize (Into, "file", Value.File); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in UploadSkinRequest_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out UploadSkinRequest_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Deserialize (Object, "model", Value.Model); Deserialize (Object, "file", Value.File); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out UploadSkinRequest_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : UploadSkinRequest_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; end com.github.asyncmc.mojang.api.ada.server.model.Models;
source/jni/u2/dots/asm.asm
Falken42/SecondReality
9
175324
include clink.inc code SEGMENT para public 'CODE' ASSUME cs:code .386 MAXDOTS equ 1024 BOTTOM equ 8000 public _gravitybottom _gravitybottom dw BOTTOM public _bpmin,_bpmax _bpmin dw 30000 _bpmax dw -30000 public _gravity _gravity dw 0 public _dotnum _dotnum dw 0 public _gravityd _gravityd dw 16 dw -1280 dw -960 dw -640 dw -320 public _rows _rows dw 200 dup(0) public _dot _dot LABEL WORD dot dw MAXDOTS dup(0,0,0,0,0,0,0,0) ;x,y,z,oldposshadow,oldpos,-,-,- public _rotsin,_rotcos _rotsin dw 0 _rotcos dw 0 public _bgpic _bgpic dw 0,0 public _depthtable1,_depthtable2,_depthtable3,_depthtable4 _depthtable1 dd 128 dup(0) _depthtable2 dd 128 dup(0) _depthtable3 dd 128 dup(0) _depthtable4 dd 128 dup(0) public _drawdots _drawdots PROC FAR CBEG mov ax,0a000h mov es,ax mov ax,cs mov ds,ax mov fs,cs:_bgpic[2] mov cx,cs:_dotnum mov si,OFFSET dot @@1: push cx mov ax,ds:[si+0] ;X imul ds:_rotsin mov ax,ax mov cx,dx mov ax,ds:[si+4] ;Z imul ds:_rotcos sub ax,bx sub dx,cx mov bp,dx add bp,9000 mov ax,ds:[si+0] ;X imul ds:_rotcos mov bx,ax mov cx,dx mov ax,ds:[si+4] ;Z imul ds:_rotsin add ax,bx adc dx,cx shrd ax,dx,8 sar dx,8 mov bx,ax mov cx,dx shrd ax,dx,3 sar dx,3 add ax,bx adc dx,cx idiv bp add ax,160 push ax cmp ax,319 ja @@2 ;shadow xor ax,ax mov dx,8 idiv bp add ax,100 cmp ax,199 ja @@2 mov bx,ax shl bx,1 mov bx,ds:_rows[bx] pop ax add bx,ax push ax mov di,ds:[si+6] mov ax,fs:[di] mov es:[di],ax mov ax,87+87*256 mov word ptr es:[bx],ax mov ds:[si+6],bx ;ball mov ax,ds:_gravity add ds:[si+14],ax mov ax,ds:[si+2] ;Y add ax,ds:[si+14] cmp ax,ds:_gravitybottom jl @@4 push ax mov ax,ds:[si+14] neg ax imul cs:_gravityd sar ax,4 mov ds:[si+14],ax pop ax add ax,ds:[si+14] @@4: mov ds:[si+2],ax cwd shld dx,ax,6 shl ax,6 idiv bp add ax,100 cmp ax,199 ja @@3 mov bx,ax shl bx,1 mov bx,ds:_rows[bx] pop ax add bx,ax mov di,ds:[si+8] mov eax,fs:[di] mov es:[di],eax add di,320 mov eax,fs:[di] mov es:[di],eax add di,320 mov eax,fs:[di] mov es:[di],eax ; add di,320 ; mov eax,fs:[di] ; mov es:[di],eax shr bp,6 and bp,not 3 cmp bp,cs:_bpmin jge @@t1 mov cs:_bpmin,bp @@t1: cmp bp,cs:_bpmax jle @@t2 mov cs:_bpmax,bp @@t2: mov ax,word ptr ds:_depthtable1[bp] mov word ptr es:[bx+1],ax mov eax,ds:_depthtable2[bp] mov dword ptr es:[bx+320],eax mov ax,word ptr ds:_depthtable3[bp] mov word ptr es:[bx+641],ax mov ds:[si+8],bx @@z: pop cx add si,16 loop @@1 @@0: CEND @@2: mov di,ds:[si+8] mov eax,fs:[di] mov es:[di],eax add di,320 mov eax,fs:[di] mov es:[di],eax add di,320 mov eax,fs:[di] mov es:[di],eax mov di,ds:[si+6] mov ds:[si+6],ax mov ax,fs:[di] mov es:[di],ax pop bx pop cx add si,16 loop @@1 jmp @@0 @@3: mov di,ds:[si+8] mov eax,fs:[di] mov es:[di],eax add di,320 mov eax,fs:[di] mov es:[di],eax add di,320 mov eax,fs:[di] mov es:[di],eax pop bx pop cx add si,16 loop @@1 jmp @@0 _drawdots ENDP PUBLIC _setpalette _setpalette PROC FAR push bp mov bp,sp push si push di push ds mov si,[bp+6] mov ds,[bp+8] mov dx,3c8h mov al,0 out dx,al inc dx mov cx,768 rep outsb pop ds pop di pop si pop bp ret _setpalette ENDP _face LABEL WORD public _face include face.inc dw 30000,30000,30000 PUBLIC _sin1024 include sin1024.inc code ENDS END
mat/src/mat-targets-probes.adb
stcarrez/mat
7
8367
<gh_stars>1-10 ----------------------------------------------------------------------- -- mat-targets-probes - Definition and Analysis of process start events -- Copyright (C) 2014, 2015 <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 Bfd; with ELF; with MAT.Formats; with MAT.Readers.Marshaller; package body MAT.Targets.Probes is M_PID : constant MAT.Events.Internal_Reference := 1; M_EXE : constant MAT.Events.Internal_Reference := 2; M_HEAP_START : constant MAT.Events.Internal_Reference := 3; M_HEAP_END : constant MAT.Events.Internal_Reference := 4; M_END : constant MAT.Events.Internal_Reference := 5; M_LIBNAME : constant MAT.Events.Internal_Reference := 6; M_LADDR : constant MAT.Events.Internal_Reference := 7; M_COUNT : constant MAT.Events.Internal_Reference := 8; M_TYPE : constant MAT.Events.Internal_Reference := 9; M_VADDR : constant MAT.Events.Internal_Reference := 10; M_SIZE : constant MAT.Events.Internal_Reference := 11; M_FLAGS : constant MAT.Events.Internal_Reference := 12; PID_NAME : aliased constant String := "pid"; EXE_NAME : aliased constant String := "exe"; HP_START_NAME : aliased constant String := "hp_start"; HP_END_NAME : aliased constant String := "hp_end"; END_NAME : aliased constant String := "end"; LIBNAME_NAME : aliased constant String := "libname"; LADDR_NAME : aliased constant String := "laddr"; COUNT_NAME : aliased constant String := "count"; TYPE_NAME : aliased constant String := "type"; VADDR_NAME : aliased constant String := "vaddr"; SIZE_NAME : aliased constant String := "size"; FLAGS_NAME : aliased constant String := "flags"; Process_Attributes : aliased constant MAT.Events.Attribute_Table := (1 => (Name => PID_NAME'Access, Size => 0, Kind => MAT.Events.T_SIZE_T, Ref => M_PID), 2 => (Name => EXE_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_EXE), 3 => (Name => HP_START_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_HEAP_START), 4 => (Name => HP_END_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_HEAP_END), 5 => (Name => END_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_END)); Library_Attributes : aliased constant MAT.Events.Attribute_Table := (1 => (Name => LIBNAME_NAME'Access, Size => 0, Kind => MAT.Events.T_SIZE_T, Ref => M_LIBNAME), 2 => (Name => LADDR_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_LADDR), 3 => (Name => COUNT_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_COUNT), 4 => (Name => TYPE_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_TYPE), 5 => (Name => VADDR_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_VADDR), 6 => (Name => SIZE_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_SIZE), 7 => (Name => FLAGS_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_FLAGS)); -- ------------------------------ -- Create a new process after the begin event is received from the event stream. -- ------------------------------ procedure Create_Process (Probe : in Process_Probe_Type; Pid : in MAT.Types.Target_Process_Ref; Path : in Ada.Strings.Unbounded.Unbounded_String) is begin Probe.Target.Create_Process (Pid => Pid, Path => Path, Process => Probe.Target.Current); Probe.Target.Process.Events := Probe.Events; Probe.Target.Process.Frames := Probe.Frames; MAT.Memory.Targets.Initialize (Memory => Probe.Target.Process.Memory, Manager => Probe.Manager.all); end Create_Process; procedure Probe_Begin (Probe : in Process_Probe_Type; Defs : in MAT.Events.Attribute_Table; Msg : in out MAT.Readers.Message; Event : in out MAT.Events.Target_Event_Type) is use type MAT.Types.Target_Addr; use type MAT.Events.Attribute_Type; Pid : MAT.Types.Target_Process_Ref := 0; Path : Ada.Strings.Unbounded.Unbounded_String; Heap : MAT.Memory.Region_Info; begin for I in Defs'Range loop declare Def : MAT.Events.Attribute renames Defs (I); begin case Def.Ref is when M_PID => Pid := MAT.Readers.Marshaller.Get_Target_Process_Ref (Msg, Def.Kind); when M_EXE => Path := MAT.Readers.Marshaller.Get_String (Msg); when M_HEAP_START => Heap.Start_Addr := MAT.Readers.Marshaller.Get_Target_Addr (Msg, Def.Kind); when M_HEAP_END => Heap.End_Addr := MAT.Readers.Marshaller.Get_Target_Addr (Msg, Def.Kind); when others => MAT.Readers.Marshaller.Skip (Msg, Def.Size); end case; end; end loop; Heap.Size := Heap.End_Addr - Heap.Start_Addr; Heap.Path := Ada.Strings.Unbounded.To_Unbounded_String ("[heap]"); Event.Addr := Heap.Start_Addr; Event.Size := Heap.Size; Probe.Create_Process (Pid, Path); Probe.Manager.Read_Message (Msg); Probe.Manager.Read_Event_Definitions (Msg); Probe.Target.Process.Memory.Add_Region (Heap); Probe.Target.Process.Endian := MAT.Readers.Get_Endian (Msg); if Probe.Manager.Get_Address_Size = MAT.Events.T_UINT32 then MAT.Formats.Set_Address_Size (8); else MAT.Formats.Set_Address_Size (16); end if; end Probe_Begin; -- ------------------------------ -- Extract the information from the 'library' event. -- ------------------------------ procedure Probe_Library (Probe : in Process_Probe_Type; Defs : in MAT.Events.Attribute_Table; Msg : in out MAT.Readers.Message; Event : in out MAT.Events.Target_Event_Type) is use type MAT.Types.Target_Addr; Count : MAT.Types.Target_Size := 0; Path : Ada.Strings.Unbounded.Unbounded_String; Addr : MAT.Types.Target_Addr; Pos : Natural := Defs'Last + 1; Offset : MAT.Types.Target_Addr; begin for I in Defs'Range loop declare Def : MAT.Events.Attribute renames Defs (I); begin case Def.Ref is when M_COUNT => Count := MAT.Readers.Marshaller.Get_Target_Size (Msg, Def.Kind); Pos := I + 1; exit; when M_LIBNAME => Path := MAT.Readers.Marshaller.Get_String (Msg); when M_LADDR => Addr := MAT.Readers.Marshaller.Get_Target_Addr (Msg, Def.Kind); when others => MAT.Readers.Marshaller.Skip (Msg, Def.Size); end case; end; end loop; Event.Addr := Addr; Event.Size := 0; for Region in 1 .. Count loop declare Region : MAT.Memory.Region_Info; Kind : ELF.Elf32_Word := 0; begin for I in Pos .. Defs'Last loop declare Def : MAT.Events.Attribute renames Defs (I); begin case Def.Ref is when M_SIZE => Region.Size := MAT.Readers.Marshaller.Get_Target_Size (Msg, Def.Kind); when M_VADDR => Region.Start_Addr := MAT.Readers.Marshaller.Get_Target_Addr (Msg, Def.Kind); when M_TYPE => Kind := MAT.Readers.Marshaller.Get_Target_Uint32 (Msg, Def.Kind); when M_FLAGS => Region.Flags := MAT.Readers.Marshaller.Get_Target_Uint32 (Msg, Def.Kind); when others => MAT.Readers.Marshaller.Skip (Msg, Def.Size); end case; end; end loop; if Kind = ELF.PT_LOAD then Region.Start_Addr := Addr + Region.Start_Addr; Region.End_Addr := Region.Start_Addr + Region.Size; if Ada.Strings.Unbounded.Length (Path) = 0 then Region.Path := Probe.Target.Process.Path; Offset := 0; else Region.Path := Path; Offset := Region.Start_Addr; end if; Event.Size := Event.Size + Region.Size; Probe.Target.Process.Memory.Add_Region (Region); -- When auto-symbol loading is enabled, load the symbols associated with the -- shared libraries used by the program. if Probe.Target.Options.Load_Symbols then begin Probe.Target.Process.Symbols.Value.Load_Symbols (Region, Offset); exception when Bfd.OPEN_ERROR => Probe.Target.Console.Error ("Cannot open symbol library file '" & Ada.Strings.Unbounded.To_String (Region.Path) & "'"); end; end if; end if; end; end loop; end Probe_Library; overriding procedure Extract (Probe : in Process_Probe_Type; Params : in MAT.Events.Const_Attribute_Table_Access; Msg : in out MAT.Readers.Message_Type; Event : in out MAT.Events.Target_Event_Type) is use type MAT.Events.Probe_Index_Type; begin if Event.Index = MAT.Events.MSG_BEGIN then Probe.Probe_Begin (Params.all, Msg, Event); elsif Event.Index = MAT.Events.MSG_LIBRARY then Probe.Probe_Library (Params.all, Msg, Event); end if; end Extract; procedure Execute (Probe : in Process_Probe_Type; Event : in out MAT.Events.Target_Event_Type) is begin null; end Execute; -- ------------------------------ -- Register the reader to extract and analyze process events. -- ------------------------------ procedure Register (Into : in out MAT.Events.Probes.Probe_Manager_Type'Class; Probe : in Process_Probe_Type_Access) is begin Probe.Manager := Into'Unchecked_Access; Into.Register_Probe (Probe.all'Access, "begin", MAT.Events.MSG_BEGIN, Process_Attributes'Access); Into.Register_Probe (Probe.all'Access, "end", MAT.Events.MSG_END, Process_Attributes'Access); Into.Register_Probe (Probe.all'Access, "shlib", MAT.Events.MSG_LIBRARY, Library_Attributes'Access); end Register; -- ------------------------------ -- Initialize the target object to prepare for reading process events. -- ------------------------------ procedure Initialize (Target : in out Target_Type; Manager : in out MAT.Events.Probes.Probe_Manager_Type'Class) is Process_Probe : constant Process_Probe_Type_Access := new Process_Probe_Type; begin Process_Probe.Target := Target'Unrestricted_Access; Process_Probe.Events := Manager.Get_Target_Events; Process_Probe.Frames := Manager.Get_Target_Frames; Register (Manager, Process_Probe); end Initialize; end MAT.Targets.Probes;
library/02_functions_batch1/unknown_1000cee0.asm
SamantazFox/dds140-reverse-engineering
1
166542
<reponame>SamantazFox/dds140-reverse-engineering 1000cee0: 8b 44 24 08 mov eax,DWORD PTR [esp+0x8] 1000cee4: 8b 4c 24 10 mov ecx,DWORD PTR [esp+0x10] 1000cee8: 0b c8 or ecx,eax 1000ceea: 8b 4c 24 0c mov ecx,DWORD PTR [esp+0xc] 1000ceee: 75 09 jne 0x1000cef9 1000cef0: 8b 44 24 04 mov eax,DWORD PTR [esp+0x4] 1000cef4: f7 e1 mul ecx 1000cef6: c2 10 00 ret 0x10 1000cef9: 53 push ebx 1000cefa: f7 e1 mul ecx 1000cefc: 8b d8 mov ebx,eax 1000cefe: 8b 44 24 08 mov eax,DWORD PTR [esp+0x8] 1000cf02: f7 64 24 14 mul DWORD PTR [esp+0x14] 1000cf06: 03 d8 add ebx,eax 1000cf08: 8b 44 24 08 mov eax,DWORD PTR [esp+0x8] 1000cf0c: f7 e1 mul ecx 1000cf0e: 03 d3 add edx,ebx 1000cf10: 5b pop ebx 1000cf11: c2 10 00 ret 0x10 1000cf14: cc int3 1000cf15: cc int3 1000cf16: cc int3 1000cf17: cc int3 1000cf18: cc int3 1000cf19: cc int3 1000cf1a: cc int3 1000cf1b: cc int3 1000cf1c: cc int3 1000cf1d: cc int3 1000cf1e: cc int3 1000cf1f: cc int3
arch/ARM/STM32/svd/stm32l5x2/stm32_svd-comp.ads
morbos/Ada_Drivers_Library
2
19577
<reponame>morbos/Ada_Drivers_Library -- This spec has been automatically generated from STM32L5x2.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.COMP is pragma Preelaborate; --------------- -- Registers -- --------------- subtype COMP1_CSR_COMP1_PWRMODE_Field is HAL.UInt2; subtype COMP1_CSR_COMP1_INMSEL_Field is HAL.UInt3; subtype COMP1_CSR_COMP1_HYST_Field is HAL.UInt2; subtype COMP1_CSR_COMP1_BLANKING_Field is HAL.UInt3; -- Comparator 1 control and status register type COMP1_CSR_Register is record -- Comparator 1 enable bit COMP1_EN : Boolean := False; -- unspecified Reserved_1_1 : HAL.Bit := 16#0#; -- Power Mode of the comparator 1 COMP1_PWRMODE : COMP1_CSR_COMP1_PWRMODE_Field := 16#0#; -- Comparator 1 Input Minus connection configuration bit COMP1_INMSEL : COMP1_CSR_COMP1_INMSEL_Field := 16#0#; -- Comparator1 input plus selection bit COMP1_INPSEL : Boolean := False; -- unspecified Reserved_8_14 : HAL.UInt7 := 16#0#; -- Comparator 1 polarity selection bit COMP1_POLARITY : Boolean := False; -- Comparator 1 hysteresis selection bits COMP1_HYST : COMP1_CSR_COMP1_HYST_Field := 16#0#; -- Comparator 1 blanking source selection bits COMP1_BLANKING : COMP1_CSR_COMP1_BLANKING_Field := 16#0#; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- Scaler bridge enable COMP1_BRGEN : Boolean := False; -- Voltage scaler enable bit COMP1_SCALEN : Boolean := False; -- unspecified Reserved_24_29 : HAL.UInt6 := 16#0#; -- Read-only. Comparator 1 output status bit COMP1_VALUE : Boolean := False; -- Write-only. COMP1_CSR register lock bit COMP1_LOCK : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for COMP1_CSR_Register use record COMP1_EN at 0 range 0 .. 0; Reserved_1_1 at 0 range 1 .. 1; COMP1_PWRMODE at 0 range 2 .. 3; COMP1_INMSEL at 0 range 4 .. 6; COMP1_INPSEL at 0 range 7 .. 7; Reserved_8_14 at 0 range 8 .. 14; COMP1_POLARITY at 0 range 15 .. 15; COMP1_HYST at 0 range 16 .. 17; COMP1_BLANKING at 0 range 18 .. 20; Reserved_21_21 at 0 range 21 .. 21; COMP1_BRGEN at 0 range 22 .. 22; COMP1_SCALEN at 0 range 23 .. 23; Reserved_24_29 at 0 range 24 .. 29; COMP1_VALUE at 0 range 30 .. 30; COMP1_LOCK at 0 range 31 .. 31; end record; subtype COMP2_CSR_COMP2_PWRMODE_Field is HAL.UInt2; subtype COMP2_CSR_COMP2_INMSEL_Field is HAL.UInt3; subtype COMP2_CSR_COMP2_HYST_Field is HAL.UInt2; subtype COMP2_CSR_COMP2_BLANKING_Field is HAL.UInt3; -- Comparator 2 control and status register type COMP2_CSR_Register is record -- Comparator 2 enable bit COMP2_EN : Boolean := False; -- unspecified Reserved_1_1 : HAL.Bit := 16#0#; -- Power Mode of the comparator 2 COMP2_PWRMODE : COMP2_CSR_COMP2_PWRMODE_Field := 16#0#; -- Comparator 2 Input Minus connection configuration bit COMP2_INMSEL : COMP2_CSR_COMP2_INMSEL_Field := 16#0#; -- Comparator 2 Input Plus connection configuration bit COMP2_INPSEL : Boolean := False; -- unspecified Reserved_8_8 : HAL.Bit := 16#0#; -- Windows mode selection bit COMP2_WINMODE : Boolean := False; -- unspecified Reserved_10_14 : HAL.UInt5 := 16#0#; -- Comparator 2 polarity selection bit COMP2_POLARITY : Boolean := False; -- Comparator 2 hysteresis selection bits COMP2_HYST : COMP2_CSR_COMP2_HYST_Field := 16#0#; -- Comparator 2 blanking source selection bits COMP2_BLANKING : COMP2_CSR_COMP2_BLANKING_Field := 16#0#; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- Scaler bridge enable COMP2_BRGEN : Boolean := False; -- Voltage scaler enable bit COMP2_SCALEN : Boolean := False; -- unspecified Reserved_24_29 : HAL.UInt6 := 16#0#; -- Read-only. Comparator 2 output status bit COMP2_VALUE : Boolean := False; -- Write-only. COMP2_CSR register lock bit COMP2_LOCK : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for COMP2_CSR_Register use record COMP2_EN at 0 range 0 .. 0; Reserved_1_1 at 0 range 1 .. 1; COMP2_PWRMODE at 0 range 2 .. 3; COMP2_INMSEL at 0 range 4 .. 6; COMP2_INPSEL at 0 range 7 .. 7; Reserved_8_8 at 0 range 8 .. 8; COMP2_WINMODE at 0 range 9 .. 9; Reserved_10_14 at 0 range 10 .. 14; COMP2_POLARITY at 0 range 15 .. 15; COMP2_HYST at 0 range 16 .. 17; COMP2_BLANKING at 0 range 18 .. 20; Reserved_21_21 at 0 range 21 .. 21; COMP2_BRGEN at 0 range 22 .. 22; COMP2_SCALEN at 0 range 23 .. 23; Reserved_24_29 at 0 range 24 .. 29; COMP2_VALUE at 0 range 30 .. 30; COMP2_LOCK at 0 range 31 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Comparator type COMP_Peripheral is record -- Comparator 1 control and status register COMP1_CSR : aliased COMP1_CSR_Register; -- Comparator 2 control and status register COMP2_CSR : aliased COMP2_CSR_Register; end record with Volatile; for COMP_Peripheral use record COMP1_CSR at 16#0# range 0 .. 31; COMP2_CSR at 16#4# range 0 .. 31; end record; -- Comparator COMP_Periph : aliased COMP_Peripheral with Import, Address => System'To_Address (16#40010200#); -- Comparator SEC_COMP_Periph : aliased COMP_Peripheral with Import, Address => System'To_Address (16#50010200#); end STM32_SVD.COMP;
gcc-gcc-7_3_0-release/gcc/ada/g-exptty.ads
best08618/asylo
7
21345
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . E X P E C T . T T Y -- -- -- -- S p e c -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with GNAT.TTY; with System; with System.OS_Constants; package GNAT.Expect.TTY is pragma Linker_Options (System.OS_Constants.PTY_Library); ------------------ -- TTY_Process -- ------------------ type TTY_Process_Descriptor is new Process_Descriptor with private; -- Similar to Process_Descriptor, with the parent set up as a full terminal -- (Unix sense, see tty(4)). procedure Pseudo_Descriptor (Descriptor : out TTY_Process_Descriptor'Class; TTY : GNAT.TTY.TTY_Handle; Buffer_Size : Natural := 4096); -- Given a terminal descriptor (TTY), create a pseudo process descriptor -- to be used with GNAT.Expect. -- -- Note that it is invalid to call Close, Interrupt, Send_Signal on the -- resulting descriptor. To deallocate memory associated with Process, -- call Close_Pseudo_Descriptor instead. procedure Close_Pseudo_Descriptor (Descriptor : in out TTY_Process_Descriptor); -- Free memory and ressources associated with Descriptor. Will *not* -- close the associated TTY, it is the caller's responsibility to call -- GNAT.TTY.Close_TTY. procedure Interrupt (Pid : Integer); -- Interrupt a process given its pid overriding procedure Send (Descriptor : in out TTY_Process_Descriptor; Str : String; Add_LF : Boolean := True; Empty_Buffer : Boolean := False); -- See parent -- What does that comment mean??? what is "parent" here procedure Set_Use_Pipes (Descriptor : in out TTY_Process_Descriptor; Use_Pipes : Boolean); -- Tell Expect.TTY whether to use Pipes or Console (on windows). Needs to -- be set before spawning the process. Default is to use Pipes. procedure Set_Size (Descriptor : in out TTY_Process_Descriptor'Class; Rows : Natural; Columns : Natural); -- Sets up the size of the terminal as reported to the spawned process private -- All declarations in the private part must be fully commented ??? overriding procedure Close (Descriptor : in out TTY_Process_Descriptor; Status : out Integer); overriding procedure Close (Descriptor : in out TTY_Process_Descriptor); overriding procedure Interrupt (Descriptor : in out TTY_Process_Descriptor); -- When we use pseudo-terminals, we do not need to use signals to -- interrupt the debugger, we can simply send the appropriate character. -- This provides a better support for remote debugging for instance. procedure Set_Up_Communications (Pid : in out TTY_Process_Descriptor; Err_To_Out : Boolean; Pipe1 : access Pipe_Type; Pipe2 : access Pipe_Type; Pipe3 : access Pipe_Type); procedure Set_Up_Parent_Communications (Pid : in out TTY_Process_Descriptor; Pipe1 : in out Pipe_Type; Pipe2 : in out Pipe_Type; Pipe3 : in out Pipe_Type); procedure Set_Up_Child_Communications (Pid : in out TTY_Process_Descriptor; Pipe1 : in out Pipe_Type; Pipe2 : in out Pipe_Type; Pipe3 : in out Pipe_Type; Cmd : String; Args : System.Address); type TTY_Process_Descriptor is new Process_Descriptor with record Process : System.Address; -- Underlying structure used in C Use_Pipes : Boolean := True; end record; end GNAT.Expect.TTY;
test/Fail/Negative1.agda
shlevy/agda
1,989
16107
<reponame>shlevy/agda module Negative1 where data D : Set where lam : (D -> D) -> D
Funlang.g4
mgrzeszczak/funlang
0
2248
<gh_stars>0 grammar Funlang; program : (statement Semicolon)+ | ; statement : definition | execution ; execution : name parameters ; parameterList : number | number Comma parameterList ; parameters : OpenParam CloseParam | OpenParam parameterList CloseParam ; definition : Define name AssignmentOperator function ; name : Nondigit (Nondigit | Digit)* ; function : composition | function CompositionOperator innerFunctions ; innerFunctions : OpenParam functionList CloseParam | function ; functionList : function | function Comma functionList ; composition : composition PrimitiveRecursionOperator primitiveRecursion | primitiveRecursion ; primitiveRecursion : OpenParam function CloseParam | zero | successor | projection | name ; zero : 'Z' OpenParam number CloseParam ; successor : 'S' ; projection : 'P' OpenParam number ',' number CloseParam ; number : Digit+ ; Define : 'def' ; AssignmentOperator : '=' ; CompositionOperator : '|' ; PrimitiveRecursionOperator : '&' ; Comma : ',' ; Semicolon : ';' ; OpenParam : '(' ; CloseParam : ')' ; Nondigit : [a-zA-Z_] ; Digit : [0-9] ; Whitespace : [ \t]+ -> skip ; Newline : ( '\r' '\n'? | '\n' ) -> skip ; BlockComment : '/*' .*? '*/' -> skip ; LineComment : '//' ~[\r\n]* -> skip ;
tools/akt-commands-info.adb
thierr26/ada-keystore
25
9041
<filename>tools/akt-commands-info.adb ----------------------------------------------------------------------- -- akt-commands-info -- Info command of keystore -- Copyright (C) 2019 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Text_IO; with Keystore.Verifier; package body AKT.Commands.Info is use type Keystore.Header_Slot_Count_Type; use type Keystore.Passwords.Keys.Key_Provider_Access; -- ------------------------------ -- List the value entries of the keystore. -- ------------------------------ overriding procedure Execute (Command : in out Command_Type; Name : in String; Args : in Argument_List'Class; Context : in out Context_Type) is pragma Unreferenced (Command, Name); Path : constant String := Context.Get_Keystore_Path (Args); Stats : Keystore.Wallet_Stats; Is_Keystore : Boolean; begin Keystore.Verifier.Print_Information (Path, Is_Keystore); -- No need to proceed if this is not a keystore file. if not Is_Keystore then return; end if; Setup_Password_Provider (Context); Setup_Key_Provider (Context); Context.Wallet.Open (Path => Path, Data_Path => Context.Data_Path.all, Info => Context.Info); if Context.No_Password_Opt and Context.Info.Header_Count = 0 then return; end if; if not Context.No_Password_Opt then if Context.Key_Provider /= null then Context.Wallet.Set_Master_Key (Context.Key_Provider.all); end if; Context.Wallet.Unlock (Context.Provider.all, Context.Slot); else Context.GPG.Load_Secrets (Context.Wallet); Context.Wallet.Set_Master_Key (Context.GPG); Context.Wallet.Unlock (Context.GPG, Context.Slot); end if; Context.Wallet.Get_Stats (Stats); Ada.Text_IO.Put ("Key slots used: "); Ada.Text_IO.Set_Col (29); for Slot in Stats.Keys'Range loop if Stats.Keys (Slot) then Ada.Text_IO.Put (Keystore.Key_Slot'Image (Slot)); end if; end loop; Ada.Text_IO.New_Line; Ada.Text_IO.Put ("Entry count: "); Ada.Text_IO.Set_Col (29); Ada.Text_IO.Put_Line (Natural'Image (Stats.Entry_Count)); end Execute; end AKT.Commands.Info;
programs/oeis/306/A306957.asm
karttu/loda
0
82995
<reponame>karttu/loda ; A306957: a(n) = n!*binomial(10,n). ; 1,10,90,720,5040,30240,151200,604800,1814400,3628800,3628800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mov $1,11 mov $2,11 lpb $0,1 sub $0,1 sub $2,1 mul $1,$2 lpe div $1,11
programs/oeis/113/A113217.asm
neoneye/loda
22
243371
<filename>programs/oeis/113/A113217.asm ; A113217: Parity of decimal digital root of n. ; 0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1 sub $0,1 mod $0,9 add $0,1 mod $0,2
oeis/217/A217478.asm
neoneye/loda-programs
11
242622
; A217478: Triangle of coefficients of polynomials providing the second term of the numerator for the generating function for odd powers (2*m+1) of Chebyshev S-polynomials. The present polynomials are called P(m;1,x^2). ; Submitted by <NAME>(s4) ; -2,3,-4,-4,10,-6,5,-20,21,-8,-6,35,-56,36,-10,7,-56,126,-120,55,-12,-8,84,-252,330,-220,78,-14,9,-120,462,-792,715,-364,105,-16,-10,165,-792,1716,-2002,1365,-560,136,-18,11,-220,1287,-3432,5005,-4368,2380,-816,171,-20 lpb $0 add $1,1 sub $0,$1 mov $2,$1 sub $2,$0 lpe add $0,1 mul $0,-2 add $2,1 bin $0,$2
proofs/AKS/Modular/Quotient/Properties.agda
mckeankylej/thesis
1
10608
open import Level using (0ℓ) open import Function using (_$_) open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl; sym; trans; cong; cong₂; isEquivalence; setoid; module ≡-Reasoning) open import Relation.Binary.PropositionalEquality.WithK using (≡-irrelevant) open import Relation.Nullary.Negation using (contradiction) open ≡-Reasoning open import Data.Unit using (⊤; tt) open import Agda.Builtin.FromNat using (Number) open import Data.Product using (_,_) open import AKS.Primality using (IsPrime; Prime; bézout-prime) module AKS.Modular.Quotient.Properties {P : Prime} where open Prime P using () renaming (prime to p; isPrime to p-isPrime) open IsPrime p-isPrime using (1<p) open import AKS.Nat using (ℕ; zero; suc; _<_; _≤_; _∸_) renaming (_+_ to _+ℕ_; _*_ to _*ℕ_; _≟_ to _≟ℕ_) open import AKS.Nat using (<⇒≤; [n∸m]+m≡n; suc-mono-≤; *-mono-≤; ≤-refl) import AKS.Nat as Nat import Data.Nat.Properties as Nat open import AKS.Nat.Divisibility using (_%_; %-distribˡ-+; %-distribˡ-∸; %-distribˡ-*; m%n%n≡m%n; n<m⇒n%m≡n; n%m<m; n%n≡0; 0%m≡0; 1%m≡1; [m+kn]%n≡m%n) open import AKS.Nat.GCD using (+ʳ; +ˡ) open import AKS.Modular.Quotient.Base using (ℤ/[_]; ℤ✓; mod; mod<p; module Operations) open Operations {P} using ([_]; _+_; _*_; -_; _⁻¹; _/_; _≟_; p≢0; ℤ/[]-irrelevance; n≢0⇒mod[n]≢0) open import Algebra.Structures {A = ℤ/[ P ]} _≡_ using ( IsCommutativeRing; IsRing; IsAbelianGroup ; IsGroup; IsMonoid; IsSemigroup; IsMagma ) open import Algebra.Definitions {A = ℤ/[ P ]} _≡_ using ( _DistributesOver_; _DistributesOverʳ_; _DistributesOverˡ_ ; RightIdentity; LeftIdentity; Identity; Associative; Commutative ; RightInverse; LeftInverse; Inverse ) open import AKS.Algebra.Structures (ℤ/[ P ]) _≡_ using (IsNonZeroCommutativeRing; IsIntegralDomain; IsGCDDomain; IsDecField) open import Algebra.Bundles using (Ring; CommutativeRing) open import AKS.Algebra.Bundles using (NonZeroCommutativeRing; DecField) open import AKS.Unsafe using (≢-irrelevant) +-isMagma : IsMagma _+_ +-isMagma = record { isEquivalence = isEquivalence ; ∙-cong = cong₂ _+_ } mod≡mod%p : ∀ (x : ℤ/[ P ]) → mod x ≡ (mod x % p) {p≢0} mod≡mod%p (ℤ✓ x x<p) = sym (n<m⇒n%m≡n x<p) mod≡mod%p%p : ∀ (x : ℤ/[ P ]) → mod x ≡ ((mod x % p) {p≢0} % p) {p≢0} mod≡mod%p%p x = begin mod x ≡⟨ mod≡mod%p x ⟩ mod x % p ≡⟨ sym (m%n%n≡m%n (mod x) p) ⟩ mod x % p % p ∎ +-assoc : Associative _+_ +-assoc x y z = ℤ/[]-irrelevance $ begin ((mod x +ℕ mod y) % p +ℕ mod z) % p ≡⟨ cong₂ (λ a b → (a +ℕ b) % p) (%-distribˡ-+ (mod x) (mod y) p {p≢0}) (mod≡mod%p z) ⟩ ((mod x % p +ℕ mod y % p) % p +ℕ mod z % p) % p ≡⟨ sym (%-distribˡ-+ (mod x % p +ℕ mod y % p) (mod z) p) ⟩ ((mod x % p +ℕ mod y % p) +ℕ mod z) % p ≡⟨ cong (λ a → (a % p) {p≢0}) (Nat.+-assoc (mod x % p) (mod y % p) (mod z)) ⟩ (mod x % p +ℕ (mod y % p +ℕ mod z)) % p ≡⟨ %-distribˡ-+ (mod x % p) (mod y % p +ℕ mod z) p ⟩ (mod x % p % p +ℕ (mod y % p +ℕ mod z) % p) % p ≡⟨ cong₂ (λ a b → (a +ℕ (b +ℕ mod z) % p) % p) (sym (mod≡mod%p%p x)) (sym (mod≡mod%p y)) ⟩ (mod x +ℕ (mod y +ℕ mod z) % p) % p ∎ +-isSemigroup : IsSemigroup _+_ +-isSemigroup = record { isMagma = +-isMagma ; assoc = +-assoc } +-comm : Commutative _+_ +-comm x y = ℤ/[]-irrelevance $ begin (mod x +ℕ mod y) % p ≡⟨ cong (λ a → (a % p) {p≢0}) (Nat.+-comm (mod x) (mod y)) ⟩ (mod y +ℕ mod x) % p ∎ +-identityˡ : LeftIdentity 0 _+_ +-identityˡ x = ℤ/[]-irrelevance $ begin (0 % p +ℕ mod x) % p ≡⟨ cong (λ a → (0 % p +ℕ a) % p) (mod≡mod%p x) ⟩ (0 % p +ℕ mod x % p) % p ≡⟨ sym (%-distribˡ-+ 0 (mod x) p) ⟩ (0 +ℕ mod x) % p ≡⟨ sym (mod≡mod%p x) ⟩ mod x ∎ open import Algebra.FunctionProperties.Consequences.Propositional using (comm+idˡ⇒idʳ; comm+invˡ⇒invʳ; comm+distrˡ⇒distrʳ) +-identityʳ : RightIdentity 0 _+_ +-identityʳ = comm+idˡ⇒idʳ +-comm {0} +-identityˡ +-identity : Identity 0 _+_ +-identity = +-identityˡ , +-identityʳ +-isMonoid : IsMonoid _+_ 0 +-isMonoid = record { isSemigroup = +-isSemigroup ; identity = +-identity } -‿inverseˡ : LeftInverse 0 -_ _+_ -‿inverseˡ (ℤ✓ zero x<p) = refl -‿inverseˡ (ℤ✓ (suc x) x<p) = ℤ/[]-irrelevance $ begin ((p ∸ suc x) +ℕ suc x) % p ≡⟨ cong (λ a → (a % p) {p≢0}) ([n∸m]+m≡n (<⇒≤ x<p)) ⟩ p % p ≡⟨ n%n≡0 p ⟩ 0 ≡⟨ sym (0%m≡0 p {p≢0}) ⟩ 0 % p ∎ -‿inverseʳ : RightInverse 0 -_ _+_ -‿inverseʳ = comm+invˡ⇒invʳ {_⁻¹ = -_} +-comm -‿inverseˡ -‿inverse : Inverse 0 -_ _+_ -‿inverse = -‿inverseˡ , -‿inverseʳ +-isGroup : IsGroup _+_ 0 -_ +-isGroup = record { isMonoid = +-isMonoid ; inverse = -‿inverse ; ⁻¹-cong = cong -_ } +-isAbelianGroup : IsAbelianGroup _+_ 0 -_ +-isAbelianGroup = record { isGroup = +-isGroup ; comm = +-comm } *-isMagma : IsMagma _*_ *-isMagma = record { isEquivalence = isEquivalence ; ∙-cong = cong₂ _*_ } *-assoc : Associative _*_ *-assoc x y z = ℤ/[]-irrelevance $ begin ((mod x *ℕ mod y) % p *ℕ mod z) % p ≡⟨ cong₂ (λ a b → (a *ℕ b) % p) (%-distribˡ-* (mod x) (mod y) p {p≢0}) (mod≡mod%p z) ⟩ (((mod x % p) *ℕ (mod y % p)) % p *ℕ (mod z % p)) % p ≡⟨ sym (%-distribˡ-* ((mod x % p) *ℕ (mod y % p)) (mod z) p) ⟩ (((mod x % p) *ℕ (mod y % p)) *ℕ mod z) % p ≡⟨ cong (λ a → (a % p) {p≢0}) (Nat.*-assoc (mod x % p) (mod y % p) (mod z)) ⟩ ((mod x % p) *ℕ ((mod y % p) *ℕ mod z)) % p ≡⟨ %-distribˡ-* (mod x % p) ((mod y % p) *ℕ mod z) p ⟩ ((mod x % p % p) *ℕ (((mod y % p) *ℕ mod z) % p)) % p ≡⟨ cong₂ (λ a b → (a *ℕ ((b *ℕ mod z) % p)) % p) (sym (mod≡mod%p%p x)) (sym (mod≡mod%p y)) ⟩ (mod x *ℕ ((mod y *ℕ mod z) % p)) % p ∎ *-isSemigroup : IsSemigroup _*_ *-isSemigroup = record { isMagma = *-isMagma ; assoc = *-assoc } *-comm : Commutative _*_ *-comm x y = ℤ/[]-irrelevance $ begin (mod x *ℕ mod y) % p ≡⟨ cong (λ a → (a % p) {p≢0}) (Nat.*-comm (mod x) (mod y)) ⟩ (mod y *ℕ mod x) % p ∎ *-identityˡ : LeftIdentity 1 _*_ *-identityˡ x = ℤ/[]-irrelevance $ begin (1 % p *ℕ mod x) % p ≡⟨ cong (λ a → ((a *ℕ mod x) % p) {p≢0}) (1%m≡1 1<p) ⟩ (1 *ℕ mod x) % p ≡⟨ cong (λ a → a % p) (Nat.*-identityˡ (mod x)) ⟩ mod x % p ≡⟨ sym (mod≡mod%p x) ⟩ mod x ∎ *-identityʳ : RightIdentity 1 _*_ *-identityʳ = comm+idˡ⇒idʳ *-comm {1} *-identityˡ *-identity : Identity 1 _*_ *-identity = *-identityˡ , *-identityʳ *-isMonoid : IsMonoid _*_ 1 *-isMonoid = record { isSemigroup = *-isSemigroup ; identity = *-identity } *-distribˡ-+ : _*_ DistributesOverˡ _+_ *-distribˡ-+ r x y = ℤ/[]-irrelevance $ begin (mod r *ℕ ((mod x +ℕ mod y) % p)) % p ≡⟨ cong (λ a → (a *ℕ ((mod x +ℕ mod y) % p)) % p) (mod≡mod%p r) ⟩ (mod r % p *ℕ ((mod x +ℕ mod y) % p)) % p ≡⟨ sym (%-distribˡ-* (mod r) (mod x +ℕ mod y) p) ⟩ (mod r *ℕ (mod x +ℕ mod y)) % p ≡⟨ cong (λ a → (a % p) {p≢0}) (Nat.*-distribˡ-+ (mod r) (mod x) (mod y)) ⟩ (mod r *ℕ mod x +ℕ mod r *ℕ mod y) % p ≡⟨ %-distribˡ-+ (mod r *ℕ mod x) (mod r *ℕ mod y) p ⟩ ((mod r *ℕ mod x) % p +ℕ (mod r *ℕ mod y) % p) % p ∎ *-distribʳ-+ : _*_ DistributesOverʳ _+_ *-distribʳ-+ = comm+distrˡ⇒distrʳ {_} {_} {_*_} {_+_} *-comm *-distribˡ-+ *-distrib-+ : _*_ DistributesOver _+_ *-distrib-+ = *-distribˡ-+ , *-distribʳ-+ +-*-isRing : IsRing _+_ _*_ -_ 0 1 +-*-isRing = record { +-isAbelianGroup = +-isAbelianGroup ; *-isMonoid = *-isMonoid ; distrib = *-distrib-+ } +-*-isCommutativeRing : IsCommutativeRing _+_ _*_ -_ 0 1 +-*-isCommutativeRing = record { isRing = +-*-isRing ; *-comm = *-comm } open import Data.Empty using (⊥) 0≢1 : [ 0 ] ≢ [ 1 ] 0≢1 [0]≡[1] = false where 0≡1 : zero ≡ 1 0≡1 = begin 0 ≡⟨ sym (0%m≡0 p {p≢0}) ⟩ 0 % p ≡⟨ cong mod [0]≡[1] ⟩ 1 % p ≡⟨ 1%m≡1 1<p ⟩ 1 ∎ false : ⊥ false with 0≡1 ... | () +-*-isNonZeroCommutativeRing : IsNonZeroCommutativeRing _+_ _*_ -_ 0 1 +-*-isNonZeroCommutativeRing = record { isCommutativeRing = +-*-isCommutativeRing ; 0#≉1# = 0≢1 } +-*-nonZeroCommutativeRing : NonZeroCommutativeRing 0ℓ 0ℓ +-*-nonZeroCommutativeRing = record { isNonZeroCommutativeRing = +-*-isNonZeroCommutativeRing } ⁻¹-inverse-lemma₁ : ∀ (n : ℤ/[ P ]) x y → 1 +ℕ x *ℕ mod n ≡ y *ℕ p → ((mod n *ℕ (p ∸ (x % p) {p≢0})) % p) {p≢0} ≡ (1 % p) {p≢0} ⁻¹-inverse-lemma₁ n x y 1+x*n≡y*p = begin (mod n *ℕ (p ∸ x % p)) % p ≡⟨ cong (λ t → (t % p) {p≢0}) (Nat.*-distribˡ-∸ (mod n) p (x % p)) ⟩ ((1 +ℕ mod n *ℕ p) ∸ (1 +ℕ mod n *ℕ (x % p))) % p ≡⟨ %-distribˡ-∸ (1 +ℕ mod n *ℕ p) (1 +ℕ mod n *ℕ (x % p)) p 1+n*x%p≤1+n*p ⟩ ((1 +ℕ mod n *ℕ p) ∸ (1 +ℕ mod n *ℕ (x % p)) % p) % p ≡⟨ cong (λ t → ((1 +ℕ mod n *ℕ p) ∸ t) % p) lemma ⟩ ((1 +ℕ mod n *ℕ p) ∸ 0) % p ≡⟨ [m+kn]%n≡m%n 1 (mod n) p ⟩ 1 % p ∎ where lemma : ((1 +ℕ mod n *ℕ (x % p) {p≢0}) % p) {p≢0} ≡ 0 lemma = begin (1 +ℕ mod n *ℕ (x % p)) % p ≡⟨ cong (λ t → ((1 +ℕ t *ℕ (x % p) {p≢0}) % p) {p≢0}) (mod≡mod%p n) ⟩ (1 +ℕ (mod n % p) *ℕ (x % p)) % p ≡⟨ %-distribˡ-+ 1 ((mod n % p) *ℕ (x % p)) p ⟩ (1 % p +ℕ ((mod n % p) *ℕ (x % p)) % p) % p ≡⟨ cong (λ t → (1 % p +ℕ t) % p) (sym (%-distribˡ-* (mod n) x p)) ⟩ (1 % p +ℕ (mod n *ℕ x) % p) % p ≡⟨ sym (%-distribˡ-+ 1 (mod n *ℕ x) p) ⟩ (1 +ℕ mod n *ℕ x) % p ≡⟨ cong (λ t → ((1 +ℕ t) % p) {p≢0}) (Nat.*-comm (mod n) x) ⟩ (1 +ℕ x *ℕ mod n) % p ≡⟨ cong (λ t → (t % p) {p≢0}) 1+x*n≡y*p ⟩ (y *ℕ p) % p ≡⟨ [m+kn]%n≡m%n 0 y p ⟩ 0 % p ≡⟨ 0%m≡0 p ⟩ 0 ∎ 1+n*x%p≤1+n*p : 1 +ℕ mod n *ℕ (x % p) {p≢0} ≤ 1 +ℕ mod n *ℕ p 1+n*x%p≤1+n*p = suc-mono-≤ (*-mono-≤ {mod n} ≤-refl (<⇒≤ (n%m<m x p))) ⁻¹-inverse-lemma₂ : ∀ (n : ℤ/[ P ]) x y → 1 +ℕ y *ℕ p ≡ x *ℕ mod n → ((mod n *ℕ (x % p) {p≢0}) % p) {p≢0} ≡ (1 % p) {p≢0} ⁻¹-inverse-lemma₂ n x y 1+y*p≡x*n = begin (mod n *ℕ (x % p)) % p ≡⟨ cong (λ t → (t *ℕ (x % p)) % p) (mod≡mod%p n) ⟩ ((mod n % p) *ℕ (x % p)) % p ≡⟨ sym (%-distribˡ-* (mod n) x p) ⟩ (mod n *ℕ x) % p ≡⟨ cong (λ t → (t % p) {p≢0}) (Nat.*-comm (mod n) x) ⟩ (x *ℕ mod n) % p ≡⟨ cong (λ t → (t % p) {p≢0}) (sym 1+y*p≡x*n) ⟩ (1 +ℕ y *ℕ p) % p ≡⟨ [m+kn]%n≡m%n 1 y p ⟩ 1 % p ∎ ⁻¹-inverse : ∀ n {n≢0} → n * (n ⁻¹) {n≢0} ≡ 1 ⁻¹-inverse n {n≢0} with bézout-prime (mod n) p (n≢0⇒mod[n]≢0 n≢0) (mod<p n) p-isPrime ... | +ʳ x y 1+x*n≡y*p = ℤ/[]-irrelevance (⁻¹-inverse-lemma₁ n x y 1+x*n≡y*p) ... | +ˡ x y 1+y*p≡x*n = ℤ/[]-irrelevance (⁻¹-inverse-lemma₂ n x y 1+y*p≡x*n) /-inverse : ∀ x y {y≢0} → x ≡ y * (x / y) {y≢0} /-inverse x y {y≢0} = begin x ≡⟨ sym (*-identityʳ x) ⟩ x * 1 ≡⟨ cong (λ a → x * a) (sym (⁻¹-inverse y {y≢0})) ⟩ x * (y * (y ⁻¹) {y≢0}) ≡⟨ sym (*-assoc x y ((y ⁻¹) {y≢0})) ⟩ (x * y) * (y ⁻¹) {y≢0} ≡⟨ cong (λ a → a * (y ⁻¹) {y≢0}) (*-comm x y) ⟩ (y * x) * (y ⁻¹) {y≢0} ≡⟨ *-assoc y x ((y ⁻¹) {y≢0}) ⟩ y * (x / y) {y≢0} ∎ open import AKS.Algebra.Consequences +-*-nonZeroCommutativeRing using (module Inverse⇒Field) open Inverse⇒Field _≟_ ≡-irrelevant ≢-irrelevant _/_ /-inverse using (gcd) renaming (isField to +-*-/-isField; [field] to +-*-/-field) public +-*-/-isDecField : IsDecField _≟_ _+_ _*_ -_ 0 1 _/_ gcd +-*-/-isDecField = record { isField = +-*-/-isField } +-*-/-decField : DecField 0ℓ 0ℓ +-*-/-decField = record { isDecField = +-*-/-isDecField }
gumiho/src/main/resources/Demo.g4
kent-bo-hai/gumiho
0
1073
<filename>gumiho/src/main/resources/Demo.g4 grammar Demo; compileUnit : expr EOF ; expr : '(' expr ')' # parensExpr | op=('+'|'-') expr # unaryExpr | left=expr op=('*'|'/') right=expr # infixExpr | left=expr op=('+'|'-') right=expr # infixExpr | func=ID '(' expr ')' # funcExpr | value=NUM # numberExpr ; OP_ADD: '+'; OP_SUB: '-'; OP_MUL: '*'; OP_DIV: '/'; NUM : [0-9]+ ('.' [0-9]+)? ([eE] [+-]? [0-9]+)?; ID : [a-zA-Z]+; WS : [ \t\r\n] -> channel(HIDDEN);
source/numerics/i-fortra.ads
ytomino/drake
33
11929
pragma License (Unrestricted); with Ada.Numerics.Generic_Complex_Types; -- see G.1.1 pragma Elaborate_All (Ada.Numerics.Generic_Complex_Types); package Interfaces.Fortran is pragma Pure; type Fortran_Integer is new Integer; -- implementation-defined type Real is new Float; -- implementation-defined type Double_Precision is new Long_Float; -- implementation-defined type Logical is new Boolean with Convention => Fortran; for Logical'Size use Integer'Size; package Single_Precision_Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real); type Complex is new Single_Precision_Complex_Types.Complex; subtype Imaginary is Single_Precision_Complex_Types.Imaginary; -- modified -- i : Imaginary renames Single_Precision_Complex_Types.i; -- j : Imaginary renames Single_Precision_Complex_Types.j; function i return Imaginary renames Single_Precision_Complex_Types.i; function j return Imaginary renames Single_Precision_Complex_Types.j; -- AI12-0058-1, Double_Precision_Complex_Types package Double_Precision_Complex_Types is new Ada.Numerics.Generic_Complex_Types (Double_Precision); type Double_Complex is new Double_Precision_Complex_Types.Complex; subtype Double_Imaginary is Double_Precision_Complex_Types.Imaginary; -- Note: character(kind=ascii) is treated as Latin-1 -- and character(kind=ucs4) is treated as UTF-32 in gfortran. type Character_Set is new Character; -- implementation-defined character type type Fortran_Character is array (Positive range <>) of Character_Set; pragma Pack (Fortran_Character); -- modified function To_Fortran ( Item : Character; Substitute : Character_Set := '?') -- additional return Character_Set; function To_Ada ( Item : Character_Set; Substitute : Character := '?') -- additional return Character; pragma Inline (To_Fortran); pragma Inline (To_Ada); -- modified function To_Fortran ( Item : String; Substitute : Fortran_Character := "?") -- additional return Fortran_Character; function To_Ada ( Item : Fortran_Character; Substitute : String := "?") -- additional, and unreferenced return String; -- modified procedure To_Fortran ( Item : String; Target : out Fortran_Character; Last : out Natural; Substitute : Fortran_Character := "?"); -- additional -- modified procedure To_Ada ( Item : Fortran_Character; Target : out String; Last : out Natural; Substitute : String := "?"); -- additional, and unreferenced -- Note: In RM B.5(21), an implementation is permitted to add -- Integer_Star_n, Real_Star_n, Logical_Star_n, Complex_Star_n, -- Integer_Kind_n, Real_Kind_n, Logical_Kind_n, Complex_Kind_n, -- and Character_Kind_n. -- Integer_Star_n and Integer_Kind_n subtype Integer_Kind_1 is Integer_8; subtype Integer_Kind_2 is Integer_16; subtype Integer_Kind_4 is Integer_32; subtype Integer_Kind_8 is Integer_64; -- type Integer_Kind_16 is ...; -- supported in gfortran, but not in GNAT subtype Integer_Star_1 is Integer_Kind_1; subtype Integer_Star_2 is Integer_Kind_2; subtype Integer_Star_4 is Integer_Kind_4; subtype Integer_Star_8 is Integer_Kind_8; -- subtype Integer_Star_16 is Integer_Kind_16; -- Real_Star_n and Real_Kind_n pragma Compile_Time_Error ( Long_Long_Float'Model_Mantissa /= 64 and then Long_Long_Float'Size /= 80 and then Long_Long_Float'Size /= 96, "Long_Long_Float is not Real_Kind_10."); subtype Real_Kind_4 is Real; subtype Real_Kind_8 is Double_Precision; type Real_Kind_10 is new Long_Long_Float; -- i686/x86_64 -- type Real_Kind_16 is ...; -- libquadmath subtype Real_Star_4 is Real_Kind_4; subtype Real_Star_8 is Real_Kind_8; subtype Real_Star_10 is Real_Kind_10; -- subtype Real_Star_16 is Real_Kind_16; -- Logical_Star_n and Logical_Kind_n type Logical_Kind_1 is new Boolean with Convention => Fortran; for Logical_Kind_1'Size use 8; for Logical_Kind_1'Alignment use 1; type Logical_Kind_2 is new Boolean with Convention => Fortran; for Logical_Kind_2'Size use 16; for Logical_Kind_2'Alignment use 2; type Logical_Kind_4 is new Boolean with Convention => Fortran; for Logical_Kind_4'Size use 32; for Logical_Kind_4'Alignment use 4; type Logical_Kind_8 is new Boolean with Convention => Fortran; for Logical_Kind_8'Size use 64; for Logical_Kind_8'Alignment use 8; -- type Logical_Kind_16 is ...; -- supported in gfortran, but not in GNAT subtype Logical_Star_1 is Logical_Kind_1; subtype Logical_Star_2 is Logical_Kind_2; subtype Logical_Star_4 is Logical_Kind_4; subtype Logical_Star_8 is Logical_Kind_8; -- subtype Logical_Star_16 is Logical_Kind_16; -- Complex_Star_n and Complex_Kind_n package Complex_Types_Kind_4 renames Single_Precision_Complex_Types; subtype Complex_Kind_4 is Complex_Types_Kind_4.Complex; package Complex_Types_Kind_8 renames Double_Precision_Complex_Types; subtype Complex_Kind_8 is Complex_Types_Kind_8.Complex; package Complex_Types_Kind_10 is new Ada.Numerics.Generic_Complex_Types (Real_Kind_10); subtype Complex_Kind_10 is Complex_Types_Kind_10.Complex; -- type Complex_Kind_16 is ...; -- libquadmath subtype Complex_Star_8 is Complex_Kind_4; subtype Complex_Star_16 is Complex_Kind_8; subtype Complex_Star_20 is Complex_Kind_10; -- subtype Complex_Star_32 is Complex_Kind_16; -- Character_Kind_n subtype Character_Set_Kind_1 is Character_Set; subtype Character_Kind_1 is Fortran_Character; type Character_Set_Kind_4 is new Wide_Wide_Character; type Character_Kind_4 is array (Positive range <>) of Character_Set_Kind_4; end Interfaces.Fortran;
libsrc/_DEVELOPMENT/l/z80/long/small/l_small_asr_dehl.asm
jpoikela/z88dk
640
18031
<filename>libsrc/_DEVELOPMENT/l/z80/long/small/l_small_asr_dehl.asm<gh_stars>100-1000 SECTION code_clib SECTION code_l PUBLIC l_small_asr_dehl EXTERN error_lznc, error_lmnc l_small_asr_dehl: ; arithmetic shift right 32-bit signed long ; ; enter : dehl = 32-bit number ; a = shift amount ; ; exit : dehl = dehl >> a ; ; uses : af, b, de, hl or a ret z cp 32 jr nc, shift_infinite ld b,a ld a,e shift_loop: sra d rra rr h rr l djnz shift_loop ld e,a ret shift_infinite: bit 7,d jp z, error_lznc jp error_lmnc
SLIDE_TronSolitaire.asm
XlogicX/CactusCon2017
2
160312
<reponame>XlogicX/CactusCon2017<gh_stars>1-10 %include 'textmode.h' call draw_border mov di, 160 * 2 + 8 ;where to place cursor mov si, line01 ;fetch the text mov ah, 0x0A ;color call slide_line mov di, 160 * 4 + 16 ;where to place cursor mov si, line02 ;fetch the text call slide_line ;Draw Border mov ah, 0x11 mov di, 160 * 6 + 32 mov cx, 40 rep stosw mov di, 160 * 21 + 32 mov cx, 40 rep stosw mov di, 160 * 7 + 32 vert1: stosw dec byte [counter] add di, 158 cmp byte [counter], 0 jne vert1 mov byte [counter], 0x0E mov di, 160 * 7 + 110 vert2: stosw dec byte [counter] add di, 158 cmp byte [counter], 0 jne vert2 ;Draw player mov ah, 0x22 mov di, 160 * 9 + 48 mov cx, 24 rep stosw mov di, 160 * 10 + 62 mov cx, 17 rep stosw mov di, 160 * 11 + 62 stosw mov di, 160 * 12 + 62 stosw mov di, 160 * 13 + 62 stosw ;Draw some bonuses mov ah, 0xAF mov al, 0x32 mov di, 160 * 15 + 80 stosw mov al, 0x36 mov di, 160 * 8 + 40 stosw mov al, 0x35 mov di, 160 * 17 + 44 stosw ;Draw some bad apples mov ah, 0xCF mov al, 0x33 mov di, 160 * 16 + 34 stosw mov al, 0x37 mov di, 160 * 9 + 100 stosw mov al, 0x34 mov di, 160 * 20 + 70 stosw jmp endloop endloop: jmp endloop %include 'slide_frame.h' %include 'pause.h' line01 db 0x0E, 'Tron Solitaire' line02 db 0x27, 'https://github.com/XlogicX/tronsolitare' titlemessage db 0x0E, 'Tron Solitaire' counter db 0xE ;BIOS sig and padding times 510-($-$$) db 0 dw 0xAA55
smsq/java/smsq_base.asm
olifink/smsqe
0
98360
; Initialise SMSQ for SMSQmulator V2.04 (c) <NAME> 2012-2015 ; 2003-01-22 2.03 use sms_dlan to copy default language (wl) ; 2015 Jul 27 2.04 removed debug code (blats etc) ; based on ; Initialise SMSQ V2.02  1994 <NAME> section base xdef smsq_base xref init_vec ; initialise vector area xref init_trp ; initialise traps xref init_sys ; initialise system variables xref init_exrv ; initialise exception redir vector xref init_sbst ; initialise SBASIC stub xref init_ext ; initialise extensions xref mem_achp xref.l smsq_vers xref smsq_end include 'dev8_keys_sys' include 'dev8_keys_jcbq' include 'dev8_keys_chp' include 'dev8_keys_err' include 'dev8_keys_java' include 'dev8_keys_sbasic' include 'dev8_keys_qdos_sms' include 'dev8_smsq_smsq_base_keys' include 'dev8_smsq_smsq_ini_keys' include 'dev8_smsq_smsq_config_keys' include 'dev8_mac_assert' smsq_base lea ini_sstk,a7 ; set ssp bra.l sms_reset ; reset section init sms_reset move.l sms.usetop,d7 ; top of usable memory tst.l sms.framt ; fast RAM installed? bne.s sms_init ; ... yes, ignore request cmp.l a4,d7 ; requested above useable top bls.s sms_init ; ... yes, ignore request move.l a4,d7 ; set requested RAMTOP sms_init jsr init_vec ; initialise vector area jsr init_trp ; initialise TRAP vectors move.l sms.sysb,a0 move.l jva_lkptr,d0 ; java -> smsqe comm block beq.s rnd_do ; ?? a very bad ooops here! add.l #jva_rand,d0 ; point to mouse area in comm block: mouse pos move.l d0,a2 move.w (a2),sys_rand(a0) ; random number seed rnd_do jsr init_sys ; initialise system vars jsr init_exrv ; initialise exception redirection vec jsr init_sbst ; initialise SuperBASIC stub ; system initialisation complete move.l #sb.jobsz+jcb_end,d1 ; set up job jsr mem_achp ; starting here, if it ever does lea chp.len(a0),a2 move.w #(jcb_end-chp.len)/4-1,d0 smsi_jclear clr.l (a2)+ dbra d0,smsi_jclear move.l sys_jbtb(a6),a1 ; job table move.l a0,(a1) ; job 0 move.l a1,sys_jbpt(a6) ; current job move.b #32,jcb_pinc(a0) ; priority 32 move.l sys_ertb(a6),jcb_exv(a0) ; exception redirection table lea jcb_end(a0),a6 lea sb.jobsz(a6),a1 move.l a1,usp move.w #$0700,sr ; go, but no interrupts yet!! smsi_job jsr init_ext ; initialise (SBASIC and) extensions trap #0 move.w sms_dlan+sms.conf,d1 ; default language moveq #0,d2 moveq #sms.lset,d0 ; set it trap #do.smsq moveq #0,d1 ; default tra moveq #0,d2 moveq #sms.trns,d0 trap #do.smsq move.l sms.sysb,a0 clr.w sys_chtg(a0) ; start channels at 0,0 moveq #0,d7 move.b sms_bwin+sms.conf,d7 swap d7 move.b sms_bflp+sms.conf,d7 move.l sms.sbjob,a0 and.w #$dfff,sr ; user mode jmp (a0) ; start job with config in d7 end
source/numerics/machine-w64-mingw32/s-ranini.ads
ytomino/drake
33
13448
pragma License (Unrestricted); -- implementation unit specialized for Windows with Ada.IO_Exceptions; with System.Storage_Elements; package System.Random_Initiators is pragma Preelaborate; procedure Get ( Item : Address; Size : Storage_Elements.Storage_Count); -- Exceptions Use_Error : exception renames Ada.IO_Exceptions.Use_Error; end System.Random_Initiators;
Transynther/x86/_processed/US/_st_4k_/i7-7700_9_0xca_notsx.log_8_440.asm
ljhsiun2/medusa
9
98729
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %r14 push %rax push %rcx lea addresses_WT_ht+0xd09e, %r14 nop nop nop nop nop and $47056, %r13 movb (%r14), %cl nop nop nop nop nop add $50601, %rax lea addresses_WC_ht+0x4d9e, %r11 xor $65339, %r14 mov $0x6162636465666768, %r10 movq %r10, %xmm0 and $0xffffffffffffffc0, %r11 vmovaps %ymm0, (%r11) cmp %r14, %r14 pop %rcx pop %rax pop %r14 pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r15 push %r8 push %r9 push %rax push %rsi // Store lea addresses_normal+0x11d9e, %r13 nop add %rsi, %rsi movw $0x5152, (%r13) nop nop and %rsi, %rsi // Store mov $0x39cc00000000019e, %rsi nop nop nop add %r9, %r9 mov $0x5152535455565758, %r10 movq %r10, (%rsi) nop nop nop nop nop xor %rax, %rax // Store lea addresses_WT+0x2d9e, %r10 nop nop nop nop nop xor $61547, %r15 mov $0x5152535455565758, %r8 movq %r8, %xmm5 vmovntdq %ymm5, (%r10) nop nop nop sub %r9, %r9 // Store lea addresses_UC+0x1859e, %r15 nop nop dec %rsi movb $0x51, (%r15) nop nop nop and $24137, %rax // Store lea addresses_WT+0xad9e, %r15 nop inc %rsi mov $0x5152535455565758, %r10 movq %r10, %xmm4 vmovups %ymm4, (%r15) nop nop nop add $1596, %rax // Faulty Load lea addresses_US+0x1059e, %r15 inc %rsi movb (%r15), %al lea oracles, %r13 and $0xff, %rax shlq $12, %rax mov (%r13,%rax,1), %rax pop %rsi pop %rax pop %r9 pop %r8 pop %r15 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 11, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'} {'dst': {'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 9, 'same': False, 'type': 'addresses_NC'}, 'OP': 'STOR'} {'dst': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 11, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 8, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'51': 8} 51 51 51 51 51 51 51 51 */
src/log_filter.ads
Lyaaaaaaaaaaaaaaa/Lyaaaaa-s-Log-Filters
1
21875
<gh_stars>1-10 ---------------------------------------------------------- -- Copyright (c), The MIT License (MIT) -- Author: Lyaaaaaaaaaaaaaaa -- -- Revision History: -- 18/09/2019 Lyaaaaaaaaaaaaaaa -- - Added file header -- - Filter_Check becomes Check_Filters -- -- Encoding issues : -- - Needs UTF-8 encoded files, -- otherwise it will return wrong data. -- -- Limitations : -- - Filters can't be longer than 40 characters. -- See array_line_control 's range in Create_Filters. -- See Filters in Create_Filters and its subtype. ---------------------------------------------------------- with Text_IO; use Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Text_IO.Unbounded_IO; with Ada.Characters.Handling; use Ada.Characters.Handling; ---------------------------------------------------------- package Log_Filter is ---------------------------------------------------------- type Store_Filter is array (Natural range <>, Natural range <>) of Character; type Store_Filters_State is array (Natural range <>) of Boolean; ---------------------------------------------------------- -------------------------------------------- -- Procedures and functions -- -------------------------------------------- ------------------- -- Filters -- ------------------- procedure Create_Filters (P_Number_Of_Filters : Natural; P_User_Filters_Input : String; P_Last_Inputs_Position : Natural); -- Inserts into 2D table "Store_Filter" input words in lower case. -- Calls Read_File procedure Check_Filters (P_Filters : store_Filter; P_Number_Of_Filters : Natural; P_Word : String; P_Filters_State : in out store_Filters_State); -- Compares each filter with the words in current line. procedure Initialize_Filters_State (P_Value : Boolean; P_Filters_State : in out Store_Filters_State); procedure Set_Filters (P_Filters : String); -- Counts the received filters and calls Create_Filters ----------------- -- Lines -- ----------------- procedure Update_Lines; -- Updates Lines and Lines_Count. procedure Read_Line (P_Filters : Store_Filter; P_Number_Of_Filters : Natural; P_Filters_State : in out Store_Filters_State); -- Reads Line character by character and inserts them into strings "Word" -- Then, calls Check_Filters. procedure Reset_Lines; procedure Reset_Lines_Count; function Get_Lines return String; function Get_Lines_Count return Integer; ---------------- -- File -- ---------------- procedure Read_File (P_Filters : Store_Filter; P_Number_Of_Filters : Natural); -- Inserts into Line the current line from the selected file. -- Calls Initialize_Filters_State and Read_Line, -- then checks Filter_State and calls Update_Lines. procedure Select_File (P_File : String); procedure Close_File; function Get_File_Name return String; ----------------- -- Other -- ----------------- function Are_They_All_True (P_Filters_State : Store_Filters_State) return Boolean; end Log_Filter;
Validation/pyFrame3DD-master/gcc-master/gcc/ada/xoscons.adb
djamal2727/Main-Bearing-Analytical-Model
0
27064
------------------------------------------------------------------------------ -- -- -- GNAT SYSTEM UTILITIES -- -- -- -- X O S C O N S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2008-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. 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 COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- The base name of the template file is given by Argument (1). This program -- generates the spec for this specified unit (let's call it UNIT_NAME). -- It works in conjunction with a C template file which must be preprocessed -- and compiled using the cross compiler. Two input files are used: -- - the preprocessed C file: UNIT_NAME-tmplt.i -- - the generated assembly file: UNIT_NAME-tmplt.s -- The generated files are UNIT_NAME.ads and UNIT_NAME.h with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Command_Line; use Ada.Command_Line; with Ada.Exceptions; use Ada.Exceptions; with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Maps; use Ada.Strings.Maps; with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; with Ada.Text_IO; use Ada.Text_IO; pragma Warnings (Off); -- System.Unsigned_Types is an internal GNAT unit with System.Unsigned_Types; use System.Unsigned_Types; pragma Warnings (On); with GNAT.OS_Lib; with GNAT.String_Split; use GNAT.String_Split; with GNAT.Table; with XUtil; use XUtil; procedure XOSCons is use Ada.Strings; Unit_Name : constant String := Argument (1); Tmpl_Name : constant String := Unit_Name & "-tmplt"; ------------------------------------------------- -- Information retrieved from assembly listing -- ------------------------------------------------- type String_Access is access all String; -- Note: we can't use GNAT.Strings for this definition, since that unit -- is not available in older base compilers. -- We need to deal with integer values that can be signed or unsigned, so -- we need to accommodate the maximum range of both cases. type Int_Value_Type is record Positive : Boolean; Abs_Value : Long_Unsigned := 0; end record; function ">" (V1, V2 : Int_Value_Type) return Boolean; function "<" (V1, V2 : Int_Value_Type) return Boolean; type Asm_Info_Kind is (CND, -- Named number (decimal) CNU, -- Named number (decimal, unsigned) CNS, -- Named number (freeform text) C, -- Constant object SUB, -- Subtype TXT); -- Literal text -- Recognized markers found in assembly file. These markers are produced by -- the same-named macros from the C template. subtype Asm_Int_Kind is Asm_Info_Kind range CND .. CNU; -- Asm_Info_Kind values with int values in input subtype Named_Number is Asm_Info_Kind range CND .. CNS; -- Asm_Info_Kind values with named numbers in output type Asm_Info (Kind : Asm_Info_Kind := TXT) is record Line_Number : Integer; -- Line number in C source file Constant_Name : String_Access; -- Name of constant to be defined Constant_Type : String_Access; -- Type of constant (case of Kind = C) Value_Len : Natural := 0; -- Length of text representation of constant's value Text_Value : String_Access; -- Value for CNS / C constant Int_Value : Int_Value_Type; -- Value for CND / CNU constant Comment : String_Access; -- Additional descriptive comment for constant, or free-form text (TXT) end record; package Asm_Infos is new GNAT.Table (Table_Component_Type => Asm_Info, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 100, Table_Increment => 10); Max_Constant_Name_Len : Natural := 0; Max_Constant_Value_Len : Natural := 0; Max_Constant_Type_Len : Natural := 0; -- Lengths of longest name and longest value Size_Of_Unsigned_Int : Integer := 0; -- Size of unsigned int on target type Language is (Lang_Ada, Lang_C); function Parse_Int (S : String; K : Asm_Int_Kind) return Int_Value_Type; -- Parse a decimal number, preceded by an optional '$' or '#' character, -- and return its value. procedure Output_Info (Lang : Language; OFile : Sfile; Info_Index : Integer); -- Output information from the indicated asm info line procedure Parse_Asm_Line (Line : String); -- Parse one information line from the assembly source function Contains_Template_Name (S : String) return Boolean; -- True if S contains Tmpl_Name, possibly with different casing function Spaces (Count : Integer) return String; -- If Count is positive, return a string of Count spaces, else return -- an empty string. --------- -- ">" -- --------- function ">" (V1, V2 : Int_Value_Type) return Boolean is P1 : Boolean renames V1.Positive; P2 : Boolean renames V2.Positive; A1 : Long_Unsigned renames V1.Abs_Value; A2 : Long_Unsigned renames V2.Abs_Value; begin return (P1 and then not P2) or else (P1 and then A1 > A2) or else (not P1 and then not P2 and then A1 < A2); end ">"; --------- -- "<" -- --------- function "<" (V1, V2 : Int_Value_Type) return Boolean is begin return not (V1 > V2) and then not (V1 = V2); end "<"; ---------------------------- -- Contains_Template_Name -- ---------------------------- function Contains_Template_Name (S : String) return Boolean is begin if Index (Source => To_Lower (S), Pattern => Tmpl_Name) > 0 then return True; else return False; end if; end Contains_Template_Name; ----------------- -- Output_Info -- ----------------- procedure Output_Info (Lang : Language; OFile : Sfile; Info_Index : Integer) is Info : Asm_Info renames Asm_Infos.Table (Info_Index); procedure Put (S : String); -- Write S to OFile --------- -- Put -- --------- procedure Put (S : String) is begin Put (OFile, S); end Put; -- Start of processing for Output_Info begin case Info.Kind is when TXT => -- Handled in the common code for comments below null; when SUB => case Lang is when Lang_Ada => Put (" subtype " & Info.Constant_Name.all & " is " & Info.Text_Value.all & ";"); when Lang_C => Put ("#define " & Info.Constant_Name.all & " " & Info.Text_Value.all); end case; when others => -- All named number cases case Lang is when Lang_Ada => Put (" " & Info.Constant_Name.all); Put (Spaces (Max_Constant_Name_Len - Info.Constant_Name'Length)); if Info.Kind in Named_Number then Put (" : constant := "); else Put (" : constant " & Info.Constant_Type.all); Put (Spaces (Max_Constant_Type_Len - Info.Constant_Type'Length)); Put (" := "); end if; when Lang_C => Put ("#define " & Info.Constant_Name.all & " "); Put (Spaces (Max_Constant_Name_Len - Info.Constant_Name'Length)); end case; if Info.Kind in Asm_Int_Kind then if not Info.Int_Value.Positive then Put ("-"); end if; Put (Trim (Info.Int_Value.Abs_Value'Img, Side => Left)); else declare Is_String : constant Boolean := Info.Kind = C and then Info.Constant_Type.all = "String"; begin if Is_String then Put (""""); end if; Put (Info.Text_Value.all); if Is_String then Put (""""); end if; end; end if; if Lang = Lang_Ada then Put (";"); if Info.Comment'Length > 0 then Put (Spaces (Max_Constant_Value_Len - Info.Value_Len)); Put (" -- "); end if; end if; end case; if Lang = Lang_Ada then Put (Info.Comment.all); end if; New_Line (OFile); end Output_Info; -------------------- -- Parse_Asm_Line -- -------------------- procedure Parse_Asm_Line (Line : String) is Index1, Index2 : Integer := Line'First; function Field_Alloc return String_Access; -- Allocate and return a copy of Line (Index1 .. Index2 - 1) procedure Find_Colon (Index : in out Integer); -- Increment Index until the next colon in Line ----------------- -- Field_Alloc -- ----------------- function Field_Alloc return String_Access is begin return new String'(Line (Index1 .. Index2 - 1)); end Field_Alloc; ---------------- -- Find_Colon -- ---------------- procedure Find_Colon (Index : in out Integer) is begin loop Index := Index + 1; exit when Index > Line'Last or else Line (Index) = ':'; end loop; end Find_Colon; -- Start of processing for Parse_Asm_Line begin Find_Colon (Index2); declare Info : Asm_Info (Kind => Asm_Info_Kind'Value (Line (Line'First .. Index2 - 1))); begin Index1 := Index2 + 1; Find_Colon (Index2); Info.Line_Number := Integer (Parse_Int (Line (Index1 .. Index2 - 1), CNU).Abs_Value); case Info.Kind is when C | CND | CNS | CNU | SUB => Index1 := Index2 + 1; Find_Colon (Index2); Info.Constant_Name := Field_Alloc; if Info.Kind /= SUB and then Info.Constant_Name'Length > Max_Constant_Name_Len then Max_Constant_Name_Len := Info.Constant_Name'Length; end if; Index1 := Index2 + 1; Find_Colon (Index2); if Info.Kind = C then Info.Constant_Type := Field_Alloc; if Info.Constant_Type'Length > Max_Constant_Type_Len then Max_Constant_Type_Len := Info.Constant_Type'Length; end if; Index1 := Index2 + 1; Find_Colon (Index2); end if; if Info.Kind = CND or else Info.Kind = CNU then Info.Int_Value := Parse_Int (Line (Index1 .. Index2 - 1), Info.Kind); Info.Value_Len := Info.Int_Value.Abs_Value'Img'Length - 1; if not Info.Int_Value.Positive then Info.Value_Len := Info.Value_Len + 1; end if; else Info.Text_Value := Field_Alloc; Info.Value_Len := Info.Text_Value'Length; end if; if Info.Constant_Name.all = "SIZEOF_unsigned_int" then Size_Of_Unsigned_Int := 8 * Integer (Info.Int_Value.Abs_Value); end if; when others => null; end case; Index1 := Index2 + 1; Index2 := Line'Last + 1; Info.Comment := Field_Alloc; if Info.Kind = TXT then Info.Text_Value := Info.Comment; -- Update Max_Constant_Value_Len, but only if this constant has a -- comment (else the value is allowed to be longer). elsif Info.Comment'Length > 0 then if Info.Value_Len > Max_Constant_Value_Len then Max_Constant_Value_Len := Info.Value_Len; end if; end if; Asm_Infos.Append (Info); end; exception when E : others => Put_Line (Standard_Error, "can't parse " & Line); Put_Line (Standard_Error, "exception raised: " & Exception_Information (E)); end Parse_Asm_Line; ---------------- -- Parse_Cond -- ---------------- procedure Parse_Cond (If_Line : String; Cond : Boolean; Tmpl_File : Ada.Text_IO.File_Type; Ada_Ofile, C_Ofile : Sfile; Current_Line : in out Integer) is function Get_Value (Name : String) return Int_Value_Type; -- Returns the value of the variable Name --------------- -- Get_Value -- --------------- function Get_Value (Name : String) return Int_Value_Type is begin if Is_Subset (To_Set (Name), Decimal_Digit_Set) then return Parse_Int (Name, CND); else for K in 1 .. Asm_Infos.Last loop if Asm_Infos.Table (K).Constant_Name /= null then if Name = Asm_Infos.Table (K).Constant_Name.all then return Asm_Infos.Table (K).Int_Value; end if; end if; end loop; -- Not found returns 0 return (True, 0); end if; end Get_Value; -- Local variables Sline : Slice_Set; Line : String (1 .. 256); Last : Integer; Value1 : Int_Value_Type; Value2 : Int_Value_Type; Res : Boolean; -- Start of processing for Parse_Cond begin Create (Sline, If_Line, " "); if Slice_Count (Sline) /= 4 then Put_Line (Standard_Error, "can't parse " & If_Line); end if; Value1 := Get_Value (Slice (Sline, 2)); Value2 := Get_Value (Slice (Sline, 4)); pragma Annotate (CodePeer, Modified, Value1); pragma Annotate (CodePeer, Modified, Value2); if Slice (Sline, 3) = ">" then Res := Cond and (Value1 > Value2); elsif Slice (Sline, 3) = "<" then Res := Cond and (Value1 < Value2); elsif Slice (Sline, 3) = "=" then Res := Cond and (Value1 = Value2); elsif Slice (Sline, 3) = "/=" then Res := Cond and (Value1 /= Value2); else -- No other operator can be used Put_Line (Standard_Error, "unknown operator in " & If_Line); Res := False; end if; Current_Line := Current_Line + 1; loop Get_Line (Tmpl_File, Line, Last); Current_Line := Current_Line + 1; exit when Line (1 .. Last) = "@END_IF"; if Last > 4 and then Line (1 .. 4) = "@IF " then Parse_Cond (Line (1 .. Last), Res, Tmpl_File, Ada_Ofile, C_Ofile, Current_Line); elsif Line (1 .. Last) = "@ELSE" then Res := Cond and not Res; elsif Res then Put_Line (Ada_OFile, Line (1 .. Last)); Put_Line (C_OFile, Line (1 .. Last)); end if; end loop; end Parse_Cond; --------------- -- Parse_Int -- --------------- function Parse_Int (S : String; K : Asm_Int_Kind) return Int_Value_Type is First : Integer := S'First; Result : Int_Value_Type; begin -- On some platforms, immediate integer values are prefixed with -- a $ or # character in assembly output. if S (First) = '$' or else S (First) = '#' then First := First + 1; end if; if S (First) = '-' then Result.Positive := False; First := First + 1; else Result.Positive := True; end if; Result.Abs_Value := Long_Unsigned'Value (S (First .. S'Last)); if not Result.Positive and then K = CNU then -- Negative value, but unsigned expected: take 2's complement -- reciprocical value. Result.Abs_Value := ((not Result.Abs_Value) + 1) and (Shift_Left (1, Size_Of_Unsigned_Int) - 1); Result.Positive := True; end if; return Result; exception when others => Put_Line (Standard_Error, "can't parse decimal value: " & S); raise; end Parse_Int; ------------ -- Spaces -- ------------ function Spaces (Count : Integer) return String is begin if Count <= 0 then return ""; else return (1 .. Count => ' '); end if; end Spaces; -- Local declarations -- Input files Tmpl_File_Name : constant String := Tmpl_Name & ".i"; Asm_File_Name : constant String := Tmpl_Name & ".s"; -- Output files Ada_File_Name : constant String := Unit_Name & ".ads"; C_File_Name : constant String := Unit_Name & ".h"; Asm_File : Ada.Text_IO.File_Type; Tmpl_File : Ada.Text_IO.File_Type; Ada_OFile : Sfile; C_OFile : Sfile; Line : String (1 .. 256); Last : Integer; -- Line being processed Current_Line : Integer; Current_Info : Integer; In_Comment : Boolean; In_Template : Boolean := False; -- Start of processing for XOSCons begin -- Load values from assembly file Open (Asm_File, In_File, Asm_File_Name); while not End_Of_File (Asm_File) loop Get_Line (Asm_File, Line, Last); if Last > 2 and then Line (1 .. 2) = "->" then Parse_Asm_Line (Line (3 .. Last)); end if; end loop; Close (Asm_File); -- Load C template and output definitions Open (Tmpl_File, In_File, Tmpl_File_Name); Create (Ada_OFile, Out_File, Ada_File_Name); Create (C_OFile, Out_File, C_File_Name); Current_Line := 0; Current_Info := Asm_Infos.First; In_Comment := False; while not End_Of_File (Tmpl_File) loop <<Get_One_Line>> Get_Line (Tmpl_File, Line, Last); if Last >= 2 and then Line (1 .. 2) = "# " then declare Index : Integer; begin Index := 3; while Index <= Last and then Line (Index) in '0' .. '9' loop Index := Index + 1; end loop; if Contains_Template_Name (Line (Index + 1 .. Last)) then Current_Line := Integer'Value (Line (3 .. Index - 1)); In_Template := True; goto Get_One_Line; else In_Template := False; end if; end; elsif In_Template then if In_Comment then if Line (1 .. Last) = "*/" then Put_Line (C_OFile, Line (1 .. Last)); In_Comment := False; elsif Last > 4 and then Line (1 .. 4) = "@IF " then Parse_Cond (Line (1 .. Last), True, Tmpl_File, Ada_Ofile, C_Ofile, Current_Line); else Put_Line (Ada_OFile, Line (1 .. Last)); Put_Line (C_OFile, Line (1 .. Last)); end if; elsif Line (1 .. Last) = "/*" then Put_Line (C_OFile, Line (1 .. Last)); In_Comment := True; elsif Asm_Infos.Table (Current_Info).Line_Number = Current_Line then if Fixed.Index (Line, "/*NOGEN*/") = 0 then Output_Info (Lang_Ada, Ada_OFile, Current_Info); Output_Info (Lang_C, C_OFile, Current_Info); end if; Current_Info := Current_Info + 1; end if; Current_Line := Current_Line + 1; end if; end loop; Close (Tmpl_File); exception when E : others => Put_Line ("raised " & Ada.Exceptions.Exception_Information (E)); GNAT.OS_Lib.OS_Exit (1); end XOSCons;
IPC/Syntax/Common.agda
mietek/hilbert-gentzen
29
380
<reponame>mietek/hilbert-gentzen -- Intuitionistic propositional calculus. -- Common syntax. module IPC.Syntax.Common where open import Common.Context public -- Types, or propositions. infixl 9 _∧_ infixl 8 _∨_ infixr 7 _▻_ data Ty : Set where α_ : Atom → Ty _▻_ : Ty → Ty → Ty _∧_ : Ty → Ty → Ty ⊤ : Ty ⊥ : Ty _∨_ : Ty → Ty → Ty -- Additional useful types. ¬_ : Ty → Ty ¬ A = A ▻ ⊥ infix 7 _▻◅_ _▻◅_ : Ty → Ty → Ty A ▻◅ B = (A ▻ B) ∧ (B ▻ A) infixr 7 _▻⋯▻_ _▻⋯▻_ : Cx Ty → Ty → Ty ∅ ▻⋯▻ B = B (Ξ , A) ▻⋯▻ B = Ξ ▻⋯▻ (A ▻ B) infixr 7 _▻⋯▻⋆_ _▻⋯▻⋆_ : Cx Ty → Cx Ty → Ty Γ ▻⋯▻⋆ ∅ = ⊤ Γ ▻⋯▻⋆ (Ξ , A) = (Γ ▻⋯▻⋆ Ξ) ∧ (Γ ▻⋯▻ A) -- Inversion principles. invα : ∀ {P P′} → α P ≡ α P′ → P ≡ P′ invα refl = refl inv▻₁ : ∀ {A A′ B B′} → A ▻ B ≡ A′ ▻ B′ → A ≡ A′ inv▻₁ refl = refl inv▻₂ : ∀ {A A′ B B′} → A ▻ B ≡ A′ ▻ B′ → B ≡ B′ inv▻₂ refl = refl inv∧₁ : ∀ {A A′ B B′} → A ∧ B ≡ A′ ∧ B′ → A ≡ A′ inv∧₁ refl = refl inv∧₂ : ∀ {A A′ B B′} → A ∧ B ≡ A′ ∧ B′ → B ≡ B′ inv∧₂ refl = refl inv∨₁ : ∀ {A A′ B B′} → A ∨ B ≡ A′ ∨ B′ → A ≡ A′ inv∨₁ refl = refl inv∨₂ : ∀ {A A′ B B′} → A ∨ B ≡ A′ ∨ B′ → B ≡ B′ inv∨₂ refl = refl -- Decidable equality on types. _≟ᵀ_ : (A A′ : Ty) → Dec (A ≡ A′) (α P) ≟ᵀ (α P′) with P ≟ᵅ P′ (α P) ≟ᵀ (α .P) | yes refl = yes refl (α P) ≟ᵀ (α P′) | no P≢P′ = no (P≢P′ ∘ invα) (α P) ≟ᵀ (A′ ▻ B′) = no λ () (α P) ≟ᵀ (A′ ∧ B′) = no λ () (α P) ≟ᵀ ⊤ = no λ () (α P) ≟ᵀ ⊥ = no λ () (α P) ≟ᵀ (A′ ∨ B′) = no λ () (A ▻ B) ≟ᵀ (α P′) = no λ () (A ▻ B) ≟ᵀ (A′ ▻ B′) with A ≟ᵀ A′ | B ≟ᵀ B′ (A ▻ B) ≟ᵀ (.A ▻ .B) | yes refl | yes refl = yes refl (A ▻ B) ≟ᵀ (A′ ▻ B′) | no A≢A′ | _ = no (A≢A′ ∘ inv▻₁) (A ▻ B) ≟ᵀ (A′ ▻ B′) | _ | no B≢B′ = no (B≢B′ ∘ inv▻₂) (A ▻ B) ≟ᵀ (A′ ∧ B′) = no λ () (A ▻ B) ≟ᵀ ⊤ = no λ () (A ▻ B) ≟ᵀ ⊥ = no λ () (A ▻ B) ≟ᵀ (A′ ∨ B′) = no λ () (A ∧ B) ≟ᵀ (α P′) = no λ () (A ∧ B) ≟ᵀ (A′ ▻ B′) = no λ () (A ∧ B) ≟ᵀ (A′ ∧ B′) with A ≟ᵀ A′ | B ≟ᵀ B′ (A ∧ B) ≟ᵀ (.A ∧ .B) | yes refl | yes refl = yes refl (A ∧ B) ≟ᵀ (A′ ∧ B′) | no A≢A′ | _ = no (A≢A′ ∘ inv∧₁) (A ∧ B) ≟ᵀ (A′ ∧ B′) | _ | no B≢B′ = no (B≢B′ ∘ inv∧₂) (A ∧ B) ≟ᵀ ⊤ = no λ () (A ∧ B) ≟ᵀ ⊥ = no λ () (A ∧ B) ≟ᵀ (A′ ∨ B′) = no λ () ⊤ ≟ᵀ (α P′) = no λ () ⊤ ≟ᵀ (A′ ▻ B′) = no λ () ⊤ ≟ᵀ (A′ ∧ B′) = no λ () ⊤ ≟ᵀ ⊤ = yes refl ⊤ ≟ᵀ ⊥ = no λ () ⊤ ≟ᵀ (A′ ∨ B′) = no λ () ⊥ ≟ᵀ (α P′) = no λ () ⊥ ≟ᵀ (A′ ▻ B′) = no λ () ⊥ ≟ᵀ (A′ ∧ B′) = no λ () ⊥ ≟ᵀ ⊤ = no λ () ⊥ ≟ᵀ ⊥ = yes refl ⊥ ≟ᵀ (A′ ∨ B′) = no λ () (A ∨ B) ≟ᵀ (α P′) = no λ () (A ∨ B) ≟ᵀ (A′ ▻ B′) = no λ () (A ∨ B) ≟ᵀ (A′ ∧ B′) = no λ () (A ∨ B) ≟ᵀ ⊤ = no λ () (A ∨ B) ≟ᵀ ⊥ = no λ () (A ∨ B) ≟ᵀ (A′ ∨ B′) with A ≟ᵀ A′ | B ≟ᵀ B′ (A ∨ B) ≟ᵀ (.A ∨ .B) | yes refl | yes refl = yes refl (A ∨ B) ≟ᵀ (A′ ∨ B′) | no A≢A′ | _ = no (A≢A′ ∘ inv∨₁) (A ∨ B) ≟ᵀ (A′ ∨ B′) | _ | no B≢B′ = no (B≢B′ ∘ inv∨₂) open ContextEquality (_≟ᵀ_) public
libsrc/_DEVELOPMENT/alloc/malloc/z80/asm_heap_info.asm
meesokim/z88dk
0
27719
<gh_stars>0 ; =============================================================== ; Apr 2014 ; =============================================================== ; ; void heap_info(void *heap, void *callback) ; ; Visit each block in the heap and pass information about ; the block to the callback function. ; ; =============================================================== INCLUDE "clib_cfg.asm" SECTION code_alloc_malloc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IF __CLIB_OPT_MULTITHREAD & $01 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PUBLIC asm_heap_info EXTERN asm_heap_info_unlocked EXTERN __heap_lock_acquire, __heap_lock_release_0, error_enolck_zc asm_heap_info: ; enter : ix = void *callback ; de = void *heap ; ; exit : none ; ; uses : af, bc, de, hl + callback call __heap_lock_acquire jp c, error_enolck_zc push de ; save void *heap call asm_heap_info_unlocked jp __heap_lock_release_0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELSE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PUBLIC asm_heap_info EXTERN asm_heap_info_unlocked defc asm_heap_info = asm_heap_info_unlocked ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ENDIF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1964.asm
ljhsiun2/medusa
9
244704
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r15 push %r8 push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x1cea6, %r10 nop nop nop nop cmp %r15, %r15 movw $0x6162, (%r10) nop nop nop nop add %rcx, %rcx lea addresses_WC_ht+0x14a66, %r14 nop nop nop nop nop dec %r8 movl $0x61626364, (%r14) nop nop nop nop nop sub %r14, %r14 lea addresses_D_ht+0xbdb6, %rcx nop nop nop nop nop sub $56045, %r13 mov $0x6162636465666768, %r14 movq %r14, %xmm3 vmovups %ymm3, (%rcx) nop nop nop add $18605, %r15 lea addresses_A_ht+0xeca6, %rsi lea addresses_D_ht+0xb7a6, %rdi nop nop nop nop nop and $45993, %r15 mov $38, %rcx rep movsl nop nop xor $60329, %r8 lea addresses_normal_ht+0xe4a6, %r8 nop nop nop nop nop xor $62515, %rsi mov (%r8), %r10w nop nop nop nop dec %r10 lea addresses_A_ht+0xe306, %rcx inc %rdx movb (%rcx), %r10b nop sub %r13, %r13 lea addresses_WC_ht+0xe49a, %rsi lea addresses_WT_ht+0xb26, %rdi nop nop nop dec %r8 mov $56, %rcx rep movsw nop nop add %r10, %r10 lea addresses_WT_ht+0x121b2, %r14 clflush (%r14) nop nop nop nop nop inc %r13 vmovups (%r14), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $0, %xmm7, %rsi sub %r13, %r13 lea addresses_normal_ht+0x15f66, %rsi nop sub $44258, %rdx movl $0x61626364, (%rsi) nop xor %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %r8 pop %r15 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r14 push %r15 push %r8 push %rax push %rbp push %rdi // Store lea addresses_A+0x19fe3, %rbp cmp $16884, %rax mov $0x5152535455565758, %r14 movq %r14, (%rbp) nop nop nop add %r14, %r14 // Faulty Load lea addresses_WC+0x190a6, %rdi clflush (%rdi) nop nop cmp $42066, %r15 mov (%rdi), %r8 lea oracles, %r14 and $0xff, %r8 shlq $12, %r8 mov (%r14,%r8,1), %r8 pop %rdi pop %rbp pop %rax pop %r8 pop %r15 pop %r14 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_WC', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_WC', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'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 */
Driver/Socket/TCPIP/tcpipDhcp.asm
steakknife/pcgeos
504
242248
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GlobalPC 2000. All rights reserved. GLOBALPC CONFIDENTIAL PROJECT: PC GEOS MODULE: TCP/IP Driver FILE: tcpipDhcp.asm AUTHOR: <NAME>., Jun 15, 2000 ROUTINES: Name Description ---- ----------- TcpipStartDhcp Starts the DHCP process TcpipDhcpBuildPacket Allocates packet and fills in header info TcpipDhcpGetHWAddr Gets the hardware address of local machine TcpipBuildSockAddr Fills in a SocketAddress struct TcpipDhcpCheckIfInUse Checks if an IP address is in use TcpipDhcpValidateResponse Checks validity of incoming packet TcpipDhcpThreadStart Fixed code, called on thread creation TcpipDhcpCopyServerID Searches for a server id in a DHCP packet, and if found, copies it to another packet TcpipDhcpParseAndSendNotification Parses an incoming DHCP packet for useful info, send out GCN notification, and inform the resolver of DNS servers. TCPIPDHCPHANDLERENEW Called from C method handler, handles lease renewal, status notifications TcpipDhcpBuildRenewPakcet Builds a packet to renew a DHCP lease TCPIPDHCPLEASEEXPIRED Called from C method handler when the DHCP lease expires without being successfully renewed. Closes the link and sends notification via GCN. REVISION HISTORY: Name Date Description ---- ---- ----------- ed 6/15/00 Initial revision DESCRIPTION: TCP/IP Dynamic Host Configuration Protocol support. $Id$ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SetGeosConvention DhcpCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipStartDhcp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Creates a new thread and runs DHCP on it CALLED BY: TcpipLinkOpened PASS: nothing RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ed 6/28/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipStartDhcp proc far uses ax,bx,cx,dx,si,di,bp .enter mov al, PRIORITY_STANDARD mov di, 1000 ; Guessing stack size mov bp, handle 0 mov bx, dx mov cx, vseg TcpipDoDhcp mov dx, offset TcpipDoDhcp call ThreadCreate .leave ret TcpipStartDhcp endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipDoDhcp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Begins the DHCP process CALLED BY: ThreadCreate PASS: cx - domain handle (for LCB) RETURN: cx, dx clear DESTROYED: whatever we want SIDE EFFECTS: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ed 6/15/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipDoDhcp proc far domainHandle local word push cx resolvedAddr local TcpAccPntResolvedAddress sockAddr local SocketAddress sock local Socket outboundMH local hptr recvMH local hptr recv2MH local hptr requestMH local hptr startTime local dword retries local word retries2 local word ; On own thread, so don't care about registers ; uses ax, bx, cx, dx, di, si, ds, es .enter CheckHack <offset resolvedAddr eq (offset sockAddr + size SocketAddress)> clr recvMH clr requestMH ; Create the socket mov al, SDT_DATAGRAM call SocketCreate LONG jc socketError mov sock, bx ; Bind the socket mov cx, MANUFACTURER_ID_SOCKET_16BIT_PORT mov dx, DHCP_CLIENT_PORT push bp clr bp call SocketBind pop bp LONG jc closeSocket ; Connect the socket segmov es, ss, di lea di, sockAddr call TcpipBuildSockAddr movdw ({dword}resolvedAddr.TAPRA_ipAddr), 0FFFFFFFFh ; broadcast ip mov sockAddr.SA_port.SP_port, DHCP_SERVER_PORT push bp clr bp movdw cxdx, esdi call SocketConnect pop bp mov bx, handle Strings call MemUnlock LONG jc closeSocket ; store current thread handle mov bx, handle dgroup call MemDerefES mov bx, ss:[0].TPD_threadHandle mov es:[dhcpThread], bx ; Allocate space for a 2 receive buffers mov ax, MAX_DHCP_PACKET_SIZE mov cx, ALLOC_DYNAMIC_LOCK or (mask HAF_ZERO_INIT shl 8) call MemAlloc mov recvMH, bx mov ax, MAX_DHCP_PACKET_SIZE call MemAlloc mov recv2MH, bx ; Build the DHCP packet mov ax, SIZEOF_DMT_REQUEST call TcpipDhcpBuildPacket mov outboundMH, bx add si, offset DM_options + SIZEOF_DHCP_COOKIE mov {DHCPMessageOption}ds:[si], DMO_DHCP_MESSAGE_TYPE inc si mov {byte}ds:[si], 1 ; option length inc si mov {DHCPMessageType}ds:[si], DMT_DISCOVER inc si mov {DHCPMessageOption}ds:[si], DMO_PARAMETER_REQUEST inc si mov {byte}ds:[si], 6 ; requesting 6 options inc si mov {DHCPMessageOption}ds:[si], DMO_RENEWAL_TIME inc si mov {DHCPMessageOption}ds:[si], DMO_REBINDING_TIME inc si mov {DHCPMessageOption}ds:[si], DMO_LEASE_TIME inc si mov {DHCPMessageOption}ds:[si], DMO_SUBNET_MASK inc si mov {DHCPMessageOption}ds:[si], DMO_ROUTER inc si mov {DHCPMessageOption}ds:[si], DMO_DNS inc si mov {DHCPMessageOption}ds:[si], DMO_END EC < call ECCheckBounds > ; Store start time call TimerGetCount movdw startTime, bxax clr retries dhcpSend: ; Send DHCP DISCOVER packet ; mov cx, size DHCPMessage + 13 mov bx, outboundMH call MemDerefDS clr si ; This level of precision is fine, as DHCP will abort before running ; long enough to cause an overflow here. call TimerGetCount subdw bxax, startTime mov bl, 60 div bl clr ah mov ds:[si].DM_secs, ax mov cx, SIZEOF_DMT_REQUEST mov bx, sock clr ax call SocketSend ; Wait for a response dhcpRecvAgain: mov bx, recvMH call MemDerefES clr di mov bx, sock mov cx, MAX_DHCP_PACKET_SIZE clr ax push bp mov bp, DHCP_QUERY_TIMEOUT_BASE call SocketRecv pop bp mov dl, DMT_OFFER call TcpipDhcpValidateResponse jnc gotResponse dhcpTryAgain: cmp ax, SE_TIMED_OUT jne dhcpRecvAgain inc retries mov dx, retries cmp dx, MAX_DHCP_RETRIES LONG ja dhcpFailed mov ax, 60 call TimerSleep jmp dhcpSend gotResponse: movdw dxax, es:[0].DM_yiaddr call TcpipDhcpCheckIfInUse jnc ipIsGood ; Address in use. Decline it. pushdw cxbx push dx mov ax, SIZEOF_DMT_REQUEST call TcpipDhcpBuildPacket mov ax, bx pop dx popdw cxbx push ax movdw ds:[si].DM_yiaddr, dxbx add si, offset DM_options + SIZEOF_DHCP_COOKIE mov {DHCPMessageOption}ds:[si], DMO_DHCP_MESSAGE_TYPE inc si mov {byte}ds:[si], 1 ; option length inc si mov {DHCPMessageType}ds:[si], DMT_DECLINE inc si call TcpipDhcpCopyServerID mov {DHCPMessageOption}ds:[si], DMO_END EC < call ECCheckBounds > clr si mov ax, es:[0].DM_secs mov ds:[si].DM_secs, ax mov bx, sock clr si mov cx, SIZEOF_DMT_DECLINE clr ax call SocketSend pop bx call MemFree jmp dhcpTryAgain ipIsGood: ; Send out a DHCP REQUEST packet to take the address offered to us. mov ax, SIZEOF_DMT_REQUEST tst requestMH jnz alreadyAllocedRequest call TcpipDhcpBuildPacket mov requestMH, bx alreadyAllocedRequest: movdw ds:[si].DM_siaddr, es:[0].DM_siaddr, bx add si, offset DM_options + SIZEOF_DHCP_COOKIE mov {DHCPMessageOption}ds:[si], DMO_DHCP_MESSAGE_TYPE inc si mov {byte}ds:[si], 1 ; option length inc si mov {DHCPMessageType}ds:[si], DMT_REQUEST inc si mov {DHCPMessageOption}ds:[si], DMO_REQUESTED_IP inc si mov {byte}ds:[si], 4 ; option length inc si movdw ds:[si], es:[0].DM_yiaddr, ax add si, 4 mov {DHCPMessageOption}ds:[si], DMO_END EC < call ECCheckBounds > clr retries2 dhcpSendRequest: mov bx, requestMH call MemDerefDS clr si mov bx, sock mov cx, SIZEOF_DMT_REQUEST clr ax call SocketSend ; Wait for a response dhcpRequestRecv: mov bx, recv2MH call MemDerefES mov bx, sock mov cx, MAX_DHCP_PACKET_SIZE clr ax push bp mov bp, DHCP_QUERY_TIMEOUT_BASE call SocketRecv pop bp mov dl, DMT_NAK call TcpipDhcpValidateResponse LONG jnc dhcpTryAgain mov dl, DMT_ACK clc call TcpipDhcpValidateResponse jnc dhcpRequestValid cmp ax, SE_TIMED_OUT jne dhcpRequestRecv inc retries2 cmp retries2, MAX_DHCP_RETRIES ja dhcpFailed mov ax, 60 call TimerSleep jmp dhcpSendRequest dhcpRequestValid: mov bx, recvMH call MemDerefES clr bx call TcpipDhcpParseAndSendNotification jc dhcpFailed ; Don't do this here. Let the link driver do it in its GCN handler. ; Needs to be this way for sync reasons. if 0 mov bx, domainHandle call LinkTableGetEntry mov ax, ds:[di].LCB_connection call MemUnlockExcl mov di, SCO_LINK_OPENED segmov ds, es, si mov si, offset DM_yiaddr mov bx, domainHandle mov cx, size IPAddr call TcpipLinkOpened endif jmp dhcpFinished dhcpFailed: ; Build notification that DHCP failed mov ax, size TcpipDhcpNotificationData mov cx, ALLOC_DYNAMIC_LOCK or (mask HAF_ZERO_INIT shl 8) call MemAlloc mov ds, ax mov ds:[0].TDND_status, TDSNT_REQUEST_FAILED call MemUnlock mov ax, 1 call MemInitRefCount ; Record the message push bp mov bp, bx mov ax, MSG_META_NOTIFY_WITH_DATA_BLOCK clr bx, si mov cx, MANUFACTURER_ID_GEOWORKS mov dx, GWNT_TCPIP_DHCP_STATUS mov di, mask MF_RECORD call ObjMessage ; Send it to the GCN list mov bx, MANUFACTURER_ID_GEOWORKS mov ax, GCNSLT_TCPIP_STATUS_NOTIFICATIONS mov cx, di mov dx, bp clr bp call GCNListSend pop bp ; DHCP failed, so tell TCP the connection failed mov bx, domainHandle call LinkTableGetEntry mov ax, ds:[di].LCB_connection call MemUnlockExcl mov dx, SDE_LINK_OPEN_FAILED mov di, SCO_CONNECT_FAILED mov bx, domainHandle call TcpipLinkClosed dhcpFinished: ; Free buffers mov bx, outboundMH call MemFree tst recvMH jz noRecvMH mov bx, recvMH call MemFree mov bx, recv2MH call MemFree noRecvMH: tst requestMH jz closeSocket mov bx, requestMH call MemFree closeSocket: ; Close socket mov bx, sock call SocketClose ; Clear stored thread handle clr es:[dhcpThread] socketError: clr cx, dx .leave ret TcpipDoDhcp endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipDhcpBuildPacket %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Allocates a memory block for a DHCP packet, and fills in info required for all DHCP packets. CALLED BY: TcpipStartDhcp TcpipDhcpBuildRenewPacket PASS: ax - size of packet to allocate RETURN: bx - MemHandle of packet ds:si - DHCPMessage DESTROYED: ax, cx, dx, di SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ed 6/21/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipDhcpBuildPacket proc far uses es .enter mov bx, handle dgroup call MemDerefES mov cx, ALLOC_DYNAMIC_LOCK or (mask HAF_ZERO_INIT shl 8) call MemAlloc ; ax = segment, bx = handle push bx mov ds, ax clr si mov ds:[si].DM_op, BO_REQUEST cmpdw es:[dhcpCookie], 0 jne alreadyHaveCookie call NetGenerateRandom32 movdw es:[dhcpCookie], dxax alreadyHaveCookie: incdw es:[dhcpCookie] movdw ds:[si].DM_xid, es:[dhcpCookie], cx ; Set up hardware medium type push ds push si mov bx, handle Strings call MemLock mov ds, ax mov cx, ax mov dx, ds:[linkMediumTypeKeyString] mov si, ds:[categoryString] mov ax, 1 ; default to ethernet call InitFileReadInteger pop si pop ds mov ds:[si].DM_htype, al ; Get hardware address call TcpipDhcpGetHWAddr mov bx, handle Strings call MemUnlock movdw ({dword}ds:[si].DM_options), DHCP_PERMUTED_COOKIE pop bx .leave ret TcpipDhcpBuildPacket endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipDhcpGetHWAddr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Fills in the DM_chaddr field of a DHCP packet CALLED BY: TcpipDhcpBuildPacket PASS: ds:si - DHCPMessage RETURN: ds:[si].DM_chaddr filled in DESTROYED: ax, bx, cx, dx SIDE EFFECTS: PSEUDO CODE/STRATEGY: Does an ARP lookup on the loopback address (127.0.0.1). REVISION HISTORY: Name Date Description ---- ---- ----------- ed 6/21/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipDhcpGetHWAddr proc near ; these 2 structs must be consecutive mesg local fptr push ds, si resolvedAddr local TcpAccPntResolvedAddress sockAddr local SocketAddress uses di, es .enter CheckHack <offset resolvedAddr eq (offset sockAddr + size SocketAddress)> movdw mesg, dssi mov bx, handle dgroup call MemDerefDS pushdw ds:[dhcpStrategy] segmov es, ss, di lea di, sockAddr call TcpipBuildSockAddr movdw ({dword}resolvedAddr.TAPRA_ipAddr), 0100007Fh ; loopback ip mov cx, mesg.segment lea dx, ds:[si].DM_chaddr mov bx, size DM_chaddr movdw dssi, esdi mov ax, SE_NOT_IMPLEMENTED mov di, DR_SOCKET_RESOLVE_LINK_LEVEL_ADDRESS call PROCCALLFIXEDORMOVABLE_PASCAL cmp ax, SE_NORMAL je getAddrNoError clr bx getAddrNoError: movdw dssi, mesg mov ds:[si].DM_hlen, bl mov bx, handle Strings call MemUnlock .leave ret TcpipDhcpGetHWAddr endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipBuildSockAddr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: CALLED BY: TcpipStartDhcp TcpipDhcpCheckIfInUse TcpipDhcpGetHWAddr PASS: es:di - SocketAddress, followed by TcpAccPntResolvedAddress RETURN: nothing DESTROYED: nothing SIDE EFFECTS: Strings resource is locked on return. SocketAddress struct contains pointers into it. PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ed 6/21/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipBuildSockAddr proc near uses ax, bx, ds .enter mov bx, handle Strings call MemLock mov ds, ax mov es:[di].SA_port.SP_manuf, MANUFACTURER_ID_SOCKET_16BIT_PORT mov es:[di].SA_domain.segment, ds mov ax, ds:[tcpipDomainString] mov es:[di].SA_domain.offset, ax ChunkSizeHandle ds, tcpipDomainString, ax sub ax, size TCHAR ; don't count trailing null mov es:[di].SA_domainSize, ax mov es:[di].SA_addressSize, size TcpAccPntResolvedAddress mov ({TcpAccPntResolvedAddress}es:[di].SA_address).TAPRA_linkSize, 3 mov ({TcpAccPntResolvedAddress}es:[di].SA_address).TAPRA_linkType, LT_ID mov ({TcpAccPntResolvedAddress}es:[di].SA_address).TAPRA_accPntID, 1 .leave ret TcpipBuildSockAddr endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipDhcpCheckIfInUse %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks if the passed IP address is in use CALLED BY: TcpipStartDhcp PASS: dxax - ip address RETURN: carry set if ip in use DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: Calls link driver to do an ARP lookup on the IP address. If the driver gets a response, IP is in use, therefore exit with carry set. Otherwise, exit carry clear. REVISION HISTORY: Name Date Description ---- ---- ----------- ed 6/26/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipDhcpCheckIfInUse proc near ; these 2 structs must be consecutive resolvedAddr local TcpAccPntResolvedAddress sockAddr local SocketAddress uses ax, bx, cx, dx, si, di, ds, es .enter CheckHack <offset resolvedAddr eq (offset sockAddr + size SocketAddress)> mov bx, handle dgroup call MemDerefDS pushdw ds:[dhcpStrategy] segmov es, ss, di lea di, sockAddr call TcpipBuildSockAddr movdw ({dword}resolvedAddr.TAPRA_ipAddr), dxax clr bx clr cx clr dx movdw dssi, esdi mov ax, SE_NOT_IMPLEMENTED mov di, DR_SOCKET_RESOLVE_LINK_LEVEL_ADDRESS call PROCCALLFIXEDORMOVABLE_PASCAL mov bx, handle Strings call MemUnlock cmp ax, SE_NORMAL clc jne addrNotInUse stc addrNotInUse: .leave ret TcpipDhcpCheckIfInUse endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipDhcpValidateResponse %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks the return values of SocketRecv, and the packet that was read for errors. CALLED BY: TcpipStartDhcp PASS: ax - Socket Error dl - DHCP message type expected cx - buffer size es:di - buffer carry - As set by SocketRecv RETURN: carry set on error DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ed 6/27/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipDhcpValidateResponse proc near uses bx, dx, ds .enter jc validateDone cmp ax, SE_NORMAL jne invalid cmp cx, MIN_DHCP_PACKET_SIZE jb invalid cmp cx, MAX_DHCP_PACKET_SIZE ja invalid cmp es:[0].DM_op, BO_REPLY jne invalid cmpdw ({dword}es:[0].DM_options), DHCP_PERMUTED_COOKIE jne invalid mov bx, handle dgroup call MemDerefDS cmpdw ds:[dhcpCookie], es:[0].DM_xid, bx jne invalid ; Check for desired message type mov bx, offset DM_options + SIZEOF_DHCP_COOKIE validateLoop: cmp bx, cx je invalid cmp {DHCPMessageOption}es:[bx], DMO_PAD je skipPad cmp {DHCPMessageOption}es:[bx], DMO_DHCP_MESSAGE_TYPE je foundType cmp {DHCPMessageOption}es:[bx], DMO_END je invalid inc bx add bl, {byte}es:[bx] adc bh, 0 jmp validateLoop skipPad: inc bx jmp validateLoop foundType: add bx, size DHCPOptionCommon cmp {DHCPMessageType}es:[bx], dl jne invalid clc validateDone: .leave ret invalid: stc jmp validateDone TcpipDhcpValidateResponse endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipDhcpCopyServerID %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Looks for a DHCP server id in an incoming packet, and copies it into an outgoing packet. CALLED BY: TcpipDoDhcp PASS: es:0 - Source DHCP packet ds:si - Location in destination packet to put id RETURN: if server id found, si points after the server id info DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ed 6/29/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipDhcpCopyServerID proc near uses ax, bx .enter mov bx, offset DM_options findIDloop: cmp bx, cx jae notFound cmp {DHCPMessageOption}es:[bx], DMO_END je notFound cmp {DHCPMessageOption}es:[bx], DMO_PAD je skipPadding cmp {DHCPMessageOption}es:[bx], DMO_DHCP_SERVER_ID je foundServerID inc bx add bl, {byte}es:[di] adc bh, 0 jmp findIDloop skipPadding: inc di jmp findIDloop foundServerID: mov {DHCPMessageOption}ds:[si], DMO_DHCP_SERVER_ID inc si mov {byte}ds:[si], IP_ADDR_SIZE inc si add bx, size DHCPOptionCommon movdw ({dword}ds:[si]), ({dword}es:[bx]), ax add si, IP_ADDR_SIZE notFound: .leave ret TcpipDhcpCopyServerID endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipDhcpParseAndSendNotification %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Parses DHCP packet and sends out GCN notification of DHCP status. CALLED BY: TcpipDoDhcp TCPIPDHCPHANDLERENEW PASS: es:0 - DHCP Message bx - zero if parsing initial lease, non-zero if renewal cx - size of DHCP message RETURN: carry set if lease invalid DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ed 6/30/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipDhcpParseAndSendNotification proc near parsingRenew local word push bx renewTime local dword rebindTime local dword expireTime local dword serverIp local IPAddr uses ax, bx, cx, dx, si, di, ds .enter clr ax clrdw renewTime, ax clrdw rebindTime, ax clrdw expireTime, ax mov ax, size TcpipDhcpNotificationData push cx mov cx, ALLOC_DYNAMIC_LOCK or (mask HAF_ZERO_INIT shl 8) call MemAlloc pop cx mov ds, ax mov ds:[0].TDND_status, TDSNT_CONFIGURATION tst parsingRenew jz notRenew mov ds:[0].TDND_status, TDSNT_LEASE_RENEWED notRenew: movdw ({dword}ds:[0].TDND_ipAddr), es:[0].DM_yiaddr, ax push bx, cx, es push ds push offset TDND_leaseReceived call TIMERGETDATEANDTIME pop bx, cx, es mov di, offset DM_options + SIZEOF_DHCP_COOKIE clr dh ; Clear now so we can just set dl later findDataLoop: cmp di, cx LONG jae doneProcessing cmp {byte}es:[di], DMO_END LONG je doneProcessing cmp {byte}es:[di], DMO_PAD jne notPadding inc di jmp findDataLoop notPadding: tst parsingRenew jnz beginRenewalChecks cmp {byte}es:[di], DMO_SUBNET_MASK jne notSubnet add di, size DHCPOptionCommon movdw ({dword}ds:[0].TDND_netmask), ({dword}es:[di]), ax add di, IP_ADDR_SIZE jmp findDataLoop notSubnet: cmp {byte}es:[di], DMO_ROUTER jne notGateway inc di mov dl, es:[di] inc di movdw ({dword}ds:[0].TDND_gateway), ({dword}es:[di]), ax add di, IP_ADDR_SIZE jmp findDataLoop notGateway: cmp {byte}es:[di], DMO_DNS jne notDNS inc di mov dl, {byte}es:[di] inc di ifdef STATIC_LINK_RESOLVER call ResolverAddDhcpDnsServers else PrintMessage "DNS CONFIGURATION VIA DHCP NOT SUPPORTED" endif movdw ({dword}ds:[0].TDND_dns1), ({dword}es:[di]), ax add di, IP_ADDR_SIZE sub dl, IP_ADDR_SIZE LONG jz findDataLoop movdw ({dword}ds:[0].TDND_dns2), ({dword}es:[di]), ax add di, dx jmp findDataLoop notDNS: beginRenewalChecks: ; These four checks must be last, as they are the only ones we want ; to process when handling a renewal. cmp {byte}es:[di], DMO_DHCP_SERVER_ID jne notServerId add di, size DHCPOptionCommon mov ax, ({dword}es:[di]).low mov ({dword}ds:[0].TDND_dhcpServer).low, ax mov serverIp.low, ax mov ax, ({dword}es:[di]).high mov ({dword}ds:[0].TDND_dhcpServer).high, ax mov serverIp.high, ax add di, IP_ADDR_SIZE jmp findDataLoop notServerId: cmp {DHCPMessageOption}es:[di], DMO_RENEWAL_TIME jne notRenewalTime add di, size DHCPOptionCommon ; Stored in network byte order, we have to reverse it to Intel order mov ax, ({dword}es:[di]).high xchg al, ah mov renewTime.low, ax mov ax, ({dword}es:[di]).low xchg al, ah mov renewTime.high, ax add di, SIZEOF_DHCP_LEASE_TIME jmp findDataLoop notRenewalTime: cmp {DHCPMessageOption}es:[di], DMO_REBINDING_TIME jne notRebindTime add di, size DHCPOptionCommon ; Stored in network byte order, we have to reverse it to Intel order mov ax, ({dword}es:[di]).high xchg al, ah mov rebindTime.low, ax mov ax, ({dword}es:[di]).low xchg al, ah mov rebindTime.high, ax add di, SIZEOF_DHCP_LEASE_TIME jmp findDataLoop notRebindTime: cmp {DHCPMessageOption}es:[di], DMO_LEASE_TIME jne notLeaseTime add di, size DHCPOptionCommon ; Stored in network byte order, we have to reverse it to Intel order mov ax, ({dword}es:[di]).high xchg al, ah mov expireTime.low, ax mov ax, ({dword}es:[di]).low xchg al, ah mov expireTime.high, ax add di, SIZEOF_DHCP_LEASE_TIME jmp findDataLoop notLeaseTime: inc di mov al, es:[di] inc di clr ah add di, ax jmp findDataLoop doneProcessing: ; Test to ensure we have valid renew, rebind, and lease times. tstdw expireTime LONG jz leaseInvalid cmpdw rebindTime, expireTime, ax ja rebindInvalid tstdw rebindTime jnz rebindValid rebindInvalid: movdw rebindTime, expireTime, ax shrdw rebindTime movdw dxax, rebindTime shrdw dxax adddw rebindTime, dxax rebindValid: cmpdw renewTime, rebindTime, ax ja renewInvalid tstdw renewTime jnz renewValid renewInvalid: movdw dxax, expireTime shrdw dxax cmpdw rebindTime, dxax jae baseOffExpire movdw dxax, rebindTime shrdw dxax baseOffExpire: movdw renewTime, dxax renewValid: push bx, es ; Store the lease time ; PrintMessage "Testing code to force lease value" ; movdw renewTime, 18*60 ; 18 min ; movdw rebindTime, 18*60*2 ; 18 min later ; movdw expireTime, 18*60*3 ; another 18 min later mov bx, handle dgroup call MemDerefES movdw ({dword}es:[dhcpServerIp]), serverIp, ax movdw es:[dhcpRenewTime], renewTime, ax movdw es:[dhcpRebindTime], rebindTime, ax subdw es:[dhcpRebindTime], renewTime, ax movdw es:[dhcpExpireTime], expireTime, ax subdw es:[dhcpExpireTime], rebindTime, ax call TcpipDhcpSetNextTimer ; Convert the seconds into TimerDateAndTime structs push ds push offset TDND_leaseReceived ; start time push ds push offset TDND_renewTime ; end time buffer pushdw renewTime ; renewal time call TCPIPDHCPCONVERTTIME push ds push offset TDND_leaseReceived ; start time push ds push offset TDND_rebindTime ; end time buffer pushdw rebindTime ; rebind time call TCPIPDHCPCONVERTTIME push ds push offset TDND_leaseReceived ; start time push ds push offset TDND_expireTime ; end time buffer pushdw expireTime ; expire time call TCPIPDHCPCONVERTTIME pop bx, es call MemUnlock mov ax, 1 call MemInitRefCount ; Record message to send to GCN list push bp mov bp, bx clr bx, si mov ax, MSG_META_NOTIFY_WITH_DATA_BLOCK mov cx, MANUFACTURER_ID_GEOWORKS mov dx, GWNT_TCPIP_DHCP_STATUS mov di, mask MF_RECORD call ObjMessage ; Send to GCN list mov bx, MANUFACTURER_ID_GEOWORKS mov ax, GCNSLT_TCPIP_STATUS_NOTIFICATIONS mov cx, di mov dx, bp clr bp call GCNListSend pop bp clc done: .leave ret leaseInvalid: mov bx, cx call MemFree stc jmp done TcpipDhcpParseAndSendNotification endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipDhcpHandleRenew %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Tries to renew the DHCP lease via a unicast send to the server that gave the lease, or via a broadcast send. On success, updates status and sends GCN notification. On failure, sets next timer. CALLED BY: (Timer) PASS: nothing RETURN: nothing DESTROYED: ax, bx, cx, dx, es SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ed 7/21/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TCPIPDHCPSTARTRENEW proc far uses di, si, ds .enter mov al, PRIORITY_STANDARD mov cx, vseg TcpipDhcpHandleRenew mov dx, offset TcpipDhcpHandleRenew mov di, 1000 ; Guessing stack size mov bp, handle 0 call ThreadCreate .leave ret TCPIPDHCPSTARTRENEW endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipDhcpHandleRenew %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Tries to renew the DHCP lease via a unicast send to the server that gave the lease, or via a broadcast send. On success, updates status and sends GCN notification. On failure, sets next timer. CALLED BY: ThreadCreate PASS: nothing RETURN: nothing DESTROYED: everything SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ed 7/21/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipDhcpHandleRenew proc far uses di, si, ds recvMH local hptr push 0 renewPacket local hptr push 0 attempts local word push 0 sock local Socket push 0 phase local word push DRP_RENEW resolvedAddr local TcpAccPntResolvedAddress sockAddr local SocketAddress .enter CheckHack <offset resolvedAddr eq (offset sockAddr + size SocketAddress)> mov bx, handle dgroup call MemDerefES clr es:[dhcpTimerId] clr es:[dhcpTimerHandle] tstdw es:[dhcpRebindTime] jnz gotPhase inc phase tstdw es:[dhcpExpireTime] jnz gotPhase inc phase gotPhase: call TcpipDhcpSetNextTimer ; Allocate a receive buffer mov ax, MAX_DHCP_PACKET_SIZE mov cx, ALLOC_DYNAMIC_LOCK or (mask HAF_ZERO_INIT shl 8) call MemAlloc LONG jc error mov recvMH, bx ; Create a socket mov al, SDT_DATAGRAM call SocketCreate LONG jc error mov sock, bx ; Bind the socket mov cx, MANUFACTURER_ID_SOCKET_16BIT_PORT mov dx, DHCP_CLIENT_PORT push bp clr bp call SocketBind pop bp LONG jc error ; Connect the socket segmov es, ss, di lea di, sockAddr call TcpipBuildSockAddr movdw dxax, 0FFFFFFFFh ; broadcast ip cmp phase, DRP_RENEW jne doBroadcast tstdw es:[dhcpServerIp] jz doBroadcast movdw dxax, es:[dhcpServerIp] doBroadcast: movdw ({dword}resolvedAddr.TAPRA_ipAddr), dxax mov sockAddr.SA_port.SP_port, DHCP_SERVER_PORT push bp clr bp movdw cxdx, esdi call SocketConnect pop bp mov bx, handle Strings call MemUnlock jc error call TcpipDhcpBuildRenewPacket mov renewPacket, bx sendAgain: inc attempts cmp attempts, MAX_DHCP_RETRIES ja error mov cx, SIZEOF_DMT_RENEWAL clr ax mov bx, sock call SocketSend push bp mov bx, recvMH call MemDerefES clr di mov bx, sock mov cx, MAX_DHCP_PACKET_SIZE mov bp, DHCP_QUERY_TIMEOUT_BASE clr ax call SocketRecv pop bp mov dl, DMT_ACK call TcpipDhcpValidateResponse jnc gotResponse mov dl, DMT_NAK call TcpipDhcpValidateResponse jc sendAgain call TcpipDhcpLeaseExpired jmp cleanup gotResponse: mov bx, 0FFFFh call TcpipDhcpParseAndSendNotification jc sendAgain jmp cleanup error: cmp phase, DRP_EXPIRE jne cleanup call TcpipDhcpLeaseExpired cleanup: ; Cleanup time tst renewPacket jz freeRecvBuf mov bx, renewPacket call MemFree freeRecvBuf: tst recvMH jz closeSocket mov bx, recvMH call MemFree closeSocket: tst sock jz done mov bx, sock call SocketClose done: clr cx, dx .leave ret TcpipDhcpHandleRenew endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipDhcpBuildRenewPacket %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Builds a packet for renewing the DHCP lease. Can be used both for renew and rebind phases. CALLED BY: TcpipDhcpHandleRenew PASS: nothing RETURN: ds:si - Renew packet (size = SIZEOF_DMT_RENEWAL) DESTROYED: ax, bx, es SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ed 7/21/00 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipDhcpBuildRenewPacket proc near .enter mov bx, handle dgroup call MemDerefES mov bx, MAIN_LINK_DOMAIN_HANDLE call LinkTableGetEntry pushdw ds:[di].LCB_localAddr call MemUnlockExcl mov ax, SIZEOF_DMT_RENEWAL call TcpipDhcpBuildPacket popdw ds:[si].DM_ciaddr movdw ds:[si].DM_yiaddr, ds:[si].DM_ciaddr, ax push si add si, offset DM_options + SIZEOF_DHCP_COOKIE mov {DHCPMessageOption}ds:[si], DMO_DHCP_MESSAGE_TYPE inc si mov {byte}ds:[si], 1 ; option length inc si mov {DHCPMessageType}ds:[si], DMT_REQUEST inc si mov {DHCPMessageType}ds:[si], DMO_END pop si .leave ret TcpipDhcpBuildRenewPacket endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipDhcpLeaseExpired %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Closes the link and sends out GCN notification CALLED BY: TcpipDhcpHandleRenew PASS: nothing RETURN: nothing DESTROYED: everything but bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ed 7/25/00 Initial version ed 10/29/00 Changed from timer routine to timer event %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipDhcpLeaseExpired proc far uses bp .enter mov bx, MAIN_LINK_DOMAIN_HANDLE call LinkTableGetEntry pushdw ds:[di].LCB_localAddr call MemUnlockExcl ; Build notification that DHCP lease expired mov ax, size TcpipDhcpNotificationData mov cx, ALLOC_DYNAMIC_LOCK or (mask HAF_ZERO_INIT shl 8) call MemAlloc mov ds, ax mov ds:[0].TDND_status, TDSNT_LEASE_EXPIRED popdw ({dword}ds:[0].TDND_ipAddr) call MemUnlock mov ax, 1 call MemInitRefCount ; Record the message mov bp, bx mov ax, MSG_META_NOTIFY_WITH_DATA_BLOCK clr bx, si mov cx, MANUFACTURER_ID_GEOWORKS mov dx, GWNT_TCPIP_DHCP_STATUS mov di, mask MF_RECORD call ObjMessage ; Send it to the GCN list mov bx, MANUFACTURER_ID_GEOWORKS mov ax, GCNSLT_TCPIP_STATUS_NOTIFICATIONS mov cx, di mov dx, bp clr bp call GCNListSend ; Tell the resolver to clear its DNS entries call ResolverRemoveDhcpDnsServers ; DHCP failed, so tell TCP the connection failed mov bx, MAIN_LINK_DOMAIN_HANDLE call LinkTableGetEntry mov ax, ds:[di].LCB_connection call MemUnlockExcl mov dx, SDE_LINK_OPEN_FAILED mov di, SCO_CONNECT_FAILED mov bx, MAIN_LINK_DOMAIN_HANDLE call TcpipLinkClosed .leave ret TcpipDhcpLeaseExpired endp DhcpCode ends ResidentCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TCPIPDHCPTIMERHANDLER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sets up & handles DHCP timer events CALLED BY: TcpipDhcpParseAndSendNotification System timer PASS: ax - TimerType cx:dx - TimerGetCount's tick count bp - timer ID/interval RETURN: nothing DESTROYED: ax, bx, cx, dx, es SIDE EFFECTS: PSEUDO CODE/STRATEGY: Check if there is at least 15 min remaining until its time for the next DHCP event. If so, decrement remaining time by 15 min and set another timer. If we have work to do, spawn another thread to do it. This code has to stay small as its in a fixed block, and has to be quick since it's being called from a system thread. It's in a fixed block since we're calling it regularly and don't want to be loading in code resources at awkward times because of it. REVISION HISTORY: Name Date Description ---- ---- ----------- ed 7/25/00 Initial version ed 10/29/00 Changed from timer routine to timer event ed 1/29/00 Rewritten %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if 0 TCPIPDHCPTIMERHANDLER proc far uses di, si, bp .enter mov bx, handle dgroup call MemDerefES clr ax tstdw es:[dhcpRenewTime] jz checkRebindTime cmpdw es:[dhcpRenewTime], DHCP_TIMER_FREQUENCY_SECS jbe setRenewTimer subdw es:[dhcpRenewTime], DHCP_TIMER_FREQUENCY_SECS jmp done checkRebindTime: tstdw es:[dhcpRebindTime] jz checkExpireTime cmpdw es:[dhcpRebindTime], DHCP_TIMER_FREQUENCY_SECS jbe setRebindTimer subdw es:[dhcpRebindTime], DHCP_TIMER_FREQUENCY_SECS jmp done checkExpireTime: ; We should never hit this timer if Expire Time is 0. EC < tstdw es:[dhcpExpireTime] > EC < ERROR_Z TCPIP_INTERNAL_ERROR > cmpdw es:[dhcpExpireTime], <DHCP_TIMER_FREQUENCY_SECS + DHCP_LEASE_PANIC_TIME_SECS> jbe setPanicTimer subdw es:[dhcpExpireTime], DHCP_TIMER_FREQUENCY_SECS jmp done setRenewTimer: ; We're here if <= 15 min remaining, which fits into one word, ; so we know the high word of the dword is clear. xchg ax, es:[dhcpRenewTime].low mov cx, DRP_RENEW jmp startTimer setRebindTimer: ; We're here if <= 15 min remaining, which fits into one word, ; so we know the high word of the dword is clear. xchg ax, es:[dhcpRebindTime].low mov cx, DRP_REBIND jmp startTimer setPanicTimer: ; We're here if <= 17 min remaining, which fits into one word, ; so we know the high word of the dword is clear. However, we want ; the timer to go off 2 min before our time runs out, so we have time ; to do a last hope renewal attempt. We're guarenteed to have at ; least 2 min remaining when we reach here. xchg ax, es:[dhcpExpireTime].low sub ax, DHCP_LEASE_PANIC_TIME_SECS mov cx, DRP_PANIC startTimer: mov bx, 60 ; ticks/sec mul bx ; dx should be zero, as multiply should be <= 54000 (15*60*60) EC < tst dx > EC < ERROR_NZ TCPIP_INTERNAL_ERROR > mov_tr si, cx mov_tr cx, ax mov al, TIMER_EVENT_ONE_SHOT clr di ; mov bx, segment ResidentCode ; mov si, offset TcpipDhcpHandleRenew mov bx, es:[driverThread] mov dx, MSG_TCPIP_DHCP_RENEW_NOW_ASM mov bp, handle 0 call TimerStartSetOwner push ax push bx mov bx, es:[dhcpTimerHandle] mov ax, es:[dhcpTimerId] call TimerStop pop es:[dhcpTimerHandle] pop es:[dhcpTimerId] done: .leave ret TCPIPDHCPTIMERHANDLER endp endif TCPIPDHCPTIMERHANDLER proc far uses di, si .enter mov bx, handle dgroup call MemDerefES tstdw es:[dhcpRenewTime] jz checkRebind cmpdw es:[dhcpRenewTime], DHCP_TIMER_FREQUENCY_SECS jbe setTimer subdw es:[dhcpRenewTime], DHCP_TIMER_FREQUENCY_SECS, bx jmp done checkRebind: tstdw es:[dhcpRebindTime] jz checkExpire cmpdw es:[dhcpRebindTime], DHCP_TIMER_FREQUENCY_SECS jbe setTimer subdw es:[dhcpRebindTime], DHCP_TIMER_FREQUENCY_SECS, bx jmp done checkExpire: EC < tstdw es:[dhcpExpireTime] > EC < ERROR_Z TCPIP_INTERNAL_ERROR > cmpdw es:[dhcpExpireTime], DHCP_TIMER_FREQUENCY_SECS jbe setTimer subdw es:[dhcpExpireTime], DHCP_TIMER_FREQUENCY_SECS, bx jmp done setTimer: call TcpipDhcpSetNextTimer done: .leave ret TCPIPDHCPTIMERHANDLER endp ResidentCode ends DhcpCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TcpipDhcpSetNextTimer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sets the next timer for DHCP CALLED BY: PASS: es = dgroup RETURN: nothing DESTROYED: ax, bx, cx, dx, di, si SIDE EFFECTS: PSEUDO CODE/STRATEGY: Looks at the remaining time, and decides how to set the next timer, and what message to use. REVISION HISTORY: Name Date Description ---- ---- ----------- ed 1/29/01 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TcpipDhcpSetNextTimer proc far uses bp .enter clr ax, bx xchg bx, es:[dhcpTimerHandle] xchg ax, es:[dhcpTimerId] tst bx jz noTimer call TimerStop noTimer: mov ax, DHCP_TIMER_FREQUENCY_SECS mov di, MSG_TCPIP_DHCP_RENEW_TIMER_ASM mov si, TIMER_EVENT_CONTINUAL tstdw es:[dhcpRenewTime] jz checkRebindTime cmpdw es:[dhcpRenewTime], DHCP_TIMER_FREQUENCY_SECS, bx jbe renewTime subdw es:[dhcpRenewTime], DHCP_TIMER_FREQUENCY_SECS, bx jmp gotTime renewTime: clr ax xchg ax, es:[dhcpRenewTime].low mov di, MSG_TCPIP_DHCP_RENEW_NOW_ASM mov si, TIMER_EVENT_ONE_SHOT jmp gotTime checkRebindTime: tstdw es:[dhcpRebindTime] jz checkExpireTime cmpdw es:[dhcpRebindTime], DHCP_TIMER_FREQUENCY_SECS, bx jbe rebindTime subdw es:[dhcpRebindTime], DHCP_TIMER_FREQUENCY_SECS, bx jmp gotTime rebindTime: clr ax xchg ax, es:[dhcpRebindTime].low mov di, MSG_TCPIP_DHCP_RENEW_NOW_ASM mov si, TIMER_EVENT_ONE_SHOT jmp gotTime checkExpireTime: tstdw es:[dhcpExpireTime] jz done cmpdw es:[dhcpExpireTime], DHCP_TIMER_FREQUENCY_SECS, bx jbe expireTime subdw es:[dhcpRebindTime], DHCP_TIMER_FREQUENCY_SECS, bx jmp gotTime expireTime: clr ax xchg ax, es:[dhcpExpireTime].low mov di, MSG_TCPIP_DHCP_RENEW_NOW_ASM mov si, TIMER_EVENT_ONE_SHOT gotTime: mov cx, 60 mul cx ; Timer value can't be more than 16 bit number of ticks EC < tst dx > EC < ERROR_NZ TCPIP_INTERNAL_ERROR > mov_tr cx, ax mov_tr dx, di mov di, cx mov_tr ax, si mov bp, handle 0 mov bx, es:[driverThread] call TimerStartSetOwner mov_tr es:[dhcpTimerHandle], bx mov_tr es:[dhcpTimerId], ax done: .leave ret TcpipDhcpSetNextTimer endp DhcpCode ends SetDefaultConvention
6/execvesh/poc_asm.asm
91fc7b/SLAE
0
98208
<gh_stars>0 global _start section .text _start: mov eax,11 xor edx,edx push edx push dword 0x68732f2f push dword 0x6e69622f mov ebx, esp xor ecx, ecx int 0x80
engine/game_corner_slots2.asm
adhi-thirumala/EvoYellow
16
92071
AbleToPlaySlotsCheck: ld a, [wSpriteStateData1 + 2] and $8 jr z, .done ; not able ld b, COIN_CASE predef GetQuantityOfItemInBag ld a, b and a ld b, (GameCornerCoinCaseText_id - TextPredefs) / 2 + 1 jr z, .printCoinCaseRequired ld hl, wPlayerCoins ld a, [hli] or [hl] jr nz, .done ; able to play ld b, (GameCornerNoCoinsText_id - TextPredefs) / 2 + 1 .printCoinCaseRequired call EnableAutoTextBoxDrawing ld a, b call PrintPredefTextID xor a .done ld [wCanPlaySlots], a ret GameCornerCoinCaseText: TX_FAR _GameCornerCoinCaseText db "@" GameCornerNoCoinsText: TX_FAR _GameCornerNoCoinsText db "@"
source/web-ui-widgets-combo_boxes.adb
godunko/adawebui
2
6087
<filename>source/web-ui-widgets-combo_boxes.adb ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2017-2020, <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: 5761 $ $Date: 2017-05-20 11:06:31 +0300 (Sat, 20 May 2017) $ ------------------------------------------------------------------------------ package body Web.UI.Widgets.Combo_Boxes is ------------------ -- Constructors -- ------------------ package body Constructors is -- type Combo_Box_Internal_Access is access all Abstract_Combo_Box'Class; -- ------------ -- -- Create -- -- ------------ -- -- function Create -- (Element : -- not null WebAPI.HTML.Select_Elements.HTML_Select_Element_Access) -- return not null Combo_Box_Access -- is -- Result : constant not null Combo_Box_Internal_Access -- := new Combo_Box; -- -- begin -- Initialize (Result.all, Element); -- -- return Combo_Box_Access (Result); -- end Create; -- -- ------------ -- -- Create -- -- ------------ -- -- function Create -- (Id : League.Strings.Universal_String) -- return not null Combo_Box_Access is -- begin -- return -- Create -- (WebAPI.HTML.Select_Elements.HTML_Select_Element_Access -- (WebAPI.HTML.Globals.Window.Get_Document.Get_Element_By_Id -- (Id))); -- end Create; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out Abstract_Combo_Box'Class; Element : Web.HTML.Selects.HTML_Select_Element'Class) is begin Web.UI.Widgets.Constructors.Initialize (Self, Element); end Initialize; end Constructors; ------------------ -- Change_Event -- ------------------ overriding procedure Change_Event (Self : in out Abstract_Combo_Box) is begin Self.Current_Index_Changed.Emit (Integer (Self.Element.As_HTML_Select.Get_Selected_Index + 1)); end Change_Event; -- ------------------- -- -- Current_Index -- -- ------------------- -- -- function Current_Index -- (Self : in out Combo_Box'Class) -- return League.Strings.Universal_String -- is -- Input : constant WebAPI.HTML.Select_Elements.HTML_Select_Element_Access -- := WebAPI.HTML.Select_Elements.HTML_Select_Element_Access -- (Self.Element); -- -- begin -- return Input.Get_Value; -- end Current_Index; ---------------------------------- -- Current_Index_Changed_Signal -- ---------------------------------- not overriding function Current_Index_Changed_Signal (Self : in out Abstract_Combo_Box) return not null access Web.UI.Integer_Slots.Signal'Class is begin return Self.Current_Index_Changed'Unchecked_Access; end Current_Index_Changed_Signal; -- ----------------- -- -- Input_Event -- -- ----------------- -- -- overriding procedure Input_Event (Self : in out Combo_Box) is -- Input : constant WebAPI.HTML.Select_Elements.HTML_Select_Element_Access -- := WebAPI.HTML.Select_Elements.HTML_Select_Element_Access -- (Self.Element); -- -- begin -- Self.Current_Index_Changed.Emit (Input.Get_Value); -- end Input_Event; -- -- ----------------------- -- -- Set_Current_Index -- -- ----------------------- -- -- not overriding procedure Set_Current_Index -- (Self : in out Combo_Box; -- To : League.Strings.Universal_String) -- is -- use type League.Strings.Universal_String; -- -- Input : constant WebAPI.HTML.Select_Elements.HTML_Select_Element_Access -- := WebAPI.HTML.Select_Elements.HTML_Select_Element_Access -- (Self.Element); -- -- begin -- if Input.Get_Value /= To then -- Input.Set_Value (To); -- Self.Current_Index_Changed.Emit (Input.Get_Value); -- -- 'input' event is not send when value is updated programmatically. -- end if; -- end Set_Current_Index; ------------------ -- Set_Disabled -- ------------------ overriding procedure Set_Disabled (Self : in out Abstract_Combo_Box; Disabled : Boolean := True) is Element : Web.HTML.Selects.HTML_Select_Element := Self.Element.As_HTML_Select; begin Element.Set_Disabled (Disabled); end Set_Disabled; end Web.UI.Widgets.Combo_Boxes;
programs/oeis/017/A017497.asm
neoneye/loda
22
25283
<reponame>neoneye/loda ; A017497: a(n) = 11*n + 9. ; 9,20,31,42,53,64,75,86,97,108,119,130,141,152,163,174,185,196,207,218,229,240,251,262,273,284,295,306,317,328,339,350,361,372,383,394,405,416,427,438,449,460,471,482,493,504,515,526,537,548,559,570,581,592,603,614,625,636,647,658,669,680,691,702,713,724,735,746,757,768,779,790,801,812,823,834,845,856,867,878,889,900,911,922,933,944,955,966,977,988,999,1010,1021,1032,1043,1054,1065,1076,1087,1098 mul $0,11 add $0,9
Categories/Monoidal/Traced.agda
copumpkin/categories
98
4462
<reponame>copumpkin/categories {-# OPTIONS --universe-polymorphism #-} module Categories.Monoidal.Traced where open import Level open import Data.Product open import Data.Fin open import Categories.Category open import Categories.Monoidal open import Categories.Functor hiding (id; _∘_; identityʳ; assoc) open import Categories.Monoidal.Braided open import Categories.Monoidal.Helpers open import Categories.Monoidal.Braided.Helpers open import Categories.Monoidal.Symmetric open import Categories.NaturalIsomorphism open import Categories.NaturalTransformation hiding (id) ------------------------------------------------------------------------------ -- Helpers unary : ∀ {o ℓ e} → (C : Category o ℓ e) → (A : Category.Obj C) → Fin 1 → Category.Obj C unary C A zero = A unary C A (suc ()) binary : ∀ {o ℓ e} → (C : Category o ℓ e) → (A B : Category.Obj C) → Fin 2 → Category.Obj C binary C A B zero = A binary C A B (suc zero) = B binary C A B (suc (suc ())) ternary : ∀ {o ℓ e} → (C : Category o ℓ e) → (A X Y : Category.Obj C) → Fin 3 → Category.Obj C ternary C A X Y zero = A ternary C A X Y (suc zero) = X ternary C A X Y (suc (suc zero)) = Y ternary C A X Y (suc (suc (suc ()))) ------------------------------------------------------------------------------ -- Def from http://ncatlab.org/nlab/show/traced+monoidal+category -- -- A symmetric monoidal category (C,⊗,1,b) (where b is the symmetry) is -- said to be traced if it is equipped with a natural family of functions -- -- TrXA,B:C(A⊗X,B⊗X)→C(A,B) -- satisfying three axioms: -- -- Vanishing: Tr1A,B(f)=f (for all f:A→B) and -- TrX⊗YA,B=TrXA,B(TrYA⊗X,B⊗X(f)) (for all f:A⊗X⊗Y→B⊗X⊗Y) -- -- Superposing: TrXC⊗A,C⊗B(idC⊗f)=idC⊗TrXA,B(f) (for all f:A⊗X→B⊗X) -- -- Yanking: TrXX,X(bX,X)=idX record Traced {o ℓ e} {C : Category o ℓ e} {M : Monoidal C} {B : Braided M} (S : Symmetric B) : Set (o ⊔ ℓ ⊔ e) where private module C = Category C open C using (Obj; id; _∘_) private module M = Monoidal M open M using (⊗; identityʳ; assoc) renaming (id to 𝟙) private module F = Functor ⊗ open F using () renaming (F₀ to ⊗ₒ; F₁ to ⊗ₘ) private module NIʳ = NaturalIsomorphism identityʳ open NaturalTransformation NIʳ.F⇒G renaming (η to ηidr⇒) open NaturalTransformation NIʳ.F⇐G renaming (η to ηidr⇐) private module NIassoc = NaturalIsomorphism assoc open NaturalTransformation NIassoc.F⇒G renaming (η to ηassoc⇒) open NaturalTransformation NIassoc.F⇐G renaming (η to ηassoc⇐) private module B = Braided B open B using (braid) private module NIbraid = NaturalIsomorphism braid open NaturalTransformation NIbraid.F⇒G renaming (η to ηbraid⇒) field trace : ∀ {X A B} → C [ ⊗ₒ (A , X) , ⊗ₒ (B , X) ] → C [ A , B ] vanish_id : ∀ {A B f} → C [ trace {𝟙} {A} {B} f ≡ (ηidr⇒ (unary C B) ∘ f ∘ ηidr⇐ (unary C A)) ] vanish_⊗ : ∀ {X Y A B f} → C [ trace {⊗ₒ (X , Y)} {A} {B} f ≡ trace {X} {A} {B} (trace {Y} {⊗ₒ (A , X)} {⊗ₒ (B , X)} ((ηassoc⇐ (ternary C B X Y)) ∘ f ∘ (ηassoc⇒ (ternary C A X Y)))) ] superpose : ∀ {X Y A B} {f : C [ ⊗ₒ (A , X) , ⊗ₒ (B , X) ]} → C [ trace {X} {⊗ₒ (Y , A)} {⊗ₒ (Y , B)} (ηassoc⇐ (ternary C Y B X) ∘ ⊗ₘ (id , f) ∘ ηassoc⇒ (ternary C Y A X)) ≡ ⊗ₘ (id , (trace {X} {A} {B} f)) ] yank : ∀ {X} → C [ trace {X} {X} {X} (ηbraid⇒ (binary C X X)) ≡ id ] ------------------------------------------------------------------------------
programs/oeis/075/A075255.asm
neoneye/loda
22
167210
<gh_stars>10-100 ; A075255: a(n) = n - (sum of primes factors of n (with repetition)). ; 1,0,0,0,0,1,0,2,3,3,0,5,0,5,7,8,0,10,0,11,11,9,0,15,15,11,18,17,0,20,0,22,19,15,23,26,0,17,23,29,0,30,0,29,34,21,0,37,35,38,31,35,0,43,39,43,35,27,0,48,0,29,50,52,47,50,0,47,43,56,0,60,0,35,62,53,59,60,0,67,69,39,0,70,63,41,55,71,0,77,71,65,59,45,71,83,0,82,82,86 mov $1,$0 seq $1,100006 ; Integer log of 2n: sum of primes dividing 2n (with repetition). sub $0,$1 add $0,3
1581/64tass/bamutl.asm
silverdr/assembly
23
102536
rdbam lda jobnum ; save it sta tmpjbn lda bam1 ; is it in memory? bne bamend ; yes lda #>(bam1-buff0) ldx #1 ; sector jsr setts jsr doread lda #>(bam2-buff0) ldx #2 ; sec number jsr setts jsr doread jmp bamend bamout lda jobnum ; save it sta tmpjbn lda #>(bam1-buff0) ldx #1 ; sector jsr setts jsr dowrit lda #>(bam2-buff0) ldx #2 ; sector jsr setts jsr dowrit bamend lda tmpjbn sta jobnum ; restore it lda #0 sta wbam ; it clean now! rts rddir jsr mapout ; wrt bams if dirty ldx #0 ; sector lda jobnum jsr setts ; set dir hdrs jsr doread ; rd in the dir jmp rdbam ; rd bams if not in memory setts sta jobnum ; stx sector ; set up t/s ldx dirtrk ; trk #18 stx track jmp seth ; setup hdrs setbpt jsr rdbam ; rd bam if not in memory setbp2 lda #>bam1 ; preset bam pointers sta bmpnt+1 lda #0 ; default bam1 addr sta bmpnt rts numfre lda ndbl sta nbtemp lda ndbh sta nbtemp+1 rts
programs/oeis/130/A130893.asm
neoneye/loda
22
83948
<filename>programs/oeis/130/A130893.asm ; A130893: Lucas numbers (beginning with 1) mod 10. ; 1,3,4,7,1,8,9,7,6,3,9,2,1,3,4,7,1,8,9,7,6,3,9,2,1,3,4,7,1,8,9,7,6,3,9,2,1,3,4,7,1,8,9,7,6,3,9,2,1,3,4,7,1,8,9,7,6,3,9,2,1,3,4,7,1,8,9,7,6,3,9,2,1,3,4,7,1,8,9,7,6,3,9,2,1,3,4,7,1,8,9,7,6,3,9,2,1,3,4,7 add $0,1 mod $0,12 seq $0,32 ; Lucas numbers beginning at 2: L(n) = L(n-1) + L(n-2), L(0) = 2, L(1) = 1. mod $0,10
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0x48.log_21829_2695.asm
ljhsiun2/medusa
9
100721
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r15 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0xbb30, %rsi lea addresses_normal_ht+0x2130, %rdi nop nop nop nop nop and %rdx, %rdx mov $53, %rcx rep movsw nop xor %r15, %r15 lea addresses_D_ht+0x17930, %r10 nop nop nop nop xor %r15, %r15 movb $0x61, (%r10) nop nop nop add %r10, %r10 lea addresses_D_ht+0xf730, %rdx nop nop nop nop nop cmp %r14, %r14 mov (%rdx), %r15 nop nop nop nop nop cmp %rdi, %rdi lea addresses_UC_ht+0x330, %rdi nop nop nop nop nop add $60068, %r14 mov (%rdi), %dx nop nop nop nop nop add $19963, %r15 lea addresses_D_ht+0x13df0, %r10 nop nop nop nop nop add $20631, %r14 mov (%r10), %rdx nop nop nop nop and $41126, %rsi lea addresses_D_ht+0x11c40, %r10 nop nop cmp %rdi, %rdi mov (%r10), %r15d nop xor %rdi, %rdi lea addresses_WC_ht+0x1db0, %r14 nop nop nop nop add $15172, %rdx vmovups (%r14), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $1, %xmm7, %r10 nop nop nop cmp $62769, %r15 lea addresses_WT_ht+0x109b0, %r14 clflush (%r14) nop nop nop nop nop dec %r15 vmovups (%r14), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %rcx cmp %r14, %r14 lea addresses_UC_ht+0x17a50, %r10 nop nop nop nop nop sub $51330, %rcx movb (%r10), %r14b nop nop nop nop nop and $23352, %rsi lea addresses_normal_ht+0x77e0, %rsi lea addresses_UC_ht+0x8468, %rdi nop nop nop nop nop dec %rbx mov $6, %rcx rep movsl and %rsi, %rsi lea addresses_normal_ht+0x15e30, %rsi lea addresses_A_ht+0x4500, %rdi nop nop add $2581, %rbx mov $36, %rcx rep movsq nop and $25172, %rsi lea addresses_D_ht+0x46b0, %rcx dec %r14 mov $0x6162636465666768, %rdx movq %rdx, %xmm5 vmovups %ymm5, (%rcx) nop nop nop nop dec %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %rbx push %rcx push %rsi // Faulty Load lea addresses_normal+0x12330, %rcx nop nop nop sub $47465, %r11 mov (%rcx), %ebx lea oracles, %rsi and $0xff, %rbx shlq $12, %rbx mov (%rsi,%rbx,1), %rbx pop %rsi pop %rcx pop %rbx pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 2, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 7, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 5, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
nes-test-roms/mmc3_irq_tests/source/prefix_mmc3_validation.asm
joebentley/ones
1,461
172626
<gh_stars>1000+ .include "prefix_mmc3.a" begin_counter_test: sta result jsr clock_counter ; avoid pathological reload behavior jsr clock_counter txa jsr set_reload jsr clear_counter jsr clear_irq rts .code should_be_clear: jsr get_pending cpx #0 jsr error_if_ne jsr clear_irq rts should_be_set: jsr get_pending cpx #1 jsr error_if_ne jsr clear_irq rts
programs/oeis/230/A230089.asm
neoneye/loda
22
18237
; A230089: If n is divisible by 4 then 4, if n is divisible by 2 then 2, otherwise n. ; 1,2,3,4,5,2,7,4,9,2,11,4,13,2,15,4,17,2,19,4,21,2,23,4,25,2,27,4,29,2,31,4,33,2,35,4,37,2,39,4,41,2,43,4,45,2,47,4,49,2,51,4,53,2,55,4,57,2,59,4,61,2,63,4,65,2,67,4,69,2,71,4,73,2,75,4,77,2,79,4,81,2,83,4,85,2,87,4,89,2 lpb $0,$0 pow $0,3 mod $0,4 lpe add $0,1
proglangs-learning/Agda/plfa-exercises/part1/Equality.agda
helq/old_code
0
7630
module plfa.part1.Equality where data _≡_ {A : Set} (x : A) : A → Set where refl : x ≡ x infix 4 _≡_ sym : ∀ {A : Set} {x y : A} → x ≡ y → y ≡ x sym refl = refl trans : ∀ {A : Set} {x y z : A} → x ≡ y → y ≡ z → x ≡ z trans refl refl = refl cong : ∀ {A B : Set} (f : A → B) {x y : A} → x ≡ y → f x ≡ f y cong f refl = refl cong₂ : ∀ {A B C : Set} (f : A → B → C) {u x : A} {v y : B} → u ≡ x → v ≡ y → f u v ≡ f x y cong₂ f refl refl = refl cong-app : ∀ {A B : Set} {f g : A → B} → f ≡ g → ∀ (x : A) → f x ≡ g x cong-app refl x = refl subst : ∀ {A : Set} {x y : A} (P : A → Set) → x ≡ y → P x → P y subst P refl px = px data ℕ : Set where zero : ℕ suc : ℕ → ℕ _+_ : ℕ → ℕ → ℕ zero + n = n (suc m) + n = suc (m + n) postulate +-identity : ∀ (m : ℕ) → m + zero ≡ m +-suc : ∀ (m n : ℕ) → m + suc n ≡ suc (m + n)
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/interface1.adb
best08618/asylo
7
14800
-- { dg-do run } with System; procedure Interface1 is package Pkg is type I1 is interface; type Root is tagged record Data : string (1 .. 300); end record; type DT is new Root and I1 with null record; end Pkg; use Pkg; use type System.Address; Obj : DT; procedure IW (O : I1'Class) is begin if O'Address /= Obj'Address then raise Program_Error; end if; end IW; begin IW (Obj); end Interface1;
base/mvdm/wow16/kernel31/hmem.asm
npocmaka/Windows-Server-2003
17
178621
<gh_stars>10-100 title HMem ;HMem.asm - huge memory functions HMemCpy, etc include gpfix.inc include kernel.inc externFP Int21Handler DataBegin externW WinFlags ifdef WOW externD pFileTable externW cur_dos_PDB externW Win_PDB endif DataEnd ifdef WOW externFP WOWFileRead externFP WOWFileWrite endif sBegin CODE assumes cs,CODE ifdef WOW externD prevInt21proc endif externA __AHINCR cProc hMemCpy,<PUBLIC,FAR>,<ds, si, di> parmD dest ; to ES:DI parmD src ; to DS:SI parmD cnt ; to DX:AX localW flags cBegin SetKernelDS mov bx, WinFlags mov flags, bx mov dx, seg_cnt ; DX:AX is 32 bit length mov ax, off_cnt xor cx, cx ; 0 if fault loading operands beg_fault_trap hmc_trap lds si, src les di, dest cld hmc_loop: mov cx, 8000h ; try to copy 32K cmp cx, si ; space left in source? jae @F mov cx, si @@: cmp cx, di ; space left in dest? jae @F mov cx, di @@: neg cx ; convert bytes left to positive or dx, dx ; >64K left to copy? jnz @F cmp cx, ax ; At least this much left? jbe @F mov cx, ax @@: sub ax, cx ; Decrement count while we're here sbb dx, 0 test flags, WF_CPU386 + WF_CPU486 + WF_ENHANCED jnz hmc_do32 shr cx, 1 ; Copy 32KB rep movsw adc cx, 0 rep movsb jmps hmc_copied hmc_do32: .386p push cx shr cx, 2 rep movsd pop cx and cx, 3 rep movsb .286p hmc_copied: mov cx, ax ; At end of copy? or cx, dx jz hmc_done or si, si ; Source wrap-around? jnz @F mov bx, ds add bx, __AHINCR mov ds, bx @@: or di, di ; Dest wrap-around? jnz @F mov bx, es add bx, __AHINCR mov es, bx end_fault_trap @@: jmps hmc_loop hmc_trap: fault_fix_stack ; DX:AX = bytes left if failure krDebugOut DEB_ERROR, "hMemCopy: Copy past end of segment" add ax, cx adc dx, 0 hmc_done: ; DX:AX = 0 if success cEnd ifdef W_Q21 cProc _HREAD, <PUBLIC, FAR, NODATA>, <ds> parmW h parmD lpData parmD dwCnt cBegin SetKernelDS ds push bx mov bx, Win_PDB cmp bx, cur_dos_PDB je HR_PDB_ok push ax mov cur_dos_PDB,bx mov ah,50h pushf call cs:prevInt21Proc ; JUMP THROUGH CS VARIABLE pop ax HR_PDB_OK: pop bx cCall WowFileRead,<h,lpData,dwCnt,cur_dos_PDB,0,pFileTable> ; DX:AX = Number Bytes Read ; DX = FFFF, AX = Error Code inc dx jnz @f xor dx,dx or ax, -1 @@: dec dx cEnd cProc _HWRITE, <PUBLIC, FAR, NODATA>, <ds> parmW h parmD lpData parmD dwCnt cBegin SetKernelDS ds push bx ; Setting the DOS PDB can probably mov bx, Win_PDB ; be removed just pass Win_PDB to cmp bx, cur_dos_PDB ; the WOW thunk je HW_PDB_ok push ax mov cur_dos_PDB,bx mov ah,50h pushf call cs:prevInt21Proc ; JUMP THROUGH CS VARIABLE pop ax HW_PDB_OK: pop bx cCall WowFileWrite,<h,lpData,dwCnt,cur_dos_PDB,0,pFileTable> ; DX:AX = Number Bytes Read ; DX = FFFF, AX = Error Code inc dx jnz @f xor dx,dx or ax, -1 @@: dec dx cEnd else public _HREAD, _HWRITE _HREAD: mov bx, 3f00h jmps hugeIO _HWRITE: mov bx, 4000h cProc hugeIO, <FAR, NODATA>, <ds, si, di, cx> parmW h parmD lpData parmD dwCnt localD dwTot localW func cBegin mov func, bx ; read from a file mov bx, h xor cx, cx mov seg_dwTot, cx mov off_dwTot, cx beg_fault_trap hr_fault lds dx, lpData mov si, seg_dwCnt mov di, off_dwCnt hr_loop: mov cx, 8000h ; try to do 32KB cmp cx, dx ; space left in data buffer jae @F mov cx, dx neg cx @@: or si, si ; at least 64K left jnz @F cmp cx, di jbe @F mov cx, di @@: mov ax, func ; talk to DOS DOSCALL jc hr_oops add off_dwTot, ax ; update transfer count adc seg_dwTot, 0 cmp ax, cx ; end of file? jnz hr_done sub di, ax ; decrement count sbb si, 0 mov cx, si ; end of count or cx, di jz hr_done add dx, ax ; update pointer to data jnz @F ; wrapped to next segment mov ax, ds add ax, __AHINCR mov ds, ax end_fault_trap @@: jmps hr_loop hr_fault: pop dx pop ax ; krDebugOut DEB_ERROR, "File I/O past end of memory block" krDebugOut DEB_ERROR, "GP fault in _hread/_hwrite at #DX #AX" ; fault_fix_stack hr_oops: or dx, -1 mov seg_dwTot, dx mov off_dwTot, dx hr_done: mov dx, seg_dwTot mov ax, off_dwTot cEnd endif ; WOW sEnd end
HelloWorld.adb
LinXueyuanStdio/HelloWorld
0
20871
<filename>HelloWorld.adb with Ada.Text_IO; use Ada.Text_IO; procedure Program is begin Ada.Text_IO.Put("HelloWorld"); end Program;
oeis/073/A073833.asm
neoneye/loda-programs
11
105381
; A073833: Numerators of b(n) where b(1) = 1, b(i) = b(i-1) + 1/b(i-1). ; Submitted by <NAME> ; 1,2,5,29,941,969581,1014556267661,1099331737522548368039021,1280590510388959061548230114212510564911731118541,1726999038066943724857508638586386504281539279376091034086485112150121338989977841573308941492781 mov $1,1 mov $3,1 lpb $0 sub $0,1 pow $1,2 mov $2,$1 add $1,$3 mul $3,$2 lpe mov $0,$1
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/bit_packed_array3.adb
best08618/asylo
7
18861
<reponame>best08618/asylo -- { dg-do run } -- { dg-options "-O2 -gnatp" } procedure Bit_Packed_Array3 is type Bitmap_T is array (1 .. 10) of Boolean; pragma Pack (Bitmap_T); type Maps_T is record M1 : Bitmap_T; end record; pragma Pack (Maps_T); for Maps_T'Size use 10; pragma Suppress_Initialization (Maps_T); Tmap : constant Bitmap_T := (others => True); Fmap : constant Bitmap_T := (others => False); Amap : constant Bitmap_T := (1 => False, 2 => True, 3 => False, 4 => True, 5 => False, 6 => True, 7 => False, 8 => True, 9 => False, 10 => True); function Some_Maps return Maps_T is Value : Maps_T := (M1 => Amap); begin return Value; end; pragma Inline (Some_Maps); Maps : Maps_T; begin Maps := Some_Maps; for I in Maps.M1'Range loop if (I mod 2 = 0 and then not Maps.M1 (I)) or else (I mod 2 /= 0 and then Maps.M1 (I)) then raise Program_Error; end if; end loop; end;
_build/dispatcher/jmp_ippsSMS4_CCMGetTag_c594e231.asm
zyktrcn/ippcp
1
160126
extern m7_ippsSMS4_CCMGetTag:function extern n8_ippsSMS4_CCMGetTag:function extern y8_ippsSMS4_CCMGetTag:function extern e9_ippsSMS4_CCMGetTag:function extern l9_ippsSMS4_CCMGetTag:function extern n0_ippsSMS4_CCMGetTag:function extern k0_ippsSMS4_CCMGetTag:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsSMS4_CCMGetTag .Larraddr_ippsSMS4_CCMGetTag: dq m7_ippsSMS4_CCMGetTag dq n8_ippsSMS4_CCMGetTag dq y8_ippsSMS4_CCMGetTag dq e9_ippsSMS4_CCMGetTag dq l9_ippsSMS4_CCMGetTag dq n0_ippsSMS4_CCMGetTag dq k0_ippsSMS4_CCMGetTag segment .text global ippsSMS4_CCMGetTag:function (ippsSMS4_CCMGetTag.LEndippsSMS4_CCMGetTag - ippsSMS4_CCMGetTag) .Lin_ippsSMS4_CCMGetTag: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsSMS4_CCMGetTag: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsSMS4_CCMGetTag] mov r11, qword [r11+rax*8] jmp r11 .LEndippsSMS4_CCMGetTag:
programs/oeis/309/A309057.asm
neoneye/loda
22
95705
<filename>programs/oeis/309/A309057.asm ; A309057: a(0) = 1; a(2*n) = 3*a(n), a(2*n+1) = a(n). ; 1,1,3,1,9,3,3,1,27,9,9,3,9,3,3,1,81,27,27,9,27,9,9,3,27,9,9,3,9,3,3,1,243,81,81,27,81,27,27,9,81,27,27,9,27,9,9,3,81,27,27,9,27,9,9,3,27,9,9,3,9,3,3,1,729,243,243,81,243,81,81,27,243,81,81,27,81,27,27,9,243 seq $0,80791 ; Number of nonleading 0's in binary expansion of n. mov $1,3 pow $1,$0 mov $0,$1
src/plfa-code/Connectives.agda
chirsz-ever/plfa-code
0
12193
<filename>src/plfa-code/Connectives.agda module plfa-code.Connectives where import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl) open Eq.≡-Reasoning open import Data.Nat using (ℕ) open import Function using (_∘_) open import plfa-code.Isomorphism using (_≃_; _≲_; extensionality) open plfa-code.Isomorphism.≃-Reasoning data _×_ (A B : Set) : Set where ⟨_,_⟩ : A → B ----- → A × B proj₁ : ∀ {A B : Set} → A × B ----- → A proj₁ ⟨ x , y ⟩ = x proj₂ : ∀ {A B : Set} → A × B ----- → B proj₂ ⟨ x , y ⟩ = y record _×′_ (A B : Set) : Set where field proj₁′ : A proj₂′ : B open _×′_ η-× : ∀ {A B : Set} (w : A × B) → ⟨ proj₁ w , proj₂ w ⟩ ≡ w η-× ⟨ x , y ⟩ = refl infixr 2 _×_ data Bool : Set where true : Bool false : Bool data Tri : Set where aa : Tri bb : Tri cc : Tri ×-count : Bool × Tri → ℕ ×-count ⟨ true , aa ⟩ = 1 ×-count ⟨ true , bb ⟩ = 2 ×-count ⟨ true , cc ⟩ = 3 ×-count ⟨ false , aa ⟩ = 4 ×-count ⟨ false , bb ⟩ = 5 ×-count ⟨ false , cc ⟩ = 6 ×-comm : ∀ {A B : Set} → A × B ≃ B × A ×-comm = record { to = λ{ ⟨ x , y ⟩ → ⟨ y , x ⟩ } ; from = λ{ ⟨ y , x ⟩ → ⟨ x , y ⟩ } ; from∘to = λ{ ⟨ x , y ⟩ → refl } ; to∘from = λ{ ⟨ y , x ⟩ → refl } } ×-assoc : ∀ {A B C : Set} → (A × B) × C ≃ A × (B × C) ×-assoc = record { to = λ{ ⟨ ⟨ x , y ⟩ , z ⟩ → ⟨ x , ⟨ y , z ⟩ ⟩ } ; from = λ{ ⟨ x , ⟨ y , z ⟩ ⟩ → ⟨ ⟨ x , y ⟩ , z ⟩ } ; from∘to = λ{ ⟨ ⟨ x , y ⟩ , z ⟩ → refl } ; to∘from = λ{ ⟨ x , ⟨ y , z ⟩ ⟩ → refl } } ---------- practice ---------- open plfa-code.Isomorphism using (_⇔_) open _⇔_ ⇔-≃-→×→ : ∀ {A B : Set} → A ⇔ B ≃ (A → B) × (B → A) ⇔-≃-→×→ = record { to = λ x → ⟨ to x , from x ⟩ ; from = λ{ ⟨ A→B , B→A ⟩ → record { to = A→B ; from = B→A } } ; from∘to = λ x → refl ; to∘from = λ{ ⟨ A→B , B→A ⟩ → refl } } ------------------------------ data ⊤ : Set where tt : -- ⊤ η-⊤ : ∀ (w : ⊤) → tt ≡ w η-⊤ tt = refl ⊤-count : ⊤ → ℕ ⊤-count tt = 1 ⊤-identityˡ : ∀ {A : Set} → ⊤ × A ≃ A ⊤-identityˡ = record { to = λ{ ⟨ tt , x ⟩ → x } ; from = λ x → ⟨ tt , x ⟩ ; from∘to = λ{ ⟨ tt , x ⟩ → refl } ; to∘from = λ x → refl } ⊤-identityʳ : ∀ {A : Set} → (A × ⊤) ≃ A ⊤-identityʳ {A} = ≃-begin (A × ⊤) ≃⟨ ×-comm ⟩ (⊤ × A) ≃⟨ ⊤-identityˡ ⟩ A ≃-∎ data _⊎_ (A B : Set) : Set where inj₁ : A ----- → A ⊎ B inj₂ : B ----- → A ⊎ B case-⊎ : ∀ {A B C : Set} → (A → C) → (B → C) → A ⊎ B ----------- → C case-⊎ f g (inj₁ x) = f x case-⊎ f g (inj₂ y) = g y η-⊎ : ∀ {A B : Set} (w : A ⊎ B) → case-⊎ inj₁ inj₂ w ≡ w η-⊎ (inj₁ x) = refl η-⊎ (inj₂ y) = refl uniq-⊎ : ∀ {A B C : Set} (h : A ⊎ B → C) (w : A ⊎ B) → case-⊎ (h ∘ inj₁) (h ∘ inj₂) w ≡ h w uniq-⊎ h (inj₁ x) = refl uniq-⊎ h (inj₂ y) = refl infix 1 _⊎_ ⊎-count : Bool ⊎ Tri → ℕ ⊎-count (inj₁ true) = 1 ⊎-count (inj₁ false) = 2 ⊎-count (inj₂ aa) = 3 ⊎-count (inj₂ bb) = 4 ⊎-count (inj₂ cc) = 5 ---------- practice ---------- ⊎-comm : ∀ {A B : Set} → A ⊎ B ≃ B ⊎ A ⊎-comm = record { to = λ{(inj₁ a) → inj₂ a ; (inj₂ b) → inj₁ b } ; from = λ{(inj₁ b) → inj₂ b ; (inj₂ a) → inj₁ a } ; from∘to = λ{(inj₁ a) → refl ; (inj₂ b) → refl } ; to∘from = λ{(inj₁ b) → refl ; (inj₂ a) → refl } } ⊎-assoc : ∀ {A B C : Set} → (A ⊎ B) ⊎ C ≃ A ⊎ (B ⊎ C) ⊎-assoc = record { to = to′ ; from = from′ ; from∘to = from∘to′ ; to∘from = to∘from′ } where to′ : ∀ {A B C : Set} → (A ⊎ B) ⊎ C → A ⊎ (B ⊎ C) to′ (inj₁ (inj₁ a)) = inj₁ a to′ (inj₁ (inj₂ b)) = inj₂ (inj₁ b) to′ (inj₂ c) = inj₂ (inj₂ c) from′ : ∀ {A B C : Set} → A ⊎ (B ⊎ C) → (A ⊎ B) ⊎ C from′ (inj₁ a) = inj₁ (inj₁ a) from′ (inj₂ (inj₁ b)) = inj₁ (inj₂ b) from′ (inj₂ (inj₂ c)) = inj₂ c from∘to′ : ∀ (x) → from′ (to′ x) ≡ x from∘to′ (inj₁ (inj₁ a)) = refl from∘to′ (inj₁ (inj₂ b)) = refl from∘to′ (inj₂ c) = refl to∘from′ : ∀ (x) → to′ (from′ x) ≡ x to∘from′ (inj₁ a) = refl to∘from′ (inj₂ (inj₁ b)) = refl to∘from′ (inj₂ (inj₂ c)) = refl ------------------------------ data ⊥ : Set where -- no clauses! ⊥-elim : ∀ {A : Set} → ⊥ -- → A ⊥-elim () uniq-⊥ : ∀ {C : Set} (h : ⊥ → C) (w : ⊥) → ⊥-elim w ≡ h w uniq-⊥ h () ⊥-count : ⊥ → ℕ ⊥-count () ---------- practice ---------- ⊥-identityˡ : ∀ {A : Set} → ⊥ ⊎ A ≃ A ⊥-identityˡ = record { to = λ{ (inj₂ a) → a } ; from = inj₂ ; from∘to = λ{ (inj₂ a) → refl } ; to∘from = λ a → refl } ⊥-identityʳ : ∀ {A : Set} → A ⊎ ⊥ ≃ A ⊥-identityʳ {A} = ≃-begin (A ⊎ ⊥) ≃⟨ ⊎-comm ⟩ (⊥ ⊎ A) ≃⟨ ⊥-identityˡ ⟩ A ≃-∎ ------------------------------ →-elim : ∀ {A B : Set} → (A → B) → A ------- → B →-elim L M = L M η-→ : ∀ {A B : Set} (f : A → B) → (λ (x : A) → f x) ≡ f η-→ f = refl →-count : (Bool → Tri) → ℕ →-count f with f true | f false ... | aa | aa = 1 ... | aa | bb = 2 ... | aa | cc = 3 ... | bb | aa = 4 ... | bb | bb = 5 ... | bb | cc = 6 ... | cc | aa = 7 ... | cc | bb = 8 ... | cc | cc = 9 currying : ∀ {A B C : Set} → (A → B → C) ≃ (A × B → C) currying = record { to = λ f → λ{ ⟨ x , y ⟩ → f x y } ; from = λ g x y → g ⟨ x , y ⟩ ; from∘to = λ x → refl ; to∘from = λ{ g → extensionality λ{ ⟨ x , y ⟩ → refl } } } →-distrib-⊎ : ∀ {A B C : Set} → (A ⊎ B → C) ≃ ((A → C) × (B → C)) →-distrib-⊎ = record { to = λ{ f → ⟨ f ∘ inj₁ , f ∘ inj₂ ⟩ } ; from = λ{ ⟨ g , h ⟩ → λ{ (inj₁ x) → g x ; (inj₂ y) → h y } } ; from∘to = λ{ f → extensionality λ{ (inj₁ x) → refl ; (inj₂ y) → refl } } ; to∘from = λ{ ⟨ g , h ⟩ → refl } } →-distrib-× : ∀ {A B C : Set} → (A → B × C) ≃ (A → B) × (A → C) →-distrib-× = record { to = λ{ f → ⟨ proj₁ ∘ f , proj₂ ∘ f ⟩ } ; from = λ{ ⟨ g , h ⟩ → λ x → ⟨ g x , h x ⟩ } ; from∘to = λ{ f → extensionality λ{ x → η-× (f x) } } ; to∘from = λ{ ⟨ g , h ⟩ → refl } } ×-distrib-⊎ : ∀ {A B C : Set} → (A ⊎ B) × C ≃ (A × C) ⊎ (B × C) ×-distrib-⊎ = record { to = λ{ ⟨ inj₁ x , z ⟩ → (inj₁ ⟨ x , z ⟩) ; ⟨ inj₂ y , z ⟩ → (inj₂ ⟨ y , z ⟩) } ; from = λ{ (inj₁ ⟨ x , z ⟩) → ⟨ inj₁ x , z ⟩ ; (inj₂ ⟨ y , z ⟩) → ⟨ inj₂ y , z ⟩ } ; from∘to = λ{ ⟨ inj₁ x , z ⟩ → refl ; ⟨ inj₂ y , z ⟩ → refl } ; to∘from = λ{ (inj₁ ⟨ x , z ⟩) → refl ; (inj₂ ⟨ y , z ⟩) → refl } } ⊎-distrib-× : ∀ {A B C : Set} → (A × B) ⊎ C ≲ (A ⊎ C) × (B ⊎ C) ⊎-distrib-× = record { to = λ{ (inj₁ ⟨ x , y ⟩) → ⟨ inj₁ x , inj₁ y ⟩ ; (inj₂ z) → ⟨ inj₂ z , inj₂ z ⟩ } ; from = λ{ ⟨ inj₁ x , inj₁ y ⟩ → (inj₁ ⟨ x , y ⟩) ; ⟨ inj₁ x , inj₂ z ⟩ → (inj₂ z) ; ⟨ inj₂ z , _ ⟩ → (inj₂ z) } ; from∘to = λ{ (inj₁ ⟨ x , y ⟩) → refl ; (inj₂ z) → refl } } ---------- practice ---------- ⊎-weak-× : ∀ {A B C : Set} → (A ⊎ B) × C → A ⊎ (B × C) ⊎-weak-× ⟨ inj₁ a , c ⟩ = inj₁ a ⊎-weak-× ⟨ inj₂ b , c ⟩ = inj₂ ⟨ b , c ⟩ -- the corresponding distributive law is ×-distrib-⊎, ×-distrib-⊎ is more strong ⊎×-implies-×⊎ : ∀ {A B C D : Set} → (A × B) ⊎ (C × D) → (A ⊎ C) × (B ⊎ D) ⊎×-implies-×⊎ (inj₁ ⟨ a , b ⟩) = ⟨ inj₁ a , inj₁ b ⟩ ⊎×-implies-×⊎ (inj₂ ⟨ c , d ⟩) = ⟨ inj₂ c , inj₂ d ⟩ -- the converse doesn't hold. ⟨ inj₁ a , inj₂ d ⟩ could not build a -- (A × B) ⊎ (C × D) value ------------------------------
stage4/graphics_rectangle.asm
amrwc/8086-graphics
5
163261
<reponame>amrwc/8086-graphics<gh_stars>1-10 %include "graphics_rectangle_main.asm" %include "graphics_rectangle_algorithm.asm" Graphics_Rectangle: push word 50d ; x0 ; Default arguments push word 50d ; y0 push word 140d ; width push word 100d ; height call Graphics_Rectangle_Main ret
legend-pure-m2-dsl-mapping/src/main/antlr4/org/finos/legend/pure/m2/dsl/mapping/serialization/grammar/OperationParser.g4
marinaelson/legend-pure
37
4305
<reponame>marinaelson/legend-pure<gh_stars>10-100 parser grammar OperationParser; options { tokenVocab = OperationLexer; } mapping: functionPath parameters (END_LINE)? EOF ; parameters: GROUP_OPEN (VALID_STRING (COMMA VALID_STRING)*)? GROUP_CLOSE ; functionPath: qualifiedName ; qualifiedName: packagePath? identifier ; packagePath: (identifier PATH_SEPARATOR)+ ; identifier: VALID_STRING ;
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_1798.asm
ljhsiun2/medusa
9
17173
<reponame>ljhsiun2/medusa<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0xfb70, %rsi lea addresses_A_ht+0x14954, %rdi clflush (%rdi) nop nop dec %rbx mov $80, %rcx rep movsq nop add %r10, %r10 lea addresses_WT_ht+0xf454, %rsi lea addresses_WT_ht+0x1bbc8, %rdi clflush (%rdi) nop nop nop cmp %rbp, %rbp mov $27, %rcx rep movsq nop nop sub %r10, %r10 lea addresses_A_ht+0x160da, %rbx nop sub %rdi, %rdi movb (%rbx), %r10b nop nop nop nop nop and %r10, %r10 lea addresses_WC_ht+0xb40, %rsi lea addresses_normal_ht+0xeab8, %rdi clflush (%rsi) dec %r15 mov $82, %rcx rep movsl nop nop cmp %rdi, %rdi lea addresses_UC_ht+0x15948, %r10 and %r15, %r15 mov $0x6162636465666768, %rbp movq %rbp, (%r10) nop nop sub $58356, %rdi lea addresses_A_ht+0x138c8, %rsi nop nop add $14880, %rbx mov (%rsi), %edi nop xor %rsi, %rsi lea addresses_D_ht+0x197c8, %rcx nop nop nop sub %r10, %r10 mov $0x6162636465666768, %rdi movq %rdi, %xmm4 vmovups %ymm4, (%rcx) nop nop nop nop nop cmp $29638, %rdi lea addresses_A_ht+0x20e8, %rbp inc %rcx movb $0x61, (%rbp) and %rbp, %rbp lea addresses_A_ht+0xed0, %rbp nop xor $16465, %rbx movups (%rbp), %xmm6 vpextrq $0, %xmm6, %r15 nop nop nop nop dec %rbp lea addresses_UC_ht+0x7bc0, %rsi lea addresses_WT_ht+0xb4a0, %rdi xor $3897, %r13 mov $118, %rcx rep movsw nop nop nop nop nop xor %r13, %r13 lea addresses_WC_ht+0x25b0, %rsi lea addresses_normal_ht+0x16dac, %rdi clflush (%rdi) sub %r15, %r15 mov $50, %rcx rep movsl nop nop sub %rcx, %rcx lea addresses_normal_ht+0xdbc8, %rsi lea addresses_A_ht+0x12338, %rdi nop nop dec %r13 mov $26, %rcx rep movsb nop and %rcx, %rcx lea addresses_normal_ht+0xec88, %rsi lea addresses_normal_ht+0x1948, %rdi nop nop nop dec %rbp mov $102, %rcx rep movsq nop nop nop nop nop dec %rbp lea addresses_WC_ht+0x134e8, %rsi lea addresses_WT_ht+0x1d7a8, %rdi clflush (%rsi) nop nop nop add %r13, %r13 mov $111, %rcx rep movsq nop cmp %rbp, %rbp lea addresses_WT_ht+0x3c8, %r10 nop nop nop nop inc %rdi mov $0x6162636465666768, %r13 movq %r13, (%r10) nop and %rsi, %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r8 push %rcx push %rdx push %rsi // Store lea addresses_WT+0x1478, %rsi nop sub $52093, %rdx movl $0x51525354, (%rsi) nop nop and $35611, %rdx // Store lea addresses_RW+0x16488, %r12 dec %rcx mov $0x5152535455565758, %rsi movq %rsi, %xmm4 vmovups %ymm4, (%r12) cmp $46324, %rcx // Store lea addresses_US+0xef08, %rdx nop nop and $11183, %r10 mov $0x5152535455565758, %r12 movq %r12, %xmm5 movups %xmm5, (%rdx) nop nop nop add %r8, %r8 // Faulty Load lea addresses_UC+0x4bc8, %r10 nop nop and $1268, %rcx mov (%r10), %dx lea oracles, %r8 and $0xff, %rdx shlq $12, %rdx mov (%r8,%rdx,1), %rdx pop %rsi pop %rdx pop %rcx pop %r8 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': True, 'congruent': 4, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 6, 'size': 16, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 6, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 10, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': True, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 3, 'size': 16, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
module-06/src/oedipus-elementary_functions.adb
morellam-dev/cs-4308-concepts-of-programming-languages
0
18959
<gh_stars>0 -- FILE: oedipus-elementary_functions.adb LICENSE: MIT © 2021 <NAME> with Oedipus; use Oedipus; package body Oedipus.Elementary_Functions is function "+" (C1, C2 : in Complex) return Complex is Sum : Complex := Create_Complex (Get_Real (C1) + Get_Real (C2), Get_Imaginary (C1) + Get_Imaginary (C2)); begin return Sum; end "+"; function "-" (C : in Complex) return Complex is Neg : Complex := Create_Complex (-Get_Real (C), -Get_Imaginary (C)); begin return Neg; end "-"; function "+" (C : in Complex) return Complex is begin return C; end "+"; function "-" (C1, C2 : in Complex) return Complex is begin -- Depends on "+" and "-" operation return C1 + (-C2); end "-"; function "*" (C1, C2 : in Complex) return Complex is Prod : Complex := Create_Complex (Get_Real (C1) * Get_Real (C2) - Get_Imaginary (C1) * Get_Imaginary (C2), Get_Real (C1) * Get_Imaginary (C2) + Get_Imaginary (C1) * Get_Real (C2)); begin return Prod; end "*"; function Reciprocal (C : in Complex) return Complex is Denom : Float := Get_Real (C) * Get_Real (C) + Get_Imaginary (C) * Get_Imaginary (C); Recip : Complex := Create_Complex (A => Get_Real (C) / Denom, B => -Get_Imaginary (C) / Denom); begin if Denom = 0.0 then raise Div_By_Zero with "Cannot take reciprocal of 0.0 + 0.0i"; end if; return Recip; end Reciprocal; function "/" (C1, C2 : in Complex) return Complex is begin return C1 * Reciprocal (C2); end "/"; end Oedipus.Elementary_Functions;
programs/oeis/033/A033338.asm
karttu/loda
1
173238
; A033338: [ 18/n ]. ; 18,9,6,4,3,3,2,2,2,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 add $0,1 mov $1,18 div $1,$0
examples/tests/expected/01_arithmetic.asm
aidnem/jenga-lang
0
22340
section .text extern _printf extern _exit global _main _main: word_0: ;; -- push 99 -- push 99 word_1: ;; -- push 1 -- push 1 word_2: ;; -- add -- pop rax pop rbx add rax, rbx push rax word_3: ;; -- dump -- mov rdi, dump_msg pop rsi call _printf word_4: ;; -- push 86 -- push 86 word_5: ;; -- push 40 -- push 40 word_6: ;; -- sub -- pop rax pop rbx sub rbx, rax push rbx word_7: ;; -- push 6 -- push 6 word_8: ;; -- sub -- pop rax pop rbx sub rbx, rax push rbx word_9: ;; -- push 2 -- push 2 word_10: ;; -- add -- pop rax pop rbx add rax, rbx push rax word_11: ;; -- dump -- mov rdi, dump_msg pop rsi call _printf word_12: ;; -- push 100 -- push 100 word_13: ;; -- dup -- pop rax push rax push rax word_14: ;; -- push 2 -- push 2 word_15: ;; -- divmod -- xor edx, edx pop rbx pop rax cqo idiv rbx push rax push rdx word_16: ;; -- drop -- pop rax word_17: ;; -- push 7 -- push 7 word_18: ;; -- add -- pop rax pop rbx add rax, rbx push rax word_19: ;; -- push 2 -- push 2 word_20: ;; -- sub -- pop rax pop rbx sub rbx, rax push rbx word_21: ;; -- dump -- mov rdi, dump_msg pop rsi call _printf word_22: ;; -- push 2 -- push 2 word_23: ;; -- mult -- pop rax pop rbx imul rbx push rax word_24: ;; -- dup -- pop rax push rax push rax word_25: ;; -- dump -- mov rdi, dump_msg pop rsi call _printf word_26: ;; -- dump -- mov rdi, dump_msg pop rsi call _printf ;; -- EOF -- word_27: xor rdi, rdi call _exit section .data dump_msg: db `%d\n`, 0 section .bss mem: resb 640000
test/Fail/Issue3517/S.agda
cruhland/agda
1,989
3433
{-# OPTIONS --safe --sized-types #-} module Issue3517.S where open import Agda.Builtin.Size public
lib/applescript/Music/state.scpt
fossabot/CatalinaScrobbler
0
3899
on run set info to "" tell application id "com.apple.Music" if player state is paused then set playerStateText to "Paused" else if player state is playing then set playerStateText to "Playing" else set playerStateText to "Stopped" end if end tell return playerStateText end run
data/text/battle.asm
Dev727/ancientplatinum
28
92554
BattleText:: ; used only for BANK(BattleText) BattleText_PlayerPickedUpPayDayMoney: text "<PLAYER> picked up" line "¥@" text_decimal wPayDayMoney, 3, 6 text "!" prompt WildPokemonAppearedText: text "Wild @" text_ram wEnemyMonNick text_start line "appeared!" prompt HookedPokemonAttackedText: text "The hooked" line "@" text_ram wEnemyMonNick text_start cont "attacked!" prompt PokemonFellFromTreeText: text_ram wEnemyMonNick text " fell" line "out of the tree!" prompt WildCelebiAppearedText: text "Wild @" text_ram wEnemyMonNick text_start line "appeared!" prompt WantsToBattleText:: text "<ENEMY>" line "wants to battle!" prompt BattleText_WildFled: text "Wild @" text_ram wEnemyMonNick text_start line "fled!" prompt BattleText_EnemyFled: text "Enemy @" text_ram wEnemyMonNick text_start line "fled!" prompt HurtByPoisonText: text "<USER>" line "is hurt by poison!" prompt HurtByBurnText: text "<USER>'s" line "hurt by its burn!" prompt LeechSeedSapsText: text "LEECH SEED saps" line "<USER>!" prompt HasANightmareText: text "<USER>" line "has a NIGHTMARE!" prompt HurtByCurseText: text "<USER>'s" line "hurt by the CURSE!" prompt SandstormHitsText: text "The SANDSTORM hits" line "<USER>!" prompt PerishCountText: text "<USER>'s" line "PERISH count is @" text_decimal wDeciramBuffer, 1, 1 text "!" prompt BattleText_TargetRecoveredWithItem: text "<TARGET>" line "recovered with" cont "@" text_ram wStringBuffer1 text "." prompt BattleText_UserRecoveredPPUsing: text "<USER>" line "recovered PP using" cont "@" text_ram wStringBuffer1 text "." prompt BattleText_TargetWasHitByFutureSight: text "<TARGET>" line "was hit by FUTURE" cont "SIGHT!" prompt BattleText_SafeguardFaded: text "<USER>'s" line "SAFEGUARD faded!" prompt BattleText_MonsLightScreenFell: text_ram wStringBuffer1 text " #MON's" line "LIGHT SCREEN fell!" prompt BattleText_MonsReflectFaded: text_ram wStringBuffer1 text " #MON's" line "REFLECT faded!" prompt BattleText_RainContinuesToFall: text "Rain continues to" line "fall." prompt BattleText_TheSunlightIsStrong: text "The sunlight is" line "strong." prompt BattleText_TheSandstormRages: text "The SANDSTORM" line "rages." prompt BattleText_TheRainStopped: text "The rain stopped." prompt BattleText_TheSunlightFaded: text "The sunlight" line "faded." prompt BattleText_TheSandstormSubsided: text "The SANDSTORM" line "subsided." prompt BattleText_EnemyMonFainted: text "Enemy @" text_ram wEnemyMonNick text_start line "fainted!" prompt GotMoneyForWinningText: text "<PLAYER> got ¥@" text_decimal wBattleReward, 3, 6 text_start line "for winning!" prompt BattleText_EnemyWasDefeated: text "<ENEMY>" line "was defeated!" prompt TiedAgainstText: text "Tied against" line "<ENEMY>!" prompt SentSomeToMomText: text "<PLAYER> got ¥@" text_decimal wBattleReward, 3, 6 text_start line "for winning!" cont "Sent some to MOM!" prompt SentHalfToMomText: text "Sent half to MOM!" prompt SentAllToMomText: text "Sent all to MOM!" prompt BattleText_0x80a4f: text "<RIVAL>: Huh? I" line "should've chosen" cont "your #MON!" prompt BattleText_MonFainted: text_ram wBattleMonNick text_start line "fainted!" prompt BattleText_UseNextMon: text "Use next #MON?" done BattleText_0x80a93: text "<RIVAL>: Yes!" line "I guess I chose a" cont "good #MON!" prompt LostAgainstText: text "Lost against" line "<ENEMY>!" prompt BattleText_EnemyIsAboutToUseWillPlayerChangeMon: text "<ENEMY>" line "is about to use" cont "@" text_ram wEnemyMonNick text "." para "Will <PLAYER>" line "change #MON?" done BattleText_EnemySentOut: text "<ENEMY>" line "sent out" cont "@" text_ram wEnemyMonNick text "!" done BattleText_TheresNoWillToBattle: text "There's no will to" line "battle!" prompt BattleText_AnEGGCantBattle: text "An EGG can't" line "battle!" prompt BattleText_CantEscape2: text "Can't escape!" prompt BattleText_TheresNoEscapeFromTrainerBattle: text "No! There's no" line "running from a" cont "trainer battle!" prompt BattleText_GotAwaySafely: text "Got away safely!" prompt BattleText_UserFledUsingAStringBuffer1: text "<USER>" line "fled using a" cont "@" text_ram wStringBuffer1 text "!" prompt BattleText_CantEscape: text "Can't escape!" prompt BattleText_UserHurtBySpikes: text "<USER>'s" line "hurt by SPIKES!" prompt RecoveredUsingText: text "<TARGET>" line "recovered using a" cont "@" text_ram wStringBuffer1 text "!" prompt BattleText_UsersStringBuffer1Activated: text "<USER>'s" line "@" text_ram wStringBuffer1 text_start cont "activated!" prompt BattleText_ItemsCantBeUsedHere: text "Items can't be" line "used here." prompt BattleText_MonIsAlreadyOut: text_ram wBattleMonNick text_start line "is already out." prompt BattleText_MonCantBeRecalled: text_ram wBattleMonNick text_start line "can't be recalled!" prompt BattleText_TheresNoPPLeftForThisMove: text "There's no PP left" line "for this move!" prompt BattleText_TheMoveIsDisabled: text "The move is" line "DISABLED!" prompt BattleText_MonHasNoMovesLeft: text_ram wBattleMonNick text_start line "has no moves left!" done BattleText_TargetsEncoreEnded: text "<TARGET>'s" line "ENCORE ended!" prompt BattleText_StringBuffer1GrewToLevel: text_ram wStringBuffer1 text " grew to" line "level @" text_decimal wCurPartyLevel, 1, 3 text "!@" sound_dex_fanfare_50_79 text_end text_end ; unused BattleText_WildMonIsEating: text "Wild @" text_ram wEnemyMonNick text_start line "is eating!" prompt BattleText_WildMonIsAngry: text "Wild @" text_ram wEnemyMonNick text_start line "is angry!" prompt FastAsleepText: text "<USER>" line "is fast asleep!" prompt WokeUpText: text "<USER>" line "woke up!" prompt FrozenSolidText: text "<USER>" line "is frozen solid!" prompt FlinchedText: text "<USER>" line "flinched!" prompt MustRechargeText: text "<USER>" line "must recharge!" prompt DisabledNoMoreText: text "<USER>'s" line "disabled no more!" prompt IsConfusedText: text "<USER>" line "is confused!" prompt HurtItselfText: text "It hurt itself in" line "its confusion!" prompt ConfusedNoMoreText: text "<USER>'s" line "confused no more!" prompt BecameConfusedText: text "<TARGET>" line "became confused!" prompt BattleText_ItemHealedConfusion: text "A @" text_ram wStringBuffer1 text " rid" line "<TARGET>" cont "of its confusion." prompt AlreadyConfusedText: text "<TARGET>'s" line "already confused!" prompt BattleText_UsersHurtByStringBuffer1: text "<USER>'s" line "hurt by" cont "@" text_ram wStringBuffer1 text "!" prompt BattleText_UserWasReleasedFromStringBuffer1: text "<USER>" line "was released from" cont "@" text_ram wStringBuffer1 text "!" prompt UsedBindText: text "<USER>" line "used BIND on" cont "<TARGET>!" prompt WhirlpoolTrapText: text "<TARGET>" line "was trapped!" prompt FireSpinTrapText: text "<TARGET>" line "was trapped!" prompt WrappedByText: text "<TARGET>" line "was WRAPPED by" cont "<USER>!" prompt ClampedByText: text "<TARGET>" line "was CLAMPED by" cont "<USER>!" prompt StoringEnergyText: text "<USER>" line "is storing energy!" prompt UnleashedEnergyText: text "<USER>" line "unleashed energy!" prompt HungOnText: text "<TARGET>" line "hung on with" cont "@" text_ram wStringBuffer1 text "!" prompt EnduredText: text "<TARGET>" line "ENDURED the hit!" prompt InLoveWithText: text "<USER>" line "is in love with" cont "<TARGET>!" prompt InfatuationText: text "<USER>'s" line "infatuation kept" cont "it from attacking!" prompt DisabledMoveText: text "<USER>'s" line "@" text_ram wStringBuffer1 text " is" cont "DISABLED!" prompt LoafingAroundText: text_ram wBattleMonNick text " is" line "loafing around." prompt BeganToNapText: text_ram wBattleMonNick text " began" line "to nap!" prompt WontObeyText: text_ram wBattleMonNick text " won't" line "obey!" prompt TurnedAwayText: text_ram wBattleMonNick text " turned" line "away!" prompt IgnoredOrdersText: text_ram wBattleMonNick text " ignored" line "orders!" prompt IgnoredSleepingText: text_ram wBattleMonNick text " ignored" line "orders…sleeping!" prompt NoPPLeftText: text "But no PP is left" line "for the move!" prompt HasNoPPLeftText: text "<USER>" line "has no PP left for" cont "@" text_ram wStringBuffer2 text "!" prompt WentToSleepText: text "<USER>" line "went to sleep!" done RestedText: text "<USER>" line "fell asleep and" cont "became healthy!" done RegainedHealthText: text "<USER>" line "regained health!" prompt AttackMissedText: text "<USER>'s" line "attack missed!" prompt AttackMissed2Text: text "<USER>'s" line "attack missed!" prompt CrashedText: text "<USER>" line "kept going and" cont "crashed!" prompt UnaffectedText: text "<TARGET>'s" line "unaffected!" prompt DoesntAffectText: text "It doesn't affect" line "<TARGET>!" prompt CriticalHitText: text "A critical hit!" prompt OneHitKOText: text "It's a one-hit KO!" prompt SuperEffectiveText: text "It's super-" line "effective!" prompt NotVeryEffectiveText: text "It's not very" line "effective…" prompt TookDownWithItText: text "<TARGET>" line "took down with it," cont "<USER>!" prompt RageBuildingText: text "<USER>'s" line "RAGE is building!" prompt GotAnEncoreText: text "<TARGET>" line "got an ENCORE!" prompt SharedPainText: text "The battlers" line "shared pain!" prompt TookAimText: text "<USER>" line "took aim!" prompt SketchedText: text "<USER>" line "SKETCHED" cont "@" text_ram wStringBuffer1 text "!" prompt DestinyBondEffectText: text "<USER>'s" line "trying to take its" cont "opponent with it!" prompt SpiteEffectText: text "<TARGET>'s" line "@" text_ram wStringBuffer1 text " was" cont "reduced by @" text_decimal wDeciramBuffer, 1, 1 text "!" prompt BellChimedText: text "A bell chimed!" line "" prompt FellAsleepText: text "<TARGET>" line "fell asleep!" prompt AlreadyAsleepText: text "<TARGET>'s" line "already asleep!" prompt WasPoisonedText: text "<TARGET>" line "was poisoned!" prompt BadlyPoisonedText: text "<TARGET>'s" line "badly poisoned!" prompt AlreadyPoisonedText: text "<TARGET>'s" line "already poisoned!" prompt SuckedHealthText: text "Sucked health from" line "<TARGET>!" prompt DreamEatenText: text "<TARGET>'s" line "dream was eaten!" prompt WasBurnedText: text "<TARGET>" line "was burned!" prompt DefrostedOpponentText: text "<TARGET>" line "was defrosted!" prompt WasFrozenText: text "<TARGET>" line "was frozen solid!" prompt WontRiseAnymoreText: text "<USER>'s" line "@" text_ram wStringBuffer2 text " won't" cont "rise anymore!" prompt WontDropAnymoreText: text "<TARGET>'s" line "@" text_ram wStringBuffer2 text " won't" cont "drop anymore!" prompt FledFromBattleText:: text "<USER>" line "fled from battle!" prompt FledInFearText: text "<TARGET>" line "fled in fear!" prompt BlownAwayText: text "<TARGET>" line "was blown away!" prompt PlayerHitTimesText: text "Hit @" text_decimal wPlayerDamageTaken, 1, 1 text " times!" prompt EnemyHitTimesText: text "Hit @" text_decimal wEnemyDamageTaken, 1, 1 text " times!" prompt MistText: text "<USER>'s" line "shrouded in MIST!" prompt ProtectedByMistText: text "<TARGET>'s" line "protected by MIST." prompt GettingPumpedText: text_pause text "<USER>'s" line "getting pumped!" prompt RecoilText: text "<USER>'s" line "hit with recoil!" prompt MadeSubstituteText: text "<USER>" line "made a SUBSTITUTE!" prompt HasSubstituteText: text "<USER>" line "has a SUBSTITUTE!" prompt TooWeakSubText: text "Too weak to make" line "a SUBSTITUTE!" prompt SubTookDamageText: text "The SUBSTITUTE" line "took damage for" cont "<TARGET>!" prompt SubFadedText: text "<TARGET>'s" line "SUBSTITUTE faded!" prompt LearnedMoveText: text "<USER>" line "learned" cont "@" text_ram wStringBuffer1 text "!" prompt WasSeededText: text "<TARGET>" line "was seeded!" prompt EvadedText: text "<TARGET>" line "evaded the attack!" prompt WasDisabledText: text "<TARGET>'s" line "@" text_ram wStringBuffer1 text " was" cont "DISABLED!" prompt CoinsScatteredText: text "Coins scattered" line "everywhere!" prompt TransformedTypeText: text "<USER>" line "transformed into" cont "the @" text_ram wStringBuffer1 text "-type!" prompt EliminatedStatsText: text "All stat changes" line "were eliminated!" prompt TransformedText: text "<USER>" line "TRANSFORMED into" cont "@" text_ram wStringBuffer1 text "!" prompt LightScreenEffectText: text "<USER>'s" line "SPCL.DEF rose!" prompt ReflectEffectText: text "<USER>'s" line "DEFENSE rose!" prompt NothingHappenedText: text "But nothing" line "happened." prompt ButItFailedText: text "But it failed!" prompt ItFailedText: text "It failed!" prompt DidntAffect1Text: text "It didn't affect" line "<TARGET>!" prompt DidntAffect2Text: text "It didn't affect" line "<TARGET>!" prompt HPIsFullText: text "<USER>'s" line "HP is full!" prompt DraggedOutText: text "<USER>" line "was dragged out!" prompt ParalyzedText: text "<TARGET>'s" line "paralyzed! Maybe" cont "it can't attack!" prompt FullyParalyzedText: text "<USER>'s" line "fully paralyzed!" prompt AlreadyParalyzedText: text "<TARGET>'s" line "already paralyzed!" prompt ProtectedByText: text "<TARGET>'s" line "protected by" cont "@" text_ram wStringBuffer1 text "!" prompt MirrorMoveFailedText: text "The MIRROR MOVE" next "failed!" prompt StoleText: text "<USER>" line "stole @" text_ram wStringBuffer1 text_start cont "from its foe!" prompt CantEscapeNowText: text "<TARGET>" line "can't escape now!" prompt StartedNightmareText: text "<TARGET>" line "started to have a" cont "NIGHTMARE!" prompt WasDefrostedText: text "<USER>" line "was defrosted!" prompt PutACurseText: text "<USER>" line "cut its own HP and" para "put a CURSE on" line "<TARGET>!" prompt ProtectedItselfText: text "<USER>" line "PROTECTED itself!" prompt ProtectingItselfText: text "<TARGET>'s" line "PROTECTING itself!" done SpikesText: text "SPIKES scattered" line "all around" cont "<TARGET>!" prompt IdentifiedText: text "<USER>" line "identified" cont "<TARGET>!" prompt StartPerishText: text "Both #MON will" line "faint in 3 turns!" prompt SandstormBrewedText: text "A SANDSTORM" line "brewed!" prompt BracedItselfText: text "<USER>" line "braced itself!" prompt FellInLoveText: text "<TARGET>" line "fell in love!" prompt CoveredByVeilText: text "<USER>'s" line "covered by a veil!" prompt SafeguardProtectText: text "<TARGET>" line "is protected by" cont "SAFEGUARD!" prompt MagnitudeText: text "Magnitude @" text_decimal wDeciramBuffer, 1, 1 text "!" prompt ReleasedByText: text "<USER>" line "was released by" cont "<TARGET>!" prompt ShedLeechSeedText: text "<USER>" line "shed LEECH SEED!" prompt BlewSpikesText: text "<USER>" line "blew away SPIKES!" prompt DownpourText: text "A downpour" line "started!" prompt SunGotBrightText: text "The sunlight got" line "bright!" prompt BellyDrumText: text "<USER>" line "cut its HP and" cont "maximized ATTACK!" prompt CopiedStatsText: text "<USER>" line "copied the stat" para "changes of" line "<TARGET>!" prompt ForesawAttackText: text "<USER>" line "foresaw an attack!" prompt BeatUpAttackText: text_ram wStringBuffer1 text "'s" line "attack!" done RefusedGiftText: text "<TARGET>" line "refused the gift!" prompt IgnoredOrders2Text: text "<USER>" line "ignored orders!" prompt BattleText_LinkErrorBattleCanceled: text "Link error…" para "The battle has" line "been canceled…" prompt BattleText_0x8188e: text "There is no time" line "left today!" done
Task/Metered-concurrency/Ada/metered-concurrency-1.ada
LaudateCorpus1/RosettaCodeData
1
21145
package Semaphores is protected type Counting_Semaphore(Max : Positive) is entry Acquire; procedure Release; function Count return Natural; private Lock_Count : Natural := 0; end Counting_Semaphore; end Semaphores;
oeis/074/A074845.asm
neoneye/loda-programs
11
243750
<reponame>neoneye/loda-programs ; A074845: Numbers n such that S(n) = largest difference between consecutive divisors of n (ordered by size), where S(n) is the Kempner function (A002034). ; Submitted by <NAME>(s1) ; 6,8,9,10,14,22,26,34,38,46,58,62,74,82,86,94,106,118,122,134,142,146,158,166,178,194,202,206,214,218,226,254,262,274,278,298,302,314,326,334,346,358,362,382,386,394,398,422,446,454,458,466,478,482,502,514,526,538,542,554,562,566,586,614,622,626,634,662,674,694,698,706,718,734,746,758,766,778,794,802,818,838,842,862,866,878,886,898,914,922,926,934,958,974,982,998,1006,1018,1042,1046 mov $2,$0 mov $3,$0 seq $0,161344 ; Numbers k with A033676(k)=2, where A033676 is the largest divisor <= sqrt(k). cmp $3,0 add $2,$3 mov $4,2 div $4,$2 add $0,$4
third_party/antlr_grammars_v4/dice/DiceNotation.g4
mikhan808/rsyntaxtextarea-antlr4-extension
5
1283
/** * Copyright 2014-2019 the original author or authors * * 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. */ /** * Dice notation grammar. * * This is the notation which RPGs and other tabletop games use to represent operations with dice. */ grammar DiceNotation; options { tokenVocab=DiceNotationLexer; } /** * Rules. */ notation : dice | number | addOp ; addOp : multOp (ADDOPERATOR multOp)* ; multOp : operand (MULTOPERATOR operand)* ; operand : dice | number | LPAREN notation RPAREN ; dice : ADDOPERATOR? DIGIT? DSEPARATOR DIGIT ; number : ADDOPERATOR? DIGIT ;
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_19.asm
ljhsiun2/medusa
9
8286
<filename>Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_19.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_WT_ht+0x15426, %rsi nop nop nop add $55041, %r10 movups (%rsi), %xmm3 vpextrq $0, %xmm3, %r13 nop nop nop nop xor %rbp, %rbp lea addresses_A_ht+0x8e9f, %r12 nop nop nop sub $11904, %rax movb $0x61, (%r12) nop nop nop nop add %rsi, %rsi lea addresses_normal_ht+0x11b06, %rsi lea addresses_A_ht+0xa2fa, %rdi nop nop nop nop nop xor %r10, %r10 mov $42, %rcx rep movsw cmp %rcx, %rcx lea addresses_WT_ht+0xcde6, %r10 nop nop nop nop cmp $34287, %rdi mov $0x6162636465666768, %rbp movq %rbp, %xmm6 vmovups %ymm6, (%r10) nop xor $55453, %rax pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %r15 push %rcx push %rdx push %rsi // Store lea addresses_WT+0x1e6, %r14 nop nop nop nop nop xor %r12, %r12 mov $0x5152535455565758, %r15 movq %r15, (%r14) nop nop inc %r14 // Store lea addresses_WT+0x12ae6, %r15 cmp %rcx, %rcx mov $0x5152535455565758, %r10 movq %r10, (%r15) sub %r14, %r14 // Store lea addresses_PSE+0x10560, %r10 nop sub %rcx, %rcx movw $0x5152, (%r10) nop add %r12, %r12 // Store lea addresses_UC+0x1a0e6, %r15 nop nop nop nop sub $42546, %r12 movl $0x51525354, (%r15) nop inc %rcx // Faulty Load lea addresses_A+0x1cde6, %rcx nop nop nop sub %r15, %r15 mov (%rcx), %si lea oracles, %rcx and $0xff, %rsi shlq $12, %rsi mov (%rcx,%rsi,1), %rsi pop %rsi pop %rdx pop %rcx pop %r15 pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': True, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 7, 'size': 4, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 6, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': True}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 8, 'size': 32, 'same': True, 'NT': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
libsrc/target/krokha/stdio/generic_console.asm
ahjelm/z88dk
640
13624
<filename>libsrc/target/krokha/stdio/generic_console.asm ; Generic console driver for the Krokha ("tiny") SECTION code_clib PUBLIC generic_console_cls PUBLIC generic_console_vpeek PUBLIC generic_console_printc PUBLIC generic_console_scrollup PUBLIC generic_console_ioctl PUBLIC generic_console_set_ink PUBLIC generic_console_set_paper PUBLIC generic_console_set_attribute EXTERN generic_console_flags EXTERN asm_toupper EXTERN CONSOLE_COLUMNS EXTERN CONSOLE_ROWS defc DISPLAY = $ea00 INCLUDE "ioctl.def" PUBLIC CLIB_GENCON_CAPS defc CLIB_GENCON_CAPS = 0 generic_console_ioctl: scf generic_console_set_ink: generic_console_set_paper: generic_console_set_attribute: ret generic_console_cls: ld hl,DISPLAY ld bc,+(CONSOLE_COLUMNS * CONSOLE_ROWS) cls_1: ld (hl),32 inc hl dec bc ld a,b or c jp nz,cls_1 ret ; c = x ; b = y ; a = d = character to print ; e = raw generic_console_printc: ld a,e and a jp nz,rawmode ld a,d call asm_toupper ld d,a rawmode: ld a,d call xypos ;Preserves a ld (hl),a ret ;Entry: c = x, ; b = y ; e = rawmode ;Exit: nc = success ; a = character, ; c = failure generic_console_vpeek: call xypos ld a,(hl) and a ret ; b = row ; c = column xypos: ld l,c ld h,0 add hl,hl ;*2 add hl,hl ;*4 add hl,hl ;*8 add hl,hl ;*16 add hl,hl ;*32 ld c,b ld b,+(DISPLAY / 256) add hl,bc ret generic_console_scrollup: push de push bc ld hl, DISPLAY + 1 ld de, DISPLAY ld bc,+(CONSOLE_COLUMNS*(CONSOLE_ROWS-1))-1 scroll1: ld a,(hl) ld (de),a inc de inc hl dec bc ld a,b or c jp nz,scroll1 ld b,CONSOLE_ROWS-1 ld c,0 call xypos ld b,CONSOLE_COLUMNS clear1: ld (hl),32 ld de,CONSOLE_ROWS add hl,de dec b jp nz,clear1 pop bc pop de ret
libsrc/_DEVELOPMENT/compress/zx0/z80/asm_dzx0_standard.asm
ahjelm/z88dk
640
19803
<gh_stars>100-1000 SECTION code_lib SECTION code_compress_zx0 PUBLIC asm_dzx0_standard asm_dzx0_standard: INCLUDE "dzx0_standard.asm"
P6/data_P6_2/ALUTest153.asm
alxzzhou/BUAA_CO_2020
1
89804
addiu $1,$1,-8375 sb $5,6($0) slti $4,$4,24821 sb $6,8($0) sltu $4,$3,$3 lb $3,9($0) addiu $6,$0,-16224 addiu $4,$3,1361 sb $3,13($0) lhu $4,8($0) sll $6,$4,30 sh $3,12($0) subu $5,$5,$3 srlv $3,$3,$3 slti $1,$2,-1483 sh $4,6($0) lb $3,5($0) nor $5,$6,$3 sh $3,8($0) or $4,$5,$3 sll $4,$1,19 addiu $4,$5,20675 sra $5,$4,29 srlv $5,$5,$3 lh $3,8($0) addu $1,$5,$3 addu $4,$5,$3 lb $0,16($0) addiu $3,$3,11912 lhu $1,2($0) srl $1,$1,0 lb $4,14($0) sltu $5,$4,$3 or $1,$4,$3 sh $4,0($0) srl $4,$0,19 ori $3,$5,55456 xori $5,$1,56814 and $4,$0,$3 subu $1,$4,$3 sllv $3,$3,$3 srl $1,$4,15 sll $1,$1,25 slti $6,$3,60 subu $5,$4,$3 nor $5,$3,$3 subu $6,$1,$3 lb $5,1($0) addu $3,$2,$3 srlv $1,$0,$3 sltiu $4,$5,-24515 subu $0,$5,$3 lw $3,8($0) nor $1,$3,$3 slt $5,$4,$3 subu $3,$0,$3 andi $4,$2,25643 subu $4,$6,$3 or $1,$0,$3 addu $3,$3,$3 sra $4,$4,8 slt $3,$5,$3 slti $4,$1,12785 addu $5,$3,$3 lhu $4,8($0) sltu $5,$5,$3 sllv $4,$1,$3 sw $5,4($0) srl $4,$0,26 sltu $3,$4,$3 ori $5,$5,37270 slti $5,$3,-27255 lw $1,16($0) lbu $3,11($0) sltu $3,$3,$3 subu $0,$3,$3 sltiu $1,$4,9470 sll $3,$5,23 andi $1,$4,28509 lhu $5,14($0) sll $4,$3,10 ori $0,$5,45858 lw $3,8($0) lb $4,7($0) and $0,$0,$3 lhu $1,16($0) lh $3,16($0) ori $1,$1,29577 sw $3,16($0) xor $5,$4,$3 subu $0,$2,$3 sh $5,12($0) sltiu $4,$0,23879 srlv $4,$3,$3 lb $3,1($0) subu $1,$3,$3 sh $4,8($0) sw $4,16($0) sh $0,12($0) nor $5,$4,$3 ori $1,$3,15880 xor $6,$4,$3 lh $4,14($0) addiu $3,$3,-4920 andi $4,$0,15751 sllv $3,$4,$3 xori $1,$3,31813 slt $1,$1,$3 ori $3,$4,46120 andi $5,$0,19344 addiu $6,$6,-5172 lw $0,16($0) srlv $6,$5,$3 or $3,$4,$3 sra $3,$3,26 addu $3,$3,$3 addu $5,$5,$3 subu $3,$0,$3 lbu $3,11($0) sw $1,16($0) sb $6,11($0) xor $6,$3,$3 sw $5,4($0) xori $5,$3,18721 addiu $5,$5,-14970 sb $5,10($0) sw $4,4($0) ori $3,$4,45518 subu $1,$3,$3 sltu $1,$5,$3 sw $3,4($0) sh $4,2($0) slti $4,$4,25407 sh $0,10($0) sll $3,$0,13 lh $5,2($0) xor $4,$1,$3 sra $3,$3,25 lbu $3,3($0) nor $5,$1,$3 lb $5,6($0) srav $5,$3,$3 nor $5,$5,$3 addu $0,$3,$3 slti $0,$5,-7314 sra $4,$3,2 and $4,$5,$3 lh $4,10($0) subu $4,$5,$3 subu $4,$2,$3 ori $3,$5,1047 or $5,$5,$3 xor $1,$3,$3 sltu $6,$1,$3 ori $1,$4,45253 or $4,$3,$3 xori $3,$4,36560 sltu $3,$3,$3 sllv $5,$4,$3 nor $5,$5,$3 subu $3,$6,$3 lb $4,11($0) ori $3,$3,12365 sh $1,12($0) and $3,$5,$3 xor $4,$5,$3 lhu $5,12($0) sra $3,$3,26 sb $3,0($0) lhu $1,14($0) addiu $5,$1,14372 subu $1,$6,$3 srl $3,$2,11 nor $4,$4,$3 xori $6,$3,46157 addiu $4,$4,19887 sltu $3,$3,$3 lw $1,4($0) subu $3,$5,$3 lw $0,8($0) sltiu $6,$2,11032 sltu $6,$1,$3 addiu $0,$4,1383 sra $6,$2,20 sllv $6,$5,$3 addiu $5,$5,-31377 or $4,$4,$3 sltu $1,$6,$3 slti $0,$3,-752 addiu $3,$3,17256 srl $1,$1,3 lw $6,0($0) ori $0,$0,2216 addu $1,$1,$3 slt $4,$3,$3 srlv $1,$1,$3 andi $0,$0,11571 sra $3,$3,25 lhu $0,14($0) slt $4,$0,$3 srav $4,$3,$3 sw $3,0($0) subu $4,$3,$3 or $4,$3,$3 addu $1,$4,$3 slti $1,$5,-30364 sw $5,12($0) srav $5,$1,$3 sltiu $1,$3,-599 lw $3,8($0) subu $4,$3,$3 and $1,$1,$3 srl $0,$0,30 sllv $4,$0,$3 addu $3,$1,$3 srl $3,$4,15 srlv $4,$4,$3 addu $6,$4,$3 sra $0,$4,25 slt $4,$1,$3 ori $1,$5,35298 lhu $5,14($0) nor $5,$2,$3 srlv $5,$3,$3 srav $4,$5,$3 slt $6,$1,$3 sw $5,12($0) subu $5,$6,$3 slt $4,$3,$3 sltiu $3,$1,-11173 srlv $6,$6,$3 lb $5,3($0) ori $3,$3,11461 slti $3,$3,16035 sw $1,16($0) sllv $4,$3,$3 lhu $0,8($0) lh $3,16($0) subu $1,$6,$3 sw $5,4($0) sh $3,4($0) slti $3,$4,28760 sltu $3,$1,$3 subu $3,$6,$3 sllv $3,$3,$3 lhu $0,10($0) subu $0,$4,$3 srav $0,$3,$3 sltu $3,$0,$3 andi $3,$4,48947 srlv $4,$4,$3 lb $4,4($0) xor $0,$1,$3 srav $3,$2,$3 sh $3,4($0) and $5,$4,$3 slt $6,$3,$3 subu $3,$1,$3 sll $3,$3,15 lb $4,1($0) srlv $5,$5,$3 subu $6,$6,$3 subu $5,$5,$3 sllv $5,$3,$3 or $4,$3,$3 lw $3,8($0) addu $6,$0,$3 sllv $4,$3,$3 sw $4,8($0) sltu $3,$3,$3 or $3,$3,$3 srlv $1,$5,$3 xori $4,$4,57996 lhu $4,2($0) addu $4,$0,$3 srav $1,$4,$3 sllv $3,$3,$3 and $3,$0,$3 xori $3,$1,35557 lbu $1,8($0) sh $3,12($0) lb $4,15($0) slti $5,$1,13628 addiu $1,$4,17140 sh $5,8($0) sllv $1,$5,$3 srl $6,$4,14 sll $4,$3,29 addiu $3,$4,-9033 srlv $1,$3,$3 addu $5,$2,$3 lbu $1,8($0) addu $1,$1,$3 addiu $4,$4,28045 lb $1,3($0) sh $1,8($0) sw $4,0($0) sltiu $5,$2,13964 ori $4,$4,54793 slt $3,$3,$3 and $4,$4,$3 lh $3,4($0) addu $3,$3,$3 sh $6,10($0) or $1,$4,$3 or $4,$4,$3 addiu $6,$3,-24223 sltu $3,$3,$3 lbu $3,9($0) slti $3,$5,20256 nor $1,$1,$3 srav $1,$4,$3 lhu $2,12($0) sltu $5,$4,$3 slt $1,$4,$3 addiu $3,$3,-10275 xori $4,$4,28163 sb $1,0($0) addu $4,$5,$3 sltu $3,$4,$3 sltiu $3,$4,14343 xor $3,$4,$3 lb $5,14($0) lh $4,16($0) subu $4,$4,$3 lw $6,12($0) subu $1,$3,$3 sltiu $5,$3,4099 sb $1,8($0) srlv $3,$5,$3 sltiu $4,$3,14180 sltu $4,$4,$3 srlv $1,$4,$3 and $3,$1,$3 lhu $3,0($0) ori $4,$1,43787 ori $3,$6,34545 addu $3,$3,$3 addu $4,$4,$3 subu $0,$1,$3 addu $1,$4,$3 sltiu $4,$4,-4546 srl $4,$4,5 sll $6,$1,0 or $3,$6,$3 addiu $4,$4,7946 nor $3,$5,$3 sltiu $1,$1,-17628 subu $3,$3,$3 addu $4,$4,$3 sll $4,$5,12 ori $3,$3,57710 sw $3,8($0) ori $1,$1,39574 addiu $1,$1,16566 slti $3,$3,-5047 nor $3,$3,$3 nor $4,$5,$3 sltu $4,$6,$3 subu $3,$3,$3 subu $1,$5,$3 sll $3,$3,19 sllv $5,$1,$3 addu $4,$1,$3 or $3,$3,$3 sll $1,$4,23 lh $1,8($0) slti $3,$5,25105 xori $1,$1,43228 addiu $3,$3,566 ori $5,$4,33504 addiu $1,$4,25127 and $1,$0,$3 subu $4,$6,$3 ori $4,$5,52652 sltu $6,$1,$3 lb $4,14($0) sb $3,8($0) addiu $6,$6,8339 lb $6,0($0) addu $4,$6,$3 slti $3,$3,-6041 addiu $1,$5,8678 sb $4,0($0) andi $6,$5,19850 sltu $2,$2,$3 sltu $3,$4,$3 sltiu $6,$0,14848 srav $3,$1,$3 sllv $0,$0,$3 srlv $4,$4,$3 sw $5,8($0) andi $1,$3,11883 sb $3,5($0) srav $3,$4,$3 sh $5,12($0) sllv $4,$3,$3 sll $3,$1,21 lb $5,3($0) sb $1,4($0) lbu $3,0($0) lw $5,8($0) lbu $0,10($0) lbu $1,15($0) lbu $1,8($0) sll $0,$0,29 subu $3,$4,$3 sw $3,8($0) xor $3,$6,$3 slti $6,$4,16935 slti $1,$3,15997 addiu $0,$3,10556 sllv $3,$4,$3 sb $3,7($0) srlv $0,$5,$3 sw $3,12($0) lh $5,4($0) lw $5,12($0) lb $1,7($0) sra $1,$1,17 nor $3,$5,$3 xor $3,$3,$3 subu $6,$4,$3 sw $2,12($0) lb $4,14($0) lw $1,8($0) sll $4,$6,10 lb $6,9($0) xor $4,$4,$3 addiu $4,$5,-11666 subu $1,$6,$3 srl $0,$0,16 lhu $3,12($0) srlv $3,$3,$3 sb $1,8($0) sw $6,8($0) sltiu $3,$3,-3916 sw $5,8($0) xor $4,$3,$3 srav $1,$3,$3 lb $3,16($0) sb $1,7($0) sh $5,8($0) srlv $6,$1,$3 addiu $4,$4,26015 srav $3,$4,$3 lh $5,14($0) xori $3,$4,61436 slti $3,$3,13778 lh $3,8($0) sw $3,0($0) addu $4,$4,$3 nor $3,$3,$3 sra $1,$1,20 sra $4,$4,9 subu $5,$5,$3 slti $0,$4,-13713 sb $0,9($0) subu $3,$3,$3 addu $3,$3,$3 ori $1,$4,51045 lw $3,4($0) andi $6,$5,19117 andi $4,$1,18505 sw $3,16($0) sh $3,8($0) lb $4,2($0) nor $5,$6,$3 addu $6,$6,$3 addiu $1,$5,-24778 srlv $4,$4,$3 or $4,$2,$3 srl $3,$3,1 lb $1,5($0) subu $1,$4,$3 sltiu $5,$5,20675 subu $3,$4,$3 andi $5,$3,33680 sll $4,$3,20 lhu $4,2($0) sllv $5,$4,$3 sh $3,0($0) sllv $3,$3,$3 lbu $0,16($0) subu $3,$5,$3 subu $3,$0,$3 lw $3,16($0) lbu $3,14($0) srlv $0,$3,$3 nor $1,$2,$3 subu $3,$3,$3 slti $3,$4,13831 and $3,$3,$3 addiu $1,$1,1835 addu $3,$3,$3 nor $1,$0,$3 lb $4,8($0) addiu $0,$3,-7958 sll $3,$3,24 or $4,$5,$3 lhu $5,14($0) and $5,$3,$3 lbu $5,13($0) ori $1,$1,59025 lhu $0,6($0) lh $0,6($0) sllv $5,$3,$3 addiu $3,$5,21218 sw $3,8($0) lb $3,14($0) lhu $4,8($0) srlv $3,$4,$3 sw $3,0($0) srlv $5,$5,$3 subu $3,$4,$3 addiu $3,$3,-16384 lhu $5,14($0) slt $4,$3,$3 srav $4,$3,$3 srlv $4,$5,$3 lw $6,16($0) xori $5,$4,44000 addiu $3,$5,27010 slt $6,$3,$3 sb $5,10($0) lhu $3,0($0) addu $3,$3,$3 lbu $5,6($0) addiu $4,$4,24495 ori $1,$3,14749 addiu $3,$3,-4609 addu $3,$1,$3 addiu $0,$4,-12733 addu $5,$2,$3 xor $1,$3,$3 srl $1,$3,23 and $6,$1,$3 lw $3,8($0) srl $0,$0,0 or $3,$3,$3 slt $3,$3,$3 subu $5,$1,$3 addiu $4,$4,-7694 sllv $3,$3,$3 xor $3,$3,$3 subu $1,$3,$3 sll $6,$1,12 srav $5,$3,$3 lbu $5,10($0) lhu $3,6($0) addu $1,$1,$3 srl $5,$3,23 and $3,$3,$3 andi $4,$4,56660 lb $3,13($0) lhu $3,4($0) subu $4,$4,$3 sltiu $3,$5,-7245 or $3,$1,$3 andi $4,$1,4567 lbu $3,0($0) subu $3,$5,$3 srl $3,$2,4 or $4,$4,$3 xori $1,$3,16323 andi $6,$6,19545 srlv $1,$3,$3 sll $4,$4,14 ori $4,$4,6710 lh $5,6($0) subu $4,$4,$3 slti $5,$5,8487 sh $0,0($0) sll $3,$4,27 sllv $3,$1,$3 sra $4,$2,8 sll $6,$4,14 srl $6,$3,11 lw $1,8($0) addiu $1,$1,-28465 and $3,$3,$3 lhu $6,0($0) subu $0,$3,$3 and $6,$4,$3 lw $3,8($0) sll $6,$6,7 sltu $5,$4,$3 srlv $6,$4,$3 slt $5,$4,$3 srlv $4,$4,$3 andi $4,$4,53285 lhu $3,0($0) subu $1,$3,$3 xori $3,$0,40127 sra $5,$5,21 addu $4,$4,$3 subu $6,$6,$3 ori $3,$0,37020 addu $5,$4,$3 addiu $1,$1,25698 subu $3,$3,$3 lh $4,4($0) lhu $3,4($0) andi $4,$4,39141 sh $3,10($0) lbu $5,16($0) andi $0,$5,19391 addu $4,$1,$3 slti $6,$3,22317 sra $5,$3,31 lh $4,0($0) addiu $4,$1,-19933 xori $6,$1,58992 sll $1,$3,18 sb $3,7($0) subu $5,$3,$3 srlv $3,$6,$3 lh $4,16($0) sb $4,5($0) lhu $5,12($0) lw $4,16($0) subu $4,$3,$3 addiu $4,$3,-31973 lh $4,0($0) andi $3,$0,40123 sh $1,4($0) sra $3,$3,14 addu $3,$5,$3 sb $5,15($0) srav $6,$3,$3 addiu $1,$1,16686 sll $0,$4,27 sltu $3,$5,$3 addu $1,$5,$3 lhu $3,2($0) sra $4,$4,6 addiu $3,$4,18559 and $3,$3,$3 and $0,$3,$3 xor $4,$4,$3 addu $1,$1,$3 subu $4,$4,$3 addu $5,$5,$3 ori $5,$0,10719 subu $6,$4,$3 addiu $4,$3,672 lbu $3,8($0) slt $3,$3,$3 addu $1,$5,$3 sltu $0,$5,$3 sltu $3,$0,$3 lh $3,4($0) sw $4,16($0) addiu $3,$5,-28289 nor $3,$3,$3 lb $4,6($0) or $3,$1,$3 addiu $5,$4,14675 subu $2,$2,$3 subu $3,$0,$3 lw $3,12($0) sw $4,8($0) and $3,$4,$3 sltiu $3,$3,-6916 sll $4,$3,29 sllv $5,$4,$3 sb $1,2($0) lhu $2,2($0) lhu $3,16($0) xor $3,$3,$3 addu $3,$5,$3 sltu $3,$4,$3 andi $4,$2,32585 sll $5,$1,23 slti $0,$0,26241 subu $0,$5,$3 ori $6,$3,4429 or $4,$2,$3 sllv $1,$3,$3 lbu $3,4($0) addiu $5,$6,-5815 sllv $3,$3,$3 lbu $6,5($0) sb $3,11($0) lbu $5,13($0) lw $1,4($0) and $1,$3,$3 xori $5,$1,38053 srlv $3,$3,$3 srl $4,$4,25 and $6,$6,$3 sllv $3,$4,$3 lhu $1,10($0) xor $6,$4,$3 andi $4,$5,60454 sb $5,12($0) addiu $3,$4,1156 addu $3,$3,$3 sllv $0,$6,$3 slt $1,$1,$3 lb $4,13($0) addiu $0,$4,-16473 slti $4,$4,-19064 addiu $4,$4,20235 ori $0,$0,35185 xori $4,$2,6011 sllv $4,$6,$3 xori $3,$3,8100 sltu $5,$1,$3 lh $3,2($0) sw $3,8($0) ori $3,$3,22988 ori $1,$3,61911 slti $6,$3,8373 xor $3,$5,$3 and $4,$1,$3 slt $1,$3,$3 sra $3,$1,7 xor $1,$1,$3 sltiu $3,$4,30301 addu $3,$3,$3 or $4,$4,$3 or $3,$1,$3 addiu $4,$3,-8047 and $0,$6,$3 ori $5,$3,58255 and $0,$3,$3 xori $0,$3,48874 ori $4,$3,30491 sltu $1,$6,$3 sh $5,4($0) sltu $5,$3,$3 sw $0,8($0) or $3,$3,$3 xor $3,$3,$3 addu $3,$2,$3 slti $3,$1,3628 srl $5,$5,20 lb $3,9($0) srl $3,$3,8 sltu $5,$0,$3 xori $1,$3,9843 sh $5,4($0) subu $3,$4,$3 sra $4,$4,1 sra $1,$5,11 srav $4,$3,$3 nor $3,$5,$3 lb $3,10($0) sllv $4,$4,$3 andi $4,$3,27819 subu $1,$5,$3 sh $3,14($0) addu $1,$3,$3 sll $6,$0,19 sll $4,$4,30 addu $6,$4,$3 xor $5,$0,$3 ori $3,$3,23856 or $4,$4,$3 srl $5,$5,6 ori $4,$4,34397 subu $3,$1,$3 sllv $1,$2,$3 xori $5,$2,39499 sll $6,$1,24 addiu $3,$3,31802 ori $4,$3,52858 lw $5,12($0) subu $3,$3,$3 addu $4,$5,$3 srav $5,$3,$3 sb $5,6($0) lh $4,0($0) sltiu $3,$5,-31221 addu $1,$3,$3 sw $5,8($0) xor $5,$1,$3 sll $3,$4,24 sltu $5,$6,$3 sllv $5,$5,$3 sll $3,$3,10 srlv $3,$1,$3 lw $0,0($0) slti $5,$4,12217 srlv $1,$1,$3 lh $1,12($0) addiu $4,$3,30492 slt $3,$4,$3 lbu $3,2($0) xori $4,$4,9924 and $1,$3,$3 sllv $1,$5,$3 sw $3,8($0) or $4,$3,$3 sh $1,12($0) sltiu $4,$3,-6758 lbu $3,1($0) or $4,$6,$3 srl $5,$3,7 sllv $3,$3,$3 xori $3,$3,12504 xori $5,$3,45340 sllv $5,$6,$3 sb $6,8($0) lh $4,12($0) sw $5,16($0) sw $4,12($0) andi $2,$2,16158 srlv $3,$4,$3 sh $5,4($0) srav $1,$1,$3 sltiu $1,$1,-3829 addu $0,$3,$3 sh $6,8($0) sh $3,12($0) andi $4,$1,54762 addiu $3,$4,32510 srl $1,$3,15 xor $3,$1,$3 subu $1,$4,$3 subu $3,$6,$3 or $3,$3,$3 ori $6,$1,20654 sltiu $4,$3,-9014 xor $5,$3,$3 lw $4,16($0) sll $6,$6,29 xori $1,$1,47705 slt $3,$6,$3 ori $1,$1,16618 ori $4,$5,27150 sra $6,$1,6 sll $1,$4,16 andi $1,$3,23405 lw $3,16($0) slti $5,$6,-7180 xori $4,$4,43269 srl $4,$5,24 lb $3,9($0) addu $5,$3,$3 sltiu $4,$1,-3281 addiu $3,$2,-15668 slti $4,$0,-26045 subu $3,$6,$3 sb $3,8($0) addiu $3,$0,-12536 sb $3,12($0) sltu $1,$4,$3 xor $4,$5,$3 xor $3,$3,$3 or $3,$4,$3 sll $0,$0,9 andi $1,$4,38156 lh $3,0($0) lw $5,8($0) sw $5,16($0) sltiu $5,$3,4123 srav $1,$1,$3 sllv $1,$3,$3 sltiu $3,$6,-9616 ori $4,$3,34024 sb $4,8($0) sh $3,2($0) or $1,$1,$3 lb $3,13($0) sh $3,0($0) slti $6,$1,15927 sltiu $4,$3,-26303 sra $5,$3,4 nor $4,$5,$3 lbu $1,0($0) addu $3,$5,$3 subu $4,$6,$3 addiu $1,$1,8314 sh $1,16($0) andi $3,$3,64353 slt $4,$1,$3 subu $3,$4,$3 xor $3,$3,$3 sll $3,$3,3 sra $4,$5,12 slti $3,$0,-223 addu $4,$4,$3 and $6,$2,$3 lhu $3,14($0) sw $5,12($0) andi $4,$4,18159
programs/oeis/135/A135215.asm
neoneye/loda
22
96820
<filename>programs/oeis/135/A135215.asm ; A135215: Maximal number of zero digits in square of number with n digits and without zero digits. ; 0,1,3,4,6,7,10,10,12,13,15 lpb $0 add $1,$0 div $0,2 add $1,$0 pow $0,2 cmp $0,$1 lpe mov $0,$1
DUT S2/M2101 - Assembleur/TP4/attenteActionUtilisateur.asm
Carduin/IUT
5
22408
<gh_stars>1-10 .DATA coordX DSW 1 coordY DSW 1 largeur DW 100 hauteur DW 100 .CODE LEA SP, STACK ;on efface l'écran au début LD R0,0 OUT R0,5 boucleSouris: ;Attente du premier clic souris de l'utilisateur IN R1, 0 CMP R1, %11000111 ;On teste si le clic a eu lieu, si oui, on dessine BEQ dessinInitial JMP boucleSouris ;Si non, on teste a nouveau dessinInitial: ;Dessin du carré initial au centre de l'écran IN R0,6 ;On prend la coordonée X ou le clic souris a eu lieu SUB R0,50 ;On la centre !! Pas de dessin trop a gauche !! ST R0,coordX ;Et on la met dans coordX IN R0,7 ;Meme technique pour coordY SUB R0,50 ; !! Pas de dessin trop en haut !! ST R0,coordY PUSH coordX ;On met les paramètres dans la pile PUSH coordY PUSH largeur PUSH hauteur CALL carre100 ;appel procédure dessin boucleClavier: ;Attente de clic sur les boutons IN R1,0 ;Recuperation de valeur du port 0 pour connaitre état clavier CMP R1,%11000101 ;Si on appuie sur A BEQ Aappuye CMP R1,%10000101 ;Si on relache A BEQ Alache CMP R1,%11000110 ;Si on appuie sur B BEQ Bappuye JMP boucleClavier ; Si pas d'action, on teste a nouveau Aappuye: ;Si on appuie sur A, on réduit la largeur et la hauteur de 50, et ;on décale le coin supérieur gauche de +25 sur x et y pour le placer au centre LD R2,largeur SUB R2,50 ST R2,largeur LD R2,hauteur SUB R2,50 ST R2,hauteur LD R2, coordX ADD r2,25 ST R2,coordX LD R2, coordY ADD r2,25 ST R2,coordY PUSH coordX ;On met a nouveau les paramètres dans la pile pour pouvoir dessiner PUSH coordY PUSH largeur PUSH hauteur CALL carre50 ;appel procédure dessin (carre50 efface le dessin precedent, pas carre100) JMP boucleClavier ;On revient a l'attente d'action Alache: ;Meme technique que quand on appuie sur A, si on relache on agrandit ; a nouveau le carre de +50, et on le décale de -25 sur x et y ; pour le placer au centre LD R2,largeur ADD R2,50 ST R2,largeur LD R2,hauteur ADD R2,50 ST R2,hauteur LD R2, coordX SUB r2,25 ST R2,coordX LD R2, coordY SUB r2,25 ST R2,coordY PUSH coordX PUSH coordY PUSH largeur PUSH hauteur CALL carre100 ;appel procédure dessin JMP boucleClavier ;On revient a l'attente d'action Bappuye: ;Si B est appuyé, on arrête le programme JMP fin fin: HLT carre100: ;Pas d'effacement necessaire au début car le plus grand carre recouvre le plus petit PUSH R0 LD R0, [SP+2] ;hauteur dans port 4 OUT R0,4 LD R0, [SP+3];largeur dans port 3 OUT R0,3 LD R0, [SP+4];coordY dans port 2 OUT R0,2 LD R0, [SP+5];coordX dans port 1 OUT R0,1 LD R0, %01110101 ;On ajoute la commande graphique a effectuer (rectangle plein vert) dans R0 OUT R0, 5 ;On dessine PULL R0 RET 5 carre50: ;on efface l'écran LD R0,0 OUT R0,5 PUSH R0 LD R0, [SP+2] ;hauteur dans port 4 OUT R0,4 LD R0, [SP+3];largeur dans port 3 OUT R0,3 LD R0, [SP+4];coordY dans port 2 OUT R0,2 LD R0, [SP+5];coordX dans port 1 OUT R0,1 LD R0, %01110101 ;On ajoute la commande graphique a effectuer (rectangle plein vert) dans R0 OUT R0, 5 ;On dessine PULL R0 RET 5 .STACK 15
oeis/328/A328141.asm
neoneye/loda-programs
11
12275
; A328141: a(n) = a(n-1) - (n-2)*a(n-2), with a(0)=1, a(1)=2. ; Submitted by <NAME> ; 1,2,2,0,-4,-4,12,32,-40,-264,56,2432,1872,-24880,-47344,276096,938912,-3202528,-18225120,36217856,364270016,-323869248,-7609269568,-808015360,166595915136,185180268416,-3813121694848,-8442628405248,90698535660800,318649502602496,-2220909495899904,-11461745071372288,55165539805624832,410479637018165760,-1354817636761828864,-14900645658361298944,31163153991540882432,552685752034186345472,-569187791661285422080,-21018560616926180204544,610575466202665834496,820334439526323693811712 mov $2,1 mov $3,1 lpb $0 sub $0,1 mul $1,$0 mov $2,$3 add $3,$1 sub $1,$3 lpe sub $2,$1 mov $0,$2
programs/oeis/130/A130630.asm
karttu/loda
1
243444
<gh_stars>1-10 ; A130630: Periodic sequence with period 1 1 1 1 1 0 0 0 0. ; 1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0 mod $0,9 trn $0,4 pow $1,$0
regtests/files/test-ada-3/src/test3.adb
stcarrez/resource-embedder
7
6291
with Resource.Web; with Resource.Config; with Ada.Command_Line; with Ada.Text_IO; procedure Test3 is use Resource; C : Content_Access := Web.Get_Content ("main.html"); begin if C = null then Ada.Text_IO.Put_Line ("FAIL: No content 'main.html'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; if C'Length /= 360 then Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'main.html'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); end if; C := Web.Get_Content ("images/wiki-create.png"); if C = null then Ada.Text_IO.Put_Line ("FAIL: No content 'images/wiki-create.png'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; if C'Length /= 3534 then Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'images/wiki-create.png'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); end if; C := Web.Get_Content ("not-included.xml"); if C /= null then Ada.Text_IO.Put_Line ("FAIL: Content was included 'not-included.xml'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; C := Web.Get_Content ("preview/main-not-included.html"); if C /= null then Ada.Text_IO.Put_Line ("FAIL: Content was included 'preview/main-not-included.html'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; C := Web.Get_Content ("js/main.js"); if C = null then Ada.Text_IO.Put_Line ("FAIL: No content 'js/main.js'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; if C'Length /= 90 then Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'js/main.js'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); end if; C := Web.Get_Content ("css/main.css"); if C = null then Ada.Text_IO.Put_Line ("FAIL: No content 'css/main.css'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; if C'Length /= 94 then Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'css/main.css'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); end if; C := Web.Get_Content ("not-included.txt"); if C /= null then Ada.Text_IO.Put_Line ("FAIL: Content was included 'not-included.txt'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; C := Config.Get_Content ("test3.xml"); if C = null then Ada.Text_IO.Put_Line ("FAIL: No content 'test3.xml'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; if C'Length /= 18 then Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'test3.xml'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); end if; Ada.Text_IO.Put ("PASS: "); for Val of C.all loop if Character'Val (Val) /= ASCII.LF then Ada.Text_IO.Put (Character'Val (Val)); end if; end loop; Ada.Text_IO.New_Line; end Test3;
data/items/buena_prizes.asm
Dev727/ancientplatinum
28
165623
<filename>data/items/buena_prizes.asm<gh_stars>10-100 BuenaPrizeItems: ; there are NUM_BUENA_PRIZES items (see engine/events/buena.asm) db ULTRA_BALL, 2 db FULL_RESTORE, 2 db NUGGET, 3 db RARE_CANDY, 3 db PROTEIN, 5 db IRON, 5 db CARBOS, 5 db CALCIUM, 5 db HP_UP, 5 .End
Task/Function-definition/Ada/function-definition-1.ada
LaudateCorpus1/RosettaCodeData
1
2288
function Multiply (A, B : Float) return Float;
artwork/goblin/goblin_idle.asm
fjpena/sword-of-ianna-zx
67
240035
; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by <NAME>, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 24, 32) ;Char Size: ( 3, 4) ;Sort Priorities: X char, Char line, Y char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: No goblin_idle: DEFB 0, 4,128, 0, 8, 0, 0, 13 DEFB 192, 0, 19,224, 0, 12, 0, 0 DEFB 4, 64, 1,197,224, 2,229,144 DEFB 3,161,240, 5,195, 0, 4, 18 DEFB 176, 14,137,224, 15, 68, 0, 14 DEFB 130, 32, 5, 65, 80, 16,128,128 DEFB 60, 0,144, 16,131, 64, 5, 76 DEFB 32, 14,128, 0, 7, 85, 56, 6 DEFB 128, 72, 3, 0,104, 27,207,104 DEFB 19,149,104, 1,128,104, 0, 32 DEFB 104, 1, 69,112, 0,138, 0, 1 DEFB 197, 0, 1,242,128, 2,169, 64