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
ada.editor/test/unit/data/if_statement.adb
timboudreau/netbeans-contrib
2
16901
-- -- 5.3 If Statements -- -- if_statement ::= -- if condition then -- sequence_of_statements -- {elsif condition then -- sequence_of_statements} -- [else -- sequence_of_statements] -- end if; -- -- condition ::= boolean_expression -- -- NOTE: This module is not compilation is used only for testing purposes -- procedure If_Statement is begin if (Month = December and Day = 31) then Month := January; Day := 1; Year := Year + 1; end if; if Line_Too_Short then raise Layout_Error; elsif Line_Full then New_Line; Put(Item); else Put(Item); end if; if My_Car.Owner.Vehicle /= My_Car then -- see 3.10.1 Report ("Incorrect data"); end if; end;
Sourcecode/Chapter6/loaded.asm
gavinzheng/Blockchain-Smart-Contract
1
28932
<reponame>gavinzheng/Blockchain-Smart-Contract 000 PUSH1 80 002 PUSH1 40 004 MSTORE 005 PUSH1 04 007 CALLDATASIZE 008 LT 009 PUSH2 0057 012 JUMPI 013 PUSH1 00 015 CALLDATALOAD 016 PUSH29 0100000000000000000000000000000000000000000000000000000000 046 SWAP1 047 DIV 048 PUSH4 ffffffff 053 AND 054 DUP1 055 PUSH4 18160ddd 060 EQ 061 PUSH2 005c 064 JUMPI 065 DUP1 066 PUSH4 70a08231 071 EQ 072 PUSH2 0087 075 JUMPI 076 DUP1 077 PUSH4 a9059cbb 082 EQ 083 PUSH2 00de 086 JUMPI 087 JUMPDEST 088 PUSH1 00 090 DUP1 091 REVERT 092 JUMPDEST 093 CALLVALUE 094 DUP1 095 ISZERO 096 PUSH2 0068 099 JUMPI 100 PUSH1 00 102 DUP1 103 REVERT 104 JUMPDEST 105 POP 106 PUSH2 0071 109 PUSH2 0143 112 JUMP 113 JUMPDEST 114 PUSH1 40 116 MLOAD 117 DUP1 118 DUP3 119 DUP2 120 MSTORE 121 PUSH1 20 123 ADD 124 SWAP2 125 POP 126 POP 127 PUSH1 40 129 MLOAD 130 DUP1 131 SWAP2 132 SUB 133 SWAP1 134 RETURN 135 JUMPDEST 136 CALLVALUE 137 DUP1 138 ISZERO 139 PUSH2 0093 142 JUMPI 143 PUSH1 00 145 DUP1 146 REVERT 147 JUMPDEST 148 POP 149 PUSH2 00c8 152 PUSH1 04 154 DUP1 155 CALLDATASIZE 156 SUB 157 DUP2 158 ADD 159 SWAP1 160 DUP1 161 DUP1 162 CALLDATALOAD 163 PUSH20 ffffffffffffffffffffffffffffffffffffffff 184 AND 185 SWAP1 186 PUSH1 20 188 ADD 189 SWAP1 190 SWAP3 191 SWAP2 192 SWAP1 193 POP 194 POP 195 POP 196 PUSH2 014c 199 JUMP 200 JUMPDEST 201 PUSH1 40 203 MLOAD 204 DUP1 205 DUP3 206 DUP2 207 MSTORE 208 PUSH1 20 210 ADD 211 SWAP2 212 POP 213 POP 214 PUSH1 40 216 MLOAD 217 DUP1 218 SWAP2 219 SUB 220 SWAP1 221 RETURN 222 JUMPDEST 223 CALLVALUE 224 DUP1 225 ISZERO 226 PUSH2 00ea 229 JUMPI 230 PUSH1 00 232 DUP1 233 REVERT 234 JUMPDEST 235 POP 236 PUSH2 0129 239 PUSH1 04 241 DUP1 242 CALLDATASIZE 243 SUB 244 DUP2 245 ADD 246 SWAP1 247 DUP1 248 DUP1 249 CALLDATALOAD 250 PUSH20 ffffffffffffffffffffffffffffffffffffffff 271 AND 272 SWAP1 273 PUSH1 20 275 ADD 276 SWAP1 277 SWAP3 278 SWAP2 279 SWAP1 280 DUP1 281 CALLDATALOAD 282 SWAP1 283 PUSH1 20 285 ADD 286 SWAP1 287 SWAP3 288 SWAP2 289 SWAP1 290 POP 291 POP 292 POP 293 PUSH2 0195 296 JUMP 297 JUMPDEST 298 PUSH1 40 300 MLOAD 301 DUP1 302 DUP3 303 ISZERO 304 ISZERO 305 ISZERO 306 ISZERO 307 DUP2 308 MSTORE 309 PUSH1 20 311 ADD 312 SWAP2 313 POP 314 POP 315 PUSH1 40 317 MLOAD 318 DUP1 319 SWAP2 320 SUB 321 SWAP1 322 RETURN 323 JUMPDEST 324 PUSH1 00 326 DUP1 327 SLOAD 328 SWAP1 329 POP 330 SWAP1 331 JUMP 332 JUMPDEST 333 PUSH1 00 335 PUSH1 01 337 PUSH1 00 339 DUP4 340 PUSH20 ffffffffffffffffffffffffffffffffffffffff 361 AND 362 PUSH20 ffffffffffffffffffffffffffffffffffffffff 383 AND 384 DUP2 385 MSTORE 386 PUSH1 20 388 ADD 389 SWAP1 390 DUP2 391 MSTORE 392 PUSH1 20 394 ADD 395 PUSH1 00 397 SHA3 398 SLOAD 399 SWAP1 400 POP 401 SWAP2 402 SWAP1 403 POP 404 JUMP 405 JUMPDEST 406 PUSH1 00 408 DUP1 409 PUSH20 ffffffffffffffffffffffffffffffffffffffff 430 AND 431 DUP4 432 PUSH20 ffffffffffffffffffffffffffffffffffffffff 453 AND 454 EQ 455 ISZERO 456 ISZERO 457 ISZERO 458 PUSH2 01d2 461 JUMPI 462 PUSH1 00 464 DUP1 465 REVERT 466 JUMPDEST 467 PUSH1 01 469 PUSH1 00 471 CALLER 472 PUSH20 ffffffffffffffffffffffffffffffffffffffff 493 AND 494 PUSH20 ffffffffffffffffffffffffffffffffffffffff 515 AND 516 DUP2 517 MSTORE 518 PUSH1 20 520 ADD 521 SWAP1 522 DUP2 523 MSTORE 524 PUSH1 20 526 ADD 527 PUSH1 00 529 SHA3 530 SLOAD 531 DUP3 532 GT 533 ISZERO 534 ISZERO 535 ISZERO 536 PUSH2 0220 539 JUMPI 540 PUSH1 00 542 DUP1 543 REVERT 544 JUMPDEST 545 DUP2 546 PUSH1 01 548 PUSH1 00 550 CALLER 551 PUSH20 ffffffffffffffffffffffffffffffffffffffff 572 AND 573 PUSH20 ffffffffffffffffffffffffffffffffffffffff 594 AND 595 DUP2 596 MSTORE 597 PUSH1 20 599 ADD 600 SWAP1 601 DUP2 602 MSTORE 603 PUSH1 20 605 ADD 606 PUSH1 00 608 SHA3 609 SLOAD 610 SUB 611 PUSH1 01 613 PUSH1 00 615 CALLER 616 PUSH20 ffffffffffffffffffffffffffffffffffffffff 637 AND 638 PUSH20 ffffffffffffffffffffffffffffffffffffffff 659 AND 660 DUP2 661 MSTORE 662 PUSH1 20 664 ADD 665 SWAP1 666 DUP2 667 MSTORE 668 PUSH1 20 670 ADD 671 PUSH1 00 673 SHA3 674 DUP2 675 SWAP1 676 SSTORE 677 POP 678 DUP2 679 PUSH1 01 681 PUSH1 00 683 DUP6 684 PUSH20 ffffffffffffffffffffffffffffffffffffffff 705 AND 706 PUSH20 ffffffffffffffffffffffffffffffffffffffff 727 AND 728 DUP2 729 MSTORE 730 PUSH1 20 732 ADD 733 SWAP1 734 DUP2 735 MSTORE 736 PUSH1 20 738 ADD 739 PUSH1 00 741 SHA3 742 SLOAD 743 ADD 744 PUSH1 01 746 PUSH1 00 748 DUP6 749 PUSH20 ffffffffffffffffffffffffffffffffffffffff 770 AND 771 PUSH20 ffffffffffffffffffffffffffffffffffffffff 792 AND 793 DUP2 794 MSTORE 795 PUSH1 20 797 ADD 798 SWAP1 799 DUP2 800 MSTORE 801 PUSH1 20 803 ADD 804 PUSH1 00 806 SHA3 807 DUP2 808 SWAP1 809 SSTORE 810 POP 811 PUSH1 01 813 SWAP1 814 POP 815 SWAP3 816 SWAP2 817 POP 818 POP 819 JUMP 820 STOP 821 LOG1 822 PUSH6 627a7a723058 829 SHA3 830 INVALID 831 LOG2 832 INVALID 833 DELEGATECALL 834 INVALID 835 INVALID 836 MLOAD 837 LOG0 838 SELFDESTRUCT 839 PUSH28 c9f2da319f40cf42521cc8a80373a8bd53cad6a9921e0029
sw/asm/trivial.asm
brianbennett/fpga_nes
190
161959
; trivial.asm ; ; Trivial 6502 asm test - loads AC with 0xBB. ; .word $8000 .org $8000 lda data .byte $02 ; HLT data: .byte $BB
src/JEWL/jewl-message_handling.ads
leomlr/sudoku_ada-jewl
0
1989
------------------------------------------------------------------------------ -- -- -- J E W L . M E S S A G E _ H A N D L I N G -- -- -- -- This is a private package which defines the message-handling task -- -- required by JEWL.Windows, the protected record used to communicate -- -- with it, and related operations. -- -- -- -- Copyright (C) <NAME> 2000. Contact address: <EMAIL> -- -- This software is released under the terms of the GNU General Public -- -- License and is intended primarily for educational use. Please contact -- -- the author to report bugs, suggestions and modifications. -- -- -- ------------------------------------------------------------------------------ -- $Id: jewl-message_handling.ads 1.7 2007/01/08 17:00:00 JE Exp $ ------------------------------------------------------------------------------ -- -- $Log: jewl-message_handling.ads $ -- Revision 1.7 2007/01/08 17:00:00 JE -- * Fixed linker options in JEWL.Win32_Interface to accommodate changes to GNAT -- GPL 2006 compiler (thanks to John McCormick for this) -- * Added delay in message loop to avoid the appearance of hogging 100% of CPU -- time -- -- Revision 1.6 2001/11/02 16:00:00 JE -- * Fixed canvas bug when saving an empty canvas -- * Restore with no prior save now acts as erase -- * Removed redundant variable declaration in Image function -- -- Revision 1.5 2001/08/22 15:00:00 JE -- * Minor bugfix to Get_Text for combo boxes -- * Minor changes to documentation (including new example involving dialogs) -- -- Revision 1.4 2001/01/25 09:00:00 je -- Changes visible to the user: -- -- * Added support for drawing bitmaps on canvases (Draw_Image operations -- and new type Image_Type) -- * Added Play_Sound -- * Added several new operations on all windows: Get_Origin, Get_Width, -- Get_Height, Set_Origin, Set_Size and Focus -- * Added several functions giving screen and window dimensions: Screen_Width, -- Screen_Height, Frame_Width, Frame_Height, Dialog_Width, Dialog_Height and -- Menu_Height -- * Canvases can now handle keyboard events: new constructor and Key_Code added -- * Added procedure Play_Sound -- * Operations "+" and "-" added for Point_Type -- * Pens can now be zero pixels wide -- * The absolute origin of a frame can now have be specified when the frame -- is created -- * Added new File_Dialog operations Add_Filter and Set_Directory -- * Added Get_Line renames to JEWL.IO for compatibility with Ada.Text_IO -- * Added all the Get(File,Item) operations mentioned in documentation but -- unaccountably missing :-( -- * Documentation updated to reflect the above changes -- * HTML versions of public package specifications added with links from -- main documentation pages -- -- Other internal changes: -- -- * Canvas fonts, pens etc. now use JEWL.Reference_Counted_Type rather than -- reinventing this particular wheel, as do images -- * Various minor code formatting changes: some code reordered for clarity, -- some comments added or amended, -- * Changes introduced in 1.2 to support GNAT 3.10 have been reversed, since -- GNAT 3.10 still couldn't compile this code correctly... ;-( -- -- Outstanding issues: -- -- * Optimisation breaks the code (workaround: don't optimise) -- -- Revision 1.3 2000/07/07 12:00:00 je -- * JEWL.Simple_Windows added; JEWL.IO modified to use JEWL.Simple_Windows. -- * JEWL.IO bug fix: Put_Line to file wrote newline to standard output -- instead of to the file (thanks to <NAME> for pointing this out). -- * Panels fixed so that mouse clicks are passed on correctly to subwindows. -- * Memos fixed so that tabs are handled properly. -- * Password feature added to editboxes. -- * Minor typos fixed in comments within the package sources. -- * Documentation corrected and updated following comments from <NAME> -- and <NAME>. -- -- Revision 1.2 2000/04/18 20:00:00 je -- * Minor code changes to enable compilation by GNAT 3.10 -- * Minor documentation errors corrected -- * Some redundant "with" clauses removed -- -- Revision 1.1 2000/04/09 21:00:00 je -- Initial revision -- ------------------------------------------------------------------------------ with JEWL.Win32_Interface; use JEWL.Win32_Interface; with JEWL.Window_Implementation; use JEWL.Window_Implementation; with Ada.Exceptions; with System; private package JEWL.Message_Handling is ---------------------------------------------------------------------------- -- -- M E S S A G E _ L O O P -- -- This task is responsible for pumping the Windows message loop. -- Windows requires that all windows are created and destroyed by -- the same task that will handle their messages, so task entries -- are used to ask the message task to create and destroy windows. -- The entries are: -- -- Create_Window : create a top-level window, given the name of the -- window class, the window title, extended and normal -- window styles, and whether the window should be -- made visible. -- Create_Child : create a child window, given the parent window's -- handle, the name of the window class, the window -- title, style, and coordinates. -- Show_Dialog : show a common dialog and return its result. -- Destroy_Window : destroy a window (specified by its handle). -- ---------------------------------------------------------------------------- task Message_Loop is entry Create_Child (Window : in Window_Ptr; Parent : in Container_Ptr; Class : in Win32_String; Title : in Win32_String; XStyle : in Win32_DWORD; Style : in Win32_DWORD; Top : in Integer; Left : in Integer; Width : in Integer; Height : in Integer); entry Create_Window (Window : in Main_Window_Ptr; Class : in Win32_String; Title : in Win32_String; XStyle : in Win32_DWORD; Style : in Win32_DWORD; Show : in Boolean); entry Show_Dialog (Dialog : in Common_Dialog_Ptr; Result : out Boolean); entry Set_Focus (Window : in Win32_HWND); entry Destroy_Window (Handle : in Win32_HWND); end Message_Loop; ---------------------------------------------------------------------------- -- -- W I N D O W _ I N F O -- -- This protected record is used for global communication between the -- message loop task and the main task. The private data this contains -- is as follows: -- -- Command : the current command code (0 if no command available) -- Dialog : the current active dialog (null if no dialog active) -- Task_Failed : True if the message loop task has failed -- Failure_Info : the exception that caused the message loop to fail -- -- The operations provide are as follows: -- -- Get_Command : wait for a command and then return its code -- Test_Command : test if there is a command pending -- Set_Command : set the current command -- Get_Dialog : get the handle of the current dialog (null if none) -- Active_Window : set the handle of the active dialog window and get -- the old value of the handle -- Record_Error : record an exception that caused the message loop -- to fail -- ---------------------------------------------------------------------------- protected Window_Info is entry Get_Command (Cmd : out Natural); function Test_Command return Boolean; procedure Set_Command (Cmd : in Natural); procedure Get_Dialog (Dlg : in out Win32_HWND); function Active_Window return Win32_HWND; procedure Record_Error (Err : in Ada.Exceptions.Exception_Occurrence); private Command : Natural := 0; Dialog : Win32_HWND := System.Null_Address; Task_Failed : Boolean := False; Failure_Info : Ada.Exceptions.Exception_Occurrence; end Window_Info; ---------------------------------------------------------------------------- -- -- M E S S A G E H A N D L E R S -- -- These functions are associated with the window classes for frames, -- dialogs and canvases when the window classes are registered (in the -- initialisation section at the end of the body of JEWL.Windows). -- Windows will call the appropriate function when a message is sent -- to a window belonging to the corresponding class, specifying the -- window handle, message code and any additional parameters. -- ---------------------------------------------------------------------------- function Frame_Proc (hwnd : Win32_HWND; msg : Win32_UINT; wParam : Win32_WPARAM; lParam : Win32_LPARAM) return Win32_LONG; pragma Convention(StdCall, Frame_Proc); function Dialog_Proc (hwnd : Win32_HWND; msg : Win32_UINT; wParam : Win32_WPARAM; lParam : Win32_LPARAM) return Win32_LONG; pragma Convention(StdCall, Dialog_Proc); function Canvas_Proc (hwnd : Win32_HWND; msg : Win32_UINT; wParam : Win32_WPARAM; lParam : Win32_LPARAM) return Win32_LONG; pragma Convention(StdCall, Canvas_Proc); function Panel_Proc (hwnd : Win32_HWND; msg : Win32_UINT; wParam : Win32_WPARAM; lParam : Win32_LPARAM) return Win32_LONG; pragma Convention(StdCall, Panel_Proc); function Memo_Proc (hwnd : Win32_HWND; msg : Win32_UINT; wParam : Win32_WPARAM; lParam : Win32_LPARAM) return Win32_LONG; pragma Convention(StdCall, Memo_Proc); ---------------------------------------------------------------------------- -- -- U T I L I T Y P R O C E D U R E S -- -- Get_Actual_Bounds : test if a set of window dimensions is relative to -- the dimensions of the parent. If they are, set the -- Resize parameter True and set the dimensions to -- the corresponding absolute (parent-based) values. -- ---------------------------------------------------------------------------- procedure Get_Actual_Bounds (Parent : in Win32_HWND; Top : in out Integer; Left : in out Integer; Width : in out Integer; Height : in out Integer; Resize : out Boolean); end JEWL.Message_Handling;
src/Categories/Category/Construction/Core.agda
bblfish/agda-categories
5
7923
<gh_stars>1-10 {-# OPTIONS --without-K --safe #-} open import Categories.Category -- The core of a category. -- See https://ncatlab.org/nlab/show/core module Categories.Category.Construction.Core {o ℓ e} (𝒞 : Category o ℓ e) where open import Level using (_⊔_) open import Function using (flip) open import Categories.Category.Groupoid using (Groupoid; IsGroupoid) open import Categories.Morphism 𝒞 open import Categories.Morphism.IsoEquiv 𝒞 open Category 𝒞 open _≃_ Core : Category o (ℓ ⊔ e) e Core = record { Obj = Obj ; _⇒_ = _≅_ ; _≈_ = _≃_ ; id = ≅.refl ; _∘_ = flip ≅.trans ; assoc = ⌞ assoc ⌟ ; sym-assoc = ⌞ sym-assoc ⌟ ; identityˡ = ⌞ identityˡ ⌟ ; identityʳ = ⌞ identityʳ ⌟ ; identity² = ⌞ identity² ⌟ ; equiv = ≃-isEquivalence ; ∘-resp-≈ = λ where ⌞ eq₁ ⌟ ⌞ eq₂ ⌟ → ⌞ ∘-resp-≈ eq₁ eq₂ ⌟ } Core-isGroupoid : IsGroupoid Core Core-isGroupoid = record { _⁻¹ = ≅.sym ; iso = λ {_ _ f} → record { isoˡ = ⌞ isoˡ f ⌟ ; isoʳ = ⌞ isoʳ f ⌟ } } where open _≅_ CoreGroupoid : Groupoid o (ℓ ⊔ e) e CoreGroupoid = record { category = Core; isGroupoid = Core-isGroupoid }
Transynther/x86/_processed/AVXALIGN/_st_4k_sm_/i9-9900K_12_0xa0.log_3_908.asm
ljhsiun2/medusa
9
176895
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r8 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x1e183, %rsi lea addresses_normal_ht+0x11307, %rdi clflush (%rsi) nop xor $23664, %r10 mov $92, %rcx rep movsw nop nop nop nop nop sub $63154, %rdx lea addresses_WC_ht+0x1b543, %r8 nop nop and %rbx, %rbx mov (%r8), %edx nop nop sub $4452, %rdi lea addresses_normal_ht+0x1cec9, %rcx nop nop nop add $59453, %rdi movl $0x61626364, (%rcx) nop nop nop dec %rdx lea addresses_WC_ht+0x2e46, %rdi nop nop dec %r8 mov $0x6162636465666768, %rsi movq %rsi, %xmm6 movups %xmm6, (%rdi) nop and %rbx, %rbx lea addresses_WC_ht+0x1b52b, %r10 nop sub $1484, %rdx mov (%r10), %rbx nop nop nop nop inc %r8 lea addresses_WC_ht+0xcf02, %rdi nop nop nop nop nop xor $28969, %r10 movb (%rdi), %bl add $16914, %r10 lea addresses_normal_ht+0x15483, %rbx cmp $25637, %rcx mov (%rbx), %r8w nop nop nop nop xor $6578, %rbx lea addresses_normal_ht+0x2d63, %rcx nop nop add %rbx, %rbx movl $0x61626364, (%rcx) nop nop nop nop cmp %rsi, %rsi lea addresses_A_ht+0x677f, %rsi lea addresses_WC_ht+0x10c83, %rdi nop nop nop xor $50969, %rax mov $39, %rcx rep movsb and %rdx, %rdx lea addresses_normal_ht+0xac83, %rsi lea addresses_WT_ht+0x283, %rdi clflush (%rdi) nop add $64341, %rax mov $87, %rcx rep movsl nop nop nop nop nop add %r8, %r8 lea addresses_A_ht+0x1dff5, %r8 nop sub %rax, %rax mov (%r8), %rsi add %rbx, %rbx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r8 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %rax push %rbp push %rbx push %rdi push %rsi // Load lea addresses_PSE+0xa00, %r12 nop xor $4048, %rax mov (%r12), %rdi nop nop nop nop and $22049, %rax // Store lea addresses_A+0x17c83, %r14 nop add $11672, %rsi movl $0x51525354, (%r14) nop nop nop nop cmp $59074, %r12 // Store lea addresses_A+0x17c83, %rax nop nop nop nop sub $34661, %rdi mov $0x5152535455565758, %rbx movq %rbx, %xmm5 vmovups %ymm5, (%rax) nop nop nop xor %r12, %r12 // Store lea addresses_UC+0x10723, %rbx nop nop nop cmp $44832, %rbp movl $0x51525354, (%rbx) nop nop and %rbp, %rbp // Store lea addresses_D+0x1a030, %rbp nop nop nop nop xor %rdi, %rdi movw $0x5152, (%rbp) nop nop nop nop nop and %rax, %rax // Store lea addresses_A+0x101d3, %r14 nop cmp $33900, %rdi movb $0x51, (%r14) nop nop nop nop nop sub %rdi, %rdi // Load lea addresses_D+0x2a1f, %rsi nop nop nop nop nop dec %rdi movb (%rsi), %bl cmp %r12, %r12 // Store lea addresses_normal+0x12d5f, %r14 nop cmp %rdi, %rdi movw $0x5152, (%r14) nop nop nop sub %rax, %rax // Store mov $0x1e4a6f0000000483, %rbp nop nop nop nop inc %rdi mov $0x5152535455565758, %r12 movq %r12, (%rbp) nop xor $61851, %rbp // Store lea addresses_A+0xb203, %r12 nop nop nop nop cmp %rbp, %rbp movl $0x51525354, (%r12) nop nop nop nop and %rdi, %rdi // Faulty Load lea addresses_A+0x17c83, %rbx nop and $7943, %rdi vmovaps (%rbx), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $0, %xmm6, %rax lea oracles, %r12 and $0xff, %rax shlq $12, %rax mov (%r12,%rax,1), %rax pop %rsi pop %rdi pop %rbx pop %rbp pop %rax pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_D', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_A', 'AVXalign': False, 'size': 1}} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_D', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_NC', 'AVXalign': False, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_A', 'AVXalign': True, 'size': 4}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': True, 'size': 32}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 1, 'type': 'addresses_normal_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 4, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}} {'src': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}} {'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}} {'src': {'NT': True, 'same': False, 'congruent': 1, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'58': 3} 58 58 58 */
Task/Percentage-difference-between-images/Ada/percentage-difference-between-images-1.ada
LaudateCorpus1/RosettaCodeData
1
11168
type Count is mod 2**64;
gcc-gcc-7_3_0-release/gcc/ada/s-tataat.adb
best08618/asylo
7
14214
<filename>gcc-gcc-7_3_0-release/gcc/ada/s-tataat.adb ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K I N G . T A S K _ A T T R I B U T E S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2014-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ with System.Parameters; use System.Parameters; with System.Tasking.Initialization; use System.Tasking.Initialization; with System.Task_Primitives.Operations; package body System.Tasking.Task_Attributes is package STPO renames System.Task_Primitives.Operations; type Index_Info is record Used : Boolean; -- Used is True if a given index is used by an instantiation of -- Ada.Task_Attributes, False otherwise. Require_Finalization : Boolean; -- Require_Finalization is True if the attribute requires finalization end record; Index_Array : array (1 .. Max_Attribute_Count) of Index_Info := (others => (False, False)); -- Note that this package will use an efficient implementation with no -- locks and no extra dynamic memory allocation if Attribute can fit in a -- System.Address type and Initial_Value is 0 (or null for an access type). function Next_Index (Require_Finalization : Boolean) return Integer is Self_Id : constant Task_Id := STPO.Self; begin Task_Lock (Self_Id); for J in Index_Array'Range loop if not Index_Array (J).Used then Index_Array (J).Used := True; Index_Array (J).Require_Finalization := Require_Finalization; Task_Unlock (Self_Id); return J; end if; end loop; Task_Unlock (Self_Id); raise Storage_Error with "Out of task attributes"; end Next_Index; -------------- -- Finalize -- -------------- procedure Finalize (Index : Integer) is Self_Id : constant Task_Id := STPO.Self; begin pragma Assert (Index in Index_Array'Range); Task_Lock (Self_Id); Index_Array (Index).Used := False; Task_Unlock (Self_Id); end Finalize; -------------------------- -- Require_Finalization -- -------------------------- function Require_Finalization (Index : Integer) return Boolean is begin pragma Assert (Index in Index_Array'Range); return Index_Array (Index).Require_Finalization; end Require_Finalization; end System.Tasking.Task_Attributes;
Principles-of-Assembly-and-Compilation/test-code/MessageBox.asm
DictXiong/THUCourse
0
91693
<gh_stars>0 .386 .model flat, stdcall option casemap: none include windows.inc include kernel32.inc include user32.inc includelib kernel32.lib includelib user32.lib .data szCaption db "Hello", 0 szText db "<NAME>!", 0 .code main PROC INVOKE MessageBox, NULL, addr szText, addr szCaption, MB_OK INVOKE ExitProcess, 0 main ENDP END main
source/league/matreshka-internals-strings-operations.ads
svn2github/matreshka
24
785
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package Matreshka.Internals.Strings.Operations is pragma Preelaborate; procedure Append (Self : in out not null Shared_String_Access; Code : Matreshka.Internals.Unicode.Code_Point); -- Appends character to the string, reallocate memory if needed. procedure Unterminated_Append (Self : in out not null Shared_String_Access; Code : Matreshka.Internals.Unicode.Code_Point); -- Appends character to the string, reallocate memory if needed. Null -- terminator is not filled. procedure Append (Self : in out not null Shared_String_Access; Item : Shared_String_Access); -- Appends data from to Item to the string, reallocate string when needed. procedure Prepend (Target : in out not null Shared_String_Access; Code : Matreshka.Internals.Unicode.Code_Point); -- Prepends character to the string, reallocate memory if needed. procedure Prepend (Target : in out not null Shared_String_Access; Item : Shared_String_Access); -- Prepends data from to Item to the string, reallocate string when needed. procedure Copy_Slice (Self : in out not null Shared_String_Access; Source : not null Shared_String_Access; First : Matreshka.Internals.Utf16.Utf16_String_Index; Size : Matreshka.Internals.Utf16.Utf16_String_Index; Length : Natural); -- Copy slice from the Source string into the string, reallocate string -- when needed. function Slice (Source : not null Shared_String_Access; First : Matreshka.Internals.Utf16.Utf16_String_Index; Size : Matreshka.Internals.Utf16.Utf16_String_Index; Length : Natural) return not null Shared_String_Access; -- Returns slice from First to First + Size - 1. Length specify expected -- length of the result. procedure Slice (Item : in out not null Shared_String_Access; First : Matreshka.Internals.Utf16.Utf16_String_Index; Size : Matreshka.Internals.Utf16.Utf16_String_Index; Length : Natural); -- Sets Item to its slice from First to First + Size - 1. Length specify -- expected length of the result. procedure Replace (String : in out not null Shared_String_Access; First : Matreshka.Internals.Utf16.Utf16_String_Index; Size : Matreshka.Internals.Utf16.Utf16_String_Index; Length : Natural; By : not null Shared_String_Access); procedure Reset (Self : in out not null Shared_String_Access); -- Resets specified shared string to have empty length or sets it to -- shared empty string when shared string is used. -- function Copy (Source : not null String_Private_Data_Access) -- return not null String_Private_Data_Access; -- Creates copy of string data. end Matreshka.Internals.Strings.Operations;
src/servlet-rest.ads
My-Colaborations/ada-servlet
6
23251
<filename>src/servlet-rest.ads ----------------------------------------------------------------------- -- servlet-rest -- REST Support -- Copyright (C) 2016, 2020 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Strings; with Util.Serialize.IO; with Servlet.Requests; with Servlet.Responses; with Servlet.Core; with EL.Contexts; with Security.Permissions; -- == REST == -- The <tt>Servlet.Rest</tt> package provides support to implement easily some RESTful API. package Servlet.Rest is subtype Request is Servlet.Requests.Request; subtype Response is Servlet.Responses.Response; subtype Output_Stream is Util.Serialize.IO.Output_Stream; -- The HTTP rest method. type Method_Type is (GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, OPTIONS, PATCH); type Descriptor is abstract tagged limited private; type Descriptor_Access is access all Descriptor'Class; -- Get the permission index associated with the REST operation. function Get_Permission (Handler : in Descriptor) return Security.Permissions.Permission_Index; -- Dispatch the request to the API handler. procedure Dispatch (Handler : in Descriptor; Req : in out Servlet.Rest.Request'Class; Reply : in out Servlet.Rest.Response'Class; Stream : in out Output_Stream'Class) is abstract; type Operation_Access is access procedure (Req : in out Servlet.Rest.Request'Class; Reply : in out Servlet.Rest.Response'Class; Stream : in out Servlet.Rest.Output_Stream'Class); -- Register the API definition in the servlet registry. procedure Register (Registry : in out Servlet.Core.Servlet_Registry'Class; Definition : in Descriptor_Access); private type Descriptor is abstract tagged limited record Next : Descriptor_Access; Method : Method_Type; Pattern : Util.Strings.Name_Access; Permission : Security.Permissions.Permission_Index := 0; end record; -- Register the API descriptor in a list. procedure Register (List : in out Descriptor_Access; Item : in Descriptor_Access); -- Register the list of API descriptors for a given servlet and a root path. procedure Register (Registry : in out Servlet.Core.Servlet_Registry; Name : in String; URI : in String; ELContext : in EL.Contexts.ELContext'Class; List : in Descriptor_Access); type Static_Descriptor is new Descriptor with record Handler : Operation_Access; end record; -- Dispatch the request to the API handler. overriding procedure Dispatch (Handler : in Static_Descriptor; Req : in out Servlet.Rest.Request'Class; Reply : in out Servlet.Rest.Response'Class; Stream : in out Output_Stream'Class); end Servlet.Rest;
data/maps/headers/FuchsiaCity.asm
opiter09/ASM-Machina
1
101748
<reponame>opiter09/ASM-Machina<gh_stars>1-10 map_header FuchsiaCity, FUCHSIA_CITY, OVERWORLD, SOUTH | WEST | EAST connection south, Route19, ROUTE_19, 5 connection west, Route18, ROUTE_18, 4 connection east, Route15, ROUTE_15, 4 end_map_header
020-equivalence.agda
mcmtroffaes/agda-proofs
2
3711
module 020-equivalence where -- We need False to represent logical contradiction. open import 010-false-true -- Next, we need to be able to work with equalities. Equalities are -- defined between objects of the same type. Two objects are equal if -- we have a proof of their equality. In Agda, we can represent this -- by means of a function which takes two instances of some type M, -- and maps this to a proof of equality. -- To be a reasonable model for equality, we demand that this function -- has the properties of an equivalence relation: (i) we must have a -- proof that every object r in M equals itself, (ii) given a proof -- that r == s, we must be able to prove that s == r, and (iii) given -- proofs of r == s and s == t, we must be able to prove that r == t. -- A convenient way to store all these properties, goes by means of a -- record, which is in essence a local parametrised module, where the -- parameters and fields correspond to postulates (theorems that can -- be stated without proof), and declarations are theorems derived -- from parameters and fields. A good question is, what should be a -- parameter, and what should be a field? Fields can be considered as -- named parameters, so probably anything that would otherwise not be -- obvious without name should go into a field. -- Here we declare the type and equality function (which maps pairs of -- elements to proofs) as parameters, and the equivalence axioms as -- fields. The parameter M is optional because it can be derived -- unambiguously from the type signature of the equality function. record Equivalence {M : Set} (_==_ : M -> M -> Set) : Set1 where {- axioms -} field refl : ∀ {r} -> (r == r) symm : ∀ {r s} -> (r == s) -> (s == r) trans : ∀ {r s t} -> (r == s) -> (s == t) -> (r == t) -- We have a proof of inequality if we can prove contradiction from -- equality, and this is precisely how we define the inequality -- relation. _!=_ : M -> M -> Set m != n = (m == n) -> False -- Prove transitivity chains. -- (TODO: Use a type dependent function for these chains.) trans3 : ∀ {r s t u} -> (r == s) -> (s == t) -> (t == u) -> (r == u) trans3 p1 p2 p3 = trans (trans p1 p2) p3 trans4 : ∀ {r s t u v} -> (r == s) -> (s == t) -> (t == u) -> (u == v) -> (r == v) trans4 p1 p2 p3 p4 = trans (trans3 p1 p2 p3) p4 trans5 : ∀ {r s t u v w} -> (r == s) -> (s == t) -> (t == u) -> (u == v) -> (v == w) -> (r == w) trans5 p1 p2 p3 p4 p5 = trans (trans4 p1 p2 p3 p4) p5 trans6 : ∀ {r s t u v w x} -> (r == s) -> (s == t) -> (t == u) -> (u == v) -> (v == w) -> (w == x) -> (r == x) trans6 p1 p2 p3 p4 p5 p6 = trans (trans5 p1 p2 p3 p4 p5) p6 -- Now we construct a trivial model of equivalence: two instances of a -- type are equivalent if they reduce to the same normal form. (Note -- that Agda reduces expressions to normal form for us.) data _≡_ {A : Set} : A -> A -> Set where refl : ∀ {r} -> r ≡ r thm-≡-is-equivalence : {A : Set} -> Equivalence {A} _≡_ thm-≡-is-equivalence = record { refl = refl; symm = symm; trans = trans } where symm : ∀ {r s} -> r ≡ s -> s ≡ r symm refl = refl trans : ∀ {r s t} -> r ≡ s -> s ≡ t -> r ≡ t trans refl refl = refl
programs/oeis/226/A226136.asm
jmorken/loda
1
165681
<reponame>jmorken/loda<filename>programs/oeis/226/A226136.asm ; A226136: Positions of the positive integers in the ordering of rational numbers as generated by the rules: 1 is in S, and if nonzero x is in S, then x+1 and -1/x are in S. (See Comments). ; 1,2,4,7,10,15,22,32,47,69,101,148,217,318,466,683,1001,1467,2150,3151,4618,6768,9919,14537,21305,31224,45761,67066,98290,144051,211117,309407,453458,664575,973982 mov $3,$0 mov $4,$0 add $4,1 lpb $4 mov $0,$3 sub $4,1 sub $0,$4 mov $2,$0 cmp $2,0 add $0,$2 sub $0,1 cal $0,226275 ; Number of new rationals produced at the n-th iteration by applying the map t -> {t+1, -1/t} to nonzero terms, starting with S[0] = {1}. add $1,$0 lpe
x86/QSearchMacros.asm
lantonov/asm
150
240977
<reponame>lantonov/asm macro QSearch PvNode, InCheck ; in: ; rbp: address of Pos struct in thread struct ; rbx: address of State ; ecx: alpha ; edx: beta ; r8d: depth virtual at rsp .tte rq 1 ; 0 .ltte rq 1 ; 8 .searchFxn rq 1 ; 16 .stage rq 1 .ttMove rd 1 ; 24 .ttValue rd 1 .ttDepth rd 1 .move rd 1 .excludedMove rd 1 .bestMove rd 1 .ext rd 1 .newDepth rd 1 .predictedDepth rd 1 .moveCount rd 1 .oldAlpha rd 1 .alpha rd 1 .beta rd 1 .depth rd 1 .bestValue rd 1 .value rd 1 .evalu rd 1 .nullValue rd 1 .futilityValue rd 1 .futilityBase rd 1 .inCheck rb 1 ; 104 rb 1 ; 105 .singularExtensionNode rb 1 ; 106 .improving rb 1 ; 107 .captureOrPromotion rb 1 ; 108 .dangerous rb 1 ; 109 .doFullDepthSearch rb 1 ; 110 .cutNode rb 1 ; 111 .ttHit rb 1 rb 1 rb 1 rb 1 rb 1 rb 1 rb 1 rb 1 if PvNode = 1 ._pv rd MAX_PLY+1 end if .lend rb 0 end virtual .localsize = ((.lend-rsp+15) and (-16)) push rbx rsi rdi r12 r13 r14 r15 _chkstk_ms rsp, .localsize sub rsp, .localsize if PvNode = 1 if InCheck = 1 Display 2, "QSearch<1,1>(alpha=%i1, beta=%i2, depth=%i8) called%n" else Display 2, "QSearch<1,0>(alpha=%i1, beta=%i2, depth=%i8) called%n" end if else if InCheck = 1 Display 2, "QSearch<0,1>(alpha=%i1, beta=%i2, depth=%i8) called%n" else Display 2, "QSearch<0,0>(alpha=%i1, beta=%i2, depth=%i8) called%n" end if end if mov dword[.alpha], ecx mov dword[.beta], edx mov dword[.depth], r8d Assert le, r8d, 0, 'assertion depth<=0 failed in qsearch' movzx eax, byte[rbx+State.ply] xor edx, edx if PvNode = 1 lea r8, [._pv] mov r9, qword[rbx+State.pv] mov dword[.oldAlpha], ecx mov qword[rbx+1*sizeof.State+State.pv], r8 mov dword[r9], edx end if lea ecx, [rax + 1] mov dword[.moveCount], 2 mov dword[.bestMove], edx mov dword[rbx+State.currentMove], edx mov byte[rbx + 1*sizeof.State + State.ply], cl ; check for instant draw or max ply movzx edx, word[rbx+State.rule50] movzx rcx, word[rbx+State.pliesFromNull] mov r8, qword[rbx+State.key] cmp eax, MAX_PLY jae .AbortSearch_PlyBigger ; ss->ply < MAX_PLY holds at this point, so if we should ; go to .AbortSearch_PlySmaller if a draw is detected PosIsDraw .AbortSearch_PlySmaller, .CheckDraw_Cold, .CheckDraw_ColdRet if InCheck = 1 mov r12d, DEPTH_QS_CHECKS mov dword[.ttDepth],r12d else mov eax, DEPTH_QS_CHECKS mov r12d, DEPTH_QS_NO_CHECKS cmp eax, dword[.depth] cmovle r12d, eax mov dword[.ttDepth], r12d end if Assert b, byte[rbx+State.ply], MAX_PLY, 'assertion 0 <= ss->ply < MAX_PLY failed in Search' ; transposition table lookup mov rcx, qword[rbx+State.key] sub r12d, 1 call MainHash_Probe mov qword[.tte], rax mov qword[.ltte], rcx mov byte[.ttHit], dl mov rdi, rcx sar rdi, 48 movsx eax, ch sub r12d, eax sar r12d, 31 ; r12d = 0 if tte.depth < ttDepth ; =-1 if tte.depth >= ttDepth shr rcx, 16 mov r13d, edx movzx ecx, cx mov dword[.ttMove], ecx mov dword[.ttValue], edi lea r8d, [rdi+VALUE_MATE_IN_MAX_PLY] test edx, edx jz .DontReturnTTValue mov eax, edi sub eax, dword[.beta] sar eax, 31 ; eax = 0 if ttValue<beta ; =-1 if ttvalue>=beta cmp edi, VALUE_NONE je .DontReturnTTValue cmp r8d, 2*VALUE_MATE_IN_MAX_PLY jae .ValueFromTT .ValueFromTTRet: if PvNode = 0 add eax, 2 ; eax = 2 if ttValue<beta ie BOUND_UPPER ; = 1 if ttvalue>=beta ie BOUND_LOWER and eax, r12d test al, byte[.ltte+MainHashEntry.genBound] mov eax, edi jnz .Return end if .DontReturnTTValue: ; Evaluate the position statically ; r13d = ttHit if InCheck = 1 mov eax, -VALUE_INFINITE mov dword[rbx+State.staticEval], VALUE_NONE mov dword[.bestValue], eax mov dword[.futilityBase], eax else mov edx, dword[rbx-1*sizeof.State+State.currentMove] test r13d, r13d jz .StaticValueNoTTHit .StaticValueYesTTHit: movsx eax, word[.ltte+MainHashEntry.eval_] cmp eax, VALUE_NONE jne @f call Evaluate @@: xor ecx, ecx mov dword[rbx+State.staticEval], eax cmp edi, eax setg cl add ecx, 1 ; ecx = 2 if ttValue > bestValue ie BOUND_LOWER ; = 1 if ttValue <=bestValue ie BOUND_UPPER cmp edi, VALUE_NONE je .StaticValueDone test cl, byte[.ltte+MainHashEntry.genBound] cmovnz eax, edi jmp .StaticValueDone .StaticValueNoTTHit: mov eax, dword[rbx+State.staticEval-1*sizeof.State] neg eax add eax, 2*Eval_Tempo cmp edx, MOVE_NULL je @f call Evaluate @@: mov dword[rbx+State.staticEval], eax .StaticValueDone: mov dword[.bestValue], eax ; Return immediately if static value is at least beta cmp eax, dword[.beta] jge .ReturnStaticValue if PvNode = 1 mov ecx, dword[.alpha] cmp ecx, eax cmovl ecx, eax mov dword[.alpha], ecx end if add eax, 128 mov dword[.futilityBase], eax end if ; InCheck = 1 ; ss->history = &(*pos->counterMoveHistory)[0][0]; mov ecx, CmhDeadOffset add rcx, qword[rbp+Pos.counterMoveHistory] mov qword[rbx+0*sizeof.State+State.counterMoves], rcx ; initialize move picker mov ecx, dword[.ttMove] if InCheck = 1 lea r15, [MovePick_ALL_EVASIONS] lea r14, [MovePick_EVASIONS] else mov edx, dword[.depth] mov dword[rbx+State.depth], edx lea r15, [MovePick_QCAPTURES_CHECKS_GEN] lea r14, [MovePick_QSEARCH_WITH_CHECKS] cmp edx, DEPTH_QS_NO_CHECKS jg .MovePickInitGo lea r15, [MovePick_QCAPTURES_NO_CHECKS_GEN] lea r14, [MovePick_QSEARCH_WITHOUT_CHECKS] end if .MovePickInitGo: mov edi, ecx test ecx, ecx jz .MovePickNoTTMove mov eax, dword[rbx-1*sizeof.State+State.currentMove] and eax, 63 ; recaptureSquare = eax mov edx, ecx and edx, 63 ; to_sq(ttm) = edx cmp eax, edx je @f mov edx, dword[.depth] cmp edx, DEPTH_QS_RECAPTURES jg @f xor edi, edi jmp .MovePickNoTTMove @@: call Move_IsPseudoLegal test rax, rax cmovz edi, eax cmovnz r15, r14 .MovePickNoTTMove: mov dword[rbx+State.ttMove], edi mov qword[rbx+State.stage], r15 calign 8 .MovePickLoop: xor esi, esi GetNextMove mov dword[.move], eax mov ecx, eax test eax, eax jz .MovePickDone sub [.moveCount], 1 ; check for check and get address of search function call Move_GivesCheck mov byte[rbx+State.givesCheck], al mov r13d, eax if PvNode = 1 lea rdx, [QSearch_Pv_NoCheck] lea rcx, [QSearch_Pv_InCheck] else lea rdx, [QSearch_NonPv_NoCheck] lea rcx, [QSearch_NonPv_InCheck] end if test eax, eax cmovnz rdx, rcx mov qword[.searchFxn], rdx mov ecx, dword[.move] mov edi, dword[.bestValue] mov esi, ecx shr esi, 12 mov r8d, ecx shr r8d, 6 and r8d, 63 ; r8d = from movzx eax, byte[rbp+Pos.board+r8] ; r14d = from piece mov r14d, eax mov r9d, ecx and r9d, 63 ; r9d = to movzx r15d, byte[rbp+Pos.board+r9] ; r15d = to piece ; futility pruning if InCheck = 0 mov r12d, dword[.futilityBase] test r13d, r13d jnz .SkipFutilityPruning and eax, 7 cmp r12d, -VALUE_KNOWN_WIN jle .SkipFutilityPruning mov edx, dword[rbp+Pos.sideToMove] neg edx cmp eax, Pawn je .CheckAdvancedPawnPush .DoFutilityPruning: mov edx, dword[PieceValue_EG+4*r15] add edx, r12d cmp edx, dword[.alpha] jle .ContinueFromFutilityValue cmp r12d, dword[.alpha] jle .ContinueFromFutilityBase .SkipFutilityPruning: end if ; do not search moves with negative see value if InCheck = 0 lea eax, [rsi-MOVE_TYPE_PROM] shl r14d, 9 shl r15d, 9 cmp eax, 4 jb .DontContinue else Assert ne, esi, MOVE_TYPE_CASTLE, 'castling encountered in qsearch<InCheck=true>' mov eax, VALUE_MATED_IN_MAX_PLY sub eax, edi shl r14d, 9 mov edx, dword[.moveCount] shl r15d, 9 jnz .DontContinue or edx, dword[.depth] cmp esi, MOVE_TYPE_PROM jae .DontContinue ; catch MOVE_TYPE_EPCAP test eax, edx jns .DontContinue end if SeeSignTest .DontContinue mov ecx, dword[.move] test eax, eax jz .MovePickLoop .DontContinue: ; speculative prefetch mov edx, ecx and edx, 63 ; edx = to shr ecx, 6 and ecx, 63 ; ecx = from mov rax, qword[rbx+State.key] xor rax, qword[Zobrist_side] xor rax, qword[Zobrist_Pieces+r14+8*rcx] xor rax, qword[Zobrist_Pieces+r14+8*rdx] xor rax, qword[Zobrist_Pieces+r15+8*rdx] mul dword[mainHash.clusterCount] shl rdx, 5 add rdx, qword[mainHash.table] prefetchnta [rdx] ; check for legality mov ecx, dword[.move] call Move_IsLegal lea edx, [rax+1] add dword[.moveCount], edx test eax, eax jz .MovePickLoop ; make the move mov ecx, dword[.move] mov dword[rbx+State.currentMove], ecx mov edx, ecx shr edx, 6 and edx, 63 movzx edx, byte[rbp+Pos.board+rdx] mov eax, ecx and eax, 63 shl edx, 6 add edx, eax ; ss->history = &(*pos->counterMoveHistory)[moved_piece(move)][to_sq(move)]; mov eax, edx shl eax, 2+4+6 add rax, qword[rbp+Pos.counterMoveHistory] mov qword[rbx+State.counterMoves], rax mov rsi, qword[.searchFxn] call Move_Do__QSearch ; search the move mov ecx, dword[.beta] neg ecx mov edx, dword[.alpha] neg edx mov r8d, dword[.depth] sub r8d, 1 call rsi neg eax mov edi, eax mov dword[.value], eax ; undo the move mov ecx, dword[.move] call Move_Undo ; check for new best move cmp edi, dword[.bestValue] jle .MovePickLoop mov dword[.bestValue], edi cmp edi, dword[.alpha] jle .MovePickLoop if PvNode = 1 mov ecx, dword[.move] mov r8, qword[rbx+0*sizeof.State+State.pv] mov r9, qword[rbx+1*sizeof.State+State.pv] xor eax, eax mov dword[r8], ecx add r8, 4 test r9, r9 jz .pv_copy_end .pv_copy_loop: mov eax, dword[r9] add r9, 4 .pv_copy_end: mov dword[r8], eax add r8, 4 test eax, eax jnz .pv_copy_loop cmp edi, dword[.beta] jge .FailHigh mov dword[.alpha], edi mov dword[.bestMove], ecx jmp .MovePickLoop end if .FailHigh: mov r9, qword[rbx+State.key] mov r8, qword[.tte] shr r9, 48 mov edx, edi lea ecx, [rdi+VALUE_MATE_IN_MAX_PLY] cmp ecx, 2*VALUE_MATE_IN_MAX_PLY jae .FailHighValueToTT .FailHighValueToTTRet: mov eax, dword[.move] MainHash_Save .ltte, r8, r9w, edx, BOUND_LOWER, byte[.ttDepth], eax, word[rbx+State.staticEval] mov eax, edi jmp .Return .FailHighValueToTT: movzx edx, byte[rbx+State.ply] mov eax, edi sar eax, 31 xor edx, eax sub edx, eax add edx, edi jmp .FailHighValueToTTRet .MovePickDone: mov r9, qword[rbx+State.key] mov edi, dword[.bestValue] lea ecx, [rdi+VALUE_MATE_IN_MAX_PLY] if USE_VARIETY = 1 mov edx, dword[rbp - Thread.rootPos + Thread.extra] mov eax, dword[variety.a_bound] add eax, edi add edx, edi cmp eax, dword[variety.b_bound] cmovb edi, edx _vmovaps xmm0, dqword[rbp - Thread.rootPos + Thread.randSeed] _vmulps xmm0, xmm0, xmm0 _vmulps xmm0, xmm0, dqword[variety.b_float] _vaddps xmm0, xmm0, dqword[variety.a_float] _vmaxps xmm0, xmm0, dqword[variety.clamp] _vmovaps dqword[rbp - Thread.rootPos + Thread.randSeed], xmm0 _vhaddps xmm0, xmm0, xmm0 _vhsubps xmm0, xmm0, xmm0 _vcvttss2si eax, xmm0 mov dword[rbp - Thread.rootPos + Thread.extra], eax end if if PvNode = 1 mov esi, dword[.oldAlpha] sub esi, edi sar esi, 31 end if if InCheck = 1 movzx eax, byte[rbx+State.ply] sub eax, VALUE_MATE cmp edi, -VALUE_INFINITE je .Return end if mov r8, qword[.tte] shr r9, 48 mov edx, edi cmp ecx, 2*VALUE_MATE_IN_MAX_PLY jae .ValueToTT .ValueToTTRet: if PvNode = 0 mov eax, dword[.bestMove] MainHash_Save .ltte, r8, r9w, edx, BOUND_UPPER, byte[.ttDepth], eax, word[rbx+State.staticEval] else mov eax, dword[.bestMove] and esi, BOUND_EXACT-BOUND_UPPER add esi, BOUND_UPPER MainHash_Save .ltte, r8, r9w, edx, sil, byte[.ttDepth], eax, word[rbx+State.staticEval] end if mov eax, edi calign 8 .Return: Display 2, "QSearch returning %i0%n" add rsp, .localsize pop r15 r14 r13 r12 rdi rsi rbx ret if InCheck = 0 calign 8 .CheckAdvancedPawnPush: and edx, 7 shr r8d, 3 xor edx, r8d cmp edx, 4 jb .DoFutilityPruning jmp .SkipFutilityPruning calign 8 .ContinueFromFutilityBase: mov edx, 1 call SeeTestGe mov ecx, dword[.move] mov edx, r12d test eax, eax jnz .SkipFutilityPruning calign 8 .ContinueFromFutilityValue: cmp edi, edx cmovl edi, edx mov dword[.bestValue], edi jmp .MovePickLoop end if calign 8 .AbortSearch_PlyBigger: xor eax, eax cmp rax, qword[rbx+State.checkersBB] jne .Return call Evaluate jmp .Return calign 8 .AbortSearch_PlySmaller: xor eax, eax jmp .Return calign 8 .ReturnStaticValue: mov r8, qword[.tte] mov r9, qword[rbx+State.key] shr r9, 48 mov edx, eax test r13d, r13d jnz .Return add eax, VALUE_MATE_IN_MAX_PLY cmp eax, 2*VALUE_MATE_IN_MAX_PLY jae .ReturnStaticValue_ValueToTT .ReturnStaticValue_ValueToTTRet: MainHash_Save .ltte, r8, r9w, edx, BOUND_LOWER, DEPTH_NONE, 0, word[rbx+State.staticEval] mov eax, dword[.bestValue] jmp .Return .ReturnStaticValue_ValueToTT: movzx ecx, byte[rbx+State.ply] mov eax, edx sar eax, 31 xor ecx, eax sub edx, eax add edx, ecx jmp .ReturnStaticValue_ValueToTTRet calign 8 .ValueFromTT: ; value in edi is not VALUE_NONE movzx r8d, byte[rbx+State.ply] mov r9d, edi sar r9d, 31 xor r8d, r9d add edi, r9d sub edi, r8d mov dword[.ttValue], edi mov eax, edi sub eax, dword[.beta] sar eax, 31 jmp .ValueFromTTRet calign 8 .ValueToTT: movzx edx, byte[rbx+State.ply] mov eax, edi sar eax, 31 xor edx, eax sub edx, eax add edx, edi jmp .ValueToTTRet calign 8 .CheckDraw_Cold: PosIsDraw_Cold .AbortSearch_PlySmaller, .CheckDraw_ColdRet end macro
src/asm/win64/readdbls.asm
Pantarheon/libkoliba
0
169350
<reponame>Pantarheon/libkoliba<gh_stars>0 ;; readdbls.asm ;; ;; Copyright 2021 G. <NAME> ;; All rights reserved ;; ;; nasm -f win64 readdbls.asm section .text default rel EXTERN KOLIBA_ScanM34tFormat, fscanf, fopen, fclose, KOLIBA_ResetMatrix GLOBAL KOLIBA_ReadDoublesFromOpenFile KOLIBA_ReadDoublesFromOpenFile: ; Since we use this only internally, and only from asm routines, ; we can use R10 to accept an extra parameter. ; ; On Entry: ; ; RCX = address of output DOUBLES ; RDX = handle of FILE to read from ; R8D = number of doubles to scan ; R9 = address of scan format string ; R10 = function to call on failure (or NULL) ; ; On Exit: ; ; RAX = DOUBLES on success, NULL on failure push rbp push rbx push rdi push rsi push r12 ; We have to reserve 4 quads at the bottom of the stack. ; Above that, we need (R8D-2) quads to pass args to fscanf. ; Above that we need R8D quads for fscanf to write to. ; But if R8D happens to be an odd number, we must round it ; up to the nearest even number (or round down its negative). ; Plus we need an extra quad just so RSP is 16-byte aligned. lea eax, [2*r8d] mov rbp, rsp neg rax and al, ~3 ; ~2 would be enough but ~3 does not hurt. lea rsp, [rsp+8*(rax-3)] ; = sub RSP, 8*((R8D-2)+R8D+4+1) mov rdi, rcx mov rbx, r10 mov r12d, r8d sub eax, eax test rdx, rdx jrcxz .done lea rsi, [rsp+8*(r8+2)] lea ecx, [r8d-2] jne .loop .rst: test rbx, rbx mov rcx, rdi mov eax, ebx je .done call rbx sub eax, eax jmp .done .loop: lea rax, [rsi+8*(rcx+1)] mov [rsp+32+8*(rcx-1)], rax loop .loop mov rcx, rdx mov rdx, r9 mov r8, rsi lea r9, [rsi+8] call fscanf cmp eax, r12d mov ecx, eax mov rax, rdi jne .rst rep movsq .done: mov rsp, rbp pop r12 pop rsi pop rdi pop rbx pop rbp ret
oeis/199/A199559.asm
neoneye/loda-programs
11
242407
<gh_stars>10-100 ; A199559: 2*9^n+1. ; 3,19,163,1459,13123,118099,1062883,9565939,86093443,774840979,6973568803,62762119219,564859072963,5083731656659,45753584909923,411782264189299,3706040377703683,33354363399333139,300189270593998243,2701703435345984179,24315330918113857603,218837978263024718419,1969541804367222465763,17725876239305002191859,159532886153745019726723,1435795975383705177540499,12922163778453346597864483,116299474006080119380780339,1046695266054721074427023043,9420257394492489669843207379 mov $1,9 pow $1,$0 mul $1,96 sub $1,96 div $1,48 add $1,3 mov $0,$1
programs/oeis/140/A140442.asm
neoneye/loda
22
26879
; A140442: Primes congruent to 9 mod 14. ; 23,37,79,107,149,163,191,233,317,331,359,373,401,443,457,499,541,569,653,709,751,821,863,877,919,947,1031,1087,1129,1171,1213,1283,1297,1367,1381,1409,1423,1451,1493,1549,1619,1759,1787,1801,1871,1913,1997,2011,2039,2053,2081,2137,2179,2207,2221,2333,2347,2389,2417,2459,2473,2543,2557,2683,2711,2753,2767,2837,2851,2879,2963,3019,3061,3089,3187,3229,3257,3271,3299,3313,3467,3593,3607,3677,3691,3719,3733,3761,3803,3929,3943,4013,4027,4111,4139,4153,4349,4363,4391,4447 add $0,1 seq $0,24904 ; Numbers k such that 7*k - 5 is prime. sub $0,4 mul $0,7 add $0,23
source/xml/sax/xml-sax-input_sources-streams-files-naming_utilities__posix.adb
svn2github/matreshka
24
7659
<reponame>svn2github/matreshka<filename>source/xml/sax/xml-sax-input_sources-streams-files-naming_utilities__posix.adb<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, <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 <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 -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This is implementation of package for POSIX systems. ------------------------------------------------------------------------------ with Ada.Directories; with League.Characters; with League.Text_Codecs; separate (XML.SAX.Input_Sources.Streams.Files) package body Naming_Utilities is use type League.Characters.Universal_Character; use type League.Strings.Universal_String; File_Protocol_Prefix : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("file://"); ------------------- -- Absolute_Name -- ------------------- function Absolute_Name (Name : League.Strings.Universal_String) return League.Strings.Universal_String is function Current_Directory return League.Strings.Universal_String; ----------------------- -- Current_Directory -- ----------------------- function Current_Directory return League.Strings.Universal_String is Aux : constant String := Ada.Directories.Current_Directory; Xua : Ada.Streams.Stream_Element_Array (1 .. Aux'Length); for Xua'Address use Aux'Address; begin return League.Text_Codecs.Codec_For_Application_Locale.Decode (Xua); end Current_Directory; begin if Name.Element (1) = '/' then return Name; else return Current_Directory & '/' & Name; end if; end Absolute_Name; ---------------------- -- File_Name_To_URI -- ---------------------- function File_Name_To_URI (File_Name : League.Strings.Universal_String) return League.Strings.Universal_String is begin return File_Protocol_Prefix & File_Name; end File_Name_To_URI; -------------------------- -- To_Ada_RTL_File_Name -- -------------------------- function To_Ada_RTL_File_Name (Name : League.Strings.Universal_String) return String is Aux : constant Ada.Streams.Stream_Element_Array := League.Text_Codecs.Codec_For_Application_Locale.Encode (Name).To_Stream_Element_Array; Result : String (1 .. Aux'Length); for Result'Address use Aux'Address; begin return Result; end To_Ada_RTL_File_Name; ---------------------- -- URI_To_File_Name -- ---------------------- function URI_To_File_Name (URI : League.Strings.Universal_String) return League.Strings.Universal_String is begin if URI.Starts_With (File_Protocol_Prefix) then return URI.Slice (8, URI.Length); else raise Constraint_Error; end if; end URI_To_File_Name; end Naming_Utilities;
exer1.asm
nobreconfrade/microcontrollers
0
85612
<reponame>nobreconfrade/microcontrollers<gh_stars>0 ----------------------------------- AVR DISASSEMBLER LISTING Address Opcode Instruction ----------------------------------- 000000 940C L5: JMP L1 // Pulo direto 000001 0034 000002 940C JMP L2 // Pulo direto 000003 003E 000004 940C JMP L2 // Pulo direto 000005 003E 000006 940C JMP L2 // Pulo direto 000007 003E 000008 940C JMP L2 // Pulo direto 000009 003E 00000A 940C JMP L2 // Pulo direto 00000B 003E 00000C 940C JMP L2 // Pulo direto 00000D 003E 00000E 940C JMP L2 // Pulo direto 00000F 003E 000010 940C JMP L2 000011 003E 000012 940C JMP L2 000013 003E 000014 940C JMP L2 000015 003E 000016 940C JMP L2 000017 003E 000018 940C JMP L2 000019 003E 00001A 940C JMP L2 00001B 003E 00001C 940C JMP L2 00001D 003E 00001E 940C JMP L2 00001F 003E 000020 940C JMP L2 000021 003E 000022 940C JMP L2 000023 003E 000024 940C JMP L2 000025 003E 000026 940C JMP L2 000027 003E 000028 940C JMP L2 000029 003E 00002A 940C JMP L2 00002B 003E 00002C 940C JMP L2 00002D 003E 00002E 940C JMP L2 00002F 003E 000030 940C JMP L2 000031 003E 000032 940C JMP L2 000033 003E 000034 2411 L1: CLR R1 // Limpa o registrador 000035 BE1F OUT SREG,R1 // Saida para um local I/O, SREG é o registrador de status 000036 EFCF LDI YL,$FF // Carregamento imediato, 000037 E0D8 LDI YH,$08 000038 BFDE OUT SPH,YH 000039 BFCD OUT SPL,YL 00003A 940E CALL L3 // Rotina direta de 'call' 00003B 0040 00003C 940C JMP L4 00003D 0054 00003E 940C L2: JMP L5 00003F 0000 000040 9A56 L3: SBI DDRD,6 // Seta o bit na I/O, local de saida 'DDRD' 000041 E920 LDI R18,$90 000042 E031 LDI R19,$01 000043 9A5E L10: SBI PORTD,6 000044 ED80 LDI R24,$D0 000045 E097 LDI R25,$07 000046 01F9 L7: MOVW R31:R30,R19:R18 // Copia registrador com palavra 000047 9731 L6: SBIW ZH:ZL,1 // Subtrai imediato a palavra 000048 F7F1 BRNE L6 // Pula se não for igual 000049 9701 SBIW R25:R24,1 00004A F7D9 BRNE L7 00004B 985E CBI PORTD,6 // Limpa o bit específico, portD 00004C ED80 LDI R24,$D0 00004D E097 LDI R25,$07 00004E 01F9 L9: MOVW R31:R30,R19:R18 00004F 9731 L8: SBIW ZH:ZL,1 000050 F7F1 BRNE L8 000051 9701 SBIW R25:R24,1 000052 F7D9 BRNE L9 000053 CFEF RJMP L10 // Pulo relativo 000054 94F8 L4: BCLR 7 // Limpa flag 000055 CFFF L11: RJMP L11
source/disassembly.asm
sitedata/MarioCompiler
0
101985
<reponame>sitedata/MarioCompiler .inesprg 2 ; 2x 16KB PRG code .ineschr 1 ; 1x 8KB CHR data .inesmap 0 ; mapper 0 = NROM, no bank swapping .inesmir 1 ; background mirroring ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;SMbBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY ;by doppelganger (<EMAIL>) ;There are so many people I have to thank for this, that taking all the credit for ;myself would be an unforgivable act of arrogance. Without their help this would ;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into ;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no ;way I could have done this without your help), as well as the authors of x816 and SMB ;Utility, and the reverse-engineers who did the original Super Mario Bros. Hacking Project, ;which I compared notes with but did not copy from. Last but certainly not least, I thank ;Nintendo for creating this game and the NES, without which this disassembly would ;only be theory. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;Revised for NESASM by bigjt_2 ;;(<EMAIL>) ;;Originally assembled with x816. ;;NESASM header already included above. Still requires SMB1 character data to work. ;;Thanks IMMENSELY to doppelganger for painstakingly taking the time to crawl through ;;all this assembly code and provide such a complete and wonderful dissassembly, and ;;for passing this onto the community at large. Ditto to all the fine folks doppelganger ;;thanked in the original x816 dissassembly, as well. ;;Assembles with NESASM 3+ ;;Be sure you have the exact correct SMB character data for the pattern tables. Otherwise ;;you will have a glitched-up title screen, among other things. ;------------------------------------------------------------------------------------- ;DEFINES ;NES specific hardware defines PPU_CTRL_REG1 = $2000 PPU_CTRL_REG2 = $2001 PPU_STATUS = $2002 PPU_SPR_ADDR = $2003 PPU_SPR_DATA = $2004 PPU_SCROLL_REG = $2005 PPU_ADDRESS = $2006 PPU_DATA = $2007 SND_REGISTER = $4000 SND_SQUARE1_REG = $4000 SND_SQUARE2_REG = $4004 SND_TRIANGLE_REG = $4008 SND_NOISE_REG = $400c SND_DELTA_REG = $4010 SND_MASTERCTRL_REG = $4015 SPR_DMA = $4014 JOYPAD_PORT = $4016 JOYPAD_PORT1 = $4016 JOYPAD_PORT2 = $4017 ; GAME SPECIFIC DEFINES ObjectOffset = $08 FrameCounter = $09 SavedJoypadBits = $06fc SavedJoypad1Bits = $06fc SavedJoypad2Bits = $06fd JoypadBitMask = $074a JoypadOverride = $0758 A_B_Buttons = $0a PreviousA_B_Buttons = $0d Up_Down_Buttons = $0b Left_Right_Buttons = $0c GameEngineSubroutine = $0e Mirror_PPU_CTRL_REG1 = $0778 Mirror_PPU_CTRL_REG2 = $0779 OperMode = $0770 OperMode_Task = $0772 ScreenRoutineTask = $073c GamePauseStatus = $0776 GamePauseTimer = $0777 DemoAction = $0717 DemoActionTimer = $0718 TimerControl = $0747 IntervalTimerControl = $077f Timers = $0780 SelectTimer = $0780 PlayerAnimTimer = $0781 JumpSwimTimer = $0782 RunningTimer = $0783 BlockBounceTimer = $0784 SideCollisionTimer = $0785 JumpspringTimer = $0786 GameTimerCtrlTimer = $0787 ClimbSideTimer = $0789 EnemyFrameTimer = $078a FrenzyEnemyTimer = $078f BowserFireBreathTimer = $0790 StompTimer = $0791 AirBubbleTimer = $0792 ScrollIntervalTimer = $0795 EnemyIntervalTimer = $0796 BrickCoinTimer = $079d InjuryTimer = $079e StarInvincibleTimer = $079f ScreenTimer = $07a0 WorldEndTimer = $07a1 DemoTimer = $07a2 Sprite_Data = $0200 Sprite_Y_Position = $0200 Sprite_Tilenumber = $0201 Sprite_Attributes = $0202 Sprite_X_Position = $0203 ScreenEdge_PageLoc = $071a ScreenEdge_X_Pos = $071c ScreenLeft_PageLoc = $071a ScreenRight_PageLoc = $071b ScreenLeft_X_Pos = $071c ScreenRight_X_Pos = $071d PlayerFacingDir = $33 DestinationPageLoc = $34 VictoryWalkControl = $35 ScrollFractional = $0768 PrimaryMsgCounter = $0719 SecondaryMsgCounter = $0749 HorizontalScroll = $073f VerticalScroll = $0740 ScrollLock = $0723 ScrollThirtyTwo = $073d Player_X_Scroll = $06ff Player_Pos_ForScroll = $0755 ScrollAmount = $0775 AreaData = $e7 AreaDataLow = $e7 AreaDataHigh = $e8 EnemyData = $e9 EnemyDataLow = $e9 EnemyDataHigh = $ea AreaParserTaskNum = $071f ColumnSets = $071e CurrentPageLoc = $0725 CurrentColumnPos = $0726 BackloadingFlag = $0728 BehindAreaParserFlag = $0729 AreaObjectPageLoc = $072a AreaObjectPageSel = $072b AreaDataOffset = $072c AreaObjOffsetBuffer = $072d AreaObjectLength = $0730 StaircaseControl = $0734 AreaObjectHeight = $0735 MushroomLedgeHalfLen = $0736 EnemyDataOffset = $0739 EnemyObjectPageLoc = $073a EnemyObjectPageSel = $073b MetatileBuffer = $06a1 BlockBufferColumnPos = $06a0 CurrentNTAddr_Low = $0721 CurrentNTAddr_High = $0720 AttributeBuffer = $03f9 LoopCommand = $0745 DisplayDigits = $07d7 TopScoreDisplay = $07d7 ScoreAndCoinDisplay = $07dd PlayerScoreDisplay = $07dd GameTimerDisplay = $07f8 DigitModifier = $0134 VerticalFlipFlag = $0109 FloateyNum_Control = $0110 ShellChainCounter = $0125 FloateyNum_Timer = $012c FloateyNum_X_Pos = $0117 FloateyNum_Y_Pos = $011e FlagpoleFNum_Y_Pos = $010d FlagpoleFNum_YMFDummy = $010e FlagpoleScore = $010f FlagpoleCollisionYPos = $070f StompChainCounter = $0484 VRAM_Buffer1_Offset = $0300 VRAM_Buffer1 = $0301 VRAM_Buffer2_Offset = $0340 VRAM_Buffer2 = $0341 VRAM_Buffer_AddrCtrl = $0773 Sprite0HitDetectFlag = $0722 DisableScreenFlag = $0774 DisableIntermediate = $0769 ColorRotateOffset = $06d4 TerrainControl = $0727 AreaStyle = $0733 ForegroundScenery = $0741 BackgroundScenery = $0742 CloudTypeOverride = $0743 BackgroundColorCtrl = $0744 AreaType = $074e AreaAddrsLOffset = $074f AreaPointer = $0750 PlayerEntranceCtrl = $0710 GameTimerSetting = $0715 AltEntranceControl = $0752 EntrancePage = $0751 NumberOfPlayers = $077a WarpZoneControl = $06d6 ChangeAreaTimer = $06de MultiLoopCorrectCntr = $06d9 MultiLoopPassCntr = $06da FetchNewGameTimerFlag = $0757 GameTimerExpiredFlag = $0759 PrimaryHardMode = $076a SecondaryHardMode = $06cc WorldSelectNumber = $076b WorldSelectEnableFlag = $07fc ContinueWorld = $07fd CurrentPlayer = $0753 PlayerSize = $0754 PlayerStatus = $0756 OnscreenPlayerInfo = $075a NumberofLives = $075a ;used by current player HalfwayPage = $075b LevelNumber = $075c ;the actual dash number Hidden1UpFlag = $075d CoinTally = $075e WorldNumber = $075f AreaNumber = $0760 ;internal number used to find areas CoinTallyFor1Ups = $0748 OffscreenPlayerInfo = $0761 OffScr_NumberofLives = $0761 ;used by offscreen player OffScr_HalfwayPage = $0762 OffScr_LevelNumber = $0763 OffScr_Hidden1UpFlag = $0764 OffScr_CoinTally = $0765 OffScr_WorldNumber = $0766 OffScr_AreaNumber = $0767 BalPlatformAlignment = $03a0 Platform_X_Scroll = $03a1 PlatformCollisionFlag = $03a2 YPlatformTopYPos = $0401 YPlatformCenterYPos = $58 BrickCoinTimerFlag = $06bc StarFlagTaskControl = $0746 PseudoRandomBitReg = $07a7 WarmBootValidation = $07ff SprShuffleAmtOffset = $06e0 SprShuffleAmt = $06e1 SprDataOffset = $06e4 Player_SprDataOffset = $06e4 Enemy_SprDataOffset = $06e5 Block_SprDataOffset = $06ec Alt_SprDataOffset = $06ec Bubble_SprDataOffset = $06ee FBall_SprDataOffset = $06f1 Misc_SprDataOffset = $06f3 SprDataOffset_Ctrl = $03ee Player_State = $1d Enemy_State = $1e Fireball_State = $24 Block_State = $26 Misc_State = $2a Player_MovingDir = $45 Enemy_MovingDir = $46 SprObject_X_Speed = $57 Player_X_Speed = $57 Enemy_X_Speed = $58 Fireball_X_Speed = $5e Block_X_Speed = $60 Misc_X_Speed = $64 Jumpspring_FixedYPos = $58 JumpspringAnimCtrl = $070e JumpspringForce = $06db SprObject_PageLoc = $6d Player_PageLoc = $6d Enemy_PageLoc = $6e Fireball_PageLoc = $74 Block_PageLoc = $76 Misc_PageLoc = $7a Bubble_PageLoc = $83 SprObject_X_Position = $86 ;position in game's abstract map, Player_X_Position = $86 ;NOT the position on the screen Enemy_X_Position = $87 Fireball_X_Position = $8d Block_X_Position = $8f Misc_X_Position = $93 Bubble_X_Position = $9c SprObject_Y_Speed = $9f Player_Y_Speed = $9f Enemy_Y_Speed = $a0 Fireball_Y_Speed = $a6 Block_Y_Speed = $a8 Misc_Y_Speed = $ac SprObject_Y_HighPos = $b5 Player_Y_HighPos = $b5 Enemy_Y_HighPos = $b6 Fireball_Y_HighPos = $bc Block_Y_HighPos = $be Misc_Y_HighPos = $c2 Bubble_Y_HighPos = $cb SprObject_Y_Position = $ce Player_Y_Position = $ce Enemy_Y_Position = $cf Fireball_Y_Position = $d5 Block_Y_Position = $d7 Misc_Y_Position = $db Bubble_Y_Position = $e4 SprObject_Rel_XPos = $03ad ;these represent the ACTUAL sprite positions Player_Rel_XPos = $03ad ;on the screen Enemy_Rel_XPos = $03ae Fireball_Rel_XPos = $03af Bubble_Rel_XPos = $03b0 Block_Rel_XPos = $03b1 Misc_Rel_XPos = $03b3 SprObject_Rel_YPos = $03b8 Player_Rel_YPos = $03b8 Enemy_Rel_YPos = $03b9 Fireball_Rel_YPos = $03ba Bubble_Rel_YPos = $03bb Block_Rel_YPos = $03bc Misc_Rel_YPos = $03be SprObject_SprAttrib = $03c4 Player_SprAttrib = $03c4 Enemy_SprAttrib = $03c5 SprObject_X_MoveForce = $0400 Enemy_X_MoveForce = $0401 SprObject_YMF_Dummy = $0416 Player_YMF_Dummy = $0416 Enemy_YMF_Dummy = $0417 Bubble_YMF_Dummy = $042c SprObject_Y_MoveForce = $0433 Player_Y_MoveForce = $0433 Enemy_Y_MoveForce = $0434 Block_Y_MoveForce = $043c DisableCollisionDet = $0716 Player_CollisionBits = $0490 Enemy_CollisionBits = $0491 SprObj_BoundBoxCtrl = $0499 Player_BoundBoxCtrl = $0499 Enemy_BoundBoxCtrl = $049a Fireball_BoundBoxCtrl = $04a0 Misc_BoundBoxCtrl = $04a2 EnemyFrenzyBuffer = $06cb EnemyFrenzyQueue = $06cd Enemy_Flag = $0f Enemy_ID = $16 PlayerGfxOffset = $06d5 Player_XSpeedAbsolute = $0700 FrictionAdderHigh = $0701 FrictionAdderLow = $0702 RunningSpeed = $0703 SwimmingFlag = $0704 Player_X_MoveForce = $0705 DiffToHaltJump = $0706 JumpOrigin_Y_HighPos = $0707 JumpOrigin_Y_Position = $0708 VerticalForce = $0709 VerticalForceDown = $070a PlayerChangeSizeFlag = $070b PlayerAnimTimerSet = $070c PlayerAnimCtrl = $070d DeathMusicLoaded = $0712 FlagpoleSoundQueue = $0713 CrouchingFlag = $0714 MaximumLeftSpeed = $0450 MaximumRightSpeed = $0456 SprObject_OffscrBits = $03d0 Player_OffscreenBits = $03d0 Enemy_OffscreenBits = $03d1 FBall_OffscreenBits = $03d2 Bubble_OffscreenBits = $03d3 Block_OffscreenBits = $03d4 Misc_OffscreenBits = $03d6 EnemyOffscrBitsMasked = $03d8 Cannon_Offset = $046a Cannon_PageLoc = $046b Cannon_X_Position = $0471 Cannon_Y_Position = $0477 Cannon_Timer = $047d Whirlpool_Offset = $046a Whirlpool_PageLoc = $046b Whirlpool_LeftExtent = $0471 Whirlpool_Length = $0477 Whirlpool_Flag = $047d VineFlagOffset = $0398 VineHeight = $0399 VineObjOffset = $039a VineStart_Y_Position = $039d Block_Orig_YPos = $03e4 Block_BBuf_Low = $03e6 Block_Metatile = $03e8 Block_PageLoc2 = $03ea Block_RepFlag = $03ec Block_ResidualCounter = $03f0 Block_Orig_XPos = $03f1 BoundingBox_UL_XPos = $04ac BoundingBox_UL_YPos = $04ad BoundingBox_DR_XPos = $04ae BoundingBox_DR_YPos = $04af BoundingBox_UL_Corner = $04ac BoundingBox_LR_Corner = $04ae EnemyBoundingBoxCoord = $04b0 PowerUpType = $39 FireballBouncingFlag = $3a FireballCounter = $06ce FireballThrowingTimer = $0711 HammerEnemyOffset = $06ae JumpCoinMiscOffset = $06b7 Block_Buffer_1 = $0500 Block_Buffer_2 = $05d0 HammerThrowingTimer = $03a2 HammerBroJumpTimer = $3c Misc_Collision_Flag = $06be RedPTroopaOrigXPos = $0401 RedPTroopaCenterYPos = $58 XMovePrimaryCounter = $a0 XMoveSecondaryCounter = $58 CheepCheepMoveMFlag = $58 CheepCheepOrigYPos = $0434 BitMFilter = $06dd LakituReappearTimer = $06d1 LakituMoveSpeed = $58 LakituMoveDirection = $a0 FirebarSpinState_Low = $58 FirebarSpinState_High = $a0 FirebarSpinSpeed = $0388 FirebarSpinDirection = $34 DuplicateObj_Offset = $06cf NumberofGroupEnemies = $06d3 BlooperMoveCounter = $a0 BlooperMoveSpeed = $58 BowserBodyControls = $0363 BowserFeetCounter = $0364 BowserMovementSpeed = $0365 BowserOrigXPos = $0366 BowserFlameTimerCtrl = $0367 BowserFront_Offset = $0368 BridgeCollapseOffset = $0369 BowserGfxFlag = $036a BowserHitPoints = $0483 MaxRangeFromOrigin = $06dc BowserFlamePRandomOfs = $0417 PiranhaPlantUpYPos = $0417 PiranhaPlantDownYPos = $0434 PiranhaPlant_Y_Speed = $58 PiranhaPlant_MoveFlag = $a0 FireworksCounter = $06d7 ExplosionGfxCounter = $58 ExplosionTimerCounter = $a0 ;sound related defines Squ2_NoteLenBuffer = $07b3 Squ2_NoteLenCounter = $07b4 Squ2_EnvelopeDataCtrl = $07b5 Squ1_NoteLenCounter = $07b6 Squ1_EnvelopeDataCtrl = $07b7 Tri_NoteLenBuffer = $07b8 Tri_NoteLenCounter = $07b9 Noise_BeatLenCounter = $07ba Squ1_SfxLenCounter = $07bb Squ2_SfxLenCounter = $07bd Sfx_SecondaryCounter = $07be Noise_SfxLenCounter = $07bf PauseSoundQueue = $fa Square1SoundQueue = $ff Square2SoundQueue = $fe NoiseSoundQueue = $fd AreaMusicQueue = $fb EventMusicQueue = $fc Square1SoundBuffer = $f1 Square2SoundBuffer = $f2 NoiseSoundBuffer = $f3 AreaMusicBuffer = $f4 EventMusicBuffer = $07b1 PauseSoundBuffer = $07b2 MusicData = $f5 MusicDataLow = $f5 MusicDataHigh = $f6 MusicOffset_Square2 = $f7 MusicOffset_Square1 = $f8 MusicOffset_Triangle = $f9 MusicOffset_Noise = $07b0 NoteLenLookupTblOfs = $f0 DAC_Counter = $07c0 NoiseDataLoopbackOfs = $07c1 NoteLengthTblAdder = $07c4 AreaMusicBuffer_Alt = $07c5 PauseModeFlag = $07c6 GroundMusicHeaderOfs = $07c7 AltRegContentFlag = $07ca ;------------------------------------------------------------------------------------- ;CONSTANTS ;sound effects constants Sfx_SmallJump = %10000000 Sfx_Flagpole = %01000000 Sfx_Fireball = %00100000 Sfx_PipeDown_Injury = %00010000 Sfx_EnemySmack = %00001000 Sfx_EnemyStomp = %00000100 Sfx_Bump = %00000010 Sfx_BigJump = %00000001 Sfx_BowserFall = %10000000 Sfx_ExtraLife = %01000000 Sfx_PowerUpGrab = %00100000 Sfx_TimerTick = %00010000 Sfx_Blast = %00001000 Sfx_GrowVine = %00000100 Sfx_GrowPowerUp = %00000010 Sfx_CoinGrab = %00000001 Sfx_BowserFlame = %00000010 Sfx_BrickShatter = %00000001 ;music constants Silence = %10000000 StarPowerMusic = %01000000 PipeIntroMusic = %00100000 CloudMusic = %00010000 CastleMusic = %00001000 UndergroundMusic = %00000100 WaterMusic = %00000010 GroundMusic = %00000001 TimeRunningOutMusic = %01000000 EndOfLevelMusic = %00100000 AltGameOverMusic = %00010000 EndOfCastleMusic = %00001000 VictoryMusic = %00000100 GameOverMusic = %00000010 DeathMusic = %00000001 ;enemy object constants GreenKoopa = $00 BuzzyBeetle = $02 RedKoopa = $03 HammerBro = $05 Goomba = $06 Bloober = $07 BulletBill_FrenzyVar = $08 GreyCheepCheep = $0a RedCheepCheep = $0b Podoboo = $0c PiranhaPlant = $0d GreenParatroopaJump = $0e RedParatroopa = $0f GreenParatroopaFly = $10 Lakitu = $11 Spiny = $12 FlyCheepCheepFrenzy = $14 FlyingCheepCheep = $14 BowserFlame = $15 Fireworks = $16 BBill_CCheep_Frenzy = $17 Stop_Frenzy = $18 Bowser = $2d PowerUpObject = $2e VineObject = $2f FlagpoleFlagObject = $30 StarFlagObject = $31 JumpspringObject = $32 BulletBill_CannonVar = $33 RetainerObject = $35 TallEnemy = $09 ;other constants World1 = 0 World2 = 1 World3 = 2 World4 = 3 World5 = 4 World6 = 5 World7 = 6 World8 = 7 Level1 = 0 Level2 = 1 Level3 = 2 Level4 = 3 WarmBootOffset = $d6 ColdBootOffset = $fe TitleScreenDataOffset = $1EC0 SoundMemory = $07b0 SwimTileRepOffset = $EEB5 ;;PlayerGraphicsTable + $9e MusicHeaderOffsetData = $F90C ;;MusicHeaderData - 1 MHD = $F90D ;;MusicHeaderData A_Button = %10000000 B_Button = %01000000 Select_Button = %00100000 Start_Button = %00010000 Up_Dir = %00001000 Down_Dir = %00000100 Left_Dir = %00000010 Right_Dir = %00000001 TitleScreenModeValue = 0 GameModeValue = 1 VictoryModeValue = 2 GameOverModeValue = 3 ;------------------------------------------------------------------------------------- ;DIRECTIVES ;.index 8 ;.mem 8 .bank 0 .org $8000 ;------------------------------------------------------------------------------------- Start: cld lda #%00010000 ;init PPU control register 1 sta PPU_CTRL_REG1 ldx #$ff ;reset stack pointer txs VBlank1: lda PPU_STATUS ;wait two frames bpl VBlank1 VBlank2: lda PPU_STATUS bpl VBlank2 ldy #ColdBootOffset ;load default cold boot pointer ldx #$05 ;this is where we check for a warm boot WBootCheck: lda TopScoreDisplay,x ;check each score digit in the top score cmp #10 ;to see if we have a valid digit bcs ColdBoot ;if not, give up and proceed with cold boot dex bpl WBootCheck lda WarmBootValidation ;second checkpoint, check to see if cmp #$a5 ;another location has a specific value bne ColdBoot ldy #WarmBootOffset ;if passed both, load warm boot pointer ColdBoot: jsr InitializeMemory ;clear memory using pointer in Y sta SND_DELTA_REG+1 ;reset delta counter load register sta OperMode ;reset primary mode of operation lda #$a5 ;set warm boot flag sta WarmBootValidation sta PseudoRandomBitReg ;set seed for pseudorandom register lda #%00001111 sta SND_MASTERCTRL_REG ;enable all sound channels except dmc lda #%00000110 sta PPU_CTRL_REG2 ;turn off clipping for OAM and background jsr MoveAllSpritesOffscreen jsr InitializeNameTables ;initialize both name tables inc DisableScreenFlag ;set flag to disable screen output lda Mirror_PPU_CTRL_REG1 ora #%10000000 ;enable NMIs jsr WritePPUReg1 EndlessLoop: jmp EndlessLoop ;endless loop, need I say more? ;------------------------------------------------------------------------------------- ;$00 - vram buffer address table low, also used for pseudorandom bit ;$01 - vram buffer address table high VRAM_AddrTable_Low: .db LOW_VRAM_Buffer1, LOW_WaterPaletteData, LOW_GroundPaletteData,LOW_UndergroundPaletteData .db LOW_CastlePaletteData, LOW_VRAM_Buffer1_Offset, LOW_VRAM_Buffer2, LOW_VRAM_Buffer2 .db LOW_BowserPaletteData,LOW_DaySnowPaletteData, LOW_NightSnowPaletteData .db LOW_MushroomPaletteData,LOW_MarioThanksMessage, LOW_LuigiThanksMessage .db LOW_MushroomRetainerSaved, LOW_PrincessSaved1, LOW_PrincessSaved2 .db LOW_WorldSelectMessage1, LOW_WorldSelectMessage2 VRAM_AddrTable_High: .db HIGH_VRAM_Buffer1, HIGH_WaterPaletteData, HIGH_GroundPaletteData,HIGH_UndergroundPaletteData .db HIGH_CastlePaletteData, HIGH_VRAM_Buffer1_Offset, HIGH_VRAM_Buffer2, HIGH_VRAM_Buffer2 .db HIGH_BowserPaletteData,HIGH_DaySnowPaletteData, HIGH_NightSnowPaletteData .db HIGH_MushroomPaletteData,HIGH_MarioThanksMessage, HIGH_LuigiThanksMessage .db HIGH_MushroomRetainerSaved, HIGH_PrincessSaved1, HIGH_PrincessSaved2 .db HIGH_WorldSelectMessage1, HIGH_WorldSelectMessage2 VRAM_Buffer_Offset: .db LOW_VRAM_Buffer1_Offset, LOW_VRAM_Buffer2_Offset ;NESASM Version ; VRAM_AddrTable_Low: ; .db LOW(VRAM_Buffer1), LOW(WaterPaletteData), LOW(GroundPaletteData) ; .db LOW(UndergroundPaletteData), LOW(CastlePaletteData), LOW(VRAM_Buffer1_Offset) ; .db LOW(VRAM_Buffer2), LOW(VRAM_Buffer2), LOW(BowserPaletteData) ; .db LOW(DaySnowPaletteData), LOW(NightSnowPaletteData), LOW(MushroomPaletteData) ; .db LOW(MarioThanksMessage), LOW(LuigiThanksMessage), LOW(MushroomRetainerSaved) ; .db LOW(PrincessSaved1), LOW(PrincessSaved2), LOW(WorldSelectMessage1) ; .db LOW(WorldSelectMessage2) ; VRAM_AddrTable_High: ; .db HIGH(VRAM_Buffer1), HIGH(WaterPaletteData), HIGH(GroundPaletteData) ; .db HIGH(UndergroundPaletteData), HIGH(CastlePaletteData), HIGH(VRAM_Buffer1_Offset) ; .db HIGH(VRAM_Buffer2), HIGH(VRAM_Buffer2), HIGH(BowserPaletteData) ; .db HIGH(DaySnowPaletteData), HIGH(NightSnowPaletteData), HIGH(MushroomPaletteData) ; .db HIGH(MarioThanksMessage), HIGH(LuigiThanksMessage), HIGH(MushroomRetainerSaved) ; .db HIGH(PrincessSaved1), HIGH(PrincessSaved2), HIGH(WorldSelectMessage1) ; .db HIGH(WorldSelectMessage2) ; VRAM_Buffer_Offset: ; .db LOW(VRAM_Buffer1_Offset), LOW(VRAM_Buffer2_Offset) NonMaskableInterrupt: lda Mirror_PPU_CTRL_REG1 ;disable NMIs in mirror reg and #%01111111 ;save all other bits sta Mirror_PPU_CTRL_REG1 and #%01111110 ;alter name table address to be $2800 sta PPU_CTRL_REG1 ;(essentially $2000) but save other bits lda Mirror_PPU_CTRL_REG2 ;disable OAM and background display by default and #%11100110 ldy DisableScreenFlag ;get screen disable flag bne ScreenOff ;if set, used bits as-is lda Mirror_PPU_CTRL_REG2 ;otherwise reenable bits and save them ora #%00011110 ScreenOff: sta Mirror_PPU_CTRL_REG2 ;save bits for later but not in register at the moment and #%11100111 ;disable screen for now sta PPU_CTRL_REG2 ldx PPU_STATUS ;reset flip-flop and reset scroll registers to zero lda #$00 jsr InitScroll sta PPU_SPR_ADDR ;reset spr-ram address register lda #$02 ;perform spr-ram DMA access on $0200-$02ff sta SPR_DMA ldx VRAM_Buffer_AddrCtrl ;load control for pointer to buffer contents lda VRAM_AddrTable_Low,x ;set indirect at $00 to pointer sta <$00 lda VRAM_AddrTable_High,x sta <$01 jsr UpdateScreen ;update screen with buffer contents ldy #$00 ldx VRAM_Buffer_AddrCtrl ;check for usage of $0341 cpx #$06 bne InitBuffer iny ;get offset based on usage InitBuffer: ldx VRAM_Buffer_Offset,y lda #$00 ;clear buffer header at last location sta VRAM_Buffer1_Offset,x sta VRAM_Buffer1,x sta VRAM_Buffer_AddrCtrl ;reinit address control to $0301 lda Mirror_PPU_CTRL_REG2 ;copy mirror of $2001 to register sta PPU_CTRL_REG2 ;Disabled Sound Engine - will need updates to the compiler to get this working ; jsr SoundEngine ;play sound jsr ReadJoypads ;read joypads jsr PauseRoutine ;handle pause jsr UpdateTopScore lda GamePauseStatus ;check for pause status lsr a bcs PauseSkip lda TimerControl ;if master timer control not set, decrement beq DecTimers ;all frame and interval timers dec TimerControl bne NoDecTimers DecTimers: ldx #$14 ;load end offset for end of frame timers dec IntervalTimerControl ;decrement interval timer control, bpl DecTimersLoop ;if not expired, only frame timers will decrement lda #$14 sta IntervalTimerControl ;if control for interval timers expired, ldx #$23 ;interval timers will decrement along with frame timers DecTimersLoop: lda Timers,x ;check current timer beq SkipExpTimer ;if current timer expired, branch to skip, dec Timers,x ;otherwise decrement the current timer SkipExpTimer: dex ;move onto next timer bpl DecTimersLoop ;do this until all timers are dealt with NoDecTimers: inc <FrameCounter ;increment frame counter PauseSkip: ldx #$00 ldy #$07 lda PseudoRandomBitReg ;get first memory location of LSFR bytes and #%00000010 ;mask out all but d1 sta <$00 ;save here lda PseudoRandomBitReg+1 ;get second memory location and #%00000010 ;mask out all but d1 eor <$00 ;perform exclusive-OR on d1 from first and second bytes clc ;if neither or both are set, carry will be clear beq RotPRandomBit sec ;if one or the other is set, carry will be set RotPRandomBit: ror PseudoRandomBitReg,x ;rotate carry into d7, and rotate last bit into carry inx ;increment to next byte dey ;decrement for loop bne RotPRandomBit lda Sprite0HitDetectFlag ;check for flag here beq SkipSprite0 Sprite0Clr: lda PPU_STATUS ;wait for sprite 0 flag to clear, which will and #%01000000 ;not happen until vblank has ended bne Sprite0Clr lda GamePauseStatus ;if in pause mode, do not bother with sprites at all lsr a bcs Sprite0Hit jsr MoveSpritesOffscreen jsr SpriteShuffler Sprite0Hit: lda PPU_STATUS ;do sprite #0 hit detection and #%01000000 beq Sprite0Hit ldy #$14 ;small delay, to wait until we hit horizontal blank time HBlankDelay: dey bne HBlankDelay SkipSprite0: lda HorizontalScroll ;set scroll registers from variables sta PPU_SCROLL_REG lda VerticalScroll sta PPU_SCROLL_REG lda Mirror_PPU_CTRL_REG1 ;load saved mirror of $2000 pha sta PPU_CTRL_REG1 lda GamePauseStatus ;if in pause mode, do not perform operation mode stuff lsr a bcs SkipMainOper jsr OperModeExecutionTree ;otherwise do one of many, many possible subroutines SkipMainOper: lda PPU_STATUS ;reset flip-flop pla ora #%10000000 ;reactivate NMIs sta PPU_CTRL_REG1 rti ;we are done until the next frame! ;------------------------------------------------------------------------------------- PauseRoutine: lda OperMode ;are we in victory mode? cmp #VictoryModeValue ;if so, go ahead beq ChkPauseTimer cmp #GameModeValue ;are we in game mode? bne ExitPause ;if not, leave lda OperMode_Task ;if we are in game mode, are we running game engine? cmp #$03 bne ExitPause ;if not, leave ChkPauseTimer: lda GamePauseTimer ;check if pause timer is still counting down beq ChkStart dec GamePauseTimer ;if so, decrement and leave rts ChkStart: lda SavedJoypad1Bits ;check to see if start is pressed and #Start_Button ;on controller 1 beq ClrPauseTimer lda GamePauseStatus ;check to see if timer flag is set and #%10000000 ;and if so, do not reset timer (residual, bne ExitPause ;joypad reading routine makes this unnecessary) lda #$2b ;set pause timer sta GamePauseTimer lda GamePauseStatus tay iny ;set pause sfx queue for next pause mode sty <PauseSoundQueue eor #%00000001 ;invert d0 and set d7 ora #%10000000 bne SetPause ;unconditional branch ClrPauseTimer: lda GamePauseStatus ;clear timer flag if timer is at zero and start button and #%01111111 ;is not pressed SetPause: sta GamePauseStatus ExitPause: rts ;------------------------------------------------------------------------------------- ;$00 - used for preset value SpriteShuffler: ldy AreaType ;load level type, likely residual code lda #$28 ;load preset value which will put it at sta <$00 ;sprite #10 ldx #$0e ;start at the end of OAM data offsets ShuffleLoop: lda SprDataOffset,x ;check for offset value against cmp <$00 ;the preset value bcc NextSprOffset ;if less, skip this part ldy SprShuffleAmtOffset ;get current offset to preset value we want to add clc adc SprShuffleAmt,y ;get shuffle amount, add to current sprite offset bcc StrSprOffset ;if not exceeded $ff, skip second add clc adc <$00 ;otherwise add preset value $28 to offset StrSprOffset: sta SprDataOffset,x ;store new offset here or old one if branched to here NextSprOffset: dex ;move backwards to next one bpl ShuffleLoop ldx SprShuffleAmtOffset ;load offset inx cpx #$03 ;check if offset + 1 goes to 3 bne SetAmtOffset ;if offset + 1 not 3, store ldx #$00 ;otherwise, init to 0 SetAmtOffset: stx SprShuffleAmtOffset ldx #$08 ;load offsets for values and storage ldy #$02 SetMiscOffset: lda SprDataOffset+5,y ;load one of three OAM data offsets sta Misc_SprDataOffset-2,x ;store first one unmodified, but clc ;add eight to the second and eight adc #$08 ;more to the third one sta Misc_SprDataOffset-1,x ;note that due to the way X is set up, clc ;this code loads into the misc sprite offsets adc #$08 sta Misc_SprDataOffset,x dex dex dex dey bpl SetMiscOffset ;do this until all misc spr offsets are loaded rts ;------------------------------------------------------------------------------------- OperModeExecutionTree: lda OperMode ;this is the heart of the entire program, jsr JumpEngine ;most of what goes on starts here .dw TitleScreenMode .dw GameMode .dw VictoryMode .dw GameOverMode ;------------------------------------------------------------------------------------- MoveAllSpritesOffscreen: ldy #$00 ;this routine moves all sprites off the screen .db $2c ;BIT instruction opcode MoveSpritesOffscreen: ldy #$04 ;this routine moves all but sprite 0 lda #$f8 ;off the screen SprInitLoop: sta Sprite_Y_Position,y ;write 248 into OAM data's Y coordinate iny ;which will move it off the screen iny iny iny bne SprInitLoop rts ;------------------------------------------------------------------------------------- TitleScreenMode: SEI lda OperMode_Task jsr JumpEngine .dw InitializeGame .dw ScreenRoutines .dw PrimaryGameSetup .dw GameMenuRoutine ;------------------------------------------------------------------------------------- WSelectBufferTemplate: .db $04, $20, $73, $01, $00, $00 GameMenuRoutine: ldy #$00 lda SavedJoypad1Bits ;check to see if either player pressed ora SavedJoypad2Bits ;only the start button (either joypad) cmp #Start_Button beq StartGame ; cmp #A_Button+Start_Button ;check to see if A + start was pressed cmp #144 bne ChkSelect ;if not, branch to check select button StartGame: jmp ChkContinue ;if either start or A + start, execute here ChkSelect: cmp #Select_Button ;check to see if the select button was pressed beq SelectBLogic ;if so, branch reset demo timer ldx DemoTimer ;otherwise check demo timer bne ChkWorldSel ;if demo timer not expired, branch to check world selection sta SelectTimer ;set controller bits here if running demo jsr DemoEngine ;run through the demo actions bcs ResetTitle ;if carry flag set, demo over, thus branch jmp RunDemo ;otherwise, run game engine for demo ChkWorldSel: ldx WorldSelectEnableFlag ;check to see if world selection has been enabled beq NullJoypad cmp #B_Button ;if so, check to see if the B button was pressed bne NullJoypad iny ;if so, increment Y and execute same code as select SelectBLogic: lda DemoTimer ;if select or B pressed, check demo timer one last time beq ResetTitle ;if demo timer expired, branch to reset title screen mode lda #$18 ;otherwise reset demo timer sta DemoTimer lda SelectTimer ;check select/B button timer bne NullJoypad ;if not expired, branch lda #$10 ;otherwise reset select button timer sta SelectTimer cpy #$01 ;was the B button pressed earlier? if so, branch beq IncWorldSel ;note this will not be run if world selection is disabled lda NumberOfPlayers ;if no, must have been the select button, therefore eor #%00000001 ;change number of players and draw icon accordingly sta NumberOfPlayers jsr DrawMushroomIcon jmp NullJoypad IncWorldSel: ldx WorldSelectNumber ;increment world select number inx txa and #%00000111 ;mask out higher bits sta WorldSelectNumber ;store as current world select number jsr GoContinue UpdateShroom: lda WSelectBufferTemplate,x ;write template for world select in vram buffer sta VRAM_Buffer1-1,x ;do this until all bytes are written inx cpx #$06 bmi UpdateShroom ldy WorldNumber ;get world number from variable and increment for iny ;proper display, and put in blank byte before sty VRAM_Buffer1+3 ;null terminator NullJoypad: lda #$00 ;clear joypad bits for player 1 sta SavedJoypad1Bits RunDemo: jsr GameCoreRoutine ;run game engine lda <GameEngineSubroutine ;check to see if we're running lose life routine cmp #$06 bne ExitMenu ;if not, do not do all the resetting below ResetTitle: lda #$00 ;reset game modes, disable sta OperMode ;sprite 0 check and disable sta OperMode_Task ;screen output sta Sprite0HitDetectFlag inc DisableScreenFlag rts ChkContinue: ldy DemoTimer ;if timer for demo has expired, reset modes beq ResetTitle asl a ;check to see if A button was also pushed bcc StartWorld1 ;if not, don't load continue function's world number lda ContinueWorld ;load previously saved world number for secret jsr GoContinue ;continue function when pressing A + start StartWorld1: jsr LoadAreaPointer inc Hidden1UpFlag ;set 1-up box flag for both players inc OffScr_Hidden1UpFlag inc FetchNewGameTimerFlag ;set fetch new game timer flag inc OperMode ;set next game mode lda WorldSelectEnableFlag ;if world select flag is on, then primary sta PrimaryHardMode ;hard mode must be on as well lda #$00 sta OperMode_Task ;set game mode here, and clear demo timer sta DemoTimer ldx #$17 lda #$00 InitScores: sta ScoreAndCoinDisplay,x ;clear player scores and coin displays dex bpl InitScores ExitMenu: rts GoContinue: sta WorldNumber ;start both players at the first area sta OffScr_WorldNumber ;of the previously saved world number ldx #$00 ;note that on power-up using this function stx AreaNumber ;will make no difference stx OffScr_AreaNumber rts ;------------------------------------------------------------------------------------- MushroomIconData: .db $07, $22, $49, $83, $ce, $24, $24, $00 DrawMushroomIcon: ldy #$07 ;read eight bytes to be read by transfer routine IconDataRead: lda MushroomIconData,y ;note that the default position is set for a sta VRAM_Buffer1-1,y ;1-player game dey bpl IconDataRead lda NumberOfPlayers ;check number of players beq ExitIcon ;if set to 1-player game, we're done lda #$24 ;otherwise, load blank tile in 1-player position sta VRAM_Buffer1+3 lda #$ce ;then load shroom icon tile in 2-player position sta VRAM_Buffer1+5 ExitIcon: rts ;------------------------------------------------------------------------------------- DemoActionData: .db $01, $80, $02, $81, $41, $80, $01 .db $42, $c2, $02, $80, $41, $c1, $41, $c1 .db $01, $c1, $01, $02, $80, $00 DemoTimingData: .db $9b, $10, $18, $05, $2c, $20, $24 .db $15, $5a, $10, $20, $28, $30, $20, $10 .db $80, $20, $30, $30, $01, $ff, $00 DemoEngine: ldx DemoAction ;load current demo action lda DemoActionTimer ;load current action timer bne DoAction ;if timer still counting down, skip inx inc DemoAction ;if expired, increment action, X, and sec ;set carry by default for demo over lda DemoTimingData-1,x ;get next timer sta DemoActionTimer ;store as current timer beq DemoOver ;if timer already at zero, skip DoAction: lda DemoActionData-1,x ;get and perform action (current or next) sta SavedJoypad1Bits dec DemoActionTimer ;decrement action timer clc ;clear carry if demo still going DemoOver: rts ;------------------------------------------------------------------------------------- VictoryMode: jsr VictoryModeSubroutines ;run victory mode subroutines lda OperMode_Task ;get current task of victory mode beq AutoPlayer ;if on bridge collapse, skip enemy processing ldx #$00 stx <ObjectOffset ;otherwise reset enemy object offset jsr EnemiesAndLoopsCore ;and run enemy code AutoPlayer: jsr RelativePlayerPosition ;get player's relative coordinates jmp PlayerGfxHandler ;draw the player, then leave VictoryModeSubroutines: lda OperMode_Task jsr JumpEngine .dw BridgeCollapse .dw SetupVictoryMode .dw PlayerVictoryWalk .dw PrintVictoryMessages .dw PlayerEndWorld ;------------------------------------------------------------------------------------- SetupVictoryMode: ldx ScreenRight_PageLoc ;get page location of right side of screen inx ;increment to next page stx <DestinationPageLoc ;store here lda #EndOfCastleMusic sta <EventMusicQueue ;play win castle music jmp IncModeTask_B ;jump to set next major task in victory mode ;------------------------------------------------------------------------------------- PlayerVictoryWalk: ldy #$00 ;set value here to not walk player by default sty <VictoryWalkControl lda <Player_PageLoc ;get player's page location cmp <DestinationPageLoc ;compare with destination page location bne PerformWalk ;if page locations don't match, branch lda <Player_X_Position ;otherwise get player's horizontal position cmp #$60 ;compare with preset horizontal position bcs DontWalk ;if still on other page, branch ahead PerformWalk: inc <VictoryWalkControl ;otherwise increment value and Y iny ;note Y will be used to walk the player DontWalk: tya ;put contents of Y in A and jsr AutoControlPlayer ;use A to move player to the right or not lda ScreenLeft_PageLoc ;check page location of left side of screen cmp <DestinationPageLoc ;against set value here beq ExitVWalk ;branch if equal to change modes if necessary lda ScrollFractional clc ;do fixed point math on fractional part of scroll adc #$80 sta ScrollFractional ;save fractional movement amount lda #$01 ;set 1 pixel per frame adc #$00 ;add carry from previous addition tay ;use as scroll amount jsr ScrollScreen ;do sub to scroll the screen jsr UpdScrollVar ;do another sub to update screen and scroll variables inc <VictoryWalkControl ;increment value to stay in this routine ExitVWalk: lda <VictoryWalkControl ;load value set here beq IncModeTask_A ;if zero, branch to change modes rts ;otherwise leave ;------------------------------------------------------------------------------------- PrintVictoryMessages: lda SecondaryMsgCounter ;load secondary message counter bne IncMsgCounter ;if set, branch to increment message counters lda PrimaryMsgCounter ;otherwise load primary message counter beq ThankPlayer ;if set to zero, branch to print first message cmp #$09 ;if at 9 or above, branch elsewhere (this comparison bcs IncMsgCounter ;is residual code, counter never reaches 9) ldy WorldNumber ;check world number cpy #World8 bne MRetainerMsg ;if not at world 8, skip to next part cmp #$03 ;check primary message counter again bcc IncMsgCounter ;if not at 3 yet (world 8 only), branch to increment sbc #$01 ;otherwise subtract one jmp ThankPlayer ;and skip to next part MRetainerMsg: cmp #$02 ;check primary message counter bcc IncMsgCounter ;if not at 2 yet (world 1-7 only), branch ThankPlayer: tay ;put primary message counter into Y bne SecondPartMsg ;if counter nonzero, skip this part, do not print first message lda CurrentPlayer ;otherwise get player currently on the screen beq EvalForMusic ;if mario, branch iny ;otherwise increment Y once for luigi and bne EvalForMusic ;do an unconditional branch to the same place SecondPartMsg: iny ;increment Y to do world 8's message lda WorldNumber cmp #World8 ;check world number beq EvalForMusic ;if at world 8, branch to next part dey ;otherwise decrement Y for world 1-7's message cpy #$04 ;if counter at 4 (world 1-7 only) bcs SetEndTimer ;branch to set victory end timer cpy #$03 ;if counter at 3 (world 1-7 only) bcs IncMsgCounter ;branch to keep counting EvalForMusic: cpy #$03 ;if counter not yet at 3 (world 8 only), branch bne PrintMsg ;to print message only (note world 1-7 will only lda #VictoryMusic ;reach this code if counter = 0, and will always branch) sta <EventMusicQueue ;otherwise load victory music first (world 8 only) PrintMsg: tya ;put primary message counter in A clc ;add $0c or 12 to counter thus giving an appropriate value, adc #$0c ;($0c-$0d = first), ($0e = world 1-7's), ($0f-$12 = world 8's) sta VRAM_Buffer_AddrCtrl ;write message counter to vram address controller IncMsgCounter: lda SecondaryMsgCounter clc adc #$04 ;add four to secondary message counter sta SecondaryMsgCounter lda PrimaryMsgCounter adc #$00 ;add carry to primary message counter sta PrimaryMsgCounter cmp #$07 ;check primary counter one more time SetEndTimer: bcc ExitMsgs ;if not reached value yet, branch to leave lda #$06 sta WorldEndTimer ;otherwise set world end timer IncModeTask_A: inc OperMode_Task ;move onto next task in mode ExitMsgs: rts ;leave ;------------------------------------------------------------------------------------- PlayerEndWorld: lda WorldEndTimer ;check to see if world end timer expired bne EndExitOne ;branch to leave if not ldy WorldNumber ;check world number cpy #World8 ;if on world 8, player is done with game, bcs EndChkBButton ;thus branch to read controller lda #$00 sta AreaNumber ;otherwise initialize area number used as offset sta LevelNumber ;and level number control to start at area 1 sta OperMode_Task ;initialize secondary mode of operation inc WorldNumber ;increment world number to move onto the next world jsr LoadAreaPointer ;get area address offset for the next area inc FetchNewGameTimerFlag ;set flag to load game timer from header lda #GameModeValue sta OperMode ;set mode of operation to game mode EndExitOne: rts ;and leave EndChkBButton: lda SavedJoypad1Bits ora SavedJoypad2Bits ;check to see if B button was pressed on and #B_Button ;either controller beq EndExitTwo ;branch to leave if not lda #$01 ;otherwise set world selection flag sta WorldSelectEnableFlag lda #$ff ;remove onscreen player's lives sta NumberofLives jsr TerminateGame ;do sub to continue other player or end game EndExitTwo: rts ;leave ;------------------------------------------------------------------------------------- ;data is used as tiles for numbers ;that appear when you defeat enemies FloateyNumTileData: .db $ff, $ff ;dummy .db $f6, $fb ; "100" .db $f7, $fb ; "200" .db $f8, $fb ; "400" .db $f9, $fb ; "500" .db $fa, $fb ; "800" .db $f6, $50 ; "1000" .db $f7, $50 ; "2000" .db $f8, $50 ; "4000" .db $f9, $50 ; "5000" .db $fa, $50 ; "8000" .db $fd, $fe ; "1-UP" ;high nybble is digit number, low nybble is number to ;add to the digit of the player's score ScoreUpdateData: .db $ff ;dummy .db $41, $42, $44, $45, $48 .db $31, $32, $34, $35, $38, $00 ;;;;;;;;;;;;;;;;;;;;;;$84C3 FloateyNumbersRoutine: lda FloateyNum_Control,x ;load control for floatey number beq EndExitOne ;if zero, branch to leave cmp #$0b ;if less than $0b, branch bcc ChkNumTimer lda #$0b ;otherwise set to $0b, thus keeping sta FloateyNum_Control,x ;it in range ChkNumTimer: tay ;use as Y lda FloateyNum_Timer,x ;check value here bne DecNumTimer ;if nonzero, branch ahead sta FloateyNum_Control,x ;initialize floatey number control and leave rts DecNumTimer: dec FloateyNum_Timer,x ;decrement value here cmp #$2b ;if not reached a certain point, branch bne ChkTallEnemy cpy #$0b ;check offset for $0b bne LoadNumTiles ;branch ahead if not found inc NumberofLives ;give player one extra life (1-up) lda #Sfx_ExtraLife sta <Square2SoundQueue ;and play the 1-up sound LoadNumTiles: lda ScoreUpdateData,y ;load point value here lsr a ;move high nybble to low lsr a lsr a lsr a tax ;use as X offset, essentially the digit lda ScoreUpdateData,y ;load again and this time and #%00001111 ;mask out the high nybble sta DigitModifier,x ;store as amount to add to the digit jsr AddToScore ;update the score accordingly ChkTallEnemy: ldy Enemy_SprDataOffset,x ;get OAM data offset for enemy object lda <Enemy_ID,x ;get enemy object identifier cmp #Spiny beq FloateyPart ;branch if spiny cmp #PiranhaPlant beq FloateyPart ;branch if piranha plant cmp #HammerBro beq GetAltOffset ;branch elsewhere if hammer bro cmp #GreyCheepCheep beq FloateyPart ;branch if cheep-cheep of either color cmp #RedCheepCheep beq FloateyPart cmp #TallEnemy bcs GetAltOffset ;branch elsewhere if enemy object => $09 lda <Enemy_State,x cmp #$02 ;if enemy state defeated or otherwise bcs FloateyPart ;$02 or greater, branch beyond this part GetAltOffset: ldx SprDataOffset_Ctrl ;load some kind of control bit ldy Alt_SprDataOffset,x ;get alternate OAM data offset ldx <ObjectOffset ;get enemy object offset again FloateyPart: lda FloateyNum_Y_Pos,x ;get vertical coordinate for cmp #$18 ;floatey number, if coordinate in the bcc SetupNumSpr ;status bar, branch sbc #$01 sta FloateyNum_Y_Pos,x ;otherwise subtract one and store as new SetupNumSpr: lda FloateyNum_Y_Pos,x ;get vertical coordinate sbc #$08 ;subtract eight and dump into the jsr DumpTwoSpr ;left and right sprite's Y coordinates lda FloateyNum_X_Pos,x ;get horizontal coordinate sta Sprite_X_Position,y ;store into X coordinate of left sprite clc adc #$08 ;add eight pixels and store into X sta Sprite_X_Position+4,y ;coordinate of right sprite lda #$02 sta Sprite_Attributes,y ;set palette control in attribute bytes sta Sprite_Attributes+4,y ;of left and right sprites lda FloateyNum_Control,x asl a ;multiply our floatey number control by 2 tax ;and use as offset for look-up table lda FloateyNumTileData,x sta Sprite_Tilenumber,y ;display first half of number of points lda FloateyNumTileData+1,x sta Sprite_Tilenumber+4,y ;display the second half ldx <ObjectOffset ;get enemy object offset and leave rts ;------------------------------------------------------------------------------------- ScreenRoutines: lda ScreenRoutineTask ;run one of the following subroutines jsr JumpEngine .dw InitScreen .dw SetupIntermediate .dw WriteTopStatusLine .dw WriteBottomStatusLine .dw DisplayTimeUp .dw ResetSpritesAndScreenTimer .dw DisplayIntermediate .dw ResetSpritesAndScreenTimer .dw AreaParserTaskControl .dw GetAreaPalette .dw GetBackgroundColor .dw GetAlternatePalette1 .dw DrawTitleScreen .dw ClearBuffersDrawIcon .dw WriteTopScore ;------------------------------------------------------------------------------------- InitScreen: jsr MoveAllSpritesOffscreen ;initialize all sprites including sprite #0 jsr InitializeNameTables ;and erase both name and attribute tables lda OperMode beq NextSubtask ;if mode still 0, do not load ldx #$03 ;into buffer pointer jmp SetVRAMAddr_A ;------------------------------------------------------------------------------------- SetupIntermediate: lda BackgroundColorCtrl ;save current background color control pha ;and player status to stack lda PlayerStatus pha lda #$00 ;set background color to black sta PlayerStatus ;and player status to not fiery lda #$02 ;this is the ONLY time background color control sta BackgroundColorCtrl ;is set to less than 4 jsr GetPlayerColors pla ;we only execute this routine for sta PlayerStatus ;the intermediate lives display pla ;and once we're done, we return bg sta BackgroundColorCtrl ;color ctrl and player status from stack jmp IncSubtask ;then move onto the next task ;------------------------------------------------------------------------------------- AreaPalette: .db $01, $02, $03, $04 GetAreaPalette: ldy AreaType ;select appropriate palette to load ldx AreaPalette,y ;based on area type SetVRAMAddr_A: stx VRAM_Buffer_AddrCtrl ;store offset into buffer control NextSubtask: jmp IncSubtask ;move onto next task ;------------------------------------------------------------------------------------- ;$00 - used as temp counter in GetPlayerColors BGColorCtrl_Addr: .db $00, $09, $0a, $04 BackgroundColors: .db $22, $22, $0f, $0f ;used by area type if bg color ctrl not set .db $0f, $22, $0f, $0f ;used by background color control if set PlayerColors: .db $22, $16, $27, $18 ;mario's colors .db $22, $30, $27, $19 ;luigi's colors .db $22, $37, $27, $16 ;fiery (used by both) GetBackgroundColor: ldy BackgroundColorCtrl ;check background color control beq NoBGColor ;if not set, increment task and fetch palette lda BGColorCtrl_Addr-4,y ;put appropriate palette into vram sta VRAM_Buffer_AddrCtrl ;note that if set to 5-7, $0301 will not be read NoBGColor: inc ScreenRoutineTask ;increment to next subtask and plod on through GetPlayerColors: ldx VRAM_Buffer1_Offset ;get current buffer offset ldy #$00 lda CurrentPlayer ;check which player is on the screen beq ChkFiery ldy #$04 ;load offset for luigi ChkFiery: lda PlayerStatus ;check player status cmp #$02 bne StartClrGet ;if fiery, load alternate offset for fiery player ldy #$08 StartClrGet: lda #$03 ;do four colors sta <$00 ClrGetLoop: lda PlayerColors,y ;fetch player colors and store them sta VRAM_Buffer1+3,x ;in the buffer iny inx dec <$00 bpl ClrGetLoop ldx VRAM_Buffer1_Offset ;load original offset from before ldy BackgroundColorCtrl ;if this value is four or greater, it will be set bne SetBGColor ;therefore use it as offset to background color ldy AreaType ;otherwise use area type bits from area offset as offset SetBGColor: lda BackgroundColors,y ;to background color instead sta VRAM_Buffer1+3,x lda #$3f ;set for sprite palette address sta VRAM_Buffer1,x ;save to buffer lda #$10 sta VRAM_Buffer1+1,x lda #$04 ;write length byte to buffer sta VRAM_Buffer1+2,x lda #$00 ;now the null terminator sta VRAM_Buffer1+7,x txa ;move the buffer pointer ahead 7 bytes clc ;in case we want to write anything else later adc #$07 SetVRAMOffset: sta VRAM_Buffer1_Offset ;store as new vram buffer offset rts ;------------------------------------------------------------------------------------- GetAlternatePalette1: lda AreaStyle ;check for mushroom level style cmp #$01 bne NoAltPal lda #$0b ;if found, load appropriate palette SetVRAMAddr_B: sta VRAM_Buffer_AddrCtrl NoAltPal: jmp IncSubtask ;now onto the next task ;------------------------------------------------------------------------------------- WriteTopStatusLine: lda #$00 ;select main status bar jsr WriteGameText ;output it jmp IncSubtask ;onto the next task ;------------------------------------------------------------------------------------- WriteBottomStatusLine: jsr GetSBNybbles ;write player's score and coin tally to screen ldx VRAM_Buffer1_Offset lda #$20 ;write address for world-area number on screen sta VRAM_Buffer1,x lda #$73 sta VRAM_Buffer1+1,x lda #$03 ;write length for it sta VRAM_Buffer1+2,x ldy WorldNumber ;first the world number iny tya sta VRAM_Buffer1+3,x lda #$28 ;next the dash sta VRAM_Buffer1+4,x ldy LevelNumber ;next the level number iny ;increment for proper number display tya sta VRAM_Buffer1+5,x lda #$00 ;put null terminator on sta VRAM_Buffer1+6,x txa ;move the buffer offset up by 6 bytes clc adc #$06 sta VRAM_Buffer1_Offset jmp IncSubtask ;------------------------------------------------------------------------------------- DisplayTimeUp: lda GameTimerExpiredFlag ;if game timer not expired, increment task beq NoTimeUp ;control 2 tasks forward, otherwise, stay here lda #$00 sta GameTimerExpiredFlag ;reset timer expiration flag lda #$02 ;output time-up screen to buffer jmp OutputInter NoTimeUp: inc ScreenRoutineTask ;increment control task 2 tasks forward jmp IncSubtask ;------------------------------------------------------------------------------------- DisplayIntermediate: lda OperMode ;check primary mode of operation beq NoInter ;if in title screen mode, skip this cmp #GameOverModeValue ;are we in game over mode? beq GameOverInter ;if so, proceed to display game over screen lda AltEntranceControl ;otherwise check for mode of alternate entry bne NoInter ;and branch if found ldy AreaType ;check if we are on castle level cpy #$03 ;and if so, branch (possibly residual) beq PlayerInter lda DisableIntermediate ;if this flag is set, skip intermediate lives display bne NoInter ;and jump to specific task, otherwise PlayerInter: jsr DrawPlayer_Intermediate ;put player in appropriate place for lda #$01 ;lives display, then output lives display to buffer OutputInter: jsr WriteGameText jsr ResetScreenTimer lda #$00 sta DisableScreenFlag ;reenable screen output rts GameOverInter: lda #$12 ;set screen timer sta ScreenTimer lda #$03 ;output game over screen to buffer jsr WriteGameText jmp IncModeTask_B NoInter: lda #$08 ;set for specific task and leave sta ScreenRoutineTask rts ;------------------------------------------------------------------------------------- AreaParserTaskControl: inc DisableScreenFlag ;turn off screen TaskLoop: jsr AreaParserTaskHandler ;render column set of current area lda AreaParserTaskNum ;check number of tasks bne TaskLoop ;if tasks still not all done, do another one dec ColumnSets ;do we need to render more column sets? bpl OutputCol inc ScreenRoutineTask ;if not, move on to the next task OutputCol: lda #$06 ;set vram buffer to output rendered column set sta VRAM_Buffer_AddrCtrl ;on next NMI rts ;------------------------------------------------------------------------------------- ;$00 - vram buffer address table low ;$01 - vram buffer address table high DrawTitleScreen: lda OperMode ;are we in title screen mode? bne IncModeTask_B ;if not, exit lda #HIGH(TitleScreenDataOffset) ;load address $1ec0 into ;;$1e sta PPU_ADDRESS ;the vram address register lda #LOW(TitleScreenDataOffset) ;;$c0 sta PPU_ADDRESS lda #$03 ;put address $0300 into sta <$01 ;the indirect at $00 ldy #$00 sty <$00 ;;check cpu dumps for $0300 lda PPU_DATA ;do one garbage read OutputTScr: lda PPU_DATA ;get title screen from chr-rom sta [$00],y ;store 256 bytes into buffer ;;91 00 STA ($00),Y = 300 @ 300 = 00 iny bne ChkHiByte ;if not past 256 bytes, do not increment inc <$01 ;otherwise increment high byte of indirect ChkHiByte: lda <$01 ;check high byte? cmp #$04 ;at $0400? bne OutputTScr ;if not, loop back and do another cpy #$3a ;check if offset points past end of data bcc OutputTScr ;if not, loop back and do another lda #$05 ;set buffer transfer control to $0300, jmp SetVRAMAddr_B ;increment task and exit ;------------------------------------------------------------------------------------- ClearBuffersDrawIcon: lda OperMode ;check game mode bne IncModeTask_B ;if not title screen mode, leave ldx #$00 ;otherwise, clear buffer space TScrClear: sta VRAM_Buffer1-1,x STA VRAM_Buffer1+255,x ; STA VRAM_Buffer1-1+$100,x dex bne TScrClear jsr DrawMushroomIcon ;draw player select icon IncSubtask: inc ScreenRoutineTask ;move onto next task rts ;------------------------------------------------------------------------------------- WriteTopScore: lda #$fa ;run display routine to display top score on title jsr UpdateNumber IncModeTask_B: inc OperMode_Task ;move onto next mode rts ;------------------------------------------------------------------------------------- GameText: TopStatusBarLine: .db $20, $43, $05 .db $16, $0a, $1b, $12, $18 ; "MARIO" .db $20, $52, $0b, $20, $18, $1b, $15, $0d ; "WORLD TIME" .db $24, $24, $1d, $12, $16, $0e .db $20, $68, $05, $00, $24, $24, $2e, $29 ; score trailing digit and coin display .db $23, $c0, $7f, $aa ; attribute table data, clears name table 0 to palette 2 .db $23, $c2, $01, $ea ; attribute table data, used for coin icon in status bar .db $ff ; end of data block WorldLivesDisplay: .db $21, $cd, $07, $24, $24 ; cross with spaces used on .db $29, $24, $24, $24, $24 ; lives display .db $21, $4b, $09, $20, $18 ; "WORLD - " used on lives display .db $1b, $15, $0d, $24, $24, $28, $24 .db $22, $0c, $47, $24 ; possibly used to clear time up .db $23, $dc, $01, $ba ; attribute table data for crown if more than 9 lives .db $ff TwoPlayerTimeUp: .db $21, $cd, $05, $16, $0a, $1b, $12, $18 ; "MARIO" OnePlayerTimeUp: .db $22, $0c, $07, $1d, $12, $16, $0e, $24, $1e, $19 ; "TIME UP" .db $ff TwoPlayerGameOver: .db $21, $cd, $05, $16, $0a, $1b, $12, $18 ; "MARIO" OnePlayerGameOver: .db $22, $0b, $09, $10, $0a, $16, $0e, $24 ; "GAME OVER" .db $18, $1f, $0e, $1b .db $ff WarpZoneWelcome: .db $25, $84, $15, $20, $0e, $15, $0c, $18, $16 ; "WELCOME TO WARP ZONE!" .db $0e, $24, $1d, $18, $24, $20, $0a, $1b, $19 .db $24, $23, $18, $17, $0e, $2b .db $26, $25, $01, $24 ; placeholder for left pipe .db $26, $2d, $01, $24 ; placeholder for middle pipe .db $26, $35, $01, $24 ; placeholder for right pipe .db $27, $d9, $46, $aa ; attribute data .db $27, $e1, $45, $aa .db $ff LuigiName: .db $15, $1e, $12, $10, $12 ; "LUIGI", no address or length WarpZoneNumbers: .db $04, $03, $02, $00 ; warp zone numbers, note spaces on middle .db $24, $05, $24, $00 ; zone, partly responsible for .db $08, $07, $06, $00 ; the minus world GameTextOffsets: .db $00,$00 .db $27,$27 .db $46,$4E .db $59,$61 .db $6E,$6E ; .db TopStatusBarLine-GameText, TopStatusBarLine-GameText ; .db WorldLivesDisplay-GameText, WorldLivesDisplay-GameText ; .db TwoPlayerTimeUp-GameText, OnePlayerTimeUp-GameText ; .db TwoPlayerGameOver-GameText, OnePlayerGameOver-GameText ; .db WarpZoneWelcome-GameText, WarpZoneWelcome-GameText WriteGameText: pha ;save text number to stack asl a tay ;multiply by 2 and use as offset cpy #$04 ;if set to do top status bar or world/lives display, bcc LdGameText ;branch to use current offset as-is cpy #$08 ;if set to do time-up or game over, bcc Chk2Players ;branch to check players ldy #$08 ;otherwise warp zone, therefore set offset Chk2Players: lda NumberOfPlayers ;check for number of players bne LdGameText ;if there are two, use current offset to also print name iny ;otherwise increment offset by one to not print name LdGameText: ldx GameTextOffsets,y ;get offset to message we want to print ldy #$00 GameTextLoop: lda GameText,x ;load message data cmp #$ff ;check for terminator beq EndGameText ;branch to end text if found sta VRAM_Buffer1,y ;otherwise write data to buffer inx ;and increment increment iny bne GameTextLoop ;do this for 256 bytes if no terminator found EndGameText: lda #$00 ;put null terminator at end sta VRAM_Buffer1,y pla ;pull original text number from stack tax cmp #$04 ;are we printing warp zone? bcs PrintWarpZoneNumbers dex ;are we printing the world/lives display? bne CheckPlayerName ;if not, branch to check player's name lda NumberofLives ;otherwise, check number of lives clc ;and increment by one for display adc #$01 cmp #10 ;more than 9 lives? bcc PutLives sbc #10 ;if so, subtract 10 and put a crown tile ldy #$9f ;next to the difference...strange things happen if sty VRAM_Buffer1+7 ;the number of lives exceeds 19 PutLives: sta VRAM_Buffer1+8 ldy WorldNumber ;write world and level numbers (incremented for display) iny ;to the buffer in the spaces surrounding the dash sty VRAM_Buffer1+19 ldy LevelNumber iny sty VRAM_Buffer1+21 ;we're done here rts CheckPlayerName: lda NumberOfPlayers ;check number of players beq ExitChkName ;if only 1 player, leave lda CurrentPlayer ;load current player dex ;check to see if current message number is for time up bne ChkLuigi ldy OperMode ;check for game over mode cpy #GameOverModeValue beq ChkLuigi eor #%00000001 ;if not, must be time up, invert d0 to do other player ChkLuigi: lsr a bcc ExitChkName ;if mario is current player, do not change the name ldy #$04 NameLoop: lda LuigiName,y ;otherwise, replace "MARIO" with "LUIGI" sta VRAM_Buffer1+3,y dey bpl NameLoop ;do this until each letter is replaced ExitChkName: rts PrintWarpZoneNumbers: sbc #$04 ;subtract 4 and then shift to the left asl a ;twice to get proper warp zone number asl a ;offset tax ldy #$00 WarpNumLoop: lda WarpZoneNumbers,x ;print warp zone numbers into the sta VRAM_Buffer1+27,y ;placeholders from earlier inx iny ;put a number in every fourth space iny iny iny cpy #$0c bcc WarpNumLoop lda #$2c ;load new buffer pointer at end of message jmp SetVRAMOffset ;------------------------------------------------------------------------------------- ResetSpritesAndScreenTimer: lda ScreenTimer ;check if screen timer has expired bne NoReset ;if not, branch to leave jsr MoveAllSpritesOffscreen ;otherwise reset sprites now ResetScreenTimer: lda #$07 ;reset timer again sta ScreenTimer inc ScreenRoutineTask ;move onto next task NoReset: rts ;------------------------------------------------------------------------------------- ;$00 - temp vram buffer offset ;$01 - temp metatile buffer offset ;$02 - temp metatile graphics table offset ;$03 - used to store attribute bits ;$04 - used to determine attribute table row ;$05 - used to determine attribute table column ;$06 - metatile graphics table address low ;$07 - metatile graphics table address high RenderAreaGraphics: lda CurrentColumnPos ;store LSB of where we're at and #$01 sta <$05 ldy VRAM_Buffer2_Offset ;store vram buffer offset sty <$00 lda CurrentNTAddr_Low ;get current name table address we're supposed to render sta VRAM_Buffer2+1,y lda CurrentNTAddr_High sta VRAM_Buffer2,y lda #$9a ;store length byte of 26 here with d7 set sta VRAM_Buffer2+2,y ;to increment by 32 (in columns) lda #$00 ;init attribute row sta <$04 tax DrawMTLoop: stx <$01 ;store init value of 0 or incremented offset for buffer lda MetatileBuffer,x ;get first metatile number, and mask out all but 2 MSB and #%11000000 sta <$03 ;store attribute table bits here asl a ;note that metatile format is: rol a ;%xx000000 - attribute table bits, rol a ;%00xxxxxx - metatile number tay ;rotate bits to d1-d0 and use as offset here lda MetatileGraphics_Low,y ;get address to graphics table from here sta <$06 lda MetatileGraphics_High,y sta <$07 lda MetatileBuffer,x ;get metatile number again asl a ;multiply by 4 and use as tile offset asl a sta <$02 lda AreaParserTaskNum ;get current task number for level processing and and #%00000001 ;mask out all but LSB, then invert LSB, multiply by 2 eor #%00000001 ;to get the correct column position in the metatile, asl a ;then add to the tile offset so we can draw either side adc <$02 ;of the metatiles tay ldx <$00 ;use vram buffer offset from before as X lda [$06],y sta VRAM_Buffer2+3,x ;get first tile number (top left or top right) and store iny lda [$06],y ;now get the second (bottom left or bottom right) and store sta VRAM_Buffer2+4,x ldy <$04 ;get current attribute row lda <$05 ;get LSB of current column where we're at, and bne RightCheck ;branch if set (clear = left attrib, set = right) lda <$01 ;get current row we're rendering lsr a ;branch if LSB set (clear = top left, set = bottom left) bcs LLeft UpperLeft: rol <$03 ;rotate attribute bits 3 to the left rol <$03 ;thus in d1-d0, for upper left square rol <$03 jmp SetAttrib RightCheck: lda <$01 ;get LSB of current row we're rendering lsr a ;branch if set (clear = top right, set = bottom right) bcs NextMTRow lsr <$03 ;shift attribute bits 4 to the right lsr <$03 ;thus in d3-d2, for upper right square lsr <$03 lsr <$03 jmp SetAttrib LLeft: lsr <$03 ;shift attribute bits 2 to the right lsr <$03 ;thus in d5-d4 for lower left square NextMTRow: inc <$04 ;move onto next attribute row SetAttrib: lda AttributeBuffer,y ;get previously saved bits from before ora <$03 ;if any, and put new bits, if any, onto sta AttributeBuffer,y ;the old, and store inc <$00 ;increment vram buffer offset by 2 inc <$00 ldx <$01 ;get current gfx buffer row, and check for inx ;the bottom of the screen cpx #$0d bcc DrawMTLoop ;if not there yet, loop back ldy <$00 ;get current vram buffer offset, increment by 3 iny ;(for name table address and length bytes) iny iny lda #$00 sta VRAM_Buffer2,y ;put null terminator at end of data for name table sty VRAM_Buffer2_Offset ;store new buffer offset inc CurrentNTAddr_Low ;increment name table address low lda CurrentNTAddr_Low ;check current low byte and #%00011111 ;if no wraparound, just skip this part bne ExitDrawM lda #$80 ;if wraparound occurs, make sure low byte stays sta CurrentNTAddr_Low ;just under the status bar lda CurrentNTAddr_High ;and then invert d2 of the name table address high eor #%00000100 ;to move onto the next appropriate name table sta CurrentNTAddr_High ExitDrawM: jmp SetVRAMCtrl ;jump to set buffer to $0341 and leave ;------------------------------------------------------------------------------------- ;$00 - temp attribute table address high (big endian order this time!) ;$01 - temp attribute table address low RenderAttributeTables: lda CurrentNTAddr_Low ;get low byte of next name table address and #%00011111 ;to be written to, mask out all but 5 LSB, sec ;subtract four sbc #$04 and #%00011111 ;mask out bits again and store sta <$01 lda CurrentNTAddr_High ;get high byte and branch if borrow not set bcs SetATHigh eor #%00000100 ;otherwise invert d2 SetATHigh: and #%00000100 ;mask out all other bits ora #$23 ;add $2300 to the high byte and store sta <$00 lda <$01 ;get low byte - 4, divide by 4, add offset for lsr a ;attribute table and store lsr a adc #$c0 ;we should now have the appropriate block of sta <$01 ;attribute table in our temp address ldx #$00 ldy VRAM_Buffer2_Offset ;get buffer offset AttribLoop: lda <$00 sta VRAM_Buffer2,y ;store high byte of attribute table address lda <$01 clc ;get low byte, add 8 because we want to start adc #$08 ;below the status bar, and store sta VRAM_Buffer2+1,y sta <$01 ;also store in temp again lda AttributeBuffer,x ;fetch current attribute table byte and store sta VRAM_Buffer2+3,y ;in the buffer lda #$01 sta VRAM_Buffer2+2,y ;store length of 1 in buffer lsr a sta AttributeBuffer,x ;clear current byte in attribute buffer iny ;increment buffer offset by 4 bytes iny iny iny inx ;increment attribute offset and check to see cpx #$07 ;if we're at the end yet bcc AttribLoop sta VRAM_Buffer2,y ;put null terminator at the end sty VRAM_Buffer2_Offset ;store offset in case we want to do any more SetVRAMCtrl: lda #$06 sta VRAM_Buffer_AddrCtrl ;set buffer to $0341 and leave rts ;------------------------------------------------------------------------------------- ;$00 - used as temporary counter in ColorRotation ColorRotatePalette: .db $27, $27, $27, $17, $07, $17 BlankPalette: .db $3f, $0c, $04, $ff, $ff, $ff, $ff, $00 ;used based on area type Palette3Data: .db $0f, $07, $12, $0f .db $0f, $07, $17, $0f .db $0f, $07, $17, $1c .db $0f, $07, $17, $00 ColorRotation: lda <FrameCounter ;get frame counter and #$07 ;mask out all but three LSB bne ExitColorRot ;branch if not set to zero to do this every eighth frame ldx VRAM_Buffer1_Offset ;check vram buffer offset cpx #$31 bcs ExitColorRot ;if offset over 48 bytes, branch to leave tay ;otherwise use frame counter's 3 LSB as offset here GetBlankPal: lda BlankPalette,y ;get blank palette for palette 3 sta VRAM_Buffer1,x ;store it in the vram buffer inx ;increment offsets iny cpy #$08 bcc GetBlankPal ;do this until all bytes are copied ldx VRAM_Buffer1_Offset ;get current vram buffer offset lda #$03 sta <$00 ;set counter here lda AreaType ;get area type asl a ;multiply by 4 to get proper offset asl a tay ;save as offset here GetAreaPal: lda Palette3Data,y ;fetch palette to be written based on area type sta VRAM_Buffer1+3,x ;store it to overwrite blank palette in vram buffer iny inx dec <$00 ;decrement counter bpl GetAreaPal ;do this until the palette is all copied ldx VRAM_Buffer1_Offset ;get current vram buffer offset ldy ColorRotateOffset ;get color cycling offset lda ColorRotatePalette,y sta VRAM_Buffer1+4,x ;get and store current color in second slot of palette lda VRAM_Buffer1_Offset clc ;add seven bytes to vram buffer offset adc #$07 sta VRAM_Buffer1_Offset inc ColorRotateOffset ;increment color cycling offset lda ColorRotateOffset cmp #$06 ;check to see if it's still in range bcc ExitColorRot ;if so, branch to leave lda #$00 sta ColorRotateOffset ;otherwise, init to keep it in range ExitColorRot: rts ;leave ;------------------------------------------------------------------------------------- ;$00 - temp store for offset control bit ;$01 - temp vram buffer offset ;$02 - temp store for vertical high nybble in block buffer routine ;$03 - temp adder for high byte of name table address ;$04, $05 - name table address low/high ;$06, $07 - block buffer address low/high BlockGfxData: .db $45, $45, $47, $47 .db $47, $47, $47, $47 .db $57, $58, $59, $5a .db $24, $24, $24, $24 .db $26, $26, $26, $26 RemoveCoin_Axe: ldy #$41 ;set low byte so offset points to $0341 lda #$03 ;load offset for default blank metatile ldx AreaType ;check area type bne WriteBlankMT ;if not water type, use offset lda #$04 ;otherwise load offset for blank metatile used in water WriteBlankMT: jsr PutBlockMetatile ;do a sub to write blank metatile to vram buffer lda #$06 sta VRAM_Buffer_AddrCtrl ;set vram address controller to $0341 and leave rts ReplaceBlockMetatile: jsr WriteBlockMetatile ;write metatile to vram buffer to replace block object inc Block_ResidualCounter ;increment unused counter (residual code) dec Block_RepFlag,x ;decrement flag (residual code) rts ;leave DestroyBlockMetatile: lda #$00 ;force blank metatile if branched/jumped to this point WriteBlockMetatile: ldy #$03 ;load offset for blank metatile cmp #$00 ;check contents of A for blank metatile beq UseBOffset ;branch if found (unconditional if branched from 8a6b) ldy #$00 ;load offset for brick metatile w/ line cmp #$58 beq UseBOffset ;use offset if metatile is brick with coins (w/ line) cmp #$51 beq UseBOffset ;use offset if metatile is breakable brick w/ line iny ;increment offset for brick metatile w/o line cmp #$5d beq UseBOffset ;use offset if metatile is brick with coins (w/o line) cmp #$52 beq UseBOffset ;use offset if metatile is breakable brick w/o line iny ;if any other metatile, increment offset for empty block UseBOffset: tya ;put Y in A ldy VRAM_Buffer1_Offset ;get vram buffer offset iny ;move onto next byte jsr PutBlockMetatile ;get appropriate block data and write to vram buffer MoveVOffset: dey ;decrement vram buffer offset tya ;add 10 bytes to it clc adc #10 jmp SetVRAMOffset ;branch to store as new vram buffer offset PutBlockMetatile: stx <$00 ;store control bit from SprDataOffset_Ctrl sty <$01 ;store vram buffer offset for next byte asl a asl a ;multiply A by four and use as X tax ldy #$20 ;load high byte for name table 0 lda <$06 ;get low byte of block buffer pointer cmp #$d0 ;check to see if we're on odd-page block buffer bcc SaveHAdder ;if not, use current high byte ldy #$24 ;otherwise load high byte for name table 1 SaveHAdder: sty <$03 ;save high byte here and #$0f ;mask out high nybble of block buffer pointer asl a ;multiply by 2 to get appropriate name table low byte sta <$04 ;and then store it here lda #$00 sta <$05 ;initialize temp high byte lda <$02 ;get vertical high nybble offset used in block buffer routine clc adc #$20 ;add 32 pixels for the status bar asl a rol <$05 ;shift and rotate d7 onto d0 and d6 into carry asl a rol <$05 ;shift and rotate d6 onto d0 and d5 into carry adc <$04 ;add low byte of name table and carry to vertical high nybble sta <$04 ;and store here lda <$05 ;get whatever was in d7 and d6 of vertical high nybble adc #$00 ;add carry clc adc <$03 ;then add high byte of name table sta <$05 ;store here ldy <$01 ;get vram buffer offset to be used RemBridge: lda BlockGfxData,x ;write top left and top right sta VRAM_Buffer1+2,y ;tile numbers into first spot lda BlockGfxData+1,x sta VRAM_Buffer1+3,y lda BlockGfxData+2,x ;write bottom left and bottom sta VRAM_Buffer1+7,y ;right tiles numbers into lda BlockGfxData+3,x ;second spot sta VRAM_Buffer1+8,y lda <$04 sta VRAM_Buffer1,y ;write low byte of name table clc ;into first slot as read adc #$20 ;add 32 bytes to value sta VRAM_Buffer1+5,y ;write low byte of name table lda <$05 ;plus 32 bytes into second slot sta VRAM_Buffer1-1,y ;write high byte of name sta VRAM_Buffer1+4,y ;table address to both slots lda #$02 sta VRAM_Buffer1+1,y ;put length of 2 in sta VRAM_Buffer1+6,y ;both slots lda #$00 sta VRAM_Buffer1+9,y ;put null terminator at end ldx <$00 ;get offset control bit here rts ;and leave ;------------------------------------------------------------------------------------- ;METATILE GRAPHICS TABLE MetatileGraphics_Low: .db LOW_Palette0_MTiles, LOW_Palette1_MTiles, LOW_Palette2_MTiles, LOW_Palette3_MTiles MetatileGraphics_High: .db HIGH_Palette0_MTiles, HIGH_Palette1_MTiles, HIGH_Palette2_MTiles, HIGH_Palette3_MTiles ;NESASM VERSION ; MetatileGraphics_Low: ; .db LOW(Palette0_MTiles), LOW(Palette1_MTiles), LOW(Palette2_MTiles), LOW(Palette3_MTiles) ; MetatileGraphics_High: ; .db HIGH(Palette0_MTiles), HIGH(Palette1_MTiles), HIGH(Palette2_MTiles), HIGH(Palette3_MTiles) Palette0_MTiles: .db $24, $24, $24, $24 ;blank .db $27, $27, $27, $27 ;black metatile .db $24, $24, $24, $35 ;bush left .db $36, $25, $37, $25 ;bush middle .db $24, $38, $24, $24 ;bush right .db $24, $30, $30, $26 ;mountain left .db $26, $26, $34, $26 ;mountain left bottom/middle center .db $24, $31, $24, $32 ;mountain middle top .db $33, $26, $24, $33 ;mountain right .db $34, $26, $26, $26 ;mountain right bottom .db $26, $26, $26, $26 ;mountain middle bottom .db $24, $c0, $24, $c0 ;bridge guardrail .db $24, $7f, $7f, $24 ;chain .db $b8, $ba, $b9, $bb ;tall tree top, top half .db $b8, $bc, $b9, $bd ;short tree top .db $ba, $bc, $bb, $bd ;tall tree top, bottom half .db $60, $64, $61, $65 ;warp pipe end left, points up .db $62, $66, $63, $67 ;warp pipe end right, points up .db $60, $64, $61, $65 ;decoration pipe end left, points up .db $62, $66, $63, $67 ;decoration pipe end right, points up .db $68, $68, $69, $69 ;pipe shaft left .db $26, $26, $6a, $6a ;pipe shaft right .db $4b, $4c, $4d, $4e ;tree ledge left edge .db $4d, $4f, $4d, $4f ;tree ledge middle .db $4d, $4e, $50, $51 ;tree ledge right edge .db $6b, $70, $2c, $2d ;mushroom left edge .db $6c, $71, $6d, $72 ;mushroom middle .db $6e, $73, $6f, $74 ;mushroom right edge .db $86, $8a, $87, $8b ;sideways pipe end top .db $88, $8c, $88, $8c ;sideways pipe shaft top .db $89, $8d, $69, $69 ;sideways pipe joint top .db $8e, $91, $8f, $92 ;sideways pipe end bottom .db $26, $93, $26, $93 ;sideways pipe shaft bottom .db $90, $94, $69, $69 ;sideways pipe joint bottom .db $a4, $e9, $ea, $eb ;seaplant .db $24, $24, $24, $24 ;blank, used on bricks or blocks that are hit .db $24, $2f, $24, $3d ;flagpole ball .db $a2, $a2, $a3, $a3 ;flagpole shaft .db $24, $24, $24, $24 ;blank, used in conjunction with vines Palette1_MTiles: .db $a2, $a2, $a3, $a3 ;vertical rope .db $99, $24, $99, $24 ;horizontal rope .db $24, $a2, $3e, $3f ;left pulley .db $5b, $5c, $24, $a3 ;right pulley .db $24, $24, $24, $24 ;blank used for balance rope .db $9d, $47, $9e, $47 ;castle top .db $47, $47, $27, $27 ;castle window left .db $47, $47, $47, $47 ;castle brick wall .db $27, $27, $47, $47 ;castle window right .db $a9, $47, $aa, $47 ;castle top w/ brick .db $9b, $27, $9c, $27 ;entrance top .db $27, $27, $27, $27 ;entrance bottom .db $52, $52, $52, $52 ;green ledge stump .db $80, $a0, $81, $a1 ;fence .db $be, $be, $bf, $bf ;tree trunk .db $75, $ba, $76, $bb ;mushroom stump top .db $ba, $ba, $bb, $bb ;mushroom stump bottom .db $45, $47, $45, $47 ;breakable brick w/ line .db $47, $47, $47, $47 ;breakable brick .db $45, $47, $45, $47 ;breakable brick (not used) .db $b4, $b6, $b5, $b7 ;cracked rock terrain .db $45, $47, $45, $47 ;brick with line (power-up) .db $45, $47, $45, $47 ;brick with line (vine) .db $45, $47, $45, $47 ;brick with line (star) .db $45, $47, $45, $47 ;brick with line (coins) .db $45, $47, $45, $47 ;brick with line (1-up) .db $47, $47, $47, $47 ;brick (power-up) .db $47, $47, $47, $47 ;brick (vine) .db $47, $47, $47, $47 ;brick (star) .db $47, $47, $47, $47 ;brick (coins) .db $47, $47, $47, $47 ;brick (1-up) .db $24, $24, $24, $24 ;hidden block (1 coin) .db $24, $24, $24, $24 ;hidden block (1-up) .db $ab, $ac, $ad, $ae ;solid block (3-d block) .db $5d, $5e, $5d, $5e ;solid block (white wall) .db $c1, $24, $c1, $24 ;bridge .db $c6, $c8, $c7, $c9 ;bullet bill cannon barrel .db $ca, $cc, $cb, $cd ;bullet bill cannon top .db $2a, $2a, $40, $40 ;bullet bill cannon bottom .db $24, $24, $24, $24 ;blank used for jumpspring .db $24, $47, $24, $47 ;half brick used for jumpspring .db $82, $83, $84, $85 ;solid block (water level, green rock) .db $24, $47, $24, $47 ;half brick (???) .db $86, $8a, $87, $8b ;water pipe top .db $8e, $91, $8f, $92 ;water pipe bottom .db $24, $2f, $24, $3d ;flag ball (residual object) Palette2_MTiles: .db $24, $24, $24, $35 ;cloud left .db $36, $25, $37, $25 ;cloud middle .db $24, $38, $24, $24 ;cloud right .db $24, $24, $39, $24 ;cloud bottom left .db $3a, $24, $3b, $24 ;cloud bottom middle .db $3c, $24, $24, $24 ;cloud bottom right .db $41, $26, $41, $26 ;water/lava top .db $26, $26, $26, $26 ;water/lava .db $b0, $b1, $b2, $b3 ;cloud level terrain .db $77, $79, $77, $79 ;bowser's bridge Palette3_MTiles: .db $53, $55, $54, $56 ;question block (coin) .db $53, $55, $54, $56 ;question block (power-up) .db $a5, $a7, $a6, $a8 ;coin .db $c2, $c4, $c3, $c5 ;underwater coin .db $57, $59, $58, $5a ;empty block .db $7b, $7d, $7c, $7e ;axe ;------------------------------------------------------------------------------------- ;VRAM BUFFER DATA FOR LOCATIONS IN PRG-ROM WaterPaletteData: .db $3f, $00, $20 .db $0f, $15, $12, $25 .db $0f, $3a, $1a, $0f .db $0f, $30, $12, $0f .db $0f, $27, $12, $0f .db $22, $16, $27, $18 .db $0f, $10, $30, $27 .db $0f, $16, $30, $27 .db $0f, $0f, $30, $10 .db $00 GroundPaletteData: .db $3f, $00, $20 .db $0f, $29, $1a, $0f .db $0f, $36, $17, $0f .db $0f, $30, $21, $0f .db $0f, $27, $17, $0f .db $0f, $16, $27, $18 .db $0f, $1a, $30, $27 .db $0f, $16, $30, $27 .db $0f, $0f, $36, $17 .db $00 UndergroundPaletteData: .db $3f, $00, $20 .db $0f, $29, $1a, $09 .db $0f, $3c, $1c, $0f .db $0f, $30, $21, $1c .db $0f, $27, $17, $1c .db $0f, $16, $27, $18 .db $0f, $1c, $36, $17 .db $0f, $16, $30, $27 .db $0f, $0c, $3c, $1c .db $00 CastlePaletteData: .db $3f, $00, $20 .db $0f, $30, $10, $00 .db $0f, $30, $10, $00 .db $0f, $30, $16, $00 .db $0f, $27, $17, $00 .db $0f, $16, $27, $18 .db $0f, $1c, $36, $17 .db $0f, $16, $30, $27 .db $0f, $00, $30, $10 .db $00 DaySnowPaletteData: .db $3f, $00, $04 .db $22, $30, $00, $10 .db $00 NightSnowPaletteData: .db $3f, $00, $04 .db $0f, $30, $00, $10 .db $00 MushroomPaletteData: .db $3f, $00, $04 .db $22, $27, $16, $0f .db $00 BowserPaletteData: .db $3f, $14, $04 .db $0f, $1a, $30, $27 .db $00 MarioThanksMessage: ;"THANK YOU MARIO!" .db $25, $48, $10 .db $1d, $11, $0a, $17, $14, $24 .db $22, $18, $1e, $24 .db $16, $0a, $1b, $12, $18, $2b .db $00 LuigiThanksMessage: ;"THANK YOU LUIGI!" .db $25, $48, $10 .db $1d, $11, $0a, $17, $14, $24 .db $22, $18, $1e, $24 .db $15, $1e, $12, $10, $12, $2b .db $00 MushroomRetainerSaved: ;"BUT OUR PRINCESS IS IN" .db $25, $c5, $16 .db $0b, $1e, $1d, $24, $18, $1e, $1b, $24 .db $19, $1b, $12, $17, $0c, $0e, $1c, $1c, $24 .db $12, $1c, $24, $12, $17 ;"ANOTHER CASTLE!" .db $26, $05, $0f .db $0a, $17, $18, $1d, $11, $0e, $1b, $24 .db $0c, $0a, $1c, $1d, $15, $0e, $2b, $00 PrincessSaved1: ;"YOUR QUEST IS OVER." .db $25, $a7, $13 .db $22, $18, $1e, $1b, $24 .db $1a, $1e, $0e, $1c, $1d, $24 .db $12, $1c, $24, $18, $1f, $0e, $1b, $af .db $00 PrincessSaved2: ;"WE PRESENT YOU A NEW QUEST." .db $25, $e3, $1b .db $20, $0e, $24 .db $19, $1b, $0e, $1c, $0e, $17, $1d, $24 .db $22, $18, $1e, $24, $0a, $24, $17, $0e, $20, $24 .db $1a, $1e, $0e, $1c, $1d, $af .db $00 WorldSelectMessage1: ;"PUSH BUTTON B" .db $26, $4a, $0d .db $19, $1e, $1c, $11, $24 .db $0b, $1e, $1d, $1d, $18, $17, $24, $0b .db $00 WorldSelectMessage2: ;"TO SELECT A WORLD" .db $26, $88, $11 .db $1d, $18, $24, $1c, $0e, $15, $0e, $0c, $1d, $24 .db $0a, $24, $20, $18, $1b, $15, $0d .db $00 ;------------------------------------------------------------------------------------- ;$04 - address low to jump address ;$05 - address high to jump address ;$06 - jump address low ;$07 - jump address high JumpEngine: asl a ;shift bit from contents of A tay pla ;pull saved return address from stack sta <$04 ;save to indirect pla sta <$05 iny lda [$04],y ;load pointer from indirect sta <$06 ;note that if an RTS is performed in next routine iny ;it will return to the execution before the sub lda [$04],y ;that called this routine sta <$07 ; jmp [$06] ;jump to the address we loaded LDY #0 JMP [$06],y .db $0 ;------------------------------------------------------------------------------------- InitializeNameTables: lda PPU_STATUS ;reset flip-flop lda Mirror_PPU_CTRL_REG1 ;load mirror of ppu reg $2000 ora #%00010000 ;set sprites for first 4k and background for second 4k and #%11110000 ;clear rest of lower nybble, leave higher alone jsr WritePPUReg1 lda #$24 ;set vram address to start of name table 1 jsr WriteNTAddr lda #$20 ;and then set it to name table 0 WriteNTAddr: sta PPU_ADDRESS lda #$00 sta PPU_ADDRESS ldx #$04 ;clear name table with blank tile #24 ldy #$c0 lda #$24 InitNTLoop: sta PPU_DATA ;count out exactly 768 tiles dey bne InitNTLoop dex bne InitNTLoop ldy #64 ;now to clear the attribute table (with zero this time) txa sta VRAM_Buffer1_Offset ;init vram buffer 1 offset sta VRAM_Buffer1 ;init vram buffer 1 InitATLoop: sta PPU_DATA dey bne InitATLoop sta HorizontalScroll ;reset scroll variables sta VerticalScroll jmp InitScroll ;initialize scroll registers to zero ;------------------------------------------------------------------------------------- ;$00 - temp joypad bit ReadJoypads: lda #$01 ;reset and clear strobe of joypad ports sta JOYPAD_PORT lsr a tax ;start with joypad 1's port sta JOYPAD_PORT jsr ReadPortBits inx ;increment for joypad 2's port ReadPortBits: ldy #$08 PortLoop: pha ;push previous bit onto stack lda JOYPAD_PORT,x ;read current bit on joypad port sta <$00 ;check d1 and d0 of port output lsr a ;this is necessary on the old ora <$00 ;famicom systems in japan lsr a pla ;read bits from stack rol a ;rotate bit from carry flag dey bne PortLoop ;count down bits left sta SavedJoypadBits,x ;save controller status here always pha and #%00110000 ;check for select or start and JoypadBitMask,x ;if neither saved state nor current state beq Save8Bits ;have any of these two set, branch pla and #%11001111 ;otherwise store without select sta SavedJoypadBits,x ;or start bits and leave rts Save8Bits: pla sta JoypadBitMask,x ;save with all bits in another place and leave rts ;------------------------------------------------------------------------------------- ;$00 - vram buffer address table low ;$01 - vram buffer address table high WriteBufferToScreen: sta PPU_ADDRESS ;store high byte of vram address iny lda [$00],y ;load next byte (second) sta PPU_ADDRESS ;store low byte of vram address iny lda [$00],y ;load next byte (third) asl a ;shift to left and save in stack pha lda Mirror_PPU_CTRL_REG1 ;load mirror of $2000, ora #%00000100 ;set ppu to increment by 32 by default bcs SetupWrites ;if d7 of third byte was clear, ppu will and #%11111011 ;only increment by 1 SetupWrites: jsr WritePPUReg1 ;write to register pla ;pull from stack and shift to left again asl a bcc GetLength ;if d6 of third byte was clear, do not repeat byte ora #%00000010 ;otherwise set d1 and increment Y iny GetLength: lsr a ;shift back to the right to get proper length lsr a ;note that d1 will now be in carry tax OutputToVRAM: bcs RepeatByte ;if carry set, repeat loading the same byte iny ;otherwise increment Y to load next byte RepeatByte: lda [$00],y ;load more data from buffer and write to vram sta PPU_DATA dex ;done writing? bne OutputToVRAM sec tya adc <$00 ;add end length plus one to the indirect at $00 sta <$00 ;to allow this routine to read another set of updates lda #$00 adc <$01 sta <$01 lda #$3f ;sets vram address to $3f00 sta PPU_ADDRESS lda #$00 sta PPU_ADDRESS sta PPU_ADDRESS ;then reinitializes it for some reason sta PPU_ADDRESS UpdateScreen: ldx PPU_STATUS ;reset flip-flop ldy #$00 ;load first byte from indirect as a pointer lda [$00],y bne WriteBufferToScreen ;if byte is zero we have no further updates to make here InitScroll: sta PPU_SCROLL_REG ;store contents of A into scroll registers sta PPU_SCROLL_REG ;and end whatever subroutine led us here rts ;------------------------------------------------------------------------------------- WritePPUReg1: sta PPU_CTRL_REG1 ;write contents of A to PPU register 1 sta Mirror_PPU_CTRL_REG1 ;and its mirror rts ;------------------------------------------------------------------------------------- ;$00 - used to store status bar nybbles ;$02 - used as temp vram offset ;$03 - used to store length of status bar number ;status bar name table offset and length data StatusBarData: .db $f0, $06 ; top score display on title screen .db $62, $06 ; player score .db $62, $06 .db $6d, $02 ; coin tally .db $6d, $02 .db $7a, $03 ; game timer StatusBarOffset: .db $06, $0c, $12, $18, $1e, $24 PrintStatusBarNumbers: sta <$00 ;store player-specific offset jsr OutputNumbers ;use first nybble to print the coin display lda <$00 ;move high nybble to low lsr a ;and print to score display lsr a lsr a lsr a OutputNumbers: clc ;add 1 to low nybble adc #$01 and #%00001111 ;mask out high nybble cmp #$06 bcs ExitOutputN pha ;save incremented value to stack for now and asl a ;shift to left and use as offset tay ldx VRAM_Buffer1_Offset ;get current buffer pointer lda #$20 ;put at top of screen by default cpy #$00 ;are we writing top score on title screen? bne SetupNums lda #$22 ;if so, put further down on the screen SetupNums: sta VRAM_Buffer1,x lda StatusBarData,y ;write low vram address and length of thing sta VRAM_Buffer1+1,x ;we're printing to the buffer lda StatusBarData+1,y sta VRAM_Buffer1+2,x sta <$03 ;save length byte in counter stx <$02 ;and buffer pointer elsewhere for now pla ;pull original incremented value from stack tax lda StatusBarOffset,x ;load offset to value we want to write sec sbc StatusBarData+1,y ;subtract from length byte we read before tay ;use value as offset to display digits ldx <$02 DigitPLoop: lda DisplayDigits,y ;write digits to the buffer sta VRAM_Buffer1+3,x inx iny dec <$03 ;do this until all the digits are written bne DigitPLoop lda #$00 ;put null terminator at end sta VRAM_Buffer1+3,x inx ;increment buffer pointer by 3 inx inx stx VRAM_Buffer1_Offset ;store it in case we want to use it again ExitOutputN: rts ;------------------------------------------------------------------------------------- DigitsMathRoutine: lda OperMode ;check mode of operation cmp #TitleScreenModeValue beq EraseDMods ;if in title screen mode, branch to lock score ldx #$05 AddModLoop: lda DigitModifier,x ;load digit amount to increment clc adc DisplayDigits,y ;add to current digit bmi BorrowOne ;if result is a negative number, branch to subtract cmp #10 bcs CarryOne ;if digit greater than $09, branch to add StoreNewD: sta DisplayDigits,y ;store as new score or game timer digit dey ;move onto next digits in score or game timer dex ;and digit amounts to increment bpl AddModLoop ;loop back if we're not done yet EraseDMods: lda #$00 ;store zero here ldx #$06 ;start with the last digit EraseMLoop: sta DigitModifier-1,x ;initialize the digit amounts to increment dex bpl EraseMLoop ;do this until they're all reset, then leave rts BorrowOne: dec DigitModifier-1,x ;decrement the previous digit, then put $09 in lda #$09 ;the game timer digit we're currently on to "borrow bne StoreNewD ;the one", then do an unconditional branch back CarryOne: sec ;subtract ten from our digit to make it a sbc #10 ;proper BCD number, then increment the digit inc DigitModifier-1,x ;preceding current digit to "carry the one" properly jmp StoreNewD ;go back to just after we branched here ;------------------------------------------------------------------------------------- UpdateTopScore: ldx #$05 ;start with mario's score jsr TopScoreCheck ldx #$0b ;now do luigi's score TopScoreCheck: ldy #$05 ;start with the lowest digit sec GetScoreDiff: lda PlayerScoreDisplay,x ;subtract each player digit from each high score digit sbc TopScoreDisplay,y ;from lowest to highest, if any top score digit exceeds dex ;any player digit, borrow will be set until a subsequent dey ;subtraction clears it (player digit is higher than top) bpl GetScoreDiff bcc NoTopSc ;check to see if borrow is still set, if so, no new high score inx ;increment X and Y once to the start of the score iny CopyScore: lda PlayerScoreDisplay,x ;store player's score digits into high score memory area sta TopScoreDisplay,y inx iny cpy #$06 ;do this until we have stored them all bcc CopyScore NoTopSc: rts ;------------------------------------------------------------------------------------- DefaultSprOffsets: .db $04, $30, $48, $60, $78, $90, $a8, $c0 .db $d8, $e8, $24, $f8, $fc, $28, $2c Sprite0Data: .db $18, $ff, $23, $58 ;------------------------------------------------------------------------------------- InitializeGame: ldy #$6f ;clear all memory as in initialization procedure, jsr InitializeMemory ;but this time, clear only as far as $076f ldy #$1f ClrSndLoop: sta SoundMemory,y ;clear out memory used dey ;by the sound engines bpl ClrSndLoop lda #$18 ;set demo timer sta DemoTimer jsr LoadAreaPointer InitializeArea: ldy #$4b ;clear all memory again, only as far as $074b jsr InitializeMemory ;this is only necessary if branching from ldx #$21 lda #$00 ClrTimersLoop: sta Timers,x ;clear out memory between dex ;$0780 and $07a1 bpl ClrTimersLoop lda HalfwayPage ldy AltEntranceControl ;if AltEntranceControl not set, use halfway page, if any found beq StartPage lda EntrancePage ;otherwise use saved entry page number here StartPage: sta ScreenLeft_PageLoc ;set as value here sta CurrentPageLoc ;also set as current page sta BackloadingFlag ;set flag here if halfway page or saved entry page number found jsr GetScreenPosition ;get pixel coordinates for screen borders ldy #$20 ;if on odd numbered page, use $2480 as start of rendering and #%00000001 ;otherwise use $2080, this address used later as name table beq SetInitNTHigh ;address for rendering of game area ldy #$24 SetInitNTHigh: sty CurrentNTAddr_High ;store name table address ldy #$80 sty CurrentNTAddr_Low asl a ;store LSB of page number in high nybble asl a ;of block buffer column position asl a asl a sta BlockBufferColumnPos dec AreaObjectLength ;set area object lengths for all empty dec AreaObjectLength+1 dec AreaObjectLength+2 lda #$0b ;set value for renderer to update 12 column sets sta ColumnSets ;12 column sets = 24 metatile columns = 1 1/2 screens jsr GetAreaDataAddrs ;get enemy and level addresses and load header lda PrimaryHardMode ;check to see if primary hard mode has been activated bne SetSecHard ;if so, activate the secondary no matter where we're at lda WorldNumber ;otherwise check world number cmp #World5 ;if less than 5, do not activate secondary bcc CheckHalfway bne SetSecHard ;if not equal to, then world > 5, thus activate lda LevelNumber ;otherwise, world 5, so check level number cmp #Level3 ;if 1 or 2, do not set secondary hard mode flag bcc CheckHalfway SetSecHard: inc SecondaryHardMode ;set secondary hard mode flag for areas 5-3 and beyond CheckHalfway: lda HalfwayPage beq DoneInitArea lda #$02 ;if halfway page set, overwrite start position from header sta PlayerEntranceCtrl DoneInitArea: lda #Silence ;silence music sta <AreaMusicQueue lda #$01 ;disable screen output sta DisableScreenFlag inc OperMode_Task ;increment one of the modes rts ;------------------------------------------------------------------------------------- PrimaryGameSetup: lda #$01 sta FetchNewGameTimerFlag ;set flag to load game timer from header sta PlayerSize ;set player's size to small lda #$02 sta NumberofLives ;give each player three lives sta OffScr_NumberofLives SecondaryGameSetup: lda #$00 sta DisableScreenFlag ;enable screen output tay ClearVRLoop: sta VRAM_Buffer1-1,y ;clear buffer at $0300-$03ff iny bne ClearVRLoop sta GameTimerExpiredFlag ;clear game timer exp flag sta DisableIntermediate ;clear skip lives display flag sta BackloadingFlag ;clear value here lda #$ff sta BalPlatformAlignment ;initialize balance platform assignment flag lda ScreenLeft_PageLoc ;get left side page location lsr Mirror_PPU_CTRL_REG1 ;shift LSB of ppu register #1 mirror out and #$01 ;mask out all but LSB of page location ror a ;rotate LSB of page location into carry then onto mirror rol Mirror_PPU_CTRL_REG1 ;this is to set the proper PPU name table jsr GetAreaMusic ;load proper music into queue lda #$38 ;load sprite shuffle amounts to be used later sta SprShuffleAmt+2 lda #$48 sta SprShuffleAmt+1 lda #$58 sta SprShuffleAmt ldx #$0e ;load default OAM offsets into $06e4-$06f2 ShufAmtLoop: lda DefaultSprOffsets,x sta SprDataOffset,x dex ;do this until they're all set bpl ShufAmtLoop ldy #$03 ;set up sprite #0 ISpr0Loop: lda Sprite0Data,y sta Sprite_Data,y dey bpl ISpr0Loop jsr DoNothing2 ;these jsrs doesn't do anything useful jsr DoNothing1 inc Sprite0HitDetectFlag ;set sprite #0 check flag inc OperMode_Task ;increment to next task rts ;------------------------------------------------------------------------------------- ;$06 - RAM address low ;$07 - RAM address high InitializeMemory: ldx #$07 ;set initial high byte to $0700-$07ff lda #$00 ;set initial low byte to start of page (at $00 of page) sta <$06 InitPageLoop: stx <$07 InitByteLoop: cpx #$01 ;check to see if we're on the stack ($0100-$01ff) bne InitByte ;if not, go ahead anyway cpy #$60 ;otherwise, check to see if we're at $0160-$01ff bcs SkipByte ;if so, skip write InitByte: sta [$06],y ;otherwise, initialize byte with current low byte in Y SkipByte: dey cpy #$ff ;do this until all bytes in page have been erased bne InitByteLoop dex ;go onto the next page bpl InitPageLoop ;do this until all pages of memory have been erased rts ;------------------------------------------------------------------------------------- MusicSelectData: .db WaterMusic, GroundMusic, UndergroundMusic, CastleMusic .db CloudMusic, PipeIntroMusic GetAreaMusic: lda OperMode ;if in title screen mode, leave beq ExitGetM lda AltEntranceControl ;check for specific alternate mode of entry cmp #$02 ;if found, branch without checking starting position beq ChkAreaType ;from area object data header ldy #$05 ;select music for pipe intro scene by default lda PlayerEntranceCtrl ;check value from level header for certain values cmp #$06 beq StoreMusic ;load music for pipe intro scene if header cmp #$07 ;start position either value $06 or $07 beq StoreMusic ChkAreaType: ldy AreaType ;load area type as offset for music bit lda CloudTypeOverride beq StoreMusic ;check for cloud type override ldy #$04 ;select music for cloud type level if found StoreMusic: lda MusicSelectData,y ;otherwise select appropriate music for level type sta <AreaMusicQueue ;store in queue and leave ExitGetM: rts ;------------------------------------------------------------------------------------- PlayerStarting_X_Pos: .db $28, $18 .db $38, $28 AltYPosOffset: .db $08, $00 PlayerStarting_Y_Pos: .db $00, $20, $b0, $50, $00, $00, $b0, $b0 .db $f0 PlayerBGPriorityData: .db $00, $20, $00, $00, $00, $00, $00, $00 GameTimerData: .db $20 ;dummy byte, used as part of bg priority data .db $04, $03, $02 Entrance_GameTimerSetup: lda ScreenLeft_PageLoc ;set current page for area objects sta <Player_PageLoc ;as page location for player lda #$28 ;store value here sta VerticalForceDown ;for fractional movement downwards if necessary lda #$01 ;set high byte of player position and sta <PlayerFacingDir ;set facing direction so that player faces right sta <Player_Y_HighPos lda #$00 ;set player state to on the ground by default sta <Player_State dec Player_CollisionBits ;initialize player's collision bits ldy #$00 ;initialize halfway page sty HalfwayPage lda AreaType ;check area type bne ChkStPos ;if water type, set swimming flag, otherwise do not set iny ChkStPos: sty SwimmingFlag ldx PlayerEntranceCtrl ;get starting position loaded from header ldy AltEntranceControl ;check alternate mode of entry flag for 0 or 1 beq SetStPos cpy #$01 beq SetStPos ldx AltYPosOffset-2,y ;if not 0 or 1, override $0710 with new offset in X SetStPos: lda PlayerStarting_X_Pos,y ;load appropriate horizontal position sta <Player_X_Position ;and vertical positions for the player, using lda PlayerStarting_Y_Pos,x ;AltEntranceControl as offset for horizontal and either $0710 sta <Player_Y_Position ;or value that overwrote $0710 as offset for vertical lda PlayerBGPriorityData,x sta Player_SprAttrib ;set player sprite attributes using offset in X jsr GetPlayerColors ;get appropriate player palette ldy GameTimerSetting ;get timer control value from header beq ChkOverR ;if set to zero, branch (do not use dummy byte for this) lda FetchNewGameTimerFlag ;do we need to set the game timer? if not, use beq ChkOverR ;old game timer setting lda GameTimerData,y ;if game timer is set and game timer flag is also set, sta GameTimerDisplay ;use value of game timer control for first digit of game timer lda #$01 sta GameTimerDisplay+2 ;set last digit of game timer to 1 lsr a sta GameTimerDisplay+1 ;set second digit of game timer sta FetchNewGameTimerFlag ;clear flag for game timer reset sta StarInvincibleTimer ;clear star mario timer ChkOverR: ldy JoypadOverride ;if controller bits not set, branch to skip this part beq ChkSwimE lda #$03 ;set player state to climbing sta <Player_State ldx #$00 ;set offset for first slot, for block object jsr InitBlock_XY_Pos lda #$f0 ;set vertical coordinate for block object sta <Block_Y_Position ldx #$05 ;set offset in X for last enemy object buffer slot ldy #$00 ;set offset in Y for object coordinates used earlier jsr Setup_Vine ;do a sub to grow vine ChkSwimE: ldy AreaType ;if level not water-type, bne SetPESub ;skip this subroutine jsr SetupBubble ;otherwise, execute sub to set up air bubbles SetPESub: lda #$07 ;set to run player entrance subroutine sta <GameEngineSubroutine ;on the next frame of game engine rts ;------------------------------------------------------------------------------------- ;page numbers are in order from -1 to -4 HalfwayPageNybbles: .db $56, $40 .db $65, $70 .db $66, $40 .db $66, $40 .db $66, $40 .db $66, $60 .db $65, $70 .db $00, $00 PlayerLoseLife: inc DisableScreenFlag ;disable screen and sprite 0 check lda #$00 sta Sprite0HitDetectFlag lda #Silence ;silence music sta <EventMusicQueue dec NumberofLives ;take one life from player bpl StillInGame ;if player still has lives, branch lda #$00 sta OperMode_Task ;initialize mode task, lda #GameOverModeValue ;switch to game over mode sta OperMode ;and leave rts StillInGame: lda WorldNumber ;multiply world number by 2 and use asl a ;as offset tax lda LevelNumber ;if in area -3 or -4, increment and #$02 ;offset by one byte, otherwise beq GetHalfway ;leave offset alone inx GetHalfway: ldy HalfwayPageNybbles,x ;get halfway page number with offset lda LevelNumber ;check area number's LSB lsr a tya ;if in area -2 or -4, use lower nybble bcs MaskHPNyb lsr a ;move higher nybble to lower if area lsr a ;number is -1 or -3 lsr a lsr a MaskHPNyb: and #%00001111 ;mask out all but lower nybble cmp ScreenLeft_PageLoc beq SetHalfway ;left side of screen must be at the halfway page, bcc SetHalfway ;otherwise player must start at the lda #$00 ;beginning of the level SetHalfway: sta HalfwayPage ;store as halfway page for player jsr TransposePlayers ;switch players around if 2-player game jmp ContinueGame ;continue the game ;------------------------------------------------------------------------------------- GameOverMode: lda OperMode_Task jsr JumpEngine .dw SetupGameOver .dw ScreenRoutines .dw RunGameOver ;------------------------------------------------------------------------------------- SetupGameOver: lda #$00 ;reset screen routine task control for title screen, game, sta ScreenRoutineTask ;and game over modes sta Sprite0HitDetectFlag ;disable sprite 0 check lda #GameOverMusic sta <EventMusicQueue ;put game over music in secondary queue inc DisableScreenFlag ;disable screen output inc OperMode_Task ;set secondary mode to 1 rts ;------------------------------------------------------------------------------------- RunGameOver: lda #$00 ;reenable screen sta DisableScreenFlag lda SavedJoypad1Bits ;check controller for start pressed and #Start_Button bne TerminateGame lda ScreenTimer ;if not pressed, wait for bne GameIsOn ;screen timer to expire TerminateGame: lda #Silence ;silence music sta <EventMusicQueue jsr TransposePlayers ;check if other player can keep bcc ContinueGame ;going, and do so if possible lda WorldNumber ;otherwise put world number of current sta ContinueWorld ;player into secret continue function variable lda #$00 asl a ;residual ASL instruction sta OperMode_Task ;reset all modes to title screen and sta ScreenTimer ;leave sta OperMode rts ContinueGame: jsr LoadAreaPointer ;update level pointer with lda #$01 ;actual world and area numbers, then sta PlayerSize ;reset player's size, status, and inc FetchNewGameTimerFlag ;set game timer flag to reload lda #$00 ;game timer from header sta TimerControl ;also set flag for timers to count again sta PlayerStatus sta <GameEngineSubroutine ;reset task for game core sta OperMode_Task ;set modes and leave lda #$01 ;if in game over mode, switch back to sta OperMode ;game mode, because game is still on GameIsOn: rts TransposePlayers: sec ;set carry flag by default to end game lda NumberOfPlayers ;if only a 1 player game, leave beq ExTrans lda OffScr_NumberofLives ;does offscreen player have any lives left? bmi ExTrans ;branch if not lda CurrentPlayer ;invert bit to update eor #%00000001 ;which player is on the screen sta CurrentPlayer ldx #$06 TransLoop: lda OnscreenPlayerInfo,x ;transpose the information pha ;of the onscreen player lda OffscreenPlayerInfo,x ;with that of the offscreen player sta OnscreenPlayerInfo,x pla sta OffscreenPlayerInfo,x dex bpl TransLoop clc ;clear carry flag to get game going ExTrans: rts ;------------------------------------------------------------------------------------- DoNothing1: lda #$ff ;this is residual code, this value is sta $06c9 ;not used anywhere in the program DoNothing2: rts ;------------------------------------------------------------------------------------- AreaParserTaskHandler: ldy AreaParserTaskNum ;check number of tasks here bne DoAPTasks ;if already set, go ahead ldy #$08 sty AreaParserTaskNum ;otherwise, set eight by default DoAPTasks: dey tya jsr AreaParserTasks dec AreaParserTaskNum ;if all tasks not complete do not bne SkipATRender ;render attribute table yet jsr RenderAttributeTables SkipATRender: rts AreaParserTasks: jsr JumpEngine .dw IncrementColumnPos .dw RenderAreaGraphics .dw RenderAreaGraphics .dw AreaParserCore .dw IncrementColumnPos .dw RenderAreaGraphics .dw RenderAreaGraphics .dw AreaParserCore ;------------------------------------------------------------------------------------- IncrementColumnPos: inc CurrentColumnPos ;increment column where we're at lda CurrentColumnPos and #%00001111 ;mask out higher nybble bne NoColWrap sta CurrentColumnPos ;if no bits left set, wrap back to zero (0-f) inc CurrentPageLoc ;and increment page number where we're at NoColWrap: inc BlockBufferColumnPos ;increment column offset where we're at lda BlockBufferColumnPos and #%00011111 ;mask out all but 5 LSB (0-1f) sta BlockBufferColumnPos ;and save rts ;------------------------------------------------------------------------------------- ;$00 - used as counter, store for low nybble for background, ceiling byte for terrain ;$01 - used to store floor byte for terrain ;$07 - used to store terrain metatile ;$06-$07 - used to store block buffer address BSceneDataOffsets: .db $00, $30, $60 BackSceneryData: .db $93, $00, $00, $11, $12, $12, $13, $00 ;clouds .db $00, $51, $52, $53, $00, $00, $00, $00 .db $00, $00, $01, $02, $02, $03, $00, $00 .db $00, $00, $00, $00, $91, $92, $93, $00 .db $00, $00, $00, $51, $52, $53, $41, $42 .db $43, $00, $00, $00, $00, $00, $91, $92 .db $97, $87, $88, $89, $99, $00, $00, $00 ;mountains and bushes .db $11, $12, $13, $a4, $a5, $a5, $a5, $a6 .db $97, $98, $99, $01, $02, $03, $00, $a4 .db $a5, $a6, $00, $11, $12, $12, $12, $13 .db $00, $00, $00, $00, $01, $02, $02, $03 .db $00, $a4, $a5, $a5, $a6, $00, $00, $00 .db $11, $12, $12, $13, $00, $00, $00, $00 ;trees and fences .db $00, $00, $00, $9c, $00, $8b, $aa, $aa .db $aa, $aa, $11, $12, $13, $8b, $00, $9c .db $9c, $00, $00, $01, $02, $03, $11, $12 .db $12, $13, $00, $00, $00, $00, $aa, $aa .db $9c, $aa, $00, $8b, $00, $01, $02, $03 BackSceneryMetatiles: .db $80, $83, $00 ;cloud left .db $81, $84, $00 ;cloud middle .db $82, $85, $00 ;cloud right .db $02, $00, $00 ;bush left .db $03, $00, $00 ;bush middle .db $04, $00, $00 ;bush right .db $00, $05, $06 ;mountain left .db $07, $06, $0a ;mountain middle .db $00, $08, $09 ;mountain right .db $4d, $00, $00 ;fence .db $0d, $0f, $4e ;tall tree .db $0e, $4e, $4e ;short tree FSceneDataOffsets: .db $00, $0d, $1a ForeSceneryData: .db $86, $87, $87, $87, $87, $87, $87 ;in water .db $87, $87, $87, $87, $69, $69 .db $00, $00, $00, $00, $00, $45, $47 ;wall .db $47, $47, $47, $47, $00, $00 .db $00, $00, $00, $00, $00, $00, $00 ;over water .db $00, $00, $00, $00, $86, $87 TerrainMetatiles: .db $69, $54, $52, $62 TerrainRenderBits: .db %00000000, %00000000 ;no ceiling or floor .db %00000000, %00011000 ;no ceiling, floor 2 .db %00000001, %00011000 ;ceiling 1, floor 2 .db %00000111, %00011000 ;ceiling 3, floor 2 .db %00001111, %00011000 ;ceiling 4, floor 2 .db %11111111, %00011000 ;ceiling 8, floor 2 .db %00000001, %00011111 ;ceiling 1, floor 5 .db %00000111, %00011111 ;ceiling 3, floor 5 .db %00001111, %00011111 ;ceiling 4, floor 5 .db %10000001, %00011111 ;ceiling 1, floor 6 .db %00000001, %00000000 ;ceiling 1, no floor .db %10001111, %00011111 ;ceiling 4, floor 6 .db %11110001, %00011111 ;ceiling 1, floor 9 .db %11111001, %00011000 ;ceiling 1, middle 5, floor 2 .db %11110001, %00011000 ;ceiling 1, middle 4, floor 2 .db %11111111, %00011111 ;completely solid top to bottom AreaParserCore: lda BackloadingFlag ;check to see if we are starting right of start beq RenderSceneryTerrain ;if not, go ahead and render background, foreground and terrain jsr ProcessAreaData ;otherwise skip ahead and load level data RenderSceneryTerrain: ldx #$0c lda #$00 ClrMTBuf: sta MetatileBuffer,x ;clear out metatile buffer dex bpl ClrMTBuf ldy BackgroundScenery ;do we need to render the background scenery? beq RendFore ;if not, skip to check the foreground lda CurrentPageLoc ;otherwise check for every third page ThirdP: cmp #$03 bmi RendBack ;if less than three we're there sec sbc #$03 ;if 3 or more, subtract 3 and bpl ThirdP ;do an unconditional branch RendBack: asl a ;move results to higher nybble asl a asl a asl a adc BSceneDataOffsets-1,y ;add to it offset loaded from here adc CurrentColumnPos ;add to the result our current column position tax lda BackSceneryData,x ;load data from sum of offsets beq RendFore ;if zero, no scenery for that part pha and #$0f ;save to stack and clear high nybble sec sbc #$01 ;subtract one (because low nybble is $01-$0c) sta <$00 ;save low nybble asl a ;multiply by three (shift to left and add result to old one) adc <$00 ;note that since d7 was nulled, the carry flag is always clear tax ;save as offset for background scenery metatile data pla ;get high nybble from stack, move low lsr a lsr a lsr a lsr a tay ;use as second offset (used to determine height) lda #$03 ;use previously saved memory location for counter sta <$00 SceLoop1: lda BackSceneryMetatiles,x ;load metatile data from offset of (lsb - 1) * 3 sta MetatileBuffer,y ;store into buffer from offset of (msb / 16) inx iny cpy #$0b ;if at this location, leave loop beq RendFore dec <$00 ;decrement until counter expires, barring exception bne SceLoop1 RendFore: ldx ForegroundScenery ;check for foreground data needed or not beq RendTerr ;if not, skip this part ldy FSceneDataOffsets-1,x ;load offset from location offset by header value, then ldx #$00 ;reinit X SceLoop2: lda ForeSceneryData,y ;load data until counter expires beq NoFore ;do not store if zero found sta MetatileBuffer,x NoFore: iny inx cpx #$0d ;store up to end of metatile buffer bne SceLoop2 RendTerr: ldy AreaType ;check world type for water level bne TerMTile ;if not water level, skip this part lda WorldNumber ;check world number, if not world number eight cmp #World8 ;then skip this part bne TerMTile lda #$62 ;if set as water level and world number eight, jmp StoreMT ;use castle wall metatile as terrain type TerMTile: lda TerrainMetatiles,y ;otherwise get appropriate metatile for area type ldy CloudTypeOverride ;check for cloud type override beq StoreMT ;if not set, keep value otherwise lda #$88 ;use cloud block terrain StoreMT: sta <$07 ;store value here ldx #$00 ;initialize X, use as metatile buffer offset lda TerrainControl ;use yet another value from the header asl a ;multiply by 2 and use as yet another offset tay TerrLoop: lda TerrainRenderBits,y ;get one of the terrain rendering bit data sta <$00 iny ;increment Y and use as offset next time around sty <$01 lda CloudTypeOverride ;skip if value here is zero beq NoCloud2 cpx #$00 ;otherwise, check if we're doing the ceiling byte beq NoCloud2 lda <$00 ;if not, mask out all but d3 and #%00001000 sta <$00 NoCloud2: ldy #$00 ;start at beginning of bitmasks TerrBChk: lda Bitmasks,y ;load bitmask, then perform AND on contents of first byte bit <$00 beq NextTBit ;if not set, skip this part (do not write terrain to buffer) lda <$07 sta MetatileBuffer,x ;load terrain type metatile number and store into buffer here NextTBit: inx ;continue until end of buffer cpx #$0d beq RendBBuf ;if we're at the end, break out of this loop lda AreaType ;check world type for underground area cmp #$02 bne EndUChk ;if not underground, skip this part cpx #$0b bne EndUChk ;if we're at the bottom of the screen, override lda #$54 ;old terrain type with ground level terrain type sta <$07 EndUChk: iny ;increment bitmasks offset in Y cpy #$08 bne TerrBChk ;if not all bits checked, loop back ldy <$01 bne TerrLoop ;unconditional branch, use Y to load next byte RendBBuf: jsr ProcessAreaData ;do the area data loading routine now lda BlockBufferColumnPos jsr GetBlockBufferAddr ;get block buffer address from where we're at ldx #$00 ldy #$00 ;init index regs and start at beginning of smaller buffer ChkMTLow: sty <$00 lda MetatileBuffer,x ;load stored metatile number and #%11000000 ;mask out all but 2 MSB asl a rol a ;make %xx000000 into %000000xx rol a tay ;use as offset in Y lda MetatileBuffer,x ;reload original unmasked value here cmp BlockBuffLowBounds,y ;check for certain values depending on bits set bcs StrBlock ;if equal or greater, branch lda #$00 ;if less, init value before storing StrBlock: ldy <$00 ;get offset for block buffer sta [$06],y ;store value into block buffer tya clc ;add 16 (move down one row) to offset adc #$10 tay inx ;increment column value cpx #$0d bcc ChkMTLow ;continue until we pass last row, then leave rts ;numbers lower than these with the same attribute bits ;will not be stored in the block buffer BlockBuffLowBounds: .db $10, $51, $88, $c0 ;------------------------------------------------------------------------------------- ;$00 - used to store area object identifier ;$07 - used as adder to find proper area object code ProcessAreaData: ldx #$02 ;start at the end of area object buffer ProcADLoop: stx <ObjectOffset lda #$00 ;reset flag sta BehindAreaParserFlag ldy AreaDataOffset ;get offset of area data pointer lda [AreaData],y ;get first byte of area object cmp #$fd ;if end-of-area, skip all this crap beq RdyDecode lda AreaObjectLength,x ;check area object buffer flag bpl RdyDecode ;if buffer not negative, branch, otherwise iny lda [AreaData],y ;get second byte of area object asl a ;check for page select bit (d7), branch if not set bcc Chk1Row13 lda AreaObjectPageSel ;check page select bne Chk1Row13 inc AreaObjectPageSel ;if not already set, set it now inc AreaObjectPageLoc ;and increment page location Chk1Row13: dey lda [AreaData],y ;reread first byte of level object and #$0f ;mask out high nybble cmp #$0d ;row 13? bne Chk1Row14 iny ;if so, reread second byte of level object lda [AreaData],y dey ;decrement to get ready to read first byte and #%01000000 ;check for d6 set (if not, object is page control) bne CheckRear lda AreaObjectPageSel ;if page select is set, do not reread bne CheckRear iny ;if d6 not set, reread second byte lda [AreaData],y and #%00011111 ;mask out all but 5 LSB and store in page control sta AreaObjectPageLoc inc AreaObjectPageSel ;increment page select jmp NextAObj Chk1Row14: cmp #$0e ;row 14? bne CheckRear lda BackloadingFlag ;check flag for saved page number and branch if set bne RdyDecode ;to render the object (otherwise bg might not look right) CheckRear: lda AreaObjectPageLoc ;check to see if current page of level object is cmp CurrentPageLoc ;behind current page of renderer bcc SetBehind ;if so branch RdyDecode: jsr DecodeAreaData ;do sub and do not turn on flag jmp ChkLength SetBehind: inc BehindAreaParserFlag ;turn on flag if object is behind renderer NextAObj: jsr IncAreaObjOffset ;increment buffer offset and move on ChkLength: ldx <ObjectOffset ;get buffer offset lda AreaObjectLength,x ;check object length for anything stored here bmi ProcLoopb ;if not, branch to handle loopback dec AreaObjectLength,x ;otherwise decrement length or get rid of it ProcLoopb: dex ;decrement buffer offset bpl ProcADLoop ;and loopback unless exceeded buffer lda BehindAreaParserFlag ;check for flag set if objects were behind renderer bne ProcessAreaData ;branch if true to load more level data, otherwise lda BackloadingFlag ;check for flag set if starting right of page $00 bne ProcessAreaData ;branch if true to load more level data, otherwise leave EndAParse: rts IncAreaObjOffset: inc AreaDataOffset ;increment offset of level pointer inc AreaDataOffset lda #$00 ;reset page select sta AreaObjectPageSel rts DecodeAreaData: lda AreaObjectLength,x ;check current buffer flag bmi Chk1stB ldy AreaObjOffsetBuffer,x ;if not, get offset from buffer Chk1stB: ldx #$10 ;load offset of 16 for special row 15 lda [AreaData],y ;get first byte of level object again cmp #$fd beq EndAParse ;if end of level, leave this routine and #$0f ;otherwise, mask out low nybble cmp #$0f ;row 15? beq ChkRow14 ;if so, keep the offset of 16 ldx #$08 ;otherwise load offset of 8 for special row 12 cmp #$0c ;row 12? beq ChkRow14 ;if so, keep the offset value of 8 ldx #$00 ;otherwise nullify value by default ChkRow14: stx <$07 ;store whatever value we just loaded here ldx <ObjectOffset ;get object offset again cmp #$0e ;row 14? bne ChkRow13 lda #$00 ;if so, load offset with $00 sta <$07 lda #$2e ;and load A with another value bne NormObj ;unconditional branch ChkRow13: cmp #$0d ;row 13? bne ChkSRows lda #$22 ;if so, load offset with 34 sta <$07 iny ;get next byte lda [AreaData],y and #%01000000 ;mask out all but d6 (page control obj bit) beq LeavePar ;if d6 clear, branch to leave (we handled this earlier) lda [AreaData],y ;otherwise, get byte again and #%01111111 ;mask out d7 cmp #$4b ;check for loop command in low nybble bne Mask2MSB ;(plus d6 set for object other than page control) inc LoopCommand ;if loop command, set loop command flag Mask2MSB: and #%00111111 ;mask out d7 and d6 jmp NormObj ;and jump ChkSRows: cmp #$0c ;row 12-15? bcs SpecObj iny ;if not, get second byte of level object lda [AreaData],y and #%01110000 ;mask out all but d6-d4 bne LrgObj ;if any bits set, branch to handle large object lda #$16 sta <$07 ;otherwise set offset of 24 for small object lda [AreaData],y ;reload second byte of level object and #%00001111 ;mask out higher nybble and jump jmp NormObj LrgObj: sta <$00 ;store value here (branch for large objects) cmp #$70 ;check for vertical pipe object bne NotWPipe lda [AreaData],y ;if not, reload second byte and #%00001000 ;mask out all but d3 (usage control bit) beq NotWPipe ;if d3 clear, branch to get original value lda #$00 ;otherwise, nullify value for warp pipe sta <$00 NotWPipe: lda <$00 ;get value and jump ahead jmp MoveAOId SpecObj: iny ;branch here for rows 12-15 lda [AreaData],y and #%01110000 ;get next byte and mask out all but d6-d4 MoveAOId: lsr a ;move d6-d4 to lower nybble lsr a lsr a lsr a NormObj: sta <$00 ;store value here (branch for small objects and rows 13 and 14) lda AreaObjectLength,x ;is there something stored here already? bpl RunAObj ;if so, branch to do its particular sub lda AreaObjectPageLoc ;otherwise check to see if the object we've loaded is on the cmp CurrentPageLoc ;same page as the renderer, and if so, branch beq InitRear ldy AreaDataOffset ;if not, get old offset of level pointer lda [AreaData],y ;and reload first byte and #%00001111 cmp #$0e ;row 14? bne LeavePar lda BackloadingFlag ;if so, check backloading flag bne StrAObj ;if set, branch to render object, else leave LeavePar: rts InitRear: lda BackloadingFlag ;check backloading flag to see if it's been initialized beq BackColC ;branch to column-wise check lda #$00 ;if not, initialize both backloading and sta BackloadingFlag ;behind-renderer flags and leave sta BehindAreaParserFlag sta <ObjectOffset LoopCmdE: rts BackColC: ldy AreaDataOffset ;get first byte again lda [AreaData],y and #%11110000 ;mask out low nybble and move high to low lsr a lsr a lsr a lsr a cmp CurrentColumnPos ;is this where we're at? bne LeavePar ;if not, branch to leave StrAObj: lda AreaDataOffset ;if so, load area obj offset and store in buffer sta AreaObjOffsetBuffer,x jsr IncAreaObjOffset ;do sub to increment to next object data RunAObj: lda <$00 ;get stored value and add offset to it clc ;then use the jump engine with current contents of A adc <$07 jsr JumpEngine ;large objects (rows $00-$0b or 00-11, d6-d4 set) .dw VerticalPipe ;used by warp pipes .dw AreaStyleObject .dw RowOfBricks .dw RowOfSolidBlocks .dw RowOfCoins .dw ColumnOfBricks .dw ColumnOfSolidBlocks .dw VerticalPipe ;used by decoration pipes ;objects for special row $0c or 12 .dw Hole_Empty .dw PulleyRopeObject .dw Bridge_High .dw Bridge_Middle .dw Bridge_Low .dw Hole_Water .dw QuestionBlockRow_High .dw QuestionBlockRow_Low ;objects for special row $0f or 15 .dw EndlessRope .dw BalancePlatRope .dw CastleObject .dw StaircaseObject .dw ExitPipe .dw FlagBalls_Residual ;small objects (rows $00-$0b or 00-11, d6-d4 all clear) .dw QuestionBlock ;power-up .dw QuestionBlock ;coin .dw QuestionBlock ;hidden, coin .dw Hidden1UpBlock ;hidden, 1-up .dw BrickWithItem ;brick, power-up .dw BrickWithItem ;brick, vine .dw BrickWithItem ;brick, star .dw BrickWithCoins ;brick, coins .dw BrickWithItem ;brick, 1-up .dw WaterPipe .dw EmptyBlock .dw Jumpspring ;objects for special row $0d or 13 (d6 set) .dw IntroPipe .dw FlagpoleObject .dw AxeObj .dw ChainObj .dw CastleBridgeObj .dw ScrollLockObject_Warp .dw ScrollLockObject .dw ScrollLockObject .dw AreaFrenzy ;flying cheep-cheeps .dw AreaFrenzy ;bullet bills or swimming cheep-cheeps .dw AreaFrenzy ;stop frenzy .dw LoopCmdE ;object for special row $0e or 14 .dw AlterAreaAttributes ;------------------------------------------------------------------------------------- ;(these apply to all area object subroutines in this section unless otherwise stated) ;$00 - used to store offset used to find object code ;$07 - starts with adder from area parser, used to store row offset AlterAreaAttributes: ldy AreaObjOffsetBuffer,x ;load offset for level object data saved in buffer iny ;load second byte lda [AreaData],y pha ;save in stack for now and #%01000000 bne Alter2 ;branch if d6 is set pla pha ;pull and push offset to copy to A and #%00001111 ;mask out high nybble and store as sta TerrainControl ;new terrain height type bits pla and #%00110000 ;pull and mask out all but d5 and d4 lsr a ;move bits to lower nybble and store lsr a ;as new background scenery bits lsr a lsr a sta BackgroundScenery ;then leave rts Alter2: pla and #%00000111 ;mask out all but 3 LSB cmp #$04 ;if four or greater, set color control bits bcc SetFore ;and nullify foreground scenery bits sta BackgroundColorCtrl lda #$00 SetFore: sta ForegroundScenery ;otherwise set new foreground scenery bits rts ;-------------------------------- ScrollLockObject_Warp: ldx #$04 ;load value of 4 for game text routine as default lda WorldNumber ;warp zone (4-3-2), then check world number beq WarpNum inx ;if world number > 1, increment for next warp zone (5) ldy AreaType ;check area type dey bne WarpNum ;if ground area type, increment for last warp zone inx ;(8-7-6) and move on WarpNum: txa sta WarpZoneControl ;store number here to be used by warp zone routine jsr WriteGameText ;print text and warp zone numbers lda #PiranhaPlant jsr KillEnemies ;load identifier for piranha plants and do sub ScrollLockObject: lda ScrollLock ;invert scroll lock to turn it on eor #%00000001 sta ScrollLock rts ;-------------------------------- ;$00 - used to store enemy identifier in KillEnemies KillEnemies: sta <$00 ;store identifier here lda #$00 ldx #$04 ;check for identifier in enemy object buffer KillELoop: ldy <Enemy_ID,x cpy <$00 ;if not found, branch bne NoKillE sta <Enemy_Flag,x ;if found, deactivate enemy object flag NoKillE: dex ;do this until all slots are checked bpl KillELoop rts ;-------------------------------- FrenzyIDData: .db FlyCheepCheepFrenzy, BBill_CCheep_Frenzy, Stop_Frenzy AreaFrenzy: ldx <$00 ;use area object identifier bit as offset lda FrenzyIDData-8,x ;note that it starts at 8, thus weird address here ldy #$05 FreCompLoop: dey ;check regular slots of enemy object buffer bmi ExitAFrenzy ;if all slots checked and enemy object not found, branch to store CMP Enemy_ID,y ;check for enemy object in buffer versus frenzy object bne FreCompLoop lda #$00 ;if enemy object already present, nullify queue and leave ExitAFrenzy: sta EnemyFrenzyQueue ;store enemy into frenzy queue rts ;-------------------------------- ;$06 - used by MushroomLedge to store length AreaStyleObject: lda AreaStyle ;load level object style and jump to the right sub jsr JumpEngine .dw TreeLedge ;also used for cloud type levels .dw MushroomLedge .dw BulletBillCannon TreeLedge: jsr GetLrgObjAttrib ;get row and length of green ledge lda AreaObjectLength,x ;check length counter for expiration beq EndTreeL bpl MidTreeL tya sta AreaObjectLength,x ;store lower nybble into buffer flag as length of ledge lda CurrentPageLoc ora CurrentColumnPos ;are we at the start of the level? beq MidTreeL lda #$16 ;render start of tree ledge jmp NoUnder MidTreeL: ldx <$07 lda #$17 ;render middle of tree ledge sta MetatileBuffer,x ;note that this is also used if ledge position is lda #$4c ;at the start of level for continuous effect jmp AllUnder ;now render the part underneath EndTreeL: lda #$18 ;render end of tree ledge jmp NoUnder MushroomLedge: jsr ChkLrgObjLength ;get shroom dimensions sty <$06 ;store length here for now bcc EndMushL lda AreaObjectLength,x ;divide length by 2 and store elsewhere lsr a sta MushroomLedgeHalfLen,x lda #$19 ;render start of mushroom jmp NoUnder EndMushL: lda #$1b ;if at the end, render end of mushroom ldy AreaObjectLength,x beq NoUnder lda MushroomLedgeHalfLen,x ;get divided length and store where length sta <$06 ;was stored originally ldx <$07 lda #$1a sta MetatileBuffer,x ;render middle of mushroom cpy <$06 ;are we smack dab in the center? bne MushLExit ;if not, branch to leave inx lda #$4f sta MetatileBuffer,x ;render stem top of mushroom underneath the middle lda #$50 AllUnder: inx ldy #$0f ;set $0f to render all way down jmp RenderUnderPart ;now render the stem of mushroom NoUnder: ldx <$07 ;load row of ledge ldy #$00 ;set 0 for no bottom on this part jmp RenderUnderPart ;-------------------------------- ;tiles used by pulleys and rope object PulleyRopeMetatiles: .db $42, $41, $43 PulleyRopeObject: jsr ChkLrgObjLength ;get length of pulley/rope object ldy #$00 ;initialize metatile offset bcs RenderPul ;if starting, render left pulley iny lda AreaObjectLength,x ;if not at the end, render rope bne RenderPul iny ;otherwise render right pulley RenderPul: lda PulleyRopeMetatiles,y sta MetatileBuffer ;render at the top of the screen MushLExit: rts ;and leave ;-------------------------------- ;$06 - used to store upper limit of rows for CastleObject CastleMetatiles: .db $00, $45, $45, $45, $00 .db $00, $48, $47, $46, $00 .db $45, $49, $49, $49, $45 .db $47, $47, $4a, $47, $47 .db $47, $47, $4b, $47, $47 .db $49, $49, $49, $49, $49 .db $47, $4a, $47, $4a, $47 .db $47, $4b, $47, $4b, $47 .db $47, $47, $47, $47, $47 .db $4a, $47, $4a, $47, $4a .db $4b, $47, $4b, $47, $4b CastleObject: jsr GetLrgObjAttrib ;save lower nybble as starting row sty <$07 ;if starting row is above $0a, game will crash!!! ldy #$04 jsr ChkLrgObjFixedLength ;load length of castle if not already loaded txa pha ;save obj buffer offset to stack ldy AreaObjectLength,x ;use current length as offset for castle data ldx <$07 ;begin at starting row lda #$0b sta <$06 ;load upper limit of number of rows to print CRendLoop: lda CastleMetatiles,y ;load current byte using offset sta MetatileBuffer,x inx ;store in buffer and increment buffer offset lda <$06 beq ChkCFloor ;have we reached upper limit yet? iny ;if not, increment column-wise iny ;to byte in next row iny iny iny dec <$06 ;move closer to upper limit ChkCFloor: cpx #$0b ;have we reached the row just before floor? bne CRendLoop ;if not, go back and do another row pla tax ;get obj buffer offset from before lda CurrentPageLoc beq ExitCastle ;if we're at page 0, we do not need to do anything else lda AreaObjectLength,x ;check length cmp #$01 ;if length almost about to expire, put brick at floor beq PlayerStop ldy <$07 ;check starting row for tall castle ($00) bne NotTall cmp #$03 ;if found, then check to see if we're at the second column beq PlayerStop NotTall: cmp #$02 ;if not tall castle, check to see if we're at the third column bne ExitCastle ;if we aren't and the castle is tall, don't create flag yet jsr GetAreaObjXPosition ;otherwise, obtain and save horizontal pixel coordinate pha jsr FindEmptyEnemySlot ;find an empty place on the enemy object buffer pla sta <Enemy_X_Position,x ;then write horizontal coordinate for star flag lda CurrentPageLoc sta <Enemy_PageLoc,x ;set page location for star flag lda #$01 sta <Enemy_Y_HighPos,x ;set vertical high byte sta <Enemy_Flag,x ;set flag for buffer lda #$90 sta <Enemy_Y_Position,x ;set vertical coordinate lda #StarFlagObject ;set star flag value in buffer itself sta <Enemy_ID,x rts PlayerStop: ldy #$52 ;put brick at floor to stop player at end of level sty MetatileBuffer+10 ;this is only done if we're on the second column ExitCastle: rts ;-------------------------------- WaterPipe: jsr GetLrgObjAttrib ;get row and lower nybble ldy AreaObjectLength,x ;get length (residual code, water pipe is 1 col thick) ldx <$07 ;get row lda #$6b sta MetatileBuffer,x ;draw something here and below it lda #$6c sta MetatileBuffer+1,x rts ;-------------------------------- ;$05 - used to store length of vertical shaft in RenderSidewaysPipe ;$06 - used to store leftover horizontal length in RenderSidewaysPipe ; and vertical length in VerticalPipe and GetPipeHeight IntroPipe: ldy #$03 ;check if length set, if not set, set it jsr ChkLrgObjFixedLength ldy #$0a ;set fixed value and render the sideways part jsr RenderSidewaysPipe bcs NoBlankP ;if carry flag set, not time to draw vertical pipe part ldx #$06 ;blank everything above the vertical pipe part VPipeSectLoop: lda #$00 ;all the way to the top of the screen sta MetatileBuffer,x ;because otherwise it will look like exit pipe dex bpl VPipeSectLoop lda VerticalPipeData,y ;draw the end of the vertical pipe part sta MetatileBuffer+7 NoBlankP: rts SidePipeShaftData: .db $15, $14 ;used to control whether or not vertical pipe shaft .db $00, $00 ;is drawn, and if so, controls the metatile number SidePipeTopPart: .db $15, $1e ;top part of sideways part of pipe .db $1d, $1c SidePipeBottomPart: .db $15, $21 ;bottom part of sideways part of pipe .db $20, $1f ExitPipe: ldy #$03 ;check if length set, if not set, set it jsr ChkLrgObjFixedLength jsr GetLrgObjAttrib ;get vertical length, then plow on through RenderSidewaysPipe RenderSidewaysPipe: dey ;decrement twice to make room for shaft at bottom dey ;and store here for now as vertical length sty <$05 ldy AreaObjectLength,x ;get length left over and store here sty <$06 ldx <$05 ;get vertical length plus one, use as buffer offset inx lda SidePipeShaftData,y ;check for value $00 based on horizontal offset cmp #$00 beq DrawSidePart ;if found, do not draw the vertical pipe shaft ldx #$00 ldy <$05 ;init buffer offset and get vertical length jsr RenderUnderPart ;and render vertical shaft using tile number in A clc ;clear carry flag to be used by IntroPipe DrawSidePart: ldy <$06 ;render side pipe part at the bottom lda SidePipeTopPart,y sta MetatileBuffer,x ;note that the pipe parts are stored lda SidePipeBottomPart,y ;backwards horizontally sta MetatileBuffer+1,x rts VerticalPipeData: .db $11, $10 ;used by pipes that lead somewhere .db $15, $14 .db $13, $12 ;used by decoration pipes .db $15, $14 VerticalPipe: jsr GetPipeHeight lda <$00 ;check to see if value was nullified earlier beq WarpPipe ;(if d3, the usage control bit of second byte, was set) iny iny iny iny ;add four if usage control bit was not set WarpPipe: tya ;save value in stack pha lda AreaNumber ora WorldNumber ;if at world 1-1, do not add piranha plant ever beq DrawPipe ldy AreaObjectLength,x ;if on second column of pipe, branch beq DrawPipe ;(because we only need to do this once) jsr FindEmptyEnemySlot ;check for an empty moving data buffer space bcs DrawPipe ;if not found, too many enemies, thus skip jsr GetAreaObjXPosition ;get horizontal pixel coordinate clc adc #$08 ;add eight to put the piranha plant in the center sta <Enemy_X_Position,x ;store as enemy's horizontal coordinate lda CurrentPageLoc ;add carry to current page number adc #$00 sta <Enemy_PageLoc,x ;store as enemy's page coordinate lda #$01 sta <Enemy_Y_HighPos,x sta <Enemy_Flag,x ;activate enemy flag jsr GetAreaObjYPosition ;get piranha plant's vertical coordinate and store here sta <Enemy_Y_Position,x lda #PiranhaPlant ;write piranha plant's value into buffer sta <Enemy_ID,x jsr InitPiranhaPlant DrawPipe: pla ;get value saved earlier and use as Y tay ldx <$07 ;get buffer offset lda VerticalPipeData,y ;draw the appropriate pipe with the Y we loaded earlier sta MetatileBuffer,x ;render the top of the pipe inx lda VerticalPipeData+2,y ;render the rest of the pipe ldy <$06 ;subtract one from length and render the part underneath dey jmp RenderUnderPart GetPipeHeight: ldy #$01 ;check for length loaded, if not, load jsr ChkLrgObjFixedLength ;pipe length of 2 (horizontal) jsr GetLrgObjAttrib tya ;get saved lower nybble as height and #$07 ;save only the three lower bits as sta <$06 ;vertical length, then load Y with ldy AreaObjectLength,x ;length left over rts FindEmptyEnemySlot: ldx #$00 ;start at first enemy slot EmptyChkLoop: clc ;clear carry flag by default lda <Enemy_Flag,x ;check enemy buffer for nonzero beq ExitEmptyChk ;if zero, leave inx cpx #$05 ;if nonzero, check next value bne EmptyChkLoop ExitEmptyChk: rts ;if all values nonzero, carry flag is set ;-------------------------------- Hole_Water: jsr ChkLrgObjLength ;get low nybble and save as length lda #$86 ;render waves sta MetatileBuffer+10 ldx #$0b ldy #$01 ;now render the water underneath lda #$87 jmp RenderUnderPart ;-------------------------------- QuestionBlockRow_High: lda #$03 ;start on the fourth row .db $2c ;BIT instruction opcode QuestionBlockRow_Low: lda #$07 ;start on the eighth row pha ;save whatever row to the stack for now jsr ChkLrgObjLength ;get low nybble and save as length pla tax ;render question boxes with coins lda #$c0 sta MetatileBuffer,x rts ;-------------------------------- Bridge_High: lda #$06 ;start on the seventh row from top of screen .db $2c ;BIT instruction opcode Bridge_Middle: lda #$07 ;start on the eighth row .db $2c ;BIT instruction opcode Bridge_Low: lda #$09 ;start on the tenth row pha ;save whatever row to the stack for now jsr ChkLrgObjLength ;get low nybble and save as length pla tax ;render bridge railing lda #$0b sta MetatileBuffer,x inx ldy #$00 ;now render the bridge itself lda #$63 jmp RenderUnderPart ;-------------------------------- FlagBalls_Residual: jsr GetLrgObjAttrib ;get low nybble from object byte ldx #$02 ;render flag balls on third row from top lda #$6d ;of screen downwards based on low nybble jmp RenderUnderPart ;-------------------------------- FlagpoleObject: lda #$24 ;render flagpole ball on top sta MetatileBuffer ldx #$01 ;now render the flagpole shaft ldy #$08 lda #$25 jsr RenderUnderPart lda #$61 ;render solid block at the bottom sta MetatileBuffer+10 jsr GetAreaObjXPosition sec ;get pixel coordinate of where the flagpole is, sbc #$08 ;subtract eight pixels and use as horizontal sta <Enemy_X_Position+5 ;coordinate for the flag lda CurrentPageLoc sbc #$00 ;subtract borrow from page location and use as sta <Enemy_PageLoc+5 ;page location for the flag lda #$30 sta <Enemy_Y_Position+5 ;set vertical coordinate for flag lda #$b0 sta FlagpoleFNum_Y_Pos ;set initial vertical coordinate for flagpole's floatey number lda #FlagpoleFlagObject sta <Enemy_ID+5 ;set flag identifier, note that identifier and coordinates inc <Enemy_Flag+5 ;use last space in enemy object buffer rts ;-------------------------------- EndlessRope: ldx #$00 ;render rope from the top to the bottom of screen ldy #$0f jmp DrawRope BalancePlatRope: txa ;save object buffer offset for now pha ldx #$01 ;blank out all from second row to the bottom ldy #$0f ;with blank used for balance platform rope lda #$44 jsr RenderUnderPart pla ;get back object buffer offset tax jsr GetLrgObjAttrib ;get vertical length from lower nybble ldx #$01 DrawRope: lda #$40 ;render the actual rope jmp RenderUnderPart ;-------------------------------- CoinMetatileData: .db $c3, $c2, $c2, $c2 RowOfCoins: ldy AreaType ;get area type lda CoinMetatileData,y ;load appropriate coin metatile jmp GetRow ;-------------------------------- C_ObjectRow: .db $06, $07, $08 C_ObjectMetatile: .db $c5, $0c, $89 CastleBridgeObj: ldy #$0c ;load length of 13 columns jsr ChkLrgObjFixedLength jmp ChainObj AxeObj: lda #$08 ;load bowser's palette into sprite portion of palette sta VRAM_Buffer_AddrCtrl ChainObj: ldy <$00 ;get value loaded earlier from decoder ldx C_ObjectRow-2,y ;get appropriate row and metatile for object lda C_ObjectMetatile-2,y jmp ColObj EmptyBlock: jsr GetLrgObjAttrib ;get row location ldx <$07 lda #$c4 ColObj: ldy #$00 ;column length of 1 jmp RenderUnderPart ;-------------------------------- SolidBlockMetatiles: .db $69, $61, $61, $62 BrickMetatiles: .db $22, $51, $52, $52 .db $88 ;used only by row of bricks object RowOfBricks: ldy AreaType ;load area type obtained from area offset pointer lda CloudTypeOverride ;check for cloud type override beq DrawBricks ldy #$04 ;if cloud type, override area type DrawBricks: lda BrickMetatiles,y ;get appropriate metatile jmp GetRow ;and go render it RowOfSolidBlocks: ldy AreaType ;load area type obtained from area offset pointer lda SolidBlockMetatiles,y ;get metatile GetRow: pha ;store metatile here jsr ChkLrgObjLength ;get row number, load length DrawRow: ldx <$07 ldy #$00 ;set vertical height of 1 pla jmp RenderUnderPart ;render object ColumnOfBricks: ldy AreaType ;load area type obtained from area offset lda BrickMetatiles,y ;get metatile (no cloud override as for row) jmp GetRow2 ColumnOfSolidBlocks: ldy AreaType ;load area type obtained from area offset lda SolidBlockMetatiles,y ;get metatile GetRow2: pha ;save metatile to stack for now jsr GetLrgObjAttrib ;get length and row pla ;restore metatile ldx <$07 ;get starting row jmp RenderUnderPart ;now render the column ;-------------------------------- BulletBillCannon: jsr GetLrgObjAttrib ;get row and length of bullet bill cannon ldx <$07 ;start at first row lda #$64 ;render bullet bill cannon sta MetatileBuffer,x inx dey ;done yet? bmi SetupCannon lda #$65 ;if not, render middle part sta MetatileBuffer,x inx dey ;done yet? bmi SetupCannon lda #$66 ;if not, render bottom until length expires jsr RenderUnderPart SetupCannon: ldx Cannon_Offset ;get offset for data used by cannons and whirlpools jsr GetAreaObjYPosition ;get proper vertical coordinate for cannon sta Cannon_Y_Position,x ;and store it here lda CurrentPageLoc sta Cannon_PageLoc,x ;store page number for cannon here jsr GetAreaObjXPosition ;get proper horizontal coordinate for cannon sta Cannon_X_Position,x ;and store it here inx cpx #$06 ;increment and check offset bcc StrCOffset ;if not yet reached sixth cannon, branch to save offset ldx #$00 ;otherwise initialize it StrCOffset: stx Cannon_Offset ;save new offset and leave rts ;-------------------------------- StaircaseHeightData: .db $07, $07, $06, $05, $04, $03, $02, $01, $00 StaircaseRowData: .db $03, $03, $04, $05, $06, $07, $08, $09, $0a StaircaseObject: jsr ChkLrgObjLength ;check and load length bcc NextStair ;if length already loaded, skip init part lda #$09 ;start past the end for the bottom sta StaircaseControl ;of the staircase NextStair: dec StaircaseControl ;move onto next step (or first if starting) ldy StaircaseControl ldx StaircaseRowData,y ;get starting row and height to render lda StaircaseHeightData,y tay lda #$61 ;now render solid block staircase jmp RenderUnderPart ;-------------------------------- Jumpspring: jsr GetLrgObjAttrib jsr FindEmptyEnemySlot ;find empty space in enemy object buffer jsr GetAreaObjXPosition ;get horizontal coordinate for jumpspring sta <Enemy_X_Position,x ;and store lda CurrentPageLoc ;store page location of jumpspring sta <Enemy_PageLoc,x jsr GetAreaObjYPosition ;get vertical coordinate for jumpspring sta <Enemy_Y_Position,x ;and store sta <Jumpspring_FixedYPos,x ;store as permanent coordinate here lda #JumpspringObject sta <Enemy_ID,x ;write jumpspring object to enemy object buffer ldy #$01 sty <Enemy_Y_HighPos,x ;store vertical high byte inc <Enemy_Flag,x ;set flag for enemy object buffer ldx <$07 lda #$67 ;draw metatiles in two rows where jumpspring is sta MetatileBuffer,x lda #$68 sta MetatileBuffer+1,x rts ;-------------------------------- ;$07 - used to save ID of brick object Hidden1UpBlock: lda Hidden1UpFlag ;if flag not set, do not render object beq ExitDecBlock lda #$00 ;if set, init for the next one sta Hidden1UpFlag jmp BrickWithItem ;jump to code shared with unbreakable bricks QuestionBlock: jsr GetAreaObjectID ;get value from level decoder routine jmp DrawQBlk ;go to render it BrickWithCoins: lda #$00 ;initialize multi-coin timer flag sta BrickCoinTimerFlag BrickWithItem: jsr GetAreaObjectID ;save area object ID sty <$07 lda #$00 ;load default adder for bricks with lines ldy AreaType ;check level type for ground level dey beq BWithL ;if ground type, do not start with 5 lda #$05 ;otherwise use adder for bricks without lines BWithL: clc ;add object ID to adder adc <$07 tay ;use as offset for metatile DrawQBlk: lda BrickQBlockMetatiles,y ;get appropriate metatile for brick (question block pha ;if branched to here from question block routine) jsr GetLrgObjAttrib ;get row from location byte jmp DrawRow ;now render the object GetAreaObjectID: lda <$00 ;get value saved from area parser routine sec sbc #$00 ;possibly residual code tay ;save to Y ExitDecBlock: rts ;-------------------------------- HoleMetatiles: .db $87, $00, $00, $00 Hole_Empty: jsr ChkLrgObjLength ;get lower nybble and save as length bcc NoWhirlP ;skip this part if length already loaded lda AreaType ;check for water type level bne NoWhirlP ;if not water type, skip this part ldx Whirlpool_Offset ;get offset for data used by cannons and whirlpools jsr GetAreaObjXPosition ;get proper vertical coordinate of where we're at sec sbc #$10 ;subtract 16 pixels sta Whirlpool_LeftExtent,x ;store as left extent of whirlpool lda CurrentPageLoc ;get page location of where we're at sbc #$00 ;subtract borrow sta Whirlpool_PageLoc,x ;save as page location of whirlpool iny iny ;increment length by 2 tya asl a ;multiply by 16 to get size of whirlpool asl a ;note that whirlpool will always be asl a ;two blocks bigger than actual size of hole asl a ;and extend one block beyond each edge sta Whirlpool_Length,x ;save size of whirlpool here inx cpx #$05 ;increment and check offset bcc StrWOffset ;if not yet reached fifth whirlpool, branch to save offset ldx #$00 ;otherwise initialize it StrWOffset: stx Whirlpool_Offset ;save new offset here NoWhirlP: ldx AreaType ;get appropriate metatile, then lda HoleMetatiles,x ;render the hole proper ldx #$08 ldy #$0f ;start at ninth row and go to bottom, run RenderUnderPart ;-------------------------------- RenderUnderPart: sty AreaObjectHeight ;store vertical length to render ldy MetatileBuffer,x ;check current spot to see if there's something beq DrawThisRow ;we need to keep, if nothing, go ahead cpy #$17 beq WaitOneRow ;if middle part (tree ledge), wait until next row cpy #$1a beq WaitOneRow ;if middle part (mushroom ledge), wait until next row cpy #$c0 beq DrawThisRow ;if question block w/ coin, overwrite cpy #$c0 bcs WaitOneRow ;if any other metatile with palette 3, wait until next row cpy #$54 bne DrawThisRow ;if cracked rock terrain, overwrite cmp #$50 beq WaitOneRow ;if stem top of mushroom, wait until next row DrawThisRow: sta MetatileBuffer,x ;render contents of A from routine that called this WaitOneRow: inx cpx #$0d ;stop rendering if we're at the bottom of the screen bcs ExitUPartR ldy AreaObjectHeight ;decrement, and stop rendering if there is no more length dey bpl RenderUnderPart ExitUPartR: rts ;-------------------------------- ChkLrgObjLength: jsr GetLrgObjAttrib ;get row location and size (length if branched to from here) ChkLrgObjFixedLength: lda AreaObjectLength,x ;check for set length counter clc ;clear carry flag for not just starting bpl LenSet ;if counter not set, load it, otherwise leave alone tya ;save length into length counter sta AreaObjectLength,x sec ;set carry flag if just starting LenSet: rts GetLrgObjAttrib: ldy AreaObjOffsetBuffer,x ;get offset saved from area obj decoding routine lda [AreaData],y ;get first byte of level object and #%00001111 sta <$07 ;save row location iny lda [AreaData],y ;get next byte, save lower nybble (length or height) and #%00001111 ;as Y, then leave tay rts ;-------------------------------- GetAreaObjXPosition: lda CurrentColumnPos ;multiply current offset where we're at by 16 asl a ;to obtain horizontal pixel coordinate asl a asl a asl a rts ;-------------------------------- GetAreaObjYPosition: lda <$07 ;multiply value by 16 asl a asl a ;this will give us the proper vertical pixel coordinate asl a asl a clc adc #32 ;add 32 pixels for the status bar rts ;------------------------------------------------------------------------------------- ;$06-$07 - used to store block buffer address used as indirect BlockBufferAddr: .db LOW_Block_Buffer_1, LOW_Block_Buffer_2 .db HIGH_Block_Buffer_1, HIGH_Block_Buffer_2 ;NESASM VERSION ; .db LOW(Block_Buffer_1), LOW(Block_Buffer_2) ; .db HIGH(Block_Buffer_1), HIGH(Block_Buffer_2) GetBlockBufferAddr: pha ;take value of A, save lsr a ;move high nybble to low lsr a lsr a lsr a tay ;use nybble as pointer to high byte lda BlockBufferAddr+2,y ;of indirect here sta <$07 pla and #%00001111 ;pull from stack, mask out high nybble clc adc BlockBufferAddr,y ;add to low byte sta <$06 ;store here and leave rts ;------------------------------------------------------------------------------------- ;unused space .db $ff, $ff ;------------------------------------------------------------------------------------- AreaDataOfsLoopback: .db $12, $36, $0e, $0e, $0e, $32, $32, $32, $0a, $26, $40 ;------------------------------------------------------------------------------------- LoadAreaPointer: jsr FindAreaPointer ;find it and store it here sta AreaPointer GetAreaType: and #%01100000 ;mask out all but d6 and d5 asl a rol a rol a rol a ;make %0xx00000 into %000000xx sta AreaType ;save 2 MSB as area type rts FindAreaPointer: ldy WorldNumber ;load offset from world variable lda WorldAddrOffsets,y clc ;add area number used to find data adc AreaNumber tay lda AreaAddrOffsets,y ;from there we have our area pointer rts GetAreaDataAddrs: lda AreaPointer ;use 2 MSB for Y jsr GetAreaType tay lda AreaPointer ;mask out all but 5 LSB and #%00011111 sta AreaAddrsLOffset ;save as low offset lda EnemyAddrHOffsets,y ;load base value with 2 altered MSB, clc ;then add base value to 5 LSB, result adc AreaAddrsLOffset ;becomes offset for level data tay lda EnemyDataAddrLow,y ;use offset to load pointer sta <EnemyDataLow lda EnemyDataAddrHigh,y sta <EnemyDataHigh ldy AreaType ;use area type as offset lda AreaDataHOffsets,y ;do the same thing but with different base value clc adc AreaAddrsLOffset tay lda AreaDataAddrLow,y ;use this offset to load another pointer sta <AreaDataLow lda AreaDataAddrHigh,y sta <AreaDataHigh ldy #$00 ;load first byte of header lda [AreaData],y pha ;save it to the stack for now and #%00000111 ;save 3 LSB for foreground scenery or bg color control cmp #$04 bcc StoreFore sta BackgroundColorCtrl ;if 4 or greater, save value here as bg color control lda #$00 StoreFore: sta ForegroundScenery ;if less, save value here as foreground scenery pla ;pull byte from stack and push it back pha and #%00111000 ;save player entrance control bits lsr a ;shift bits over to LSBs lsr a lsr a sta PlayerEntranceCtrl ;save value here as player entrance control pla ;pull byte again but do not push it back and #%11000000 ;save 2 MSB for game timer setting clc rol a ;rotate bits over to LSBs rol a rol a sta GameTimerSetting ;save value here as game timer setting iny lda [AreaData],y ;load second byte of header pha ;save to stack and #%00001111 ;mask out all but lower nybble sta TerrainControl pla ;pull and push byte to copy it to A pha and #%00110000 ;save 2 MSB for background scenery type lsr a lsr a ;shift bits to LSBs lsr a lsr a sta BackgroundScenery ;save as background scenery pla and #%11000000 clc rol a ;rotate bits over to LSBs rol a rol a cmp #%00000011 ;if set to 3, store here bne StoreStyle ;and nullify other value sta CloudTypeOverride ;otherwise store value in other place lda #$00 StoreStyle: sta AreaStyle lda <AreaDataLow ;increment area data address by 2 bytes clc adc #$02 sta <AreaDataLow lda <AreaDataHigh adc #$00 sta <AreaDataHigh rts ;------------------------------------------------------------------------------------- ;GAME LEVELS DATA WorldAddrOffsets: .db $00,$05,$0A,$0E,$13,$17,$1B,$20 ;this controls the starting level ; .db World1Areas-AreaAddrOffsets, World2Areas-AreaAddrOffsets ; .db World3Areas-AreaAddrOffsets, World4Areas-AreaAddrOffsets ; .db World5Areas-AreaAddrOffsets, World6Areas-AreaAddrOffsets ; .db World7Areas-AreaAddrOffsets, World8Areas-AreaAddrOffsets AreaAddrOffsets: World1Areas: .db $25, $29, $c0, $26, $60 World2Areas: .db $28, $29, $01, $27, $62 World3Areas: .db $24, $35, $20, $63 World4Areas: .db $22, $29, $41, $2c, $61 World5Areas: .db $2a, $31, $26, $62 World6Areas: .db $2e, $23, $2d, $60 World7Areas: .db $33, $29, $01, $27, $64 World8Areas: .db $30, $32, $21, $65 ;bonus area data offsets, included here for comparison purposes ;underground bonus area - c2 ;cloud area 1 (day) - 2b ;cloud area 2 (night) - 34 ;water area (5-2/6-2) - 00 ;water area (8-4) - 02 ;warp zone area (4-2) - 2f EnemyAddrHOffsets: .db $1f, $06, $1c, $00 ;Had to splice the ends of some of these rows on the following tables due to NESASM3 compiling line max oddity. EnemyDataAddrLow: .db LOW_E_CastleArea1, LOW_E_CastleArea2, LOW_E_CastleArea3, LOW_E_CastleArea4, LOW_E_CastleArea5, LOW_E_CastleArea6 .db LOW_E_GroundArea1, LOW_E_GroundArea2, LOW_E_GroundArea3, LOW_E_GroundArea4, LOW_E_GroundArea5, LOW_E_GroundArea6 .db LOW_E_GroundArea7, LOW_E_GroundArea8, LOW_E_GroundArea9, LOW_E_GroundArea10, LOW_E_GroundArea11, LOW_E_GroundArea12 .db LOW_E_GroundArea13, LOW_E_GroundArea14, LOW_E_GroundArea15, LOW_E_GroundArea16, LOW_E_GroundArea17,LOW_E_GroundArea18 .db LOW_E_GroundArea19, LOW_E_GroundArea20, LOW_E_GroundArea21, LOW_E_GroundArea22, LOW_E_UndergroundArea1 .db LOW_E_UndergroundArea2, LOW_E_UndergroundArea3, LOW_E_WaterArea1, LOW_E_WaterArea2, LOW_E_WaterArea3 EnemyDataAddrHigh: .db HIGH_E_CastleArea1, HIGH_E_CastleArea2, HIGH_E_CastleArea3, HIGH_E_CastleArea4, HIGH_E_CastleArea5, HIGH_E_CastleArea6 .db HIGH_E_GroundArea1, HIGH_E_GroundArea2, HIGH_E_GroundArea3, HIGH_E_GroundArea4, HIGH_E_GroundArea5, HIGH_E_GroundArea6 .db HIGH_E_GroundArea7, HIGH_E_GroundArea8, HIGH_E_GroundArea9, HIGH_E_GroundArea10, HIGH_E_GroundArea11, HIGH_E_GroundArea12 .db HIGH_E_GroundArea13, HIGH_E_GroundArea14, HIGH_E_GroundArea15, HIGH_E_GroundArea16, HIGH_E_GroundArea17, HIGH_E_GroundArea18 .db HIGH_E_GroundArea19, HIGH_E_GroundArea20, HIGH_E_GroundArea21, HIGH_E_GroundArea22, HIGH_E_UndergroundArea1 .db HIGH_E_UndergroundArea2, HIGH_E_UndergroundArea3, HIGH_E_WaterArea1, HIGH_E_WaterArea2, HIGH_E_WaterArea3 ;NESASM VERSION ; EnemyDataAddrLow: ; .db LOW(E_CastleArea1), LOW(E_CastleArea2), LOW(E_CastleArea3), LOW(E_CastleArea4), LOW(E_CastleArea5), LOW(E_CastleArea6) ; .db LOW(E_GroundArea1), LOW(E_GroundArea2), LOW(E_GroundArea3), LOW(E_GroundArea4), LOW(E_GroundArea5), LOW(E_GroundArea6) ; .db LOW(E_GroundArea7), LOW(E_GroundArea8), LOW(E_GroundArea9), LOW(E_GroundArea10), LOW(E_GroundArea11), LOW(E_GroundArea12) ; .db LOW(E_GroundArea13), LOW(E_GroundArea14), LOW(E_GroundArea15), LOW(E_GroundArea16), LOW(E_GroundArea17) ; .db LOW(E_GroundArea18) ; .db LOW(E_GroundArea19), LOW(E_GroundArea20), LOW(E_GroundArea21), LOW(E_GroundArea22), LOW(E_UndergroundArea1) ; .db LOW(E_UndergroundArea2), LOW(E_UndergroundArea3), LOW(E_WaterArea1), LOW(E_WaterArea2), LOW(E_WaterArea3) ; EnemyDataAddrHigh: ; .db HIGH(E_CastleArea1), HIGH(E_CastleArea2), HIGH(E_CastleArea3), HIGH(E_CastleArea4), HIGH(E_CastleArea5) ; .db HIGH(E_CastleArea6) ; .db HIGH(E_GroundArea1), HIGH(E_GroundArea2), HIGH(E_GroundArea3), HIGH(E_GroundArea4), HIGH(E_GroundArea5) ; .db HIGH(E_GroundArea6) ; .db HIGH(E_GroundArea7), HIGH(E_GroundArea8), HIGH(E_GroundArea9), HIGH(E_GroundArea10), HIGH(E_GroundArea11) ; .db HIGH(E_GroundArea12) ; .db HIGH(E_GroundArea13), HIGH(E_GroundArea14), HIGH(E_GroundArea15), HIGH(E_GroundArea16) ; .db HIGH(E_GroundArea17), HIGH(E_GroundArea18) ; .db HIGH(E_GroundArea19), HIGH(E_GroundArea20), HIGH(E_GroundArea21), HIGH(E_GroundArea22) ; .db HIGH(E_UndergroundArea1) ; .db HIGH(E_UndergroundArea2), HIGH(E_UndergroundArea3), HIGH(E_WaterArea1), HIGH(E_WaterArea2) ; .db HIGH(E_WaterArea3) AreaDataHOffsets: .db $00, $03, $19, $1c AreaDataAddrLow: .db LOW_L_WaterArea1, LOW_L_WaterArea2, LOW_L_WaterArea3, LOW_L_GroundArea1, LOW_L_GroundArea2, LOW_L_GroundArea3 .db LOW_L_GroundArea4, LOW_L_GroundArea5, LOW_L_GroundArea6, LOW_L_GroundArea7, LOW_L_GroundArea8, LOW_L_GroundArea9 .db LOW_L_GroundArea10, LOW_L_GroundArea11, LOW_L_GroundArea12, LOW_L_GroundArea13, LOW_L_GroundArea14, LOW_L_GroundArea15 .db LOW_L_GroundArea16, LOW_L_GroundArea17, LOW_L_GroundArea18, LOW_L_GroundArea19, LOW_L_GroundArea20, LOW_L_GroundArea21 .db LOW_L_GroundArea22, LOW_L_UndergroundArea1, LOW_L_UndergroundArea2, LOW_L_UndergroundArea3, LOW_L_CastleArea1 .db LOW_L_CastleArea2, LOW_L_CastleArea3, LOW_L_CastleArea4, LOW_L_CastleArea5, LOW_L_CastleArea6 AreaDataAddrHigh: .db HIGH_L_WaterArea1, HIGH_L_WaterArea2, HIGH_L_WaterArea3, HIGH_L_GroundArea1, HIGH_L_GroundArea2, HIGH_L_GroundArea3 .db HIGH_L_GroundArea4, HIGH_L_GroundArea5, HIGH_L_GroundArea6, HIGH_L_GroundArea7, HIGH_L_GroundArea8, HIGH_L_GroundArea9 .db HIGH_L_GroundArea10, HIGH_L_GroundArea11, HIGH_L_GroundArea12, HIGH_L_GroundArea13, HIGH_L_GroundArea14, HIGH_L_GroundArea15 .db HIGH_L_GroundArea16, HIGH_L_GroundArea17, HIGH_L_GroundArea18, HIGH_L_GroundArea19, HIGH_L_GroundArea20, HIGH_L_GroundArea21 .db HIGH_L_GroundArea22, HIGH_L_UndergroundArea1, HIGH_L_UndergroundArea2, HIGH_L_UndergroundArea3, HIGH_L_CastleArea1 .db HIGH_L_CastleArea2, HIGH_L_CastleArea3, HIGH_L_CastleArea4, HIGH_L_CastleArea5, HIGH_L_CastleArea6 ;NESASM VERSION ; AreaDataAddrLow: ; .db LOW(L_WaterArea1), LOW(L_WaterArea2), LOW(L_WaterArea3), LOW(L_GroundArea1), LOW(L_GroundArea2) ; .db LOW(L_GroundArea3) ; .db LOW(L_GroundArea4), LOW(L_GroundArea5), LOW(L_GroundArea6), LOW(L_GroundArea7), LOW(L_GroundArea8) ; .db LOW(L_GroundArea9) ; .db LOW(L_GroundArea10), LOW(L_GroundArea11), LOW(L_GroundArea12), LOW(L_GroundArea13), LOW(L_GroundArea14) ; .db LOW(L_GroundArea15) ; .db LOW(L_GroundArea16), LOW(L_GroundArea17), LOW(L_GroundArea18), LOW(L_GroundArea19), LOW(L_GroundArea20) ; .db LOW(L_GroundArea21) ; .db LOW(L_GroundArea22), LOW(L_UndergroundArea1), LOW(L_UndergroundArea2), LOW(L_UndergroundArea3) ; .db LOW(L_CastleArea1) ; .db LOW(L_CastleArea2), LOW(L_CastleArea3), LOW(L_CastleArea4), LOW(L_CastleArea5), LOW(L_CastleArea6) ; AreaDataAddrHigh: ; .db HIGH(L_WaterArea1), HIGH(L_WaterArea2), HIGH(L_WaterArea3), HIGH(L_GroundArea1) ; .db HIGH(L_GroundArea2), HIGH(L_GroundArea3) ; .db HIGH(L_GroundArea4), HIGH(L_GroundArea5), HIGH(L_GroundArea6), HIGH(L_GroundArea7) ; .db HIGH(L_GroundArea8), HIGH(L_GroundArea9) ; .db HIGH(L_GroundArea10), HIGH(L_GroundArea11), HIGH(L_GroundArea12), HIGH(L_GroundArea13) ; .db HIGH(L_GroundArea14), HIGH(L_GroundArea15) ; .db HIGH(L_GroundArea16), HIGH(L_GroundArea17), HIGH(L_GroundArea18), HIGH(L_GroundArea19) ; .db HIGH(L_GroundArea20), HIGH(L_GroundArea21) ; .db HIGH(L_GroundArea22), HIGH(L_UndergroundArea1), HIGH(L_UndergroundArea2) ; .db HIGH(L_UndergroundArea3), HIGH(L_CastleArea1) ; .db HIGH(L_CastleArea2), HIGH(L_CastleArea3), HIGH(L_CastleArea4) ; .db HIGH(L_CastleArea5), HIGH(L_CastleArea6) ;ENEMY OBJECT DATA ;level 1-4/6-4 E_CastleArea1: .db $76, $dd, $bb, $4c, $ea, $1d, $1b, $cc, $56, $5d .db $16, $9d, $c6, $1d, $36, $9d, $c9, $1d, $04, $db .db $49, $1d, $84, $1b, $c9, $5d, $88, $95, $0f, $08 .db $30, $4c, $78, $2d, $a6, $28, $90, $b5 .db $ff ;level 4-4 E_CastleArea2: .db $0f, $03, $56, $1b, $c9, $1b, $0f, $07, $36, $1b .db $aa, $1b, $48, $95, $0f, $0a, $2a, $1b, $5b, $0c .db $78, $2d, $90, $b5 .db $ff ;level 2-4/5-4 E_CastleArea3: .db $0b, $8c, $4b, $4c, $77, $5f, $eb, $0c, $bd, $db .db $19, $9d, $75, $1d, $7d, $5b, $d9, $1d, $3d, $dd .db $99, $1d, $26, $9d, $5a, $2b, $8a, $2c, $ca, $1b .db $20, $95, $7b, $5c, $db, $4c, $1b, $cc, $3b, $cc .db $78, $2d, $a6, $28, $90, $b5 .db $ff ;level 3-4 E_CastleArea4: .db $0b, $8c, $3b, $1d, $8b, $1d, $ab, $0c, $db, $1d .db $0f, $03, $65, $1d, $6b, $1b, $05, $9d, $0b, $1b .db $05, $9b, $0b, $1d, $8b, $0c, $1b, $8c, $70, $15 .db $7b, $0c, $db, $0c, $0f, $08, $78, $2d, $a6, $28 .db $90, $b5 .db $ff ;level 7-4 E_CastleArea5: .db $27, $a9, $4b, $0c, $68, $29, $0f, $06, $77, $1b .db $0f, $0b, $60, $15, $4b, $8c, $78, $2d, $90, $b5 .db $ff ;level 8-4 E_CastleArea6: .db $0f, $03, $8e, $65, $e1, $bb, $38, $6d, $a8, $3e, $e5, $e7 .db $0f, $08, $0b, $02, $2b, $02, $5e, $65, $e1, $bb, $0e .db $db, $0e, $bb, $8e, $db, $0e, $fe, $65, $ec, $0f, $0d .db $4e, $65, $e1, $0f, $0e, $4e, $02, $e0, $0f, $10, $fe, $e5, $e1 .db $1b, $85, $7b, $0c, $5b, $95, $78, $2d, $90, $b5 .db $ff ;level 3-3 E_GroundArea1: .db $a5, $86, $e4, $28, $18, $a8, $45, $83, $69, $03 .db $c6, $29, $9b, $83, $16, $a4, $88, $24, $e9, $28 .db $05, $a8, $7b, $28, $24, $8f, $c8, $03, $e8, $03 .db $46, $a8, $85, $24, $c8, $24 .db $ff ;level 8-3 E_GroundArea2: .db $eb, $8e, $0f, $03, $fb, $05, $17, $85, $db, $8e .db $0f, $07, $57, $05, $7b, $05, $9b, $80, $2b, $85 .db $fb, $05, $0f, $0b, $1b, $05, $9b, $05 .db $ff ;level 4-1 E_GroundArea3: .db $2e, $c2, $66, $e2, $11, $0f, $07, $02, $11, $0f, $0c .db $12, $11 .db $ff ;level 6-2 E_GroundArea4: .db $0e, $c2, $a8, $ab, $00, $bb, $8e, $6b, $82, $de, $00, $a0 .db $33, $86, $43, $06, $3e, $b4, $a0, $cb, $02, $0f, $07 .db $7e, $42, $a6, $83, $02, $0f, $0a, $3b, $02, $cb, $37 .db $0f, $0c, $e3, $0e .db $ff ;level 3-1 E_GroundArea5: .db $9b, $8e, $ca, $0e, $ee, $42, $44, $5b, $86, $80, $b8 .db $1b, $80, $50, $ba, $10, $b7, $5b, $00, $17, $85 .db $4b, $05, $fe, $34, $40, $b7, $86, $c6, $06, $5b, $80 .db $83, $00, $d0, $38, $5b, $8e, $8a, $0e, $a6, $00 .db $bb, $0e, $c5, $80, $f3, $00 .db $ff ;level 1-1 E_GroundArea6: .db $1e, $c2, $00, $6b, $06, $8b, $86, $63, $b7, $0f, $05 .db $03, $06, $23, $06, $4b, $b7, $bb, $00, $5b, $b7 .db $fb, $37, $3b, $b7, $0f, $0b, $1b, $37 .db $ff ;level 1-3/5-3 E_GroundArea7: .db $2b, $d7, $e3, $03, $c2, $86, $e2, $06, $76, $a5 .db $a3, $8f, $03, $86, $2b, $57, $68, $28, $e9, $28 .db $e5, $83, $24, $8f, $36, $a8, $5b, $03 .db $ff ;level 2-3/7-3 E_GroundArea8: .db $0f, $02, $78, $40, $48, $ce, $f8, $c3, $f8, $c3 .db $0f, $07, $7b, $43, $c6, $d0, $0f, $8a, $c8, $50 .db $ff ;level 2-1 E_GroundArea9: .db $85, $86, $0b, $80, $1b, $00, $db, $37, $77, $80 .db $eb, $37, $fe, $2b, $20, $2b, $80, $7b, $38, $ab, $b8 .db $77, $86, $fe, $42, $20, $49, $86, $8b, $06, $9b, $80 .db $7b, $8e, $5b, $b7, $9b, $0e, $bb, $0e, $9b, $80 ;end of data terminator here is also used by pipe intro area E_GroundArea10: .db $ff ;level 5-1 E_GroundArea11: .db $0b, $80, $60, $38, $10, $b8, $c0, $3b, $db, $8e .db $40, $b8, $f0, $38, $7b, $8e, $a0, $b8, $c0, $b8 .db $fb, $00, $a0, $b8, $30, $bb, $ee, $42, $88, $0f, $0b .db $2b, $0e, $67, $0e .db $ff ;cloud level used in levels 2-1 and 5-2 E_GroundArea12: .db $0a, $aa, $0e, $28, $2a, $0e, $31, $88 .db $ff ;level 4-3 E_GroundArea13: .db $c7, $83, $d7, $03, $42, $8f, $7a, $03, $05, $a4 .db $78, $24, $a6, $25, $e4, $25, $4b, $83, $e3, $03 .db $05, $a4, $89, $24, $b5, $24, $09, $a4, $65, $24 .db $c9, $24, $0f, $08, $85, $25 .db $ff ;level 6-3 E_GroundArea14: .db $cd, $a5, $b5, $a8, $07, $a8, $76, $28, $cc, $25 .db $65, $a4, $a9, $24, $e5, $24, $19, $a4, $0f, $07 .db $95, $28, $e6, $24, $19, $a4, $d7, $29, $16, $a9 .db $58, $29, $97, $29 .db $ff ;level 6-1 E_GroundArea15: .db $0f, $02, $02, $11, $0f, $07, $02, $11 .db $ff ;warp zone area used in level 4-2 E_GroundArea16: .db $ff ;level 8-1 E_GroundArea17: .db $2b, $82, $ab, $38, $de ;;;;;;;;;;;;;;;;;;;;;; ;; .bank 1 .org $A000 ;level 8-1 - con't .db $42, $e2, $1b, $b8, $eb .db $3b, $db, $80, $8b, $b8, $1b, $82, $fb, $b8, $7b .db $80, $fb, $3c, $5b, $bc, $7b, $b8, $1b, $8e, $cb .db $0e, $1b, $8e, $0f, $0d, $2b, $3b, $bb, $b8, $eb, $82 .db $4b, $b8, $bb, $38, $3b, $b7, $bb, $02, $0f, $13 .db $1b, $00, $cb, $80, $6b, $bc .db $ff ;level 5-2 E_GroundArea18: .db $7b, $80, $ae, $00, $80, $8b, $8e, $e8, $05, $f9, $86 .db $17, $86, $16, $85, $4e, $2b, $80, $ab, $8e, $87, $85 .db $c3, $05, $8b, $82, $9b, $02, $ab, $02, $bb, $86 .db $cb, $06, $d3, $03, $3b, $8e, $6b, $0e, $a7, $8e .db $ff ;level 8-2 E_GroundArea19: .db $29, $8e, $52, $11, $83, $0e, $0f, $03, $9b, $0e .db $2b, $8e, $5b, $0e, $cb, $8e, $fb, $0e, $fb, $82 .db $9b, $82, $bb, $02, $fe, $42, $e8, $bb, $8e, $0f, $0a .db $ab, $0e, $cb, $0e, $f9, $0e, $88, $86, $a6, $06 .db $db, $02, $b6, $8e .db $ff ;level 7-1 E_GroundArea20: .db $ab, $ce, $de, $42, $c0, $cb, $ce, $5b, $8e, $1b, $ce .db $4b, $85, $67, $45, $0f, $07, $2b, $00, $7b, $85 .db $97, $05, $0f, $0a, $92, $02 .db $ff ;cloud level used in levels 3-1 and 6-2 E_GroundArea21: .db $0a, $aa, $0e, $24, $4a, $1e, $23, $aa .db $ff ;level 3-2 E_GroundArea22: .db $1b, $80, $bb, $38, $4b, $bc, $eb, $3b, $0f, $04 .db $2b, $00, $ab, $38, $eb, $00, $cb, $8e, $fb, $80 .db $ab, $b8, $6b, $80, $fb, $3c, $9b, $bb, $5b, $bc .db $fb, $00, $6b, $b8, $fb, $38 .db $ff ;level 1-2 E_UndergroundArea1: .db $0b, $86, $1a, $06, $db, $06, $de, $c2, $02, $f0, $3b .db $bb, $80, $eb, $06, $0b, $86, $93, $06, $f0, $39 .db $0f, $06, $60, $b8, $1b, $86, $a0, $b9, $b7, $27 .db $bd, $27, $2b, $83, $a1, $26, $a9, $26, $ee, $25, $0b .db $27, $b4 .db $ff ;level 4-2 E_UndergroundArea2: .db $0f, $02, $1e, $2f, $60, $e0, $3a, $a5, $a7, $db, $80 .db $3b, $82, $8b, $02, $fe, $42, $68, $70, $bb, $25, $a7 .db $2c, $27, $b2, $26, $b9, $26, $9b, $80, $a8, $82 .db $b5, $27, $bc, $27, $b0, $bb, $3b, $82, $87, $34 .db $ee, $25, $6b .db $ff ;underground bonus rooms area used in many levels E_UndergroundArea3: .db $1e, $a5, $0a, $2e, $28, $27, $2e, $33, $c7, $0f, $03, $1e, $40, $07 .db $2e, $30, $e7, $0f, $05, $1e, $24, $44, $0f, $07, $1e, $22, $6a .db $2e, $23, $ab, $0f, $09, $1e, $41, $68, $1e, $2a, $8a, $2e, $23, $a2 .db $2e, $32, $ea .db $ff ;water area used in levels 5-2 and 6-2 E_WaterArea1: .db $3b, $87, $66, $27, $cc, $27, $ee, $31, $87, $ee, $23, $a7 .db $3b, $87, $db, $07 .db $ff ;level 2-2/7-2 E_WaterArea2: .db $0f, $01, $2e, $25, $2b, $2e, $25, $4b, $4e, $25, $cb, $6b, $07 .db $97, $47, $e9, $87, $47, $c7, $7a, $07, $d6, $c7 .db $78, $07, $38, $87, $ab, $47, $e3, $07, $9b, $87 .db $0f, $09, $68, $47, $db, $c7, $3b, $c7 .db $ff ;water area used in level 8-4 E_WaterArea3: .db $47, $9b, $cb, $07, $fa, $1d, $86, $9b, $3a, $87 .db $56, $07, $88, $1b, $07, $9d, $2e, $65, $f0 .db $ff ;AREA OBJECT DATA ;level 1-4/6-4 L_CastleArea1: .db $9b, $07 .db $05, $32, $06, $33, $07, $34, $ce, $03, $dc, $51 .db $ee, $07, $73, $e0, $74, $0a, $7e, $06, $9e, $0a .db $ce, $06, $e4, $00, $e8, $0a, $fe, $0a, $2e, $89 .db $4e, $0b, $54, $0a, $14, $8a, $c4, $0a, $34, $8a .db $7e, $06, $c7, $0a, $01, $e0, $02, $0a, $47, $0a .db $81, $60, $82, $0a, $c7, $0a, $0e, $87, $7e, $02 .db $a7, $02, $b3, $02, $d7, $02, $e3, $02, $07, $82 .db $13, $02, $3e, $06, $7e, $02, $ae, $07, $fe, $0a .db $0d, $c4, $cd, $43, $ce, $09, $de, $0b, $dd, $42 .db $fe, $02, $5d, $c7 .db $fd ;level 4-4 L_CastleArea2: .db $5b, $07 .db $05, $32, $06, $33, $07, $34, $5e, $0a, $68, $64 .db $98, $64, $a8, $64, $ce, $06, $fe, $02, $0d, $01 .db $1e, $0e, $7e, $02, $94, $63, $b4, $63, $d4, $63 .db $f4, $63, $14, $e3, $2e, $0e, $5e, $02, $64, $35 .db $88, $72, $be, $0e, $0d, $04, $ae, $02, $ce, $08 .db $cd, $4b, $fe, $02, $0d, $05, $68, $31, $7e, $0a .db $96, $31, $a9, $63, $a8, $33, $d5, $30, $ee, $02 .db $e6, $62, $f4, $61, $04, $b1, $08, $3f, $44, $33 .db $94, $63, $a4, $31, $e4, $31, $04, $bf, $08, $3f .db $04, $bf, $08, $3f, $cd, $4b, $03, $e4, $0e, $03 .db $2e, $01, $7e, $06, $be, $02, $de, $06, $fe, $0a .db $0d, $c4, $cd, $43, $ce, $09, $de, $0b, $dd, $42 .db $fe, $02, $5d, $c7 .db $fd ;level 2-4/5-4 L_CastleArea3: .db $9b, $07 .db $05, $32, $06, $33, $07, $34, $fe, $00, $27, $b1 .db $65, $32, $75, $0a, $71, $00, $b7, $31, $08, $e4 .db $18, $64, $1e, $04, $57, $3b, $bb, $0a, $17, $8a .db $27, $3a, $73, $0a, $7b, $0a, $d7, $0a, $e7, $3a .db $3b, $8a, $97, $0a, $fe, $08, $24, $8a, $2e, $00 .db $3e, $40, $38, $64, $6f, $00, $9f, $00, $be, $43 .db $c8, $0a, $c9, $63, $ce, $07, $fe, $07, $2e, $81 .db $66, $42, $6a, $42, $79, $0a, $be, $00, $c8, $64 .db $f8, $64, $08, $e4, $2e, $07, $7e, $03, $9e, $07 .db $be, $03, $de, $07, $fe, $0a, $03, $a5, $0d, $44 .db $cd, $43, $ce, $09, $dd, $42, $de, $0b, $fe, $02 .db $5d, $c7 .db $fd ;level 3-4 L_CastleArea4: .db $9b, $07 .db $05, $32, $06, $33, $07, $34, $fe, $06, $0c, $81 .db $39, $0a, $5c, $01, $89, $0a, $ac, $01, $d9, $0a .db $fc, $01, $2e, $83, $a7, $01, $b7, $00, $c7, $01 .db $de, $0a, $fe, $02, $4e, $83, $5a, $32, $63, $0a .db $69, $0a, $7e, $02, $ee, $03, $fa, $32, $03, $8a .db $09, $0a, $1e, $02, $ee, $03, $fa, $32, $03, $8a .db $09, $0a, $14, $42, $1e, $02, $7e, $0a, $9e, $07 .db $fe, $0a, $2e, $86, $5e, $0a, $8e, $06, $be, $0a .db $ee, $07, $3e, $83, $5e, $07, $fe, $0a, $0d, $c4 .db $41, $52, $51, $52, $cd, $43, $ce, $09, $de, $0b .db $dd, $42, $fe, $02, $5d, $c7 .db $fd ;level 7-4 L_CastleArea5: .db $5b, $07 .db $05, $32, $06, $33, $07, $34, $fe, $0a, $ae, $86 .db $be, $07, $fe, $02, $0d, $02, $27, $32, $46, $61 .db $55, $62, $5e, $0e, $1e, $82, $68, $3c, $74, $3a .db $7d, $4b, $5e, $8e, $7d, $4b, $7e, $82, $84, $62 .db $94, $61, $a4, $31, $bd, $4b, $ce, $06, $fe, $02 .db $0d, $06, $34, $31, $3e, $0a, $64, $32, $75, $0a .db $7b, $61, $a4, $33, $ae, $02, $de, $0e, $3e, $82 .db $64, $32, $78, $32, $b4, $36, $c8, $36, $dd, $4b .db $44, $b2, $58, $32, $94, $63, $a4, $3e, $ba, $30 .db $c9, $61, $ce, $06, $dd, $4b, $ce, $86, $dd, $4b .db $fe, $02, $2e, $86, $5e, $02, $7e, $06, $fe, $02 .db $1e, $86, $3e, $02, $5e, $06, $7e, $02, $9e, $06 .db $fe, $0a, $0d, $c4, $cd, $43, $ce, $09, $de, $0b .db $dd, $42, $fe, $02, $5d, $c7 .db $fd ;level 8-4 L_CastleArea6: .db $5b, $06 .db $05, $32, $06, $33, $07, $34, $5e, $0a, $ae, $02 .db $0d, $01, $39, $73, $0d, $03, $39, $7b, $4d, $4b .db $de, $06, $1e, $8a, $ae, $06, $c4, $33, $16, $fe .db $a5, $77, $fe, $02, $fe, $82, $0d, $07, $39, $73 .db $a8, $74, $ed, $4b, $49, $fb, $e8, $74, $fe, $0a .db $2e, $82, $67, $02, $84, $7a, $87, $31, $0d, $0b .db $fe, $02, $0d, $0c, $39, $73, $5e, $06, $c6, $76 .db $45, $ff, $be, $0a, $dd, $48, $fe, $06, $3d, $cb .db $46, $7e, $ad, $4a, $fe, $82, $39, $f3, $a9, $7b .db $4e, $8a, $9e, $07, $fe, $0a, $0d, $c4, $cd, $43 .db $ce, $09, $de, $0b, $dd, $42, $fe, $02, $5d, $c7 .db $fd ;level 3-3 L_GroundArea1: .db $94, $11 .db $0f, $26, $fe, $10, $28, $94, $65, $15, $eb, $12 .db $fa, $41, $4a, $96, $54, $40, $a4, $42, $b7, $13 .db $e9, $19, $f5, $15, $11, $80, $47, $42, $71, $13 .db $80, $41, $15, $92, $1b, $1f, $24, $40, $55, $12 .db $64, $40, $95, $12, $a4, $40, $d2, $12, $e1, $40 .db $13, $c0, $2c, $17, $2f, $12, $49, $13, $83, $40 .db $9f, $14, $a3, $40, $17, $92, $83, $13, $92, $41 .db $b9, $14, $c5, $12, $c8, $40, $d4, $40, $4b, $92 .db $78, $1b, $9c, $94, $9f, $11, $df, $14, $fe, $11 .db $7d, $c1, $9e, $42, $cf, $20 .db $fd ;level 8-3 L_GroundArea2: .db $90, $b1 .db $0f, $26, $29, $91, $7e, $42, $fe, $40, $28, $92 .db $4e, $42, $2e, $c0, $57, $73, $c3, $25, $c7, $27 .db $23, $84, $33, $20, $5c, $01, $77, $63, $88, $62 .db $99, $61, $aa, $60, $bc, $01, $ee, $42, $4e, $c0 .db $69, $11, $7e, $42, $de, $40, $f8, $62, $0e, $c2 .db $ae, $40, $d7, $63, $e7, $63, $33, $a7, $37, $27 .db $43, $04, $cc, $01, $e7, $73, $0c, $81, $3e, $42 .db $0d, $0a, $5e, $40, $88, $72, $be, $42, $e7, $87 .db $fe, $40, $39, $e1, $4e, $00, $69, $60, $87, $60 .db $a5, $60, $c3, $31, $fe, $31, $6d, $c1, $be, $42 .db $ef, $20 .db $fd ;level 4-1 L_GroundArea3: .db $52, $21 .db $0f, $20, $6e, $40, $58, $f2, $93, $01, $97, $00 .db $0c, $81, $97, $40, $a6, $41, $c7, $40, $0d, $04 .db $03, $01, $07, $01, $23, $01, $27, $01, $ec, $03 .db $ac, $f3, $c3, $03, $78, $e2, $94, $43, $47, $f3 .db $74, $43, $47, $fb, $74, $43, $2c, $f1, $4c, $63 .db $47, $00, $57, $21, $5c, $01, $7c, $72, $39, $f1 .db $ec, $02, $4c, $81, $d8, $62, $ec, $01, $0d, $0d .db $0f, $38, $c7, $07, $ed, $4a, $1d, $c1, $5f, $26 .db $fd ;level 6-2 L_GroundArea4: .db $54, $21 .db $0f, $26, $a7, $22, $37, $fb, $73, $20, $83, $07 .db $87, $02, $93, $20, $c7, $73, $04, $f1, $06, $31 .db $39, $71, $59, $71, $e7, $73, $37, $a0, $47, $04 .db $86, $7c, $e5, $71, $e7, $31, $33, $a4, $39, $71 .db $a9, $71, $d3, $23, $08, $f2, $13, $05, $27, $02 .db $49, $71, $75, $75, $e8, $72, $67, $f3, $99, $71 .db $e7, $20, $f4, $72, $f7, $31, $17, $a0, $33, $20 .db $39, $71, $73, $28, $bc, $05, $39, $f1, $79, $71 .db $a6, $21, $c3, $06, $d3, $20, $dc, $00, $fc, $00 .db $07, $a2, $13, $21, $5f, $32, $8c, $00, $98, $7a .db $c7, $63, $d9, $61, $03, $a2, $07, $22, $74, $72 .db $77, $31, $e7, $73, $39, $f1, $58, $72, $77, $73 .db $d8, $72, $7f, $b1, $97, $73, $b6, $64, $c5, $65 .db $d4, $66, $e3, $67, $f3, $67, $8d, $c1, $cf, $26 .db $fd ;level 3-1 L_GroundArea5: .db $52, $31 .db $0f, $20, $6e, $66, $07, $81, $36, $01, $66, $00 .db $a7, $22, $08, $f2, $67, $7b, $dc, $02, $98, $f2 .db $d7, $20, $39, $f1, $9f, $33, $dc, $27, $dc, $57 .db $23, $83, $57, $63, $6c, $51, $87, $63, $99, $61 .db $a3, $06, $b3, $21, $77, $f3, $f3, $21, $f7, $2a .db $13, $81, $23, $22, $53, $00, $63, $22, $e9, $0b .db $0c, $83, $13, $21, $16, $22, $33, $05, $8f, $35 .db $ec, $01, $63, $a0, $67, $20, $73, $01, $77, $01 .db $83, $20, $87, $20, $b3, $20, $b7, $20, $c3, $01 .db $c7, $00, $d3, $20, $d7, $20, $67, $a0, $77, $07 .db $87, $22, $e8, $62, $f5, $65, $1c, $82, $7f, $38 .db $8d, $c1, $cf, $26 .db $fd ;level 1-1 L_GroundArea6: .db $50, $21 .db $07, $81, $47, $24, $57, $00, $63, $01, $77, $01 .db $c9, $71, $68, $f2, $e7, $73, $97, $fb, $06, $83 .db $5c, $01, $d7, $22, $e7, $00, $03, $a7, $6c, $02 .db $b3, $22, $e3, $01, $e7, $07, $47, $a0, $57, $06 .db $a7, $01, $d3, $00, $d7, $01, $07, $81, $67, $20 .db $93, $22, $03, $a3, $1c, $61, $17, $21, $6f, $33 .db $c7, $63, $d8, $62, $e9, $61, $fa, $60, $4f, $b3 .db $87, $63, $9c, $01, $b7, $63, $c8, $62, $d9, $61 .db $ea, $60, $39, $f1, $87, $21, $a7, $01, $b7, $20 .db $39, $f1, $5f, $38, $6d, $c1, $af, $26 .db $fd ;level 1-3/5-3 L_GroundArea7: .db $90, $11 .db $0f, $26, $fe, $10, $2a, $93, $87, $17, $a3, $14 .db $b2, $42, $0a, $92, $19, $40, $36, $14, $50, $41 .db $82, $16, $2b, $93, $24, $41, $bb, $14, $b8, $00 .db $c2, $43, $c3, $13, $1b, $94, $67, $12, $c4, $15 .db $53, $c1, $d2, $41, $12, $c1, $29, $13, $85, $17 .db $1b, $92, $1a, $42, $47, $13, $83, $41, $a7, $13 .db $0e, $91, $a7, $63, $b7, $63, $c5, $65, $d5, $65 .db $dd, $4a, $e3, $67, $f3, $67, $8d, $c1, $ae, $42 .db $df, $20 .db $fd ;level 2-3/7-3 L_GroundArea8: .db $90, $11 .db $0f, $26, $6e, $10, $8b, $17, $af, $32, $d8, $62 .db $e8, $62, $fc, $3f, $ad, $c8, $f8, $64, $0c, $be .db $43, $43, $f8, $64, $0c, $bf, $73, $40, $84, $40 .db $93, $40, $a4, $40, $b3, $40, $f8, $64, $48, $e4 .db $5c, $39, $83, $40, $92, $41, $b3, $40, $f8, $64 .db $48, $e4, $5c, $39, $f8, $64, $13, $c2, $37, $65 .db $4c, $24, $63, $00, $97, $65, $c3, $42, $0b, $97 .db $ac, $32, $f8, $64, $0c, $be, $53, $45, $9d, $48 .db $f8, $64, $2a, $e2, $3c, $47, $56, $43, $ba, $62 .db $f8, $64, $0c, $b7, $88, $64, $bc, $31, $d4, $45 .db $fc, $31, $3c, $b1, $78, $64, $8c, $38, $0b, $9c .db $1a, $33, $18, $61, $28, $61, $39, $60, $5d, $4a .db $ee, $11, $0f, $b8, $1d, $c1, $3e, $42, $6f, $20 .db $fd ;level 2-1 L_GroundArea9: .db $52, $31 .db $0f, $20, $6e, $40, $f7, $20, $07, $84, $17, $20 .db $4f, $34, $c3, $03, $c7, $02, $d3, $22, $27, $e3 .db $39, $61, $e7, $73, $5c, $e4, $57, $00, $6c, $73 .db $47, $a0, $53, $06, $63, $22, $a7, $73, $fc, $73 .db $13, $a1, $33, $05, $43, $21, $5c, $72, $c3, $23 .db $cc, $03, $77, $fb, $ac, $02, $39, $f1, $a7, $73 .db $d3, $04, $e8, $72, $e3, $22, $26, $f4, $bc, $02 .db $8c, $81, $a8, $62, $17, $87, $43, $24, $a7, $01 .db $c3, $04, $08, $f2, $97, $21, $a3, $02, $c9, $0b .db $e1, $69, $f1, $69, $8d, $c1, $cf, $26 .db $fd ;pipe intro area L_GroundArea10: .db $38, $11 .db $0f, $26, $ad, $40, $3d, $c7 .db $fd ;level 5-1 L_GroundArea11: .db $95, $b1 .db $0f, $26, $0d, $02, $c8, $72, $1c, $81, $38, $72 .db $0d, $05, $97, $34, $98, $62, $a3, $20, $b3, $06 .db $c3, $20, $cc, $03, $f9, $91, $2c, $81, $48, $62 .db $0d, $09, $37, $63, $47, $03, $57, $21, $8c, $02 .db $c5, $79, $c7, $31, $f9, $11, $39, $f1, $a9, $11 .db $6f, $b4, $d3, $65, $e3, $65, $7d, $c1, $bf, $26 .db $fd ;cloud level used in levels 2-1 and 5-2 L_GroundArea12: .db $00, $c1 .db $4c, $00, $f4, $4f, $0d, $02, $02, $42, $43, $4f .db $52, $c2, $de, $00, $5a, $c2, $4d, $c7 .db $fd ;level 4-3 L_GroundArea13: .db $90, $51 .db $0f, $26, $ee, $10, $0b, $94, $33, $14, $42, $42 .db $77, $16, $86, $44, $02, $92, $4a, $16, $69, $42 .db $73, $14, $b0, $00, $c7, $12, $05, $c0, $1c, $17 .db $1f, $11, $36, $12, $8f, $14, $91, $40, $1b, $94 .db $35, $12, $34, $42, $60, $42, $61, $12, $87, $12 .db $96, $40, $a3, $14, $1c, $98, $1f, $11, $47, $12 .db $9f, $15, $cc, $15, $cf, $11, $05, $c0, $1f, $15 .db $39, $12, $7c, $16, $7f, $11, $82, $40, $98, $12 .db $df, $15, $16, $c4, $17, $14, $54, $12, $9b, $16 .db $28, $94, $ce, $01, $3d, $c1, $5e, $42, $8f, $20 .db $fd ;level 6-3 L_GroundArea14: .db $97, $11 .db $0f, $26, $fe, $10, $2b, $92, $57, $12, $8b, $12 .db $c0, $41, $f7, $13, $5b, $92, $69, $0b, $bb, $12 .db $b2, $46, $19, $93, $71, $00, $17, $94, $7c, $14 .db $7f, $11, $93, $41, $bf, $15, $fc, $13, $ff, $11 .db $2f, $95, $50, $42, $51, $12, $58, $14, $a6, $12 .db $db, $12, $1b, $93, $46, $43, $7b, $12, $8d, $49 .db $b7, $14, $1b, $94, $49, $0b, $bb, $12, $fc, $13 .db $ff, $12, $03, $c1, $2f, $15, $43, $12, $4b, $13 .db $77, $13, $9d, $4a, $15, $c1, $a1, $41, $c3, $12 .db $fe, $01, $7d, $c1, $9e, $42, $cf, $20 .db $fd ;level 6-1 L_GroundArea15: .db $52, $21 .db $0f, $20, $6e, $44, $0c, $f1, $4c, $01, $aa, $35 .db $d9, $34, $ee, $20, $08, $b3, $37, $32, $43, $04 .db $4e, $21, $53, $20, $7c, $01, $97, $21, $b7, $07 .db $9c, $81, $e7, $42, $5f, $b3, $97, $63, $ac, $02 .db $c5, $41, $49, $e0, $58, $61, $76, $64, $85, $65 .db $94, $66, $a4, $22, $a6, $03, $c8, $22, $dc, $02 .db $68, $f2, $96, $42, $13, $82, $17, $02, $af, $34 .db $f6, $21, $fc, $06, $26, $80, $2a, $24, $36, $01 .db $8c, $00, $ff, $35, $4e, $a0, $55, $21, $77, $20 .db $87, $07, $89, $22, $ae, $21, $4c, $82, $9f, $34 .db $ec, $01, $03, $e7, $13, $67, $8d, $4a, $ad, $41 .db $0f, $a6 .db $fd ;warp zone area used in level 4-2 L_GroundArea16: .db $10, $51 .db $4c, $00, $c7, $12, $c6, $42, $03, $92, $02, $42 .db $29, $12, $63, $12, $62, $42, $69, $14, $a5, $12 .db $a4, $42, $e2, $14, $e1, $44, $f8, $16, $37, $c1 .db $8f, $38, $02, $bb, $28, $7a, $68, $7a, $a8, $7a .db $e0, $6a, $f0, $6a, $6d, $c5 .db $fd ;level 8-1 L_GroundArea17: .db $92, $31 .db $0f, $20, $6e, $40, $0d, $02, $37, $73, $ec, $00 .db $0c, $80, $3c, $00, $6c, $00, $9c, $00, $06, $c0 .db $c7, $73, $06, $83, $28, $72, $96, $40, $e7, $73 .db $26, $c0, $87, $7b, $d2, $41, $39, $f1, $c8, $f2 .db $97, $e3, $a3, $23, $e7, $02, $e3, $07, $f3, $22 .db $37, $e3, $9c, $00, $bc, $00, $ec, $00, $0c, $80 .db $3c, $00, $86, $21, $a6, $06, $b6, $24, $5c, $80 .db $7c, $00, $9c, $00, $29, $e1, $dc, $05, $f6, $41 .db $dc, $80, $e8, $72, $0c, $81, $27, $73, $4c, $01 .db $66, $74, $0d, $11, $3f, $35, $b6, $41, $2c, $82 .db $36, $40, $7c, $02, $86, $40, $f9, $61, $39, $e1 .db $ac, $04, $c6, $41, $0c, $83, $16, $41, $88, $f2 .db $39, $f1, $7c, $00, $89, $61, $9c, $00, $a7, $63 .db $bc, $00, $c5, $65, $dc, $00, $e3, $67, $f3, $67 .db $8d, $c1, $cf, $26 .db $fd ;level 5-2 L_GroundArea18: .db $55, $b1 .db $0f, $26, $cf, $33, $07, $b2, $15, $11, $52, $42 .db $99, $0b, $ac, $02, $d3, $24, $d6, $42, $d7, $25 .db $23, $84, $cf, $33, $07, $e3, $19, $61, $78, $7a .db $ef, $33, $2c, $81, $46, $64, $55, $65, $65, $65 .db $ec, $74, $47, $82, $53, $05, $63, $21, $62, $41 .db $96, $22, $9a, $41, $cc, $03, $b9, $91, $39, $f1 .db $63, $26, $67, $27, $d3, $06, $fc, $01, $18, $e2 .db $d9, $07, $e9, $04, $0c, $86, $37, $22, $93, $24 .db $87, $84, $ac, $02, $c2, $41, $c3, $23, $d9, $71 .db $fc, $01, $7f, $b1, $9c, $00, $a7, $63, $b6, $64 .db $cc, $00, $d4, $66, $e3, $67, $f3, $67, $8d, $c1 .db $cf, $26 .db $fd ;level 8-2 L_GroundArea19: .db $50, $b1 .db $0f, $26, $fc, $00, $1f, $b3, $5c, $00, $65, $65 .db $74, $66, $83, $67, $93, $67, $dc, $73, $4c, $80 .db $b3, $20, $c9, $0b, $c3, $08, $d3, $2f, $dc, $00 .db $2c, $80, $4c, $00, $8c, $00, $d3, $2e, $ed, $4a .db $fc, $00, $d7, $a1, $ec, $01, $4c, $80, $59, $11 .db $d8, $11, $da, $10, $37, $a0, $47, $04, $99, $11 .db $e7, $21, $3a, $90, $67, $20, $76, $10, $77, $60 .db $87, $07, $d8, $12, $39, $f1, $ac, $00, $e9, $71 .db $0c, $80, $2c, $00, $4c, $05, $c7, $7b, $39, $f1 .db $ec, $00, $f9, $11, $0c, $82, $6f, $34, $f8, $11 .db $fa, $10, $7f, $b2, $ac, $00, $b6, $64, $cc, $01 .db $e3, $67, $f3, $67, $8d, $c1, $cf, $26 .db $fd ;level 7-1 L_GroundArea20: .db $52, $b1 .db $0f, $20, $6e, $45, $39, $91, $b3, $04, $c3, $21 .db $c8, $11, $ca, $10, $49, $91, $7c, $73, $e8, $12 .db $88, $91, $8a, $10, $e7, $21, $05, $91, $07, $30 .db $17, $07, $27, $20, $49, $11, $9c, $01, $c8, $72 .db $23, $a6, $27, $26, $d3, $03, $d8, $7a, $89, $91 .db $d8, $72, $39, $f1, $a9, $11, $09, $f1, $63, $24 .db $67, $24, $d8, $62, $28, $91, $2a, $10, $56, $21 .db $70, $04, $79, $0b, $8c, $00, $94, $21, $9f, $35 .db $2f, $b8, $3d, $c1, $7f, $26 .db $fd ;cloud level used in levels 3-1 and 6-2 L_GroundArea21: .db $06, $c1 .db $4c, $00, $f4, $4f, $0d, $02, $06, $20, $24, $4f .db $35, $a0, $36, $20, $53, $46, $d5, $20, $d6, $20 .db $34, $a1, $73, $49, $74, $20, $94, $20, $b4, $20 .db $d4, $20, $f4, $20, $2e, $80, $59, $42, $4d, $c7 .db $fd ;level 3-2 L_GroundArea22: .db $96, $31 .db $0f, $26, $0d, $03, $1a, $60, $77, $42, $c4, $00 .db $c8, $62, $b9, $e1, $d3, $06, $d7, $07, $f9, $61 .db $0c, $81, $4e, $b1, $8e, $b1, $bc, $01, $e4, $50 .db $e9, $61, $0c, $81, $0d, $0a, $84, $43, $98, $72 .db $0d, $0c, $0f, $38, $1d, $c1, $5f, $26 .db $fd ;level 1-2 L_UndergroundArea1: .db $48, $0f .db $0e, $01, $5e, $02, $a7, $00, $bc, $73, $1a, $e0 .db $39, $61, $58, $62, $77, $63, $97, $63, $b8, $62 .db $d6, $07, $f8, $62, $19, $e1, $75, $52, $86, $40 .db $87, $50, $95, $52, $93, $43, $a5, $21, $c5, $52 .db $d6, $40, $d7, $20, $e5, $06, $e6, $51, $3e, $8d .db $5e, $03, $67, $52, $77, $52, $7e, $02, $9e, $03 .db $a6, $43, $a7, $23, $de, $05, $fe, $02, $1e, $83 .db $33, $54, $46, $40, $47, $21, $56, $04, $5e, $02 .db $83, $54, $93, $52, $96, $07, $97, $50, $be, $03 .db $c7, $23, $fe, $02, $0c, $82, $43, $45, $45, $24 .db $46, $24, $90, $08, $95, $51, $78, $fa, $d7, $73 .db $39, $f1, $8c, $01, $a8, $52, $b8, $52, $cc, $01 .db $5f, $b3, $97, $63, $9e, $00, $0e, $81, $16, $24 .db $66, $04, $8e, $00, $fe, $01, $08, $d2, $0e, $06 .db $6f, $47, $9e, $0f, $0e, $82, $2d, $47, $28, $7a .db $68, $7a, $a8, $7a, $ae, $01, $de, $0f, $6d, $c5 .db $fd ;level 4-2 L_UndergroundArea2: .db $48, $0f .db $0e, $01, $5e, $02, $bc, $01, $fc, $01, $2c, $82 .db $41, $52, $4e, $04, $67, $25, $68, $24, $69, $24 .db $ba, $42, $c7, $04, $de, $0b, $b2, $87, $fe, $02 .db $2c, $e1, $2c, $71, $67, $01, $77, $00, $87, $01 .db $8e, $00, $ee, $01, $f6, $02, $03, $85, $05, $02 .db $13, $21, $16, $02, $27, $02, $2e, $02, $88, $72 .db $c7, $20, $d7, $07, $e4, $76, $07, $a0, $17, $06 .db $48, $7a, $76, $20, $98, $72, $79, $e1, $88, $62 .db $9c, $01, $b7, $73, $dc, $01, $f8, $62, $fe, $01 .db $08, $e2, $0e, $00, $6e, $02, $73, $20, $77, $23 .db $83, $04, $93, $20, $ae, $00, $fe, $0a, $0e, $82 .db $39, $71, $a8, $72, $e7, $73, $0c, $81, $8f, $32 .db $ae, $00, $fe, $04, $04, $d1, $17, $04, $26, $49 .db $27, $29, $df, $33, $fe, $02, $44, $f6, $7c, $01 .db $8e, $06, $bf, $47, $ee, $0f, $4d, $c7, $0e, $82 .db $68, $7a, $ae, $01, $de, $0f, $6d, $c5 .db $fd ;underground bonus rooms area used in many levels L_UndergroundArea3: .db $48, $01 .db $0e, $01, $00, $5a, $3e, $06, $45, $46, $47, $46 .db $53, $44, $ae, $01, $df, $4a, $4d, $c7, $0e, $81 .db $00, $5a, $2e, $04, $37, $28, $3a, $48, $46, $47 .db $c7, $07, $ce, $0f, $df, $4a, $4d, $c7, $0e, $81 .db $00, $5a, $33, $53, $43, $51, $46, $40, $47, $50 .db $53, $04, $55, $40, $56, $50, $62, $43, $64, $40 .db $65, $50, $71, $41, $73, $51, $83, $51, $94, $40 .db $95, $50, $a3, $50, $a5, $40, $a6, $50, $b3, $51 .db $b6, $40, $b7, $50, $c3, $53, $df, $4a, $4d, $c7 .db $0e, $81, $00, $5a, $2e, $02, $36, $47, $37, $52 .db $3a, $49, $47, $25, $a7, $52, $d7, $04, $df, $4a .db $4d, $c7, $0e, $81, $00, $5a, $3e, $02, $44, $51 .db $53, $44, $54, $44, $55, $24, $a1, $54, $ae, $01 .db $b4, $21, $df, $4a, $e5, $07, $4d, $c7 .db $fd ;water area used in levels 5-2 and 6-2 L_WaterArea1: .db $41, $01 .db $b4, $34, $c8, $52, $f2, $51, $47, $d3, $6c, $03 .db $65, $49, $9e, $07, $be, $01, $cc, $03, $fe, $07 .db $0d, $c9, $1e, $01, $6c, $01, $62, $35, $63, $53 .db $8a, $41, $ac, $01, $b3, $53, $e9, $51, $26, $c3 .db $27, $33, $63, $43, $64, $33, $ba, $60, $c9, $61 .db $ce, $0b, $e5, $09, $ee, $0f, $7d, $ca, $7d, $47 .db $fd ;level 2-2/7-2 L_WaterArea2: .db $41, $01 .db $b8, $52, $ea, $41, $27, $b2, $b3, $42, $16, $d4 .db $4a, $42, $a5, $51, $a7, $31, $27, $d3, $08, $e2 .db $16, $64, $2c, $04, $38, $42, $76, $64, $88, $62 .db $de, $07, $fe, $01, $0d, $c9, $23, $32, $31, $51 .db $98, $52, $0d, $c9, $59, $42, $63, $53, $67, $31 .db $14, $c2, $36, $31, $87, $53, $17, $e3, $29, $61 .db $30, $62, $3c, $08, $42, $37, $59, $40, $6a, $42 .db $99, $40, $c9, $61, $d7, $63, $39, $d1, $58, $52 .db $c3, $67, $d3, $31, $dc, $06, $f7, $42, $fa, $42 .db $23, $b1, $43, $67, $c3, $34, $c7, $34, $d1, $51 .db $43, $b3, $47, $33, $9a, $30, $a9, $61, $b8, $62 .db $be, $0b, $d5, $09, $de, $0f, $0d, $ca, $7d, $47 .db $fd ;water area used in level 8-4 L_WaterArea3: .db $49, $0f .db $1e, $01, $39, $73, $5e, $07, $ae, $0b, $1e, $82 .db $6e, $88, $9e, $02, $0d, $04, $2e, $0b, $45, $09 .db $4e, $0f, $ed, $47 .db $fd ;------------------------------------------------------------------------------------- ;unused space .db $ff ;------------------------------------------------------------------------------------- ;indirect jump routine called when ;$0770 is set to 1 GameMode: lda OperMode_Task jsr JumpEngine .dw InitializeArea .dw ScreenRoutines .dw SecondaryGameSetup .dw GameCoreRoutine ;------------------------------------------------------------------------------------- GameCoreRoutine: ldx CurrentPlayer ;get which player is on the screen lda SavedJoypadBits,x ;use appropriate player's controller bits sta SavedJoypadBits ;as the master controller bits jsr GameRoutines ;execute one of many possible subs lda OperMode_Task ;check major task of operating mode cmp #$03 ;if we are supposed to be here, bcs GameEngine ;branch to the game engine itself rts GameEngine: jsr ProcFireball_Bubble ;process fireballs and air bubbles ldx #$00 ProcELoop: stx <ObjectOffset ;put incremented offset in X as enemy object offset jsr EnemiesAndLoopsCore ;process enemy objects jsr FloateyNumbersRoutine ;process floatey numbers inx cpx #$06 ;do these two subroutines until the whole buffer is done bne ProcELoop jsr GetPlayerOffscreenBits ;get offscreen bits for player object jsr RelativePlayerPosition ;get relative coordinates for player object jsr PlayerGfxHandler ;draw the player jsr BlockObjMT_Updater ;replace block objects with metatiles if necessary ldx #$01 stx <ObjectOffset ;set offset for second jsr BlockObjectsCore ;process second block object dex stx <ObjectOffset ;set offset for first jsr BlockObjectsCore ;process first block object jsr MiscObjectsCore ;process misc objects (hammer, jumping coins) jsr ProcessCannons ;process bullet bill cannons jsr ProcessWhirlpools ;process whirlpools jsr FlagpoleRoutine ;process the flagpole jsr RunGameTimer ;count down the game timer jsr ColorRotation ;cycle one of the background colors lda <Player_Y_HighPos cmp #$02 ;if player is below the screen, don't bother with the music bpl NoChgMus lda StarInvincibleTimer ;if star mario invincibility timer at zero, beq ClrPlrPal ;skip this part cmp #$04 bne NoChgMus ;if not yet at a certain point, continue lda IntervalTimerControl ;if interval timer not yet expired, bne NoChgMus ;branch ahead, don't bother with the music jsr GetAreaMusic ;to re-attain appropriate level music NoChgMus: ldy StarInvincibleTimer ;get invincibility timer lda <FrameCounter ;get frame counter cpy #$08 ;if timer still above certain point, bcs CycleTwo ;branch to cycle player's palette quickly lsr a ;otherwise, divide by 8 to cycle every eighth frame lsr a CycleTwo: lsr a ;if branched here, divide by 2 to cycle every other frame jsr CyclePlayerPalette ;do sub to cycle the palette (note: shares fire flower code) jmp SaveAB ;then skip this sub to finish up the game engine ClrPlrPal: jsr ResetPalStar ;do sub to clear player's palette bits in attributes SaveAB: lda <A_B_Buttons ;save current A and B button sta <PreviousA_B_Buttons ;into temp variable to be used on next frame lda #$00 sta <Left_Right_Buttons ;nullify left and right buttons temp variable UpdScrollVar: lda VRAM_Buffer_AddrCtrl cmp #$06 ;if vram address controller set to 6 (one of two $0341s) beq ExitEng ;then branch to leave lda AreaParserTaskNum ;otherwise check number of tasks bne RunParser lda ScrollThirtyTwo ;get horizontal scroll in 0-31 or $00-$20 range cmp #$20 ;check to see if exceeded $21 bmi ExitEng ;branch to leave if not lda ScrollThirtyTwo sbc #$20 ;otherwise subtract $20 to set appropriately sta ScrollThirtyTwo ;and store lda #$00 ;reset vram buffer offset used in conjunction with sta VRAM_Buffer2_Offset ;level graphics buffer at $0341-$035f RunParser: jsr AreaParserTaskHandler ;update the name table with more level graphics ExitEng: rts ;and after all that, we're finally done! ;------------------------------------------------------------------------------------- ScrollHandler: lda Player_X_Scroll ;load value saved here clc adc Platform_X_Scroll ;add value used by left/right platforms sta Player_X_Scroll ;save as new value here to impose force on scroll lda ScrollLock ;check scroll lock flag bne InitScrlAmt ;skip a bunch of code here if set lda Player_Pos_ForScroll cmp #$50 ;check player's horizontal screen position bcc InitScrlAmt ;if less than 80 pixels to the right, branch lda SideCollisionTimer ;if timer related to player's side collision bne InitScrlAmt ;not expired, branch ldy Player_X_Scroll ;get value and decrement by one dey ;if value originally set to zero or otherwise bmi InitScrlAmt ;negative for left movement, branch iny cpy #$02 ;if value $01, branch and do not decrement bcc ChkNearMid dey ;otherwise decrement by one ChkNearMid: lda Player_Pos_ForScroll cmp #$70 ;check player's horizontal screen position bcc ScrollScreen ;if less than 112 pixels to the right, branch ldy Player_X_Scroll ;otherwise get original value undecremented ScrollScreen: tya sta ScrollAmount ;save value here clc adc ScrollThirtyTwo ;add to value already set here sta ScrollThirtyTwo ;save as new value here tya clc adc ScreenLeft_X_Pos ;add to left side coordinate sta ScreenLeft_X_Pos ;save as new left side coordinate sta HorizontalScroll ;save here also lda ScreenLeft_PageLoc adc #$00 ;add carry to page location for left sta ScreenLeft_PageLoc ;side of the screen and #$01 ;get LSB of page location sta <$00 ;save as temp variable for PPU register 1 mirror lda Mirror_PPU_CTRL_REG1 ;get PPU register 1 mirror and #%11111110 ;save all bits except d0 ora <$00 ;get saved bit here and save in PPU register 1 sta Mirror_PPU_CTRL_REG1 ;mirror to be used to set name table later jsr GetScreenPosition ;figure out where the right side is lda #$08 sta ScrollIntervalTimer ;set scroll timer (residual, not used elsewhere) jmp ChkPOffscr ;skip this part InitScrlAmt: lda #$00 sta ScrollAmount ;initialize value here ChkPOffscr: ldx #$00 ;set X for player offset jsr GetXOffscreenBits ;get horizontal offscreen bits for player sta <$00 ;save them here ldy #$00 ;load default offset (left side) asl a ;if d7 of offscreen bits are set, bcs KeepOnscr ;branch with default offset iny ;otherwise use different offset (right side) lda <$00 and #%00100000 ;check offscreen bits for d5 set beq InitPlatScrl ;if not set, branch ahead of this part KeepOnscr: lda ScreenEdge_X_Pos,y ;get left or right side coordinate based on offset sec sbc X_SubtracterData,y ;subtract amount based on offset sta <Player_X_Position ;store as player position to prevent movement further lda ScreenEdge_PageLoc,y ;get left or right page location based on offset sbc #$00 ;subtract borrow sta <Player_PageLoc ;save as player's page location lda <Left_Right_Buttons ;check saved controller bits cmp OffscrJoypadBitsData,y ;against bits based on offset beq InitPlatScrl ;if not equal, branch lda #$00 sta <Player_X_Speed ;otherwise nullify horizontal speed of player InitPlatScrl: lda #$00 ;nullify platform force imposed on scroll sta Platform_X_Scroll rts X_SubtracterData: .db $00, $10 OffscrJoypadBitsData: .db $01, $02 ;------------------------------------------------------------------------------------- GetScreenPosition: lda ScreenLeft_X_Pos ;get coordinate of screen's left boundary clc adc #$ff ;add 255 pixels sta ScreenRight_X_Pos ;store as coordinate of screen's right boundary lda ScreenLeft_PageLoc ;get page number where left boundary is adc #$00 ;add carry from before sta ScreenRight_PageLoc ;store as page number where right boundary is rts ;------------------------------------------------------------------------------------- GameRoutines: lda <GameEngineSubroutine ;run routine based on number (a few of these routines are jsr JumpEngine ;merely placeholders as conditions for other routines) .dw Entrance_GameTimerSetup .dw Vine_AutoClimb .dw SideExitPipeEntry .dw VerticalPipeEntry .dw FlagpoleSlide .dw PlayerEndLevel .dw PlayerLoseLife .dw PlayerEntrance .dw PlayerCtrlRoutine .dw PlayerChangeSize .dw PlayerInjuryBlink .dw PlayerDeath .dw PlayerFireFlower ;------------------------------------------------------------------------------------- PlayerEntrance: lda AltEntranceControl ;check for mode of alternate entry cmp #$02 beq EntrMode2 ;if found, branch to enter from pipe or with vine lda #$00 ldy <Player_Y_Position ;if vertical position above a certain cpy #$30 ;point, nullify controller bits and continue bcc AutoControlPlayer ;with player movement code, do not return lda PlayerEntranceCtrl ;check player entry bits from header cmp #$06 beq ChkBehPipe ;if set to 6 or 7, execute pipe intro code cmp #$07 ;otherwise branch to normal entry bne PlayerRdy ChkBehPipe: lda Player_SprAttrib ;check for sprite attributes bne IntroEntr ;branch if found lda #$01 jmp AutoControlPlayer ;force player to walk to the right IntroEntr: jsr EnterSidePipe ;execute sub to move player to the right dec ChangeAreaTimer ;decrement timer for change of area bne ExitEntr ;branch to exit if not yet expired inc DisableIntermediate ;set flag to skip world and lives display jmp NextArea ;jump to increment to next area and set modes EntrMode2: lda JoypadOverride ;if controller override bits set here, bne VineEntr ;branch to enter with vine lda #$ff ;otherwise, set value here then execute sub jsr MovePlayerYAxis ;to move player upwards (note $ff = -1) lda <Player_Y_Position ;check to see if player is at a specific coordinate cmp #$91 ;if player risen to a certain point (this requires pipes bcc PlayerRdy ;to be at specific height to look/function right) branch rts ;to the last part, otherwise leave VineEntr: lda VineHeight cmp #$60 ;check vine height bne ExitEntr ;if vine not yet reached maximum height, branch to leave lda <Player_Y_Position ;get player's vertical coordinate cmp #$99 ;check player's vertical coordinate against preset value ldy #$00 ;load default values to be written to lda #$01 ;this value moves player to the right off the vine bcc OffVine ;if vertical coordinate < preset value, use defaults lda #$03 sta <Player_State ;otherwise set player state to climbing iny ;increment value in Y lda #$08 ;set block in block buffer to cover hole, then STA Block_Buffer_1+180 ; sta Block_Buffer_1+$b4 ;use same value to force player to climb OffVine: sty DisableCollisionDet ;set collision detection disable flag jsr AutoControlPlayer ;use contents of A to move player up or right, execute sub lda <Player_X_Position cmp #$48 ;check player's horizontal position bcc ExitEntr ;if not far enough to the right, branch to leave PlayerRdy: lda #$08 ;set routine to be executed by game engine next frame sta <GameEngineSubroutine lda #$01 ;set to face player to the right sta <PlayerFacingDir lsr a ;init A sta AltEntranceControl ;init mode of entry sta DisableCollisionDet ;init collision detection disable flag sta JoypadOverride ;nullify controller override bits ExitEntr: rts ;leave! ;------------------------------------------------------------------------------------- ;$07 - used to hold upper limit of high byte when player falls down hole AutoControlPlayer: sta SavedJoypadBits ;override controller bits with contents of A if executing here PlayerCtrlRoutine: lda <GameEngineSubroutine ;check task here cmp #$0b ;if certain value is set, branch to skip controller bit loading beq SizeChk lda AreaType ;are we in a water type area? bne SaveJoyp ;if not, branch ldy <Player_Y_HighPos dey ;if not in vertical area between bne DisJoyp ;status bar and bottom, branch lda <Player_Y_Position cmp #$d0 ;if nearing the bottom of the screen or bcc SaveJoyp ;not in the vertical area between status bar or bottom, DisJoyp: lda #$00 ;disable controller bits sta SavedJoypadBits SaveJoyp: lda SavedJoypadBits ;otherwise store A and B buttons in $0a and #%11000000 sta <A_B_Buttons lda SavedJoypadBits ;store left and right buttons in $0c and #%00000011 sta <Left_Right_Buttons lda SavedJoypadBits ;store up and down buttons in $0b and #%00001100 sta <Up_Down_Buttons and #%00000100 ;check for pressing down beq SizeChk ;if not, branch lda <Player_State ;check player's state bne SizeChk ;if not on the ground, branch ldy <Left_Right_Buttons ;check left and right beq SizeChk ;if neither pressed, branch lda #$00 sta <Left_Right_Buttons ;if pressing down while on the ground, sta <Up_Down_Buttons ;nullify directional bits SizeChk: jsr PlayerMovementSubs ;run movement subroutines ldy #$01 ;is player small? lda PlayerSize bne ChkMoveDir ldy #$00 ;check for if crouching lda CrouchingFlag beq ChkMoveDir ;if not, branch ahead ldy #$02 ;if big and crouching, load y with 2 ChkMoveDir: sty Player_BoundBoxCtrl ;set contents of Y as player's bounding box size control lda #$01 ;set moving direction to right by default ldy <Player_X_Speed ;check player's horizontal speed beq PlayerSubs ;if not moving at all horizontally, skip this part bpl SetMoveDir ;if moving to the right, use default moving direction asl a ;otherwise change to move to the left SetMoveDir: sta <Player_MovingDir ;set moving direction PlayerSubs: jsr ScrollHandler ;move the screen if necessary jsr GetPlayerOffscreenBits ;get player's offscreen bits jsr RelativePlayerPosition ;get coordinates relative to the screen ldx #$00 ;set offset for player object jsr BoundingBoxCore ;get player's bounding box coordinates jsr PlayerBGCollision ;do collision detection and process lda <Player_Y_Position cmp #$40 ;check to see if player is higher than 64th pixel bcc PlayerHole ;if so, branch ahead lda <GameEngineSubroutine cmp #$05 ;if running end-of-level routine, branch ahead beq PlayerHole cmp #$07 ;if running player entrance routine, branch ahead beq PlayerHole cmp #$04 ;if running routines $00-$03, branch ahead bcc PlayerHole lda Player_SprAttrib and #%11011111 ;otherwise nullify player's sta Player_SprAttrib ;background priority flag PlayerHole: lda <Player_Y_HighPos ;check player's vertical high byte cmp #$02 ;for below the screen bmi ExitCtrl ;branch to leave if not that far down ldx #$01 stx ScrollLock ;set scroll lock ldy #$04 sty <$07 ;set value here ldx #$00 ;use X as flag, and clear for cloud level ldy GameTimerExpiredFlag ;check game timer expiration flag bne HoleDie ;if set, branch ldy CloudTypeOverride ;check for cloud type override bne ChkHoleX ;skip to last part if found HoleDie: inx ;set flag in X for player death ldy <GameEngineSubroutine cpy #$0b ;check for some other routine running beq ChkHoleX ;if so, branch ahead ldy DeathMusicLoaded ;check value here bne HoleBottom ;if already set, branch to next part iny sty <EventMusicQueue ;otherwise play death music sty DeathMusicLoaded ;and set value here HoleBottom: ldy #$06 sty <$07 ;change value here ChkHoleX: cmp <$07 ;compare vertical high byte with value set here bmi ExitCtrl ;if less, branch to leave dex ;otherwise decrement flag in X bmi CloudExit ;if flag was clear, branch to set modes and other values ldy EventMusicBuffer ;check to see if music is still playing bne ExitCtrl ;branch to leave if so lda #$06 ;otherwise set to run lose life routine sta <GameEngineSubroutine ;on next frame ExitCtrl: rts ;leave CloudExit: lda #$00 sta JoypadOverride ;clear controller override bits if any are set jsr SetEntr ;do sub to set secondary mode inc AltEntranceControl ;set mode of entry to 3 rts ;------------------------------------------------------------------------------------- Vine_AutoClimb: lda <Player_Y_HighPos ;check to see whether player reached position bne AutoClimb ;above the status bar yet and if so, set modes lda <Player_Y_Position cmp #$e4 bcc SetEntr AutoClimb: lda #%00001000 ;set controller bits override to up sta JoypadOverride ldy #$03 ;set player state to climbing sty <Player_State jmp AutoControlPlayer SetEntr: lda #$02 ;set starting position to override sta AltEntranceControl jmp ChgAreaMode ;set modes ;------------------------------------------------------------------------------------- VerticalPipeEntry: lda #$01 ;set 1 as movement amount jsr MovePlayerYAxis ;do sub to move player downwards jsr ScrollHandler ;do sub to scroll screen with saved force if necessary ldy #$00 ;load default mode of entry lda WarpZoneControl ;check warp zone control variable/flag bne ChgAreaPipe ;if set, branch to use mode 0 iny lda AreaType ;check for castle level type cmp #$03 bne ChgAreaPipe ;if not castle type level, use mode 1 iny jmp ChgAreaPipe ;otherwise use mode 2 MovePlayerYAxis: clc adc <Player_Y_Position ;add contents of A to player position sta <Player_Y_Position rts ;------------------------------------------------------------------------------------- SideExitPipeEntry: jsr EnterSidePipe ;execute sub to move player to the right ldy #$02 ChgAreaPipe: dec ChangeAreaTimer ;decrement timer for change of area bne ExitCAPipe sty AltEntranceControl ;when timer expires set mode of alternate entry ChgAreaMode: inc DisableScreenFlag ;set flag to disable screen output lda #$00 sta OperMode_Task ;set secondary mode of operation sta Sprite0HitDetectFlag ;disable sprite 0 check ExitCAPipe: rts ;leave EnterSidePipe: lda #$08 ;set player's horizontal speed sta <Player_X_Speed ldy #$01 ;set controller right button by default lda <Player_X_Position ;mask out higher nybble of player's and #%00001111 ;horizontal position bne RightPipe sta <Player_X_Speed ;if lower nybble = 0, set as horizontal speed tay ;and nullify controller bit override here RightPipe: tya ;use contents of Y to jsr AutoControlPlayer ;execute player control routine with ctrl bits nulled rts ;------------------------------------------------------------------------------------- PlayerChangeSize: lda TimerControl ;check master timer control cmp #$f8 ;for specific moment in time bne EndChgSize ;branch if before or after that point jmp InitChangeSize ;otherwise run code to get growing/shrinking going EndChgSize: cmp #$c4 ;check again for another specific moment bne ExitChgSize ;and branch to leave if before or after that point jsr DonePlayerTask ;otherwise do sub to init timer control and set routine ExitChgSize: rts ;and then leave ;------------------------------------------------------------------------------------- PlayerInjuryBlink: lda TimerControl ;check master timer control cmp #$f0 ;for specific moment in time bcs ExitBlink ;branch if before that point cmp #$c8 ;check again for another specific point beq DonePlayerTask ;branch if at that point, and not before or after jmp PlayerCtrlRoutine ;otherwise run player control routine ExitBlink: bne ExitBoth ;do unconditional branch to leave InitChangeSize: ldy PlayerChangeSizeFlag ;if growing/shrinking flag already set bne ExitBoth ;then branch to leave sty PlayerAnimCtrl ;otherwise initialize player's animation frame control inc PlayerChangeSizeFlag ;set growing/shrinking flag lda PlayerSize eor #$01 ;invert player's size sta PlayerSize ExitBoth: rts ;leave ;------------------------------------------------------------------------------------- ;$00 - used in CyclePlayerPalette to store current palette to cycle PlayerDeath: lda TimerControl ;check master timer control cmp #$f0 ;for specific moment in time bcs ExitDeath ;branch to leave if before that point jmp PlayerCtrlRoutine ;otherwise run player control routine DonePlayerTask: lda #$00 sta TimerControl ;initialize master timer control to continue timers lda #$08 sta <GameEngineSubroutine ;set player control routine to run next frame rts ;leave PlayerFireFlower: lda TimerControl ;check master timer control cmp #$c0 ;for specific moment in time beq ResetPalFireFlower ;branch if at moment, not before or after lda <FrameCounter ;get frame counter lsr a lsr a ;divide by four to change every four frames CyclePlayerPalette: and #$03 ;mask out all but d1-d0 (previously d3-d2) sta <$00 ;store result here to use as palette bits lda Player_SprAttrib ;get player attributes and #%11111100 ;save any other bits but palette bits ora <$00 ;add palette bits sta Player_SprAttrib ;store as new player attributes rts ;and leave ResetPalFireFlower: jsr DonePlayerTask ;do sub to init timer control and run player control routine ResetPalStar: lda Player_SprAttrib ;get player attributes and #%11111100 ;mask out palette bits to force palette 0 sta Player_SprAttrib ;store as new player attributes rts ;and leave ExitDeath: rts ;leave from death routine ;------------------------------------------------------------------------------------- FlagpoleSlide: lda <Enemy_ID+5 ;check special use enemy slot cmp #FlagpoleFlagObject ;for flagpole flag object bne NoFPObj ;if not found, branch to something residual lda FlagpoleSoundQueue ;load flagpole sound sta <Square1SoundQueue ;into square 1's sfx queue lda #$00 sta FlagpoleSoundQueue ;init flagpole sound queue ldy <Player_Y_Position cpy #$9e ;check to see if player has slid down bcs SlidePlayer ;far enough, and if so, branch with no controller bits set lda #$04 ;otherwise force player to climb down (to slide) SlidePlayer: jmp AutoControlPlayer ;jump to player control routine NoFPObj: inc <GameEngineSubroutine ;increment to next routine (this may rts ;be residual code) ;------------------------------------------------------------------------------------- Hidden1UpCoinAmts: .db $15, $23, $16, $1b, $17, $18, $23, $63 PlayerEndLevel: lda #$01 ;force player to walk to the right jsr AutoControlPlayer lda <Player_Y_Position ;check player's vertical position cmp #$ae bcc ChkStop ;if player is not yet off the flagpole, skip this part lda ScrollLock ;if scroll lock not set, branch ahead to next part beq ChkStop ;because we only need to do this part once lda #EndOfLevelMusic sta <EventMusicQueue ;load win level music in event music queue lda #$00 sta ScrollLock ;turn off scroll lock to skip this part later ChkStop: lda Player_CollisionBits ;get player collision bits lsr a ;check for d0 set bcs RdyNextA ;if d0 set, skip to next part lda StarFlagTaskControl ;if star flag task control already set, bne InCastle ;go ahead with the rest of the code inc StarFlagTaskControl ;otherwise set task control now (this gets ball rolling!) InCastle: lda #%00100000 ;set player's background priority bit to sta Player_SprAttrib ;give illusion of being inside the castle RdyNextA: lda StarFlagTaskControl cmp #$05 ;if star flag task control not yet set bne ExitNA ;beyond last valid task number, branch to leave inc LevelNumber ;increment level number used for game logic lda LevelNumber cmp #$03 ;check to see if we have yet reached level -4 bne NextArea ;and skip this last part here if not ldy WorldNumber ;get world number as offset lda CoinTallyFor1Ups ;check third area coin tally for bonus 1-ups cmp Hidden1UpCoinAmts,y ;against minimum value, if player has not collected bcc NextArea ;at least this number of coins, leave flag clear inc Hidden1UpFlag ;otherwise set hidden 1-up box control flag NextArea: inc AreaNumber ;increment area number used for address loader jsr LoadAreaPointer ;get new level pointer inc FetchNewGameTimerFlag ;set flag to load new game timer jsr ChgAreaMode ;do sub to set secondary mode, disable screen and sprite 0 sta HalfwayPage ;reset halfway page to 0 (beginning) lda #Silence sta <EventMusicQueue ;silence music and leave ExitNA: rts ;------------------------------------------------------------------------------------- PlayerMovementSubs: lda #$00 ;set A to init crouch flag by default ldy PlayerSize ;is player small? bne SetCrouch ;if so, branch lda <Player_State ;check state of player bne ProcMove ;if not on the ground, branch lda <Up_Down_Buttons ;load controller bits for up and down and #%00000100 ;single out bit for down button SetCrouch: sta CrouchingFlag ;store value in crouch flag ProcMove: jsr PlayerPhysicsSub ;run sub related to jumping and swimming lda PlayerChangeSizeFlag ;if growing/shrinking flag set, bne NoMoveSub ;branch to leave lda <Player_State cmp #$03 ;get player state beq MoveSubs ;if climbing, branch ahead, leave timer unset ldy #$18 sty ClimbSideTimer ;otherwise reset timer now MoveSubs: jsr JumpEngine .dw OnGroundStateSub .dw JumpSwimSub .dw FallingSub .dw ClimbingSub NoMoveSub: rts ;------------------------------------------------------------------------------------- ;$00 - used by ClimbingSub to store high vertical adder OnGroundStateSub: jsr GetPlayerAnimSpeed ;do a sub to set animation frame timing lda <Left_Right_Buttons beq GndMove ;if left/right controller bits not set, skip instruction sta <PlayerFacingDir ;otherwise set new facing direction GndMove: jsr ImposeFriction ;do a sub to impose friction on player's walk/run jsr MovePlayerHorizontally ;do another sub to move player horizontally sta Player_X_Scroll ;set returned value as player's movement speed for scroll rts ;-------------------------------- FallingSub: lda VerticalForceDown sta VerticalForce ;dump vertical movement force for falling into main one jmp LRAir ;movement force, then skip ahead to process left/right movement ;-------------------------------- JumpSwimSub: ldy <Player_Y_Speed ;if player's vertical speed zero bpl DumpFall ;or moving downwards, branch to falling lda <A_B_Buttons and #A_Button ;check to see if A button is being pressed and <PreviousA_B_Buttons ;and was pressed in previous frame bne ProcSwim ;if so, branch elsewhere lda JumpOrigin_Y_Position ;get vertical position player jumped from sec sbc <Player_Y_Position ;subtract current from original vertical coordinate cmp DiffToHaltJump ;compare to value set here to see if player is in mid-jump bcc ProcSwim ;or just starting to jump, if just starting, skip ahead DumpFall: lda VerticalForceDown ;otherwise dump falling into main fractional sta VerticalForce ProcSwim: lda SwimmingFlag ;if swimming flag not set, beq LRAir ;branch ahead to last part jsr GetPlayerAnimSpeed ;do a sub to get animation frame timing lda <Player_Y_Position cmp #$14 ;check vertical position against preset value bcs LRWater ;if not yet reached a certain position, branch ahead lda #$18 sta VerticalForce ;otherwise set fractional LRWater: lda <Left_Right_Buttons ;check left/right controller bits (check for swimming) beq LRAir ;if not pressing any, skip sta <PlayerFacingDir ;otherwise set facing direction accordingly LRAir: lda <Left_Right_Buttons ;check left/right controller bits (check for jumping/falling) beq JSMove ;if not pressing any, skip jsr ImposeFriction ;otherwise process horizontal movement JSMove: jsr MovePlayerHorizontally ;do a sub to move player horizontally sta Player_X_Scroll ;set player's speed here, to be used for scroll later lda <GameEngineSubroutine cmp #$0b ;check for specific routine selected bne ExitMov1 ;branch if not set to run lda #$28 sta VerticalForce ;otherwise set fractional ExitMov1: jmp MovePlayerVertically ;jump to move player vertically, then leave ;-------------------------------- ClimbAdderLow: .db $0e, $04, $fc, $f2 ClimbAdderHigh: .db $00, $00, $ff, $ff ClimbingSub: lda Player_YMF_Dummy clc ;add movement force to dummy variable adc Player_Y_MoveForce ;save with carry sta Player_YMF_Dummy ldy #$00 ;set default adder here lda <Player_Y_Speed ;get player's vertical speed bpl MoveOnVine ;if not moving upwards, branch dey ;otherwise set adder to $ff MoveOnVine: sty <$00 ;store adder here adc <Player_Y_Position ;add carry to player's vertical position sta <Player_Y_Position ;and store to move player up or down lda <Player_Y_HighPos adc <$00 ;add carry to player's page location sta <Player_Y_HighPos ;and store lda <Left_Right_Buttons ;compare left/right controller bits and Player_CollisionBits ;to collision flag beq InitCSTimer ;if not set, skip to end ldy ClimbSideTimer ;otherwise check timer bne ExitCSub ;if timer not expired, branch to leave ldy #$18 sty ClimbSideTimer ;otherwise set timer now ldx #$00 ;set default offset here ldy <PlayerFacingDir ;get facing direction lsr a ;move right button controller bit to carry bcs ClimbFD ;if controller right pressed, branch ahead inx inx ;otherwise increment offset by 2 bytes ClimbFD: dey ;check to see if facing right beq CSetFDir ;if so, branch, do not increment inx ;otherwise increment by 1 byte CSetFDir: lda <Player_X_Position clc ;add or subtract from player's horizontal position adc ClimbAdderLow,x ;using value here as adder and X as offset sta <Player_X_Position lda <Player_PageLoc ;add or subtract carry or borrow using value here adc ClimbAdderHigh,x ;from the player's page location sta <Player_PageLoc lda <Left_Right_Buttons ;get left/right controller bits again eor #%00000011 ;invert them and store them while player sta <PlayerFacingDir ;is on vine to face player in opposite direction ExitCSub: rts ;then leave InitCSTimer: sta ClimbSideTimer ;initialize timer here rts ;------------------------------------------------------------------------------------- ;$00 - used to store offset to friction data JumpMForceData: .db $20, $20, $1e, $28, $28, $0d, $04 FallMForceData: .db $70, $70, $60, $90, $90, $0a, $09 PlayerYSpdData: .db $fc, $fc, $fc, $fb, $fb, $fe, $ff InitMForceData: .db $00, $00, $00, $00, $00, $80, $00 MaxLeftXSpdData: .db $d8, $e8, $f0 MaxRightXSpdData: .db $28, $18, $10 .db $0c ;used for pipe intros FrictionData: .db $e4, $98, $d0 Climb_Y_SpeedData: .db $00, $ff, $01 Climb_Y_MForceData: .db $00, $20, $ff PlayerPhysicsSub: lda <Player_State ;check player state cmp #$03 bne CheckForJumping ;if not climbing, branch ldy #$00 lda <Up_Down_Buttons ;get controller bits for up/down and Player_CollisionBits ;check against player's collision detection bits beq ProcClimb ;if not pressing up or down, branch iny and #%00001000 ;check for pressing up bne ProcClimb iny ProcClimb: ldx Climb_Y_MForceData,y ;load value here stx Player_Y_MoveForce ;store as vertical movement force lda #$08 ;load default animation timing ldx Climb_Y_SpeedData,y ;load some other value here stx <Player_Y_Speed ;store as vertical speed bmi SetCAnim ;if climbing down, use default animation timing value lsr a ;otherwise divide timer setting by 2 SetCAnim: sta PlayerAnimTimerSet ;store animation timer setting and leave rts CheckForJumping: lda JumpspringAnimCtrl ;if jumpspring animating, bne NoJump ;skip ahead to something else lda <A_B_Buttons ;check for A button press and #A_Button beq NoJump ;if not, branch to something else and <PreviousA_B_Buttons ;if button not pressed in previous frame, branch beq ProcJumping NoJump: jmp X_Physics ;otherwise, jump to something else ProcJumping: lda <Player_State ;check player state beq InitJS ;if on the ground, branch lda SwimmingFlag ;if swimming flag not set, jump to do something else beq NoJump ;to prevent midair jumping, otherwise continue lda JumpSwimTimer ;if jump/swim timer nonzero, branch bne InitJS lda <Player_Y_Speed ;check player's vertical speed bpl InitJS ;if player's vertical speed motionless or down, branch jmp X_Physics ;if timer at zero and player still rising, do not swim InitJS: lda #$20 ;set jump/swim timer sta JumpSwimTimer ldy #$00 ;initialize vertical force and dummy variable sty Player_YMF_Dummy sty Player_Y_MoveForce lda <Player_Y_HighPos ;get vertical high and low bytes of jump origin sta JumpOrigin_Y_HighPos ;and store them next to each other here lda <Player_Y_Position sta JumpOrigin_Y_Position lda #$01 ;set player state to jumping/swimming sta <Player_State lda Player_XSpeedAbsolute ;check value related to walking/running speed cmp #$09 bcc ChkWtr ;branch if below certain values, increment Y iny ;for each amount equal or exceeded cmp #$10 bcc ChkWtr iny cmp #$19 bcc ChkWtr iny cmp #$1c bcc ChkWtr ;note that for jumping, range is 0-4 for Y iny ChkWtr: lda #$01 ;set value here (apparently always set to 1) sta DiffToHaltJump lda SwimmingFlag ;if swimming flag disabled, branch beq GetYPhy ldy #$05 ;otherwise set Y to 5, range is 5-6 lda Whirlpool_Flag ;if whirlpool flag not set, branch beq GetYPhy iny ;otherwise increment to 6 GetYPhy: lda JumpMForceData,y ;store appropriate jump/swim sta VerticalForce ;data here lda FallMForceData,y sta VerticalForceDown lda InitMForceData,y sta Player_Y_MoveForce lda PlayerYSpdData,y sta <Player_Y_Speed lda SwimmingFlag ;if swimming flag disabled, branch beq PJumpSnd lda #Sfx_EnemyStomp ;load swim/goomba stomp sound into sta <Square1SoundQueue ;square 1's sfx queue lda <Player_Y_Position cmp #$14 ;check vertical low byte of player position bcs X_Physics ;if below a certain point, branch lda #$00 ;otherwise reset player's vertical speed sta <Player_Y_Speed ;and jump to something else to keep player jmp X_Physics ;from swimming above water level PJumpSnd: lda #Sfx_BigJump ;load big mario's jump sound by default ldy PlayerSize ;is mario big? beq SJumpSnd lda #Sfx_SmallJump ;if not, load small mario's jump sound SJumpSnd: sta <Square1SoundQueue ;store appropriate jump sound in square 1 sfx queue X_Physics: ldy #$00 sty <$00 ;init value here lda <Player_State ;if mario is on the ground, branch beq ProcPRun lda Player_XSpeedAbsolute ;check something that seems to be related cmp #$19 ;to mario's speed bcs GetXPhy ;if =>$19 branch here bcc ChkRFast ;if not branch elsewhere ProcPRun: iny ;if mario on the ground, increment Y lda AreaType ;check area type beq ChkRFast ;if water type, branch dey ;decrement Y by default for non-water type area lda <Left_Right_Buttons ;get left/right controller bits cmp <Player_MovingDir ;check against moving direction bne ChkRFast ;if controller bits <> moving direction, skip this part lda <A_B_Buttons ;check for b button pressed and #B_Button bne SetRTmr ;if pressed, skip ahead to set timer lda RunningTimer ;check for running timer set bne GetXPhy ;if set, branch ChkRFast: iny ;if running timer not set or level type is water, inc <$00 ;increment Y again and temp variable in memory lda RunningSpeed bne FastXSp ;if running speed set here, branch lda Player_XSpeedAbsolute cmp #$21 ;otherwise check player's walking/running speed bcc GetXPhy ;if less than a certain amount, branch ahead FastXSp: inc <$00 ;if running speed set or speed => $21 increment $00 jmp GetXPhy ;and jump ahead SetRTmr: lda #$0a ;if b button pressed, set running timer sta RunningTimer GetXPhy: lda MaxLeftXSpdData,y ;get maximum speed to the left sta MaximumLeftSpeed lda <GameEngineSubroutine ;check for specific routine running cmp #$07 ;(player entrance) bne GetXPhy2 ;if not running, skip and use old value of Y ldy #$03 ;otherwise set Y to 3 GetXPhy2: lda MaxRightXSpdData,y ;get maximum speed to the right sta MaximumRightSpeed ldy <$00 ;get other value in memory lda FrictionData,y ;get value using value in memory as offset sta FrictionAdderLow lda #$00 sta FrictionAdderHigh ;init something here lda <PlayerFacingDir cmp <Player_MovingDir ;check facing direction against moving direction beq ExitPhy ;if the same, branch to leave asl FrictionAdderLow ;otherwise shift d7 of friction adder low into carry rol FrictionAdderHigh ;then rotate carry onto d0 of friction adder high ExitPhy: rts ;and then leave ;------------------------------------------------------------------------------------- PlayerAnimTmrData: .db $02, $04, $07 GetPlayerAnimSpeed: ldy #$00 ;initialize offset in Y lda Player_XSpeedAbsolute ;check player's walking/running speed cmp #$1c ;against preset amount bcs SetRunSpd ;if greater than a certain amount, branch ahead iny ;otherwise increment Y cmp #$0e ;compare against lower amount bcs ChkSkid ;if greater than this but not greater than first, skip increment iny ;otherwise increment Y again ChkSkid: lda SavedJoypadBits ;get controller bits and #%01111111 ;mask out A button beq SetAnimSpd ;if no other buttons pressed, branch ahead of all this and #$03 ;mask out all others except left and right cmp <Player_MovingDir ;check against moving direction bne ProcSkid ;if left/right controller bits <> moving direction, branch lda #$00 ;otherwise set zero value here SetRunSpd: sta RunningSpeed ;store zero or running speed here jmp SetAnimSpd ProcSkid: lda Player_XSpeedAbsolute ;check player's walking/running speed cmp #$0b ;against one last amount bcs SetAnimSpd ;if greater than this amount, branch lda <PlayerFacingDir sta <Player_MovingDir ;otherwise use facing direction to set moving direction lda #$00 sta <Player_X_Speed ;nullify player's horizontal speed sta Player_X_MoveForce ;and dummy variable for player SetAnimSpd: lda PlayerAnimTmrData,y ;get animation timer setting using Y as offset sta PlayerAnimTimerSet rts ;------------------------------------------------------------------------------------- ImposeFriction: and Player_CollisionBits ;perform AND between left/right controller bits and collision flag cmp #$00 ;then compare to zero (this instruction is redundant) bne JoypFrict ;if any bits set, branch to next part lda <Player_X_Speed beq SetAbsSpd ;if player has no horizontal speed, branch ahead to last part bpl RghtFrict ;if player moving to the right, branch to slow bmi LeftFrict ;otherwise logic dictates player moving left, branch to slow JoypFrict: lsr a ;put right controller bit into carry bcc RghtFrict ;if left button pressed, carry = 0, thus branch LeftFrict: lda Player_X_MoveForce ;load value set here clc adc FrictionAdderLow ;add to it another value set here sta Player_X_MoveForce ;store here lda <Player_X_Speed adc FrictionAdderHigh ;add value plus carry to horizontal speed sta <Player_X_Speed ;set as new horizontal speed cmp MaximumRightSpeed ;compare against maximum value for right movement bmi XSpdSign ;if horizontal speed greater negatively, branch lda MaximumRightSpeed ;otherwise set preset value as horizontal speed sta <Player_X_Speed ;thus slowing the player's left movement down jmp SetAbsSpd ;skip to the end RghtFrict: lda Player_X_MoveForce ;load value set here sec sbc FrictionAdderLow ;subtract from it another value set here sta Player_X_MoveForce ;store here lda <Player_X_Speed sbc FrictionAdderHigh ;subtract value plus borrow from horizontal speed sta <Player_X_Speed ;set as new horizontal speed cmp MaximumLeftSpeed ;compare against maximum value for left movement bpl XSpdSign ;if horizontal speed greater positively, branch lda MaximumLeftSpeed ;otherwise set preset value as horizontal speed sta <Player_X_Speed ;thus slowing the player's right movement down XSpdSign: cmp #$00 ;if player not moving or moving to the right, bpl SetAbsSpd ;branch and leave horizontal speed value unmodified eor #$ff clc ;otherwise get two's compliment to get absolute adc #$01 ;unsigned walking/running speed SetAbsSpd: sta Player_XSpeedAbsolute ;store walking/running speed here and leave rts ;------------------------------------------------------------------------------------- ;$00 - used to store downward movement force in FireballObjCore ;$02 - used to store maximum vertical speed in FireballObjCore ;$07 - used to store pseudorandom bit in BubbleCheck ProcFireball_Bubble: lda PlayerStatus ;check player's status cmp #$02 bcc ProcAirBubbles ;if not fiery, branch lda <A_B_Buttons and #B_Button ;check for b button pressed beq ProcFireballs ;branch if not pressed and <PreviousA_B_Buttons bne ProcFireballs ;if button pressed in previous frame, branch lda FireballCounter ;load fireball counter and #%00000001 ;get LSB and use as offset for buffer tax lda <Fireball_State,x ;load fireball state bne ProcFireballs ;if not inactive, branch ldy <Player_Y_HighPos ;if player too high or too low, branch dey bne ProcFireballs lda CrouchingFlag ;if player crouching, branch bne ProcFireballs lda <Player_State ;if player's state = climbing, branch cmp #$03 beq ProcFireballs lda #Sfx_Fireball ;play fireball sound effect sta <Square1SoundQueue lda #$02 ;load state sta <Fireball_State,x ldy PlayerAnimTimerSet ;copy animation frame timer setting sty FireballThrowingTimer ;into fireball throwing timer dey sty PlayerAnimTimer ;decrement and store in player's animation timer inc FireballCounter ;increment fireball counter ProcFireballs: ldx #$00 jsr FireballObjCore ;process first fireball object ldx #$01 jsr FireballObjCore ;process second fireball object, then do air bubbles ProcAirBubbles: lda AreaType ;if not water type level, skip the rest of this bne BublExit ldx #$02 ;otherwise load counter and use as offset BublLoop: stx <ObjectOffset ;store offset jsr BubbleCheck ;check timers and coordinates, create air bubble jsr RelativeBubblePosition ;get relative coordinates jsr GetBubbleOffscreenBits ;get offscreen information jsr DrawBubble ;draw the air bubble dex bpl BublLoop ;do this until all three are handled BublExit: rts ;then leave FireballXSpdData: .db $40, $c0 FireballObjCore: stx <ObjectOffset ;store offset as current object lda <Fireball_State,x ;check for d7 = 1 asl a bcs FireballExplosion ;if so, branch to get relative coordinates and draw explosion ldy <Fireball_State,x ;if fireball inactive, branch to leave beq NoFBall dey ;if fireball state set to 1, skip this part and just run it beq RunFB lda <Player_X_Position ;get player's horizontal position adc #$04 ;add four pixels and store as fireball's horizontal position sta <Fireball_X_Position,x lda <Player_PageLoc ;get player's page location adc #$00 ;add carry and store as fireball's page location sta <Fireball_PageLoc,x lda <Player_Y_Position ;get player's vertical position and store sta <Fireball_Y_Position,x lda #$01 ;set high byte of vertical position sta <Fireball_Y_HighPos,x ldy <PlayerFacingDir ;get player's facing direction dey ;decrement to use as offset here lda FireballXSpdData,y ;set horizontal speed of fireball accordingly sta <Fireball_X_Speed,x lda #$04 ;set vertical speed of fireball sta <Fireball_Y_Speed,x lda #$07 sta Fireball_BoundBoxCtrl,x ;set bounding box size control for fireball dec <Fireball_State,x ;decrement state to 1 to skip this part from now on RunFB: txa ;add 7 to offset to use clc ;as fireball offset for next routines adc #$07 tax lda #$50 ;set downward movement force here sta <$00 lda #$03 ;set maximum speed here sta <$02 lda #$00 jsr ImposeGravity ;do sub here to impose gravity on fireball and move vertically jsr MoveObjectHorizontally ;do another sub to move it horizontally ldx <ObjectOffset ;return fireball offset to X jsr RelativeFireballPosition ;get relative coordinates jsr GetFireballOffscreenBits ;get offscreen information jsr GetFireballBoundBox ;get bounding box coordinates jsr FireballBGCollision ;do fireball to background collision detection lda FBall_OffscreenBits ;get fireball offscreen bits and #%11001100 ;mask out certain bits bne EraseFB ;if any bits still set, branch to kill fireball jsr FireballEnemyCollision ;do fireball to enemy collision detection and deal with collisions jmp DrawFireball ;draw fireball appropriately and leave EraseFB: lda #$00 ;erase fireball state sta <Fireball_State,x NoFBall: rts ;leave FireballExplosion: jsr RelativeFireballPosition jmp DrawExplosion_Fireball BubbleCheck: lda PseudoRandomBitReg+1,x ;get part of LSFR and #$01 sta <$07 ;store pseudorandom bit here lda <Bubble_Y_Position,x ;get vertical coordinate for air bubble cmp #$f8 ;if offscreen coordinate not set, bne MoveBubl ;branch to move air bubble lda AirBubbleTimer ;if air bubble timer not expired, bne ExitBubl ;branch to leave, otherwise create new air bubble SetupBubble: ldy #$00 ;load default value here lda <PlayerFacingDir ;get player's facing direction lsr a ;move d0 to carry bcc PosBubl ;branch to use default value if facing left ldy #$08 ;otherwise load alternate value here PosBubl: tya ;use value loaded as adder adc <Player_X_Position ;add to player's horizontal position sta <Bubble_X_Position,x ;save as horizontal position for airbubble lda <Player_PageLoc adc #$00 ;add carry to player's page location sta <Bubble_PageLoc,x ;save as page location for airbubble lda <Player_Y_Position clc ;add eight pixels to player's vertical position adc #$08 sta <Bubble_Y_Position,x ;save as vertical position for air bubble lda #$01 sta <Bubble_Y_HighPos,x ;set vertical high byte for air bubble ldy <$07 ;get pseudorandom bit, use as offset lda BubbleTimerData,y ;get data for air bubble timer sta AirBubbleTimer ;set air bubble timer MoveBubl: ldy <$07 ;get pseudorandom bit again, use as offset lda Bubble_YMF_Dummy,x sec ;subtract pseudorandom amount from dummy variable sbc Bubble_MForceData,y sta Bubble_YMF_Dummy,x ;save dummy variable lda <Bubble_Y_Position,x sbc #$00 ;subtract borrow from airbubble's vertical coordinate cmp #$20 ;if below the status bar, bcs Y_Bubl ;branch to go ahead and use to move air bubble upwards lda #$f8 ;otherwise set offscreen coordinate Y_Bubl: sta <Bubble_Y_Position,x ;store as new vertical coordinate for air bubble ExitBubl: rts ;leave Bubble_MForceData: .db $ff, $50 BubbleTimerData: .db $40, $20 ;------------------------------------------------------------------------------------- RunGameTimer: lda OperMode ;get primary mode of operation beq ExGTimer ;branch to leave if in title screen mode lda <GameEngineSubroutine cmp #$08 ;if routine number less than eight running, bcc ExGTimer ;branch to leave cmp #$0b ;if running death routine, beq ExGTimer ;branch to leave lda <Player_Y_HighPos cmp #$02 ;if player below the screen, bcs ExGTimer ;branch to leave regardless of level type lda GameTimerCtrlTimer ;if game timer control not yet expired, bne ExGTimer ;branch to leave lda GameTimerDisplay ora GameTimerDisplay+1 ;otherwise check game timer digits ora GameTimerDisplay+2 beq TimeUpOn ;if game timer digits at 000, branch to time-up code ldy GameTimerDisplay ;otherwise check first digit dey ;if first digit not on 1, bne ResGTCtrl ;branch to reset game timer control lda GameTimerDisplay+1 ;otherwise check second and third digits ora GameTimerDisplay+2 bne ResGTCtrl ;if timer not at 100, branch to reset game timer control lda #TimeRunningOutMusic sta <EventMusicQueue ;otherwise load time running out music ResGTCtrl: lda #$18 ;reset game timer control sta GameTimerCtrlTimer ldy #$23 ;set offset for last digit lda #$ff ;set value to decrement game timer digit sta DigitModifier+5 jsr DigitsMathRoutine ;do sub to decrement game timer slowly lda #$a4 ;set status nybbles to update game timer display jmp PrintStatusBarNumbers ;do sub to update the display TimeUpOn: sta PlayerStatus ;init player status (note A will always be zero here) jsr ForceInjury ;do sub to kill the player (note player is small here) inc GameTimerExpiredFlag ;set game timer expiration flag ExGTimer: rts ;leave ;------------------------------------------------------------------------------------- WarpZoneObject: lda ScrollLock ;check for scroll lock flag beq ExGTimer ;branch if not set to leave lda <Player_Y_Position ;check to see if player's vertical coordinate has and <Player_Y_HighPos ;same bits set as in vertical high byte (why?) bne ExGTimer ;if so, branch to leave sta ScrollLock ;otherwise nullify scroll lock flag inc WarpZoneControl ;increment warp zone flag to make warp pipes for warp zone jmp EraseEnemyObject ;kill this object ;------------------------------------------------------------------------------------- ;$00 - used in WhirlpoolActivate to store whirlpool length / 2, page location of center of whirlpool ;and also to store movement force exerted on player ;$01 - used in ProcessWhirlpools to store page location of right extent of whirlpool ;and in WhirlpoolActivate to store center of whirlpool ;$02 - used in ProcessWhirlpools to store right extent of whirlpool and in ;WhirlpoolActivate to store maximum vertical speed ProcessWhirlpools: lda AreaType ;check for water type level bne ExitWh ;branch to leave if not found sta Whirlpool_Flag ;otherwise initialize whirlpool flag lda TimerControl ;if master timer control set, bne ExitWh ;branch to leave ldy #$04 ;otherwise start with last whirlpool data WhLoop: lda Whirlpool_LeftExtent,y ;get left extent of whirlpool clc adc Whirlpool_Length,y ;add length of whirlpool sta <$02 ;store result as right extent here lda Whirlpool_PageLoc,y ;get page location beq NextWh ;if none or page 0, branch to get next data adc #$00 ;add carry sta <$01 ;store result as page location of right extent here lda <Player_X_Position ;get player's horizontal position sec sbc Whirlpool_LeftExtent,y ;subtract left extent lda <Player_PageLoc ;get player's page location sbc Whirlpool_PageLoc,y ;subtract borrow bmi NextWh ;if player too far left, branch to get next data lda <$02 ;otherwise get right extent sec sbc <Player_X_Position ;subtract player's horizontal coordinate lda <$01 ;get right extent's page location sbc <Player_PageLoc ;subtract borrow bpl WhirlpoolActivate ;if player within right extent, branch to whirlpool code NextWh: dey ;move onto next whirlpool data bpl WhLoop ;do this until all whirlpools are checked ExitWh: rts ;leave WhirlpoolActivate: lda Whirlpool_Length,y ;get length of whirlpool lsr a ;divide by 2 sta <$00 ;save here lda Whirlpool_LeftExtent,y ;get left extent of whirlpool clc adc <$00 ;add length divided by 2 sta <$01 ;save as center of whirlpool lda Whirlpool_PageLoc,y ;get page location adc #$00 ;add carry sta <$00 ;save as page location of whirlpool center lda <FrameCounter ;get frame counter lsr a ;shift d0 into carry (to run on every other frame) bcc WhPull ;if d0 not set, branch to last part of code lda <$01 ;get center sec sbc <Player_X_Position ;subtract player's horizontal coordinate lda <$00 ;get page location of center sbc <Player_PageLoc ;subtract borrow bpl LeftWh ;if player to the left of center, branch lda <Player_X_Position ;otherwise slowly pull player left, towards the center sec sbc #$01 ;subtract one pixel sta <Player_X_Position ;set player's new horizontal coordinate lda <Player_PageLoc sbc #$00 ;subtract borrow jmp SetPWh ;jump to set player's new page location LeftWh: lda Player_CollisionBits ;get player's collision bits lsr a ;shift d0 into carry bcc WhPull ;if d0 not set, branch lda <Player_X_Position ;otherwise slowly pull player right, towards the center clc adc #$01 ;add one pixel sta <Player_X_Position ;set player's new horizontal coordinate lda <Player_PageLoc adc #$00 ;add carry SetPWh: sta <Player_PageLoc ;set player's new page location WhPull: lda #$10 sta <$00 ;set vertical movement force lda #$01 sta Whirlpool_Flag ;set whirlpool flag to be used later sta <$02 ;also set maximum vertical speed lsr a tax ;set X for player offset jmp ImposeGravity ;jump to put whirlpool effect on player vertically, do not return ;------------------------------------------------------------------------------------- FlagpoleScoreMods: .db $05, $02, $08, $04, $01 FlagpoleScoreDigits: .db $03, $03, $04, $04, $04 FlagpoleRoutine: ldx #$05 ;set enemy object offset stx <ObjectOffset ;to special use slot lda <Enemy_ID,x cmp #FlagpoleFlagObject ;if flagpole flag not found, bne ExitFlagP ;branch to leave lda <GameEngineSubroutine cmp #$04 ;if flagpole slide routine not running, bne SkipScore ;branch to near the end of code lda <Player_State cmp #$03 ;if player state not climbing, bne SkipScore ;branch to near the end of code lda <Enemy_Y_Position,x ;check flagpole flag's vertical coordinate cmp #$aa ;if flagpole flag down to a certain point, bcs GiveFPScr ;branch to end the level lda <Player_Y_Position ;check player's vertical coordinate cmp #$a2 ;if player down to a certain point, bcs GiveFPScr ;branch to end the level lda Enemy_YMF_Dummy,x adc #$ff ;add movement amount to dummy variable sta Enemy_YMF_Dummy,x ;save dummy variable lda <Enemy_Y_Position,x ;get flag's vertical coordinate adc #$01 ;add 1 plus carry to move flag, and sta <Enemy_Y_Position,x ;store vertical coordinate lda FlagpoleFNum_YMFDummy sec ;subtract movement amount from dummy variable sbc #$ff sta FlagpoleFNum_YMFDummy ;save dummy variable lda FlagpoleFNum_Y_Pos sbc #$01 ;subtract one plus borrow to move floatey number, sta FlagpoleFNum_Y_Pos ;and store vertical coordinate here SkipScore: jmp FPGfx ;jump to skip ahead and draw flag and floatey number GiveFPScr: ldy FlagpoleScore ;get score offset from earlier (when player touched flagpole) lda FlagpoleScoreMods,y ;get amount to award player points ldx FlagpoleScoreDigits,y ;get digit with which to award points sta DigitModifier,x ;store in digit modifier jsr AddToScore ;do sub to award player points depending on height of collision lda #$05 sta <GameEngineSubroutine ;set to run end-of-level subroutine on next frame FPGfx: jsr GetEnemyOffscreenBits ;get offscreen information jsr RelativeEnemyPosition ;get relative coordinates jsr FlagpoleGfxHandler ;draw flagpole flag and floatey number ExitFlagP: rts ;------------------------------------------------------------------------------------- Jumpspring_Y_PosData: .db $08, $10, $08, $00 JumpspringHandler: jsr GetEnemyOffscreenBits ;get offscreen information lda TimerControl ;check master timer control bne DrawJSpr ;branch to last section if set lda JumpspringAnimCtrl ;check jumpspring frame control beq DrawJSpr ;branch to last section if not set tay dey ;subtract one from frame control, tya ;the only way a poor nmos 6502 can and #%00000010 ;mask out all but d1, original value still in Y bne DownJSpr ;if set, branch to move player up inc <Player_Y_Position inc <Player_Y_Position ;move player's vertical position down two pixels jmp PosJSpr ;skip to next part DownJSpr: dec <Player_Y_Position ;move player's vertical position up two pixels dec <Player_Y_Position PosJSpr: lda <Jumpspring_FixedYPos,x ;get permanent vertical position clc adc Jumpspring_Y_PosData,y ;add value using frame control as offset sta <Enemy_Y_Position,x ;store as new vertical position cpy #$01 ;check frame control offset (second frame is $00) bcc BounceJS ;if offset not yet at third frame ($01), skip to next part lda <A_B_Buttons and #A_Button ;check saved controller bits for A button press beq BounceJS ;skip to next part if A not pressed and <PreviousA_B_Buttons ;check for A button pressed in previous frame bne BounceJS ;skip to next part if so lda #$f4 sta JumpspringForce ;otherwise write new jumpspring force here BounceJS: cpy #$03 ;check frame control offset again bne DrawJSpr ;skip to last part if not yet at fifth frame ($03) lda JumpspringForce sta <Player_Y_Speed ;store jumpspring force as player's new vertical speed lda #$00 sta JumpspringAnimCtrl ;initialize jumpspring frame control DrawJSpr: jsr RelativeEnemyPosition ;get jumpspring's relative coordinates jsr EnemyGfxHandler ;draw jumpspring jsr OffscreenBoundsCheck ;check to see if we need to kill it lda JumpspringAnimCtrl ;if frame control at zero, don't bother beq ExJSpring ;trying to animate it, just leave lda JumpspringTimer bne ExJSpring ;if jumpspring timer not expired yet, leave lda #$04 sta JumpspringTimer ;otherwise initialize jumpspring timer inc JumpspringAnimCtrl ;increment frame control to animate jumpspring ExJSpring: rts ;leave ;------------------------------------------------------------------------------------- Setup_Vine: lda #VineObject ;load identifier for vine object sta <Enemy_ID,x ;store in buffer lda #$01 sta <Enemy_Flag,x ;set flag for enemy object buffer LDA Block_PageLoc,y sta <Enemy_PageLoc,x ;copy page location from previous object LDA Block_X_Position,y sta <Enemy_X_Position,x ;copy horizontal coordinate from previous object LDA Block_Y_Position,y sta <Enemy_Y_Position,x ;copy vertical coordinate from previous object ldy VineFlagOffset ;load vine flag/offset to next available vine slot bne NextVO ;if set at all, don't bother to store vertical sta VineStart_Y_Position ;otherwise store vertical coordinate here NextVO: txa ;store object offset to next available vine slot sta VineObjOffset,y ;using vine flag as offset inc VineFlagOffset ;increment vine flag offset lda #Sfx_GrowVine sta <Square2SoundQueue ;load vine grow sound rts ;------------------------------------------------------------------------------------- ;$06-$07 - used as address to block buffer data ;$02 - used as vertical high nybble of block buffer offset VineHeightData: .db $30, $60 VineObjectHandler: cpx #$05 ;check enemy offset for special use slot bne ExitVH ;if not in last slot, branch to leave ldy VineFlagOffset dey ;decrement vine flag in Y, use as offset lda VineHeight cmp VineHeightData,y ;if vine has reached certain height, beq RunVSubs ;branch ahead to skip this part lda <FrameCounter ;get frame counter lsr a ;shift d1 into carry lsr a bcc RunVSubs ;if d1 not set (2 frames every 4) skip this part lda <Enemy_Y_Position+5 sbc #$01 ;subtract vertical position of vine sta <Enemy_Y_Position+5 ;one pixel every frame it's time inc VineHeight ;increment vine height RunVSubs: lda VineHeight ;if vine still very small, cmp #$08 ;branch to leave bcc ExitVH jsr RelativeEnemyPosition ;get relative coordinates of vine, jsr GetEnemyOffscreenBits ;and any offscreen bits ldy #$00 ;initialize offset used in draw vine sub VDrawLoop: jsr DrawVine ;draw vine iny ;increment offset cpy VineFlagOffset ;if offset in Y and offset here bne VDrawLoop ;do not yet match, loop back to draw more vine lda Enemy_OffscreenBits and #%00001100 ;mask offscreen bits beq WrCMTile ;if none of the saved offscreen bits set, skip ahead dey ;otherwise decrement Y to get proper offset again KillVine: ldx VineObjOffset,y ;get enemy object offset for this vine object jsr EraseEnemyObject ;kill this vine object dey ;decrement Y bpl KillVine ;if any vine objects left, loop back to kill it sta VineFlagOffset ;initialize vine flag/offset sta VineHeight ;initialize vine height WrCMTile: lda VineHeight ;check vine height cmp #$20 ;if vine small (less than 32 pixels tall) bcc ExitVH ;then branch ahead to leave ldx #$06 ;set offset in X to last enemy slot lda #$01 ;set A to obtain horizontal in $04, but we don't care ldy #$1b ;set Y to offset to get block at ($04, $10) of coordinates jsr BlockBufferCollision ;do a sub to get block buffer address set, return contents ldy <$02 cpy #$d0 ;if vertical high nybble offset beyond extent of bcs ExitVH ;current block buffer, branch to leave, do not write lda [$06],y ;otherwise check contents of block buffer at bne ExitVH ;current offset, if not empty, branch to leave lda #$26 sta [$06],y ;otherwise, write climbing metatile to block buffer ExitVH: ldx <ObjectOffset ;get enemy object offset and leave rts ;------------------------------------------------------------------------------------- CannonBitmasks: .db %00001111, %00000111 ProcessCannons: lda AreaType ;get area type beq ExCannon ;if water type area, branch to leave ldx #$02 ThreeSChk: stx <ObjectOffset ;start at third enemy slot lda <Enemy_Flag,x ;check enemy buffer flag bne Chk_BB ;if set, branch to check enemy lda PseudoRandomBitReg+1,x ;otherwise get part of LSFR ldy SecondaryHardMode ;get secondary hard mode flag, use as offset and CannonBitmasks,y ;mask out bits of LSFR as decided by flag cmp #$06 ;check to see if lower nybble is above certain value bcs Chk_BB ;if so, branch to check enemy tay ;transfer masked contents of LSFR to Y as pseudorandom offset lda Cannon_PageLoc,y ;get page location beq Chk_BB ;if not set or on page 0, branch to check enemy lda Cannon_Timer,y ;get cannon timer beq FireCannon ;if expired, branch to fire cannon sbc #$00 ;otherwise subtract borrow (note carry will always be clear here) sta Cannon_Timer,y ;to count timer down jmp Chk_BB ;then jump ahead to check enemy FireCannon: lda TimerControl ;if master timer control set, bne Chk_BB ;branch to check enemy lda #$0e ;otherwise we start creating one sta Cannon_Timer,y ;first, reset cannon timer lda Cannon_PageLoc,y ;get page location of cannon sta <Enemy_PageLoc,x ;save as page location of bullet bill lda Cannon_X_Position,y ;get horizontal coordinate of cannon sta <Enemy_X_Position,x ;save as horizontal coordinate of bullet bill lda Cannon_Y_Position,y ;get vertical coordinate of cannon sec sbc #$08 ;subtract eight pixels (because enemies are 24 pixels tall) sta <Enemy_Y_Position,x ;save as vertical coordinate of bullet bill lda #$01 sta <Enemy_Y_HighPos,x ;set vertical high byte of bullet bill sta <Enemy_Flag,x ;set buffer flag lsr a ;shift right once to init A sta <Enemy_State,x ;then initialize enemy's state lda #$09 sta Enemy_BoundBoxCtrl,x ;set bounding box size control for bullet bill lda #BulletBill_CannonVar sta <Enemy_ID,x ;load identifier for bullet bill (cannon variant) jmp Next3Slt ;move onto next slot Chk_BB: lda <Enemy_ID,x ;check enemy identifier for bullet bill (cannon variant) cmp #BulletBill_CannonVar bne Next3Slt ;if not found, branch to get next slot jsr OffscreenBoundsCheck ;otherwise, check to see if it went offscreen lda <Enemy_Flag,x ;check enemy buffer flag beq Next3Slt ;if not set, branch to get next slot jsr GetEnemyOffscreenBits ;otherwise, get offscreen information jsr BulletBillHandler ;then do sub to handle bullet bill Next3Slt: dex ;move onto next slot bpl ThreeSChk ;do this until first three slots are checked ExCannon: rts ;then leave ;-------------------------------- BulletBillXSpdData: .db $18, $e8 BulletBillHandler: lda TimerControl ;if master timer control set, bne RunBBSubs ;branch to run subroutines except movement sub lda <Enemy_State,x bne ChkDSte ;if bullet bill's state set, branch to check defeated state lda Enemy_OffscreenBits ;otherwise load offscreen bits and #%00001100 ;mask out bits cmp #%00001100 ;check to see if all bits are set beq KillBB ;if so, branch to kill this object ldy #$01 ;set to move right by default jsr PlayerEnemyDiff ;get horizontal difference between player and bullet bill bmi SetupBB ;if enemy to the left of player, branch iny ;otherwise increment to move left SetupBB: sty <Enemy_MovingDir,x ;set bullet bill's moving direction dey ;decrement to use as offset lda BulletBillXSpdData,y ;get horizontal speed based on moving direction sta <Enemy_X_Speed,x ;and store it lda <$00 ;get horizontal difference adc #$28 ;add 40 pixels cmp #$50 ;if less than a certain amount, player is too close bcc KillBB ;to cannon either on left or right side, thus branch lda #$01 sta <Enemy_State,x ;otherwise set bullet bill's state lda #$0a sta EnemyFrameTimer,x ;set enemy frame timer lda #Sfx_Blast sta <Square2SoundQueue ;play fireworks/gunfire sound ChkDSte: lda <Enemy_State,x ;check enemy state for d5 set and #%00100000 beq BBFly ;if not set, skip to move horizontally jsr MoveD_EnemyVertically ;otherwise do sub to move bullet bill vertically BBFly: jsr MoveEnemyHorizontally ;do sub to move bullet bill horizontally RunBBSubs: jsr GetEnemyOffscreenBits ;get offscreen information jsr RelativeEnemyPosition ;get relative coordinates jsr GetEnemyBoundBox ;get bounding box coordinates jsr PlayerEnemyCollision ;handle player to enemy collisions jmp EnemyGfxHandler ;draw the bullet bill and leave KillBB: jsr EraseEnemyObject ;kill bullet bill and leave rts ;------------------------------------------------------------------------------------- HammerEnemyOfsData: .db $04, $04, $04, $05, $05, $05 .db $06, $06, $06 HammerXSpdData: .db $10, $f0 SpawnHammerObj: lda PseudoRandomBitReg+1 ;get pseudorandom bits from and #%00000111 ;second part of LSFR bne SetMOfs ;if any bits are set, branch and use as offset lda PseudoRandomBitReg+1 and #%00001000 ;get d3 from same part of LSFR SetMOfs: tay ;use either d3 or d2-d0 for offset here LDA Misc_State,y ;if any values loaded in bne NoHammer ;$2a-$32 where offset is then leave with carry clear ldx HammerEnemyOfsData,y ;get offset of enemy slot to check using Y as offset lda <Enemy_Flag,x ;check enemy buffer flag at offset bne NoHammer ;if buffer flag set, branch to leave with carry clear ldx <ObjectOffset ;get original enemy object offset txa sta HammerEnemyOffset,y ;save here lda #$90 STA Misc_State,y ;save hammer's state here lda #$07 sta Misc_BoundBoxCtrl,y ;set something else entirely, here sec ;return with carry set rts NoHammer: ldx <ObjectOffset ;get original enemy object offset clc ;return with carry clear rts ;-------------------------------- ;$00 - used to set downward force ;$01 - used to set upward force (residual) ;$02 - used to set maximum speed ProcHammerObj: lda TimerControl ;if master timer control set bne RunHSubs ;skip all of this code and go to last subs at the end lda <Misc_State,x ;otherwise get hammer's state and #%01111111 ;mask out d7 ldy HammerEnemyOffset,x ;get enemy object offset that spawned this hammer cmp #$02 ;check hammer's state beq SetHSpd ;if currently at 2, branch bcs SetHPos ;if greater than 2, branch elsewhere txa clc ;add 13 bytes to use adc #$0d ;proper misc object tax ;return offset to X lda #$10 sta <$00 ;set downward movement force lda #$0f sta <$01 ;set upward movement force (not used) lda #$04 sta <$02 ;set maximum vertical speed lda #$00 ;set A to impose gravity on hammer jsr ImposeGravity ;do sub to impose gravity on hammer and move vertically jsr MoveObjectHorizontally ;do sub to move it horizontally ldx <ObjectOffset ;get original misc object offset jmp RunAllH ;branch to essential subroutines SetHSpd: lda #$fe sta <Misc_Y_Speed,x ;set hammer's vertical speed LDA Enemy_State,y ;get enemy object state and #%11110111 ;mask out d3 STA Enemy_State,y ;store new state ldx <Enemy_MovingDir,y ;get enemy's moving direction dex ;decrement to use as offset lda HammerXSpdData,x ;get proper speed to use based on moving direction ldx <ObjectOffset ;reobtain hammer's buffer offset sta <Misc_X_Speed,x ;set hammer's horizontal speed SetHPos: dec <Misc_State,x ;decrement hammer's state LDA Enemy_X_Position,y ;get enemy's horizontal position clc adc #$02 ;set position 2 pixels to the right sta <Misc_X_Position,x ;store as hammer's horizontal position LDA Enemy_PageLoc,y ;get enemy's page location adc #$00 ;add carry sta <Misc_PageLoc,x ;store as hammer's page location LDA Enemy_Y_Position,y ;get enemy's vertical position sec sbc #$0a ;move position 10 pixels upward sta <Misc_Y_Position,x ;store as hammer's vertical position lda #$01 sta <Misc_Y_HighPos,x ;set hammer's vertical high byte bne RunHSubs ;unconditional branch to skip first routine RunAllH: jsr PlayerHammerCollision ;handle collisions RunHSubs: jsr GetMiscOffscreenBits ;get offscreen information jsr RelativeMiscPosition ;get relative coordinates jsr GetMiscBoundBox ;get bounding box coordinates jsr DrawHammer ;draw the hammer rts ;and we are done here ;------------------------------------------------------------------------------------- ;$02 - used to store vertical high nybble offset from block buffer routine ;$06 - used to store low byte of block buffer address CoinBlock: jsr FindEmptyMiscSlot ;set offset for empty or last misc object buffer slot lda <Block_PageLoc,x ;get page location of block object STA Misc_PageLoc,y ;store as page location of misc object lda <Block_X_Position,x ;get horizontal coordinate of block object ora #$05 ;add 5 pixels STA Misc_X_Position,y ;store as horizontal coordinate of misc object lda <Block_Y_Position,x ;get vertical coordinate of block object sbc #$10 ;subtract 16 pixels STA Misc_Y_Position,y ;store as vertical coordinate of misc object jmp JCoinC ;jump to rest of code as applies to this misc object SetupJumpCoin: jsr FindEmptyMiscSlot ;set offset for empty or last misc object buffer slot lda Block_PageLoc2,x ;get page location saved earlier STA Misc_PageLoc,y ;and save as page location for misc object lda <$06 ;get low byte of block buffer offset asl a asl a ;multiply by 16 to use lower nybble asl a asl a ora #$05 ;add five pixels STA Misc_X_Position,y ;save as horizontal coordinate for misc object lda <$02 ;get vertical high nybble offset from earlier adc #$20 ;add 32 pixels for the status bar STA Misc_Y_Position,y ;store as vertical coordinate JCoinC: lda #$fb STA Misc_Y_Speed,y ;set vertical speed lda #$01 STA Misc_Y_HighPos,y ;set vertical high byte STA Misc_State,y ;set state for misc object sta <Square2SoundQueue ;load coin grab sound stx <ObjectOffset ;store current control bit as misc object offset jsr GiveOneCoin ;update coin tally on the screen and coin amount variable inc CoinTallyFor1Ups ;increment coin tally used to activate 1-up block flag rts FindEmptyMiscSlot: ldy #$08 ;start at end of misc objects buffer FMiscLoop: LDA Misc_State,y ;get misc object state beq UseMiscS ;branch if none found to use current offset dey ;decrement offset cpy #$05 ;do this for three slots bne FMiscLoop ;do this until all slots are checked ldy #$08 ;if no empty slots found, use last slot UseMiscS: sty JumpCoinMiscOffset ;store offset of misc object buffer here (residual) rts ;------------------------------------------------------------------------------------- MiscObjectsCore: ldx #$08 ;set at end of misc object buffer MiscLoop: stx <ObjectOffset ;store misc object offset here lda <Misc_State,x ;check misc object state beq MiscLoopBack ;branch to check next slot asl a ;otherwise shift d7 into carry bcc ProcJumpCoin ;if d7 not set, jumping coin, thus skip to rest of code here jsr ProcHammerObj ;otherwise go to process hammer, jmp MiscLoopBack ;then check next slot ;-------------------------------- ;$00 - used to set downward force ;$01 - used to set upward force (residual) ;$02 - used to set maximum speed ProcJumpCoin: ldy <Misc_State,x ;check misc object state dey ;decrement to see if it's set to 1 beq JCoinRun ;if so, branch to handle jumping coin inc <Misc_State,x ;otherwise increment state to either start off or as timer lda <Misc_X_Position,x ;get horizontal coordinate for misc object clc ;whether its jumping coin (state 0 only) or floatey number adc ScrollAmount ;add current scroll speed sta <Misc_X_Position,x ;store as new horizontal coordinate lda <Misc_PageLoc,x ;get page location adc #$00 ;add carry sta <Misc_PageLoc,x ;store as new page location lda <Misc_State,x cmp #$30 ;check state of object for preset value bne RunJCSubs ;if not yet reached, branch to subroutines lda #$00 sta <Misc_State,x ;otherwise nullify object state jmp MiscLoopBack ;and move onto next slot JCoinRun: txa clc ;add 13 bytes to offset for next subroutine adc #$0d tax lda #$50 ;set downward movement amount sta <$00 lda #$06 ;set maximum vertical speed sta <$02 lsr a ;divide by 2 and set sta <$01 ;as upward movement amount (apparently residual) lda #$00 ;set A to impose gravity on jumping coin jsr ImposeGravity ;do sub to move coin vertically and impose gravity on it ldx <ObjectOffset ;get original misc object offset lda <Misc_Y_Speed,x ;check vertical speed cmp #$05 bne RunJCSubs ;if not moving downward fast enough, keep state as-is inc <Misc_State,x ;otherwise increment state to change to floatey number RunJCSubs: jsr RelativeMiscPosition ;get relative coordinates jsr GetMiscOffscreenBits ;get offscreen information jsr GetMiscBoundBox ;get bounding box coordinates (why?) jsr JCoinGfxHandler ;draw the coin or floatey number MiscLoopBack: dex ;decrement misc object offset bpl MiscLoop ;loop back until all misc objects handled rts ;then leave ;------------------------------------------------------------------------------------- CoinTallyOffsets: .db $17, $1d ScoreOffsets: .db $0b, $11 StatusBarNybbles: .db $02, $13 GiveOneCoin: lda #$01 ;set digit modifier to add 1 coin sta DigitModifier+5 ;to the current player's coin tally ldx CurrentPlayer ;get current player on the screen ldy CoinTallyOffsets,x ;get offset for player's coin tally jsr DigitsMathRoutine ;update the coin tally inc CoinTally ;increment onscreen player's coin amount lda CoinTally cmp #100 ;does player have 100 coins yet? bne CoinPoints ;if not, skip all of this lda #$00 sta CoinTally ;otherwise, reinitialize coin amount inc NumberofLives ;give the player an extra life lda #Sfx_ExtraLife sta <Square2SoundQueue ;play 1-up sound CoinPoints: lda #$02 ;set digit modifier to award sta DigitModifier+4 ;200 points to the player AddToScore: ldx CurrentPlayer ;get current player ldy ScoreOffsets,x ;get offset for player's score jsr DigitsMathRoutine ;update the score internally with value in digit modifier GetSBNybbles: ldy CurrentPlayer ;get current player lda StatusBarNybbles,y ;get nybbles based on player, use to update score and coins UpdateNumber: jsr PrintStatusBarNumbers ;print status bar numbers based on nybbles, whatever they be ldy VRAM_Buffer1_Offset lda VRAM_Buffer1-6,y ;check highest digit of score bne NoZSup ;if zero, overwrite with space tile for zero suppression lda #$24 sta VRAM_Buffer1-6,y NoZSup: ldx <ObjectOffset ;get enemy object buffer offset rts ;------------------------------------------------------------------------------------- SetupPowerUp: lda #PowerUpObject ;load power-up identifier into sta <Enemy_ID+5 ;special use slot of enemy object buffer lda <Block_PageLoc,x ;store page location of block object sta <Enemy_PageLoc+5 ;as page location of power-up object lda <Block_X_Position,x ;store horizontal coordinate of block object sta <Enemy_X_Position+5 ;as horizontal coordinate of power-up object lda #$01 sta <Enemy_Y_HighPos+5 ;set vertical high byte of power-up object lda <Block_Y_Position,x ;get vertical coordinate of block object sec sbc #$08 ;subtract 8 pixels sta <Enemy_Y_Position+5 ;and use as vertical coordinate of power-up object PwrUpJmp: lda #$01 ;this is a residual jump point in enemy object jump table sta <Enemy_State+5 ;set power-up object's state sta <Enemy_Flag+5 ;set buffer flag lda #$03 sta Enemy_BoundBoxCtrl+5 ;set bounding box size control for power-up object lda <PowerUpType cmp #$02 ;check currently loaded power-up type bcs PutBehind ;if star or 1-up, branch ahead lda PlayerStatus ;otherwise check player's current status cmp #$02 bcc StrType ;if player not fiery, use status as power-up type lsr a ;otherwise shift right to force fire flower type StrType: sta <PowerUpType ;store type here PutBehind: lda #%00100000 sta Enemy_SprAttrib+5 ;set background priority bit lda #Sfx_GrowPowerUp sta <Square2SoundQueue ;load power-up reveal sound and leave rts ;------------------------------------------------------------------------------------- PowerUpObjHandler: ldx #$05 ;set object offset for last slot in enemy object buffer stx <ObjectOffset lda <Enemy_State+5 ;check power-up object's state beq ExitPUp ;if not set, branch to leave asl a ;shift to check if d7 was set in object state bcc GrowThePowerUp ;if not set, branch ahead to skip this part lda TimerControl ;if master timer control set, bne RunPUSubs ;branch ahead to enemy object routines lda <PowerUpType ;check power-up type beq ShroomM ;if normal mushroom, branch ahead to move it cmp #$03 beq ShroomM ;if 1-up mushroom, branch ahead to move it cmp #$02 bne RunPUSubs ;if not star, branch elsewhere to skip movement jsr MoveJumpingEnemy ;otherwise impose gravity on star power-up and make it jump jsr EnemyJump ;note that green paratroopa shares the same code here jmp RunPUSubs ;then jump to other power-up subroutines ShroomM: jsr MoveNormalEnemy ;do sub to make mushrooms move jsr EnemyToBGCollisionDet ;deal with collisions jmp RunPUSubs ;run the other subroutines GrowThePowerUp: lda <FrameCounter ;get frame counter and #$03 ;mask out all but 2 LSB bne ChkPUSte ;if any bits set here, branch dec <Enemy_Y_Position+5 ;otherwise decrement vertical coordinate slowly lda <Enemy_State+5 ;load power-up object state inc <Enemy_State+5 ;increment state for next frame (to make power-up rise) cmp #$11 ;if power-up object state not yet past 16th pixel, bcc ChkPUSte ;branch ahead to last part here lda #$10 sta <Enemy_X_Speed,x ;otherwise set horizontal speed lda #%10000000 sta <Enemy_State+5 ;and then set d7 in power-up object's state asl a ;shift once to init A sta Enemy_SprAttrib+5 ;initialize background priority bit set here rol a ;rotate A to set right moving direction sta <Enemy_MovingDir,x ;set moving direction ChkPUSte: lda <Enemy_State+5 ;check power-up object's state cmp #$06 ;for if power-up has risen enough bcc ExitPUp ;if not, don't even bother running these routines RunPUSubs: jsr RelativeEnemyPosition ;get coordinates relative to screen jsr GetEnemyOffscreenBits ;get offscreen bits jsr GetEnemyBoundBox ;get bounding box coordinates jsr DrawPowerUp ;draw the power-up object jsr PlayerEnemyCollision ;check for collision with player jsr OffscreenBoundsCheck ;check to see if it went offscreen ExitPUp: rts ;and we're done ;------------------------------------------------------------------------------------- ;These apply to all routines in this section unless otherwise noted: ;$00 - used to store metatile from block buffer routine ;$02 - used to store vertical high nybble offset from block buffer routine ;$05 - used to store metatile stored in A at beginning of PlayerHeadCollision ;$06-$07 - used as block buffer address indirect BlockYPosAdderData: .db $04, $12 PlayerHeadCollision: pha ;store metatile number to stack lda #$11 ;load unbreakable block object state by default ldx SprDataOffset_Ctrl ;load offset control bit here ldy PlayerSize ;check player's size bne DBlockSte ;if small, branch lda #$12 ;otherwise load breakable block object state DBlockSte: sta <Block_State,x ;store into block object buffer jsr DestroyBlockMetatile ;store blank metatile in vram buffer to write to name table ldx SprDataOffset_Ctrl ;load offset control bit lda <$02 ;get vertical high nybble offset used in block buffer routine sta Block_Orig_YPos,x ;set as vertical coordinate for block object tay lda <$06 ;get low byte of block buffer address used in same routine sta Block_BBuf_Low,x ;save as offset here to be used later lda [$06],y ;get contents of block buffer at old address at $06, $07 jsr BlockBumpedChk ;do a sub to check which block player bumped head on sta <$00 ;store metatile here ldy PlayerSize ;check player's size bne ChkBrick ;if small, use metatile itself as contents of A tya ;otherwise init A (note: big = 0) ChkBrick: bcc PutMTileB ;if no match was found in previous sub, skip ahead ldy #$11 ;otherwise load unbreakable state into block object buffer sty <Block_State,x ;note this applies to both player sizes lda #$c4 ;load empty block metatile into A for now ldy <$00 ;get metatile from before cpy #$58 ;is it brick with coins (with line)? beq StartBTmr ;if so, branch cpy #$5d ;is it brick with coins (without line)? bne PutMTileB ;if not, branch ahead to store empty block metatile StartBTmr: lda BrickCoinTimerFlag ;check brick coin timer flag bne ContBTmr ;if set, timer expired or counting down, thus branch lda #$0b sta BrickCoinTimer ;if not set, set brick coin timer inc BrickCoinTimerFlag ;and set flag linked to it ContBTmr: lda BrickCoinTimer ;check brick coin timer bne PutOldMT ;if not yet expired, branch to use current metatile ldy #$c4 ;otherwise use empty block metatile PutOldMT: tya ;put metatile into A PutMTileB: sta Block_Metatile,x ;store whatever metatile be appropriate here jsr InitBlock_XY_Pos ;get block object horizontal coordinates saved ldy <$02 ;get vertical high nybble offset lda #$23 sta [$06],y ;write blank metatile $23 to block buffer lda #$10 sta BlockBounceTimer ;set block bounce timer pla ;pull original metatile from stack sta <$05 ;and save here ldy #$00 ;set default offset lda CrouchingFlag ;is player crouching? bne SmallBP ;if so, branch to increment offset lda PlayerSize ;is player big? beq BigBP ;if so, branch to use default offset SmallBP: iny ;increment for small or big and crouching BigBP: lda <Player_Y_Position ;get player's vertical coordinate clc adc BlockYPosAdderData,y ;add value determined by size and #$f0 ;mask out low nybble to get 16-pixel correspondence sta <Block_Y_Position,x ;save as vertical coordinate for block object ldy <Block_State,x ;get block object state cpy #$11 beq Unbreak ;if set to value loaded for unbreakable, branch jsr BrickShatter ;execute code for breakable brick jmp InvOBit ;skip subroutine to do last part of code here Unbreak: jsr BumpBlock ;execute code for unbreakable brick or question block InvOBit: lda SprDataOffset_Ctrl ;invert control bit used by block objects eor #$01 ;and floatey numbers sta SprDataOffset_Ctrl rts ;leave! ;-------------------------------- InitBlock_XY_Pos: lda <Player_X_Position ;get player's horizontal coordinate clc adc #$08 ;add eight pixels and #$f0 ;mask out low nybble to give 16-pixel correspondence sta <Block_X_Position,x ;save as horizontal coordinate for block object lda <Player_PageLoc adc #$00 ;add carry to page location of player sta <Block_PageLoc,x ;save as page location of block object sta Block_PageLoc2,x ;save elsewhere to be used later lda <Player_Y_HighPos sta <Block_Y_HighPos,x ;save vertical high byte of player into rts ;vertical high byte of block object and leave ;-------------------------------- BumpBlock: jsr CheckTopOfBlock ;check to see if there's a coin directly above this block lda #Sfx_Bump sta <Square1SoundQueue ;play bump sound lda #$00 sta <Block_X_Speed,x ;initialize horizontal speed for block object sta Block_Y_MoveForce,x ;init fractional movement force sta <Player_Y_Speed ;init player's vertical speed lda #$fe sta <Block_Y_Speed,x ;set vertical speed for block object lda <$05 ;get original metatile from stack jsr BlockBumpedChk ;do a sub to check which block player bumped head on bcc ExitBlockChk ;if no match was found, branch to leave tya ;move block number to A cmp #$09 ;if block number was within 0-8 range, bcc BlockCode ;branch to use current number sbc #$05 ;otherwise subtract 5 for second set to get proper number BlockCode: jsr JumpEngine ;run appropriate subroutine depending on block number .dw MushFlowerBlock .dw CoinBlock .dw CoinBlock .dw ExtraLifeMushBlock .dw MushFlowerBlock .dw VineBlock .dw StarBlock .dw CoinBlock .dw ExtraLifeMushBlock ;-------------------------------- MushFlowerBlock: lda #$00 ;load mushroom/fire flower into power-up type .db $2c ;BIT instruction opcode StarBlock: lda #$02 ;load star into power-up type .db $2c ;BIT instruction opcode ExtraLifeMushBlock: lda #$03 ;load 1-up mushroom into power-up type sta <$39 ;store correct power-up type jmp SetupPowerUp VineBlock: ldx #$05 ;load last slot for enemy object buffer ldy SprDataOffset_Ctrl ;get control bit jsr Setup_Vine ;set up vine object ExitBlockChk: rts ;leave ;-------------------------------- BrickQBlockMetatiles: .db $c1, $c0, $5f, $60 ;used by question blocks ;these two sets are functionally identical, but look different .db $55, $56, $57, $58, $59 ;used by ground level types .db $5a, $5b, $5c, $5d, $5e ;used by other level types BlockBumpedChk: ldy #$0d ;start at end of metatile data BumpChkLoop: cmp BrickQBlockMetatiles,y ;check to see if current metatile matches beq MatchBump ;metatile found in block buffer, branch if so dey ;otherwise move onto next metatile bpl BumpChkLoop ;do this until all metatiles are checked clc ;if none match, return with carry clear MatchBump: rts ;note carry is set if found match ;-------------------------------- BrickShatter: jsr CheckTopOfBlock ;check to see if there's a coin directly above this block lda #Sfx_BrickShatter sta Block_RepFlag,x ;set flag for block object to immediately replace metatile sta <NoiseSoundQueue ;load brick shatter sound jsr SpawnBrickChunks ;create brick chunk objects lda #$fe sta <Player_Y_Speed ;set vertical speed for player lda #$05 sta DigitModifier+5 ;set digit modifier to give player 50 points jsr AddToScore ;do sub to update the score ldx SprDataOffset_Ctrl ;load control bit and leave rts ;-------------------------------- CheckTopOfBlock: ldx SprDataOffset_Ctrl ;load control bit ldy <$02 ;get vertical high nybble offset used in block buffer beq TopEx ;branch to leave if set to zero, because we're at the top tya ;otherwise set to A sec sbc #$10 ;subtract $10 to move up one row in the block buffer sta <$02 ;store as new vertical high nybble offset tay lda [$06],y ;get contents of block buffer in same column, one row up cmp #$c2 ;is it a coin? (not underwater) bne TopEx ;if not, branch to leave lda #$00 sta [$06],y ;otherwise put blank metatile where coin was jsr RemoveCoin_Axe ;write blank metatile to vram buffer ldx SprDataOffset_Ctrl ;get control bit jsr SetupJumpCoin ;create jumping coin object and update coin variables TopEx: rts ;leave! ;-------------------------------- SpawnBrickChunks: lda <Block_X_Position,x ;set horizontal coordinate of block object sta Block_Orig_XPos,x ;as original horizontal coordinate here lda #$f0 sta <Block_X_Speed,x ;set horizontal speed for brick chunk objects sta <Block_X_Speed+2,x lda #$fa sta <Block_Y_Speed,x ;set vertical speed for one lda #$fc sta <Block_Y_Speed+2,x ;set lower vertical speed for the other lda #$00 sta Block_Y_MoveForce,x ;init fractional movement force for both sta Block_Y_MoveForce+2,x lda <Block_PageLoc,x sta <Block_PageLoc+2,x ;copy page location lda <Block_X_Position,x sta <Block_X_Position+2,x ;copy horizontal coordinate lda <Block_Y_Position,x clc ;add 8 pixels to vertical coordinate adc #$08 ;and save as vertical coordinate for one of them sta <Block_Y_Position+2,x lda #$fa sta <Block_Y_Speed,x ;set vertical speed...again??? (redundant) rts ;------------------------------------------------------------------------------------- BlockObjectsCore: lda <Block_State,x ;get state of block object beq UpdSte ;if not set, branch to leave and #$0f ;mask out high nybble pha ;push to stack tay ;put in Y for now txa clc adc #$09 ;add 9 bytes to offset (note two block objects are created tax ;when using brick chunks, but only one offset for both) dey ;decrement Y to check for solid block state beq BouncingBlockHandler ;branch if found, otherwise continue for brick chunks jsr ImposeGravityBlock ;do sub to impose gravity on one block object object jsr MoveObjectHorizontally ;do another sub to move horizontally txa clc ;move onto next block object adc #$02 tax jsr ImposeGravityBlock ;do sub to impose gravity on other block object jsr MoveObjectHorizontally ;do another sub to move horizontally ldx <ObjectOffset ;get block object offset used for both jsr RelativeBlockPosition ;get relative coordinates jsr GetBlockOffscreenBits ;get offscreen information jsr DrawBrickChunks ;draw the brick chunks pla ;get lower nybble of saved state ldy <Block_Y_HighPos,x ;check vertical high byte of block object beq UpdSte ;if above the screen, branch to kill it pha ;otherwise save state back into stack lda #$f0 cmp <Block_Y_Position+2,x ;check to see if bottom block object went bcs ChkTop ;to the bottom of the screen, and branch if not sta <Block_Y_Position+2,x ;otherwise set offscreen coordinate ChkTop: lda <Block_Y_Position,x ;get top block object's vertical coordinate cmp #$f0 ;see if it went to the bottom of the screen pla ;pull block object state from stack bcc UpdSte ;if not, branch to save state bcs KillBlock ;otherwise do unconditional branch to kill it BouncingBlockHandler: jsr ImposeGravityBlock ;do sub to impose gravity on block object ldx <ObjectOffset ;get block object offset jsr RelativeBlockPosition ;get relative coordinates jsr GetBlockOffscreenBits ;get offscreen information jsr DrawBlock ;draw the block lda <Block_Y_Position,x ;get vertical coordinate and #$0f ;mask out high nybble cmp #$05 ;check to see if low nybble wrapped around pla ;pull state from stack bcs UpdSte ;if still above amount, not time to kill block yet, thus branch lda #$01 sta Block_RepFlag,x ;otherwise set flag to replace metatile KillBlock: lda #$00 ;if branched here, nullify object state UpdSte: sta <Block_State,x ;store contents of A in block object state rts ;------------------------------------------------------------------------------------- ;$02 - used to store offset to block buffer ;$06-$07 - used to store block buffer address BlockObjMT_Updater: ldx #$01 ;set offset to start with second block object UpdateLoop: stx <ObjectOffset ;set offset here lda VRAM_Buffer1 ;if vram buffer already being used here, bne NextBUpd ;branch to move onto next block object lda Block_RepFlag,x ;if flag for block object already clear, beq NextBUpd ;branch to move onto next block object lda Block_BBuf_Low,x ;get low byte of block buffer sta <$06 ;store into block buffer address lda #$05 sta <$07 ;set high byte of block buffer address lda Block_Orig_YPos,x ;get original vertical coordinate of block object sta <$02 ;store here and use as offset to block buffer tay lda Block_Metatile,x ;get metatile to be written sta [$06],y ;write it to the block buffer jsr ReplaceBlockMetatile ;do sub to replace metatile where block object is lda #$00 sta Block_RepFlag,x ;clear block object flag NextBUpd: dex ;decrement block object offset bpl UpdateLoop ;do this until both block objects are dealt with rts ;then leave ;------------------------------------------------------------------------------------- ;$00 - used to store high nybble of horizontal speed as adder ;$01 - used to store low nybble of horizontal speed ;$02 - used to store adder to page location MoveEnemyHorizontally: inx ;increment offset for enemy offset jsr MoveObjectHorizontally ;position object horizontally according to ldx <ObjectOffset ;counters, return with saved value in A, rts ;put enemy offset back in X and leave MovePlayerHorizontally: lda JumpspringAnimCtrl ;if jumpspring currently animating, bne ExXMove ;branch to leave tax ;otherwise set zero for offset to use player's stuff MoveObjectHorizontally: lda <SprObject_X_Speed,x ;get currently saved value (horizontal asl a ;speed, secondary counter, whatever) asl a ;and move low nybble to high asl a asl a sta <$01 ;store result here lda <SprObject_X_Speed,x ;get saved value again lsr a ;move high nybble to low lsr a lsr a lsr a cmp #$08 ;if < 8, branch, do not change bcc SaveXSpd ora #%11110000 ;otherwise alter high nybble SaveXSpd: sta <$00 ;save result here ldy #$00 ;load default Y value here cmp #$00 ;if result positive, leave Y alone bpl UseAdder dey ;otherwise decrement Y UseAdder: sty <$02 ;save Y here lda SprObject_X_MoveForce,x ;get whatever number's here clc adc <$01 ;add low nybble moved to high sta SprObject_X_MoveForce,x ;store result here lda #$00 ;init A rol a ;rotate carry into d0 pha ;push onto stack ror a ;rotate d0 back onto carry lda <SprObject_X_Position,x adc <$00 ;add carry plus saved value (high nybble moved to low sta <SprObject_X_Position,x ;plus $f0 if necessary) to object's horizontal position lda <SprObject_PageLoc,x adc <$02 ;add carry plus other saved value to the sta <SprObject_PageLoc,x ;object's page location and save pla clc ;pull old carry from stack and add adc <$00 ;to high nybble moved to low ExXMove: rts ;and leave ;------------------------------------------------------------------------------------- ;$00 - used for downward force ;$01 - used for upward force ;$02 - used for maximum vertical speed MovePlayerVertically: ldx #$00 ;set X for player offset lda TimerControl bne NoJSChk ;if master timer control set, branch ahead lda JumpspringAnimCtrl ;otherwise check to see if jumpspring is animating bne ExXMove ;branch to leave if so NoJSChk: lda VerticalForce ;dump vertical force sta <$00 lda #$04 ;set maximum vertical speed here jmp ImposeGravitySprObj ;then jump to move player vertically ;-------------------------------- MoveD_EnemyVertically: ldy #$3d ;set quick movement amount downwards lda <Enemy_State,x ;then check enemy state cmp #$05 ;if not set to unique state for spiny's egg, go ahead bne ContVMove ;and use, otherwise set different movement amount, continue on MoveFallingPlatform: ldy #$20 ;set movement amount ContVMove: jmp SetHiMax ;jump to skip the rest of this ;-------------------------------- MoveRedPTroopaDown: ldy #$00 ;set Y to move downwards jmp MoveRedPTroopa ;skip to movement routine MoveRedPTroopaUp: ldy #$01 ;set Y to move upwards MoveRedPTroopa: inx ;increment X for enemy offset lda #$03 sta <$00 ;set downward movement amount here lda #$06 sta <$01 ;set upward movement amount here lda #$02 sta <$02 ;set maximum speed here tya ;set movement direction in A, and jmp RedPTroopaGrav ;jump to move this thing ;-------------------------------- MoveDropPlatform: ldy #$7f ;set movement amount for drop platform bne SetMdMax ;skip ahead of other value set here MoveEnemySlowVert: ldy #$0f ;set movement amount for bowser/other objects SetMdMax: lda #$02 ;set maximum speed in A bne SetXMoveAmt ;unconditional branch ;-------------------------------- MoveJ_EnemyVertically: ldy #$1c ;set movement amount for podoboo/other objects SetHiMax: lda #$03 ;set maximum speed in A SetXMoveAmt: sty <$00 ;set movement amount here inx ;increment X for enemy offset jsr ImposeGravitySprObj ;do a sub to move enemy object downwards ldx <ObjectOffset ;get enemy object buffer offset and leave rts ;-------------------------------- MaxSpdBlockData: .db $06, $08 ResidualGravityCode: ldy #$00 ;this part appears to be residual, .db $2c ;no code branches or jumps to it... ImposeGravityBlock: ldy #$01 ;set offset for maximum speed lda #$50 ;set movement amount here sta <$00 lda MaxSpdBlockData,y ;get maximum speed ImposeGravitySprObj: sta <$02 ;set maximum speed here lda #$00 ;set value to move downwards jmp ImposeGravity ;jump to the code that actually moves it ;-------------------------------- MovePlatformDown: lda #$00 ;save value to stack (if branching here, execute next .db $2c ;part as BIT instruction) MovePlatformUp: lda #$01 ;save value to stack pha ldy <Enemy_ID,x ;get enemy object identifier inx ;increment offset for enemy object lda #$05 ;load default value here cpy #$29 ;residual comparison, object #29 never executes bne SetDplSpd ;this code, thus unconditional branch here lda #$09 ;residual code SetDplSpd: sta <$00 ;save downward movement amount here lda #$0a ;save upward movement amount here sta <$01 lda #$03 ;save maximum vertical speed here sta <$02 pla ;get value from stack tay ;use as Y, then move onto code shared by red koopa RedPTroopaGrav: jsr ImposeGravity ;do a sub to move object gradually ldx <ObjectOffset ;get enemy object offset and leave rts ;------------------------------------------------------------------------------------- ;$00 - used for downward force ;$01 - used for upward force ;$07 - used as adder for vertical position ImposeGravity: pha ;push value to stack lda SprObject_YMF_Dummy,x clc ;add value in movement force to contents of dummy variable adc SprObject_Y_MoveForce,x sta SprObject_YMF_Dummy,x ldy #$00 ;set Y to zero by default lda <SprObject_Y_Speed,x ;get current vertical speed bpl AlterYP ;if currently moving downwards, do not decrement Y dey ;otherwise decrement Y AlterYP: sty <$07 ;store Y here adc <SprObject_Y_Position,x ;add vertical position to vertical speed plus carry sta <SprObject_Y_Position,x ;store as new vertical position lda <SprObject_Y_HighPos,x adc <$07 ;add carry plus contents of $07 to vertical high byte sta <SprObject_Y_HighPos,x ;store as new vertical high byte lda SprObject_Y_MoveForce,x clc adc <$00 ;add downward movement amount to contents of $0433 sta SprObject_Y_MoveForce,x lda <SprObject_Y_Speed,x ;add carry to vertical speed and store ;;;;;;;;;;;;;;;;;;;;;; ;; .bank 2 .org $C000 adc #$00 sta <SprObject_Y_Speed,x cmp <$02 ;compare to maximum speed bmi ChkUpM ;if less than preset value, skip this part lda SprObject_Y_MoveForce,x cmp #$80 ;if less positively than preset maximum, skip this part bcc ChkUpM lda <$02 sta <SprObject_Y_Speed,x ;keep vertical speed within maximum value lda #$00 sta SprObject_Y_MoveForce,x ;clear fractional ChkUpM: pla ;get value from stack beq ExVMove ;if set to zero, branch to leave lda <$02 eor #%11111111 ;otherwise get two's compliment of maximum speed tay iny sty <$07 ;store two's compliment here lda SprObject_Y_MoveForce,x sec ;subtract upward movement amount from contents sbc <$01 ;of movement force, note that $01 is twice as large as $00, sta SprObject_Y_MoveForce,x ;thus it effectively undoes add we did earlier lda <SprObject_Y_Speed,x sbc #$00 ;subtract borrow from vertical speed and store sta <SprObject_Y_Speed,x cmp <$07 ;compare vertical speed to two's compliment bpl ExVMove ;if less negatively than preset maximum, skip this part lda SprObject_Y_MoveForce,x cmp #$80 ;check if fractional part is above certain amount, bcs ExVMove ;and if so, branch to leave lda <$07 sta <SprObject_Y_Speed,x ;keep vertical speed within maximum value lda #$ff sta SprObject_Y_MoveForce,x ;clear fractional ExVMove: rts ;leave! ;------------------------------------------------------------------------------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;$C047 EnemiesAndLoopsCore: lda <Enemy_Flag,x ;check data here for MSB set pha ;save in stack asl a bcs ChkBowserF ;if MSB set in enemy flag, branch ahead of jumps pla ;get from stack beq ChkAreaTsk ;if data zero, branch jmp RunEnemyObjectsCore ;otherwise, jump to run enemy subroutines ChkAreaTsk: lda AreaParserTaskNum ;check number of tasks to perform and #$07 cmp #$07 ;if at a specific task, jump and leave beq ExitELCore jmp ProcLoopCommand ;otherwise, jump to process loop command/load enemies ChkBowserF: pla ;get data from stack and #%00001111 ;mask out high nybble tay LDA Enemy_Flag,y ;use as pointer and load same place with different offset bne ExitELCore sta <Enemy_Flag,x ;if second enemy flag not set, also clear first one ExitELCore: rts ;-------------------------------- ;loop command data LoopCmdWorldNumber: .db $03, $03, $06, $06, $06, $06, $06, $06, $07, $07, $07 LoopCmdPageNumber: .db $05, $09, $04, $05, $06, $08, $09, $0a, $06, $0b, $10 LoopCmdYPosition: .db $40, $b0, $b0, $80, $40, $40, $80, $40, $f0, $f0, $f0 ExecGameLoopback: lda <Player_PageLoc ;send player back four pages sec sbc #$04 sta <Player_PageLoc lda CurrentPageLoc ;send current page back four pages sec sbc #$04 sta CurrentPageLoc lda ScreenLeft_PageLoc ;subtract four from page location sec ;of screen's left border sbc #$04 sta ScreenLeft_PageLoc lda ScreenRight_PageLoc ;do the same for the page location sec ;of screen's right border sbc #$04 sta ScreenRight_PageLoc lda AreaObjectPageLoc ;subtract four from page control sec ;for area objects sbc #$04 sta AreaObjectPageLoc lda #$00 ;initialize page select for both sta EnemyObjectPageSel ;area and enemy objects sta AreaObjectPageSel sta EnemyDataOffset ;initialize enemy object data offset sta EnemyObjectPageLoc ;and enemy object page control lda AreaDataOfsLoopback,y ;adjust area object offset based on sta AreaDataOffset ;which loop command we encountered rts ProcLoopCommand: lda LoopCommand ;check if loop command was found beq ChkEnemyFrenzy lda CurrentColumnPos ;check to see if we're still on the first page bne ChkEnemyFrenzy ;if not, do not loop yet ldy #$0b ;start at the end of each set of loop data FindLoop: dey bmi ChkEnemyFrenzy ;if all data is checked and not match, do not loop lda WorldNumber ;check to see if one of the world numbers cmp LoopCmdWorldNumber,y ;matches our current world number bne FindLoop lda CurrentPageLoc ;check to see if one of the page numbers cmp LoopCmdPageNumber,y ;matches the page we're currently on bne FindLoop lda <Player_Y_Position ;check to see if the player is at the correct position cmp LoopCmdYPosition,y ;if not, branch to check for world 7 bne WrongChk lda <Player_State ;check to see if the player is cmp #$00 ;on solid ground (i.e. not jumping or falling) bne WrongChk ;if not, player fails to pass loop, and loopback lda WorldNumber ;are we in world 7? (check performed on correct cmp #World7 ;vertical position and on solid ground) bne InitMLp ;if not, initialize flags used there, otherwise inc MultiLoopCorrectCntr ;increment counter for correct progression IncMLoop: inc MultiLoopPassCntr ;increment master multi-part counter lda MultiLoopPassCntr ;have we done all three parts? cmp #$03 bne InitLCmd ;if not, skip this part lda MultiLoopCorrectCntr ;if so, have we done them all correctly? cmp #$03 beq InitMLp ;if so, branch past unnecessary check here bne DoLpBack ;unconditional branch if previous branch fails WrongChk: lda WorldNumber ;are we in world 7? (check performed on cmp #World7 ;incorrect vertical position or not on solid ground) beq IncMLoop DoLpBack: jsr ExecGameLoopback ;if player is not in right place, loop back jsr KillAllEnemies InitMLp: lda #$00 ;initialize counters used for multi-part loop commands sta MultiLoopPassCntr sta MultiLoopCorrectCntr InitLCmd: lda #$00 ;initialize loop command flag sta LoopCommand ;-------------------------------- ChkEnemyFrenzy: lda EnemyFrenzyQueue ;check for enemy object in frenzy queue beq ProcessEnemyData ;if not, skip this part sta <Enemy_ID,x ;store as enemy object identifier here lda #$01 sta <Enemy_Flag,x ;activate enemy object flag lda #$00 sta <Enemy_State,x ;initialize state and frenzy queue sta EnemyFrenzyQueue jmp InitEnemyObject ;and then jump to deal with this enemy ;-------------------------------- ;$06 - used to hold page location of extended right boundary ;$07 - used to hold high nybble of position of extended right boundary ;;;;;;;;;;;;;;;;;;;;;;;;;;;$C144 ProcessEnemyData: ldy EnemyDataOffset ;get offset of enemy object data lda [EnemyData],y ;load first byte cmp #$ff ;check for EOD terminator bne CheckEndofBuffer jmp CheckFrenzyBuffer ;if found, jump to check frenzy buffer, otherwise CheckEndofBuffer: and #%00001111 ;check for special row $0e cmp #$0e beq CheckRightBounds ;if found, branch, otherwise cpx #$05 ;check for end of buffer bcc CheckRightBounds ;if not at end of buffer, branch iny lda [EnemyData],y ;check for specific value here and #%00111111 ;not sure what this was intended for, exactly cmp #$2e ;this part is quite possibly residual code beq CheckRightBounds ;but it has the effect of keeping enemies out of rts ;the sixth slot CheckRightBounds: lda ScreenRight_X_Pos ;add 48 to pixel coordinate of right boundary clc adc #$30 and #%11110000 ;store high nybble sta <$07 lda ScreenRight_PageLoc ;add carry to page location of right boundary adc #$00 sta <$06 ;store page location + carry ldy EnemyDataOffset iny lda [EnemyData],y ;if MSB of enemy object is clear, branch to check for row $0f asl a bcc CheckPageCtrlRow lda EnemyObjectPageSel ;if page select already set, do not set again bne CheckPageCtrlRow inc EnemyObjectPageSel ;otherwise, if MSB is set, set page select inc EnemyObjectPageLoc ;and increment page control CheckPageCtrlRow: dey lda [EnemyData],y ;reread first byte and #$0f cmp #$0f ;check for special row $0f bne PositionEnemyObj ;if not found, branch to position enemy object lda EnemyObjectPageSel ;if page select set, bne PositionEnemyObj ;branch without reading second byte iny lda [EnemyData],y ;otherwise, get second byte, mask out 2 MSB and #%00111111 sta EnemyObjectPageLoc ;store as page control for enemy object data inc EnemyDataOffset ;increment enemy object data offset 2 bytes inc EnemyDataOffset inc EnemyObjectPageSel ;set page select for enemy object data and jmp ProcLoopCommand ;jump back to process loop commands again PositionEnemyObj: lda EnemyObjectPageLoc ;store page control as page location sta <Enemy_PageLoc,x ;for enemy object lda [EnemyData],y ;get first byte of enemy object and #%11110000 sta <Enemy_X_Position,x ;store column position cmp ScreenRight_X_Pos ;check column position against right boundary lda <Enemy_PageLoc,x ;without subtracting, then subtract borrow sbc ScreenRight_PageLoc ;from page location bcs CheckRightExtBounds ;if enemy object beyond or at boundary, branch lda [EnemyData],y and #%00001111 ;check for special row $0e cmp #$0e ;if found, jump elsewhere beq ParseRow0e jmp CheckThreeBytes ;if not found, unconditional jump CheckRightExtBounds: lda <$07 ;check right boundary + 48 against cmp <Enemy_X_Position,x ;column position without subtracting, lda <$06 ;then subtract borrow from page control temp sbc <Enemy_PageLoc,x ;plus carry bcc CheckFrenzyBuffer ;if enemy object beyond extended boundary, branch lda #$01 ;store value in vertical high byte sta <Enemy_Y_HighPos,x lda [EnemyData],y ;get first byte again asl a ;multiply by four to get the vertical asl a ;coordinate asl a asl a sta <Enemy_Y_Position,x cmp #$e0 ;do one last check for special row $0e beq ParseRow0e ;(necessary if branched to $c1cb) iny lda [EnemyData],y ;get second byte of object and #%01000000 ;check to see if hard mode bit is set beq CheckForEnemyGroup ;if not, branch to check for group enemy objects lda SecondaryHardMode ;if set, check to see if secondary hard mode flag beq Inc2B ;is on, and if not, branch to skip this object completely ;;;;;;;;;;;;;;;;;;;;;;;$C1F1 CheckForEnemyGroup: lda [EnemyData],y ;get second byte and mask out 2 MSB and #%00111111 cmp #$37 ;check for value below $37 bcc BuzzyBeetleMutate cmp #$3f ;if $37 or greater, check for value bcc DoGroup ;below $3f, branch if below $3f BuzzyBeetleMutate: cmp #Goomba ;if below $37, check for goomba bne StrID ;value ($3f or more always fails) ldy PrimaryHardMode ;check if primary hard mode flag is set beq StrID ;and if so, change goomba to buzzy beetle lda #BuzzyBeetle StrID: sta <Enemy_ID,x ;store enemy object number into buffer lda #$01 sta <Enemy_Flag,x ;set flag for enemy in buffer jsr InitEnemyObject lda <Enemy_Flag,x ;check to see if flag is set bne Inc2B ;if not, leave, otherwise branch rts ;;;;;;;;;;;;;;;;;;;;;;$C216 CheckFrenzyBuffer: lda EnemyFrenzyBuffer ;if enemy object stored in frenzy buffer bne StrFre ;then branch ahead to store in enemy object buffer lda VineFlagOffset ;otherwise check vine flag offset cmp #$01 bne ExEPar ;if other value <> 1, leave lda #VineObject ;otherwise put vine in enemy identifier StrFre: sta <Enemy_ID,x ;store contents of frenzy buffer into enemy identifier value InitEnemyObject: lda #$00 ;initialize enemy state sta <Enemy_State,x jsr CheckpointEnemyID ;jump ahead to run jump engine and subroutines ExEPar: rts ;then leave DoGroup: jmp HandleGroupEnemies ;handle enemy group objects ParseRow0e: iny ;increment Y to load third byte of object iny lda [EnemyData],y lsr a ;move 3 MSB to the bottom, effectively lsr a ;making %xxx00000 into %00000xxx lsr a lsr a lsr a cmp WorldNumber ;is it the same world number as we're on? bne NotUse ;if not, do not use (this allows multiple uses dey ;of the same area, like the underground bonus areas) lda [EnemyData],y ;otherwise, get second byte and use as offset sta AreaPointer ;to addresses for level and enemy object data iny lda [EnemyData],y ;get third byte again, and this time mask out and #%00011111 ;the 3 MSB from before, save as page number to be sta EntrancePage ;used upon entry to area, if area is entered NotUse: jmp Inc3B CheckThreeBytes: ldy EnemyDataOffset ;load current offset for enemy object data lda [EnemyData],y ;get first byte and #%00001111 ;check for special row $0e cmp #$0e bne Inc2B Inc3B: inc EnemyDataOffset ;if row = $0e, increment three bytes Inc2B: inc EnemyDataOffset ;otherwise increment two bytes inc EnemyDataOffset lda #$00 ;init page select for enemy objects sta EnemyObjectPageSel ldx <ObjectOffset ;reload current offset in enemy buffers rts ;and leave ;;;;;;;;;;;;;;;;;;;;;;;$2C6C CheckpointEnemyID: lda <Enemy_ID,x cmp #$15 ;check enemy object identifier for $15 or greater bcs InitEnemyRoutines ;and branch straight to the jump engine if found tay ;save identifier in Y register for now lda <Enemy_Y_Position,x adc #$08 ;add eight pixels to what will eventually be the sta <Enemy_Y_Position,x ;enemy object's vertical coordinate ($00-$14 only) lda #$01 sta EnemyOffscrBitsMasked,x ;set offscreen masked bit tya ;get identifier back and use as offset for jump engine InitEnemyRoutines: jsr JumpEngine ;jump engine table for newly loaded enemy objects .dw InitNormalEnemy ;for objects $00-$0f .dw InitNormalEnemy .dw InitNormalEnemy .dw InitRedKoopa .dw NoInitCode .dw InitHammerBro .dw InitGoomba .dw InitBloober .dw InitBulletBill .dw NoInitCode .dw InitCheepCheep .dw InitCheepCheep .dw InitPodoboo .dw InitPiranhaPlant .dw InitJumpGPTroopa .dw InitRedPTroopa .dw InitHorizFlySwimEnemy ;for objects $10-$1f .dw InitLakitu .dw InitEnemyFrenzy .dw NoInitCode .dw InitEnemyFrenzy .dw InitEnemyFrenzy .dw InitEnemyFrenzy .dw InitEnemyFrenzy .dw EndFrenzy .dw NoInitCode .dw NoInitCode .dw InitShortFirebar .dw InitShortFirebar .dw InitShortFirebar .dw InitShortFirebar .dw InitLongFirebar .dw NoInitCode ;for objects $20-$2f .dw NoInitCode .dw NoInitCode .dw NoInitCode .dw InitBalPlatform .dw InitVertPlatform .dw LargeLiftUp .dw LargeLiftDown .dw InitHoriPlatform .dw InitDropPlatform .dw InitHoriPlatform .dw PlatLiftUp .dw PlatLiftDown .dw InitBowser .dw PwrUpJmp ;possibly dummy value .dw Setup_Vine .dw NoInitCode ;for objects $30-$36 .dw NoInitCode .dw NoInitCode .dw NoInitCode .dw NoInitCode .dw InitRetainerObj .dw EndOfEnemyInitCode ;------------------------------------------------------------------------------------- NoInitCode: rts ;this executed when enemy object has no init code ;-------------------------------- InitGoomba: jsr InitNormalEnemy ;set appropriate horizontal speed jmp SmallBBox ;set $09 as bounding box control, set other values ;-------------------------------- InitPodoboo: lda #$02 ;set enemy position to below sta <Enemy_Y_HighPos,x ;the bottom of the screen sta <Enemy_Y_Position,x lsr a sta EnemyIntervalTimer,x ;set timer for enemy lsr a sta <Enemy_State,x ;initialize enemy state, then jump to use jmp SmallBBox ;$09 as bounding box size and set other things ;-------------------------------- InitRetainerObj: lda #$b8 ;set fixed vertical position for sta <Enemy_Y_Position,x ;princess/mushroom retainer object rts ;-------------------------------- NormalXSpdData: .db $f8, $f4 ;;;;;;;;;;;;;;;;;;;;;;$C30E InitNormalEnemy: ldy #$01 ;load offset of 1 by default lda PrimaryHardMode ;check for primary hard mode flag set bne GetESpd dey ;if not set, decrement offset GetESpd: lda NormalXSpdData,y ;get appropriate horizontal speed SetESpd: sta <Enemy_X_Speed,x ;store as speed for enemy object jmp TallBBox ;branch to set bounding box control and other data ;-------------------------------- InitRedKoopa: jsr InitNormalEnemy ;load appropriate horizontal speed lda #$01 ;set enemy state for red koopa troopa $03 sta <Enemy_State,x rts ;-------------------------------- HBroWalkingTimerData: .db $80, $50 InitHammerBro: lda #$00 ;init horizontal speed and timer used by hammer bro sta HammerThrowingTimer,x ;apparently to time hammer throwing sta <Enemy_X_Speed,x ldy SecondaryHardMode ;get secondary hard mode flag lda HBroWalkingTimerData,y sta EnemyIntervalTimer,x ;set value as delay for hammer bro to walk left lda #$0b ;set specific value for bounding box size control jmp SetBBox ;-------------------------------- InitHorizFlySwimEnemy: lda #$00 ;initialize horizontal speed jmp SetESpd ;-------------------------------- InitBloober: lda #$00 ;initialize horizontal speed sta <BlooperMoveSpeed,x SmallBBox: lda #$09 ;set specific bounding box size control bne SetBBox ;unconditional branch ;-------------------------------- InitRedPTroopa: ldy #$30 ;load central position adder for 48 pixels down lda <Enemy_Y_Position,x ;set vertical coordinate into location to sta RedPTroopaOrigXPos,x ;be used as original vertical coordinate bpl GetCent ;if vertical coordinate < $80 ldy #$e0 ;if => $80, load position adder for 32 pixels up GetCent: tya ;send central position adder to A adc <Enemy_Y_Position,x ;add to current vertical coordinate sta <RedPTroopaCenterYPos,x ;store as central vertical coordinate TallBBox: lda #$03 ;set specific bounding box size control SetBBox: sta Enemy_BoundBoxCtrl,x ;set bounding box control here lda #$02 ;set moving direction for left sta <Enemy_MovingDir,x InitVStf: lda #$00 ;initialize vertical speed sta <Enemy_Y_Speed,x ;and movement force sta Enemy_Y_MoveForce,x rts ;-------------------------------- InitBulletBill: lda #$02 ;set moving direction for left sta <Enemy_MovingDir,x lda #$09 ;set bounding box control for $09 sta Enemy_BoundBoxCtrl,x rts ;-------------------------------- InitCheepCheep: jsr SmallBBox ;set vertical bounding box, speed, init others lda PseudoRandomBitReg,x ;check one portion of LSFR and #%00010000 ;get d4 from it sta <CheepCheepMoveMFlag,x ;save as movement flag of some sort lda <Enemy_Y_Position,x sta CheepCheepOrigYPos,x ;save original vertical coordinate here rts ;-------------------------------- InitLakitu: lda EnemyFrenzyBuffer ;check to see if an enemy is already in bne KillLakitu ;the frenzy buffer, and branch to kill lakitu if so SetupLakitu: lda #$00 ;erase counter for lakitu's reappearance sta LakituReappearTimer jsr InitHorizFlySwimEnemy ;set $03 as bounding box, set other attributes jmp TallBBox2 ;set $03 as bounding box again (not necessary) and leave KillLakitu: jmp EraseEnemyObject ;-------------------------------- ;$01-$03 - used to hold pseudorandom difference adjusters PRDiffAdjustData: .db $26, $2c, $32, $38 .db $20, $22, $24, $26 .db $13, $14, $15, $16 LakituAndSpinyHandler: lda FrenzyEnemyTimer ;if timer here not expired, leave bne ExLSHand cpx #$05 ;if we are on the special use slot, leave bcs ExLSHand lda #$80 ;set timer sta FrenzyEnemyTimer ldy #$04 ;start with the last enemy slot ChkLak: LDA Enemy_ID,y ;check all enemy slots to see cmp #Lakitu ;if lakitu is on one of them beq CreateSpiny ;if so, branch out of this loop dey ;otherwise check another slot bpl ChkLak ;loop until all slots are checked inc LakituReappearTimer ;increment reappearance timer lda LakituReappearTimer cmp #$07 ;check to see if we're up to a certain value yet bcc ExLSHand ;if not, leave ldx #$04 ;start with the last enemy slot again ChkNoEn: lda <Enemy_Flag,x ;check enemy buffer flag for non-active enemy slot beq CreateL ;branch out of loop if found dex ;otherwise check next slot bpl ChkNoEn ;branch until all slots are checked bmi RetEOfs ;if no empty slots were found, branch to leave CreateL: lda #$00 ;initialize enemy state sta <Enemy_State,x lda #Lakitu ;create lakitu enemy object sta <Enemy_ID,x jsr SetupLakitu ;do a sub to set up lakitu lda #$20 jsr PutAtRightExtent ;finish setting up lakitu RetEOfs: ldx <ObjectOffset ;get enemy object buffer offset again and leave ExLSHand: rts ;-------------------------------- CreateSpiny: lda <Player_Y_Position ;if player above a certain point, branch to leave cmp #$2c bcc ExLSHand LDA Enemy_State,y ;if lakitu is not in normal state, branch to leave bne ExLSHand LDA Enemy_PageLoc,y ;store horizontal coordinates (high and low) of lakitu sta <Enemy_PageLoc,x ;into the coordinates of the spiny we're going to create LDA Enemy_X_Position,y sta <Enemy_X_Position,x lda #$01 ;put spiny within vertical screen unit sta <Enemy_Y_HighPos,x LDA Enemy_Y_Position,y ;put spiny eight pixels above where lakitu is sec sbc #$08 sta <Enemy_Y_Position,x lda PseudoRandomBitReg,x ;get 2 LSB of LSFR and save to Y and #%00000011 tay ldx #$02 DifLoop: lda PRDiffAdjustData,y ;get three values and save them sta <$01,x ;to $01-$03 iny iny ;increment Y four bytes for each value iny iny dex ;decrement X for each one bpl DifLoop ;loop until all three are written ldx <ObjectOffset ;get enemy object buffer offset jsr PlayerLakituDiff ;move enemy, change direction, get value - difference ldy <Player_X_Speed ;check player's horizontal speed cpy #$08 bcs SetSpSpd ;if moving faster than a certain amount, branch elsewhere tay ;otherwise save value in A to Y for now lda PseudoRandomBitReg+1,x and #%00000011 ;get one of the LSFR parts and save the 2 LSB beq UsePosv ;branch if neither bits are set tya eor #%11111111 ;otherwise get two's compliment of Y tay iny UsePosv: tya ;put value from A in Y back to A (they will be lost anyway) SetSpSpd: jsr SmallBBox ;set bounding box control, init attributes, lose contents of A ldy #$02 sta <Enemy_X_Speed,x ;set horizontal speed to zero because previous contents cmp #$00 ;of A were lost...branch here will never be taken for bmi SpinyRte ;the same reason dey SpinyRte: sty <Enemy_MovingDir,x ;set moving direction to the right lda #$fd sta <Enemy_Y_Speed,x ;set vertical speed to move upwards lda #$01 sta <Enemy_Flag,x ;enable enemy object by setting flag lda #$05 sta <Enemy_State,x ;put spiny in egg state and leave ChpChpEx: rts ;-------------------------------- FirebarSpinSpdData: .db $28, $38, $28, $38, $28 FirebarSpinDirData: .db $00, $00, $10, $10, $00 InitLongFirebar: jsr DuplicateEnemyObj ;create enemy object for long firebar InitShortFirebar: lda #$00 ;initialize low byte of spin state sta <FirebarSpinState_Low,x lda <Enemy_ID,x ;subtract $1b from enemy identifier sec ;to get proper offset for firebar data sbc #$1b tay lda FirebarSpinSpdData,y ;get spinning speed of firebar sta FirebarSpinSpeed,x lda FirebarSpinDirData,y ;get spinning direction of firebar sta <FirebarSpinDirection,x lda <Enemy_Y_Position,x clc ;add four pixels to vertical coordinate adc #$04 sta <Enemy_Y_Position,x lda <Enemy_X_Position,x clc ;add four pixels to horizontal coordinate adc #$04 sta <Enemy_X_Position,x lda <Enemy_PageLoc,x adc #$00 ;add carry to page location sta <Enemy_PageLoc,x jmp TallBBox2 ;set bounding box control (not used) and leave ;-------------------------------- ;$00-$01 - used to hold pseudorandom bits FlyCCXPositionData: .db $80, $30, $40, $80 .db $30, $50, $50, $70 .db $20, $40, $80, $a0 .db $70, $40, $90, $68 FlyCCXSpeedData: .db $0e, $05, $06, $0e .db $1c, $20, $10, $0c .db $1e, $22, $18, $14 FlyCCTimerData: .db $10, $60, $20, $48 InitFlyingCheepCheep: lda FrenzyEnemyTimer ;if timer here not expired yet, branch to leave bne ChpChpEx jsr SmallBBox ;jump to set bounding box size $09 and init other values lda PseudoRandomBitReg+1,x and #%00000011 ;set pseudorandom offset here tay lda FlyCCTimerData,y ;load timer with pseudorandom offset sta FrenzyEnemyTimer ldy #$03 ;load Y with default value lda SecondaryHardMode beq MaxCC ;if secondary hard mode flag not set, do not increment Y iny ;otherwise, increment Y to allow as many as four onscreen MaxCC: sty <$00 ;store whatever pseudorandom bits are in Y cpx <$00 ;compare enemy object buffer offset with Y bcs ChpChpEx ;if X => Y, branch to leave lda PseudoRandomBitReg,x and #%00000011 ;get last two bits of LSFR, first part sta <$00 ;and store in two places sta <$01 lda #$fb ;set vertical speed for cheep-cheep sta <Enemy_Y_Speed,x lda #$00 ;load default value ldy <Player_X_Speed ;check player's horizontal speed beq GSeed ;if player not moving left or right, skip this part lda #$04 cpy #$19 ;if moving to the right but not very quickly, bcc GSeed ;do not change A asl a ;otherwise, multiply A by 2 GSeed: pha ;save to stack clc adc <$00 ;add to last two bits of LSFR we saved earlier sta <$00 ;save it there lda PseudoRandomBitReg+1,x and #%00000011 ;if neither of the last two bits of second LSFR set, beq RSeed ;skip this part and save contents of $00 lda PseudoRandomBitReg+2,x and #%00001111 ;otherwise overwrite with lower nybble of sta <$00 ;third LSFR part RSeed: pla ;get value from stack we saved earlier clc adc <$01 ;add to last two bits of LSFR we saved in other place tay ;use as pseudorandom offset here lda FlyCCXSpeedData,y ;get horizontal speed using pseudorandom offset sta <Enemy_X_Speed,x lda #$01 ;set to move towards the right sta <Enemy_MovingDir,x lda <Player_X_Speed ;if player moving left or right, branch ahead of this part bne DD2XPos1 ldy <$00 ;get first LSFR or third LSFR lower nybble tya ;and check for d1 set and #%00000010 beq DD2XPos1 ;if d1 not set, branch lda <Enemy_X_Speed,x eor #$ff ;if d1 set, change horizontal speed clc ;into two's compliment, thus moving in the opposite adc #$01 ;direction sta <Enemy_X_Speed,x inc <Enemy_MovingDir,x ;increment to move towards the left DD2XPos1: tya ;get first LSFR or third LSFR lower nybble again and #%00000010 beq DD2XPos2 ;check for d1 set again, branch again if not set lda <Player_X_Position ;get player's horizontal position clc adc FlyCCXPositionData,y ;if d1 set, add value obtained from pseudorandom offset sta <Enemy_X_Position,x ;and save as enemy's horizontal position lda <Player_PageLoc ;get player's page location adc #$00 ;add carry and jump past this part jmp FinCCSt DD2XPos2: lda <Player_X_Position ;get player's horizontal position sec sbc FlyCCXPositionData,y ;if d1 not set, subtract value obtained from pseudorandom sta <Enemy_X_Position,x ;offset and save as enemy's horizontal position lda <Player_PageLoc ;get player's page location sbc #$00 ;subtract borrow FinCCSt: sta <Enemy_PageLoc,x ;save as enemy's page location lda #$01 sta <Enemy_Flag,x ;set enemy's buffer flag sta <Enemy_Y_HighPos,x ;set enemy's high vertical byte lda #$f8 sta <Enemy_Y_Position,x ;put enemy below the screen, and we are done rts ;-------------------------------- InitBowser: jsr DuplicateEnemyObj ;jump to create another bowser object stx BowserFront_Offset ;save offset of first here lda #$00 sta BowserBodyControls ;initialize bowser's body controls sta BridgeCollapseOffset ;and bridge collapse offset lda <Enemy_X_Position,x sta BowserOrigXPos ;store original horizontal position here lda #$df sta BowserFireBreathTimer ;store something here sta <Enemy_MovingDir,x ;and in moving direction lda #$20 sta BowserFeetCounter ;set bowser's feet timer and in enemy timer sta EnemyFrameTimer,x lda #$05 sta BowserHitPoints ;give bowser 5 hit points lsr a sta BowserMovementSpeed ;set default movement speed here rts ;-------------------------------- DuplicateEnemyObj: ldy #$ff ;start at beginning of enemy slots FSLoop: iny ;increment one slot LDA Enemy_Flag,y ;check enemy buffer flag for empty slot bne FSLoop ;if set, branch and keep checking sty DuplicateObj_Offset ;otherwise set offset here txa ;transfer original enemy buffer offset ora #%10000000 ;store with d7 set as flag in new enemy STA Enemy_Flag,y ;slot as well as enemy offset lda <Enemy_PageLoc,x STA Enemy_PageLoc,y ;copy page location and horizontal coordinates lda <Enemy_X_Position,x ;from original enemy to new enemy STA Enemy_X_Position,y lda #$01 sta <Enemy_Flag,x ;set flag as normal for original enemy STA Enemy_Y_HighPos,y ;set high vertical byte for new enemy lda <Enemy_Y_Position,x STA Enemy_Y_Position,y ;copy vertical coordinate from original to new FlmEx: rts ;and then leave ;-------------------------------- FlameYPosData: .db $90, $80, $70, $90 FlameYMFAdderData: .db $ff, $01 InitBowserFlame: lda FrenzyEnemyTimer ;if timer not expired yet, branch to leave bne FlmEx sta Enemy_Y_MoveForce,x ;reset something here lda <NoiseSoundQueue ora #Sfx_BowserFlame ;load bowser's flame sound into queue sta <NoiseSoundQueue ldy BowserFront_Offset ;get bowser's buffer offset LDA Enemy_ID,y ;check for bowser cmp #Bowser beq SpawnFromMouth ;branch if found jsr SetFlameTimer ;get timer data based on flame counter clc adc #$20 ;add 32 frames by default ldy SecondaryHardMode beq SetFrT ;if secondary mode flag not set, use as timer setting sec sbc #$10 ;otherwise subtract 16 frames for secondary hard mode SetFrT: sta FrenzyEnemyTimer ;set timer accordingly lda PseudoRandomBitReg,x and #%00000011 ;get 2 LSB from first part of LSFR sta BowserFlamePRandomOfs,x ;set here tay ;use as offset lda FlameYPosData,y ;load vertical position based on pseudorandom offset PutAtRightExtent: sta <Enemy_Y_Position,x ;set vertical position lda ScreenRight_X_Pos clc adc #$20 ;place enemy 32 pixels beyond right side of screen sta <Enemy_X_Position,x lda ScreenRight_PageLoc adc #$00 ;add carry sta <Enemy_PageLoc,x jmp FinishFlame ;skip this part to finish setting values SpawnFromMouth: LDA Enemy_X_Position,y ;get bowser's horizontal position sec sbc #$0e ;subtract 14 pixels sta <Enemy_X_Position,x ;save as flame's horizontal position LDA Enemy_PageLoc,y sta <Enemy_PageLoc,x ;copy page location from bowser to flame LDA Enemy_Y_Position,y clc ;add 8 pixels to bowser's vertical position adc #$08 sta <Enemy_Y_Position,x ;save as flame's vertical position lda PseudoRandomBitReg,x and #%00000011 ;get 2 LSB from first part of LSFR sta Enemy_YMF_Dummy,x ;save here tay ;use as offset lda FlameYPosData,y ;get value here using bits as offset ldy #$00 ;load default offset cmp <Enemy_Y_Position,x ;compare value to flame's current vertical position bcc SetMF ;if less, do not increment offset iny ;otherwise increment now SetMF: lda FlameYMFAdderData,y ;get value here and save sta Enemy_Y_MoveForce,x ;to vertical movement force lda #$00 sta EnemyFrenzyBuffer ;clear enemy frenzy buffer FinishFlame: lda #$08 ;set $08 for bounding box control sta Enemy_BoundBoxCtrl,x lda #$01 ;set high byte of vertical and sta <Enemy_Y_HighPos,x ;enemy buffer flag sta <Enemy_Flag,x lsr a sta Enemy_X_MoveForce,x ;initialize horizontal movement force, and sta <Enemy_State,x ;enemy state rts ;-------------------------------- FireworksXPosData: .db $00, $30, $60, $60, $00, $20 FireworksYPosData: .db $60, $40, $70, $40, $60, $30 InitFireworks: lda FrenzyEnemyTimer ;if timer not expired yet, branch to leave bne ExitFWk lda #$20 ;otherwise reset timer sta FrenzyEnemyTimer dec FireworksCounter ;decrement for each explosion ldy #$06 ;start at last slot StarFChk: dey LDA Enemy_ID,y ;check for presence of star flag object cmp #StarFlagObject ;if there isn't a star flag object, bne StarFChk ;routine goes into infinite loop = crash LDA Enemy_X_Position,y sec ;get horizontal coordinate of star flag object, then sbc #$30 ;subtract 48 pixels from it and save to pha ;the stack LDA Enemy_PageLoc,y sbc #$00 ;subtract the carry from the page location sta <$00 ;of the star flag object lda FireworksCounter ;get fireworks counter clc ADC Enemy_State,y ;add state of star flag object (possibly not necessary) tay ;use as offset pla ;get saved horizontal coordinate of star flag - 48 pixels clc adc FireworksXPosData,y ;add number based on offset of fireworks counter sta <Enemy_X_Position,x ;store as the fireworks object horizontal coordinate lda <$00 adc #$00 ;add carry and store as page location for sta <Enemy_PageLoc,x ;the fireworks object lda FireworksYPosData,y ;get vertical position using same offset sta <Enemy_Y_Position,x ;and store as vertical coordinate for fireworks object lda #$01 sta <Enemy_Y_HighPos,x ;store in vertical high byte sta <Enemy_Flag,x ;and activate enemy buffer flag lsr a sta <ExplosionGfxCounter,x ;initialize explosion counter lda #$08 sta <ExplosionTimerCounter,x ;set explosion timing counter ExitFWk: rts ;-------------------------------- Bitmasks: .db %00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000, %10000000 Enemy17YPosData: .db $40, $30, $90, $50, $20, $60, $a0, $70 SwimCC_IDData: .db $0a, $0b BulletBillCheepCheep: lda FrenzyEnemyTimer ;if timer not expired yet, branch to leave bne ExF17 lda AreaType ;are we in a water-type level? bne DoBulletBills ;if not, branch elsewhere cpx #$03 ;are we past third enemy slot? bcs ExF17 ;if so, branch to leave ldy #$00 ;load default offset lda PseudoRandomBitReg,x cmp #$aa ;check first part of LSFR against preset value bcc ChkW2 ;if less than preset, do not increment offset iny ;otherwise increment ChkW2: lda WorldNumber ;check world number cmp #World2 beq Get17ID ;if we're on world 2, do not increment offset iny ;otherwise increment Get17ID: tya and #%00000001 ;mask out all but last bit of offset tay lda SwimCC_IDData,y ;load identifier for cheep-cheeps Set17ID: sta <Enemy_ID,x ;store whatever's in A as enemy identifier lda BitMFilter cmp #$ff ;if not all bits set, skip init part and compare bits bne GetRBit lda #$00 ;initialize vertical position filter sta BitMFilter GetRBit: lda PseudoRandomBitReg,x ;get first part of LSFR and #%00000111 ;mask out all but 3 LSB ChkRBit: tay ;use as offset lda Bitmasks,y ;load bitmask bit BitMFilter ;perform AND on filter without changing it beq AddFBit iny ;increment offset tya and #%00000111 ;mask out all but 3 LSB thus keeping it 0-7 jmp ChkRBit ;do another check AddFBit: ora BitMFilter ;add bit to already set bits in filter sta BitMFilter ;and store lda Enemy17YPosData,y ;load vertical position using offset jsr PutAtRightExtent ;set vertical position and other values sta Enemy_YMF_Dummy,x ;initialize dummy variable lda #$20 ;set timer sta FrenzyEnemyTimer jmp CheckpointEnemyID ;process our new enemy object DoBulletBills: ldy #$ff ;start at beginning of enemy slots BB_SLoop: iny ;move onto the next slot cpy #$05 ;branch to play sound if we've done all slots bcs FireBulletBill LDA Enemy_Flag,y ;if enemy buffer flag not set, beq BB_SLoop ;loop back and check another slot LDA Enemy_ID,y cmp #BulletBill_FrenzyVar ;check enemy identifier for bne BB_SLoop ;bullet bill object (frenzy variant) ExF17: rts ;if found, leave FireBulletBill: lda <Square2SoundQueue ora #Sfx_Blast ;play fireworks/gunfire sound sta <Square2SoundQueue lda #BulletBill_FrenzyVar ;load identifier for bullet bill object bne Set17ID ;unconditional branch ;-------------------------------- ;$00 - used to store Y position of group enemies ;$01 - used to store enemy ID ;$02 - used to store page location of right side of screen ;$03 - used to store X position of right side of screen ;;;;;;;;;;;;;;;;;;;;;;$C71B HandleGroupEnemies: ldy #$00 ;load value for green koopa troopa sec sbc #$37 ;subtract $37 from second byte read pha ;save result in stack for now cmp #$04 ;was byte in $3b-$3e range? bcs SnglID ;if so, branch pha ;save another copy to stack ldy #Goomba ;load value for goomba enemy lda PrimaryHardMode ;if primary hard mode flag not set, beq PullID ;branch, otherwise change to value ldy #BuzzyBeetle ;for buzzy beetle PullID: pla ;get second copy from stack SnglID: sty <$01 ;save enemy id here ldy #$b0 ;load default y coordinate and #$02 ;check to see if d1 was set beq SetYGp ;if so, move y coordinate up, ldy #$70 ;otherwise branch and use default SetYGp: sty <$00 ;save y coordinate here lda ScreenRight_PageLoc ;get page number of right edge of screen sta <$02 ;save here lda ScreenRight_X_Pos ;get pixel coordinate of right edge sta <$03 ;save here ldy #$02 ;load two enemies by default pla ;get first copy from stack lsr a ;check to see if d0 was set bcc CntGrp ;if not, use default value iny ;otherwise increment to three enemies CntGrp: sty NumberofGroupEnemies ;save number of enemies here GrLoop: ldx #$ff ;start at beginning of enemy buffers GSltLp: inx ;increment and branch if past cpx #$05 ;end of buffers bcs NextED lda <Enemy_Flag,x ;check to see if enemy is already bne GSltLp ;stored in buffer, and branch if so lda <$01 sta <Enemy_ID,x ;store enemy object identifier lda <$02 sta <Enemy_PageLoc,x ;store page location for enemy object lda <$03 sta <Enemy_X_Position,x ;store x coordinate for enemy object clc adc #$18 ;add 24 pixels for next enemy sta <$03 lda <$02 ;add carry to page location for adc #$00 ;next enemy sta <$02 lda <$00 ;store y coordinate for enemy object sta <Enemy_Y_Position,x lda #$01 ;activate flag for buffer, and sta <Enemy_Y_HighPos,x ;put enemy within the screen vertically sta <Enemy_Flag,x jsr CheckpointEnemyID ;process each enemy object separately dec NumberofGroupEnemies ;do this until we run out of enemy objects bne GrLoop NextED: jmp Inc2B ;jump to increment data offset and leave ;-------------------------------- InitPiranhaPlant: lda #$01 ;set initial speed sta <PiranhaPlant_Y_Speed,x lsr a sta <Enemy_State,x ;initialize enemy state and what would normally sta <PiranhaPlant_MoveFlag,x ;be used as vertical speed, but not in this case lda <Enemy_Y_Position,x sta PiranhaPlantDownYPos,x ;save original vertical coordinate here sec sbc #$18 sta PiranhaPlantUpYPos,x ;save original vertical coordinate - 24 pixels here lda #$09 jmp SetBBox2 ;set specific value for bounding box control ;-------------------------------- InitEnemyFrenzy: lda <Enemy_ID,x ;load enemy identifier sta EnemyFrenzyBuffer ;save in enemy frenzy buffer sec sbc #$12 ;subtract 12 and use as offset for jump engine jsr JumpEngine ;frenzy object jump table .dw LakituAndSpinyHandler .dw NoFrenzyCode .dw InitFlyingCheepCheep .dw InitBowserFlame .dw InitFireworks .dw BulletBillCheepCheep ;-------------------------------- NoFrenzyCode: rts ;-------------------------------- EndFrenzy: ldy #$05 ;start at last slot LakituChk: LDA Enemy_ID,y ;check enemy identifiers cmp #Lakitu ;for lakitu bne NextFSlot lda #$01 ;if found, set state STA Enemy_State,y NextFSlot: dey ;move onto the next slot bpl LakituChk ;do this until all slots are checked lda #$00 sta EnemyFrenzyBuffer ;empty enemy frenzy buffer sta <Enemy_Flag,x ;disable enemy buffer flag for this object rts ;-------------------------------- InitJumpGPTroopa: lda #$02 ;set for movement to the left sta <Enemy_MovingDir,x lda #$f8 ;set horizontal speed sta <Enemy_X_Speed,x TallBBox2: lda #$03 ;set specific value for bounding box control SetBBox2: sta Enemy_BoundBoxCtrl,x ;set bounding box control then leave rts ;-------------------------------- InitBalPlatform: dec <Enemy_Y_Position,x ;raise vertical position by two pixels dec <Enemy_Y_Position,x ldy SecondaryHardMode ;if secondary hard mode flag not set, bne AlignP ;branch ahead ldy #$02 ;otherwise set value here jsr PosPlatform ;do a sub to add or subtract pixels AlignP: ldy #$ff ;set default value here for now lda BalPlatformAlignment ;get current balance platform alignment sta <Enemy_State,x ;set platform alignment to object state here bpl SetBPA ;if old alignment $ff, put $ff as alignment for negative txa ;if old contents already $ff, put tay ;object offset as alignment to make next positive SetBPA: sty BalPlatformAlignment ;store whatever value's in Y here lda #$00 sta <Enemy_MovingDir,x ;init moving direction tay ;init Y jsr PosPlatform ;do a sub to add 8 pixels, then run shared code here ;-------------------------------- InitDropPlatform: lda #$ff sta PlatformCollisionFlag,x ;set some value here jmp CommonPlatCode ;then jump ahead to execute more code ;-------------------------------- InitHoriPlatform: lda #$00 sta <XMoveSecondaryCounter,x ;init one of the moving counters jmp CommonPlatCode ;jump ahead to execute more code ;-------------------------------- InitVertPlatform: ldy #$40 ;set default value here lda <Enemy_Y_Position,x ;check vertical position bpl SetYO ;if above a certain point, skip this part eor #$ff clc ;otherwise get two's compliment adc #$01 ldy #$c0 ;get alternate value to add to vertical position SetYO: sta YPlatformTopYPos,x ;save as top vertical position tya clc ;load value from earlier, add number of pixels adc <Enemy_Y_Position,x ;to vertical position sta <YPlatformCenterYPos,x ;save result as central vertical position ;-------------------------------- CommonPlatCode: jsr InitVStf ;do a sub to init certain other values SPBBox: lda #$05 ;set default bounding box size control ldy AreaType cpy #$03 ;check for castle-type level beq CasPBB ;use default value if found ldy SecondaryHardMode ;otherwise check for secondary hard mode flag bne CasPBB ;if set, use default value lda #$06 ;use alternate value if not castle or secondary not set CasPBB: sta Enemy_BoundBoxCtrl,x ;set bounding box size control here and leave rts ;-------------------------------- LargeLiftUp: jsr PlatLiftUp ;execute code for platforms going up jmp LargeLiftBBox ;overwrite bounding box for large platforms LargeLiftDown: jsr PlatLiftDown ;execute code for platforms going down LargeLiftBBox: jmp SPBBox ;jump to overwrite bounding box size control ;-------------------------------- PlatLiftUp: lda #$10 ;set movement amount here sta Enemy_Y_MoveForce,x lda #$ff ;set moving speed for platforms going up sta <Enemy_Y_Speed,x jmp CommonSmallLift ;skip ahead to part we should be executing ;-------------------------------- PlatLiftDown: lda #$f0 ;set movement amount here sta Enemy_Y_MoveForce,x lda #$00 ;set moving speed for platforms going down sta <Enemy_Y_Speed,x ;-------------------------------- CommonSmallLift: ldy #$01 jsr PosPlatform ;do a sub to add 12 pixels due to preset value lda #$04 sta Enemy_BoundBoxCtrl,x ;set bounding box control for small platforms rts ;-------------------------------- PlatPosDataLow: .db $08,$0c,$f8 PlatPosDataHigh: .db $00,$00,$ff PosPlatform: lda <Enemy_X_Position,x ;get horizontal coordinate clc adc PlatPosDataLow,y ;add or subtract pixels depending on offset sta <Enemy_X_Position,x ;store as new horizontal coordinate lda <Enemy_PageLoc,x adc PlatPosDataHigh,y ;add or subtract page location depending on offset sta <Enemy_PageLoc,x ;store as new page location rts ;and go back ;-------------------------------- EndOfEnemyInitCode: rts ;------------------------------------------------------------------------------------- RunEnemyObjectsCore: ldx <ObjectOffset ;get offset for enemy object buffer lda #$00 ;load value 0 for jump engine by default ldy <Enemy_ID,x cpy #$15 ;if enemy object < $15, use default value bcc JmpEO tya ;otherwise subtract $14 from the value and use sbc #$14 ;as value for jump engine JmpEO: jsr JumpEngine .dw RunNormalEnemies ;for objects $00-$14 .dw RunBowserFlame ;for objects $15-$1f .dw RunFireworks .dw NoRunCode .dw NoRunCode .dw NoRunCode .dw NoRunCode .dw RunFirebarObj .dw RunFirebarObj .dw RunFirebarObj .dw RunFirebarObj .dw RunFirebarObj .dw RunFirebarObj ;for objects $20-$2f .dw RunFirebarObj .dw RunFirebarObj .dw NoRunCode .dw RunLargePlatform .dw RunLargePlatform .dw RunLargePlatform .dw RunLargePlatform .dw RunLargePlatform .dw RunLargePlatform .dw RunLargePlatform .dw RunSmallPlatform .dw RunSmallPlatform .dw RunBowser .dw PowerUpObjHandler .dw VineObjectHandler .dw NoRunCode ;for objects $30-$35 .dw RunStarFlagObj .dw JumpspringHandler .dw NoRunCode .dw WarpZoneObject .dw RunRetainerObj ;-------------------------------- NoRunCode: rts ;-------------------------------- RunRetainerObj: jsr GetEnemyOffscreenBits jsr RelativeEnemyPosition jmp EnemyGfxHandler ;-------------------------------- RunNormalEnemies: lda #$00 ;init sprite attributes sta Enemy_SprAttrib,x jsr GetEnemyOffscreenBits jsr RelativeEnemyPosition jsr EnemyGfxHandler jsr GetEnemyBoundBox jsr EnemyToBGCollisionDet jsr EnemiesCollision jsr PlayerEnemyCollision ldy TimerControl ;if master timer control set, skip to last routine bne SkipMove jsr EnemyMovementSubs SkipMove: jmp OffscreenBoundsCheck EnemyMovementSubs: lda <Enemy_ID,x jsr JumpEngine .dw MoveNormalEnemy ;only objects $00-$14 use this table .dw MoveNormalEnemy .dw MoveNormalEnemy .dw MoveNormalEnemy .dw MoveNormalEnemy .dw ProcHammerBro .dw MoveNormalEnemy .dw MoveBloober .dw MoveBulletBill .dw NoMoveCode .dw MoveSwimmingCheepCheep .dw MoveSwimmingCheepCheep .dw MovePodoboo .dw MovePiranhaPlant .dw MoveJumpingEnemy .dw ProcMoveRedPTroopa .dw MoveFlyGreenPTroopa .dw MoveLakitu .dw MoveNormalEnemy .dw NoMoveCode ;dummy .dw MoveFlyingCheepCheep ;-------------------------------- NoMoveCode: rts ;-------------------------------- RunBowserFlame: jsr ProcBowserFlame jsr GetEnemyOffscreenBits jsr RelativeEnemyPosition jsr GetEnemyBoundBox jsr PlayerEnemyCollision jmp OffscreenBoundsCheck ;-------------------------------- RunFirebarObj: jsr ProcFirebar jmp OffscreenBoundsCheck ;-------------------------------- RunSmallPlatform: jsr GetEnemyOffscreenBits jsr RelativeEnemyPosition jsr SmallPlatformBoundBox jsr SmallPlatformCollision jsr RelativeEnemyPosition jsr DrawSmallPlatform jsr MoveSmallPlatform jmp OffscreenBoundsCheck ;-------------------------------- RunLargePlatform: jsr GetEnemyOffscreenBits jsr RelativeEnemyPosition jsr LargePlatformBoundBox jsr LargePlatformCollision lda TimerControl ;if master timer control set, bne SkipPT ;skip subroutine tree jsr LargePlatformSubroutines SkipPT: jsr RelativeEnemyPosition jsr DrawLargePlatform jmp OffscreenBoundsCheck ;-------------------------------- LargePlatformSubroutines: lda <Enemy_ID,x ;subtract $24 to get proper offset for jump table sec sbc #$24 jsr JumpEngine .dw BalancePlatform ;table used by objects $24-$2a .dw YMovingPlatform .dw MoveLargeLiftPlat .dw MoveLargeLiftPlat .dw XMovingPlatform .dw DropPlatform .dw RightPlatform ;------------------------------------------------------------------------------------- EraseEnemyObject: lda #$00 ;clear all enemy object variables sta <Enemy_Flag,x sta <Enemy_ID,x sta <Enemy_State,x sta FloateyNum_Control,x sta EnemyIntervalTimer,x sta ShellChainCounter,x sta Enemy_SprAttrib,x sta EnemyFrameTimer,x rts ;------------------------------------------------------------------------------------- MovePodoboo: lda EnemyIntervalTimer,x ;check enemy timer bne PdbM ;branch to move enemy if not expired jsr InitPodoboo ;otherwise set up podoboo again lda PseudoRandomBitReg+1,x ;get part of LSFR ora #%10000000 ;set d7 sta Enemy_Y_MoveForce,x ;store as movement force and #%00001111 ;mask out high nybble ora #$06 ;set for at least six intervals sta EnemyIntervalTimer,x ;store as new enemy timer lda #$f9 sta <Enemy_Y_Speed,x ;set vertical speed to move podoboo upwards PdbM: jmp MoveJ_EnemyVertically ;branch to impose gravity on podoboo ;-------------------------------- ;$00 - used in HammerBroJumpCode as bitmask HammerThrowTmrData: .db $30, $1c XSpeedAdderData: .db $00, $e8, $00, $18 RevivedXSpeed: .db $08, $f8, $0c, $f4 ProcHammerBro: lda <Enemy_State,x ;check hammer bro's enemy state for d5 set and #%00100000 beq ChkJH ;if not set, go ahead with code jmp MoveDefeatedEnemy ;otherwise jump to something else ChkJH: lda <HammerBroJumpTimer,x ;check jump timer beq HammerBroJumpCode ;if expired, branch to jump dec <HammerBroJumpTimer,x ;otherwise decrement jump timer lda Enemy_OffscreenBits and #%00001100 ;check offscreen bits bne MoveHammerBroXDir ;if hammer bro a little offscreen, skip to movement code lda HammerThrowingTimer,x ;check hammer throwing timer bne DecHT ;if not expired, skip ahead, do not throw hammer ldy SecondaryHardMode ;otherwise get secondary hard mode flag lda HammerThrowTmrData,y ;get timer data using flag as offset sta HammerThrowingTimer,x ;set as new timer jsr SpawnHammerObj ;do a sub here to spawn hammer object bcc DecHT ;if carry clear, hammer not spawned, skip to decrement timer lda <Enemy_State,x ora #%00001000 ;set d3 in enemy state for hammer throw sta <Enemy_State,x jmp MoveHammerBroXDir ;jump to move hammer bro DecHT: dec HammerThrowingTimer,x ;decrement timer jmp MoveHammerBroXDir ;jump to move hammer bro HammerBroJumpLData: .db $20, $37 HammerBroJumpCode: lda <Enemy_State,x ;get hammer bro's enemy state and #%00000111 ;mask out all but 3 LSB cmp #$01 ;check for d0 set (for jumping) beq MoveHammerBroXDir ;if set, branch ahead to moving code lda #$00 ;load default value here sta <$00 ;save into temp variable for now ldy #$fa ;set default vertical speed lda <Enemy_Y_Position,x ;check hammer bro's vertical coordinate bmi SetHJ ;if on the bottom half of the screen, use current speed ldy #$fd ;otherwise set alternate vertical speed cmp #$70 ;check to see if hammer bro is above the middle of screen inc <$00 ;increment preset value to $01 bcc SetHJ ;if above the middle of the screen, use current speed and $01 dec <$00 ;otherwise return value to $00 lda PseudoRandomBitReg+1,x ;get part of LSFR, mask out all but LSB and #$01 bne SetHJ ;if d0 of LSFR set, branch and use current speed and $00 ldy #$fa ;otherwise reset to default vertical speed SetHJ: sty <Enemy_Y_Speed,x ;set vertical speed for jumping lda <Enemy_State,x ;set d0 in enemy state for jumping ora #$01 sta <Enemy_State,x lda <$00 ;load preset value here to use as bitmask and PseudoRandomBitReg+2,x ;and do bit-wise comparison with part of LSFR tay ;then use as offset lda SecondaryHardMode ;check secondary hard mode flag bne HJump tay ;if secondary hard mode flag clear, set offset to 0 HJump: lda HammerBroJumpLData,y ;get jump length timer data using offset from before sta EnemyFrameTimer,x ;save in enemy timer lda PseudoRandomBitReg+1,x ora #%11000000 ;get contents of part of LSFR, set d7 and d6, then sta <HammerBroJumpTimer,x ;store in jump timer MoveHammerBroXDir: ldy #$fc ;move hammer bro a little to the left lda <FrameCounter and #%01000000 ;change hammer bro's direction every 64 frames bne Shimmy ldy #$04 ;if d6 set in counter, move him a little to the right Shimmy: sty <Enemy_X_Speed,x ;store horizontal speed ldy #$01 ;set to face right by default jsr PlayerEnemyDiff ;get horizontal difference between player and hammer bro bmi SetShim ;if enemy to the left of player, skip this part iny ;set to face left lda EnemyIntervalTimer,x ;check walking timer bne SetShim ;if not yet expired, skip to set moving direction lda #$f8 sta <Enemy_X_Speed,x ;otherwise, make the hammer bro walk left towards player SetShim: sty <Enemy_MovingDir,x ;set moving direction MoveNormalEnemy: ldy #$00 ;init Y to leave horizontal movement as-is lda <Enemy_State,x and #%01000000 ;check enemy state for d6 set, if set skip bne FallE ;to move enemy vertically, then horizontally if necessary lda <Enemy_State,x asl a ;check enemy state for d7 set bcs SteadM ;if set, branch to move enemy horizontally lda <Enemy_State,x and #%00100000 ;check enemy state for d5 set bne MoveDefeatedEnemy ;if set, branch to move defeated enemy object lda <Enemy_State,x and #%00000111 ;check d2-d0 of enemy state for any set bits beq SteadM ;if enemy in normal state, branch to move enemy horizontally cmp #$05 beq FallE ;if enemy in state used by spiny's egg, go ahead here cmp #$03 bcs ReviveStunned ;if enemy in states $03 or $04, skip ahead to yet another part FallE: jsr MoveD_EnemyVertically ;do a sub here to move enemy downwards ldy #$00 lda <Enemy_State,x ;check for enemy state $02 cmp #$02 beq MEHor ;if found, branch to move enemy horizontally and #%01000000 ;check for d6 set beq SteadM ;if not set, branch to something else lda <Enemy_ID,x cmp #PowerUpObject ;check for power-up object beq SteadM bne SlowM ;if any other object where d6 set, jump to set Y MEHor: jmp MoveEnemyHorizontally ;jump here to move enemy horizontally for <> $2e and d6 set SlowM: ldy #$01 ;if branched here, increment Y to slow horizontal movement SteadM: lda <Enemy_X_Speed,x ;get current horizontal speed pha ;save to stack bpl AddHS ;if not moving or moving right, skip, leave Y alone iny iny ;otherwise increment Y to next data AddHS: clc adc XSpeedAdderData,y ;add value here to slow enemy down if necessary sta <Enemy_X_Speed,x ;save as horizontal speed temporarily jsr MoveEnemyHorizontally ;then do a sub to move horizontally pla sta <Enemy_X_Speed,x ;get old horizontal speed from stack and return to rts ;original memory location, then leave ReviveStunned: lda EnemyIntervalTimer,x ;if enemy timer not expired yet, bne ChkKillGoomba ;skip ahead to something else sta <Enemy_State,x ;otherwise initialize enemy state to normal lda <FrameCounter and #$01 ;get d0 of frame counter tay ;use as Y and increment for movement direction iny sty <Enemy_MovingDir,x ;store as pseudorandom movement direction dey ;decrement for use as pointer lda PrimaryHardMode ;check primary hard mode flag beq SetRSpd ;if not set, use pointer as-is iny iny ;otherwise increment 2 bytes to next data SetRSpd: lda RevivedXSpeed,y ;load and store new horizontal speed sta <Enemy_X_Speed,x ;and leave rts MoveDefeatedEnemy: jsr MoveD_EnemyVertically ;execute sub to move defeated enemy downwards jmp MoveEnemyHorizontally ;now move defeated enemy horizontally ChkKillGoomba: cmp #$0e ;check to see if enemy timer has reached bne NKGmba ;a certain point, and branch to leave if not lda <Enemy_ID,x cmp #Goomba ;check for goomba object bne NKGmba ;branch if not found jsr EraseEnemyObject ;otherwise, kill this goomba object NKGmba: rts ;leave! ;-------------------------------- MoveJumpingEnemy: jsr MoveJ_EnemyVertically ;do a sub to impose gravity on green paratroopa jmp MoveEnemyHorizontally ;jump to move enemy horizontally ;-------------------------------- ProcMoveRedPTroopa: lda <Enemy_Y_Speed,x ora Enemy_Y_MoveForce,x ;check for any vertical force or speed bne MoveRedPTUpOrDown ;branch if any found sta Enemy_YMF_Dummy,x ;initialize something here lda <Enemy_Y_Position,x ;check current vs. original vertical coordinate cmp RedPTroopaOrigXPos,x bcs MoveRedPTUpOrDown ;if current => original, skip ahead to more code lda <FrameCounter ;get frame counter and #%00000111 ;mask out all but 3 LSB bne NoIncPT ;if any bits set, branch to leave inc <Enemy_Y_Position,x ;otherwise increment red paratroopa's vertical position NoIncPT: rts ;leave MoveRedPTUpOrDown: lda <Enemy_Y_Position,x ;check current vs. central vertical coordinate cmp <RedPTroopaCenterYPos,x bcc MovPTDwn ;if current < central, jump to move downwards jmp MoveRedPTroopaUp ;otherwise jump to move upwards MovPTDwn: jmp MoveRedPTroopaDown ;move downwards ;-------------------------------- ;$00 - used to store adder for movement, also used as adder for platform ;$01 - used to store maximum value for secondary counter MoveFlyGreenPTroopa: jsr XMoveCntr_GreenPTroopa ;do sub to increment primary and secondary counters jsr MoveWithXMCntrs ;do sub to move green paratroopa accordingly, and horizontally ldy #$01 ;set Y to move green paratroopa down lda <FrameCounter and #%00000011 ;check frame counter 2 LSB for any bits set bne NoMGPT ;branch to leave if set to move up/down every fourth frame lda <FrameCounter and #%01000000 ;check frame counter for d6 set bne YSway ;branch to move green paratroopa down if set ldy #$ff ;otherwise set Y to move green paratroopa up YSway: sty <$00 ;store adder here lda <Enemy_Y_Position,x clc ;add or subtract from vertical position adc <$00 ;to give green paratroopa a wavy flight sta <Enemy_Y_Position,x NoMGPT: rts ;leave! XMoveCntr_GreenPTroopa: lda #$13 ;load preset maximum value for secondary counter XMoveCntr_Platform: sta <$01 ;store value here lda <FrameCounter and #%00000011 ;branch to leave if not on bne NoIncXM ;every fourth frame ldy <XMoveSecondaryCounter,x ;get secondary counter lda <XMovePrimaryCounter,x ;get primary counter lsr a bcs DecSeXM ;if d0 of primary counter set, branch elsewhere cpy <$01 ;compare secondary counter to preset maximum value beq IncPXM ;if equal, branch ahead of this part inc <XMoveSecondaryCounter,x ;increment secondary counter and leave NoIncXM: rts IncPXM: inc <XMovePrimaryCounter,x ;increment primary counter and leave rts DecSeXM: tya ;put secondary counter in A beq IncPXM ;if secondary counter at zero, branch back dec <XMoveSecondaryCounter,x ;otherwise decrement secondary counter and leave rts MoveWithXMCntrs: lda <XMoveSecondaryCounter,x ;save secondary counter to stack pha ldy #$01 ;set value here by default lda <XMovePrimaryCounter,x and #%00000010 ;if d1 of primary counter is bne XMRight ;set, branch ahead of this part here lda <XMoveSecondaryCounter,x eor #$ff ;otherwise change secondary clc ;counter to two's compliment adc #$01 sta <XMoveSecondaryCounter,x ldy #$02 ;load alternate value here XMRight: sty <Enemy_MovingDir,x ;store as moving direction jsr MoveEnemyHorizontally sta <$00 ;save value obtained from sub here pla ;get secondary counter from stack sta <XMoveSecondaryCounter,x ;and return to original place rts ;-------------------------------- BlooberBitmasks: .db %00111111, %00000011 MoveBloober: lda <Enemy_State,x and #%00100000 ;check enemy state for d5 set bne MoveDefeatedBloober ;branch if set to move defeated bloober ldy SecondaryHardMode ;use secondary hard mode flag as offset lda PseudoRandomBitReg+1,x ;get LSFR and BlooberBitmasks,y ;mask out bits in LSFR using bitmask loaded with offset bne BlooberSwim ;if any bits set, skip ahead to make swim txa lsr a ;check to see if on second or fourth slot (1 or 3) bcc FBLeft ;if not, branch to figure out moving direction ldy <Player_MovingDir ;otherwise, load player's moving direction and bcs SBMDir ;do an unconditional branch to set FBLeft: ldy #$02 ;set left moving direction by default jsr PlayerEnemyDiff ;get horizontal difference between player and bloober bpl SBMDir ;if enemy to the right of player, keep left dey ;otherwise decrement to set right moving direction SBMDir: sty <Enemy_MovingDir,x ;set moving direction of bloober, then continue on here BlooberSwim: jsr ProcSwimmingB ;execute sub to make bloober swim characteristically lda <Enemy_Y_Position,x ;get vertical coordinate sec sbc Enemy_Y_MoveForce,x ;subtract movement force cmp #$20 ;check to see if position is above edge of status bar bcc SwimX ;if so, don't do it sta <Enemy_Y_Position,x ;otherwise, set new vertical position, make bloober swim SwimX: ldy <Enemy_MovingDir,x ;check moving direction dey bne LeftSwim ;if moving to the left, branch to second part lda <Enemy_X_Position,x clc ;add movement speed to horizontal coordinate adc <BlooperMoveSpeed,x sta <Enemy_X_Position,x ;store result as new horizontal coordinate lda <Enemy_PageLoc,x adc #$00 ;add carry to page location sta <Enemy_PageLoc,x ;store as new page location and leave rts LeftSwim: lda <Enemy_X_Position,x sec ;subtract movement speed from horizontal coordinate sbc <BlooperMoveSpeed,x sta <Enemy_X_Position,x ;store result as new horizontal coordinate lda <Enemy_PageLoc,x sbc #$00 ;subtract borrow from page location sta <Enemy_PageLoc,x ;store as new page location and leave rts MoveDefeatedBloober: jmp MoveEnemySlowVert ;jump to move defeated bloober downwards ProcSwimmingB: lda <BlooperMoveCounter,x ;get enemy's movement counter and #%00000010 ;check for d1 set bne ChkForFloatdown ;branch if set lda <FrameCounter and #%00000111 ;get 3 LSB of frame counter pha ;and save it to the stack lda <BlooperMoveCounter,x ;get enemy's movement counter lsr a ;check for d0 set bcs SlowSwim ;branch if set pla ;pull 3 LSB of frame counter from the stack bne BSwimE ;branch to leave, execute code only every eighth frame lda Enemy_Y_MoveForce,x clc ;add to movement force to speed up swim adc #$01 sta Enemy_Y_MoveForce,x ;set movement force sta <BlooperMoveSpeed,x ;set as movement speed cmp #$02 bne BSwimE ;if certain horizontal speed, branch to leave inc <BlooperMoveCounter,x ;otherwise increment movement counter BSwimE: rts SlowSwim: pla ;pull 3 LSB of frame counter from the stack bne NoSSw ;branch to leave, execute code only every eighth frame lda Enemy_Y_MoveForce,x sec ;subtract from movement force to slow swim sbc #$01 sta Enemy_Y_MoveForce,x ;set movement force sta <BlooperMoveSpeed,x ;set as movement speed bne NoSSw ;if any speed, branch to leave inc <BlooperMoveCounter,x ;otherwise increment movement counter lda #$02 sta EnemyIntervalTimer,x ;set enemy's timer NoSSw: rts ;leave ChkForFloatdown: lda EnemyIntervalTimer,x ;get enemy timer beq ChkNearPlayer ;branch if expired Floatdown: lda <FrameCounter ;get frame counter lsr a ;check for d0 set bcs NoFD ;branch to leave on every other frame inc <Enemy_Y_Position,x ;otherwise increment vertical coordinate NoFD: rts ;leave ChkNearPlayer: lda <Enemy_Y_Position,x ;get vertical coordinate adc #$10 ;add sixteen pixels cmp <Player_Y_Position ;compare result with player's vertical coordinate bcc Floatdown ;if modified vertical less than player's, branch lda #$00 sta <BlooperMoveCounter,x ;otherwise nullify movement counter rts ;-------------------------------- MoveBulletBill: lda <Enemy_State,x ;check bullet bill's enemy object state for d5 set and #%00100000 beq NotDefB ;if not set, continue with movement code jmp MoveJ_EnemyVertically ;otherwise jump to move defeated bullet bill downwards NotDefB: lda #$e8 ;set bullet bill's horizontal speed sta <Enemy_X_Speed,x ;and move it accordingly (note: this bullet bill jmp MoveEnemyHorizontally ;object occurs in frenzy object $17, not from cannons) ;-------------------------------- ;$02 - used to hold preset values ;$03 - used to hold enemy state SwimCCXMoveData: .db $40, $80 .db $04, $04 ;residual data, not used MoveSwimmingCheepCheep: lda <Enemy_State,x ;check cheep-cheep's enemy object state and #%00100000 ;for d5 set beq CCSwim ;if not set, continue with movement code jmp MoveEnemySlowVert ;otherwise jump to move defeated cheep-cheep downwards CCSwim: sta <$03 ;save enemy state in $03 lda <Enemy_ID,x ;get enemy identifier sec sbc #$0a ;subtract ten for cheep-cheep identifiers tay ;use as offset lda SwimCCXMoveData,y ;load value here sta <$02 lda Enemy_X_MoveForce,x ;load horizontal force sec sbc <$02 ;subtract preset value from horizontal force sta Enemy_X_MoveForce,x ;store as new horizontal force lda <Enemy_X_Position,x ;get horizontal coordinate sbc #$00 ;subtract borrow (thus moving it slowly) sta <Enemy_X_Position,x ;and save as new horizontal coordinate lda <Enemy_PageLoc,x sbc #$00 ;subtract borrow again, this time from the sta <Enemy_PageLoc,x ;page location, then save lda #$20 sta <$02 ;save new value here cpx #$02 ;check enemy object offset bcc ExSwCC ;if in first or second slot, branch to leave lda <CheepCheepMoveMFlag,x ;check movement flag cmp #$10 ;if movement speed set to $00, bcc CCSwimUpwards ;branch to move upwards lda Enemy_YMF_Dummy,x clc adc <$02 ;add preset value to dummy variable to get carry sta Enemy_YMF_Dummy,x ;and save dummy lda <Enemy_Y_Position,x ;get vertical coordinate adc <$03 ;add carry to it plus enemy state to slowly move it downwards sta <Enemy_Y_Position,x ;save as new vertical coordinate lda <Enemy_Y_HighPos,x adc #$00 ;add carry to page location and jmp ChkSwimYPos ;jump to end of movement code CCSwimUpwards: lda Enemy_YMF_Dummy,x sec sbc <$02 ;subtract preset value to dummy variable to get borrow sta Enemy_YMF_Dummy,x ;and save dummy lda <Enemy_Y_Position,x ;get vertical coordinate sbc <$03 ;subtract borrow to it plus enemy state to slowly move it upwards sta <Enemy_Y_Position,x ;save as new vertical coordinate lda <Enemy_Y_HighPos,x sbc #$00 ;subtract borrow from page location ChkSwimYPos: sta <Enemy_Y_HighPos,x ;save new page location here ldy #$00 ;load movement speed to upwards by default lda <Enemy_Y_Position,x ;get vertical coordinate sec sbc CheepCheepOrigYPos,x ;subtract original coordinate from current bpl YPDiff ;if result positive, skip to next part ldy #$10 ;otherwise load movement speed to downwards eor #$ff clc ;get two's compliment of result adc #$01 ;to obtain total difference of original vs. current YPDiff: cmp #$0f ;if difference between original vs. current vertical bcc ExSwCC ;coordinates < 15 pixels, leave movement speed alone tya sta <CheepCheepMoveMFlag,x ;otherwise change movement speed ExSwCC: rts ;leave ;-------------------------------- ;$00 - used as counter for firebar parts ;$01 - used for oscillated high byte of spin state or to hold horizontal adder ;$02 - used for oscillated high byte of spin state or to hold vertical adder ;$03 - used for mirror data ;$04 - used to store player's sprite 1 X coordinate ;$05 - used to evaluate mirror data ;$06 - used to store either screen X coordinate or sprite data offset ;$07 - used to store screen Y coordinate ;$ed - used to hold maximum length of firebar ;$ef - used to hold high byte of spinstate ;horizontal adder is at first byte + high byte of spinstate, ;vertical adder is same + 8 bytes, two's compliment ;if greater than $08 for proper oscillation FirebarPosLookupTbl: .db $00, $01, $03, $04, $05, $06, $07, $07, $08 .db $00, $03, $06, $09, $0b, $0d, $0e, $0f, $10 .db $00, $04, $09, $0d, $10, $13, $16, $17, $18 .db $00, $06, $0c, $12, $16, $1a, $1d, $1f, $20 .db $00, $07, $0f, $16, $1c, $21, $25, $27, $28 .db $00, $09, $12, $1b, $21, $27, $2c, $2f, $30 .db $00, $0b, $15, $1f, $27, $2e, $33, $37, $38 .db $00, $0c, $18, $24, $2d, $35, $3b, $3e, $40 .db $00, $0e, $1b, $28, $32, $3b, $42, $46, $48 .db $00, $0f, $1f, $2d, $38, $42, $4a, $4e, $50 .db $00, $11, $22, $31, $3e, $49, $51, $56, $58 FirebarMirrorData: .db $01, $03, $02, $00 FirebarTblOffsets: .db $00, $09, $12, $1b, $24, $2d .db $36, $3f, $48, $51, $5a, $63 FirebarYPos: .db $0c, $18 ProcFirebar: jsr GetEnemyOffscreenBits ;get offscreen information lda Enemy_OffscreenBits ;check for d3 set and #%00001000 ;if so, branch to leave bne SkipFBar lda TimerControl ;if master timer control set, branch bne SusFbar ;ahead of this part lda FirebarSpinSpeed,x ;load spinning speed of firebar jsr FirebarSpin ;modify current spinstate and #%00011111 ;mask out all but 5 LSB sta <FirebarSpinState_High,x ;and store as new high byte of spinstate SusFbar: lda <FirebarSpinState_High,x ;get high byte of spinstate ldy <Enemy_ID,x ;check enemy identifier cpy #$1f bcc SetupGFB ;if < $1f (long firebar), branch cmp #$08 ;check high byte of spinstate beq SkpFSte ;if eight, branch to change cmp #$18 bne SetupGFB ;if not at twenty-four branch to not change SkpFSte: clc adc #$01 ;add one to spinning thing to avoid horizontal state sta <FirebarSpinState_High,x SetupGFB: sta <$ef ;save high byte of spinning thing, modified or otherwise jsr RelativeEnemyPosition ;get relative coordinates to screen jsr GetFirebarPosition ;do a sub here (residual, too early to be used now) ldy Enemy_SprDataOffset,x ;get OAM data offset lda Enemy_Rel_YPos ;get relative vertical coordinate sta Sprite_Y_Position,y ;store as Y in OAM data sta <$07 ;also save here lda Enemy_Rel_XPos ;get relative horizontal coordinate sta Sprite_X_Position,y ;store as X in OAM data sta <$06 ;also save here lda #$01 sta <$00 ;set $01 value here (not necessary) jsr FirebarCollision ;draw fireball part and do collision detection ldy #$05 ;load value for short firebars by default lda <Enemy_ID,x cmp #$1f ;are we doing a long firebar? bcc SetMFbar ;no, branch then ldy #$0b ;otherwise load value for long firebars SetMFbar: sty <$ed ;store maximum value for length of firebars lda #$00 sta <$00 ;initialize counter here DrawFbar: lda <$ef ;load high byte of spinstate jsr GetFirebarPosition ;get fireball position data depending on firebar part jsr DrawFirebar_Collision ;position it properly, draw it and do collision detection lda <$00 ;check which firebar part cmp #$04 bne NextFbar ldy DuplicateObj_Offset ;if we arrive at fifth firebar part, lda Enemy_SprDataOffset,y ;get offset from long firebar and load OAM data offset sta <$06 ;using long firebar offset, then store as new one here NextFbar: inc <$00 ;move onto the next firebar part lda <$00 cmp <$ed ;if we end up at the maximum part, go on and leave bcc DrawFbar ;otherwise go back and do another SkipFBar: rts DrawFirebar_Collision: lda <$03 ;store mirror data elsewhere sta <$05 ldy <$06 ;load OAM data offset for firebar lda <$01 ;load horizontal adder we got from position loader lsr <$05 ;shift LSB of mirror data bcs AddHA ;if carry was set, skip this part eor #$ff adc #$01 ;otherwise get two's compliment of horizontal adder AddHA: clc ;add horizontal coordinate relative to screen to adc Enemy_Rel_XPos ;horizontal adder, modified or otherwise sta Sprite_X_Position,y ;store as X coordinate here sta <$06 ;store here for now, note offset is saved in Y still cmp Enemy_Rel_XPos ;compare X coordinate of sprite to original X of firebar bcs SubtR1 ;if sprite coordinate => original coordinate, branch lda Enemy_Rel_XPos sec ;otherwise subtract sprite X from the sbc <$06 ;original one and skip this part jmp ChkFOfs SubtR1: sec ;subtract original X from the sbc Enemy_Rel_XPos ;current sprite X ChkFOfs: cmp #$59 ;if difference of coordinates within a certain range, bcc VAHandl ;continue by handling vertical adder lda #$f8 ;otherwise, load offscreen Y coordinate bne SetVFbr ;and unconditionally branch to move sprite offscreen VAHandl: lda Enemy_Rel_YPos ;if vertical relative coordinate offscreen, cmp #$f8 ;skip ahead of this part and write into sprite Y coordinate beq SetVFbr lda <$02 ;load vertical adder we got from position loader lsr <$05 ;shift LSB of mirror data one more time bcs AddVA ;if carry was set, skip this part eor #$ff adc #$01 ;otherwise get two's compliment of second part AddVA: clc ;add vertical coordinate relative to screen to adc Enemy_Rel_YPos ;the second data, modified or otherwise SetVFbr: sta Sprite_Y_Position,y ;store as Y coordinate here sta <$07 ;also store here for now FirebarCollision: jsr DrawFirebar ;run sub here to draw current tile of firebar tya ;return OAM data offset and save pha ;to the stack for now lda StarInvincibleTimer ;if star mario invincibility timer ora TimerControl ;or master timer controls set bne NoColFB ;then skip all of this sta <$05 ;otherwise initialize counter ldy <Player_Y_HighPos dey ;if player's vertical high byte offscreen, bne NoColFB ;skip all of this ldy <Player_Y_Position ;get player's vertical position lda PlayerSize ;get player's size bne AdjSm ;if player small, branch to alter variables lda CrouchingFlag beq BigJp ;if player big and not crouching, jump ahead AdjSm: inc <$05 ;if small or big but crouching, execute this part inc <$05 ;first increment our counter twice (setting $02 as flag) tya clc ;then add 24 pixels to the player's adc #$18 ;vertical coordinate tay BigJp: tya ;get vertical coordinate, altered or otherwise, from Y FBCLoop: sec ;subtract vertical position of firebar sbc <$07 ;from the vertical coordinate of the player bpl ChkVFBD ;if player lower on the screen than firebar, eor #$ff ;skip two's compliment part clc ;otherwise get two's compliment adc #$01 ChkVFBD: cmp #$08 ;if difference => 8 pixels, skip ahead of this part bcs Chk2Ofs lda <$06 ;if firebar on far right on the screen, skip this, cmp #$f0 ;because, really, what's the point? bcs Chk2Ofs lda Sprite_X_Position+4 ;get OAM X coordinate for sprite #1 clc adc #$04 ;add four pixels sta <$04 ;store here sec ;subtract horizontal coordinate of firebar sbc <$06 ;from the X coordinate of player's sprite 1 bpl ChkFBCl ;if modded X coordinate to the right of firebar eor #$ff ;skip two's compliment part clc ;otherwise get two's compliment adc #$01 ChkFBCl: cmp #$08 ;if difference < 8 pixels, collision, thus branch bcc ChgSDir ;to process Chk2Ofs: lda <$05 ;if value of $02 was set earlier for whatever reason, cmp #$02 ;branch to increment OAM offset and leave, no collision beq NoColFB ldy <$05 ;otherwise get temp here and use as offset lda <Player_Y_Position clc adc FirebarYPos,y ;add value loaded with offset to player's vertical coordinate inc <$05 ;then increment temp and jump back jmp FBCLoop ChgSDir: ldx #$01 ;set movement direction by default lda <$04 ;if OAM X coordinate of player's sprite 1 cmp <$06 ;is greater than horizontal coordinate of firebar bcs SetSDir ;then do not alter movement direction inx ;otherwise increment it SetSDir: stx <Enemy_MovingDir ;store movement direction here ldx #$00 lda <$00 ;save value written to $00 to stack pha jsr InjurePlayer ;perform sub to hurt or kill player pla sta <$00 ;get value of $00 from stack NoColFB: pla ;get OAM data offset clc ;add four to it and save adc #$04 sta <$06 ldx <ObjectOffset ;get enemy object buffer offset and leave rts GetFirebarPosition: pha ;save high byte of spinstate to the stack and #%00001111 ;mask out low nybble cmp #$09 bcc GetHAdder ;if lower than $09, branch ahead eor #%00001111 ;otherwise get two's compliment to oscillate clc adc #$01 GetHAdder: sta <$01 ;store result, modified or not, here ldy <$00 ;load number of firebar ball where we're at lda FirebarTblOffsets,y ;load offset to firebar position data clc adc <$01 ;add oscillated high byte of spinstate tay ;to offset here and use as new offset lda FirebarPosLookupTbl,y ;get data here and store as horizontal adder sta <$01 pla ;pull whatever was in A from the stack pha ;save it again because we still need it clc adc #$08 ;add eight this time, to get vertical adder and #%00001111 ;mask out high nybble cmp #$09 ;if lower than $09, branch ahead bcc GetVAdder eor #%00001111 ;otherwise get two's compliment clc adc #$01 GetVAdder: sta <$02 ;store result here ldy <$00 lda FirebarTblOffsets,y ;load offset to firebar position data again clc adc <$02 ;this time add value in $02 to offset here and use as offset tay lda FirebarPosLookupTbl,y ;get data here and store as vertica adder sta <$02 pla ;pull out whatever was in A one last time lsr a ;divide by eight or shift three to the right lsr a lsr a tay ;use as offset lda FirebarMirrorData,y ;load mirroring data here sta <$03 ;store rts ;-------------------------------- PRandomSubtracter: .db $f8, $a0, $70, $bd, $00 FlyCCBPriority: .db $20, $20, $20, $00, $00 MoveFlyingCheepCheep: lda <Enemy_State,x ;check cheep-cheep's enemy state and #%00100000 ;for d5 set beq FlyCC ;branch to continue code if not set lda #$00 sta Enemy_SprAttrib,x ;otherwise clear sprite attributes jmp MoveJ_EnemyVertically ;and jump to move defeated cheep-cheep downwards FlyCC: jsr MoveEnemyHorizontally ;move cheep-cheep horizontally based on speed and force ldy #$0d ;set vertical movement amount lda #$05 ;set maximum speed jsr SetXMoveAmt ;branch to impose gravity on flying cheep-cheep lda Enemy_Y_MoveForce,x lsr a ;get vertical movement force and lsr a ;move high nybble to low lsr a lsr a tay ;save as offset (note this tends to go into reach of code) lda <Enemy_Y_Position,x ;get vertical position sec ;subtract pseudorandom value based on offset from position sbc PRandomSubtracter,y bpl AddCCF ;if result within top half of screen, skip this part eor #$ff clc ;otherwise get two's compliment adc #$01 AddCCF: cmp #$08 ;if result or two's compliment greater than eight, bcs BPGet ;skip to the end without changing movement force lda Enemy_Y_MoveForce,x clc adc #$10 ;otherwise add to it sta Enemy_Y_MoveForce,x lsr a ;move high nybble to low again lsr a lsr a lsr a tay BPGet: lda FlyCCBPriority,y ;load bg priority data and store (this is very likely sta Enemy_SprAttrib,x ;broken or residual code, value is overwritten before rts ;drawing it next frame), then leave ;-------------------------------- ;$00 - used to hold horizontal difference ;$01-$03 - used to hold difference adjusters LakituDiffAdj: .db $15, $30, $40 MoveLakitu: lda <Enemy_State,x ;check lakitu's enemy state and #%00100000 ;for d5 set beq ChkLS ;if not set, continue with code jmp MoveD_EnemyVertically ;otherwise jump to move defeated lakitu downwards ChkLS: lda <Enemy_State,x ;if lakitu's enemy state not set at all, beq Fr12S ;go ahead and continue with code lda #$00 sta <LakituMoveDirection,x ;otherwise initialize moving direction to move to left sta EnemyFrenzyBuffer ;initialize frenzy buffer lda #$10 bne SetLSpd ;load horizontal speed and do unconditional branch Fr12S: lda #Spiny sta EnemyFrenzyBuffer ;set spiny identifier in frenzy buffer ldy #$02 LdLDa: lda LakituDiffAdj,y ;load values sta $0001,y ;store in zero page dey bpl LdLDa ;do this until all values are stired jsr PlayerLakituDiff ;execute sub to set speed and create spinys SetLSpd: sta <LakituMoveSpeed,x ;set movement speed returned from sub ldy #$01 ;set moving direction to right by default lda <LakituMoveDirection,x and #$01 ;get LSB of moving direction bne SetLMov ;if set, branch to the end to use moving direction lda <LakituMoveSpeed,x eor #$ff ;get two's compliment of moving speed clc adc #$01 sta <LakituMoveSpeed,x ;store as new moving speed iny ;increment moving direction to left SetLMov: sty <Enemy_MovingDir,x ;store moving direction jmp MoveEnemyHorizontally ;move lakitu horizontally PlayerLakituDiff: ldy #$00 ;set Y for default value jsr PlayerEnemyDiff ;get horizontal difference between enemy and player bpl ChkLakDif ;branch if enemy is to the right of the player iny ;increment Y for left of player lda <$00 eor #$ff ;get two's compliment of low byte of horizontal difference clc adc #$01 ;store two's compliment as horizontal difference sta <$00 ChkLakDif: lda <$00 ;get low byte of horizontal difference cmp #$3c ;if within a certain distance of player, branch bcc ChkPSpeed lda #$3c ;otherwise set maximum distance sta <$00 lda <Enemy_ID,x ;check if lakitu is in our current enemy slot cmp #Lakitu bne ChkPSpeed ;if not, branch elsewhere tya ;compare contents of Y, now in A cmp <LakituMoveDirection,x ;to what is being used as horizontal movement direction beq ChkPSpeed ;if moving toward the player, branch, do not alter lda <LakituMoveDirection,x ;if moving to the left beyond maximum distance, beq SetLMovD ;branch and alter without delay dec <LakituMoveSpeed,x ;decrement horizontal speed lda <LakituMoveSpeed,x ;if horizontal speed not yet at zero, branch to leave bne ExMoveLak SetLMovD: tya ;set horizontal direction depending on horizontal sta <LakituMoveDirection,x ;difference between enemy and player if necessary ChkPSpeed: lda <$00 and #%00111100 ;mask out all but four bits in the middle lsr a ;divide masked difference by four lsr a sta <$00 ;store as new value ldy #$00 ;init offset lda <Player_X_Speed beq SubDifAdj ;if player not moving horizontally, branch lda ScrollAmount beq SubDifAdj ;if scroll speed not set, branch to same place iny ;otherwise increment offset lda <Player_X_Speed cmp #$19 ;if player not running, branch bcc ChkSpinyO lda ScrollAmount cmp #$02 ;if scroll speed below a certain amount, branch bcc ChkSpinyO ;to same place iny ;otherwise increment once more ChkSpinyO: lda <Enemy_ID,x ;check for spiny object cmp #Spiny bne ChkEmySpd ;branch if not found lda <Player_X_Speed ;if player not moving, skip this part bne SubDifAdj ChkEmySpd: lda <Enemy_Y_Speed,x ;check vertical speed bne SubDifAdj ;branch if nonzero ldy #$00 ;otherwise reinit offset SubDifAdj: lda $0001,y ;get one of three saved values from earlier ldy <$00 ;get saved horizontal difference SPixelLak: sec ;subtract one for each pixel of horizontal difference sbc #$01 ;from one of three saved values dey bpl SPixelLak ;branch until all pixels are subtracted, to adjust difference ExMoveLak: rts ;leave!!! ;------------------------------------------------------------------------------------- ;$04-$05 - used to store name table address in little endian order BridgeCollapseData: .db $1a ;axe .db $58 ;chain .db $98, $96, $94, $92, $90, $8e, $8c ;bridge .db $8a, $88, $86, $84, $82, $80 BridgeCollapse: ldx BowserFront_Offset ;get enemy offset for bowser lda <Enemy_ID,x ;check enemy object identifier for bowser cmp #Bowser ;if not found, branch ahead, bne SetM2 ;metatile removal not necessary stx <ObjectOffset ;store as enemy offset here lda <Enemy_State,x ;if bowser in normal state, skip all of this beq RemoveBridge and #%01000000 ;if bowser's state has d6 clear, skip to silence music beq SetM2 lda <Enemy_Y_Position,x ;check bowser's vertical coordinate cmp #$e0 ;if bowser not yet low enough, skip this part ahead bcc MoveD_Bowser SetM2: lda #Silence ;silence music sta <EventMusicQueue inc OperMode_Task ;move onto next secondary mode in autoctrl mode jmp KillAllEnemies ;jump to empty all enemy slots and then leave MoveD_Bowser: jsr MoveEnemySlowVert ;do a sub to move bowser downwards jmp BowserGfxHandler ;jump to draw bowser's front and rear, then leave RemoveBridge: dec BowserFeetCounter ;decrement timer to control bowser's feet bne NoBFall ;if not expired, skip all of this lda #$04 sta BowserFeetCounter ;otherwise, set timer now lda BowserBodyControls eor #$01 ;invert bit to control bowser's feet sta BowserBodyControls lda #$22 ;put high byte of name table address here for now sta <$05 ldy BridgeCollapseOffset ;get bridge collapse offset here lda BridgeCollapseData,y ;load low byte of name table address and store here sta <$04 ldy VRAM_Buffer1_Offset ;increment vram buffer offset iny ldx #$0c ;set offset for tile data for sub to draw blank metatile jsr RemBridge ;do sub here to remove bowser's bridge metatiles ldx <ObjectOffset ;get enemy offset jsr MoveVOffset ;set new vram buffer offset lda #Sfx_Blast ;load the fireworks/gunfire sound into the square 2 sfx sta <Square2SoundQueue ;queue while at the same time loading the brick lda #Sfx_BrickShatter ;shatter sound into the noise sfx queue thus sta <NoiseSoundQueue ;producing the unique sound of the bridge collapsing inc BridgeCollapseOffset ;increment bridge collapse offset lda BridgeCollapseOffset cmp #$0f ;if bridge collapse offset has not yet reached bne NoBFall ;the end, go ahead and skip this part jsr InitVStf ;initialize whatever vertical speed bowser has lda #%01000000 sta <Enemy_State,x ;set bowser's state to one of defeated states (d6 set) lda #Sfx_BowserFall sta <Square2SoundQueue ;play bowser defeat sound NoBFall: jmp BowserGfxHandler ;jump to code that draws bowser ;-------------------------------- PRandomRange: .db $21, $41, $11, $31 RunBowser: lda <Enemy_State,x ;if d5 in enemy state is not set and #%00100000 ;then branch elsewhere to run bowser beq BowserControl lda <Enemy_Y_Position,x ;otherwise check vertical position cmp #$e0 ;if above a certain point, branch to move defeated bowser bcc MoveD_Bowser ;otherwise proceed to KillAllEnemies KillAllEnemies: ldx #$04 ;start with last enemy slot KillLoop: jsr EraseEnemyObject ;branch to kill enemy objects dex ;move onto next enemy slot bpl KillLoop ;do this until all slots are emptied sta EnemyFrenzyBuffer ;empty frenzy buffer ldx <ObjectOffset ;get enemy object offset and leave rts BowserControl: lda #$00 sta EnemyFrenzyBuffer ;empty frenzy buffer lda TimerControl ;if master timer control not set, beq ChkMouth ;skip jump and execute code here jmp SkipToFB ;otherwise, jump over a bunch of code ChkMouth: lda BowserBodyControls ;check bowser's mouth bpl FeetTmr ;if bit clear, go ahead with code here jmp HammerChk ;otherwise skip a whole section starting here FeetTmr: dec BowserFeetCounter ;decrement timer to control bowser's feet bne ResetMDr ;if not expired, skip this part lda #$20 ;otherwise, reset timer sta BowserFeetCounter lda BowserBodyControls ;and invert bit used eor #%00000001 ;to control bowser's feet sta BowserBodyControls ResetMDr: lda <FrameCounter ;check frame counter and #%00001111 ;if not on every sixteenth frame, skip bne B_FaceP ;ahead to continue code lda #$02 ;otherwise reset moving/facing direction every sta <Enemy_MovingDir,x ;sixteen frames B_FaceP: lda EnemyFrameTimer,x ;if timer set here expired, beq GetPRCmp ;branch to next section jsr PlayerEnemyDiff ;get horizontal difference between player and bowser, bpl GetPRCmp ;and branch if bowser to the right of the player lda #$01 sta <Enemy_MovingDir,x ;set bowser to move and face to the right lda #$02 sta BowserMovementSpeed ;set movement speed lda #$20 sta EnemyFrameTimer,x ;set timer here sta BowserFireBreathTimer ;set timer used for bowser's flame lda <Enemy_X_Position,x cmp #$c8 ;if bowser to the right past a certain point, bcs HammerChk ;skip ahead to some other section GetPRCmp: lda <FrameCounter ;get frame counter and #%00000011 bne HammerChk ;execute this code every fourth frame, otherwise branch lda <Enemy_X_Position,x cmp BowserOrigXPos ;if bowser not at original horizontal position, bne GetDToO ;branch to skip this part lda PseudoRandomBitReg,x and #%00000011 ;get pseudorandom offset tay lda PRandomRange,y ;load value using pseudorandom offset sta MaxRangeFromOrigin ;and store here GetDToO: lda <Enemy_X_Position,x clc ;add movement speed to bowser's horizontal adc BowserMovementSpeed ;coordinate and save as new horizontal position sta <Enemy_X_Position,x ldy <Enemy_MovingDir,x cpy #$01 ;if bowser moving and facing to the right, skip ahead beq HammerChk ldy #$ff ;set default movement speed here (move left) sec ;get difference of current vs. original sbc BowserOrigXPos ;horizontal position bpl CompDToO ;if current position to the right of original, skip ahead eor #$ff clc ;get two's compliment adc #$01 ldy #$01 ;set alternate movement speed here (move right) CompDToO: cmp MaxRangeFromOrigin ;compare difference with pseudorandom value bcc HammerChk ;if difference < pseudorandom value, leave speed alone sty BowserMovementSpeed ;otherwise change bowser's movement speed HammerChk: lda EnemyFrameTimer,x ;if timer set here not expired yet, skip ahead to bne MakeBJump ;some other section of code jsr MoveEnemySlowVert ;otherwise start by moving bowser downwards lda WorldNumber ;check world number cmp #World6 bcc SetHmrTmr ;if world 1-5, skip this part (not time to throw hammers yet) lda <FrameCounter and #%00000011 ;check to see if it's time to execute sub bne SetHmrTmr ;if not, skip sub, otherwise jsr SpawnHammerObj ;execute sub on every fourth frame to spawn misc object (hammer) SetHmrTmr: lda <Enemy_Y_Position,x ;get current vertical position cmp #$80 ;if still above a certain point bcc ChkFireB ;then skip to world number check for flames lda PseudoRandomBitReg,x and #%00000011 ;get pseudorandom offset tay lda PRandomRange,y ;get value using pseudorandom offset sta EnemyFrameTimer,x ;set for timer here SkipToFB: jmp ChkFireB ;jump to execute flames code MakeBJump: cmp #$01 ;if timer not yet about to expire, bne ChkFireB ;skip ahead to next part dec <Enemy_Y_Position,x ;otherwise decrement vertical coordinate jsr InitVStf ;initialize movement amount lda #$fe sta <Enemy_Y_Speed,x ;set vertical speed to move bowser upwards ChkFireB: lda WorldNumber ;check world number here cmp #World8 ;world 8? beq SpawnFBr ;if so, execute this part here cmp #World6 ;world 6-7? bcs BowserGfxHandler ;if so, skip this part here SpawnFBr: lda BowserFireBreathTimer ;check timer here bne BowserGfxHandler ;if not expired yet, skip all of this lda #$20 sta BowserFireBreathTimer ;set timer here lda BowserBodyControls eor #%10000000 ;invert bowser's mouth bit to open sta BowserBodyControls ;and close bowser's mouth bmi ChkFireB ;if bowser's mouth open, loop back jsr SetFlameTimer ;get timing for bowser's flame ldy SecondaryHardMode beq SetFBTmr ;if secondary hard mode flag not set, skip this sec sbc #$10 ;otherwise subtract from value in A SetFBTmr: sta BowserFireBreathTimer ;set value as timer here lda #BowserFlame ;put bowser's flame identifier sta EnemyFrenzyBuffer ;in enemy frenzy buffer ;-------------------------------- BowserGfxHandler: jsr ProcessBowserHalf ;do a sub here to process bowser's front ldy #$10 ;load default value here to position bowser's rear lda <Enemy_MovingDir,x ;check moving direction lsr a bcc CopyFToR ;if moving left, use default ldy #$f0 ;otherwise load alternate positioning value here CopyFToR: tya ;move bowser's rear object position value to A clc adc <Enemy_X_Position,x ;add to bowser's front object horizontal coordinate ldy DuplicateObj_Offset ;get bowser's rear object offset STA Enemy_X_Position,y ;store A as bowser's rear horizontal coordinate lda <Enemy_Y_Position,x clc ;add eight pixels to bowser's front object adc #$08 ;vertical coordinate and store as vertical coordinate STA Enemy_Y_Position,y ;for bowser's rear lda <Enemy_State,x STA Enemy_State,y ;copy enemy state directly from front to rear lda <Enemy_MovingDir,x STA Enemy_MovingDir,y ;copy moving direction also lda <ObjectOffset ;save enemy object offset of front to stack pha ldx DuplicateObj_Offset ;put enemy object offset of rear as current stx <ObjectOffset lda #Bowser ;set bowser's enemy identifier sta <Enemy_ID,x ;store in bowser's rear object jsr ProcessBowserHalf ;do a sub here to process bowser's rear pla sta <ObjectOffset ;get original enemy object offset tax lda #$00 ;nullify bowser's front/rear graphics flag sta BowserGfxFlag ExBGfxH: rts ;leave! ProcessBowserHalf: inc BowserGfxFlag ;increment bowser's graphics flag, then run subroutines jsr RunRetainerObj ;to get offscreen bits, relative position and draw bowser (finally!) lda <Enemy_State,x bne ExBGfxH ;if either enemy object not in normal state, branch to leave lda #$0a sta Enemy_BoundBoxCtrl,x ;set bounding box size control jsr GetEnemyBoundBox ;get bounding box coordinates jmp PlayerEnemyCollision ;do player-to-enemy collision detection ;------------------------------------------------------------------------------------- ;$00 - used to hold movement force and tile number ;$01 - used to hold sprite attribute data FlameTimerData: .db $BF, $40, $BF, $BF, $BF, $40, $40, $BF SetFlameTimer: ldy BowserFlameTimerCtrl ;load counter as offset inc BowserFlameTimerCtrl ;increment lda BowserFlameTimerCtrl ;mask out all but 3 LSB and #%00000111 ;to keep in range of 0-7 sta BowserFlameTimerCtrl lda FlameTimerData,y ;load value to be used then leave ExFl: rts ProcBowserFlame: lda TimerControl ;if master timer control flag set, bne SetGfxF ;skip all of this lda #$40 ;load default movement force ldy SecondaryHardMode beq SFlmX ;if secondary hard mode flag not set, use default lda #$60 ;otherwise load alternate movement force to go faster SFlmX: sta <$00 ;store value here lda Enemy_X_MoveForce,x sec ;subtract value from movement force sbc <$00 sta Enemy_X_MoveForce,x ;save new value lda <Enemy_X_Position,x sbc #$01 ;subtract one from horizontal position to move sta <Enemy_X_Position,x ;to the left lda <Enemy_PageLoc,x sbc #$00 ;subtract borrow from page location sta <Enemy_PageLoc,x ldy BowserFlamePRandomOfs,x ;get some value here and use as offset lda <Enemy_Y_Position,x ;load vertical coordinate cmp FlameYPosData,y ;compare against coordinate data using $0417,x as offset beq SetGfxF ;if equal, branch and do not modify coordinate clc adc Enemy_Y_MoveForce,x ;otherwise add value here to coordinate and store sta <Enemy_Y_Position,x ;as new vertical coordinate SetGfxF: jsr RelativeEnemyPosition ;get new relative coordinates lda <Enemy_State,x ;if bowser's flame not in normal state, bne ExFl ;branch to leave lda #$51 ;otherwise, continue sta <$00 ;write first tile number ldy #$02 ;load attributes without vertical flip by default lda <FrameCounter and #%00000010 ;invert vertical flip bit every 2 frames beq FlmeAt ;if d1 not set, write default value ldy #$82 ;otherwise write value with vertical flip bit set FlmeAt: sty <$01 ;set bowser's flame sprite attributes here ldy Enemy_SprDataOffset,x ;get OAM data offset ldx #$00 DrawFlameLoop: lda Enemy_Rel_YPos ;get Y relative coordinate of current enemy object sta Sprite_Y_Position,y ;write into Y coordinate of OAM data lda <$00 sta Sprite_Tilenumber,y ;write current tile number into OAM data inc <$00 ;increment tile number to draw more bowser's flame lda <$01 sta Sprite_Attributes,y ;write saved attributes into OAM data lda Enemy_Rel_XPos sta Sprite_X_Position,y ;write X relative coordinate of current enemy object clc adc #$08 sta Enemy_Rel_XPos ;then add eight to it and store iny iny iny iny ;increment Y four times to move onto the next OAM inx ;move onto the next OAM, and branch if three cpx #$03 ;have not yet been done bcc DrawFlameLoop ldx <ObjectOffset ;reload original enemy offset jsr GetEnemyOffscreenBits ;get offscreen information ldy Enemy_SprDataOffset,x ;get OAM data offset lda Enemy_OffscreenBits ;get enemy object offscreen bits lsr a ;move d0 to carry and result to stack pha bcc MM3FOfs ;branch if carry not set lda #$f8 ;otherwise move sprite offscreen, this part likely sta Sprite_Y_Position+12,y ;residual since flame is only made of three sprites MM3FOfs: pla ;get bits from stack lsr a ;move d1 to carry and move bits back to stack pha bcc MM2FOfs ;branch if carry not set again lda #$f8 ;otherwise move third sprite offscreen sta Sprite_Y_Position+8,y MM2FOfs: pla ;get bits from stack again lsr a ;move d2 to carry and move bits back to stack again pha bcc MM1FOfs ;branch if carry not set yet again lda #$f8 ;otherwise move second sprite offscreen sta Sprite_Y_Position+4,y MM1FOfs: pla ;get bits from stack one last time lsr a ;move d3 to carry bcc ExFlmeD ;branch if carry not set one last time lda #$f8 sta Sprite_Y_Position,y ;otherwise move first sprite offscreen ExFlmeD: rts ;leave ;-------------------------------- RunFireworks: dec <ExplosionTimerCounter,x ;decrement explosion timing counter here bne SetupExpl ;if not expired, skip this part lda #$08 sta <ExplosionTimerCounter,x ;reset counter inc <ExplosionGfxCounter,x ;increment explosion graphics counter lda <ExplosionGfxCounter,x cmp #$03 ;check explosion graphics counter bcs FireworksSoundScore ;if at a certain point, branch to kill this object SetupExpl: jsr RelativeEnemyPosition ;get relative coordinates of explosion lda Enemy_Rel_YPos ;copy relative coordinates sta Fireball_Rel_YPos ;from the enemy object to the fireball object lda Enemy_Rel_XPos ;first vertical, then horizontal sta Fireball_Rel_XPos ldy Enemy_SprDataOffset,x ;get OAM data offset lda <ExplosionGfxCounter,x ;get explosion graphics counter jsr DrawExplosion_Fireworks ;do a sub to draw the explosion then leave rts FireworksSoundScore: lda #$00 ;disable enemy buffer flag sta <Enemy_Flag,x lda #Sfx_Blast ;play fireworks/gunfire sound sta <Square2SoundQueue lda #$05 ;set part of score modifier for 500 points sta DigitModifier+4 jmp EndAreaPoints ;jump to award points accordingly then leave ;-------------------------------- StarFlagYPosAdder: .db $00, $00, $08, $08 StarFlagXPosAdder: .db $00, $08, $00, $08 StarFlagTileData: .db $54, $55, $56, $57 RunStarFlagObj: lda #$00 ;initialize enemy frenzy buffer sta EnemyFrenzyBuffer lda StarFlagTaskControl ;check star flag object task number here cmp #$05 ;if greater than 5, branch to exit bcs StarFlagExit jsr JumpEngine ;otherwise jump to appropriate sub .dw StarFlagExit .dw GameTimerFireworks .dw AwardGameTimerPoints .dw RaiseFlagSetoffFWorks .dw DelayToAreaEnd GameTimerFireworks: ldy #$05 ;set default state for star flag object lda GameTimerDisplay+2 ;get game timer's last digit cmp #$01 beq SetFWC ;if last digit of game timer set to 1, skip ahead ldy #$03 ;otherwise load new value for state cmp #$03 beq SetFWC ;if last digit of game timer set to 3, skip ahead ldy #$00 ;otherwise load one more potential value for state cmp #$06 beq SetFWC ;if last digit of game timer set to 6, skip ahead lda #$ff ;otherwise set value for no fireworks SetFWC: sta FireworksCounter ;set fireworks counter here sty <Enemy_State,x ;set whatever state we have in star flag object IncrementSFTask1: inc StarFlagTaskControl ;increment star flag object task number StarFlagExit: rts ;leave AwardGameTimerPoints: lda GameTimerDisplay ;check all game timer digits for any intervals left ora GameTimerDisplay+1 ora GameTimerDisplay+2 beq IncrementSFTask1 ;if no time left on game timer at all, branch to next task lda <FrameCounter and #%00000100 ;check frame counter for d2 set (skip ahead beq NoTTick ;for four frames every four frames) branch if not set lda #Sfx_TimerTick sta <Square2SoundQueue ;load timer tick sound NoTTick: ldy #$23 ;set offset here to subtract from game timer's last digit lda #$ff ;set adder here to $ff, or -1, to subtract one sta DigitModifier+5 ;from the last digit of the game timer jsr DigitsMathRoutine ;subtract digit lda #$05 ;set now to add 50 points sta DigitModifier+5 ;per game timer interval subtracted EndAreaPoints: ldy #$0b ;load offset for mario's score by default lda CurrentPlayer ;check player on the screen beq ELPGive ;if mario, do not change ldy #$11 ;otherwise load offset for luigi's score ELPGive: jsr DigitsMathRoutine ;award 50 points per game timer interval lda CurrentPlayer ;get player on the screen (or 500 points per asl a ;fireworks explosion if branched here from there) asl a ;shift to high nybble asl a asl a ora #%00000100 ;add four to set nybble for game timer jmp UpdateNumber ;jump to print the new score and game timer RaiseFlagSetoffFWorks: lda <Enemy_Y_Position,x ;check star flag's vertical position cmp #$72 ;against preset value bcc SetoffF ;if star flag higher vertically, branch to other code dec <Enemy_Y_Position,x ;otherwise, raise star flag by one pixel jmp DrawStarFlag ;and skip this part here SetoffF: lda FireworksCounter ;check fireworks counter beq DrawFlagSetTimer ;if no fireworks left to go off, skip this part bmi DrawFlagSetTimer ;if no fireworks set to go off, skip this part lda #Fireworks sta EnemyFrenzyBuffer ;otherwise set fireworks object in frenzy queue DrawStarFlag: jsr RelativeEnemyPosition ;get relative coordinates of star flag ldy Enemy_SprDataOffset,x ;get OAM data offset ldx #$03 ;do four sprites DSFLoop: lda Enemy_Rel_YPos ;get relative vertical coordinate clc adc StarFlagYPosAdder,x ;add Y coordinate adder data sta Sprite_Y_Position,y ;store as Y coordinate lda StarFlagTileData,x ;get tile number sta Sprite_Tilenumber,y ;store as tile number lda #$22 ;set palette and background priority bits sta Sprite_Attributes,y ;store as attributes lda Enemy_Rel_XPos ;get relative horizontal coordinate clc adc StarFlagXPosAdder,x ;add X coordinate adder data sta Sprite_X_Position,y ;store as X coordinate iny iny ;increment OAM data offset four bytes iny ;for next sprite iny dex ;move onto next sprite bpl DSFLoop ;do this until all sprites are done ldx <ObjectOffset ;get enemy object offset and leave rts DrawFlagSetTimer: jsr DrawStarFlag ;do sub to draw star flag lda #$06 sta EnemyIntervalTimer,x ;set interval timer here IncrementSFTask2: inc StarFlagTaskControl ;move onto next task rts DelayToAreaEnd: jsr DrawStarFlag ;do sub to draw star flag lda EnemyIntervalTimer,x ;if interval timer set in previous task bne StarFlagExit2 ;not yet expired, branch to leave lda EventMusicBuffer ;if event music buffer empty, beq IncrementSFTask2 ;branch to increment task StarFlagExit2: rts ;otherwise leave ;-------------------------------- ;$00 - used to store horizontal difference between player and piranha plant MovePiranhaPlant: lda <Enemy_State,x ;check enemy state bne PutinPipe ;if set at all, branch to leave lda EnemyFrameTimer,x ;check enemy's timer here bne PutinPipe ;branch to end if not yet expired lda <PiranhaPlant_MoveFlag,x ;check movement flag bne SetupToMovePPlant ;if moving, skip to part ahead lda <PiranhaPlant_Y_Speed,x ;if currently rising, branch bmi ReversePlantSpeed ;to move enemy upwards out of pipe jsr PlayerEnemyDiff ;get horizontal difference between player and bpl ChkPlayerNearPipe ;piranha plant, and branch if enemy to right of player lda <$00 ;otherwise get saved horizontal difference eor #$ff clc ;and change to two's compliment adc #$01 sta <$00 ;save as new horizontal difference ChkPlayerNearPipe: lda <$00 ;get saved horizontal difference cmp #$21 bcc PutinPipe ;if player within a certain distance, branch to leave ReversePlantSpeed: lda <PiranhaPlant_Y_Speed,x ;get vertical speed eor #$ff clc ;change to two's compliment adc #$01 sta <PiranhaPlant_Y_Speed,x ;save as new vertical speed inc <PiranhaPlant_MoveFlag,x ;increment to set movement flag SetupToMovePPlant: lda PiranhaPlantDownYPos,x ;get original vertical coordinate (lowest point) ldy <PiranhaPlant_Y_Speed,x ;get vertical speed bpl RiseFallPiranhaPlant ;branch if moving downwards lda PiranhaPlantUpYPos,x ;otherwise get other vertical coordinate (highest point) RiseFallPiranhaPlant: sta <$00 ;save vertical coordinate here lda <FrameCounter ;get frame counter lsr a bcc PutinPipe ;branch to leave if d0 set (execute code every other frame) lda TimerControl ;get master timer control bne PutinPipe ;branch to leave if set (likely not necessary) lda <Enemy_Y_Position,x ;get current vertical coordinate clc adc <PiranhaPlant_Y_Speed,x ;add vertical speed to move up or down sta <Enemy_Y_Position,x ;save as new vertical coordinate cmp <$00 ;compare against low or high coordinate bne PutinPipe ;branch to leave if not yet reached lda #$00 sta <PiranhaPlant_MoveFlag,x ;otherwise clear movement flag lda #$40 sta EnemyFrameTimer,x ;set timer to delay piranha plant movement PutinPipe: lda #%00100000 ;set background priority bit in sprite sta Enemy_SprAttrib,x ;attributes to give illusion of being inside pipe rts ;then leave ;------------------------------------------------------------------------------------- ;$07 - spinning speed FirebarSpin: sta <$07 ;save spinning speed here lda <FirebarSpinDirection,x ;check spinning direction bne SpinCounterClockwise ;if moving counter-clockwise, branch to other part ldy #$18 ;possibly residual ldy lda <FirebarSpinState_Low,x clc ;add spinning speed to what would normally be adc <$07 ;the horizontal speed sta <FirebarSpinState_Low,x lda <FirebarSpinState_High,x ;add carry to what would normally be the vertical speed adc #$00 rts SpinCounterClockwise: ldy #$08 ;possibly residual ldy lda <FirebarSpinState_Low,x sec ;subtract spinning speed to what would normally be sbc <$07 ;the horizontal speed sta <FirebarSpinState_Low,x lda <FirebarSpinState_High,x ;add carry to what would normally be the vertical speed sbc #$00 rts ;------------------------------------------------------------------------------------- ;$00 - used to hold collision flag, Y movement force + 5 or low byte of name table for rope ;$01 - used to hold high byte of name table for rope ;$02 - used to hold page location of rope BalancePlatform: lda <Enemy_Y_HighPos,x ;check high byte of vertical position cmp #$03 bne DoBPl jmp EraseEnemyObject ;if far below screen, kill the object DoBPl: lda <Enemy_State,x ;get object's state (set to $ff or other platform offset) bpl CheckBalPlatform ;if doing other balance platform, branch to leave rts CheckBalPlatform: tay ;save offset from state as Y lda PlatformCollisionFlag,x ;get collision flag of platform sta <$00 ;store here lda <Enemy_MovingDir,x ;get moving direction beq ChkForFall jmp PlatformFall ;if set, jump here ChkForFall: lda #$2d ;check if platform is above a certain point cmp <Enemy_Y_Position,x bcc ChkOtherForFall ;if not, branch elsewhere cpy <$00 ;if collision flag is set to same value as beq MakePlatformFall ;enemy state, branch to make platforms fall clc adc #$02 ;otherwise add 2 pixels to vertical position sta <Enemy_Y_Position,x ;of current platform and branch elsewhere jmp StopPlatforms ;to make platforms stop MakePlatformFall: jmp InitPlatformFall ;make platforms fall ChkOtherForFall: CMP Enemy_Y_Position,y ;check if other platform is above a certain point bcc ChkToMoveBalPlat ;if not, branch elsewhere cpx <$00 ;if collision flag is set to same value as beq MakePlatformFall ;enemy state, branch to make platforms fall clc adc #$02 ;otherwise add 2 pixels to vertical position STA Enemy_Y_Position,y ;of other platform and branch elsewhere jmp StopPlatforms ;jump to stop movement and do not return ChkToMoveBalPlat: lda <Enemy_Y_Position,x ;save vertical position to stack pha lda PlatformCollisionFlag,x ;get collision flag bpl ColFlg ;branch if collision lda Enemy_Y_MoveForce,x clc ;add $05 to contents of moveforce, whatever they be adc #$05 sta <$00 ;store here lda <Enemy_Y_Speed,x adc #$00 ;add carry to vertical speed bmi PlatDn ;branch if moving downwards bne PlatUp ;branch elsewhere if moving upwards lda <$00 cmp #$0b ;check if there's still a little force left bcc PlatSt ;if not enough, branch to stop movement bcs PlatUp ;otherwise keep branch to move upwards ColFlg: cmp <ObjectOffset ;if collision flag matches beq PlatDn ;current enemy object offset, branch PlatUp: jsr MovePlatformUp ;do a sub to move upwards jmp DoOtherPlatform ;jump ahead to remaining code PlatSt: jsr StopPlatforms ;do a sub to stop movement jmp DoOtherPlatform ;jump ahead to remaining code PlatDn: jsr MovePlatformDown ;do a sub to move downwards DoOtherPlatform: ldy <Enemy_State,x ;get offset of other platform pla ;get old vertical coordinate from stack sec sbc <Enemy_Y_Position,x ;get difference of old vs. new coordinate clc ADC Enemy_Y_Position,y ;add difference to vertical coordinate of other STA Enemy_Y_Position,y ;platform to move it in the opposite direction lda PlatformCollisionFlag,x ;if no collision, skip this part here bmi DrawEraseRope tax ;put offset which collision occurred here jsr PositionPlayerOnVPlat ;and use it to position player accordingly DrawEraseRope: ldy <ObjectOffset ;get enemy object offset LDA Enemy_Y_Speed,y ;check to see if current platform is ora Enemy_Y_MoveForce,y ;moving at all beq ExitRp ;if not, skip all of this and branch to leave ldx VRAM_Buffer1_Offset ;get vram buffer offset cpx #$20 ;if offset beyond a certain point, go ahead bcs ExitRp ;and skip this, branch to leave LDA Enemy_Y_Speed,y pha ;save two copies of vertical speed to stack pha jsr SetupPlatformRope ;do a sub to figure out where to put new bg tiles lda <$01 ;write name table address to vram buffer sta VRAM_Buffer1,x ;first the high byte, then the low lda <$00 sta VRAM_Buffer1+1,x lda #$02 ;set length for 2 bytes sta VRAM_Buffer1+2,x LDA Enemy_Y_Speed,y ;if platform moving upwards, branch bmi EraseR1 ;to do something else lda #$a2 sta VRAM_Buffer1+3,x ;otherwise put tile numbers for left lda #$a3 ;and right sides of rope in vram buffer sta VRAM_Buffer1+4,x jmp OtherRope ;jump to skip this part EraseR1: lda #$24 ;put blank tiles in vram buffer sta VRAM_Buffer1+3,x ;to erase rope sta VRAM_Buffer1+4,x OtherRope: LDA Enemy_State,y ;get offset of other platform from state tay ;use as Y here pla ;pull second copy of vertical speed from stack eor #$ff ;invert bits to reverse speed jsr SetupPlatformRope ;do sub again to figure out where to put bg tiles lda <$01 ;write name table address to vram buffer sta VRAM_Buffer1+5,x ;this time we're doing putting tiles for lda <$00 ;the other platform sta VRAM_Buffer1+6,x lda #$02 sta VRAM_Buffer1+7,x ;set length again for 2 bytes pla ;pull first copy of vertical speed from stack bpl EraseR2 ;if moving upwards (note inversion earlier), skip this lda #$a2 sta VRAM_Buffer1+8,x ;otherwise put tile numbers for left lda #$a3 ;and right sides of rope in vram sta VRAM_Buffer1+9,x ;transfer buffer jmp EndRp ;jump to skip this part EraseR2: lda #$24 ;put blank tiles in vram buffer sta VRAM_Buffer1+8,x ;to erase rope sta VRAM_Buffer1+9,x EndRp: lda #$00 ;put null terminator at the end sta VRAM_Buffer1+10,x lda VRAM_Buffer1_Offset ;add ten bytes to the vram buffer offset clc ;and store adc #10 sta VRAM_Buffer1_Offset ExitRp: ldx <ObjectOffset ;get enemy object buffer offset and leave rts SetupPlatformRope: pha ;save second/third copy to stack LDA Enemy_X_Position,y ;get horizontal coordinate clc adc #$08 ;add eight pixels ldx SecondaryHardMode ;if secondary hard mode flag set, bne GetLRp ;use coordinate as-is clc adc #$10 ;otherwise add sixteen more pixels GetLRp: pha ;save modified horizontal coordinate to stack LDA Enemy_PageLoc,y adc #$00 ;add carry to page location sta <$02 ;and save here pla ;pull modified horizontal coordinate and #%11110000 ;from the stack, mask out low nybble lsr a ;and shift three bits to the right lsr a lsr a sta <$00 ;store result here as part of name table low byte ldx <Enemy_Y_Position,y ;get vertical coordinate pla ;get second/third copy of vertical speed from stack bpl GetHRp ;skip this part if moving downwards or not at all txa clc adc #$08 ;add eight to vertical coordinate and tax ;save as X GetHRp: txa ;move vertical coordinate to A ldx VRAM_Buffer1_Offset ;get vram buffer offset asl a rol a ;rotate d7 to d0 and d6 into carry pha ;save modified vertical coordinate to stack rol a ;rotate carry to d0, thus d7 and d6 are at 2 LSB and #%00000011 ;mask out all bits but d7 and d6, then set ora #%00100000 ;d5 to get appropriate high byte of name table sta <$01 ;address, then store lda <$02 ;get saved page location from earlier and #$01 ;mask out all but LSB asl a asl a ;shift twice to the left and save with the ora <$01 ;rest of the bits of the high byte, to get sta <$01 ;the proper name table and the right place on it pla ;get modified vertical coordinate from stack and #%11100000 ;mask out low nybble and LSB of high nybble clc adc <$00 ;add to horizontal part saved here sta <$00 ;save as name table low byte LDA Enemy_Y_Position,y cmp #$e8 ;if vertical position not below the bcc ExPRp ;bottom of the screen, we're done, branch to leave lda <$00 and #%10111111 ;mask out d6 of low byte of name table address sta <$00 ExPRp: rts ;leave! InitPlatformFall: tya ;move offset of other platform from Y to X tax jsr GetEnemyOffscreenBits ;get offscreen bits lda #$06 jsr SetupFloateyNumber ;award 1000 points to player lda Player_Rel_XPos sta FloateyNum_X_Pos,x ;put floatey number coordinates where player is lda <Player_Y_Position sta FloateyNum_Y_Pos,x lda #$01 ;set moving direction as flag for sta <Enemy_MovingDir,x ;falling platforms StopPlatforms: jsr InitVStf ;initialize vertical speed and low byte STA Enemy_Y_Speed,y ;for both platforms and leave sta Enemy_Y_MoveForce,y rts PlatformFall: tya ;save offset for other platform to stack pha jsr MoveFallingPlatform ;make current platform fall pla tax ;pull offset from stack and save to X jsr MoveFallingPlatform ;make other platform fall ldx <ObjectOffset lda PlatformCollisionFlag,x ;if player not standing on either platform, bmi ExPF ;skip this part tax ;transfer collision flag offset as offset to X jsr PositionPlayerOnVPlat ;and position player appropriately ExPF: ldx <ObjectOffset ;get enemy object buffer offset and leave rts ;-------------------------------- YMovingPlatform: lda <Enemy_Y_Speed,x ;if platform moving up or down, skip ahead to ora Enemy_Y_MoveForce,x ;check on other position bne ChkYCenterPos sta Enemy_YMF_Dummy,x ;initialize dummy variable lda <Enemy_Y_Position,x cmp YPlatformTopYPos,x ;if current vertical position => top position, branch bcs ChkYCenterPos ;ahead of all this lda <FrameCounter and #%00000111 ;check for every eighth frame bne SkipIY inc <Enemy_Y_Position,x ;increase vertical position every eighth frame SkipIY: jmp ChkYPCollision ;skip ahead to last part ChkYCenterPos: lda <Enemy_Y_Position,x ;if current vertical position < central position, branch cmp <YPlatformCenterYPos,x ;to slow ascent/move downwards bcc YMDown jsr MovePlatformUp ;otherwise start slowing descent/moving upwards jmp ChkYPCollision YMDown: jsr MovePlatformDown ;start slowing ascent/moving downwards ChkYPCollision: lda PlatformCollisionFlag,x ;if collision flag not set here, branch bmi ExYPl ;to leave jsr PositionPlayerOnVPlat ;otherwise position player appropriately ExYPl: rts ;leave ;-------------------------------- ;$00 - used as adder to position player hotizontally XMovingPlatform: lda #$0e ;load preset maximum value for secondary counter jsr XMoveCntr_Platform ;do a sub to increment counters for movement jsr MoveWithXMCntrs ;do a sub to move platform accordingly, and return value lda PlatformCollisionFlag,x ;if no collision with player, bmi ExXMP ;branch ahead to leave PositionPlayerOnHPlat: lda <Player_X_Position clc ;add saved value from second subroutine to adc <$00 ;current player's position to position sta <Player_X_Position ;player accordingly in horizontal position lda <Player_PageLoc ;get player's page location ldy <$00 ;check to see if saved value here is positive or negative bmi PPHSubt ;if negative, branch to subtract adc #$00 ;otherwise add carry to page location jmp SetPVar ;jump to skip subtraction PPHSubt: sbc #$00 ;subtract borrow from page location SetPVar: sta <Player_PageLoc ;save result to player's page location sty Platform_X_Scroll ;put saved value from second sub here to be used later jsr PositionPlayerOnVPlat ;position player vertically and appropriately ExXMP: rts ;and we are done here ;-------------------------------- DropPlatform: lda PlatformCollisionFlag,x ;if no collision between platform and player bmi ExDPl ;occurred, just leave without moving anything jsr MoveDropPlatform ;otherwise do a sub to move platform down very quickly jsr PositionPlayerOnVPlat ;do a sub to position player appropriately ExDPl: rts ;leave ;-------------------------------- ;$00 - residual value from sub RightPlatform: jsr MoveEnemyHorizontally ;move platform with current horizontal speed, if any sta <$00 ;store saved value here (residual code) lda PlatformCollisionFlag,x ;check collision flag, if no collision between player bmi ExRPl ;and platform, branch ahead, leave speed unaltered lda #$10 sta <Enemy_X_Speed,x ;otherwise set new speed (gets moving if motionless) jsr PositionPlayerOnHPlat ;use saved value from earlier sub to position player ExRPl: rts ;then leave ;-------------------------------- MoveLargeLiftPlat: jsr MoveLiftPlatforms ;execute common to all large and small lift platforms jmp ChkYPCollision ;branch to position player correctly MoveSmallPlatform: jsr MoveLiftPlatforms ;execute common to all large and small lift platforms jmp ChkSmallPlatCollision ;branch to position player correctly MoveLiftPlatforms: lda TimerControl ;if master timer control set, skip all of this bne ExLiftP ;and branch to leave lda Enemy_YMF_Dummy,x clc ;add contents of movement amount to whatever's here adc Enemy_Y_MoveForce,x sta Enemy_YMF_Dummy,x lda <Enemy_Y_Position,x ;add whatever vertical speed is set to current adc <Enemy_Y_Speed,x ;vertical position plus carry to move up or down sta <Enemy_Y_Position,x ;and then leave rts ChkSmallPlatCollision: lda PlatformCollisionFlag,x ;get bounding box counter saved in collision flag beq ExLiftP ;if none found, leave player position alone jsr PositionPlayerOnS_Plat ;use to position player correctly ExLiftP: rts ;then leave ;------------------------------------------------------------------------------------- ;$00 - page location of extended left boundary left page location - carry ;$01 - extended left boundary position left edge - 72 pixels ;$02 - page location of extended right boundary right page loc + carry ;$03 - extended right boundary position right edge + 72 pixels ;ScreenLeft_PageLoc = what background left edge of screen is on ;ScreenRight_PageLoc = what background right edge of screen is on OffscreenBoundsCheck: lda <Enemy_ID,x ;check for cheep-cheep object cmp #FlyingCheepCheep ;branch to leave if found beq ExScrnBd lda ScreenLeft_X_Pos ;get horizontal coordinate for left side of screen ldy <Enemy_ID,x cpy #HammerBro ;check for hammer bro object beq LimitB cpy #PiranhaPlant ;check for piranha plant object bne ExtendLB ;these two will be erased sooner than others if too far left LimitB: adc #$38 ;add 56 pixels to coordinate if hammer bro or piranha plant ExtendLB: sbc #$48 ;subtract 72 pixels regardless of enemy object sta <$01 ;store result here lda ScreenLeft_PageLoc sbc #$00 ;subtract borrow from page location of left side sta <$00 ;store result here lda ScreenRight_X_Pos ;add 72 pixels to the right side horizontal coordinate adc #$48 sta <$03 ;store result here lda ScreenRight_PageLoc adc #$00 ;then add the carry to the page location sta <$02 ;and store result here lda <Enemy_X_Position,x ;compare horizontal coordinate of the enemy object cmp <$01 ;to modified horizontal left edge coordinate to get carry lda <Enemy_PageLoc,x sbc <$00 ;then subtract it from the page coordinate of the enemy object bmi TooFar ;if enemy object is too far left, branch to erase it lda <Enemy_X_Position,x ;compare horizontal coordinate of the enemy object cmp <$03 ;to modified horizontal right edge coordinate to get carry lda <Enemy_PageLoc,x sbc <$02 ;then subtract it from the page coordinate of the enemy object bmi ExScrnBd ;if enemy object is on the screen, leave, do not erase enemy lda <Enemy_State,x ;if at this point, enemy is offscreen to the right, so check cmp #HammerBro ;if in state used by spiny's egg, do not erase beq ExScrnBd cpy #PiranhaPlant ;if piranha plant, do not erase beq ExScrnBd cpy #FlagpoleFlagObject ;if flagpole flag, do not erase beq ExScrnBd cpy #StarFlagObject ;if star flag, do not erase beq ExScrnBd cpy #JumpspringObject ;if jumpspring, do not erase beq ExScrnBd ;erase all others too far to the right TooFar: jsr EraseEnemyObject ;erase object if necessary ExScrnBd: rts ;leave ;------------------------------------------------------------------------------------- ;some unused space .db $ff, $ff, $ff ;------------------------------------------------------------------------------------- ;$01 - enemy buffer offset FireballEnemyCollision: lda <Fireball_State,x ;check to see if fireball state is set at all beq ExitFBallEnemy ;branch to leave if not asl a bcs ExitFBallEnemy ;branch to leave also if d7 in state is set lda <FrameCounter lsr a ;get LSB of frame counter bcs ExitFBallEnemy ;branch to leave if set (do routine every other frame) txa asl a ;multiply fireball offset by four asl a clc adc #$1c ;then add $1c or 28 bytes to it tay ;to use fireball's bounding box coordinates ldx #$04 FireballEnemyCDLoop: stx <$01 ;store enemy object offset here tya pha ;push fireball offset to the stack lda <Enemy_State,x and #%00100000 ;check to see if d5 is set in enemy state bne NoFToECol ;if so, skip to next enemy slot lda <Enemy_Flag,x ;check to see if buffer flag is set beq NoFToECol ;if not, skip to next enemy slot lda <Enemy_ID,x ;check enemy identifier cmp #$24 bcc GoombaDie ;if < $24, branch to check further cmp #$2b bcc NoFToECol ;if in range $24-$2a, skip to next enemy slot GoombaDie: cmp #Goomba ;check for goomba identifier bne NotGoomba ;if not found, continue with code lda <Enemy_State,x ;otherwise check for defeated state cmp #$02 ;if stomped or otherwise defeated, bcs NoFToECol ;skip to next enemy slot NotGoomba: lda EnemyOffscrBitsMasked,x ;if any masked offscreen bits set, bne NoFToECol ;skip to next enemy slot txa asl a ;otherwise multiply enemy offset by four asl a clc adc #$04 ;add 4 bytes to it tax ;to use enemy's bounding box coordinates jsr SprObjectCollisionCore ;do fireball-to-enemy collision detection ldx <ObjectOffset ;return fireball's original offset bcc NoFToECol ;if carry clear, no collision, thus do next enemy slot lda #%10000000 sta <Fireball_State,x ;set d7 in enemy state ldx <$01 ;get enemy offset jsr HandleEnemyFBallCol ;jump to handle fireball to enemy collision NoFToECol: pla ;pull fireball offset from stack tay ;put it in Y ldx <$01 ;get enemy object offset dex ;decrement it bpl FireballEnemyCDLoop ;loop back until collision detection done on all enemies ExitFBallEnemy: ldx <ObjectOffset ;get original fireball offset and leave rts BowserIdentities: .db Goomba, GreenKoopa, BuzzyBeetle, Spiny, Lakitu, Bloober, HammerBro, Bowser HandleEnemyFBallCol: jsr RelativeEnemyPosition ;get relative coordinate of enemy ldx <$01 ;get current enemy object offset lda <Enemy_Flag,x ;check buffer flag for d7 set bpl ChkBuzzyBeetle ;branch if not set to continue and #%00001111 ;otherwise mask out high nybble and tax ;use low nybble as enemy offset lda <Enemy_ID,x cmp #Bowser ;check enemy identifier for bowser beq HurtBowser ;branch if found ldx <$01 ;otherwise retrieve current enemy offset ChkBuzzyBeetle: lda <Enemy_ID,x cmp #BuzzyBeetle ;check for buzzy beetle beq ExHCF ;branch if found to leave (buzzy beetles fireproof) cmp #Bowser ;check for bowser one more time (necessary if d7 of flag was clear) bne ChkOtherEnemies ;if not found, branch to check other enemies HurtBowser: dec BowserHitPoints ;decrement bowser's hit points bne ExHCF ;if bowser still has hit points, branch to leave jsr InitVStf ;otherwise do sub to init vertical speed and movement force sta <Enemy_X_Speed,x ;initialize horizontal speed sta EnemyFrenzyBuffer ;init enemy frenzy buffer lda #$fe sta <Enemy_Y_Speed,x ;set vertical speed to make defeated bowser jump a little ldy WorldNumber ;use world number as offset lda BowserIdentities,y ;get enemy identifier to replace bowser with sta <Enemy_ID,x ;set as new enemy identifier lda #$20 ;set A to use starting value for state cpy #$03 ;check to see if using offset of 3 or more bcs SetDBSte ;branch if so ora #$03 ;otherwise add 3 to enemy state SetDBSte: sta <Enemy_State,x ;set defeated enemy state lda #Sfx_BowserFall sta <Square2SoundQueue ;load bowser defeat sound ldx <$01 ;get enemy offset lda #$09 ;award 5000 points to player for defeating bowser bne EnemySmackScore ;unconditional branch to award points ChkOtherEnemies: cmp #BulletBill_FrenzyVar beq ExHCF ;branch to leave if bullet bill (frenzy variant) cmp #Podoboo beq ExHCF ;branch to leave if podoboo cmp #$15 bcs ExHCF ;branch to leave if identifier => $15 ShellOrBlockDefeat: lda <Enemy_ID,x ;check for piranha plant cmp #PiranhaPlant bne StnE ;branch if not found lda <Enemy_Y_Position,x adc #$18 ;add 24 pixels to enemy object's vertical position sta <Enemy_Y_Position,x StnE: jsr ChkToStunEnemies ;do yet another sub lda <Enemy_State,x and #%00011111 ;mask out 2 MSB of enemy object's state ora #%00100000 ;set d5 to defeat enemy and save as new state sta <Enemy_State,x lda #$02 ;award 200 points by default ldy <Enemy_ID,x ;check for hammer bro cpy #HammerBro bne GoombaPoints ;branch if not found lda #$06 ;award 1000 points for hammer bro GoombaPoints: cpy #Goomba ;check for goomba bne EnemySmackScore ;branch if not found lda #$01 ;award 100 points for goomba EnemySmackScore: jsr SetupFloateyNumber ;update necessary score variables lda #Sfx_EnemySmack ;play smack enemy sound sta <Square1SoundQueue ExHCF: rts ;and now let's leave ;------------------------------------------------------------------------------------- PlayerHammerCollision: lda <FrameCounter ;get frame counter lsr a ;shift d0 into carry bcc ExPHC ;branch to leave if d0 not set to execute every other frame lda TimerControl ;if either master timer control ora Misc_OffscreenBits ;or any offscreen bits for hammer are set, bne ExPHC ;branch to leave txa asl a ;multiply misc object offset by four asl a clc adc #$24 ;add 36 or $24 bytes to get proper offset tay ;for misc object bounding box coordinates jsr PlayerCollisionCore ;do player-to-hammer collision detection ldx <ObjectOffset ;get misc object offset bcc ClHCol ;if no collision, then branch lda Misc_Collision_Flag,x ;otherwise read collision flag bne ExPHC ;if collision flag already set, branch to leave lda #$01 sta Misc_Collision_Flag,x ;otherwise set collision flag now lda <Misc_X_Speed,x eor #$ff ;get two's compliment of clc ;hammer's horizontal speed adc #$01 sta <Misc_X_Speed,x ;set to send hammer flying the opposite direction lda StarInvincibleTimer ;if star mario invincibility timer set, bne ExPHC ;branch to leave jmp InjurePlayer ;otherwise jump to hurt player, do not return ClHCol: lda #$00 ;clear collision flag sta Misc_Collision_Flag,x ExPHC: rts ;------------------------------------------------------------------------------------- HandlePowerUpCollision: jsr EraseEnemyObject ;erase the power-up object lda #$06 jsr SetupFloateyNumber ;award 1000 points to player by default lda #Sfx_PowerUpGrab sta <Square2SoundQueue ;play the power-up sound lda <PowerUpType ;check power-up type cmp #$02 bcc Shroom_Flower_PUp ;if mushroom or fire flower, branch cmp #$03 beq SetFor1Up ;if 1-up mushroom, branch lda #$23 ;otherwise set star mario invincibility sta StarInvincibleTimer ;timer, and load the star mario music lda #StarPowerMusic ;into the area music queue, then leave sta <AreaMusicQueue rts Shroom_Flower_PUp: lda PlayerStatus ;if player status = small, branch beq UpToSuper cmp #$01 ;if player status not super, leave bne NoPUp ldx <ObjectOffset ;get enemy offset, not necessary lda #$02 ;set player status to fiery sta PlayerStatus jsr GetPlayerColors ;run sub to change colors of player ldx <ObjectOffset ;get enemy offset again, and again not necessary lda #$0c ;set value to be used by subroutine tree (fiery) jmp UpToFiery ;jump to set values accordingly SetFor1Up: lda #$0b ;change 1000 points into 1-up instead sta FloateyNum_Control,x ;and then leave rts UpToSuper: lda #$01 ;set player status to super sta PlayerStatus lda #$09 ;set value to be used by subroutine tree (super) UpToFiery: ldy #$00 ;set value to be used as new player state jsr SetPRout ;set values to stop certain things in motion NoPUp: rts ;-------------------------------- ResidualXSpdData: .db $18, $e8 KickedShellXSpdData: .db $30, $d0 DemotedKoopaXSpdData: .db $08, $f8 PlayerEnemyCollision: lda <FrameCounter ;check counter for d0 set lsr a bcs NoPUp ;if set, branch to leave jsr CheckPlayerVertical ;if player object is completely offscreen or bcs NoPECol ;if down past 224th pixel row, branch to leave lda EnemyOffscrBitsMasked,x ;if current enemy is offscreen by any amount, bne NoPECol ;go ahead and branch to leave lda <GameEngineSubroutine cmp #$08 ;if not set to run player control routine bne NoPECol ;on next frame, branch to leave lda <Enemy_State,x and #%00100000 ;if enemy state has d5 set, branch to leave bne NoPECol jsr GetEnemyBoundBoxOfs ;get bounding box offset for current enemy object jsr PlayerCollisionCore ;do collision detection on player vs. enemy ldx <ObjectOffset ;get enemy object buffer offset bcs CheckForPUpCollision ;if collision, branch past this part here lda Enemy_CollisionBits,x and #%11111110 ;otherwise, clear d0 of current enemy object's sta Enemy_CollisionBits,x ;collision bit NoPECol: rts CheckForPUpCollision: ldy <Enemy_ID,x cpy #PowerUpObject ;check for power-up object bne EColl ;if not found, branch to next part jmp HandlePowerUpCollision ;otherwise, unconditional jump backwards EColl: lda StarInvincibleTimer ;if star mario invincibility timer expired, beq HandlePECollisions ;perform task here, otherwise kill enemy like jmp ShellOrBlockDefeat ;hit with a shell, or from beneath KickedShellPtsData: .db $0a, $06, $04 HandlePECollisions: lda Enemy_CollisionBits,x ;check enemy collision bits for d0 set and #%00000001 ;or for being offscreen at all ora EnemyOffscrBitsMasked,x bne ExPEC ;branch to leave if either is true lda #$01 ora Enemy_CollisionBits,x ;otherwise set d0 now sta Enemy_CollisionBits,x cpy #Spiny ;branch if spiny beq ChkForPlayerInjury cpy #PiranhaPlant ;branch if piranha plant beq InjurePlayer cpy #Podoboo ;branch if podoboo beq InjurePlayer cpy #BulletBill_CannonVar ;branch if bullet bill beq ChkForPlayerInjury cpy #$15 ;branch if object => $15 bcs InjurePlayer lda AreaType ;branch if water type level beq InjurePlayer lda <Enemy_State,x ;branch if d7 of enemy state was set asl a bcs ChkForPlayerInjury lda <Enemy_State,x ;mask out all but 3 LSB of enemy state and #%00000111 cmp #$02 ;branch if enemy is in normal or falling state bcc ChkForPlayerInjury lda <Enemy_ID,x ;branch to leave if goomba in defeated state cmp #Goomba beq ExPEC lda #Sfx_EnemySmack ;play smack enemy sound sta <Square1SoundQueue lda <Enemy_State,x ;set d7 in enemy state, thus become moving shell ora #%10000000 sta <Enemy_State,x jsr EnemyFacePlayer ;set moving direction and get offset lda KickedShellXSpdData,y ;load and set horizontal speed data with offset sta <Enemy_X_Speed,x lda #$03 ;add three to whatever the stomp counter contains clc ;to give points for kicking the shell adc StompChainCounter ldy EnemyIntervalTimer,x ;check shell enemy's timer cpy #$03 ;if above a certain point, branch using the points bcs KSPts ;data obtained from the stomp counter + 3 lda KickedShellPtsData,y ;otherwise, set points based on proximity to timer expiration KSPts: jsr SetupFloateyNumber ;set values for floatey number now ExPEC: rts ;leave!!! ChkForPlayerInjury: lda <Player_Y_Speed ;check player's vertical speed bmi ChkInj ;perform procedure below if player moving upwards bne EnemyStomped ;or not at all, and branch elsewhere if moving downwards ChkInj: lda <Enemy_ID,x ;branch if enemy object < $07 cmp #Bloober bcc ChkETmrs lda <Player_Y_Position ;add 12 pixels to player's vertical position clc adc #$0c cmp <Enemy_Y_Position,x ;compare modified player's position to enemy's position bcc EnemyStomped ;branch if this player's position above (less than) enemy's ChkETmrs: lda StompTimer ;check stomp timer bne EnemyStomped ;branch if set lda InjuryTimer ;check to see if injured invincibility timer still bne ExInjColRoutines ;counting down, and branch elsewhere to leave if so lda Player_Rel_XPos cmp Enemy_Rel_XPos ;if player's relative position to the left of enemy's bcc TInjE ;relative position, branch here jmp ChkEnemyFaceRight ;otherwise do a jump here TInjE: lda <Enemy_MovingDir,x ;if enemy moving towards the left, cmp #$01 ;branch, otherwise do a jump here bne InjurePlayer ;to turn the enemy around jmp LInj InjurePlayer: lda InjuryTimer ;check again to see if injured invincibility timer is bne ExInjColRoutines ;at zero, and branch to leave if so ForceInjury: ldx PlayerStatus ;check player's status beq KillPlayer ;branch if small sta PlayerStatus ;otherwise set player's status to small lda #$08 sta InjuryTimer ;set injured invincibility timer asl a sta <Square1SoundQueue ;play pipedown/injury sound jsr GetPlayerColors ;change player's palette if necessary lda #$0a ;set subroutine to run on next frame SetKRout: ldy #$01 ;set new player state SetPRout: sta <GameEngineSubroutine ;load new value to run subroutine on next frame sty <Player_State ;store new player state ldy #$ff sty TimerControl ;set master timer control flag to halt timers iny sty ScrollAmount ;initialize scroll speed ExInjColRoutines: ldx <ObjectOffset ;get enemy offset and leave rts KillPlayer: stx <Player_X_Speed ;halt player's horizontal movement by initializing speed inx stx <EventMusicQueue ;set event music queue to death music lda #$fc sta <Player_Y_Speed ;set new vertical speed lda #$0b ;set subroutine to run on next frame bne SetKRout ;branch to set player's state and other things StompedEnemyPtsData: .db $02, $06, $05, $06 EnemyStomped: lda <Enemy_ID,x ;check for spiny, branch to hurt player cmp #Spiny ;if found beq InjurePlayer lda #Sfx_EnemyStomp ;otherwise play stomp/swim sound sta <Square1SoundQueue lda <Enemy_ID,x ldy #$00 ;initialize points data offset for stomped enemies cmp #FlyingCheepCheep ;branch for cheep-cheep beq EnemyStompedPts cmp #BulletBill_FrenzyVar ;branch for either bullet bill object beq EnemyStompedPts cmp #BulletBill_CannonVar beq EnemyStompedPts cmp #Podoboo ;branch for podoboo (this branch is logically impossible beq EnemyStompedPts ;for cpu to take due to earlier checking of podoboo) iny ;increment points data offset cmp #HammerBro ;branch for hammer bro beq EnemyStompedPts iny ;increment points data offset cmp #Lakitu ;branch for lakitu beq EnemyStompedPts iny ;increment points data offset cmp #Bloober ;branch if NOT bloober bne ChkForDemoteKoopa EnemyStompedPts: lda StompedEnemyPtsData,y ;load points data using offset in Y jsr SetupFloateyNumber ;run sub to set floatey number controls lda <Enemy_MovingDir,x pha ;save enemy movement direction to stack jsr SetStun ;run sub to kill enemy pla sta <Enemy_MovingDir,x ;return enemy movement direction from stack lda #%00100000 sta <Enemy_State,x ;set d5 in enemy state jsr InitVStf ;nullify vertical speed, physics-related thing, sta <Enemy_X_Speed,x ;and horizontal speed lda #$fd ;set player's vertical speed, to give bounce sta <Player_Y_Speed rts ChkForDemoteKoopa: cmp #$09 ;branch elsewhere if enemy object < $09 bcc HandleStompedShellE and #%00000001 ;demote koopa paratroopas to ordinary troopas sta <Enemy_ID,x ldy #$00 ;return enemy to normal state sty <Enemy_State,x lda #$03 ;award 400 points to the player jsr SetupFloateyNumber jsr InitVStf ;nullify physics-related thing and vertical speed jsr EnemyFacePlayer ;turn enemy around if necessary lda DemotedKoopaXSpdData,y sta <Enemy_X_Speed,x ;set appropriate moving speed based on direction jmp SBnce ;then move onto something else RevivalRateData: .db $10, $0b HandleStompedShellE: lda #$04 ;set defeated state for enemy sta <Enemy_State,x inc StompChainCounter ;increment the stomp counter lda StompChainCounter ;add whatever is in the stomp counter clc ;to whatever is in the stomp timer adc StompTimer jsr SetupFloateyNumber ;award points accordingly inc StompTimer ;increment stomp timer of some sort ldy PrimaryHardMode ;check primary hard mode flag lda RevivalRateData,y ;load timer setting according to flag sta EnemyIntervalTimer,x ;set as enemy timer to revive stomped enemy SBnce: lda #$fc ;set player's vertical speed for bounce sta <Player_Y_Speed ;and then leave!!! rts ChkEnemyFaceRight: lda <Enemy_MovingDir,x ;check to see if enemy is moving to the right cmp #$01 bne LInj ;if not, branch jmp InjurePlayer ;otherwise go back to hurt player LInj: jsr EnemyTurnAround ;turn the enemy around, if necessary jmp InjurePlayer ;go back to hurt player EnemyFacePlayer: ldy #$01 ;set to move right by default jsr PlayerEnemyDiff ;get horizontal difference between player and enemy bpl SFcRt ;if enemy is to the right of player, do not increment iny ;otherwise, increment to set to move to the left SFcRt: sty <Enemy_MovingDir,x ;set moving direction here dey ;then decrement to use as a proper offset rts SetupFloateyNumber: sta FloateyNum_Control,x ;set number of points control for floatey numbers lda #$30 sta FloateyNum_Timer,x ;set timer for floatey numbers lda <Enemy_Y_Position,x sta FloateyNum_Y_Pos,x ;set vertical coordinate lda Enemy_Rel_XPos sta FloateyNum_X_Pos,x ;set horizontal coordinate and leave ExSFN: rts ;------------------------------------------------------------------------------------- ;$01 - used to hold enemy offset for second enemy SetBitsMask: .db %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010 ClearBitsMask: .db %01111111, %10111111, %11011111, %11101111, %11110111, %11111011, %11111101 EnemiesCollision: lda <FrameCounter ;check counter for d0 set lsr a bcc ExSFN ;if d0 not set, leave lda AreaType beq ExSFN ;if water area type, leave lda <Enemy_ID,x cmp #$15 ;if enemy object => $15, branch to leave bcs ExitECRoutine cmp #Lakitu ;if lakitu, branch to leave beq ExitECRoutine cmp #PiranhaPlant ;if piranha plant, branch to leave beq ExitECRoutine lda EnemyOffscrBitsMasked,x ;if masked offscreen bits nonzero, branch to leave bne ExitECRoutine jsr GetEnemyBoundBoxOfs ;otherwise, do sub, get appropriate bounding box offset for dex ;first enemy we're going to compare, then decrement for second bmi ExitECRoutine ;branch to leave if there are no other enemies ECLoop: stx <$01 ;save enemy object buffer offset for second enemy here tya ;save first enemy's bounding box offset to stack pha lda <Enemy_Flag,x ;check enemy object enable flag beq ReadyNextEnemy ;branch if flag not set lda <Enemy_ID,x cmp #$15 ;check for enemy object => $15 bcs ReadyNextEnemy ;branch if true cmp #Lakitu beq ReadyNextEnemy ;branch if enemy object is lakitu cmp #PiranhaPlant beq ReadyNextEnemy ;branch if enemy object is piranha plant lda EnemyOffscrBitsMasked,x bne ReadyNextEnemy ;branch if masked offscreen bits set txa ;get second enemy object's bounding box offset asl a ;multiply by four, then add four asl a clc adc #$04 tax ;use as new contents of X jsr SprObjectCollisionCore ;do collision detection using the two enemies here ldx <ObjectOffset ;use first enemy offset for X ldy <$01 ;use second enemy offset for Y bcc NoEnemyCollision ;if carry clear, no collision, branch ahead of this lda <Enemy_State,x ORA Enemy_State,y ;check both enemy states for d7 set and #%10000000 bne YesEC ;branch if at least one of them is set lda Enemy_CollisionBits,y ;load first enemy's collision-related bits and SetBitsMask,x ;check to see if bit connected to second enemy is bne ReadyNextEnemy ;already set, and move onto next enemy slot if set lda Enemy_CollisionBits,y ora SetBitsMask,x ;if the bit is not set, set it now sta Enemy_CollisionBits,y YesEC: jsr ProcEnemyCollisions ;react according to the nature of collision jmp ReadyNextEnemy ;move onto next enemy slot NoEnemyCollision: lda Enemy_CollisionBits,y ;load first enemy's collision-related bits and ClearBitsMask,x ;clear bit connected to second enemy sta Enemy_CollisionBits,y ;then move onto next enemy slot ReadyNextEnemy: pla ;get first enemy's bounding box offset from the stack tay ;use as Y again ldx <$01 ;get and decrement second enemy's object buffer offset dex bpl ECLoop ;loop until all enemy slots have been checked ExitECRoutine: ldx <ObjectOffset ;get enemy object buffer offset rts ;leave ProcEnemyCollisions: LDA Enemy_State,y ;check both enemy states for d5 set ora <Enemy_State,x and #%00100000 ;if d5 is set in either state, or both, branch bne ExitProcessEColl ;to leave and do nothing else at this point lda <Enemy_State,x cmp #$06 ;if second enemy state < $06, branch elsewhere bcc ProcSecondEnemyColl lda <Enemy_ID,x ;check second enemy identifier for hammer bro cmp #HammerBro ;if hammer bro found in alt state, branch to leave beq ExitProcessEColl LDA Enemy_State,y ;check first enemy state for d7 set asl a bcc ShellCollisions ;branch if d7 is clear lda #$06 jsr SetupFloateyNumber ;award 1000 points for killing enemy jsr ShellOrBlockDefeat ;then kill enemy, then load ldy <$01 ;original offset of second enemy ShellCollisions: tya ;move Y to X tax jsr ShellOrBlockDefeat ;kill second enemy ldx <ObjectOffset lda ShellChainCounter,x ;get chain counter for shell clc adc #$04 ;add four to get appropriate point offset ldx <$01 jsr SetupFloateyNumber ;award appropriate number of points for second enemy ldx <ObjectOffset ;load original offset of first enemy inc ShellChainCounter,x ;increment chain counter for additional enemies ExitProcessEColl: rts ;leave!!! ProcSecondEnemyColl: LDA Enemy_State,y ;if first enemy state < $06, branch elsewhere cmp #$06 bcc MoveEOfs LDA Enemy_ID,y ;check first enemy identifier for hammer bro cmp #HammerBro ;if hammer bro found in alt state, branch to leave beq ExitProcessEColl jsr ShellOrBlockDefeat ;otherwise, kill first enemy ldy <$01 lda ShellChainCounter,y ;get chain counter for shell clc adc #$04 ;add four to get appropriate point offset ldx <ObjectOffset jsr SetupFloateyNumber ;award appropriate number of points for first enemy ldx <$01 ;load original offset of second enemy inc ShellChainCounter,x ;increment chain counter for additional enemies rts ;leave!!! MoveEOfs: tya ;move Y ($01) to X tax jsr EnemyTurnAround ;do the sub here using value from $01 ldx <ObjectOffset ;then do it again using value from $08 EnemyTurnAround: lda <Enemy_ID,x ;check for specific enemies cmp #PiranhaPlant beq ExTA ;if piranha plant, leave cmp #Lakitu beq ExTA ;if lakitu, leave cmp #HammerBro beq ExTA ;if hammer bro, leave cmp #Spiny beq RXSpd ;if spiny, turn it around cmp #GreenParatroopaJump beq RXSpd ;if green paratroopa, turn it around cmp #$07 bcs ExTA ;if any OTHER enemy object => $07, leave RXSpd: lda <Enemy_X_Speed,x ;load horizontal speed eor #$ff ;get two's compliment for horizontal speed tay iny sty <Enemy_X_Speed,x ;store as new horizontal speed lda <Enemy_MovingDir,x eor #%00000011 ;invert moving direction and store, then leave sta <Enemy_MovingDir,x ;thus effectively turning the enemy around ExTA: rts ;leave!!! ;------------------------------------------------------------------------------------- ;$00 - vertical position of platform LargePlatformCollision: lda #$ff ;save value here sta PlatformCollisionFlag,x lda TimerControl ;check master timer control bne ExLPC ;if set, branch to leave lda <Enemy_State,x ;if d7 set in object state, bmi ExLPC ;branch to leave lda <Enemy_ID,x cmp #$24 ;check enemy object identifier for bne ChkForPlayerC_LargeP ;balance platform, branch if not found lda <Enemy_State,x tax ;set state as enemy offset here jsr ChkForPlayerC_LargeP ;perform code with state offset, then original offset, in X ChkForPlayerC_LargeP: jsr CheckPlayerVertical ;figure out if player is below a certain point bcs ExLPC ;or offscreen, branch to leave if true txa jsr GetEnemyBoundBoxOfsArg ;get bounding box offset in Y lda <Enemy_Y_Position,x ;store vertical coordinate in sta <$00 ;temp variable for now txa ;send offset we're on to the stack pha jsr PlayerCollisionCore ;do player-to-platform collision detection pla ;retrieve offset from the stack tax bcc ExLPC ;if no collision, branch to leave jsr ProcLPlatCollisions ;otherwise collision, perform sub ExLPC: ldx <ObjectOffset ;get enemy object buffer offset and leave rts ;-------------------------------- ;$00 - counter for bounding boxes SmallPlatformCollision: lda TimerControl ;if master timer control set, bne ExSPC ;branch to leave sta PlatformCollisionFlag,x ;otherwise initialize collision flag jsr CheckPlayerVertical ;do a sub to see if player is below a certain point bcs ExSPC ;or entirely offscreen, and branch to leave if true lda #$02 sta <$00 ;load counter here for 2 bounding boxes ChkSmallPlatLoop: ldx <ObjectOffset ;get enemy object offset jsr GetEnemyBoundBoxOfs ;get bounding box offset in Y and #%00000010 ;if d1 of offscreen lower nybble bits was set bne ExSPC ;then branch to leave lda BoundingBox_UL_YPos,y ;check top of platform's bounding box for being cmp #$20 ;above a specific point bcc MoveBoundBox ;if so, branch, don't do collision detection jsr PlayerCollisionCore ;otherwise, perform player-to-platform collision detection bcs ProcSPlatCollisions ;skip ahead if collision MoveBoundBox: lda BoundingBox_UL_YPos,y ;move bounding box vertical coordinates clc ;128 pixels downwards adc #$80 sta BoundingBox_UL_YPos,y lda BoundingBox_DR_YPos,y clc adc #$80 sta BoundingBox_DR_YPos,y dec <$00 ;decrement counter we set earlier bne ChkSmallPlatLoop ;loop back until both bounding boxes are checked ExSPC: ldx <ObjectOffset ;get enemy object buffer offset, then leave rts ;-------------------------------- ProcSPlatCollisions: ldx <ObjectOffset ;return enemy object buffer offset to X, then continue ProcLPlatCollisions: lda BoundingBox_DR_YPos,y ;get difference by subtracting the top sec ;of the player's bounding box from the bottom sbc BoundingBox_UL_YPos ;of the platform's bounding box cmp #$04 ;if difference too large or negative, bcs ChkForTopCollision ;branch, do not alter vertical speed of player lda <Player_Y_Speed ;check to see if player's vertical speed is moving down bpl ChkForTopCollision ;if so, don't mess with it lda #$01 ;otherwise, set vertical sta <Player_Y_Speed ;speed of player to kill jump ChkForTopCollision: lda BoundingBox_DR_YPos ;get difference by subtracting the top sec ;of the platform's bounding box from the bottom sbc BoundingBox_UL_YPos,y ;of the player's bounding box cmp #$06 bcs PlatformSideCollisions ;if difference not close enough, skip all of this lda <Player_Y_Speed bmi PlatformSideCollisions ;if player's vertical speed moving upwards, skip this lda <$00 ;get saved bounding box counter from earlier ldy <Enemy_ID,x cpy #$2b ;if either of the two small platform objects are found, beq SetCollisionFlag ;regardless of which one, branch to use bounding box counter cpy #$2c ;as contents of collision flag beq SetCollisionFlag txa ;otherwise use enemy object buffer offset SetCollisionFlag: ldx <ObjectOffset ;get enemy object buffer offset sta PlatformCollisionFlag,x ;save either bounding box counter or enemy offset here lda #$00 sta <Player_State ;set player state to normal then leave rts PlatformSideCollisions: lda #$01 ;set value here to indicate possible horizontal sta <$00 ;collision on left side of platform lda BoundingBox_DR_XPos ;get difference by subtracting platform's left edge sec ;from player's right edge sbc BoundingBox_UL_XPos,y cmp #$08 ;if difference close enough, skip all of this bcc SideC inc <$00 ;otherwise increment value set here for right side collision lda BoundingBox_DR_XPos,y ;get difference by subtracting player's left edge clc ;from platform's right edge sbc BoundingBox_UL_XPos cmp #$09 ;if difference not close enough, skip subroutine bcs NoSideC ;and instead branch to leave (no collision) SideC: jsr ImpedePlayerMove ;deal with horizontal collision NoSideC: ldx <ObjectOffset ;return with enemy object buffer offset rts ;------------------------------------------------------------------------------------- PlayerPosSPlatData: .db $80, $00 PositionPlayerOnS_Plat: tay ;use bounding box counter saved in collision flag lda <Enemy_Y_Position,x ;for offset clc ;add positioning data using offset to the vertical adc PlayerPosSPlatData-1,y ;coordinate .db $2c ;BIT instruction opcode PositionPlayerOnVPlat: lda <Enemy_Y_Position,x ;get vertical coordinate ldy <GameEngineSubroutine cpy #$0b ;if certain routine being executed on this frame, beq ExPlPos ;skip all of this ldy <Enemy_Y_HighPos,x cpy #$01 ;if vertical high byte offscreen, skip this bne ExPlPos sec ;subtract 32 pixels from vertical coordinate sbc #$20 ;for the player object's height sta <Player_Y_Position ;save as player's new vertical coordinate tya sbc #$00 ;subtract borrow and store as player's sta <Player_Y_HighPos ;new vertical high byte lda #$00 sta <Player_Y_Speed ;initialize vertical speed and low byte of force sta Player_Y_MoveForce ;and then leave ExPlPos: rts ;------------------------------------------------------------------------------------- CheckPlayerVertical: lda Player_OffscreenBits ;if player object is completely offscreen cmp #$f0 ;vertically, leave this routine bcs ExCPV ldy <Player_Y_HighPos ;if player high vertical byte is not dey ;within the screen, leave this routine bne ExCPV lda <Player_Y_Position ;if on the screen, check to see how far down cmp #$d0 ;the player is vertically ExCPV: rts ;------------------------------------------------------------------------------------- GetEnemyBoundBoxOfs: lda <ObjectOffset ;get enemy object buffer offset GetEnemyBoundBoxOfsArg: asl a ;multiply A by four, then add four asl a ;to skip player's bounding box clc adc #$04 tay ;send to Y lda Enemy_OffscreenBits ;get offscreen bits for enemy object and #%00001111 ;save low nybble cmp #%00001111 ;check for all bits set rts ;------------------------------------------------------------------------------------- ;$00-$01 - used to hold many values, essentially temp variables ;$04 - holds lower nybble of vertical coordinate from block buffer routine ;$eb - used to hold block buffer adder PlayerBGUpperExtent: .db $20, $10 PlayerBGCollision: lda DisableCollisionDet ;if collision detection disabled flag set, bne ExPBGCol ;branch to leave lda <GameEngineSubroutine cmp #$0b ;if running routine #11 or $0b beq ExPBGCol ;branch to leave cmp #$04 bcc ExPBGCol ;if running routines $00-$03 branch to leave lda #$01 ;load default player state for swimming ldy SwimmingFlag ;if swimming flag set, bne SetPSte ;branch ahead to set default state lda <Player_State ;if player in normal state, beq SetFallS ;branch to set default state for falling cmp #$03 bne ChkOnScr ;if in any other state besides climbing, skip to next part SetFallS: lda #$02 ;load default player state for falling SetPSte: sta <Player_State ;set whatever player state is appropriate ChkOnScr: lda <Player_Y_HighPos cmp #$01 ;check player's vertical high byte for still on the screen bne ExPBGCol ;branch to leave if not lda #$ff sta Player_CollisionBits ;initialize player's collision flag lda <Player_Y_Position cmp #$cf ;check player's vertical coordinate bcc ChkCollSize ;if not too close to the bottom of screen, continue ExPBGCol: rts ;otherwise leave ChkCollSize: ldy #$02 ;load default offset lda CrouchingFlag bne GBBAdr ;if player crouching, skip ahead lda PlayerSize bne GBBAdr ;if player small, skip ahead dey ;otherwise decrement offset for big player not crouching lda SwimmingFlag bne GBBAdr ;if swimming flag set, skip ahead dey ;otherwise decrement offset GBBAdr: lda BlockBufferAdderData,y ;get value using offset sta <$eb ;store value here tay ;put value into Y, as offset for block buffer routine ldx PlayerSize ;get player's size as offset lda CrouchingFlag beq HeadChk ;if player not crouching, branch ahead inx ;otherwise increment size as offset HeadChk: lda <Player_Y_Position ;get player's vertical coordinate cmp PlayerBGUpperExtent,x ;compare with upper extent value based on offset bcc DoFootCheck ;if player is too high, skip this part jsr BlockBufferColli_Head ;do player-to-bg collision detection on top of beq DoFootCheck ;player, and branch if nothing above player's head jsr CheckForCoinMTiles ;check to see if player touched coin with their head bcs AwardTouchedCoin ;if so, branch to some other part of code ldy <Player_Y_Speed ;check player's vertical speed bpl DoFootCheck ;if player not moving upwards, branch elsewhere ldy <$04 ;check lower nybble of vertical coordinate returned cpy #$04 ;from collision detection routine bcc DoFootCheck ;if low nybble < 4, branch jsr CheckForSolidMTiles ;check to see what player's head bumped on bcs SolidOrClimb ;if player collided with solid metatile, branch ldy AreaType ;otherwise check area type beq NYSpd ;if water level, branch ahead ldy BlockBounceTimer ;if block bounce timer not expired, bne NYSpd ;branch ahead, do not process collision jsr PlayerHeadCollision ;otherwise do a sub to process collision jmp DoFootCheck ;jump ahead to skip these other parts here SolidOrClimb: cmp #$26 ;if climbing metatile, beq NYSpd ;branch ahead and do not play sound lda #Sfx_Bump sta <Square1SoundQueue ;otherwise load bump sound NYSpd: lda #$01 ;set player's vertical speed to nullify sta <Player_Y_Speed ;jump or swim DoFootCheck: ldy <$eb ;get block buffer adder offset lda <Player_Y_Position cmp #$cf ;check to see how low player is bcs DoPlayerSideCheck ;if player is too far down on screen, skip all of this jsr BlockBufferColli_Feet ;do player-to-bg collision detection on bottom left of player jsr CheckForCoinMTiles ;check to see if player touched coin with their left foot bcs AwardTouchedCoin ;if so, branch to some other part of code pha ;save bottom left metatile to stack jsr BlockBufferColli_Feet ;do player-to-bg collision detection on bottom right of player sta <$00 ;save bottom right metatile here pla sta <$01 ;pull bottom left metatile and save here bne ChkFootMTile ;if anything here, skip this part lda <$00 ;otherwise check for anything in bottom right metatile beq DoPlayerSideCheck ;and skip ahead if not jsr CheckForCoinMTiles ;check to see if player touched coin with their right foot bcc ChkFootMTile ;if not, skip unconditional jump and continue code AwardTouchedCoin: jmp HandleCoinMetatile ;follow the code to erase coin and award to player 1 coin ChkFootMTile: jsr CheckForClimbMTiles ;check to see if player landed on climbable metatiles bcs DoPlayerSideCheck ;if so, branch ldy <Player_Y_Speed ;check player's vertical speed bmi DoPlayerSideCheck ;if player moving upwards, branch cmp #$c5 bne ContChk ;if player did not touch axe, skip ahead jmp HandleAxeMetatile ;otherwise jump to set modes of operation ContChk: jsr ChkInvisibleMTiles ;do sub to check for hidden coin or 1-up blocks beq DoPlayerSideCheck ;if either found, branch ldy JumpspringAnimCtrl ;if jumpspring animating right now, bne InitSteP ;branch ahead ldy <$04 ;check lower nybble of vertical coordinate returned cpy #$05 ;from collision detection routine bcc LandPlyr ;if lower nybble < 5, branch lda <Player_MovingDir sta <$00 ;use player's moving direction as temp variable jmp ImpedePlayerMove ;jump to impede player's movement in that direction LandPlyr: jsr ChkForLandJumpSpring ;do sub to check for jumpspring metatiles and deal with it lda #$f0 and <Player_Y_Position ;mask out lower nybble of player's vertical position sta <Player_Y_Position ;and store as new vertical position to land player properly jsr HandlePipeEntry ;do sub to process potential pipe entry lda #$00 sta <Player_Y_Speed ;initialize vertical speed and fractional sta Player_Y_MoveForce ;movement force to stop player's vertical movement sta StompChainCounter ;initialize enemy stomp counter InitSteP: lda #$00 sta <Player_State ;set player's state to normal DoPlayerSideCheck: ldy <$eb ;get block buffer adder offset iny iny ;increment offset 2 bytes to use adders for side collisions lda #$02 ;set value here to be used as counter sta <$00 SideCheckLoop: iny ;move onto the next one sty <$eb ;store it lda <Player_Y_Position cmp #$20 ;check player's vertical position bcc BHalf ;if player is in status bar area, branch ahead to skip this part cmp #$e4 bcs ExSCH ;branch to leave if player is too far down jsr BlockBufferColli_Side ;do player-to-bg collision detection on one half of player beq BHalf ;branch ahead if nothing found cmp #$1c ;otherwise check for pipe metatiles beq BHalf ;if collided with sideways pipe (top), branch ahead cmp #$6b beq BHalf ;if collided with water pipe (top), branch ahead jsr CheckForClimbMTiles ;do sub to see if player bumped into anything climbable bcc CheckSideMTiles ;if not, branch to alternate section of code BHalf: ldy <$eb ;load block adder offset iny ;increment it lda <Player_Y_Position ;get player's vertical position cmp #$08 bcc ExSCH ;if too high, branch to leave cmp #$d0 bcs ExSCH ;if too low, branch to leave jsr BlockBufferColli_Side ;do player-to-bg collision detection on other half of player bne CheckSideMTiles ;if something found, branch dec <$00 ;otherwise decrement counter bne SideCheckLoop ;run code until both sides of player are checked ExSCH: rts ;leave CheckSideMTiles: jsr ChkInvisibleMTiles ;check for hidden or coin 1-up blocks beq ExCSM ;branch to leave if either found jsr CheckForClimbMTiles ;check for climbable metatiles bcc ContSChk ;if not found, skip and continue with code jmp HandleClimbing ;otherwise jump to handle climbing ContSChk: jsr CheckForCoinMTiles ;check to see if player touched coin bcs HandleCoinMetatile ;if so, execute code to erase coin and award to player 1 coin jsr ChkJumpspringMetatiles ;check for jumpspring metatiles bcc ChkPBtm ;if not found, branch ahead to continue cude lda JumpspringAnimCtrl ;otherwise check jumpspring animation control bne ExCSM ;branch to leave if set jmp StopPlayerMove ;otherwise jump to impede player's movement ChkPBtm: ldy <Player_State ;get player's state cpy #$00 ;check for player's state set to normal bne StopPlayerMove ;if not, branch to impede player's movement ldy <PlayerFacingDir ;get player's facing direction dey bne StopPlayerMove ;if facing left, branch to impede movement cmp #$6c ;otherwise check for pipe metatiles beq PipeDwnS ;if collided with sideways pipe (bottom), branch cmp #$1f ;if collided with water pipe (bottom), continue bne StopPlayerMove ;otherwise branch to impede player's movement PipeDwnS: lda Player_SprAttrib ;check player's attributes bne PlyrPipe ;if already set, branch, do not play sound again ldy #Sfx_PipeDown_Injury sty <Square1SoundQueue ;otherwise load pipedown/injury sound PlyrPipe: ora #%00100000 sta Player_SprAttrib ;set background priority bit in player attributes lda <Player_X_Position and #%00001111 ;get lower nybble of player's horizontal coordinate beq ChkGERtn ;if at zero, branch ahead to skip this part ldy #$00 ;set default offset for timer setting data lda ScreenLeft_PageLoc ;load page location for left side of screen beq SetCATmr ;if at page zero, use default offset iny ;otherwise increment offset SetCATmr: lda AreaChangeTimerData,y ;set timer for change of area as appropriate sta ChangeAreaTimer ChkGERtn: lda <GameEngineSubroutine ;get number of game engine routine running cmp #$07 beq ExCSM ;if running player entrance routine or cmp #$08 ;player control routine, go ahead and branch to leave bne ExCSM lda #$02 sta <GameEngineSubroutine ;otherwise set sideways pipe entry routine to run rts ;and leave ;-------------------------------- ;$02 - high nybble of vertical coordinate from block buffer ;$04 - low nybble of horizontal coordinate from block buffer ;$06-$07 - block buffer address StopPlayerMove: jsr ImpedePlayerMove ;stop player's movement ExCSM: rts ;leave AreaChangeTimerData: .db $a0, $34 HandleCoinMetatile: jsr ErACM ;do sub to erase coin metatile from block buffer inc CoinTallyFor1Ups ;increment coin tally used for 1-up blocks jmp GiveOneCoin ;update coin amount and tally on the screen HandleAxeMetatile: lda #$00 sta OperMode_Task ;reset secondary mode lda #$02 sta OperMode ;set primary mode to autoctrl mode lda #$18 sta <Player_X_Speed ;set horizontal speed and continue to erase axe metatile ErACM: ldy <$02 ;load vertical high nybble offset for block buffer lda #$00 ;load blank metatile sta [$06],y ;store to remove old contents from block buffer jmp RemoveCoin_Axe ;update the screen accordingly ;-------------------------------- ;$02 - high nybble of vertical coordinate from block buffer ;$04 - low nybble of horizontal coordinate from block buffer ;$06-$07 - block buffer address ClimbXPosAdder: .db $f9, $07 ClimbPLocAdder: .db $ff, $00 FlagpoleYPosData: .db $18, $22, $50, $68, $90 HandleClimbing: ldy <$04 ;check low nybble of horizontal coordinate returned from cpy #$06 ;collision detection routine against certain values, this bcc ExHC ;makes actual physical part of vine or flagpole thinner cpy #$0a ;than 16 pixels bcc ChkForFlagpole ExHC: rts ;leave if too far left or too far right ChkForFlagpole: cmp #$24 ;check climbing metatiles beq FlagpoleCollision ;branch if flagpole ball found cmp #$25 bne VineCollision ;branch to alternate code if flagpole shaft not found FlagpoleCollision: lda <GameEngineSubroutine cmp #$05 ;check for end-of-level routine running beq PutPlayerOnVine ;if running, branch to end of climbing code lda #$01 sta <PlayerFacingDir ;set player's facing direction to right inc ScrollLock ;set scroll lock flag lda <GameEngineSubroutine cmp #$04 ;check for flagpole slide routine running beq RunFR ;if running, branch to end of flagpole code here lda #BulletBill_CannonVar ;load identifier for bullet bills (cannon variant) jsr KillEnemies ;get rid of them lda #Silence sta <EventMusicQueue ;silence music lsr a sta FlagpoleSoundQueue ;load flagpole sound into flagpole sound queue ldx #$04 ;start at end of vertical coordinate data lda <Player_Y_Position sta FlagpoleCollisionYPos ;store player's vertical coordinate here to be used later ChkFlagpoleYPosLoop: cmp FlagpoleYPosData,x ;compare with current vertical coordinate data bcs MtchF ;if player's => current, branch to use current offset dex ;otherwise decrement offset to use bne ChkFlagpoleYPosLoop ;do this until all data is checked (use last one if all checked) MtchF: stx FlagpoleScore ;store offset here to be used later RunFR: lda #$04 sta <GameEngineSubroutine ;set value to run flagpole slide routine jmp PutPlayerOnVine ;jump to end of climbing code VineCollision: cmp #$26 ;check for climbing metatile used on vines bne PutPlayerOnVine lda <Player_Y_Position ;check player's vertical coordinate cmp #$20 ;for being in status bar area bcs PutPlayerOnVine ;branch if not that far up lda #$01 sta <GameEngineSubroutine ;otherwise set to run autoclimb routine next frame PutPlayerOnVine: lda #$03 ;set player state to climbing sta <Player_State lda #$00 ;nullify player's horizontal speed sta <Player_X_Speed ;and fractional horizontal movement force sta Player_X_MoveForce lda <Player_X_Position ;get player's horizontal coordinate sec sbc ScreenLeft_X_Pos ;subtract from left side horizontal coordinate cmp #$10 bcs SetVXPl ;if 16 or more pixels difference, do not alter facing direction lda #$02 sta <PlayerFacingDir ;otherwise force player to face left SetVXPl: ldy <PlayerFacingDir ;get current facing direction, use as offset lda <$06 ;get low byte of block buffer address asl a asl a ;move low nybble to high asl a asl a clc adc ClimbXPosAdder-1,y ;add pixels depending on facing direction sta <Player_X_Position ;store as player's horizontal coordinate lda <$06 ;get low byte of block buffer address again bne ExPVne ;if not zero, branch lda ScreenRight_PageLoc ;load page location of right side of screen clc adc ClimbPLocAdder-1,y ;add depending on facing location sta <Player_PageLoc ;store as player's page location ExPVne: rts ;finally, we're done! ;-------------------------------- ChkInvisibleMTiles: cmp #$5f ;check for hidden coin block beq ExCInvT ;branch to leave if found cmp #$60 ;check for hidden 1-up block ExCInvT: rts ;leave with zero flag set if either found ;-------------------------------- ;$00-$01 - used to hold bottom right and bottom left metatiles (in that order) ;$00 - used as flag by ImpedePlayerMove to restrict specific movement ChkForLandJumpSpring: jsr ChkJumpspringMetatiles ;do sub to check if player landed on jumpspring bcc ExCJSp ;if carry not set, jumpspring not found, therefore leave lda #$70 sta VerticalForce ;otherwise set vertical movement force for player lda #$f9 sta JumpspringForce ;set default jumpspring force lda #$03 sta JumpspringTimer ;set jumpspring timer to be used later lsr a sta JumpspringAnimCtrl ;set jumpspring animation control to start animating ExCJSp: rts ;and leave ChkJumpspringMetatiles: cmp #$67 ;check for top jumpspring metatile beq JSFnd ;branch to set carry if found cmp #$68 ;check for bottom jumpspring metatile clc ;clear carry flag bne NoJSFnd ;branch to use cleared carry if not found JSFnd: sec ;set carry if found NoJSFnd: rts ;leave HandlePipeEntry: lda <Up_Down_Buttons ;check saved controller bits from earlier and #%00000100 ;for pressing down beq ExPipeE ;if not pressing down, branch to leave lda <$00 cmp #$11 ;check right foot metatile for warp pipe right metatile bne ExPipeE ;branch to leave if not found lda <$01 cmp #$10 ;check left foot metatile for warp pipe left metatile bne ExPipeE ;branch to leave if not found lda #$30 sta ChangeAreaTimer ;set timer for change of area lda #$03 sta <GameEngineSubroutine ;set to run vertical pipe entry routine on next frame lda #Sfx_PipeDown_Injury sta <Square1SoundQueue ;load pipedown/injury sound lda #%00100000 sta Player_SprAttrib ;set background priority bit in player's attributes lda WarpZoneControl ;check warp zone control beq ExPipeE ;branch to leave if none found and #%00000011 ;mask out all but 2 LSB asl a asl a ;multiply by four tax ;save as offset to warp zone numbers (starts at left pipe) lda <Player_X_Position ;get player's horizontal position cmp #$60 bcc GetWNum ;if player at left, not near middle, use offset and skip ahead inx ;otherwise increment for middle pipe cmp #$a0 bcc GetWNum ;if player at middle, but not too far right, use offset and skip inx ;otherwise increment for last pipe GetWNum: ldy WarpZoneNumbers,x ;get warp zone numbers dey ;decrement for use as world number sty WorldNumber ;store as world number and offset ldx WorldAddrOffsets,y ;get offset to where this world's area offsets are lda AreaAddrOffsets,x ;get area offset based on world offset sta AreaPointer ;store area offset here to be used to change areas lda #Silence sta <EventMusicQueue ;silence music lda #$00 sta EntrancePage ;initialize starting page number sta AreaNumber ;initialize area number used for area address offset sta LevelNumber ;initialize level number used for world display sta AltEntranceControl ;initialize mode of entry inc Hidden1UpFlag ;set flag for hidden 1-up blocks inc FetchNewGameTimerFlag ;set flag to load new game timer ExPipeE: rts ;leave!!! ImpedePlayerMove: lda #$00 ;initialize value here ldy <Player_X_Speed ;get player's horizontal speed ldx <$00 ;check value set earlier for dex ;left side collision bne RImpd ;if right side collision, skip this part inx ;return value to X cpy #$00 ;if player moving to the left, bmi ExIPM ;branch to invert bit and leave lda #$ff ;otherwise load A with value to be used later jmp NXSpd ;and jump to affect movement RImpd: ldx #$02 ;return $02 to X cpy #$01 ;if player moving to the right, bpl ExIPM ;branch to invert bit and leave lda #$01 ;otherwise load A with value to be used here NXSpd: ldy #$10 sty SideCollisionTimer ;set timer of some sort ldy #$00 sty <Player_X_Speed ;nullify player's horizontal speed cmp #$00 ;if value set in A not set to $ff, bpl PlatF ;branch ahead, do not decrement Y dey ;otherwise decrement Y now PlatF: sty <$00 ;store Y as high bits of horizontal adder clc adc <Player_X_Position ;add contents of A to player's horizontal sta <Player_X_Position ;position to move player left or right lda <Player_PageLoc adc <$00 ;add high bits and carry to sta <Player_PageLoc ;page location if necessary ExIPM: txa ;invert contents of X eor #$ff and Player_CollisionBits ;mask out bit that was set here sta Player_CollisionBits ;store to clear bit rts ;-------------------------------- SolidMTileUpperExt: .db $10, $61, $88, $c4 CheckForSolidMTiles: jsr GetMTileAttrib ;find appropriate offset based on metatile's 2 MSB cmp SolidMTileUpperExt,x ;compare current metatile with solid metatiles rts ClimbMTileUpperExt: .db $24, $6d, $8a, $c6 CheckForClimbMTiles: jsr GetMTileAttrib ;find appropriate offset based on metatile's 2 MSB cmp ClimbMTileUpperExt,x ;compare current metatile with climbable metatiles rts CheckForCoinMTiles: cmp #$c2 ;check for regular coin beq CoinSd ;branch if found cmp #$c3 ;check for underwater coin beq CoinSd ;branch if found clc ;otherwise clear carry and leave rts CoinSd: lda #Sfx_CoinGrab sta <Square2SoundQueue ;load coin grab sound and leave rts GetMTileAttrib: tay ;save metatile value into Y and #%11000000 ;mask out all but 2 MSB asl a rol a ;shift and rotate d7-d6 to d1-d0 rol a tax ;use as offset for metatile data tya ;get original metatile value back ExEBG: rts ;leave ;------------------------------------------------------------------------------------- ;$06-$07 - address from block buffer routine EnemyBGCStateData: .db $01, $01, $02, $02, $02, $05 EnemyBGCXSpdData: .db $10, $f0 EnemyToBGCollisionDet: lda <Enemy_State,x ;check enemy state for d6 set and #%00100000 bne ExEBG ;if set, branch to leave jsr SubtEnemyYPos ;otherwise, do a subroutine here bcc ExEBG ;if enemy vertical coord + 62 < 68, branch to leave ldy <Enemy_ID,x cpy #Spiny ;if enemy object is not spiny, branch elsewhere bne DoIDCheckBGColl lda <Enemy_Y_Position,x cmp #$25 ;if enemy vertical coordinate < 36 branch to leave bcc ExEBG DoIDCheckBGColl: cpy #GreenParatroopaJump ;check for some other enemy object bne HBChk ;branch if not found jmp EnemyJump ;otherwise jump elsewhere HBChk: cpy #HammerBro ;check for hammer bro bne CInvu ;branch if not found jmp HammerBroBGColl ;otherwise jump elsewhere CInvu: cpy #Spiny ;if enemy object is spiny, branch beq YesIn cpy #PowerUpObject ;if special power-up object, branch beq YesIn cpy #$07 ;if enemy object =>$07, branch to leave bcs ExEBGChk YesIn: jsr ChkUnderEnemy ;if enemy object < $07, or = $12 or $2e, do this sub bne HandleEToBGCollision ;if block underneath enemy, branch NoEToBGCollision: jmp ChkForRedKoopa ;otherwise skip and do something else ;-------------------------------- ;$02 - vertical coordinate from block buffer routine HandleEToBGCollision: jsr ChkForNonSolids ;if something is underneath enemy, find out what beq NoEToBGCollision ;if blank $26, coins, or hidden blocks, jump, enemy falls through ;;;cmp #$23 this instruction got cut between banks. (?) .db $C9 ;;;;;;;;;;;;;;;;;;;;;; ;; .bank 3 .org $E000 .db $23 ;latter half of instruction above bne LandEnemyProperly ;check for blank metatile $23 and branch if not found ldy <$02 ;get vertical coordinate used to find block lda #$00 ;store default blank metatile in that spot so we won't sta [$06],y ;trigger this routine accidentally again lda <Enemy_ID,x cmp #$15 ;if enemy object => $15, branch ahead bcs ChkToStunEnemies cmp #Goomba ;if enemy object not goomba, branch ahead of this routine bne GiveOEPoints jsr KillEnemyAboveBlock ;if enemy object IS goomba, do this sub GiveOEPoints: lda #$01 ;award 100 points for hitting block beneath enemy jsr SetupFloateyNumber ChkToStunEnemies: cmp #$09 ;perform many comparisons on enemy object identifier bcc SetStun cmp #$11 ;if the enemy object identifier is equal to the values bcs SetStun ;$09, $0e, $0f or $10, it will be modified, and not cmp #$0a ;modified if not any of those values, note that piranha plant will bcc Demote ;always fail this test because A will still have vertical cmp #PiranhaPlant ;coordinate from previous addition, also these comparisons bcc SetStun ;are only necessary if branching from $d7a1 Demote: and #%00000001 ;erase all but LSB, essentially turning enemy object sta <Enemy_ID,x ;into green or red koopa troopa to demote them SetStun: lda <Enemy_State,x ;load enemy state and #%11110000 ;save high nybble ora #%00000010 sta <Enemy_State,x ;set d1 of enemy state dec <Enemy_Y_Position,x dec <Enemy_Y_Position,x ;subtract two pixels from enemy's vertical position lda <Enemy_ID,x cmp #Bloober ;check for bloober object beq SetWYSpd lda #$fd ;set default vertical speed ldy AreaType bne SetNotW ;if area type not water, set as speed, otherwise SetWYSpd: lda #$ff ;change the vertical speed SetNotW: sta <Enemy_Y_Speed,x ;set vertical speed now ldy #$01 jsr PlayerEnemyDiff ;get horizontal difference between player and enemy object bpl ChkBBill ;branch if enemy is to the right of player iny ;increment Y if not ChkBBill: lda <Enemy_ID,x cmp #BulletBill_CannonVar ;check for bullet bill (cannon variant) beq NoCDirF cmp #BulletBill_FrenzyVar ;check for bullet bill (frenzy variant) beq NoCDirF ;branch if either found, direction does not change sty <Enemy_MovingDir,x ;store as moving direction NoCDirF: dey ;decrement and use as offset lda EnemyBGCXSpdData,y ;get proper horizontal speed sta <Enemy_X_Speed,x ;and store, then leave ExEBGChk: rts ;-------------------------------- ;$04 - low nybble of vertical coordinate from block buffer routine LandEnemyProperly: lda <$04 ;check lower nybble of vertical coordinate saved earlier sec sbc #$08 ;subtract eight pixels cmp #$05 ;used to determine whether enemy landed from falling bcs ChkForRedKoopa ;branch if lower nybble in range of $0d-$0f before subtract lda <Enemy_State,x and #%01000000 ;branch if d6 in enemy state is set bne LandEnemyInitState lda <Enemy_State,x asl a ;branch if d7 in enemy state is not set bcc ChkLandedEnemyState SChkA: jmp DoEnemySideCheck ;if lower nybble < $0d, d7 set but d6 not set, jump here ChkLandedEnemyState: lda <Enemy_State,x ;if enemy in normal state, branch back to jump here beq SChkA cmp #$05 ;if in state used by spiny's egg beq ProcEnemyDirection ;then branch elsewhere cmp #$03 ;if already in state used by koopas and buzzy beetles bcs ExSteChk ;or in higher numbered state, branch to leave lda <Enemy_State,x ;load enemy state again (why?) cmp #$02 ;if not in $02 state (used by koopas and buzzy beetles) bne ProcEnemyDirection ;then branch elsewhere lda #$10 ;load default timer here ldy <Enemy_ID,x ;check enemy identifier for spiny cpy #Spiny bne SetForStn ;branch if not found lda #$00 ;set timer for $00 if spiny SetForStn: sta EnemyIntervalTimer,x ;set timer here lda #$03 ;set state here, apparently used to render sta <Enemy_State,x ;upside-down koopas and buzzy beetles jsr EnemyLanding ;then land it properly ExSteChk: rts ;then leave ProcEnemyDirection: lda <Enemy_ID,x ;check enemy identifier for goomba cmp #Goomba ;branch if found beq LandEnemyInitState cmp #Spiny ;check for spiny bne InvtD ;branch if not found lda #$01 sta <Enemy_MovingDir,x ;send enemy moving to the right by default lda #$08 sta <Enemy_X_Speed,x ;set horizontal speed accordingly lda <FrameCounter and #%00000111 ;if timed appropriately, spiny will skip over beq LandEnemyInitState ;trying to face the player InvtD: ldy #$01 ;load 1 for enemy to face the left (inverted here) jsr PlayerEnemyDiff ;get horizontal difference between player and enemy bpl CNwCDir ;if enemy to the right of player, branch iny ;if to the left, increment by one for enemy to face right (inverted) CNwCDir: tya cmp <Enemy_MovingDir,x ;compare direction in A with current direction in memory bne LandEnemyInitState jsr ChkForBump_HammerBroJ ;if equal, not facing in correct dir, do sub to turn around LandEnemyInitState: jsr EnemyLanding ;land enemy properly lda <Enemy_State,x and #%10000000 ;if d7 of enemy state is set, branch bne NMovShellFallBit lda #$00 ;otherwise initialize enemy state and leave sta <Enemy_State,x ;note this will also turn spiny's egg into spiny rts NMovShellFallBit: lda <Enemy_State,x ;nullify d6 of enemy state, save other bits and #%10111111 ;and store, then leave sta <Enemy_State,x rts ;-------------------------------- ChkForRedKoopa: lda <Enemy_ID,x ;check for red koopa troopa $03 cmp #RedKoopa bne Chk2MSBSt ;branch if not found lda <Enemy_State,x beq ChkForBump_HammerBroJ ;if enemy found and in normal state, branch Chk2MSBSt: lda <Enemy_State,x ;save enemy state into Y tay asl a ;check for d7 set bcc GetSteFromD ;branch if not set lda <Enemy_State,x ora #%01000000 ;set d6 jmp SetD6Ste ;jump ahead of this part GetSteFromD: lda EnemyBGCStateData,y ;load new enemy state with old as offset SetD6Ste: sta <Enemy_State,x ;set as new state ;-------------------------------- ;$00 - used to store bitmask (not used but initialized here) ;$eb - used in DoEnemySideCheck as counter and to compare moving directions DoEnemySideCheck: lda <Enemy_Y_Position,x ;if enemy within status bar, branch to leave cmp #$20 ;because there's nothing there that impedes movement bcc ExESdeC ldy #$16 ;start by finding block to the left of enemy ($00,$14) lda #$02 ;set value here in what is also used as sta <$eb ;OAM data offset SdeCLoop: lda <$eb ;check value cmp <Enemy_MovingDir,x ;compare value against moving direction bne NextSdeC ;branch if different and do not seek block there lda #$01 ;set flag in A for save horizontal coordinate jsr BlockBufferChk_Enemy ;find block to left or right of enemy object beq NextSdeC ;if nothing found, branch jsr ChkForNonSolids ;check for non-solid blocks bne ChkForBump_HammerBroJ ;branch if not found NextSdeC: dec <$eb ;move to the next direction iny cpy #$18 ;increment Y, loop only if Y < $18, thus we check bcc SdeCLoop ;enemy ($00, $14) and ($10, $14) pixel coordinates ExESdeC: rts ChkForBump_HammerBroJ: cpx #$05 ;check if we're on the special use slot beq NoBump ;and if so, branch ahead and do not play sound lda <Enemy_State,x ;if enemy state d7 not set, branch asl a ;ahead and do not play sound bcc NoBump lda #Sfx_Bump ;otherwise, play bump sound sta <Square1SoundQueue ;sound will never be played if branching from ChkForRedKoopa NoBump: lda <Enemy_ID,x ;check for hammer bro cmp #$05 bne InvEnemyDir ;branch if not found lda #$00 sta <$00 ;initialize value here for bitmask ldy #$fa ;load default vertical speed for jumping jmp SetHJ ;jump to code that makes hammer bro jump InvEnemyDir: jmp RXSpd ;jump to turn the enemy around ;-------------------------------- ;$00 - used to hold horizontal difference between player and enemy PlayerEnemyDiff: lda <Enemy_X_Position,x ;get distance between enemy object's sec ;horizontal coordinate and the player's sbc <Player_X_Position ;horizontal coordinate sta <$00 ;and store here lda <Enemy_PageLoc,x sbc <Player_PageLoc ;subtract borrow, then leave rts ;-------------------------------- EnemyLanding: jsr InitVStf ;do something here to vertical speed and something else lda <Enemy_Y_Position,x and #%11110000 ;save high nybble of vertical coordinate, and ora #%00001000 ;set d3, then store, probably used to set enemy object sta <Enemy_Y_Position,x ;neatly on whatever it's landing on rts SubtEnemyYPos: lda <Enemy_Y_Position,x ;add 62 pixels to enemy object's clc ;vertical coordinate adc #$3e cmp #$44 ;compare against a certain range rts ;and leave with flags set for conditional branch EnemyJump: jsr SubtEnemyYPos ;do a sub here bcc DoSide ;if enemy vertical coord + 62 < 68, branch to leave lda <Enemy_Y_Speed,x clc ;add two to vertical speed adc #$02 cmp #$03 ;if green paratroopa not falling, branch ahead bcc DoSide jsr ChkUnderEnemy ;otherwise, check to see if green paratroopa is beq DoSide ;standing on anything, then branch to same place if not jsr ChkForNonSolids ;check for non-solid blocks beq DoSide ;branch if found jsr EnemyLanding ;change vertical coordinate and speed lda #$fd sta <Enemy_Y_Speed,x ;make the paratroopa jump again DoSide: jmp DoEnemySideCheck ;check for horizontal blockage, then leave ;-------------------------------- HammerBroBGColl: jsr ChkUnderEnemy ;check to see if hammer bro is standing on anything beq NoUnderHammerBro cmp #$23 ;check for blank metatile $23 and branch if not found bne UnderHammerBro KillEnemyAboveBlock: jsr ShellOrBlockDefeat ;do this sub to kill enemy lda #$fc ;alter vertical speed of enemy and leave sta <Enemy_Y_Speed,x rts UnderHammerBro: lda EnemyFrameTimer,x ;check timer used by hammer bro bne NoUnderHammerBro ;branch if not expired lda <Enemy_State,x and #%10001000 ;save d7 and d3 from enemy state, nullify other bits sta <Enemy_State,x ;and store jsr EnemyLanding ;modify vertical coordinate, speed and something else jmp DoEnemySideCheck ;then check for horizontal blockage and leave NoUnderHammerBro: lda <Enemy_State,x ;if hammer bro is not standing on anything, set d0 ora #$01 ;in the enemy state to indicate jumping or falling, then leave sta <Enemy_State,x rts ChkUnderEnemy: lda #$00 ;set flag in A for save vertical coordinate ldy #$15 ;set Y to check the bottom middle (8,18) of enemy object jmp BlockBufferChk_Enemy ;hop to it! ChkForNonSolids: cmp #$26 ;blank metatile used for vines? beq NSFnd cmp #$c2 ;regular coin? beq NSFnd cmp #$c3 ;underwater coin? beq NSFnd cmp #$5f ;hidden coin block? beq NSFnd cmp #$60 ;hidden 1-up block? NSFnd: rts ;------------------------------------------------------------------------------------- FireballBGCollision: lda <Fireball_Y_Position,x ;check fireball's vertical coordinate cmp #$18 bcc ClearBounceFlag ;if within the status bar area of the screen, branch ahead jsr BlockBufferChk_FBall ;do fireball to background collision detection on bottom of it beq ClearBounceFlag ;if nothing underneath fireball, branch jsr ChkForNonSolids ;check for non-solid metatiles beq ClearBounceFlag ;branch if any found lda <Fireball_Y_Speed,x ;if fireball's vertical speed set to move upwards, bmi InitFireballExplode ;branch to set exploding bit in fireball's state lda <FireballBouncingFlag,x ;if bouncing flag already set, bne InitFireballExplode ;branch to set exploding bit in fireball's state lda #$fd sta <Fireball_Y_Speed,x ;otherwise set vertical speed to move upwards (give it bounce) lda #$01 sta <FireballBouncingFlag,x ;set bouncing flag lda <Fireball_Y_Position,x and #$f8 ;modify vertical coordinate to land it properly sta <Fireball_Y_Position,x ;store as new vertical coordinate rts ;leave ClearBounceFlag: lda #$00 sta <FireballBouncingFlag,x ;clear bouncing flag by default rts ;leave InitFireballExplode: lda #$80 sta <Fireball_State,x ;set exploding flag in fireball's state lda #Sfx_Bump sta <Square1SoundQueue ;load bump sound rts ;leave ;------------------------------------------------------------------------------------- ;$00 - used to hold one of bitmasks, or offset ;$01 - used for relative X coordinate, also used to store middle screen page location ;$02 - used for relative Y coordinate, also used to store middle screen coordinate ;this data added to relative coordinates of sprite objects ;stored in order: left edge, top edge, right edge, bottom edge BoundBoxCtrlData: .db $02, $08, $0e, $20 .db $03, $14, $0d, $20 .db $02, $14, $0e, $20 .db $02, $09, $0e, $15 .db $00, $00, $18, $06 .db $00, $00, $20, $0d .db $00, $00, $30, $0d .db $00, $00, $08, $08 .db $06, $04, $0a, $08 .db $03, $0e, $0d, $14 .db $00, $02, $10, $15 .db $04, $04, $0c, $1c GetFireballBoundBox: txa ;add seven bytes to offset clc ;to use in routines as offset for fireball adc #$07 tax ldy #$02 ;set offset for relative coordinates bne FBallB ;unconditional branch GetMiscBoundBox: txa ;add nine bytes to offset clc ;to use in routines as offset for misc object adc #$09 tax ldy #$06 ;set offset for relative coordinates FBallB: jsr BoundingBoxCore ;get bounding box coordinates jmp CheckRightScreenBBox ;jump to handle any offscreen coordinates GetEnemyBoundBox: ldy #$48 ;store bitmask here for now sty <$00 ldy #$44 ;store another bitmask here for now and jump jmp GetMaskedOffScrBits SmallPlatformBoundBox: ldy #$08 ;store bitmask here for now sty <$00 ldy #$04 ;store another bitmask here for now GetMaskedOffScrBits: lda <Enemy_X_Position,x ;get enemy object position relative sec ;to the left side of the screen sbc ScreenLeft_X_Pos sta <$01 ;store here lda <Enemy_PageLoc,x ;subtract borrow from current page location sbc ScreenLeft_PageLoc ;of left side bmi CMBits ;if enemy object is beyond left edge, branch ora <$01 beq CMBits ;if precisely at the left edge, branch ldy <$00 ;if to the right of left edge, use value in $00 for A CMBits: tya ;otherwise use contents of Y and Enemy_OffscreenBits ;preserve bitwise whatever's in here sta EnemyOffscrBitsMasked,x ;save masked offscreen bits here bne MoveBoundBoxOffscreen ;if anything set here, branch jmp SetupEOffsetFBBox ;otherwise, do something else LargePlatformBoundBox: inx ;increment X to get the proper offset jsr GetXOffscreenBits ;then jump directly to the sub for horizontal offscreen bits dex ;decrement to return to original offset cmp #$fe ;if completely offscreen, branch to put entire bounding bcs MoveBoundBoxOffscreen ;box offscreen, otherwise start getting coordinates SetupEOffsetFBBox: txa ;add 1 to offset to properly address clc ;the enemy object memory locations adc #$01 tax ldy #$01 ;load 1 as offset here, same reason jsr BoundingBoxCore ;do a sub to get the coordinates of the bounding box jmp CheckRightScreenBBox ;jump to handle offscreen coordinates of bounding box MoveBoundBoxOffscreen: txa ;multiply offset by 4 asl a asl a tay ;use as offset here lda #$ff sta EnemyBoundingBoxCoord,y ;load value into four locations here and leave sta EnemyBoundingBoxCoord+1,y sta EnemyBoundingBoxCoord+2,y sta EnemyBoundingBoxCoord+3,y rts BoundingBoxCore: stx <$00 ;save offset here lda SprObject_Rel_YPos,y ;store object coordinates relative to screen sta <$02 ;vertically and horizontally, respectively lda SprObject_Rel_XPos,y sta <$01 txa ;multiply offset by four and save to stack asl a asl a pha tay ;use as offset for Y, X is left alone lda SprObj_BoundBoxCtrl,x ;load value here to be used as offset for X asl a ;multiply that by four and use as X asl a tax lda <$01 ;add the first number in the bounding box data to the clc ;relative horizontal coordinate using enemy object offset adc BoundBoxCtrlData,x ;and store somewhere using same offset * 4 sta BoundingBox_UL_Corner,y ;store here lda <$01 clc adc BoundBoxCtrlData+2,x ;add the third number in the bounding box data to the sta BoundingBox_LR_Corner,y ;relative horizontal coordinate and store inx ;increment both offsets iny lda <$02 ;add the second number to the relative vertical coordinate clc ;using incremented offset and store using the other adc BoundBoxCtrlData,x ;incremented offset sta BoundingBox_UL_Corner,y lda <$02 clc adc BoundBoxCtrlData+2,x ;add the fourth number to the relative vertical coordinate sta BoundingBox_LR_Corner,y ;and store pla ;get original offset loaded into $00 * y from stack tay ;use as Y ldx <$00 ;get original offset and use as X again rts CheckRightScreenBBox: lda ScreenLeft_X_Pos ;add 128 pixels to left side of screen clc ;and store as horizontal coordinate of middle adc #$80 sta <$02 lda ScreenLeft_PageLoc ;add carry to page location of left side of screen adc #$00 ;and store as page location of middle sta <$01 lda <SprObject_X_Position,x ;get horizontal coordinate cmp <$02 ;compare against middle horizontal coordinate lda <SprObject_PageLoc,x ;get page location sbc <$01 ;subtract from middle page location bcc CheckLeftScreenBBox ;if object is on the left side of the screen, branch lda BoundingBox_DR_XPos,y ;check right-side edge of bounding box for offscreen bmi NoOfs ;coordinates, branch if still on the screen lda #$ff ;load offscreen value here to use on one or both horizontal sides ldx BoundingBox_UL_XPos,y ;check left-side edge of bounding box for offscreen bmi SORte ;coordinates, and branch if still on the screen sta BoundingBox_UL_XPos,y ;store offscreen value for left side SORte: sta BoundingBox_DR_XPos,y ;store offscreen value for right side NoOfs: ldx <ObjectOffset ;get object offset and leave rts CheckLeftScreenBBox: lda BoundingBox_UL_XPos,y ;check left-side edge of bounding box for offscreen bpl NoOfs2 ;coordinates, and branch if still on the screen cmp #$a0 ;check to see if left-side edge is in the middle of the bcc NoOfs2 ;screen or really offscreen, and branch if still on lda #$00 ldx BoundingBox_DR_XPos,y ;check right-side edge of bounding box for offscreen bpl SOLft ;coordinates, branch if still onscreen sta BoundingBox_DR_XPos,y ;store offscreen value for right side SOLft: sta BoundingBox_UL_XPos,y ;store offscreen value for left side NoOfs2: ldx <ObjectOffset ;get object offset and leave rts ;------------------------------------------------------------------------------------- ;$06 - second object's offset ;$07 - counter PlayerCollisionCore: ldx #$00 ;initialize X to use player's bounding box for comparison SprObjectCollisionCore: sty <$06 ;save contents of Y here lda #$01 sta <$07 ;save value 1 here as counter, compare horizontal coordinates first CollisionCoreLoop: lda BoundingBox_UL_Corner,y ;compare left/top coordinates cmp BoundingBox_UL_Corner,x ;of first and second objects' bounding boxes bcs FirstBoxGreater ;if first left/top => second, branch cmp BoundingBox_LR_Corner,x ;otherwise compare to right/bottom of second bcc SecondBoxVerticalChk ;if first left/top < second right/bottom, branch elsewhere beq CollisionFound ;if somehow equal, collision, thus branch lda BoundingBox_LR_Corner,y ;if somehow greater, check to see if bottom of cmp BoundingBox_UL_Corner,y ;first object's bounding box is greater than its top bcc CollisionFound ;if somehow less, vertical wrap collision, thus branch cmp BoundingBox_UL_Corner,x ;otherwise compare bottom of first bounding box to the top bcs CollisionFound ;of second box, and if equal or greater, collision, thus branch ldy <$06 ;otherwise return with carry clear and Y = $0006 rts ;note horizontal wrapping never occurs SecondBoxVerticalChk: lda BoundingBox_LR_Corner,x ;check to see if the vertical bottom of the box cmp BoundingBox_UL_Corner,x ;is greater than the vertical top bcc CollisionFound ;if somehow less, vertical wrap collision, thus branch lda BoundingBox_LR_Corner,y ;otherwise compare horizontal right or vertical bottom cmp BoundingBox_UL_Corner,x ;of first box with horizontal left or vertical top of second box bcs CollisionFound ;if equal or greater, collision, thus branch ldy <$06 ;otherwise return with carry clear and Y = $0006 rts FirstBoxGreater: cmp BoundingBox_UL_Corner,x ;compare first and second box horizontal left/vertical top again beq CollisionFound ;if first coordinate = second, collision, thus branch cmp BoundingBox_LR_Corner,x ;if not, compare with second object right or bottom edge bcc CollisionFound ;if left/top of first less than or equal to right/bottom of second beq CollisionFound ;then collision, thus branch cmp BoundingBox_LR_Corner,y ;otherwise check to see if top of first box is greater than bottom bcc NoCollisionFound ;if less than or equal, no collision, branch to end beq NoCollisionFound lda BoundingBox_LR_Corner,y ;otherwise compare bottom of first to top of second cmp BoundingBox_UL_Corner,x ;if bottom of first is greater than top of second, vertical wrap bcs CollisionFound ;collision, and branch, otherwise, proceed onwards here NoCollisionFound: clc ;clear carry, then load value set earlier, then leave ldy <$06 ;like previous ones, if horizontal coordinates do not collide, we do rts ;not bother checking vertical ones, because what's the point? CollisionFound: inx ;increment offsets on both objects to check iny ;the vertical coordinates dec <$07 ;decrement counter to reflect this bpl CollisionCoreLoop ;if counter not expired, branch to loop sec ;otherwise we already did both sets, therefore collision, so set carry ldy <$06 ;load original value set here earlier, then leave rts ;------------------------------------------------------------------------------------- ;$02 - modified y coordinate ;$03 - stores metatile involved in block buffer collisions ;$04 - comes in with offset to block buffer adder data, goes out with low nybble x/y coordinate ;$05 - modified x coordinate ;$06-$07 - block buffer address BlockBufferChk_Enemy: pha ;save contents of A to stack txa clc ;add 1 to X to run sub with enemy offset in mind adc #$01 tax pla ;pull A from stack and jump elsewhere jmp BBChk_E ResidualMiscObjectCode: txa clc ;supposedly used once to set offset for adc #$0d ;miscellaneous objects tax ldy #$1b ;supposedly used once to set offset for block buffer data jmp ResJmpM ;probably used in early stages to do misc to bg collision detection BlockBufferChk_FBall: ldy #$1a ;set offset for block buffer adder data txa clc adc #$07 ;add seven bytes to use tax ResJmpM: lda #$00 ;set A to return vertical coordinate BBChk_E: jsr BlockBufferCollision ;do collision detection subroutine for sprite object ldx <ObjectOffset ;get object offset cmp #$00 ;check to see if object bumped into anything rts BlockBufferAdderData: .db $00, $07, $0e BlockBuffer_X_Adder: .db $08, $03, $0c, $02, $02, $0d, $0d, $08 .db $03, $0c, $02, $02, $0d, $0d, $08, $03 .db $0c, $02, $02, $0d, $0d, $08, $00, $10 .db $04, $14, $04, $04 BlockBuffer_Y_Adder: .db $04, $20, $20, $08, $18, $08, $18, $02 .db $20, $20, $08, $18, $08, $18, $12, $20 .db $20, $18, $18, $18, $18, $18, $14, $14 .db $06, $06, $08, $10 BlockBufferColli_Feet: iny ;if branched here, increment to next set of adders BlockBufferColli_Head: lda #$00 ;set flag to return vertical coordinate .db $2c ;BIT instruction opcode BlockBufferColli_Side: lda #$01 ;set flag to return horizontal coordinate ldx #$00 ;set offset for player object BlockBufferCollision: pha ;save contents of A to stack sty <$04 ;save contents of Y here lda BlockBuffer_X_Adder,y ;add horizontal coordinate clc ;of object to value obtained using Y as offset adc <SprObject_X_Position,x sta <$05 ;store here lda <SprObject_PageLoc,x adc #$00 ;add carry to page location and #$01 ;get LSB, mask out all other bits lsr a ;move to carry ora <$05 ;get stored value ror a ;rotate carry to MSB of A lsr a ;and effectively move high nybble to lsr a ;lower, LSB which became MSB will be lsr a ;d4 at this point jsr GetBlockBufferAddr ;get address of block buffer into $06, $07 ldy <$04 ;get old contents of Y lda <SprObject_Y_Position,x ;get vertical coordinate of object clc adc BlockBuffer_Y_Adder,y ;add it to value obtained using Y as offset and #%11110000 ;mask out low nybble sec sbc #$20 ;subtract 32 pixels for the status bar sta <$02 ;store result here tay ;use as offset for block buffer lda [$06],y ;check current content of block buffer sta <$03 ;and store here ldy <$04 ;get old contents of Y again pla ;pull A from stack bne RetXC ;if A = 1, branch lda <SprObject_Y_Position,x ;if A = 0, load vertical coordinate jmp RetYC ;and jump RetXC: lda <SprObject_X_Position,x ;otherwise load horizontal coordinate RetYC: and #%00001111 ;and mask out high nybble sta <$04 ;store masked out result here lda <$03 ;get saved content of block buffer rts ;and leave ;------------------------------------------------------------------------------------- ;unused byte .db $ff ;------------------------------------------------------------------------------------- ;$00 - offset to vine Y coordinate adder ;$02 - offset to sprite data VineYPosAdder: .db $00, $30 DrawVine: sty <$00 ;save offset here lda Enemy_Rel_YPos ;get relative vertical coordinate clc adc VineYPosAdder,y ;add value using offset in Y to get value ldx VineObjOffset,y ;get offset to vine ldy Enemy_SprDataOffset,x ;get sprite data offset sty <$02 ;store sprite data offset here jsr SixSpriteStacker ;stack six sprites on top of each other vertically lda Enemy_Rel_XPos ;get relative horizontal coordinate sta Sprite_X_Position,y ;store in first, third and fifth sprites sta Sprite_X_Position+8,y sta Sprite_X_Position+16,y clc adc #$06 ;add six pixels to second, fourth and sixth sprites sta Sprite_X_Position+4,y ;to give characteristic staggered vine shape to sta Sprite_X_Position+12,y ;our vertical stack of sprites sta Sprite_X_Position+20,y lda #%00100001 ;set bg priority and palette attribute bits sta Sprite_Attributes,y ;set in first, third and fifth sprites sta Sprite_Attributes+8,y sta Sprite_Attributes+16,y ora #%01000000 ;additionally, set horizontal flip bit sta Sprite_Attributes+4,y ;for second, fourth and sixth sprites sta Sprite_Attributes+12,y sta Sprite_Attributes+20,y ldx #$05 ;set tiles for six sprites VineTL: lda #$e1 ;set tile number for sprite sta Sprite_Tilenumber,y iny ;move offset to next sprite data iny iny iny dex ;move onto next sprite bpl VineTL ;loop until all sprites are done ldy <$02 ;get original offset lda <$00 ;get offset to vine adding data bne SkpVTop ;if offset not zero, skip this part lda #$e0 sta Sprite_Tilenumber,y ;set other tile number for top of vine SkpVTop: ldx #$00 ;start with the first sprite again ChkFTop: lda VineStart_Y_Position ;get original starting vertical coordinate sec sbc Sprite_Y_Position,y ;subtract top-most sprite's Y coordinate cmp #$64 ;if two coordinates are less than 100/$64 pixels bcc NextVSp ;apart, skip this to leave sprite alone lda #$f8 sta Sprite_Y_Position,y ;otherwise move sprite offscreen NextVSp: iny ;move offset to next OAM data iny iny iny inx ;move onto next sprite cpx #$06 ;do this until all sprites are checked bne ChkFTop ldy <$00 ;return offset set earlier rts SixSpriteStacker: ldx #$06 ;do six sprites StkLp: sta Sprite_Data,y ;store X or Y coordinate into OAM data clc adc #$08 ;add eight pixels iny iny ;move offset four bytes forward iny iny dex ;do another sprite bne StkLp ;do this until all sprites are done ldy <$02 ;get saved OAM data offset and leave rts ;------------------------------------------------------------------------------------- FirstSprXPos: .db $04, $00, $04, $00 FirstSprYPos: .db $00, $04, $00, $04 SecondSprXPos: .db $00, $08, $00, $08 SecondSprYPos: .db $08, $00, $08, $00 FirstSprTilenum: .db $80, $82, $81, $83 SecondSprTilenum: .db $81, $83, $80, $82 HammerSprAttrib: .db $03, $03, $c3, $c3 DrawHammer: ldy Misc_SprDataOffset,x ;get misc object OAM data offset lda TimerControl bne ForceHPose ;if master timer control set, skip this part lda <Misc_State,x ;otherwise get hammer's state and #%01111111 ;mask out d7 cmp #$01 ;check to see if set to 1 yet beq GetHPose ;if so, branch ForceHPose: ldx #$00 ;reset offset here beq RenderH ;do unconditional branch to rendering part GetHPose: lda <FrameCounter ;get frame counter lsr a ;move d3-d2 to d1-d0 lsr a and #%00000011 ;mask out all but d1-d0 (changes every four frames) tax ;use as timing offset RenderH: lda Misc_Rel_YPos ;get relative vertical coordinate clc adc FirstSprYPos,x ;add first sprite vertical adder based on offset sta Sprite_Y_Position,y ;store as sprite Y coordinate for first sprite clc adc SecondSprYPos,x ;add second sprite vertical adder based on offset sta Sprite_Y_Position+4,y ;store as sprite Y coordinate for second sprite lda Misc_Rel_XPos ;get relative horizontal coordinate clc adc FirstSprXPos,x ;add first sprite horizontal adder based on offset sta Sprite_X_Position,y ;store as sprite X coordinate for first sprite clc adc SecondSprXPos,x ;add second sprite horizontal adder based on offset sta Sprite_X_Position+4,y ;store as sprite X coordinate for second sprite lda FirstSprTilenum,x sta Sprite_Tilenumber,y ;get and store tile number of first sprite lda SecondSprTilenum,x sta Sprite_Tilenumber+4,y ;get and store tile number of second sprite lda HammerSprAttrib,x sta Sprite_Attributes,y ;get and store attribute bytes for both sta Sprite_Attributes+4,y ;note in this case they use the same data ldx <ObjectOffset ;get misc object offset lda Misc_OffscreenBits and #%11111100 ;check offscreen bits beq NoHOffscr ;if all bits clear, leave object alone lda #$00 sta <Misc_State,x ;otherwise nullify misc object state lda #$f8 jsr DumpTwoSpr ;do sub to move hammer sprites offscreen NoHOffscr: rts ;leave ;------------------------------------------------------------------------------------- ;$00-$01 - used to hold tile numbers ($01 addressed in draw floatey number part) ;$02 - used to hold Y coordinate for floatey number ;$03 - residual byte used for flip (but value set here affects nothing) ;$04 - attribute byte for floatey number ;$05 - used as X coordinate for floatey number FlagpoleScoreNumTiles: .db $f9, $50 .db $f7, $50 .db $fa, $fb .db $f8, $fb .db $f6, $fb FlagpoleGfxHandler: ldy Enemy_SprDataOffset,x ;get sprite data offset for flagpole flag lda Enemy_Rel_XPos ;get relative horizontal coordinate sta Sprite_X_Position,y ;store as X coordinate for first sprite clc adc #$08 ;add eight pixels and store sta Sprite_X_Position+4,y ;as X coordinate for second and third sprites sta Sprite_X_Position+8,y clc adc #$0c ;add twelve more pixels and sta <$05 ;store here to be used later by floatey number lda <Enemy_Y_Position,x ;get vertical coordinate jsr DumpTwoSpr ;and do sub to dump into first and second sprites adc #$08 ;add eight pixels sta Sprite_Y_Position+8,y ;and store into third sprite lda FlagpoleFNum_Y_Pos ;get vertical coordinate for floatey number sta <$02 ;store it here lda #$01 sta <$03 ;set value for flip which will not be used, and sta <$04 ;attribute byte for floatey number sta Sprite_Attributes,y ;set attribute bytes for all three sprites sta Sprite_Attributes+4,y sta Sprite_Attributes+8,y lda #$7e sta Sprite_Tilenumber,y ;put triangle shaped tile sta Sprite_Tilenumber+8,y ;into first and third sprites lda #$7f sta Sprite_Tilenumber+4,y ;put skull tile into second sprite lda FlagpoleCollisionYPos ;get vertical coordinate at time of collision beq ChkFlagOffscreen ;if zero, branch ahead tya clc ;add 12 bytes to sprite data offset adc #$0c tay ;put back in Y lda FlagpoleScore ;get offset used to award points for touching flagpole asl a ;multiply by 2 to get proper offset here tax lda FlagpoleScoreNumTiles,x ;get appropriate tile data sta <$00 lda FlagpoleScoreNumTiles+1,x jsr DrawOneSpriteRow ;use it to render floatey number ChkFlagOffscreen: ldx <ObjectOffset ;get object offset for flag ldy Enemy_SprDataOffset,x ;get OAM data offset lda Enemy_OffscreenBits ;get offscreen bits and #%00001110 ;mask out all but d3-d1 beq ExitDumpSpr ;if none of these bits set, branch to leave ;------------------------------------------------------------------------------------- MoveSixSpritesOffscreen: lda #$f8 ;set offscreen coordinate if jumping here DumpSixSpr: sta Sprite_Data+20,y ;dump A contents sta Sprite_Data+16,y ;into third row sprites DumpFourSpr: sta Sprite_Data+12,y ;into second row sprites DumpThreeSpr: sta Sprite_Data+8,y DumpTwoSpr: sta Sprite_Data+4,y ;and into first row sprites sta Sprite_Data,y ExitDumpSpr: rts ;------------------------------------------------------------------------------------- DrawLargePlatform: ldy Enemy_SprDataOffset,x ;get OAM data offset sty <$02 ;store here iny ;add 3 to it for offset iny ;to X coordinate iny lda Enemy_Rel_XPos ;get horizontal relative coordinate jsr SixSpriteStacker ;store X coordinates using A as base, stack horizontally ldx <ObjectOffset lda <Enemy_Y_Position,x ;get vertical coordinate jsr DumpFourSpr ;dump into first four sprites as Y coordinate ldy AreaType cpy #$03 ;check for castle-type level beq ShrinkPlatform ldy SecondaryHardMode ;check for secondary hard mode flag set beq SetLast2Platform ;branch if not set elsewhere ShrinkPlatform: lda #$f8 ;load offscreen coordinate if flag set or castle-type level SetLast2Platform: ldy Enemy_SprDataOffset,x ;get OAM data offset sta Sprite_Y_Position+16,y ;store vertical coordinate or offscreen sta Sprite_Y_Position+20,y ;coordinate into last two sprites as Y coordinate lda #$5b ;load default tile for platform (girder) ldx CloudTypeOverride beq SetPlatformTilenum ;if cloud level override flag not set, use lda #$75 ;otherwise load other tile for platform (puff) SetPlatformTilenum: ldx <ObjectOffset ;get enemy object buffer offset iny ;increment Y for tile offset jsr DumpSixSpr ;dump tile number into all six sprites lda #$02 ;set palette controls iny ;increment Y for sprite attributes jsr DumpSixSpr ;dump attributes into all six sprites inx ;increment X for enemy objects jsr GetXOffscreenBits ;get offscreen bits again dex ldy Enemy_SprDataOffset,x ;get OAM data offset asl a ;rotate d7 into carry, save remaining pha ;bits to the stack bcc SChk2 lda #$f8 ;if d7 was set, move first sprite offscreen sta Sprite_Y_Position,y SChk2: pla ;get bits from stack asl a ;rotate d6 into carry pha ;save to stack bcc SChk3 lda #$f8 ;if d6 was set, move second sprite offscreen sta Sprite_Y_Position+4,y SChk3: pla ;get bits from stack asl a ;rotate d5 into carry pha ;save to stack bcc SChk4 lda #$f8 ;if d5 was set, move third sprite offscreen sta Sprite_Y_Position+8,y SChk4: pla ;get bits from stack asl a ;rotate d4 into carry pha ;save to stack bcc SChk5 lda #$f8 ;if d4 was set, move fourth sprite offscreen sta Sprite_Y_Position+12,y SChk5: pla ;get bits from stack asl a ;rotate d3 into carry pha ;save to stack bcc SChk6 lda #$f8 ;if d3 was set, move fifth sprite offscreen sta Sprite_Y_Position+16,y SChk6: pla ;get bits from stack asl a ;rotate d2 into carry bcc SLChk ;save to stack lda #$f8 sta Sprite_Y_Position+20,y ;if d2 was set, move sixth sprite offscreen SLChk: lda Enemy_OffscreenBits ;check d7 of offscreen bits asl a ;and if d7 is not set, skip sub bcc ExDLPl jsr MoveSixSpritesOffscreen ;otherwise branch to move all sprites offscreen ExDLPl: rts ;------------------------------------------------------------------------------------- DrawFloateyNumber_Coin: lda <FrameCounter ;get frame counter lsr a ;divide by 2 bcs NotRsNum ;branch if d0 not set to raise number every other frame dec <Misc_Y_Position,x ;otherwise, decrement vertical coordinate NotRsNum: lda <Misc_Y_Position,x ;get vertical coordinate jsr DumpTwoSpr ;dump into both sprites lda Misc_Rel_XPos ;get relative horizontal coordinate sta Sprite_X_Position,y ;store as X coordinate for first sprite clc adc #$08 ;add eight pixels sta Sprite_X_Position+4,y ;store as X coordinate for second sprite lda #$02 sta Sprite_Attributes,y ;store attribute byte in both sprites sta Sprite_Attributes+4,y lda #$f7 sta Sprite_Tilenumber,y ;put tile numbers into both sprites lda #$fb ;that resemble "200" sta Sprite_Tilenumber+4,y jmp ExJCGfx ;then jump to leave (why not an rts here instead?) JumpingCoinTiles: .db $60, $61, $62, $63 JCoinGfxHandler: ldy Misc_SprDataOffset,x ;get coin/floatey number's OAM data offset lda <Misc_State,x ;get state of misc object cmp #$02 ;if 2 or greater, bcs DrawFloateyNumber_Coin ;branch to draw floatey number lda <Misc_Y_Position,x ;store vertical coordinate as sta Sprite_Y_Position,y ;Y coordinate for first sprite clc adc #$08 ;add eight pixels sta Sprite_Y_Position+4,y ;store as Y coordinate for second sprite lda Misc_Rel_XPos ;get relative horizontal coordinate sta Sprite_X_Position,y sta Sprite_X_Position+4,y ;store as X coordinate for first and second sprites lda <FrameCounter ;get frame counter lsr a ;divide by 2 to alter every other frame and #%00000011 ;mask out d2-d1 tax ;use as graphical offset lda JumpingCoinTiles,x ;load tile number iny ;increment OAM data offset to write tile numbers jsr DumpTwoSpr ;do sub to dump tile number into both sprites dey ;decrement to get old offset lda #$02 sta Sprite_Attributes,y ;set attribute byte in first sprite lda #$82 sta Sprite_Attributes+4,y ;set attribute byte with vertical flip in second sprite ldx <ObjectOffset ;get misc object offset ExJCGfx: rts ;leave ;------------------------------------------------------------------------------------- ;$00-$01 - used to hold tiles for drawing the power-up, $00 also used to hold power-up type ;$02 - used to hold bottom row Y position ;$03 - used to hold flip control (not used here) ;$04 - used to hold sprite attributes ;$05 - used to hold X position ;$07 - counter ;tiles arranged in top left, right, bottom left, right order PowerUpGfxTable: .db $76, $77, $78, $79 ;regular mushroom .db $d6, $d6, $d9, $d9 ;fire flower .db $8d, $8d, $e4, $e4 ;star .db $76, $77, $78, $79 ;1-up mushroom PowerUpAttributes: .db $02, $01, $02, $01 DrawPowerUp: ldy Enemy_SprDataOffset+5 ;get power-up's sprite data offset lda Enemy_Rel_YPos ;get relative vertical coordinate clc adc #$08 ;add eight pixels sta <$02 ;store result here lda Enemy_Rel_XPos ;get relative horizontal coordinate sta <$05 ;store here ldx <PowerUpType ;get power-up type lda PowerUpAttributes,x ;get attribute data for power-up type ora Enemy_SprAttrib+5 ;add background priority bit if set sta <$04 ;store attributes here txa pha ;save power-up type to the stack asl a asl a ;multiply by four to get proper offset tax ;use as X lda #$01 sta <$07 ;set counter here to draw two rows of sprite object sta <$03 ;init d1 of flip control PUpDrawLoop: lda PowerUpGfxTable,x ;load left tile of power-up object sta <$00 lda PowerUpGfxTable+1,x ;load right tile jsr DrawOneSpriteRow ;branch to draw one row of our power-up object dec <$07 ;decrement counter bpl PUpDrawLoop ;branch until two rows are drawn ldy Enemy_SprDataOffset+5 ;get sprite data offset again pla ;pull saved power-up type from the stack beq PUpOfs ;if regular mushroom, branch, do not change colors or flip cmp #$03 beq PUpOfs ;if 1-up mushroom, branch, do not change colors or flip sta <$00 ;store power-up type here now lda <FrameCounter ;get frame counter lsr a ;divide by 2 to change colors every two frames and #%00000011 ;mask out all but d1 and d0 (previously d2 and d1) ora Enemy_SprAttrib+5 ;add background priority bit if any set sta Sprite_Attributes,y ;set as new palette bits for top left and sta Sprite_Attributes+4,y ;top right sprites for fire flower and star ldx <$00 dex ;check power-up type for fire flower beq FlipPUpRightSide ;if found, skip this part sta Sprite_Attributes+8,y ;otherwise set new palette bits for bottom left sta Sprite_Attributes+12,y ;and bottom right sprites as well for star only FlipPUpRightSide: lda Sprite_Attributes+4,y ora #%01000000 ;set horizontal flip bit for top right sprite sta Sprite_Attributes+4,y lda Sprite_Attributes+12,y ora #%01000000 ;set horizontal flip bit for bottom right sprite sta Sprite_Attributes+12,y ;note these are only done for fire flower and star power-ups PUpOfs: jmp SprObjectOffscrChk ;jump to check to see if power-up is offscreen at all, then leave ;------------------------------------------------------------------------------------- ;$00-$01 - used in DrawEnemyObjRow to hold sprite tile numbers ;$02 - used to store Y position ;$03 - used to store moving direction, used to flip enemies horizontally ;$04 - used to store enemy's sprite attributes ;$05 - used to store X position ;$eb - used to hold sprite data offset ;$ec - used to hold either altered enemy state or special value used in gfx handler as condition ;$ed - used to hold enemy state from buffer ;$ef - used to hold enemy code used in gfx handler (may or may not resemble Enemy_ID values) ;tiles arranged in top left, right, middle left, right, bottom left, right order EnemyGraphicsTable: .db $fc, $fc, $aa, $ab, $ac, $ad ;buzzy beetle frame 1 .db $fc, $fc, $ae, $af, $b0, $b1 ; frame 2 .db $fc, $a5, $a6, $a7, $a8, $a9 ;koopa troopa frame 1 .db $fc, $a0, $a1, $a2, $a3, $a4 ; frame 2 .db $69, $a5, $6a, $a7, $a8, $a9 ;koopa paratroopa frame 1 .db $6b, $a0, $6c, $a2, $a3, $a4 ; frame 2 .db $fc, $fc, $96, $97, $98, $99 ;spiny frame 1 .db $fc, $fc, $9a, $9b, $9c, $9d ; frame 2 .db $fc, $fc, $8f, $8e, $8e, $8f ;spiny's egg frame 1 .db $fc, $fc, $95, $94, $94, $95 ; frame 2 .db $fc, $fc, $dc, $dc, $df, $df ;bloober frame 1 .db $dc, $dc, $dd, $dd, $de, $de ; frame 2 .db $fc, $fc, $b2, $b3, $b4, $b5 ;cheep-cheep frame 1 .db $fc, $fc, $b6, $b3, $b7, $b5 ; frame 2 .db $fc, $fc, $70, $71, $72, $73 ;goomba .db $fc, $fc, $6e, $6e, $6f, $6f ;koopa shell frame 1 (upside-down) .db $fc, $fc, $6d, $6d, $6f, $6f ; frame 2 .db $fc, $fc, $6f, $6f, $6e, $6e ;koopa shell frame 1 (rightsideup) .db $fc, $fc, $6f, $6f, $6d, $6d ; frame 2 .db $fc, $fc, $f4, $f4, $f5, $f5 ;buzzy beetle shell frame 1 (rightsideup) .db $fc, $fc, $f4, $f4, $f5, $f5 ; frame 2 .db $fc, $fc, $f5, $f5, $f4, $f4 ;buzzy beetle shell frame 1 (upside-down) .db $fc, $fc, $f5, $f5, $f4, $f4 ; frame 2 .db $fc, $fc, $fc, $fc, $ef, $ef ;defeated goomba .db $b9, $b8, $bb, $ba, $bc, $bc ;lakitu frame 1 .db $fc, $fc, $bd, $bd, $bc, $bc ; frame 2 .db $7a, $7b, $da, $db, $d8, $d8 ;princess .db $cd, $cd, $ce, $ce, $cf, $cf ;mushroom retainer .db $7d, $7c, $d1, $8c, $d3, $d2 ;hammer bro frame 1 .db $7d, $7c, $89, $88, $8b, $8a ; frame 2 .db $d5, $d4, $e3, $e2, $d3, $d2 ; frame 3 .db $d5, $d4, $e3, $e2, $8b, $8a ; frame 4 .db $e5, $e5, $e6, $e6, $eb, $eb ;piranha plant frame 1 .db $ec, $ec, $ed, $ed, $ee, $ee ; frame 2 .db $fc, $fc, $d0, $d0, $d7, $d7 ;podoboo .db $bf, $be, $c1, $c0, $c2, $fc ;bowser front frame 1 .db $c4, $c3, $c6, $c5, $c8, $c7 ;bowser rear frame 1 .db $bf, $be, $ca, $c9, $c2, $fc ; front frame 2 .db $c4, $c3, $c6, $c5, $cc, $cb ; rear frame 2 .db $fc, $fc, $e8, $e7, $ea, $e9 ;bullet bill .db $f2, $f2, $f3, $f3, $f2, $f2 ;jumpspring frame 1 .db $f1, $f1, $f1, $f1, $fc, $fc ; frame 2 .db $f0, $f0, $fc, $fc, $fc, $fc ; frame 3 EnemyGfxTableOffsets: .db $0c, $0c, $00, $0c, $0c, $a8, $54, $3c .db $ea, $18, $48, $48, $cc, $c0, $18, $18 .db $18, $90, $24, $ff, $48, $9c, $d2, $d8 .db $f0, $f6, $fc EnemyAttributeData: .db $01, $02, $03, $02, $01, $01, $03, $03 .db $03, $01, $01, $02, $02, $21, $01, $02 .db $01, $01, $02, $ff, $02, $02, $01, $01 .db $02, $02, $02 EnemyAnimTimingBMask: .db $08, $18 JumpspringFrameOffsets: .db $18, $19, $1a, $19, $18 EnemyGfxHandler: lda <Enemy_Y_Position,x ;get enemy object vertical position sta <$02 lda Enemy_Rel_XPos ;get enemy object horizontal position sta <$05 ;relative to screen ldy Enemy_SprDataOffset,x sty <$eb ;get sprite data offset lda #$00 sta VerticalFlipFlag ;initialize vertical flip flag by default lda <Enemy_MovingDir,x sta <$03 ;get enemy object moving direction lda Enemy_SprAttrib,x sta <$04 ;get enemy object sprite attributes lda <Enemy_ID,x cmp #PiranhaPlant ;is enemy object piranha plant? bne CheckForRetainerObj ;if not, branch ldy <PiranhaPlant_Y_Speed,x bmi CheckForRetainerObj ;if piranha plant moving upwards, branch ldy EnemyFrameTimer,x beq CheckForRetainerObj ;if timer for movement expired, branch rts ;if all conditions fail, leave CheckForRetainerObj: lda <Enemy_State,x ;store enemy state sta <$ed and #%00011111 ;nullify all but 5 LSB and use as Y tay lda <Enemy_ID,x ;check for mushroom retainer/princess object cmp #RetainerObject bne CheckForBulletBillCV ;if not found, branch ldy #$00 ;if found, nullify saved state in Y lda #$01 ;set value that will not be used sta <$03 lda #$15 ;set value $15 as code for mushroom retainer/princess object CheckForBulletBillCV: cmp #BulletBill_CannonVar ;otherwise check for bullet bill object bne CheckForJumpspring ;if not found, branch again dec <$02 ;decrement saved vertical position lda #$03 ldy EnemyFrameTimer,x ;get timer for enemy object beq SBBAt ;if expired, do not set priority bit ora #%00100000 ;otherwise do so SBBAt: sta <$04 ;set new sprite attributes ldy #$00 ;nullify saved enemy state both in Y and in sty <$ed ;memory location here lda #$08 ;set specific value to unconditionally branch once CheckForJumpspring: cmp #JumpspringObject ;check for jumpspring object bne CheckForPodoboo ldy #$03 ;set enemy state -2 MSB here for jumpspring object ldx JumpspringAnimCtrl ;get current frame number for jumpspring object lda JumpspringFrameOffsets,x ;load data using frame number as offset CheckForPodoboo: sta <$ef ;store saved enemy object value here sty <$ec ;and Y here (enemy state -2 MSB if not changed) ldx <ObjectOffset ;get enemy object offset cmp #$0c ;check for podoboo object bne CheckBowserGfxFlag ;branch if not found lda <Enemy_Y_Speed,x ;if moving upwards, branch bmi CheckBowserGfxFlag inc VerticalFlipFlag ;otherwise, set flag for vertical flip CheckBowserGfxFlag: lda BowserGfxFlag ;if not drawing bowser at all, skip to something else beq CheckForGoomba ldy #$16 ;if set to 1, draw bowser's front cmp #$01 beq SBwsrGfxOfs iny ;otherwise draw bowser's rear SBwsrGfxOfs: sty <$ef CheckForGoomba: ldy <$ef ;check value for goomba object cpy #Goomba bne CheckBowserFront ;branch if not found lda <Enemy_State,x cmp #$02 ;check for defeated state bcc GmbaAnim ;if not defeated, go ahead and animate ldx #$04 ;if defeated, write new value here stx <$ec GmbaAnim: and #%00100000 ;check for d5 set in enemy object state ora TimerControl ;or timer disable flag set bne CheckBowserFront ;if either condition true, do not animate goomba lda <FrameCounter and #%00001000 ;check for every eighth frame bne CheckBowserFront lda <$03 eor #%00000011 ;invert bits to flip horizontally every eight frames sta <$03 ;leave alone otherwise CheckBowserFront: lda EnemyAttributeData,y ;load sprite attribute using enemy object ora <$04 ;as offset, and add to bits already loaded sta <$04 lda EnemyGfxTableOffsets,y ;load value based on enemy object as offset tax ;save as X ldy <$ec ;get previously saved value lda BowserGfxFlag beq CheckForSpiny ;if not drawing bowser object at all, skip all of this cmp #$01 bne CheckBowserRear ;if not drawing front part, branch to draw the rear part lda BowserBodyControls ;check bowser's body control bits bpl ChkFrontSte ;branch if d7 not set (control's bowser's mouth) ldx #$de ;otherwise load offset for second frame ChkFrontSte: lda <$ed ;check saved enemy state and #%00100000 ;if bowser not defeated, do not set flag beq DrawBowser FlipBowserOver: stx VerticalFlipFlag ;set vertical flip flag to nonzero DrawBowser: jmp DrawEnemyObject ;draw bowser's graphics now CheckBowserRear: lda BowserBodyControls ;check bowser's body control bits and #$01 beq ChkRearSte ;branch if d0 not set (control's bowser's feet) ldx #$e4 ;otherwise load offset for second frame ChkRearSte: lda <$ed ;check saved enemy state and #%00100000 ;if bowser not defeated, do not set flag beq DrawBowser lda <$02 ;subtract 16 pixels from sec ;saved vertical coordinate sbc #$10 sta <$02 jmp FlipBowserOver ;jump to set vertical flip flag CheckForSpiny: cpx #$24 ;check if value loaded is for spiny bne CheckForLakitu ;if not found, branch cpy #$05 ;if enemy state set to $05, do this, bne NotEgg ;otherwise branch ldx #$30 ;set to spiny egg offset lda #$02 sta <$03 ;set enemy direction to reverse sprites horizontally lda #$05 sta <$ec ;set enemy state NotEgg: jmp CheckForHammerBro ;skip a big chunk of this if we found spiny but not in egg CheckForLakitu: cpx #$90 ;check value for lakitu's offset loaded bne CheckUpsideDownShell ;branch if not loaded lda <$ed and #%00100000 ;check for d5 set in enemy state bne NoLAFr ;branch if set lda FrenzyEnemyTimer cmp #$10 ;check timer to see if we've reached a certain range bcs NoLAFr ;branch if not ldx #$96 ;if d6 not set and timer in range, load alt frame for lakitu NoLAFr: jmp CheckDefeatedState ;skip this next part if we found lakitu but alt frame not needed CheckUpsideDownShell: lda <$ef ;check for enemy object => $04 cmp #$04 bcs CheckRightSideUpShell ;branch if true cpy #$02 bcc CheckRightSideUpShell ;branch if enemy state < $02 ldx #$5a ;set for upside-down koopa shell by default ldy <$ef cpy #BuzzyBeetle ;check for buzzy beetle object bne CheckRightSideUpShell ldx #$7e ;set for upside-down buzzy beetle shell if found inc <$02 ;increment vertical position by one pixel CheckRightSideUpShell: lda <$ec ;check for value set here cmp #$04 ;if enemy state < $02, do not change to shell, if bne CheckForHammerBro ;enemy state => $02 but not = $04, leave shell upside-down ldx #$72 ;set right-side up buzzy beetle shell by default inc <$02 ;increment saved vertical position by one pixel ldy <$ef cpy #BuzzyBeetle ;check for buzzy beetle object beq CheckForDefdGoomba ;branch if found ldx #$66 ;change to right-side up koopa shell if not found inc <$02 ;and increment saved vertical position again CheckForDefdGoomba: cpy #Goomba ;check for goomba object (necessary if previously bne CheckForHammerBro ;failed buzzy beetle object test) ldx #$54 ;load for regular goomba lda <$ed ;note that this only gets performed if enemy state => $02 and #%00100000 ;check saved enemy state for d5 set bne CheckForHammerBro ;branch if set ldx #$8a ;load offset for defeated goomba dec <$02 ;set different value and decrement saved vertical position CheckForHammerBro: ldy <ObjectOffset lda <$ef ;check for hammer bro object cmp #HammerBro bne CheckForBloober ;branch if not found lda <$ed beq CheckToAnimateEnemy ;branch if not in normal enemy state and #%00001000 beq CheckDefeatedState ;if d3 not set, branch further away ldx #$b4 ;otherwise load offset for different frame bne CheckToAnimateEnemy ;unconditional branch CheckForBloober: cpx #$48 ;check for cheep-cheep offset loaded beq CheckToAnimateEnemy ;branch if found lda EnemyIntervalTimer,y cmp #$05 bcs CheckDefeatedState ;branch if some timer is above a certain point cpx #$3c ;check for bloober offset loaded bne CheckToAnimateEnemy ;branch if not found this time cmp #$01 beq CheckDefeatedState ;branch if timer is set to certain point inc <$02 ;increment saved vertical coordinate three pixels inc <$02 inc <$02 jmp CheckAnimationStop ;and do something else CheckToAnimateEnemy: lda <$ef ;check for specific enemy objects cmp #Goomba beq CheckDefeatedState ;branch if goomba cmp #$08 beq CheckDefeatedState ;branch if bullet bill (note both variants use $08 here) cmp #Podoboo beq CheckDefeatedState ;branch if podoboo cmp #$18 ;branch if => $18 bcs CheckDefeatedState ldy #$00 cmp #$15 ;check for mushroom retainer/princess object bne CheckForSecondFrame ;which uses different code here, branch if not found iny ;residual instruction lda WorldNumber ;are we on world 8? cmp #World8 bcs CheckDefeatedState ;if so, leave the offset alone (use princess) ldx #$a2 ;otherwise, set for mushroom retainer object instead lda #$03 ;set alternate state here sta <$ec bne CheckDefeatedState ;unconditional branch CheckForSecondFrame: lda <FrameCounter ;load frame counter and EnemyAnimTimingBMask,y ;mask it (partly residual, one byte not ever used) bne CheckDefeatedState ;branch if timing is off CheckAnimationStop: lda <$ed ;check saved enemy state and #%10100000 ;for d7 or d5, or check for timers stopped ora TimerControl bne CheckDefeatedState ;if either condition true, branch txa clc adc #$06 ;add $06 to current enemy offset tax ;to animate various enemy objects CheckDefeatedState: lda <$ed ;check saved enemy state and #%00100000 ;for d5 set beq DrawEnemyObject ;branch if not set lda <$ef cmp #$04 ;check for saved enemy object => $04 bcc DrawEnemyObject ;branch if less ldy #$01 sty VerticalFlipFlag ;set vertical flip flag dey sty <$ec ;init saved value here DrawEnemyObject: ldy <$eb ;load sprite data offset jsr DrawEnemyObjRow ;draw six tiles of data jsr DrawEnemyObjRow ;into sprite data jsr DrawEnemyObjRow ldx <ObjectOffset ;get enemy object offset ldy Enemy_SprDataOffset,x ;get sprite data offset lda <$ef cmp #$08 ;get saved enemy object and check bne CheckForVerticalFlip ;for bullet bill, branch if not found SkipToOffScrChk: jmp SprObjectOffscrChk ;jump if found CheckForVerticalFlip: lda VerticalFlipFlag ;check if vertical flip flag is set here beq CheckForESymmetry ;branch if not lda Sprite_Attributes,y ;get attributes of first sprite we dealt with ora #%10000000 ;set bit for vertical flip iny iny ;increment two bytes so that we store the vertical flip jsr DumpSixSpr ;in attribute bytes of enemy obj sprite data dey dey ;now go back to the Y coordinate offset tya tax ;give offset to X lda <$ef cmp #HammerBro ;check saved enemy object for hammer bro beq FlipEnemyVertically cmp #Lakitu ;check saved enemy object for lakitu beq FlipEnemyVertically ;branch for hammer bro or lakitu cmp #$15 bcs FlipEnemyVertically ;also branch if enemy object => $15 txa clc adc #$08 ;if not selected objects or => $15, set tax ;offset in X for next row FlipEnemyVertically: lda Sprite_Tilenumber,x ;load first or second row tiles pha ;and save tiles to the stack lda Sprite_Tilenumber+4,x pha lda Sprite_Tilenumber+16,y ;exchange third row tiles sta Sprite_Tilenumber,x ;with first or second row tiles lda Sprite_Tilenumber+20,y sta Sprite_Tilenumber+4,x pla ;pull first or second row tiles from stack sta Sprite_Tilenumber+20,y ;and save in third row pla sta Sprite_Tilenumber+16,y CheckForESymmetry: lda BowserGfxFlag ;are we drawing bowser at all? bne SkipToOffScrChk ;branch if so lda <$ef ldx <$ec ;get alternate enemy state cmp #$05 ;check for hammer bro object bne ContES jmp SprObjectOffscrChk ;jump if found ContES: cmp #Bloober ;check for bloober object beq MirrorEnemyGfx cmp #PiranhaPlant ;check for piranha plant object beq MirrorEnemyGfx cmp #Podoboo ;check for podoboo object beq MirrorEnemyGfx ;branch if either of three are found cmp #Spiny ;check for spiny object bne ESRtnr ;branch closer if not found cpx #$05 ;check spiny's state bne CheckToMirrorLakitu ;branch if not an egg, otherwise ESRtnr: cmp #$15 ;check for princess/mushroom retainer object bne SpnySC lda #$42 ;set horizontal flip on bottom right sprite sta Sprite_Attributes+20,y ;note that palette bits were already set earlier SpnySC: cpx #$02 ;if alternate enemy state set to 1 or 0, branch bcc CheckToMirrorLakitu MirrorEnemyGfx: lda BowserGfxFlag ;if enemy object is bowser, skip all of this bne CheckToMirrorLakitu lda Sprite_Attributes,y ;load attribute bits of first sprite and #%10100011 sta Sprite_Attributes,y ;save vertical flip, priority, and palette bits sta Sprite_Attributes+8,y ;in left sprite column of enemy object OAM data sta Sprite_Attributes+16,y ora #%01000000 ;set horizontal flip cpx #$05 ;check for state used by spiny's egg bne EggExc ;if alternate state not set to $05, branch ora #%10000000 ;otherwise set vertical flip EggExc: sta Sprite_Attributes+4,y ;set bits of right sprite column sta Sprite_Attributes+12,y ;of enemy object sprite data sta Sprite_Attributes+20,y cpx #$04 ;check alternate enemy state bne CheckToMirrorLakitu ;branch if not $04 lda Sprite_Attributes+8,y ;get second row left sprite attributes ora #%10000000 sta Sprite_Attributes+8,y ;store bits with vertical flip in sta Sprite_Attributes+16,y ;second and third row left sprites ora #%01000000 sta Sprite_Attributes+12,y ;store with horizontal and vertical flip in sta Sprite_Attributes+20,y ;second and third row right sprites CheckToMirrorLakitu: lda <$ef ;check for lakitu enemy object cmp #Lakitu bne CheckToMirrorJSpring ;branch if not found lda VerticalFlipFlag bne NVFLak ;branch if vertical flip flag not set lda Sprite_Attributes+16,y ;save vertical flip and palette bits and #%10000001 ;in third row left sprite sta Sprite_Attributes+16,y lda Sprite_Attributes+20,y ;set horizontal flip and palette bits ora #%01000001 ;in third row right sprite sta Sprite_Attributes+20,y ldx FrenzyEnemyTimer ;check timer cpx #$10 bcs SprObjectOffscrChk ;branch if timer has not reached a certain range sta Sprite_Attributes+12,y ;otherwise set same for second row right sprite and #%10000001 sta Sprite_Attributes+8,y ;preserve vertical flip and palette bits for left sprite bcc SprObjectOffscrChk ;unconditional branch NVFLak: lda Sprite_Attributes,y ;get first row left sprite attributes and #%10000001 sta Sprite_Attributes,y ;save vertical flip and palette bits lda Sprite_Attributes+4,y ;get first row right sprite attributes ora #%01000001 ;set horizontal flip and palette bits sta Sprite_Attributes+4,y ;note that vertical flip is left as-is CheckToMirrorJSpring: lda <$ef ;check for jumpspring object (any frame) cmp #$18 bcc SprObjectOffscrChk ;branch if not jumpspring object at all lda #$82 sta Sprite_Attributes+8,y ;set vertical flip and palette bits of sta Sprite_Attributes+16,y ;second and third row left sprites ora #%01000000 sta Sprite_Attributes+12,y ;set, in addition to those, horizontal flip sta Sprite_Attributes+20,y ;for second and third row right sprites SprObjectOffscrChk: ldx <ObjectOffset ;get enemy buffer offset lda Enemy_OffscreenBits ;check offscreen information lsr a lsr a ;shift three times to the right lsr a ;which puts d2 into carry pha ;save to stack bcc LcChk ;branch if not set lda #$04 ;set for right column sprites jsr MoveESprColOffscreen ;and move them offscreen LcChk: pla ;get from stack lsr a ;move d3 to carry pha ;save to stack bcc Row3C ;branch if not set lda #$00 ;set for left column sprites, jsr MoveESprColOffscreen ;move them offscreen Row3C: pla ;get from stack again lsr a ;move d5 to carry this time lsr a pha ;save to stack again bcc Row23C ;branch if carry not set lda #$10 ;set for third row of sprites jsr MoveESprRowOffscreen ;and move them offscreen Row23C: pla ;get from stack lsr a ;move d6 into carry pha ;save to stack bcc AllRowC lda #$08 ;set for second and third rows jsr MoveESprRowOffscreen ;move them offscreen AllRowC: pla ;get from stack once more lsr a ;move d7 into carry bcc ExEGHandler jsr MoveESprRowOffscreen ;move all sprites offscreen (A should be 0 by now) lda <Enemy_ID,x cmp #Podoboo ;check enemy identifier for podoboo beq ExEGHandler ;skip this part if found, we do not want to erase podoboo! lda <Enemy_Y_HighPos,x ;check high byte of vertical position cmp #$02 ;if not yet past the bottom of the screen, branch bne ExEGHandler jsr EraseEnemyObject ;what it says ExEGHandler: rts DrawEnemyObjRow: lda EnemyGraphicsTable,x ;load two tiles of enemy graphics sta <$00 lda EnemyGraphicsTable+1,x DrawOneSpriteRow: sta <$01 jmp DrawSpriteObject ;draw them MoveESprRowOffscreen: clc ;add A to enemy object OAM data offset adc Enemy_SprDataOffset,x tay ;use as offset lda #$f8 jmp DumpTwoSpr ;move first row of sprites offscreen MoveESprColOffscreen: clc ;add A to enemy object OAM data offset adc Enemy_SprDataOffset,x tay ;use as offset jsr MoveColOffscreen ;move first and second row sprites in column offscreen sta Sprite_Data+16,y ;move third row sprite in column offscreen rts ;------------------------------------------------------------------------------------- ;$00-$01 - tile numbers ;$02 - relative Y position ;$03 - horizontal flip flag (not used here) ;$04 - attributes ;$05 - relative X position DefaultBlockObjTiles: .db $85, $85, $86, $86 ;brick w/ line (these are sprite tiles, not BG!) DrawBlock: lda Block_Rel_YPos ;get relative vertical coordinate of block object sta <$02 ;store here lda Block_Rel_XPos ;get relative horizontal coordinate of block object sta <$05 ;store here lda #$03 sta <$04 ;set attribute byte here lsr a sta <$03 ;set horizontal flip bit here (will not be used) ldy Block_SprDataOffset,x ;get sprite data offset ldx #$00 ;reset X for use as offset to tile data DBlkLoop: lda DefaultBlockObjTiles,x ;get left tile number sta <$00 ;set here lda DefaultBlockObjTiles+1,x ;get right tile number jsr DrawOneSpriteRow ;do sub to write tile numbers to first row of sprites cpx #$04 ;check incremented offset bne DBlkLoop ;and loop back until all four sprites are done ldx <ObjectOffset ;get block object offset ldy Block_SprDataOffset,x ;get sprite data offset lda AreaType cmp #$01 ;check for ground level type area beq ChkRep ;if found, branch to next part lda #$86 sta Sprite_Tilenumber,y ;otherwise remove brick tiles with lines sta Sprite_Tilenumber+4,y ;and replace then with lineless brick tiles ChkRep: lda Block_Metatile,x ;check replacement metatile cmp #$c4 ;if not used block metatile, then bne BlkOffscr ;branch ahead to use current graphics lda #$87 ;set A for used block tile iny ;increment Y to write to tile bytes jsr DumpFourSpr ;do sub to dump into all four sprites dey ;return Y to original offset lda #$03 ;set palette bits ldx AreaType dex ;check for ground level type area again beq SetBFlip ;if found, use current palette bits lsr a ;otherwise set to $01 SetBFlip: ldx <ObjectOffset ;put block object offset back in X sta Sprite_Attributes,y ;store attribute byte as-is in first sprite ora #%01000000 sta Sprite_Attributes+4,y ;set horizontal flip bit for second sprite ora #%10000000 sta Sprite_Attributes+12,y ;set both flip bits for fourth sprite and #%10000011 sta Sprite_Attributes+8,y ;set vertical flip bit for third sprite BlkOffscr: lda Block_OffscreenBits ;get offscreen bits for block object pha ;save to stack and #%00000100 ;check to see if d2 in offscreen bits are set beq PullOfsB ;if not set, branch, otherwise move sprites offscreen lda #$f8 ;move offscreen two OAMs sta Sprite_Y_Position+4,y ;on the right side sta Sprite_Y_Position+12,y PullOfsB: pla ;pull offscreen bits from stack ChkLeftCo: and #%00001000 ;check to see if d3 in offscreen bits are set beq ExDBlk ;if not set, branch, otherwise move sprites offscreen MoveColOffscreen: lda #$f8 ;move offscreen two OAMs sta Sprite_Y_Position,y ;on the left side (or two rows of enemy on either side sta Sprite_Y_Position+8,y ;if branched here from enemy graphics handler) ExDBlk: rts ;------------------------------------------------------------------------------------- ;$00 - used to hold palette bits for attribute byte or relative X position DrawBrickChunks: lda #$02 ;set palette bits here sta <$00 lda #$75 ;set tile number for ball (something residual, likely) ldy <GameEngineSubroutine cpy #$05 ;if end-of-level routine running, beq DChunks ;use palette and tile number assigned lda #$03 ;otherwise set different palette bits sta <$00 lda #$84 ;and set tile number for brick chunks DChunks: ldy Block_SprDataOffset,x ;get OAM data offset iny ;increment to start with tile bytes in OAM jsr DumpFourSpr ;do sub to dump tile number into all four sprites lda <FrameCounter ;get frame counter asl a asl a asl a ;move low nybble to high asl a and #$c0 ;get what was originally d3-d2 of low nybble ora <$00 ;add palette bits iny ;increment offset for attribute bytes jsr DumpFourSpr ;do sub to dump attribute data into all four sprites dey dey ;decrement offset to Y coordinate lda Block_Rel_YPos ;get first block object's relative vertical coordinate jsr DumpTwoSpr ;do sub to dump current Y coordinate into two sprites lda Block_Rel_XPos ;get first block object's relative horizontal coordinate sta Sprite_X_Position,y ;save into X coordinate of first sprite lda Block_Orig_XPos,x ;get original horizontal coordinate sec sbc ScreenLeft_X_Pos ;subtract coordinate of left side from original coordinate sta <$00 ;store result as relative horizontal coordinate of original sec sbc Block_Rel_XPos ;get difference of relative positions of original - current adc <$00 ;add original relative position to result adc #$06 ;plus 6 pixels to position second brick chunk correctly sta Sprite_X_Position+4,y ;save into X coordinate of second sprite lda Block_Rel_YPos+1 ;get second block object's relative vertical coordinate sta Sprite_Y_Position+8,y sta Sprite_Y_Position+12,y ;dump into Y coordinates of third and fourth sprites lda Block_Rel_XPos+1 ;get second block object's relative horizontal coordinate sta Sprite_X_Position+8,y ;save into X coordinate of third sprite lda <$00 ;use original relative horizontal position sec sbc Block_Rel_XPos+1 ;get difference of relative positions of original - current adc <$00 ;add original relative position to result adc #$06 ;plus 6 pixels to position fourth brick chunk correctly sta Sprite_X_Position+12,y ;save into X coordinate of fourth sprite lda Block_OffscreenBits ;get offscreen bits for block object jsr ChkLeftCo ;do sub to move left half of sprites offscreen if necessary lda Block_OffscreenBits ;get offscreen bits again asl a ;shift d7 into carry bcc ChnkOfs ;if d7 not set, branch to last part lda #$f8 jsr DumpTwoSpr ;otherwise move top sprites offscreen ChnkOfs: lda <$00 ;if relative position on left side of screen, bpl ExBCDr ;go ahead and leave lda Sprite_X_Position,y ;otherwise compare left-side X coordinate cmp Sprite_X_Position+4,y ;to right-side X coordinate bcc ExBCDr ;branch to leave if less lda #$f8 ;otherwise move right half of sprites offscreen sta Sprite_Y_Position+4,y sta Sprite_Y_Position+12,y ExBCDr: rts ;leave ;------------------------------------------------------------------------------------- DrawFireball: ldy FBall_SprDataOffset,x ;get fireball's sprite data offset lda Fireball_Rel_YPos ;get relative vertical coordinate sta Sprite_Y_Position,y ;store as sprite Y coordinate lda Fireball_Rel_XPos ;get relative horizontal coordinate sta Sprite_X_Position,y ;store as sprite X coordinate, then do shared code DrawFirebar: lda <FrameCounter ;get frame counter lsr a ;divide by four lsr a pha ;save result to stack and #$01 ;mask out all but last bit eor #$64 ;set either tile $64 or $65 as fireball tile sta Sprite_Tilenumber,y ;thus tile changes every four frames pla ;get from stack lsr a ;divide by four again lsr a lda #$02 ;load value $02 to set palette in attrib byte bcc FireA ;if last bit shifted out was not set, skip this ora #%11000000 ;otherwise flip both ways every eight frames FireA: sta Sprite_Attributes,y ;store attribute byte and leave rts ;------------------------------------------------------------------------------------- ExplosionTiles: .db $68, $67, $66 DrawExplosion_Fireball: ldy Alt_SprDataOffset,x ;get OAM data offset of alternate sort for fireball's explosion lda <Fireball_State,x ;load fireball state inc <Fireball_State,x ;increment state for next frame lsr a ;divide by 2 and #%00000111 ;mask out all but d3-d1 cmp #$03 ;check to see if time to kill fireball bcs KillFireBall ;branch if so, otherwise continue to draw explosion DrawExplosion_Fireworks: tax ;use whatever's in A for offset lda ExplosionTiles,x ;get tile number using offset iny ;increment Y (contains sprite data offset) jsr DumpFourSpr ;and dump into tile number part of sprite data dey ;decrement Y so we have the proper offset again ldx <ObjectOffset ;return enemy object buffer offset to X lda Fireball_Rel_YPos ;get relative vertical coordinate sec ;subtract four pixels vertically sbc #$04 ;for first and third sprites sta Sprite_Y_Position,y sta Sprite_Y_Position+8,y clc ;add eight pixels vertically adc #$08 ;for second and fourth sprites sta Sprite_Y_Position+4,y sta Sprite_Y_Position+12,y lda Fireball_Rel_XPos ;get relative horizontal coordinate sec ;subtract four pixels horizontally sbc #$04 ;for first and second sprites sta Sprite_X_Position,y sta Sprite_X_Position+4,y clc ;add eight pixels horizontally adc #$08 ;for third and fourth sprites sta Sprite_X_Position+8,y sta Sprite_X_Position+12,y lda #$02 ;set palette attributes for all sprites, but sta Sprite_Attributes,y ;set no flip at all for first sprite lda #$82 sta Sprite_Attributes+4,y ;set vertical flip for second sprite lda #$42 sta Sprite_Attributes+8,y ;set horizontal flip for third sprite lda #$c2 sta Sprite_Attributes+12,y ;set both flips for fourth sprite rts ;we are done KillFireBall: lda #$00 ;clear fireball state to kill it sta <Fireball_State,x rts ;------------------------------------------------------------------------------------- DrawSmallPlatform: ldy Enemy_SprDataOffset,x ;get OAM data offset lda #$5b ;load tile number for small platforms iny ;increment offset for tile numbers jsr DumpSixSpr ;dump tile number into all six sprites iny ;increment offset for attributes lda #$02 ;load palette controls jsr DumpSixSpr ;dump attributes into all six sprites dey ;decrement for original offset dey lda Enemy_Rel_XPos ;get relative horizontal coordinate sta Sprite_X_Position,y sta Sprite_X_Position+12,y ;dump as X coordinate into first and fourth sprites clc adc #$08 ;add eight pixels sta Sprite_X_Position+4,y ;dump into second and fifth sprites sta Sprite_X_Position+16,y clc adc #$08 ;add eight more pixels sta Sprite_X_Position+8,y ;dump into third and sixth sprites sta Sprite_X_Position+20,y lda <Enemy_Y_Position,x ;get vertical coordinate tax pha ;save to stack cpx #$20 ;if vertical coordinate below status bar, bcs TopSP ;do not mess with it lda #$f8 ;otherwise move first three sprites offscreen TopSP: jsr DumpThreeSpr ;dump vertical coordinate into Y coordinates pla ;pull from stack clc adc #$80 ;add 128 pixels tax cpx #$20 ;if below status bar (taking wrap into account) bcs BotSP ;then do not change altered coordinate lda #$f8 ;otherwise move last three sprites offscreen BotSP: sta Sprite_Y_Position+12,y ;dump vertical coordinate + 128 pixels sta Sprite_Y_Position+16,y ;into Y coordinates sta Sprite_Y_Position+20,y lda Enemy_OffscreenBits ;get offscreen bits pha ;save to stack and #%00001000 ;check d3 beq SOfs lda #$f8 ;if d3 was set, move first and sta Sprite_Y_Position,y ;fourth sprites offscreen sta Sprite_Y_Position+12,y SOfs: pla ;move out and back into stack pha and #%00000100 ;check d2 beq SOfs2 lda #$f8 ;if d2 was set, move second and sta Sprite_Y_Position+4,y ;fifth sprites offscreen sta Sprite_Y_Position+16,y SOfs2: pla ;get from stack and #%00000010 ;check d1 beq ExSPl lda #$f8 ;if d1 was set, move third and sta Sprite_Y_Position+8,y ;sixth sprites offscreen sta Sprite_Y_Position+20,y ExSPl: ldx <ObjectOffset ;get enemy object offset and leave rts ;------------------------------------------------------------------------------------- DrawBubble: ldy <Player_Y_HighPos ;if player's vertical high position dey ;not within screen, skip all of this bne ExDBub lda Bubble_OffscreenBits ;check air bubble's offscreen bits and #%00001000 bne ExDBub ;if bit set, branch to leave ldy Bubble_SprDataOffset,x ;get air bubble's OAM data offset lda Bubble_Rel_XPos ;get relative horizontal coordinate sta Sprite_X_Position,y ;store as X coordinate here lda Bubble_Rel_YPos ;get relative vertical coordinate sta Sprite_Y_Position,y ;store as Y coordinate here lda #$74 sta Sprite_Tilenumber,y ;put air bubble tile into OAM data lda #$02 sta Sprite_Attributes,y ;set attribute byte ExDBub: rts ;leave ;------------------------------------------------------------------------------------- ;$00 - used to store player's vertical offscreen bits PlayerGfxTblOffsets: .db $20, $28, $c8, $18, $00, $40, $50, $58 .db $80, $88, $b8, $78, $60, $a0, $b0, $b8 ;tiles arranged in order, 2 tiles per row, top to bottom PlayerGraphicsTable: ;big player table .db $00, $01, $02, $03, $04, $05, $06, $07 ;walking frame 1 .db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; frame 2 .db $10, $11, $12, $13, $14, $15, $16, $17 ; frame 3 .db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ;skidding .db $20, $21, $22, $23, $24, $25, $26, $27 ;jumping .db $08, $09, $28, $29, $2a, $2b, $2c, $2d ;swimming frame 1 .db $08, $09, $0a, $0b, $0c, $30, $2c, $2d ; frame 2 .db $08, $09, $0a, $0b, $2e, $2f, $2c, $2d ; frame 3 .db $08, $09, $28, $29, $2a, $2b, $5c, $5d ;climbing frame 1 .db $08, $09, $0a, $0b, $0c, $0d, $5e, $5f ; frame 2 .db $fc, $fc, $08, $09, $58, $59, $5a, $5a ;crouching .db $08, $09, $28, $29, $2a, $2b, $0e, $0f ;fireball throwing ;small player table .db $fc, $fc, $fc, $fc, $32, $33, $34, $35 ;walking frame 1 .db $fc, $fc, $fc, $fc, $36, $37, $38, $39 ; frame 2 .db $fc, $fc, $fc, $fc, $3a, $37, $3b, $3c ; frame 3 .db $fc, $fc, $fc, $fc, $3d, $3e, $3f, $40 ;skidding .db $fc, $fc, $fc, $fc, $32, $41, $42, $43 ;jumping .db $fc, $fc, $fc, $fc, $32, $33, $44, $45 ;swimming frame 1 .db $fc, $fc, $fc, $fc, $32, $33, $44, $47 ; frame 2 .db $fc, $fc, $fc, $fc, $32, $33, $48, $49 ; frame 3 .db $fc, $fc, $fc, $fc, $32, $33, $90, $91 ;climbing frame 1 .db $fc, $fc, $fc, $fc, $3a, $37, $92, $93 ; frame 2 .db $fc, $fc, $fc, $fc, $9e, $9e, $9f, $9f ;killed ;used by both player sizes .db $fc, $fc, $fc, $fc, $3a, $37, $4f, $4f ;small player standing .db $fc, $fc, $00, $01, $4c, $4d, $4e, $4e ;intermediate grow frame .db $00, $01, $4c, $4d, $4a, $4a, $4b, $4b ;big player standing SwimKickTileNum: .db $31, $46 PlayerGfxHandler: lda InjuryTimer ;if player's injured invincibility timer beq CntPl ;not set, skip checkpoint and continue code lda <FrameCounter lsr a ;otherwise check frame counter and branch bcs ExPGH ;to leave on every other frame (when d0 is set) CntPl: lda <GameEngineSubroutine ;if executing specific game engine routine, cmp #$0b ;branch ahead to some other part beq PlayerKilled lda PlayerChangeSizeFlag ;if grow/shrink flag set bne DoChangeSize ;then branch to some other code ldy SwimmingFlag ;if swimming flag set, branch to beq FindPlayerAction ;different part, do not return lda <Player_State cmp #$00 ;if player status normal, beq FindPlayerAction ;branch and do not return jsr FindPlayerAction ;otherwise jump and return lda <FrameCounter and #%00000100 ;check frame counter for d2 set (8 frames every bne ExPGH ;eighth frame), and branch if set to leave tax ;initialize X to zero ldy Player_SprDataOffset ;get player sprite data offset lda <PlayerFacingDir ;get player's facing direction lsr a bcs SwimKT ;if player facing to the right, use current offset iny iny ;otherwise move to next OAM data iny iny SwimKT: lda PlayerSize ;check player's size beq BigKTS ;if big, use first tile lda Sprite_Tilenumber+24,y ;check tile number of seventh/eighth sprite cmp SwimTileRepOffset ;against tile number in player graphics table beq ExPGH ;if spr7/spr8 tile number = value, branch to leave inx ;otherwise increment X for second tile BigKTS: lda SwimKickTileNum,x ;overwrite tile number in sprite 7/8 sta Sprite_Tilenumber+24,y ;to animate player's feet when swimming ExPGH: rts ;then leave FindPlayerAction: jsr ProcessPlayerAction ;find proper offset to graphics table by player's actions jmp PlayerGfxProcessing ;draw player, then process for fireball throwing DoChangeSize: jsr HandleChangeSize ;find proper offset to graphics table for grow/shrink jmp PlayerGfxProcessing ;draw player, then process for fireball throwing PlayerKilled: ldy #$0e ;load offset for player killed lda PlayerGfxTblOffsets,y ;get offset to graphics table PlayerGfxProcessing: sta PlayerGfxOffset ;store offset to graphics table here lda #$04 jsr RenderPlayerSub ;draw player based on offset loaded jsr ChkForPlayerAttrib ;set horizontal flip bits as necessary lda FireballThrowingTimer beq PlayerOffscreenChk ;if fireball throw timer not set, skip to the end ldy #$00 ;set value to initialize by default lda PlayerAnimTimer ;get animation frame timer cmp FireballThrowingTimer ;compare to fireball throw timer sty FireballThrowingTimer ;initialize fireball throw timer bcs PlayerOffscreenChk ;if animation frame timer => fireball throw timer skip to end sta FireballThrowingTimer ;otherwise store animation timer into fireball throw timer ldy #$07 ;load offset for throwing lda PlayerGfxTblOffsets,y ;get offset to graphics table sta PlayerGfxOffset ;store it for use later ldy #$04 ;set to update four sprite rows by default lda <Player_X_Speed ora <Left_Right_Buttons ;check for horizontal speed or left/right button press beq SUpdR ;if no speed or button press, branch using set value in Y dey ;otherwise set to update only three sprite rows SUpdR: tya ;save in A for use jsr RenderPlayerSub ;in sub, draw player object again PlayerOffscreenChk: lda Player_OffscreenBits ;get player's offscreen bits lsr a lsr a ;move vertical bits to low nybble lsr a lsr a sta <$00 ;store here ldx #$03 ;check all four rows of player sprites lda Player_SprDataOffset ;get player's sprite data offset clc adc #$18 ;add 24 bytes to start at bottom row tay ;set as offset here PROfsLoop: lda #$f8 ;load offscreen Y coordinate just in case lsr <$00 ;shift bit into carry bcc NPROffscr ;if bit not set, skip, do not move sprites jsr DumpTwoSpr ;otherwise dump offscreen Y coordinate into sprite data NPROffscr: tya sec ;subtract eight bytes to do sbc #$08 ;next row up tay dex ;decrement row counter bpl PROfsLoop ;do this until all sprite rows are checked rts ;then we are done! ;------------------------------------------------------------------------------------- IntermediatePlayerData: .db $58, $01, $00, $60, $ff, $04 DrawPlayer_Intermediate: ldx #$05 ;store data into zero page memory PIntLoop: lda IntermediatePlayerData,x ;load data to display player as he always sta <$02,x ;appears on world/lives display dex bpl PIntLoop ;do this until all data is loaded ldx #$b8 ;load offset for small standing ldy #$04 ;load sprite data offset jsr DrawPlayerLoop ;draw player accordingly lda Sprite_Attributes+36 ;get empty sprite attributes ora #%01000000 ;set horizontal flip bit for bottom-right sprite sta Sprite_Attributes+32 ;store and leave rts ;------------------------------------------------------------------------------------- ;$00-$01 - used to hold tile numbers, $00 also used to hold upper extent of animation frames ;$02 - vertical position ;$03 - facing direction, used as horizontal flip control ;$04 - attributes ;$05 - horizontal position ;$07 - number of rows to draw ;these also used in IntermediatePlayerData RenderPlayerSub: sta <$07 ;store number of rows of sprites to draw lda Player_Rel_XPos sta Player_Pos_ForScroll ;store player's relative horizontal position sta <$05 ;store it here also lda Player_Rel_YPos sta <$02 ;store player's vertical position lda <PlayerFacingDir sta <$03 ;store player's facing direction lda Player_SprAttrib sta <$04 ;store player's sprite attributes ldx PlayerGfxOffset ;load graphics table offset ldy Player_SprDataOffset ;get player's sprite data offset DrawPlayerLoop: lda PlayerGraphicsTable,x ;load player's left side sta <$00 lda PlayerGraphicsTable+1,x ;now load right side jsr DrawOneSpriteRow dec <$07 ;decrement rows of sprites to draw bne DrawPlayerLoop ;do this until all rows are drawn rts ProcessPlayerAction: lda <Player_State ;get player's state cmp #$03 beq ActionClimbing ;if climbing, branch here cmp #$02 beq ActionFalling ;if falling, branch here cmp #$01 bne ProcOnGroundActs ;if not jumping, branch here lda SwimmingFlag bne ActionSwimming ;if swimming flag set, branch elsewhere ldy #$06 ;load offset for crouching lda CrouchingFlag ;get crouching flag bne NonAnimatedActs ;if set, branch to get offset for graphics table ldy #$00 ;otherwise load offset for jumping jmp NonAnimatedActs ;go to get offset to graphics table ProcOnGroundActs: ldy #$06 ;load offset for crouching lda CrouchingFlag ;get crouching flag bne NonAnimatedActs ;if set, branch to get offset for graphics table ldy #$02 ;load offset for standing lda <Player_X_Speed ;check player's horizontal speed ora <Left_Right_Buttons ;and left/right controller bits beq NonAnimatedActs ;if no speed or buttons pressed, use standing offset lda Player_XSpeedAbsolute ;load walking/running speed cmp #$09 bcc ActionWalkRun ;if less than a certain amount, branch, too slow to skid lda <Player_MovingDir ;otherwise check to see if moving direction and <PlayerFacingDir ;and facing direction are the same bne ActionWalkRun ;if moving direction = facing direction, branch, don't skid iny ;otherwise increment to skid offset ($03) NonAnimatedActs: jsr GetGfxOffsetAdder ;do a sub here to get offset adder for graphics table lda #$00 sta PlayerAnimCtrl ;initialize animation frame control lda PlayerGfxTblOffsets,y ;load offset to graphics table using size as offset rts ActionFalling: ldy #$04 ;load offset for walking/running jsr GetGfxOffsetAdder ;get offset to graphics table jmp GetCurrentAnimOffset ;execute instructions for falling state ActionWalkRun: ldy #$04 ;load offset for walking/running jsr GetGfxOffsetAdder ;get offset to graphics table jmp FourFrameExtent ;execute instructions for normal state ActionClimbing: ldy #$05 ;load offset for climbing lda <Player_Y_Speed ;check player's vertical speed beq NonAnimatedActs ;if no speed, branch, use offset as-is jsr GetGfxOffsetAdder ;otherwise get offset for graphics table jmp ThreeFrameExtent ;then skip ahead to more code ActionSwimming: ldy #$01 ;load offset for swimming jsr GetGfxOffsetAdder lda JumpSwimTimer ;check jump/swim timer ora PlayerAnimCtrl ;and animation frame control bne FourFrameExtent ;if any one of these set, branch ahead lda <A_B_Buttons asl a ;check for A button pressed bcs FourFrameExtent ;branch to same place if A button pressed GetCurrentAnimOffset: lda PlayerAnimCtrl ;get animation frame control jmp GetOffsetFromAnimCtrl ;jump to get proper offset to graphics table FourFrameExtent: lda #$03 ;load upper extent for frame control jmp AnimationControl ;jump to get offset and animate player object ThreeFrameExtent: lda #$02 ;load upper extent for frame control for climbing AnimationControl: sta <$00 ;store upper extent here jsr GetCurrentAnimOffset ;get proper offset to graphics table pha ;save offset to stack lda PlayerAnimTimer ;load animation frame timer bne ExAnimC ;branch if not expired lda PlayerAnimTimerSet ;get animation frame timer amount sta PlayerAnimTimer ;and set timer accordingly lda PlayerAnimCtrl clc ;add one to animation frame control adc #$01 cmp <$00 ;compare to upper extent bcc SetAnimC ;if frame control + 1 < upper extent, use as next lda #$00 ;otherwise initialize frame control SetAnimC: sta PlayerAnimCtrl ;store as new animation frame control ExAnimC: pla ;get offset to graphics table from stack and leave rts GetGfxOffsetAdder: lda PlayerSize ;get player's size beq SzOfs ;if player big, use current offset as-is tya ;for big player clc ;otherwise add eight bytes to offset adc #$08 ;for small player tay SzOfs: rts ;go back ChangeSizeOffsetAdder: .db $00, $01, $00, $01, $00, $01, $02, $00, $01, $02 .db $02, $00, $02, $00, $02, $00, $02, $00, $02, $00 HandleChangeSize: ldy PlayerAnimCtrl ;get animation frame control lda <FrameCounter and #%00000011 ;get frame counter and execute this code every bne GorSLog ;fourth frame, otherwise branch ahead iny ;increment frame control cpy #$0a ;check for preset upper extent bcc CSzNext ;if not there yet, skip ahead to use ldy #$00 ;otherwise initialize both grow/shrink flag sty PlayerChangeSizeFlag ;and animation frame control CSzNext: sty PlayerAnimCtrl ;store proper frame control GorSLog: lda PlayerSize ;get player's size bne ShrinkPlayer ;if player small, skip ahead to next part lda ChangeSizeOffsetAdder,y ;get offset adder based on frame control as offset ldy #$0f ;load offset for player growing GetOffsetFromAnimCtrl: asl a ;multiply animation frame control asl a ;by eight to get proper amount asl a ;to add to our offset adc PlayerGfxTblOffsets,y ;add to offset to graphics table rts ;and return with result in A ShrinkPlayer: tya ;add ten bytes to frame control as offset clc adc #$0a ;this thing apparently uses two of the swimming frames tax ;to draw the player shrinking ldy #$09 ;load offset for small player swimming lda ChangeSizeOffsetAdder,x ;get what would normally be offset adder bne ShrPlF ;and branch to use offset if nonzero ldy #$01 ;otherwise load offset for big player swimming ShrPlF: lda PlayerGfxTblOffsets,y ;get offset to graphics table based on offset loaded rts ;and leave ChkForPlayerAttrib: ldy Player_SprDataOffset ;get sprite data offset lda <GameEngineSubroutine cmp #$0b ;if executing specific game engine routine, beq KilledAtt ;branch to change third and fourth row OAM attributes lda PlayerGfxOffset ;get graphics table offset cmp #$50 beq C_S_IGAtt ;if crouch offset, either standing offset, cmp #$b8 ;or intermediate growing offset, beq C_S_IGAtt ;go ahead and execute code to change cmp #$c0 ;fourth row OAM attributes only beq C_S_IGAtt cmp #$c8 bne ExPlyrAt ;if none of these, branch to leave KilledAtt: lda Sprite_Attributes+16,y and #%00111111 ;mask out horizontal and vertical flip bits sta Sprite_Attributes+16,y ;for third row sprites and save lda Sprite_Attributes+20,y and #%00111111 ora #%01000000 ;set horizontal flip bit for second sta Sprite_Attributes+20,y ;sprite in the third row C_S_IGAtt: lda Sprite_Attributes+24,y and #%00111111 ;mask out horizontal and vertical flip bits sta Sprite_Attributes+24,y ;for fourth row sprites and save lda Sprite_Attributes+28,y and #%00111111 ora #%01000000 ;set horizontal flip bit for second sta Sprite_Attributes+28,y ;sprite in the fourth row ExPlyrAt: rts ;leave ;------------------------------------------------------------------------------------- ;$00 - used in adding to get proper offset RelativePlayerPosition: ldx #$00 ;set offsets for relative cooordinates ldy #$00 ;routine to correspond to player object jmp RelWOfs ;get the coordinates RelativeBubblePosition: ldy #$01 ;set for air bubble offsets jsr GetProperObjOffset ;modify X to get proper air bubble offset ldy #$03 jmp RelWOfs ;get the coordinates RelativeFireballPosition: ldy #$00 ;set for fireball offsets jsr GetProperObjOffset ;modify X to get proper fireball offset ldy #$02 RelWOfs: jsr GetObjRelativePosition ;get the coordinates ldx <ObjectOffset ;return original offset rts ;leave RelativeMiscPosition: ldy #$02 ;set for misc object offsets jsr GetProperObjOffset ;modify X to get proper misc object offset ldy #$06 jmp RelWOfs ;get the coordinates RelativeEnemyPosition: lda #$01 ;get coordinates of enemy object ldy #$01 ;relative to the screen jmp VariableObjOfsRelPos RelativeBlockPosition: lda #$09 ;get coordinates of one block object ldy #$04 ;relative to the screen jsr VariableObjOfsRelPos inx ;adjust offset for other block object if any inx lda #$09 iny ;adjust other and get coordinates for other one VariableObjOfsRelPos: stx <$00 ;store value to add to A here clc adc <$00 ;add A to value stored tax ;use as enemy offset jsr GetObjRelativePosition ldx <ObjectOffset ;reload old object offset and leave rts ;;;;;;;;;;;;;;;;;;;;;;;;;;$F171 GetObjRelativePosition: lda <SprObject_Y_Position,x ;load vertical coordinate low sta SprObject_Rel_YPos,y ;store here lda <SprObject_X_Position,x ;load horizontal coordinate sec ;subtract left edge coordinate sbc ScreenLeft_X_Pos sta SprObject_Rel_XPos,y ;store result here rts ;------------------------------------------------------------------------------------- ;$00 - used as temp variable to hold offscreen bits GetPlayerOffscreenBits: ldx #$00 ;set offsets for player-specific variables ldy #$00 ;and get offscreen information about player jmp GetOffScreenBitsSet GetFireballOffscreenBits: ldy #$00 ;set for fireball offsets jsr GetProperObjOffset ;modify X to get proper fireball offset ldy #$02 ;set other offset for fireball's offscreen bits jmp GetOffScreenBitsSet ;and get offscreen information about fireball GetBubbleOffscreenBits: ldy #$01 ;set for air bubble offsets jsr GetProperObjOffset ;modify X to get proper air bubble offset ldy #$03 ;set other offset for airbubble's offscreen bits jmp GetOffScreenBitsSet ;and get offscreen information about air bubble GetMiscOffscreenBits: ldy #$02 ;set for misc object offsets jsr GetProperObjOffset ;modify X to get proper misc object offset ldy #$06 ;set other offset for misc object's offscreen bits jmp GetOffScreenBitsSet ;and get offscreen information about misc object ObjOffsetData: .db $07, $16, $0d GetProperObjOffset: txa ;move offset to A clc adc ObjOffsetData,y ;add amount of bytes to offset depending on setting in Y tax ;put back in X and leave rts GetEnemyOffscreenBits: lda #$01 ;set A to add 1 byte in order to get enemy offset ldy #$01 ;set Y to put offscreen bits in Enemy_OffscreenBits jmp SetOffscrBitsOffset GetBlockOffscreenBits: lda #$09 ;set A to add 9 bytes in order to get block obj offset ldy #$04 ;set Y to put offscreen bits in Block_OffscreenBits SetOffscrBitsOffset: stx <$00 clc ;add contents of X to A to get adc <$00 ;appropriate offset, then give back to X tax GetOffScreenBitsSet: tya ;save offscreen bits offset to stack for now pha jsr RunOffscrBitsSubs asl a ;move low nybble to high nybble asl a asl a asl a ora <$00 ;mask together with previously saved low nybble sta <$00 ;store both here pla ;get offscreen bits offset from stack tay lda <$00 ;get value here and store elsewhere sta SprObject_OffscrBits,y ldx <ObjectOffset rts RunOffscrBitsSubs: jsr GetXOffscreenBits ;do subroutine here lsr a ;move high nybble to low lsr a lsr a lsr a sta <$00 ;store here jmp GetYOffscreenBits ;-------------------------------- ;(these apply to these three subsections) ;$04 - used to store proper offset ;$05 - used as adder in DividePDiff ;$06 - used to store preset value used to compare to pixel difference in $07 ;$07 - used to store difference between coordinates of object and screen edges XOffscreenBitsData: .db $7f, $3f, $1f, $0f, $07, $03, $01, $00 .db $80, $c0, $e0, $f0, $f8, $fc, $fe, $ff DefaultXOnscreenOfs: .db $07, $0f, $07 GetXOffscreenBits: stx <$04 ;save position in buffer to here ldy #$01 ;start with right side of screen XOfsLoop: lda ScreenEdge_X_Pos,y ;get pixel coordinate of edge sec ;get difference between pixel coordinate of edge sbc <SprObject_X_Position,x ;and pixel coordinate of object position sta <$07 ;store here lda ScreenEdge_PageLoc,y ;get page location of edge sbc <SprObject_PageLoc,x ;subtract from page location of object position ldx DefaultXOnscreenOfs,y ;load offset value here cmp #$00 bmi XLdBData ;if beyond right edge or in front of left edge, branch ldx DefaultXOnscreenOfs+1,y ;if not, load alternate offset value here cmp #$01 bpl XLdBData ;if one page or more to the left of either edge, branch lda #$38 ;if no branching, load value here and store sta <$06 lda #$08 ;load some other value and execute subroutine jsr DividePDiff XLdBData: lda XOffscreenBitsData,x ;get bits here ldx <$04 ;reobtain position in buffer cmp #$00 ;if bits not zero, branch to leave bne ExXOfsBS dey ;otherwise, do left side of screen now bpl XOfsLoop ;branch if not already done with left side ExXOfsBS: rts ;-------------------------------- YOffscreenBitsData: .db $00, $08, $0c, $0e .db $0f, $07, $03, $01 .db $00 DefaultYOnscreenOfs: .db $04, $00, $04 HighPosUnitData: .db $ff, $00 GetYOffscreenBits: stx <$04 ;save position in buffer to here ldy #$01 ;start with top of screen YOfsLoop: lda HighPosUnitData,y ;load coordinate for edge of vertical unit sec sbc <SprObject_Y_Position,x ;subtract from vertical coordinate of object sta <$07 ;store here lda #$01 ;subtract one from vertical high byte of object sbc <SprObject_Y_HighPos,x ldx DefaultYOnscreenOfs,y ;load offset value here cmp #$00 bmi YLdBData ;if under top of the screen or beyond bottom, branch ldx DefaultYOnscreenOfs+1,y ;if not, load alternate offset value here cmp #$01 bpl YLdBData ;if one vertical unit or more above the screen, branch lda #$20 ;if no branching, load value here and store sta <$06 lda #$04 ;load some other value and execute subroutine jsr DividePDiff YLdBData: lda YOffscreenBitsData,x ;get offscreen data bits using offset ldx <$04 ;reobtain position in buffer cmp #$00 bne ExYOfsBS ;if bits not zero, branch to leave dey ;otherwise, do bottom of the screen now bpl YOfsLoop ExYOfsBS: rts ;-------------------------------- DividePDiff: sta <$05 ;store current value in A here lda <$07 ;get pixel difference cmp <$06 ;compare to preset value bcs ExDivPD ;if pixel difference >= preset value, branch lsr a ;divide by eight lsr a lsr a and #$07 ;mask out all but 3 LSB cpy #$01 ;right side of the screen or top? bcs SetOscrO ;if so, branch, use difference / 8 as offset adc <$05 ;if not, add value to difference / 8 SetOscrO: tax ;use as offset ExDivPD: rts ;leave ;------------------------------------------------------------------------------------- ;$00-$01 - tile numbers ;$02 - Y coordinate ;$03 - flip control ;$04 - sprite attributes ;$05 - X coordinate DrawSpriteObject: lda <$03 ;get saved flip control bits lsr a lsr a ;move d1 into carry lda <$00 bcc NoHFlip ;if d1 not set, branch sta Sprite_Tilenumber+4,y ;store first tile into second sprite lda <$01 ;and second into first sprite sta Sprite_Tilenumber,y lda #$40 ;activate horizontal flip OAM attribute bne SetHFAt ;and unconditionally branch NoHFlip: sta Sprite_Tilenumber,y ;store first tile into first sprite lda <$01 ;and second into second sprite sta Sprite_Tilenumber+4,y lda #$00 ;clear bit for horizontal flip SetHFAt: ora <$04 ;add other OAM attributes if necessary sta Sprite_Attributes,y ;store sprite attributes sta Sprite_Attributes+4,y lda <$02 ;now the y coordinates sta Sprite_Y_Position,y ;note because they are sta Sprite_Y_Position+4,y ;side by side, they are the same lda <$05 sta Sprite_X_Position,y ;store x coordinate, then clc ;add 8 pixels and store another to adc #$08 ;put them side by side sta Sprite_X_Position+4,y lda <$02 ;add eight pixels to the next y clc ;coordinate adc #$08 sta <$02 tya ;add eight to the offset in Y to clc ;move to the next two sprites adc #$08 tay inx ;increment offset to return it to the inx ;routine that called this subroutine rts ;------------------------------------------------------------------------------------- ;unused space .db $ff, $ff, $ff, $ff, $ff, $ff ;------------------------------------------------------------------------------------- SoundEngine: lda OperMode ;are we in title screen mode? bne SndOn sta SND_MASTERCTRL_REG ;if so, disable sound and leave rts SndOn: lda #$ff sta JOYPAD_PORT2 ;disable irqs and set frame counter mode??? lda #$0f sta SND_MASTERCTRL_REG ;enable first four channels lda PauseModeFlag ;is sound already in pause mode? bne InPause lda <PauseSoundQueue ;if not, check pause sfx queue cmp #$01 bne RunSoundSubroutines ;if queue is empty, skip pause mode routine InPause: lda PauseSoundBuffer ;check pause sfx buffer bne ContPau lda <PauseSoundQueue ;check pause queue beq SkipSoundSubroutines sta PauseSoundBuffer ;if queue full, store in buffer and activate sta PauseModeFlag ;pause mode to interrupt game sounds lda #$00 ;disable sound and clear sfx buffers sta SND_MASTERCTRL_REG sta <Square1SoundBuffer sta <Square2SoundBuffer sta <NoiseSoundBuffer lda #$0f sta SND_MASTERCTRL_REG ;enable sound again lda #$2a ;store length of sound in pause counter sta Squ1_SfxLenCounter PTone1F: lda #$44 ;play first tone bne PTRegC ;unconditional branch ContPau: lda Squ1_SfxLenCounter ;check pause length left cmp #$24 ;time to play second? beq PTone2F cmp #$1e ;time to play first again? beq PTone1F cmp #$18 ;time to play second again? bne DecPauC ;only load regs during times, otherwise skip PTone2F: lda #$64 ;store reg contents and play the pause sfx PTRegC: ldx #$84 ldy #$7f jsr PlaySqu1Sfx DecPauC: dec Squ1_SfxLenCounter ;decrement pause sfx counter bne SkipSoundSubroutines lda #$00 ;disable sound if in pause mode and sta SND_MASTERCTRL_REG ;not currently playing the pause sfx lda PauseSoundBuffer ;if no longer playing pause sfx, check to see cmp #$02 ;if we need to be playing sound again bne SkipPIn lda #$00 ;clear pause mode to allow game sounds again sta PauseModeFlag SkipPIn: lda #$00 ;clear pause sfx buffer sta PauseSoundBuffer beq SkipSoundSubroutines RunSoundSubroutines: jsr Square1SfxHandler ;play sfx on square channel 1 jsr Square2SfxHandler ; '' '' '' square channel 2 jsr NoiseSfxHandler ; '' '' '' noise channel jsr MusicHandler ;play music on all channels lda #$00 ;clear the music queues sta <AreaMusicQueue sta <EventMusicQueue SkipSoundSubroutines: lda #$00 ;clear the sound effects queues sta <Square1SoundQueue sta <Square2SoundQueue sta <NoiseSoundQueue sta <PauseSoundQueue ldy DAC_Counter ;load some sort of counter lda <AreaMusicBuffer and #%00000011 ;check for specific music beq NoIncDAC inc DAC_Counter ;increment and check counter cpy #$30 bcc StrWave ;if not there yet, just store it NoIncDAC: tya beq StrWave ;if we are at zero, do not decrement dec DAC_Counter ;decrement counter StrWave: sty SND_DELTA_REG+1 ;store into DMC load register (??) rts ;we are done here ;-------------------------------- Dump_Squ1_Regs: sty SND_SQUARE1_REG+1 ;dump the contents of X and Y into square 1's control regs stx SND_SQUARE1_REG rts PlaySqu1Sfx: jsr Dump_Squ1_Regs ;do sub to set ctrl regs for square 1, then set frequency regs SetFreq_Squ1: ldx #$00 ;set frequency reg offset for square 1 sound channel Dump_Freq_Regs: tay lda FreqRegLookupTbl+1,y ;use previous contents of A for sound reg offset beq NoTone ;if zero, then do not load sta SND_REGISTER+2,x ;first byte goes into LSB of frequency divider lda FreqRegLookupTbl,y ;second byte goes into 3 MSB plus extra bit for ora #%00001000 ;length counter sta SND_REGISTER+3,x NoTone: rts Dump_Sq2_Regs: stx SND_SQUARE2_REG ;dump the contents of X and Y into square 2's control regs sty SND_SQUARE2_REG+1 rts PlaySqu2Sfx: jsr Dump_Sq2_Regs ;do sub to set ctrl regs for square 2, then set frequency regs SetFreq_Squ2: ldx #$04 ;set frequency reg offset for square 2 sound channel bne Dump_Freq_Regs ;unconditional branch SetFreq_Tri: ldx #$08 ;set frequency reg offset for triangle sound channel bne Dump_Freq_Regs ;unconditional branch ;-------------------------------- SwimStompEnvelopeData: .db $9f, $9b, $98, $96, $95, $94, $92, $90 .db $90, $9a, $97, $95, $93, $92 PlayFlagpoleSlide: lda #$40 ;store length of flagpole sound sta Squ1_SfxLenCounter lda #$62 ;load part of reg contents for flagpole sound jsr SetFreq_Squ1 ldx #$99 ;now load the rest bne FPS2nd PlaySmallJump: lda #$26 ;branch here for small mario jumping sound bne JumpRegContents PlayBigJump: lda #$18 ;branch here for big mario jumping sound JumpRegContents: ldx #$82 ;note that small and big jump borrow each others' reg contents ldy #$a7 ;anyway, this loads the first part of mario's jumping sound jsr PlaySqu1Sfx lda #$28 ;store length of sfx for both jumping sounds sta Squ1_SfxLenCounter ;then continue on here ContinueSndJump: lda Squ1_SfxLenCounter ;jumping sounds seem to be composed of three parts cmp #$25 ;check for time to play second part yet bne NA2Prt ldx #$5f ;load second part ldy #$f6 bne DmpJpFPS ;unconditional branch NA2Prt: cmp #$20 ;check for third part bne DecJpFPS ldx #$48 ;load third part FPS2nd: ldy #$bc ;the flagpole slide sound shares part of third part DmpJpFPS: jsr Dump_Squ1_Regs bne DecJpFPS ;unconditional branch outta here PlayFireballThrow: lda #$05 ldy #$99 ;load reg contents for fireball throw sound bne Fthrow ;unconditional branch PlayBump: lda #$0a ;load length of sfx and reg contents for bump sound ldy #$93 Fthrow: ldx #$9e ;the fireball sound shares reg contents with the bump sound sta Squ1_SfxLenCounter lda #$0c ;load offset for bump sound jsr PlaySqu1Sfx ContinueBumpThrow: lda Squ1_SfxLenCounter ;check for second part of bump sound cmp #$06 bne DecJpFPS lda #$bb ;load second part directly sta SND_SQUARE1_REG+1 DecJpFPS: bne BranchToDecLength1 ;unconditional branch Square1SfxHandler: ldy <Square1SoundQueue ;check for sfx in queue beq CheckSfx1Buffer sty <Square1SoundBuffer ;if found, put in buffer bmi PlaySmallJump ;small jump lsr <Square1SoundQueue bcs PlayBigJump ;big jump lsr <Square1SoundQueue bcs PlayBump ;bump lsr <Square1SoundQueue bcs PlaySwimStomp ;swim/stomp lsr <Square1SoundQueue bcs PlaySmackEnemy ;smack enemy lsr <Square1SoundQueue bcs PlayPipeDownInj ;pipedown/injury lsr <Square1SoundQueue bcs PlayFireballThrow ;fireball throw lsr <Square1SoundQueue bcs PlayFlagpoleSlide ;slide flagpole CheckSfx1Buffer: lda <Square1SoundBuffer ;check for sfx in buffer beq ExS1H ;if not found, exit sub bmi ContinueSndJump ;small mario jump lsr a bcs ContinueSndJump ;big mario jump lsr a bcs ContinueBumpThrow ;bump lsr a bcs ContinueSwimStomp ;swim/stomp lsr a bcs ContinueSmackEnemy ;smack enemy lsr a bcs ContinuePipeDownInj ;pipedown/injury lsr a bcs ContinueBumpThrow ;fireball throw lsr a bcs DecrementSfx1Length ;slide flagpole ExS1H: rts PlaySwimStomp: lda #$0e ;store length of swim/stomp sound sta Squ1_SfxLenCounter ldy #$9c ;store reg contents for swim/stomp sound ldx #$9e lda #$26 jsr PlaySqu1Sfx ContinueSwimStomp: ldy Squ1_SfxLenCounter ;look up reg contents in data section based on lda SwimStompEnvelopeData-1,y ;length of sound left, used to control sound's sta SND_SQUARE1_REG ;envelope cpy #$06 bne BranchToDecLength1 lda #$9e ;when the length counts down to a certain point, put this sta SND_SQUARE1_REG+2 ;directly into the LSB of square 1's frequency divider BranchToDecLength1: bne DecrementSfx1Length ;unconditional branch (regardless of how we got here) PlaySmackEnemy: lda #$0e ;store length of smack enemy sound ldy #$cb ldx #$9f sta Squ1_SfxLenCounter lda #$28 ;store reg contents for smack enemy sound jsr PlaySqu1Sfx bne DecrementSfx1Length ;unconditional branch ContinueSmackEnemy: ldy Squ1_SfxLenCounter ;check about halfway through cpy #$08 bne SmSpc lda #$a0 ;if we're at the about-halfway point, make the second tone sta SND_SQUARE1_REG+2 ;in the smack enemy sound lda #$9f bne SmTick SmSpc: lda #$90 ;this creates spaces in the sound, giving it its distinct noise SmTick: sta SND_SQUARE1_REG DecrementSfx1Length: dec Squ1_SfxLenCounter ;decrement length of sfx bne ExSfx1 StopSquare1Sfx: ldx #$00 ;if end of sfx reached, clear buffer stx <$f1 ;and stop making the sfx ldx #$0e stx SND_MASTERCTRL_REG ldx #$0f stx SND_MASTERCTRL_REG ExSfx1: rts PlayPipeDownInj: lda #$2f ;load length of pipedown sound sta Squ1_SfxLenCounter ContinuePipeDownInj: lda Squ1_SfxLenCounter ;some bitwise logic, forces the regs lsr a ;to be written to only during six specific times bcs NoPDwnL ;during which d3 must be set and d1-0 must be clear lsr a bcs NoPDwnL and #%00000010 beq NoPDwnL ldy #$91 ;and this is where it actually gets written in ldx #$9a lda #$44 jsr PlaySqu1Sfx NoPDwnL: jmp DecrementSfx1Length ;-------------------------------- ExtraLifeFreqData: .db $58, $02, $54, $56, $4e, $44 PowerUpGrabFreqData: .db $4c, $52, $4c, $48, $3e, $36, $3e, $36, $30 .db $28, $4a, $50, $4a, $64, $3c, $32, $3c, $32 .db $2c, $24, $3a, $64, $3a, $34, $2c, $22, $2c ;residual frequency data .db $22, $1c, $14 PUp_VGrow_FreqData: .db $14, $04, $22, $24, $16, $04, $24, $26 ;used by both .db $18, $04, $26, $28, $1a, $04, $28, $2a .db $1c, $04, $2a, $2c, $1e, $04, $2c, $2e ;used by vinegrow .db $20, $04, $2e, $30, $22, $04, $30, $32 PlayCoinGrab: lda #$35 ;load length of coin grab sound ldx #$8d ;and part of reg contents bne CGrab_TTickRegL PlayTimerTick: lda #$06 ;load length of timer tick sound ldx #$98 ;and part of reg contents CGrab_TTickRegL: sta Squ2_SfxLenCounter ldy #$7f ;load the rest of reg contents lda #$42 ;of coin grab and timer tick sound jsr PlaySqu2Sfx ContinueCGrabTTick: lda Squ2_SfxLenCounter ;check for time to play second tone yet cmp #$30 ;timer tick sound also executes this, not sure why bne NA2Tone lda #$54 ;if so, load the tone directly into the reg sta SND_SQUARE2_REG+2 NA2Tone: bne DecrementSfx2Length PlayBlast: lda #$20 ;load length of fireworks/gunfire sound sta Squ2_SfxLenCounter ldy #$94 ;load reg contents of fireworks/gunfire sound lda #$5e bne SBlasJ ContinueBlast: lda Squ2_SfxLenCounter ;check for time to play second part cmp #$18 bne DecrementSfx2Length ldy #$93 ;load second part reg contents then lda #$18 SBlasJ: bne BlstSJp ;unconditional branch to load rest of reg contents PlayPowerUpGrab: lda #$36 ;load length of power-up grab sound sta Squ2_SfxLenCounter ContinuePowerUpGrab: lda Squ2_SfxLenCounter ;load frequency reg based on length left over lsr a ;divide by 2 bcs DecrementSfx2Length ;alter frequency every other frame tay lda PowerUpGrabFreqData-1,y ;use length left over / 2 for frequency offset ldx #$5d ;store reg contents of power-up grab sound ldy #$7f LoadSqu2Regs: jsr PlaySqu2Sfx DecrementSfx2Length: dec Squ2_SfxLenCounter ;decrement length of sfx bne ExSfx2 EmptySfx2Buffer: ldx #$00 ;initialize square 2's sound effects buffer stx <Square2SoundBuffer StopSquare2Sfx: ldx #$0d ;stop playing the sfx stx SND_MASTERCTRL_REG ldx #$0f stx SND_MASTERCTRL_REG ExSfx2: rts Square2SfxHandler: lda <Square2SoundBuffer ;special handling for the 1-up sound to keep it and #Sfx_ExtraLife ;from being interrupted by other sounds on square 2 bne ContinueExtraLife ldy <Square2SoundQueue ;check for sfx in queue beq CheckSfx2Buffer sty <Square2SoundBuffer ;if found, put in buffer and check for the following bmi PlayBowserFall ;bowser fall lsr <Square2SoundQueue bcs PlayCoinGrab ;coin grab lsr <Square2SoundQueue bcs PlayGrowPowerUp ;power-up reveal lsr <Square2SoundQueue bcs PlayGrowVine ;vine grow lsr <Square2SoundQueue bcs PlayBlast ;fireworks/gunfire lsr <Square2SoundQueue bcs PlayTimerTick ;timer tick lsr <Square2SoundQueue bcs PlayPowerUpGrab ;power-up grab lsr <Square2SoundQueue bcs PlayExtraLife ;1-up CheckSfx2Buffer: lda <Square2SoundBuffer ;check for sfx in buffer beq ExS2H ;if not found, exit sub bmi ContinueBowserFall ;bowser fall lsr a bcs Cont_CGrab_TTick ;coin grab lsr a bcs ContinueGrowItems ;power-up reveal lsr a bcs ContinueGrowItems ;vine grow lsr a bcs ContinueBlast ;fireworks/gunfire lsr a bcs Cont_CGrab_TTick ;timer tick lsr a bcs ContinuePowerUpGrab ;power-up grab lsr a bcs ContinueExtraLife ;1-up ExS2H: rts Cont_CGrab_TTick: jmp ContinueCGrabTTick JumpToDecLength2: jmp DecrementSfx2Length PlayBowserFall: lda #$38 ;load length of bowser defeat sound sta Squ2_SfxLenCounter ldy #$c4 ;load contents of reg for bowser defeat sound lda #$18 BlstSJp: bne PBFRegs ContinueBowserFall: lda Squ2_SfxLenCounter ;check for almost near the end cmp #$08 bne DecrementSfx2Length ldy #$a4 ;if so, load the rest of reg contents for bowser defeat sound lda #$5a PBFRegs: ldx #$9f ;the fireworks/gunfire sound shares part of reg contents here EL_LRegs: bne LoadSqu2Regs ;this is an unconditional branch outta here PlayExtraLife: lda #$30 ;load length of 1-up sound sta Squ2_SfxLenCounter ContinueExtraLife: lda Squ2_SfxLenCounter ldx #$03 ;load new tones only every eight frames DivLLoop: lsr a bcs JumpToDecLength2 ;if any bits set here, branch to dec the length dex bne DivLLoop ;do this until all bits checked, if none set, continue tay lda ExtraLifeFreqData-1,y ;load our reg contents ldx #$82 ldy #$7f bne EL_LRegs ;unconditional branch PlayGrowPowerUp: lda #$10 ;load length of power-up reveal sound bne GrowItemRegs PlayGrowVine: lda #$20 ;load length of vine grow sound GrowItemRegs: sta Squ2_SfxLenCounter lda #$7f ;load contents of reg for both sounds directly sta SND_SQUARE2_REG+1 lda #$00 ;start secondary counter for both sounds sta Sfx_SecondaryCounter ContinueGrowItems: inc Sfx_SecondaryCounter ;increment secondary counter for both sounds lda Sfx_SecondaryCounter ;this sound doesn't decrement the usual counter lsr a ;divide by 2 to get the offset tay cpy Squ2_SfxLenCounter ;have we reached the end yet? beq StopGrowItems ;if so, branch to jump, and stop playing sounds lda #$9d ;load contents of other reg directly sta SND_SQUARE2_REG lda PUp_VGrow_FreqData,y ;use secondary counter / 2 as offset for frequency regs jsr SetFreq_Squ2 rts StopGrowItems: jmp EmptySfx2Buffer ;branch to stop playing sounds ;-------------------------------- BrickShatterFreqData: .db $01, $0e, $0e, $0d, $0b, $06, $0c, $0f .db $0a, $09, $03, $0d, $08, $0d, $06, $0c PlayBrickShatter: lda #$20 ;load length of brick shatter sound sta Noise_SfxLenCounter ContinueBrickShatter: lda Noise_SfxLenCounter lsr a ;divide by 2 and check for bit set to use offset bcc DecrementSfx3Length tay ldx BrickShatterFreqData,y ;load reg contents of brick shatter sound lda BrickShatterEnvData,y PlayNoiseSfx: sta SND_NOISE_REG ;play the sfx stx SND_NOISE_REG+2 lda #$18 sta SND_NOISE_REG+3 DecrementSfx3Length: dec Noise_SfxLenCounter ;decrement length of sfx bne ExSfx3 lda #$f0 ;if done, stop playing the sfx sta SND_NOISE_REG lda #$00 sta <NoiseSoundBuffer ExSfx3: rts NoiseSfxHandler: ldy <NoiseSoundQueue ;check for sfx in queue beq CheckNoiseBuffer sty <NoiseSoundBuffer ;if found, put in buffer lsr <NoiseSoundQueue bcs PlayBrickShatter ;brick shatter lsr <NoiseSoundQueue bcs PlayBowserFlame ;bowser flame CheckNoiseBuffer: lda <NoiseSoundBuffer ;check for sfx in buffer beq ExNH ;if not found, exit sub lsr a bcs ContinueBrickShatter ;brick shatter lsr a bcs ContinueBowserFlame ;bowser flame ExNH: rts PlayBowserFlame: lda #$40 ;load length of bowser flame sound sta Noise_SfxLenCounter ContinueBowserFlame: lda Noise_SfxLenCounter lsr a tay ldx #$0f ;load reg contents of bowser flame sound lda BowserFlameEnvData-1,y bne PlayNoiseSfx ;unconditional branch here ;-------------------------------- ContinueMusic: jmp HandleSquare2Music ;if we have music, start with square 2 channel MusicHandler: lda <EventMusicQueue ;check event music queue bne LoadEventMusic lda <AreaMusicQueue ;check area music queue bne LoadAreaMusic lda EventMusicBuffer ;check both buffers ora <AreaMusicBuffer bne ContinueMusic rts ;no music, then leave LoadEventMusic: sta EventMusicBuffer ;copy event music queue contents to buffer cmp #DeathMusic ;is it death music? bne NoStopSfx ;if not, jump elsewhere jsr StopSquare1Sfx ;stop sfx in square 1 and 2 jsr StopSquare2Sfx ;but clear only square 1's sfx buffer NoStopSfx: ldx <AreaMusicBuffer stx AreaMusicBuffer_Alt ;save current area music buffer to be re-obtained later ldy #$00 sty NoteLengthTblAdder ;default value for additional length byte offset sty <AreaMusicBuffer ;clear area music buffer cmp #TimeRunningOutMusic ;is it time running out music? bne FindEventMusicHeader ldx #$08 ;load offset to be added to length byte of header stx NoteLengthTblAdder bne FindEventMusicHeader ;unconditional branch LoadAreaMusic: cmp #$04 ;is it underground music? bne NoStop1 ;no, do not stop square 1 sfx jsr StopSquare1Sfx NoStop1: ldy #$10 ;start counter used only by ground level music GMLoopB: sty GroundMusicHeaderOfs HandleAreaMusicLoopB: ldy #$00 ;clear event music buffer sty EventMusicBuffer sta <AreaMusicBuffer ;copy area music queue contents to buffer cmp #$01 ;is it ground level music? bne FindAreaMusicHeader inc GroundMusicHeaderOfs ;increment but only if playing ground level music ldy GroundMusicHeaderOfs ;is it time to loopback ground level music? cpy #$32 bne LoadHeader ;branch ahead with alternate offset ldy #$11 bne GMLoopB ;unconditional branch FindAreaMusicHeader: ldy #$08 ;load Y for offset of area music sty <MusicOffset_Square2 ;residual instruction here FindEventMusicHeader: iny ;increment Y pointer based on previously loaded queue contents lsr a ;bit shift and increment until we find a set bit for music bcc FindEventMusicHeader LoadHeader: lda MusicHeaderOffsetData,y ;load offset for header tay lda MusicHeaderData,y ;now load the header sta <NoteLenLookupTblOfs lda MusicHeaderData+1,y sta <MusicDataLow lda MusicHeaderData+2,y sta <MusicDataHigh lda MusicHeaderData+3,y sta <MusicOffset_Triangle lda MusicHeaderData+4,y sta <MusicOffset_Square1 lda MusicHeaderData+5,y sta MusicOffset_Noise sta NoiseDataLoopbackOfs lda #$01 ;initialize music note counters sta Squ2_NoteLenCounter sta Squ1_NoteLenCounter sta Tri_NoteLenCounter sta Noise_BeatLenCounter lda #$00 ;initialize music data offset for square 2 sta <MusicOffset_Square2 sta AltRegContentFlag ;initialize alternate control reg data used by square 1 lda #$0b ;disable triangle channel and reenable it sta SND_MASTERCTRL_REG lda #$0f sta SND_MASTERCTRL_REG HandleSquare2Music: dec Squ2_NoteLenCounter ;decrement square 2 note length bne MiscSqu2MusicTasks ;is it time for more data? if not, branch to end tasks ldy <MusicOffset_Square2 ;increment square 2 music offset and fetch data inc <MusicOffset_Square2 lda [MusicData],y beq EndOfMusicData ;if zero, the data is a null terminator bpl Squ2NoteHandler ;if non-negative, data is a note bne Squ2LengthHandler ;otherwise it is length data EndOfMusicData: lda EventMusicBuffer ;check secondary buffer for time running out music cmp #TimeRunningOutMusic bne NotTRO lda AreaMusicBuffer_Alt ;load previously saved contents of primary buffer bne MusicLoopBack ;and start playing the song again if there is one NotTRO: and #VictoryMusic ;check for victory music (the only secondary that loops) bne VictoryMLoopBack lda <AreaMusicBuffer ;check primary buffer for any music except pipe intro and #%01011111 bne MusicLoopBack ;if any area music except pipe intro, music loops lda #$00 ;clear primary and secondary buffers and initialize sta <AreaMusicBuffer ;control regs of square and triangle channels sta EventMusicBuffer sta SND_TRIANGLE_REG lda #$90 sta SND_SQUARE1_REG sta SND_SQUARE2_REG rts MusicLoopBack: jmp HandleAreaMusicLoopB VictoryMLoopBack: jmp LoadEventMusic Squ2LengthHandler: jsr ProcessLengthData ;store length of note sta Squ2_NoteLenBuffer ldy <MusicOffset_Square2 ;fetch another byte (MUST NOT BE LENGTH BYTE!) inc <MusicOffset_Square2 lda [MusicData],y Squ2NoteHandler: ldx <Square2SoundBuffer ;is there a sound playing on this channel? bne SkipFqL1 jsr SetFreq_Squ2 ;no, then play the note beq Rest ;check to see if note is rest jsr LoadControlRegs ;if not, load control regs for square 2 Rest: sta Squ2_EnvelopeDataCtrl ;save contents of A jsr Dump_Sq2_Regs ;dump X and Y into square 2 control regs SkipFqL1: lda Squ2_NoteLenBuffer ;save length in square 2 note counter sta Squ2_NoteLenCounter MiscSqu2MusicTasks: lda <Square2SoundBuffer ;is there a sound playing on square 2? bne HandleSquare1Music lda EventMusicBuffer ;check for death music or d4 set on secondary buffer and #%10010001 ;note that regs for death music or d4 are loaded by default bne HandleSquare1Music ldy Squ2_EnvelopeDataCtrl ;check for contents saved from LoadControlRegs beq NoDecEnv1 dec Squ2_EnvelopeDataCtrl ;decrement unless already zero NoDecEnv1: jsr LoadEnvelopeData ;do a load of envelope data to replace default sta SND_SQUARE2_REG ;based on offset set by first load unless playing ldx #$7f ;death music or d4 set on secondary buffer stx SND_SQUARE2_REG+1 HandleSquare1Music: ldy <MusicOffset_Square1 ;is there a nonzero offset here? beq HandleTriangleMusic ;if not, skip ahead to the triangle channel dec Squ1_NoteLenCounter ;decrement square 1 note length bne MiscSqu1MusicTasks ;is it time for more data? FetchSqu1MusicData: ldy <MusicOffset_Square1 ;increment square 1 music offset and fetch data inc <MusicOffset_Square1 lda [MusicData],y bne Squ1NoteHandler ;if nonzero, then skip this part lda #$83 sta SND_SQUARE1_REG ;store some data into control regs for square 1 lda #$94 ;and fetch another byte of data, used to give sta SND_SQUARE1_REG+1 ;death music its unique sound sta AltRegContentFlag bne FetchSqu1MusicData ;unconditional branch Squ1NoteHandler: jsr AlternateLengthHandler sta Squ1_NoteLenCounter ;save contents of A in square 1 note counter ldy <Square1SoundBuffer ;is there a sound playing on square 1? bne HandleTriangleMusic txa and #%00111110 ;change saved data to appropriate note format jsr SetFreq_Squ1 ;play the note beq SkipCtrlL jsr LoadControlRegs SkipCtrlL: sta Squ1_EnvelopeDataCtrl ;save envelope offset jsr Dump_Squ1_Regs MiscSqu1MusicTasks: lda <Square1SoundBuffer ;is there a sound playing on square 1? bne HandleTriangleMusic lda EventMusicBuffer ;check for death music or d4 set on secondary buffer and #%10010001 bne DeathMAltReg ldy Squ1_EnvelopeDataCtrl ;check saved envelope offset beq NoDecEnv2 dec Squ1_EnvelopeDataCtrl ;decrement unless already zero NoDecEnv2: jsr LoadEnvelopeData ;do a load of envelope data sta SND_SQUARE1_REG ;based on offset set by first load DeathMAltReg: lda AltRegContentFlag ;check for alternate control reg data bne DoAltLoad lda #$7f ;load this value if zero, the alternate value DoAltLoad: sta SND_SQUARE1_REG+1 ;if nonzero, and let's move on HandleTriangleMusic: lda <MusicOffset_Triangle dec Tri_NoteLenCounter ;decrement triangle note length bne HandleNoiseMusic ;is it time for more data? ldy <MusicOffset_Triangle ;increment square 1 music offset and fetch data inc <MusicOffset_Triangle lda [MusicData],y beq LoadTriCtrlReg ;if zero, skip all this and move on to noise bpl TriNoteHandler ;if non-negative, data is note jsr ProcessLengthData ;otherwise, it is length data sta Tri_NoteLenBuffer ;save contents of A lda #$1f sta SND_TRIANGLE_REG ;load some default data for triangle control reg ldy <MusicOffset_Triangle ;fetch another byte inc <MusicOffset_Triangle lda [MusicData],y beq LoadTriCtrlReg ;check once more for nonzero data TriNoteHandler: jsr SetFreq_Tri ldx Tri_NoteLenBuffer ;save length in triangle note counter stx Tri_NoteLenCounter lda EventMusicBuffer and #%01101110 ;check for death music or d4 set on secondary buffer bne NotDOrD4 ;if playing any other secondary, skip primary buffer check lda <AreaMusicBuffer ;check primary buffer for water or castle level music and #%00001010 beq HandleNoiseMusic ;if playing any other primary, or death or d4, go on to noise routine NotDOrD4: txa ;if playing water or castle music or any secondary cmp #$12 ;besides death music or d4 set, check length of note bcs LongN lda EventMusicBuffer ;check for win castle music again if not playing a long note and #EndOfCastleMusic beq MediN lda #$0f ;load value $0f if playing the win castle music and playing a short bne LoadTriCtrlReg ;note, load value $1f if playing water or castle level music or any MediN: lda #$1f ;secondary besides death and d4 except win castle or win castle and playing bne LoadTriCtrlReg ;a short note, and load value $ff if playing a long note on water, castle LongN: lda #$ff ;or any secondary (including win castle) except death and d4 LoadTriCtrlReg: sta SND_TRIANGLE_REG ;save final contents of A into control reg for triangle HandleNoiseMusic: lda <AreaMusicBuffer ;check if playing underground or castle music and #%11110011 beq ExitMusicHandler ;if so, skip the noise routine dec Noise_BeatLenCounter ;decrement noise beat length bne ExitMusicHandler ;is it time for more data? FetchNoiseBeatData: ldy MusicOffset_Noise ;increment noise beat offset and fetch data inc MusicOffset_Noise lda [MusicData],y ;get noise beat data, if nonzero, branch to handle bne NoiseBeatHandler lda NoiseDataLoopbackOfs ;if data is zero, reload original noise beat offset sta MusicOffset_Noise ;and loopback next time around bne FetchNoiseBeatData ;unconditional branch NoiseBeatHandler: jsr AlternateLengthHandler sta Noise_BeatLenCounter ;store length in noise beat counter txa and #%00111110 ;reload data and erase length bits beq SilentBeat ;if no beat data, silence cmp #$30 ;check the beat data and play the appropriate beq LongBeat ;noise accordingly cmp #$20 beq StrongBeat and #%00010000 beq SilentBeat lda #$1c ;short beat data ldx #$03 ldy #$18 bne PlayBeat StrongBeat: lda #$1c ;strong beat data ldx #$0c ldy #$18 bne PlayBeat LongBeat: lda #$1c ;long beat data ldx #$03 ldy #$58 bne PlayBeat SilentBeat: lda #$10 ;silence PlayBeat: sta SND_NOISE_REG ;load beat data into noise regs stx SND_NOISE_REG+2 sty SND_NOISE_REG+3 ExitMusicHandler: rts AlternateLengthHandler: tax ;save a copy of original byte into X ror a ;save LSB from original byte into carry txa ;reload original byte and rotate three times rol a ;turning xx00000x into 00000xxx, with the rol a ;bit in carry as the MSB here rol a ProcessLengthData: and #%00000111 ;clear all but the three LSBs clc adc <$f0 ;add offset loaded from first header byte adc NoteLengthTblAdder ;add extra if time running out music tay lda MusicLengthLookupTbl,y ;load length rts LoadControlRegs: lda EventMusicBuffer ;check secondary buffer for win castle music and #EndOfCastleMusic beq NotECstlM lda #$04 ;this value is only used for win castle music bne AllMus ;unconditional branch NotECstlM: lda <AreaMusicBuffer and #%01111101 ;check primary buffer for water music beq WaterMus lda #$08 ;this is the default value for all other music bne AllMus WaterMus: lda #$28 ;this value is used for water music and all other event music AllMus: ldx #$82 ;load contents of other sound regs for square 2 ldy #$7f rts LoadEnvelopeData: lda EventMusicBuffer ;check secondary buffer for win castle music and #EndOfCastleMusic beq LoadUsualEnvData lda EndOfCastleMusicEnvData,y ;load data from offset for win castle music rts LoadUsualEnvData: lda <AreaMusicBuffer ;check primary buffer for water music and #%01111101 beq LoadWaterEventMusEnvData lda AreaMusicEnvData,y ;load default data from offset for all other music rts LoadWaterEventMusEnvData: lda WaterEventMusEnvData,y ;load data from offset for water music and all other event music rts ;-------------------------------- ;music header offsets MusicHeaderData: .db $00 ; .db DeathMusHdr-MHD ;event music ; .db GameOverMusHdr-MHD ; .db VictoryMusHdr-MHD ; .db WinCastleMusHdr-MHD ; .db GameOverMusHdr-MHD ; .db EndOfLevelMusHdr-MHD ; .db TimeRunningOutHdr-MHD ; .db SilenceHdr-MHD ; .db GroundLevelPart1Hdr-MHD ;area music ; .db WaterMusHdr-MHD ; .db UndergroundMusHdr-MHD ; .db CastleMusHdr-MHD ; .db Star_CloudHdr-MHD ; .db GroundLevelLeadInHdr-MHD ; .db Star_CloudHdr-MHD ; .db SilenceHdr-MHD ; .db GroundLevelLeadInHdr-MHD ;ground level music layout ; .db GroundLevelPart1Hdr-MHD, GroundLevelPart1Hdr-MHD ; .db GroundLevelPart2AHdr-MHD, GroundLevelPart2BHdr-MHD, GroundLevelPart2AHdr-MHD, GroundLevelPart2CHdr-MHD ; .db GroundLevelPart2AHdr-MHD, GroundLevelPart2BHdr-MHD, GroundLevelPart2AHdr-MHD, GroundLevelPart2CHdr-MHD ; .db GroundLevelPart3AHdr-MHD, GroundLevelPart3BHdr-MHD, GroundLevelPart3AHdr-MHD, GroundLevelLeadInHdr-MHD ; .db GroundLevelPart1Hdr-MHD, GroundLevelPart1Hdr-MHD ; .db GroundLevelPart4AHdr-MHD, GroundLevelPart4BHdr-MHD, GroundLevelPart4AHdr-MHD, GroundLevelPart4CHdr-MHD ; .db GroundLevelPart4AHdr-MHD, GroundLevelPart4BHdr-MHD, GroundLevelPart4AHdr-MHD, GroundLevelPart4CHdr-MHD ; .db GroundLevelPart3AHdr-MHD, GroundLevelPart3BHdr-MHD, GroundLevelPart3AHdr-MHD, GroundLevelLeadInHdr-MHD ; .db GroundLevelPart4AHdr-MHD, GroundLevelPart4BHdr-MHD, GroundLevelPart4AHdr-MHD, GroundLevelPart4CHdr-MHD ;music headers ;header format is as follows: ;1 byte - length byte offset ;2 bytes - music data address ;1 byte - triangle data offset ;1 byte - square 1 data offset ;1 byte - noise data offset (not used by secondary music) TimeRunningOutHdr: .db $08, LOW_TimeRunOutMusData, HIGH_TimeRunOutMusData, $27, $18 Star_CloudHdr: .db $20, LOW_Star_CloudMData, HIGH_Star_CloudMData, $2e, $1a, $40 EndOfLevelMusHdr: .db $20, LOW_WinLevelMusData, HIGH_WinLevelMusData, $3d, $21 ResidualHeaderData: .db $20, $c4, $fc, $3f, $1d UndergroundMusHdr: .db $18, LOW_UndergroundMusData, HIGH_UndergroundMusData, $00, $00 SilenceHdr: .db $08, LOW_SilenceData, HIGH_SilenceData, $00 CastleMusHdr: .db $00, LOW_CastleMusData, HIGH_CastleMusData, $93, $62 VictoryMusHdr: .db $10, LOW_VictoryMusData, HIGH_VictoryMusData, $24, $14 GameOverMusHdr: .db $18, LOW_GameOverMusData, HIGH_GameOverMusData, $1e, $14 WaterMusHdr: .db $08, LOW_WaterMusData, HIGH_WaterMusData, $a0, $70, $68 WinCastleMusHdr: .db $08, LOW_EndOfCastleMusData, HIGH_EndOfCastleMusData, $4c, $24 GroundLevelPart1Hdr: .db $18, LOW_GroundM_P1Data, HIGH_GroundM_P1Data, $2d, $1c, $b8 GroundLevelPart2AHdr: .db $18, LOW_GroundM_P2AData, HIGH_GroundM_P2AData, $20, $12, $70 GroundLevelPart2BHdr: .db $18, LOW_GroundM_P2BData, HIGH_GroundM_P2BData, $1b, $10, $44 GroundLevelPart2CHdr: .db $18, LOW_GroundM_P2CData, HIGH_GroundM_P2CData, $11, $0a, $1c GroundLevelPart3AHdr: .db $18, LOW_GroundM_P3AData, HIGH_GroundM_P3AData, $2d, $10, $58 GroundLevelPart3BHdr: .db $18, LOW_GroundM_P3BData, HIGH_GroundM_P3BData, $14, $0d, $3f GroundLevelLeadInHdr: .db $18, LOW_GroundMLdInData, HIGH_GroundMLdInData, $15, $0d, $21 GroundLevelPart4AHdr: .db $18, LOW_GroundM_P4AData, HIGH_GroundM_P4AData, $18, $10, $7a GroundLevelPart4BHdr: .db $18, LOW_GroundM_P4BData, HIGH_GroundM_P4BData, $19, $0f, $54 GroundLevelPart4CHdr: .db $18, LOW_GroundM_P4CData, HIGH_GroundM_P4CData, $1e, $12, $2b DeathMusHdr: .db $18, LOW_DeathMusData, HIGH_DeathMusData, $1e, $0f, $2d ;-------------------------------- ;MUSIC DATA ;square 2/triangle format ;d7 - length byte flag (0-note, 1-length) ;if d7 is set to 0 and d6-d0 is nonzero: ;d6-d0 - note offset in frequency look-up table (must be even) ;if d7 is set to 1: ;d6-d3 - unused ;d2-d0 - length offset in length look-up table ;value of $00 in square 2 data is used as null terminator, affects all sound channels ;value of $00 in triangle data causes routine to skip note ;square 1 format ;d7-d6, d0 - length offset in length look-up table (bit order is d0,d7,d6) ;d5-d1 - note offset in frequency look-up table ;value of $00 in square 1 data is flag alternate control reg data to be loaded ;noise format ;d7-d6, d0 - length offset in length look-up table (bit order is d0,d7,d6) ;d5-d4 - beat type (0 - rest, 1 - short, 2 - strong, 3 - long) ;d3-d1 - unused ;value of $00 in noise data is used as null terminator, affects only noise ;all music data is organized into sections (unless otherwise stated): ;square 2, square 1, triangle, noise Star_CloudMData: .db $84, $2c, $2c, $2c, $82, $04, $2c, $04, $85, $2c, $84, $2c, $2c .db $2a, $2a, $2a, $82, $04, $2a, $04, $85, $2a, $84, $2a, $2a, $00 .db $1f, $1f, $1f, $98, $1f, $1f, $98, $9e, $98, $1f .db $1d, $1d, $1d, $94, $1d, $1d, $94, $9c, $94, $1d .db $86, $18, $85, $26, $30, $84, $04, $26, $30 .db $86, $14, $85, $22, $2c, $84, $04, $22, $2c .db $21, $d0, $c4, $d0, $31, $d0, $c4, $d0, $00 GroundM_P1Data: .db $85, $2c, $22, $1c, $84, $26, $2a, $82, $28, $26, $04 .db $87, $22, $34, $3a, $82, $40, $04, $36, $84, $3a, $34 .db $82, $2c, $30, $85, $2a SilenceData: .db $00 .db $5d, $55, $4d, $15, $19, $96, $15, $d5, $e3, $eb .db $2d, $a6, $2b, $27, $9c, $9e, $59 .db $85, $22, $1c, $14, $84, $1e, $22, $82, $20, $1e, $04, $87 .db $1c, $2c, $34, $82, $36, $04, $30, $34, $04, $2c, $04, $26 .db $2a, $85, $22 GroundM_P2AData: .db $84, $04, $82, $3a, $38, $36, $32, $04, $34 .db $04, $24, $26, $2c, $04, $26, $2c, $30, $00 .db $05, $b4, $b2, $b0, $2b, $ac, $84 .db $9c, $9e, $a2, $84, $94, $9c, $9e .db $85, $14, $22, $84, $2c, $85, $1e .db $82, $2c, $84, $2c, $1e GroundM_P2BData: .db $84, $04, $82, $3a, $38, $36, $32, $04, $34 .db $04, $64, $04, $64, $86, $64, $00 .db $05, $b4, $b2, $b0, $2b, $ac, $84 .db $37, $b6, $b6, $45 .db $85, $14, $1c, $82, $22, $84, $2c .db $4e, $82, $4e, $84, $4e, $22 GroundM_P2CData: .db $84, $04, $85, $32, $85, $30, $86, $2c, $04, $00 .db $05, $a4, $05, $9e, $05, $9d, $85 .db $84, $14, $85, $24, $28, $2c, $82 .db $22, $84, $22, $14 .db $21, $d0, $c4, $d0, $31, $d0, $c4, $d0, $00 GroundM_P3AData: .db $82, $2c, $84, $2c, $2c, $82, $2c, $30 .db $04, $34, $2c, $04, $26, $86, $22, $00 .db $a4, $25, $25, $a4, $29, $a2, $1d, $9c, $95 GroundM_P3BData: .db $82, $2c, $2c, $04, $2c, $04, $2c, $30, $85, $34, $04, $04, $00 .db $a4, $25, $25, $a4, $a8, $63, $04 ;triangle data used by both sections of third part .db $85, $0e, $1a, $84, $24, $85, $22, $14, $84, $0c GroundMLdInData: .db $82, $34, $84, $34, $34, $82, $2c, $84, $34, $86, $3a, $04, $00 .db $a0, $21, $21, $a0, $21, $2b, $05, $a3 .db $82, $18, $84, $18, $18, $82, $18, $18, $04, $86, $3a, $22 ;noise data used by lead-in and third part sections .db $31, $90, $31, $90, $31, $71, $31, $90, $90, $90, $00 GroundM_P4AData: .db $82, $34, $84, $2c, $85, $22, $84, $24 .db $82, $26, $36, $04, $36, $86, $26, $00 .db $ac, $27, $5d, $1d, $9e, $2d, $ac, $9f .db $85, $14, $82, $20, $84, $22, $2c .db $1e, $1e, $82, $2c, $2c, $1e, $04 GroundM_P4BData: .db $87, $2a, $40, $40, $40, $3a, $36 .db $82, $34, $2c, $04, $26, $86, $22, $00 .db $e3, $f7, $f7, $f7, $f5, $f1, $ac, $27, $9e, $9d .db $85, $18, $82, $1e, $84, $22, $2a .db $22, $22, $82, $2c, $2c, $22, $04 DeathMusData: .db $86, $04 ;death music share data with fourth part c of ground level music GroundM_P4CData: .db $82, $2a, $36, $04, $36, $87, $36, $34, $30, $86, $2c, $04, $00 .db $00, $68, $6a, $6c, $45 ;death music only .db $a2, $31, $b0, $f1, $ed, $eb, $a2, $1d, $9c, $95 .db $86, $04 ;death music only .db $85, $22, $82, $22, $87, $22, $26, $2a, $84, $2c, $22, $86, $14 ;noise data used by fourth part sections .db $51, $90, $31, $11, $00 CastleMusData: .db $80, $22, $28, $22, $26, $22, $24, $22, $26 .db $22, $28, $22, $2a, $22, $28, $22, $26 .db $22, $28, $22, $26, $22, $24, $22, $26 .db $22, $28, $22, $2a, $22, $28, $22, $26 .db $20, $26, $20, $24, $20, $26, $20, $28 .db $20, $26, $20, $28, $20, $26, $20, $24 .db $20, $26, $20, $24, $20, $26, $20, $28 .db $20, $26, $20, $28, $20, $26, $20, $24 .db $28, $30, $28, $32, $28, $30, $28, $2e .db $28, $30, $28, $2e, $28, $2c, $28, $2e .db $28, $30, $28, $32, $28, $30, $28, $2e .db $28, $30, $28, $2e, $28, $2c, $28, $2e, $00 .db $04, $70, $6e, $6c, $6e, $70, $72, $70, $6e .db $70, $6e, $6c, $6e, $70, $72, $70, $6e .db $6e, $6c, $6e, $70, $6e, $70, $6e, $6c .db $6e, $6c, $6e, $70, $6e, $70, $6e, $6c .db $76, $78, $76, $74, $76, $74, $72, $74 .db $76, $78, $76, $74, $76, $74, $72, $74 .db $84, $1a, $83, $18, $20, $84, $1e, $83, $1c, $28 .db $26, $1c, $1a, $1c GameOverMusData: .db $82, $2c, $04, $04, $22, $04, $04, $84, $1c, $87 .db $26, $2a, $26, $84, $24, $28, $24, $80, $22, $00 .db $9c, $05, $94, $05, $0d, $9f, $1e, $9c, $98, $9d .db $82, $22, $04, $04, $1c, $04, $04, $84, $14 .db $86, $1e, $80, $16, $80, $14 TimeRunOutMusData: .db $81, $1c, $30, $04, $30, $30, $04, $1e, $32, $04, $32, $32 .db $04, $20, $34, $04, $34, $34, $04, $36, $04, $84, $36, $00 .db $46, $a4, $64, $a4, $48, $a6, $66, $a6, $4a, $a8, $68, $a8 .db $6a, $44, $2b .db $81, $2a, $42, $04, $42, $42, $04, $2c, $64, $04, $64, $64 .db $04, $2e, $46, $04, $46, $46, $04, $22, $04, $84, $22 WinLevelMusData: .db $87, $04, $06, $0c, $14, $1c, $22, $86, $2c, $22 .db $87, $04, $60, $0e, $14, $1a, $24, $86, $2c, $24 .db $87, $04, $08, $10, $18, $1e, $28, $86, $30, $30 .db $80, $64, $00 .db $cd, $d5, $dd, $e3, $ed, $f5, $bb, $b5, $cf, $d5 .db $db, $e5, $ed, $f3, $bd, $b3, $d1, $d9, $df, $e9 .db $f1, $f7, $bf, $ff, $ff, $ff, $34 .db $00 ;unused byte .db $86, $04, $87, $14, $1c, $22, $86, $34, $84, $2c .db $04, $04, $04, $87, $14, $1a, $24, $86, $32, $84 .db $2c, $04, $86, $04, $87, $18, $1e, $28, $86, $36 .db $87, $30, $30, $30, $80, $2c ;square 2 and triangle use the same data, square 1 is unused UndergroundMusData: .db $82, $14, $2c, $62, $26, $10, $28, $80, $04 .db $82, $14, $2c, $62, $26, $10, $28, $80, $04 .db $82, $08, $1e, $5e, $18, $60, $1a, $80, $04 .db $82, $08, $1e, $5e, $18, $60, $1a, $86, $04 .db $83, $1a, $18, $16, $84, $14, $1a, $18, $0e, $0c .db $16, $83, $14, $20, $1e, $1c, $28, $26, $87 .db $24, $1a, $12, $10, $62, $0e, $80, $04, $04 .db $00 ;noise data directly follows square 2 here unlike in other songs WaterMusData: .db $82, $18, $1c, $20, $22, $26, $28 .db $81, $2a, $2a, $2a, $04, $2a, $04, $83, $2a, $82, $22 .db $86, $34, $32, $34, $81, $04, $22, $26, $2a, $2c, $30 .db $86, $34, $83, $32, $82, $36, $84, $34, $85, $04, $81, $22 .db $86, $30, $2e, $30, $81, $04, $22, $26, $2a, $2c, $2e .db $86, $30, $83, $22, $82, $36, $84, $34, $85, $04, $81, $22 .db $86, $3a, $3a, $3a, $82, $3a, $81, $40, $82, $04, $81, $3a .db $86, $36, $36, $36, $82, $36, $81, $3a, $82, $04, $81, $36 .db $86, $34, $82, $26, $2a, $36 .db $81, $34, $34, $85, $34, $81, $2a, $86, $2c, $00 .db $84, $90, $b0, $84, $50, $50, $b0, $00 .db $98, $96, $94, $92, $94, $96, $58, $58, $58, $44 .db $5c, $44, $9f, $a3, $a1, $a3, $85, $a3, $e0, $a6 .db $23, $c4, $9f, $9d, $9f, $85, $9f, $d2, $a6, $23 .db $c4, $b5, $b1, $af, $85, $b1, $af, $ad, $85, $95 .db $9e, $a2, $aa, $6a, $6a, $6b, $5e, $9d .db $84, $04, $04, $82, $22, $86, $22 .db $82, $14, $22, $2c, $12, $22, $2a, $14, $22, $2c .db $1c, $22, $2c, $14, $22, $2c, $12, $22, $2a, $14 .db $22, $2c, $1c, $22, $2c, $18, $22, $2a, $16, $20 .db $28, $18, $22, $2a, $12, $22, $2a, $18, $22, $2a .db $12, $22, $2a, $14, $22, $2c, $0c, $22, $2c, $14, $22, $34, $12 .db $22, $30, $10, $22, $2e, $16, $22, $34, $18, $26 .db $36, $16, $26, $36, $14, $26, $36, $12, $22, $36 .db $5c, $22, $34, $0c, $22, $22, $81, $1e, $1e, $85, $1e .db $81, $12, $86, $14 EndOfCastleMusData: .db $81, $2c, $22, $1c, $2c, $22, $1c, $85, $2c, $04 .db $81, $2e, $24, $1e, $2e, $24, $1e, $85, $2e, $04 .db $81, $32, $28, $22, $32, $28, $22, $85, $32 .db $87, $36, $36, $36, $84, $3a, $00 .db $5c, $54, $4c, $5c, $54, $4c .db $5c, $1c, $1c, $5c, $5c, $5c, $5c .db $5e, $56, $4e, $5e, $56, $4e .db $5e, $1e, $1e, $5e, $5e, $5e, $5e .db $62, $5a, $50, $62, $5a, $50 .db $62, $22, $22, $62, $e7, $e7, $e7, $2b .db $86, $14, $81, $14, $80, $14, $14, $81, $14, $14, $14, $14 .db $86, $16, $81, $16, $80, $16, $16, $81, $16, $16, $16, $16 .db $81, $28, $22, $1a, $28, $22, $1a, $28, $80, $28, $28 .db $81, $28, $87, $2c, $2c, $2c, $84, $30 VictoryMusData: .db $83, $04, $84, $0c, $83, $62, $10, $84, $12 .db $83, $1c, $22, $1e, $22, $26, $18, $1e, $04, $1c, $00 .db $e3, $e1, $e3, $1d, $de, $e0, $23 .db $ec, $75, $74, $f0, $f4, $f6, $ea, $31, $2d .db $83, $12, $14, $04, $18, $1a, $1c, $14 .db $26, $22, $1e, $1c, $18, $1e, $22, $0c, $14 ;unused space .db $ff, $ff, $ff FreqRegLookupTbl: .db $00, $88, $00, $2f, $00, $00 .db $02, $a6, $02, $80, $02, $5c, $02, $3a .db $02, $1a, $01, $df, $01, $c4, $01, $ab .db $01, $93, $01, $7c, $01, $67, $01, $53 .db $01, $40, $01, $2e, $01, $1d, $01, $0d .db $00, $fe, $00, $ef, $00, $e2, $00, $d5 .db $00, $c9, $00, $be, $00, $b3, $00, $a9 .db $00, $a0, $00, $97, $00, $8e, $00, $86 .db $00, $77, $00, $7e, $00, $71, $00, $54 .db $00, $64, $00, $5f, $00, $59, $00, $50 .db $00, $47, $00, $43, $00, $3b, $00, $35 .db $00, $2a, $00, $23, $04, $75, $03, $57 .db $02, $f9, $02, $cf, $01, $fc, $00, $6a MusicLengthLookupTbl: .db $05, $0a, $14, $28, $50, $1e, $3c, $02 .db $04, $08, $10, $20, $40, $18, $30, $0c .db $03, $06, $0c, $18, $30, $12, $24, $08 .db $36, $03, $09, $06, $12, $1b, $24, $0c .db $24, $02, $06, $04, $0c, $12, $18, $08 .db $12, $01, $03, $02, $06, $09, $0c, $04 EndOfCastleMusicEnvData: .db $98, $99, $9a, $9b AreaMusicEnvData: .db $90, $94, $94, $95, $95, $96, $97, $98 WaterEventMusEnvData: .db $90, $91, $92, $92, $93, $93, $93, $94 .db $94, $94, $94, $94, $94, $95, $95, $95 .db $95, $95, $95, $96, $96, $96, $96, $96 .db $96, $96, $96, $96, $96, $96, $96, $96 .db $96, $96, $96, $96, $95, $95, $94, $93 BowserFlameEnvData: .db $15, $16, $16, $17, $17, $18, $19, $19 .db $1a, $1a, $1c, $1d, $1d, $1e, $1e, $1f .db $1f, $1f, $1f, $1e, $1d, $1c, $1e, $1f .db $1f, $1e, $1d, $1c, $1a, $18, $16, $14 BrickShatterEnvData: .db $15, $16, $16, $17, $17, $18, $19, $19 .db $1a, $1a, $1c, $1d, $1d, $1e, $1e, $1f ;------------------------------------------------------------------------------------- ;INTERRUPT VECTORS .org $FFFA .dw NonMaskableInterrupt .dw Start .dw $fff0 ;unused
programs/oeis/002/A002327.asm
neoneye/loda
22
22692
<gh_stars>10-100 ; A002327: Primes of form n^2 - n - 1. ; 5,11,19,29,41,71,89,109,131,181,239,271,379,419,461,599,701,811,929,991,1259,1481,1559,1721,1979,2069,2161,2351,2549,2861,2969,3079,3191,3539,3659,4159,4289,4421,4691,4969,5851,6971,7309,7481,8009,8741,8929,9311,10099,10301,10711,13109,13339,14519,15749,16001,17029,17291,18089,19181,19739,20021,20879,21169,22051,22349,23561,23869,24179,25121,25439,25759,26731,27059,28729,29411,30449,31151,32579,32941,34039,34781,35531,36671,37441,38219,38611,39799,41411,42641,43889,46439,47741,48179,48619,50849,53129,53591,54521,55931 seq $0,88502 ; Numbers n such that (n^2 - 5)/4 is prime. pow $0,2 sub $0,25 div $0,4 add $0,5
sources/flac-reader.adb
HeisenbugLtd/flac-ada
5
4394
<filename>sources/flac-reader.adb ------------------------------------------------------------------------------ -- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. ------------------------------------------------------------------------------ pragma License (Unrestricted); with Ada.Streams.Stream_IO; with Flac.Debug; with Flac.Frames; with Flac.Headers.Meta_Data; with Flac.Headers.Stream_Info; with Flac.Types; with SPARK_Stream_IO; package body Flac.Reader with SPARK_Mode => On is --------------------------------------------------------------------------- -- Local helper subroutines. --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- Validate_Header -- -- Tries reading the first block of data from the file stream and checks -- if a valid flac file signature could be found. --------------------------------------------------------------------------- procedure Validate_Header (Flac_File : in out File_Handle) with Pre => (Is_Open (Handle => Flac_File) and then Flac_File.Error = No_Error), Post => (case Flac_File.Error.Main is when None => Is_Open (Handle => Flac_File), when others => not Is_Open (Handle => Flac_File)), Depends => (Flac_File => Flac_File); --------------------------------------------------------------------------- -- Read_Metadata_Block --------------------------------------------------------------------------- procedure Read_Metadata_Block (Flac_File : in out File_Handle; Meta_Data : out Headers.Meta_Data.T) with Relaxed_Initialization => Meta_Data, Pre => (Is_Open (Handle => Flac_File) and then Flac_File.Error = No_Error), Post => (case Flac_File.Error.Main is when None => Is_Open (Handle => Flac_File) and then Meta_Data'Initialized, when others => not Is_Open (Handle => Flac_File)), Depends => (Flac_File => Flac_File, Meta_Data => Flac_File); --------------------------------------------------------------------------- -- Read_Stream_Info -- -- Reads basic stream info from current position. -- Requires to have read a meta data block with Info = Stream_Info before. --------------------------------------------------------------------------- procedure Read_Stream_Info (Flac_File : in out File_Handle; Meta_Data : out Headers.Meta_Data.T) with Relaxed_Initialization => Meta_Data, Pre => (Is_Open (Handle => Flac_File) and then Flac_File.Error = No_Error), Post => (case Flac_File.Error.Main is when None => Is_Open (Handle => Flac_File) and then Meta_Data'Initialized, when others => not Is_Open (Handle => Flac_File)), Depends => (Flac_File => Flac_File, Meta_Data => Flac_File); --------------------------------------------------------------------------- -- Read_Metadata_Block --------------------------------------------------------------------------- procedure Read_Metadata_Block (Flac_File : in out File_Handle; Meta_Data : out Headers.Meta_Data.T) is Error : Boolean; begin Headers.Meta_Data.Read (File => Flac_File.File, Item => Meta_Data, Error => Error); if Error then Close (Flac_File => Flac_File); Flac_File.Error := Error_Type'(Main => Not_A_Flac_File, Sub => Corrupt_Meta_Data); return; end if; end Read_Metadata_Block; --------------------------------------------------------------------------- -- Read_Stream_Info --------------------------------------------------------------------------- procedure Read_Stream_Info (Flac_File : in out File_Handle; Meta_Data : out Headers.Meta_Data.T) is Stream_Info : Headers.Stream_Info.T; Error : Boolean; use type Types.Block_Type; use type Types.Length_24; begin Read_Metadata_Block (Flac_File => Flac_File, Meta_Data => Meta_Data); if Flac_File.Error.Main /= None then return; end if; if Meta_Data.Block_Type /= Types.Stream_Info or else Meta_Data.Length /= Headers.Stream_Info.Stream_Info_Length then Close (Flac_File => Flac_File); Flac_File.Error := Error_Type'(Main => Not_A_Flac_File, Sub => Corrupt_Stream_Info); return; end if; Headers.Stream_Info.Read (File => Flac_File.File, Item => Stream_Info, Error => Error); if Error then Close (Flac_File => Flac_File); Flac_File.Error := Error_Type'(Main => Not_A_Flac_File, Sub => Invalid_Stream_Info); return; end if; Flac_File.Properties := Stream_Properties'(Num_Channels => Stream_Info.Num_Channels, Bits_Per_Sample => Stream_Info.Bits_Per_Sample, Sample_Rate => Stream_Info.Sample_Rate, Num_Samples => Stream_Info.Total_Samples); end Read_Stream_Info; --------------------------------------------------------------------------- -- Validate_Header --------------------------------------------------------------------------- procedure Validate_Header (Flac_File : in out File_Handle) is Header : Headers.Four_CC; Error : Boolean; use type Ada.Streams.Stream_Element_Array; begin SPARK_Stream_IO.Read (File => Flac_File.File, Item => Header, Error => Error); -- Check header. if Error or else Header /= Headers.Stream then Close (Flac_File => Flac_File); Flac_File.Error := Error_Type'(Main => Not_A_Flac_File, Sub => Header_Not_Found); end if; end Validate_Header; --------------------------------------------------------------------------- -- Close --------------------------------------------------------------------------- procedure Close (Flac_File : in out File_Handle) is begin SPARK_Stream_IO.Close (Flac_File.File); Flac_File.Open := False; end Close; --------------------------------------------------------------------------- -- Open --------------------------------------------------------------------------- procedure Open (File : in String; Flac_File : in out File_Handle) is Meta_Data : Headers.Meta_Data.T; Error : Boolean; begin -- Try opening the actual file. SPARK_Stream_IO.Open (File => Flac_File.File, Name => File, Error => Error); if Error then Flac_File.Error := Error_Type'(Main => Open_Error, Sub => None); return; end if; Flac_File.Open := True; -- For precondition of "Close" below. Flac_File.Error := No_Error; Validate_Header (Flac_File => Flac_File); if Flac_File.Error /= No_Error then return; end if; -- Header check went fine, now we should go for the first Stream_Info -- meta data block. This is mandatory according to the spec. Read_Stream_Info (Flac_File => Flac_File, Meta_Data => Meta_Data); if Flac_File.Error /= No_Error then return; end if; -- There may be more meta data blocks. For now, we just skip them. Skip_All_Meta_Data : declare use type Ada.Streams.Stream_IO.Count; use type Types.Block_Type; begin while not Meta_Data.Last loop pragma Loop_Invariant (Get_Error (Handle => Flac_File) = No_Error and then Is_Open (Handle => Flac_File)); Read_Metadata_Block (Flac_File => Flac_File, Meta_Data => Meta_Data); if Flac_File.Error /= No_Error then return; end if; if Meta_Data.Block_Type = Types.Invalid then Close (Flac_File => Flac_File); Flac_File.Error := Error_Type'(Main => Not_A_Flac_File, Sub => Invalid_Meta_Data); return; end if; SPARK_Stream_IO.Skip (File => Flac_File.File, Num_Elements => Ada.Streams.Stream_IO.Count (Meta_Data.Length), Error => Error); if Error then Close (Flac_File => Flac_File); Flac_File.Error := Error_Type'(Main => Not_A_Flac_File, Sub => Corrupt_Meta_Data); return; end if; end loop; end Skip_All_Meta_Data; -- Now the file should be positioned at the first frame. declare Frame : Frames.T; begin Frames.Read (File => Flac_File.File, Sample_Rate => Sample_Rate (Handle => Flac_File), Sample_Size => Bits_Per_Sample (Handle => Flac_File), Item => Frame, Error => Error); if Error then Flac.Debug.Print_Frame_Info (Frame => Frame); else Flac.Debug.Print_Frame_Info (Frame => Frame); end if; end; end Open; end Flac.Reader;
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_nxos/CiscoNxos_ipv6_prefix_list.g4
zabrewer/batfish
763
6303
parser grammar CiscoNxos_ipv6_prefix_list; import CiscoNxos_common; options { tokenVocab = CiscoNxosLexer; } ipv6_prefix_list : PREFIX_LIST name = ip_prefix_list_name ( pl6_action | pl6_description ) ; pl6_action : ( SEQ num = ip_prefix_list_line_number )? action = line_action prefix = ipv6_prefix ( EQ eq = ipv6_prefix_list_line_prefix_length | (GE ge = ipv6_prefix_list_line_prefix_length)? (LE le = ipv6_prefix_list_line_prefix_length)? ) ( MASK mask = ipv6_address )? NEWLINE ; ipv6_prefix_list_line_prefix_length : // 1-128 UINT8 ; pl6_description : DESCRIPTION text = ip_prefix_list_description NEWLINE ;
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1881.asm
ljhsiun2/medusa
9
103325
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0xbe7, %rbx inc %rdx mov (%rbx), %r10w nop inc %rax lea addresses_WC_ht+0x158d3, %rsi nop dec %r13 mov $0x6162636465666768, %r14 movq %r14, %xmm4 vmovups %ymm4, (%rsi) nop nop nop nop and $38298, %r10 lea addresses_WT_ht+0x342d, %r14 nop nop nop nop cmp $21602, %rsi movb $0x61, (%r14) cmp $26616, %r10 lea addresses_normal_ht+0x3423, %rbx clflush (%rbx) nop nop nop cmp %rsi, %rsi mov (%rbx), %edx nop cmp %rsi, %rsi lea addresses_WT_ht+0xd943, %rsi lea addresses_WT_ht+0x16953, %rdi nop nop sub $18477, %r14 mov $50, %rcx rep movsl nop nop nop add %rdi, %rdi lea addresses_D_ht+0xd2c3, %rcx nop sub $9448, %r14 mov (%rcx), %r10 sub $22050, %r10 lea addresses_A_ht+0x17093, %rsi lea addresses_normal_ht+0x1e553, %rdi clflush (%rsi) nop nop nop xor %rbx, %rbx mov $21, %rcx rep movsw nop nop nop sub $30518, %rdx lea addresses_normal_ht+0x11d33, %r10 nop nop nop nop nop cmp $30708, %rcx vmovups (%r10), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %r13 nop nop nop nop cmp %r14, %r14 lea addresses_normal_ht+0x4f13, %rbx nop nop and %rsi, %rsi movl $0x61626364, (%rbx) nop cmp $28508, %rbx lea addresses_normal_ht+0x9253, %rax nop and $9201, %rcx mov $0x6162636465666768, %rsi movq %rsi, (%rax) nop nop inc %rax lea addresses_WT_ht+0x171f3, %rax nop nop cmp $20099, %r14 mov $0x6162636465666768, %rdi movq %rdi, (%rax) nop nop nop and $63785, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r14 push %rbp push %rcx push %rdi // Load lea addresses_normal+0xbbd3, %r14 nop cmp %rdi, %rdi mov (%r14), %r12 nop nop nop sub $18499, %r10 // Load lea addresses_WT+0x13253, %rdi nop nop nop nop nop cmp %r11, %r11 mov (%rdi), %r14 cmp %rdi, %rdi // Store lea addresses_D+0x1ba53, %r10 nop and $49, %rcx movb $0x51, (%r10) nop nop nop nop sub $52535, %rdi // Faulty Load lea addresses_D+0x1c253, %r14 nop nop cmp %r11, %r11 mov (%r14), %r10w lea oracles, %r11 and $0xff, %r10 shlq $12, %r10 mov (%r11,%r10,1), %r10 pop %rdi pop %rcx pop %rbp pop %r14 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
Validation/pyFrame3DD-master/gcc-master/gcc/ada/bindo-units.adb
djamal2727/Main-Bearing-Analytical-Model
0
17987
<filename>Validation/pyFrame3DD-master/gcc-master/gcc/ada/bindo-units.adb ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- B I N D O . U N I T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2019-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. -- -- -- ------------------------------------------------------------------------------ with Bindo.Writers; use Bindo.Writers; use Bindo.Writers.Phase_Writers; package body Bindo.Units is ------------------- -- Signature set -- ------------------- package Signature_Sets is new Membership_Sets (Element_Type => Invocation_Signature_Id, "=" => "=", Hash => Hash_Invocation_Signature); ----------------- -- Global data -- ----------------- -- The following set stores all invocation signatures that appear in -- elaborable units. Elaborable_Constructs : Signature_Sets.Membership_Set := Signature_Sets.Nil; -- The following set stores all units the need to be elaborated Elaborable_Units : Unit_Sets.Membership_Set := Unit_Sets.Nil; ----------------------- -- Local subprograms -- ----------------------- function Corresponding_Unit (Nam : Name_Id) return Unit_Id; pragma Inline (Corresponding_Unit); -- Obtain the unit which corresponds to name Nam function Is_Stand_Alone_Library_Unit (U_Id : Unit_Id) return Boolean; pragma Inline (Is_Stand_Alone_Library_Unit); -- Determine whether unit U_Id is part of a stand-alone library procedure Process_Invocation_Construct (IC_Id : Invocation_Construct_Id); pragma Inline (Process_Invocation_Construct); -- Process invocation construct IC_Id by adding its signature to set -- Elaborable_Constructs_Set. procedure Process_Invocation_Constructs (U_Id : Unit_Id); pragma Inline (Process_Invocation_Constructs); -- Process all invocation constructs of unit U_Id for classification -- purposes. procedure Process_Unit (U_Id : Unit_Id); pragma Inline (Process_Unit); -- Process unit U_Id for unit classification purposes ------------------------------ -- Collect_Elaborable_Units -- ------------------------------ procedure Collect_Elaborable_Units is begin Start_Phase (Unit_Collection); for U_Id in ALI.Units.First .. ALI.Units.Last loop Process_Unit (U_Id); end loop; End_Phase (Unit_Collection); end Collect_Elaborable_Units; ------------------------ -- Corresponding_Body -- ------------------------ function Corresponding_Body (U_Id : Unit_Id) return Unit_Id is pragma Assert (Present (U_Id)); U_Rec : Unit_Record renames ALI.Units.Table (U_Id); begin pragma Assert (U_Rec.Utype = Is_Spec); return U_Id - 1; end Corresponding_Body; ------------------------ -- Corresponding_Spec -- ------------------------ function Corresponding_Spec (U_Id : Unit_Id) return Unit_Id is pragma Assert (Present (U_Id)); U_Rec : Unit_Record renames ALI.Units.Table (U_Id); begin pragma Assert (U_Rec.Utype = Is_Body); return U_Id + 1; end Corresponding_Spec; ------------------------ -- Corresponding_Unit -- ------------------------ function Corresponding_Unit (FNam : File_Name_Type) return Unit_Id is begin return Corresponding_Unit (Name_Id (FNam)); end Corresponding_Unit; ------------------------ -- Corresponding_Unit -- ------------------------ function Corresponding_Unit (Nam : Name_Id) return Unit_Id is begin return Unit_Id (Get_Name_Table_Int (Nam)); end Corresponding_Unit; ------------------------ -- Corresponding_Unit -- ------------------------ function Corresponding_Unit (UNam : Unit_Name_Type) return Unit_Id is begin return Corresponding_Unit (Name_Id (UNam)); end Corresponding_Unit; --------------- -- File_Name -- --------------- function File_Name (U_Id : Unit_Id) return File_Name_Type is pragma Assert (Present (U_Id)); U_Rec : Unit_Record renames ALI.Units.Table (U_Id); begin return U_Rec.Sfile; end File_Name; -------------------- -- Finalize_Units -- -------------------- procedure Finalize_Units is begin Signature_Sets.Destroy (Elaborable_Constructs); Unit_Sets.Destroy (Elaborable_Units); end Finalize_Units; ------------------------------ -- For_Each_Elaborable_Unit -- ------------------------------ procedure For_Each_Elaborable_Unit (Processor : Unit_Processor_Ptr) is Iter : Elaborable_Units_Iterator; U_Id : Unit_Id; begin Iter := Iterate_Elaborable_Units; while Has_Next (Iter) loop Next (Iter, U_Id); Processor.all (U_Id); end loop; end For_Each_Elaborable_Unit; ------------------- -- For_Each_Unit -- ------------------- procedure For_Each_Unit (Processor : Unit_Processor_Ptr) is begin for U_Id in ALI.Units.First .. ALI.Units.Last loop Processor.all (U_Id); end loop; end For_Each_Unit; -------------- -- Has_Next -- -------------- function Has_Next (Iter : Elaborable_Units_Iterator) return Boolean is begin return Unit_Sets.Has_Next (Unit_Sets.Iterator (Iter)); end Has_Next; ----------------------------- -- Has_No_Elaboration_Code -- ----------------------------- function Has_No_Elaboration_Code (U_Id : Unit_Id) return Boolean is pragma Assert (Present (U_Id)); U_Rec : Unit_Record renames ALI.Units.Table (U_Id); begin return U_Rec.No_Elab; end Has_No_Elaboration_Code; ------------------------------- -- Hash_Invocation_Signature -- ------------------------------- function Hash_Invocation_Signature (IS_Id : Invocation_Signature_Id) return Bucket_Range_Type is begin pragma Assert (Present (IS_Id)); return Bucket_Range_Type (IS_Id); end Hash_Invocation_Signature; --------------- -- Hash_Unit -- --------------- function Hash_Unit (U_Id : Unit_Id) return Bucket_Range_Type is begin pragma Assert (Present (U_Id)); return Bucket_Range_Type (U_Id); end Hash_Unit; ---------------------- -- Initialize_Units -- ---------------------- procedure Initialize_Units is begin Elaborable_Constructs := Signature_Sets.Create (Number_Of_Units); Elaborable_Units := Unit_Sets.Create (Number_Of_Units); end Initialize_Units; ------------------------------- -- Invocation_Graph_Encoding -- ------------------------------- function Invocation_Graph_Encoding (U_Id : Unit_Id) return Invocation_Graph_Encoding_Kind is pragma Assert (Present (U_Id)); U_Rec : Unit_Record renames ALI.Units.Table (U_Id); U_ALI : ALIs_Record renames ALI.ALIs.Table (U_Rec.My_ALI); begin return U_ALI.Invocation_Graph_Encoding; end Invocation_Graph_Encoding; ------------------------------- -- Is_Dynamically_Elaborated -- ------------------------------- function Is_Dynamically_Elaborated (U_Id : Unit_Id) return Boolean is pragma Assert (Present (U_Id)); U_Rec : Unit_Record renames ALI.Units.Table (U_Id); begin return U_Rec.Dynamic_Elab; end Is_Dynamically_Elaborated; ---------------------- -- Is_Internal_Unit -- ---------------------- function Is_Internal_Unit (U_Id : Unit_Id) return Boolean is pragma Assert (Present (U_Id)); U_Rec : Unit_Record renames ALI.Units.Table (U_Id); begin return U_Rec.Internal; end Is_Internal_Unit; ------------------------ -- Is_Predefined_Unit -- ------------------------ function Is_Predefined_Unit (U_Id : Unit_Id) return Boolean is pragma Assert (Present (U_Id)); U_Rec : Unit_Record renames ALI.Units.Table (U_Id); begin return U_Rec.Predefined; end Is_Predefined_Unit; --------------------------------- -- Is_Stand_Alone_Library_Unit -- --------------------------------- function Is_Stand_Alone_Library_Unit (U_Id : Unit_Id) return Boolean is pragma Assert (Present (U_Id)); U_Rec : Unit_Record renames ALI.Units.Table (U_Id); begin return U_Rec.SAL_Interface; end Is_Stand_Alone_Library_Unit; ------------------------------ -- Iterate_Elaborable_Units -- ------------------------------ function Iterate_Elaborable_Units return Elaborable_Units_Iterator is begin return Elaborable_Units_Iterator (Unit_Sets.Iterate (Elaborable_Units)); end Iterate_Elaborable_Units; ---------- -- Name -- ---------- function Name (U_Id : Unit_Id) return Unit_Name_Type is pragma Assert (Present (U_Id)); U_Rec : Unit_Record renames ALI.Units.Table (U_Id); begin return U_Rec.Uname; end Name; ----------------------- -- Needs_Elaboration -- ----------------------- function Needs_Elaboration (IS_Id : Invocation_Signature_Id) return Boolean is begin pragma Assert (Present (IS_Id)); return Signature_Sets.Contains (Elaborable_Constructs, IS_Id); end Needs_Elaboration; ----------------------- -- Needs_Elaboration -- ----------------------- function Needs_Elaboration (U_Id : Unit_Id) return Boolean is begin pragma Assert (Present (U_Id)); return Unit_Sets.Contains (Elaborable_Units, U_Id); end Needs_Elaboration; ---------- -- Next -- ---------- procedure Next (Iter : in out Elaborable_Units_Iterator; U_Id : out Unit_Id) is begin Unit_Sets.Next (Unit_Sets.Iterator (Iter), U_Id); end Next; -------------------------------- -- Number_Of_Elaborable_Units -- -------------------------------- function Number_Of_Elaborable_Units return Natural is begin return Unit_Sets.Size (Elaborable_Units); end Number_Of_Elaborable_Units; --------------------- -- Number_Of_Units -- --------------------- function Number_Of_Units return Natural is begin return Natural (ALI.Units.Last) - Natural (ALI.Units.First) + 1; end Number_Of_Units; ---------------------------------- -- Process_Invocation_Construct -- ---------------------------------- procedure Process_Invocation_Construct (IC_Id : Invocation_Construct_Id) is pragma Assert (Present (IC_Id)); IS_Id : constant Invocation_Signature_Id := Signature (IC_Id); pragma Assert (Present (IS_Id)); begin Signature_Sets.Insert (Elaborable_Constructs, IS_Id); end Process_Invocation_Construct; ----------------------------------- -- Process_Invocation_Constructs -- ----------------------------------- procedure Process_Invocation_Constructs (U_Id : Unit_Id) is pragma Assert (Present (U_Id)); U_Rec : Unit_Record renames ALI.Units.Table (U_Id); begin for IC_Id in U_Rec.First_Invocation_Construct .. U_Rec.Last_Invocation_Construct loop Process_Invocation_Construct (IC_Id); end loop; end Process_Invocation_Constructs; ------------------ -- Process_Unit -- ------------------ procedure Process_Unit (U_Id : Unit_Id) is begin pragma Assert (Present (U_Id)); -- A stand-alone library unit must not be elaborated as part of the -- current compilation because the library already carries its own -- elaboration code. if Is_Stand_Alone_Library_Unit (U_Id) then null; -- Otherwise the unit needs to be elaborated. Add it to the set -- of units that require elaboration, as well as all invocation -- signatures of constructs it declares. else Unit_Sets.Insert (Elaborable_Units, U_Id); Process_Invocation_Constructs (U_Id); end if; end Process_Unit; end Bindo.Units;
alloy4fun_models/trashltl/models/15/mD569Bu9uNYEXjmyR.als
Kaixi26/org.alloytools.alloy
0
925
open main pred idmD569Bu9uNYEXjmyR_prop16 { File in Protected historically File in Protected } pred __repair { idmD569Bu9uNYEXjmyR_prop16 } check __repair { idmD569Bu9uNYEXjmyR_prop16 <=> prop16o }
PMOO/ADA/LAB2/PARTE_1/probar_listas.adb
usainzg/EHU
0
15102
<reponame>usainzg/EHU with Ada.Integer_Text_IO, Ada.Text_IO; use Ada.Integer_Text_IO, Ada.Text_IO; with Listas; with Es_Abundante; with Crear_Sublista_4Primos; with Crear_Sublista_Pares; procedure Probar_Listas is procedure Crear_Sublista_3Abundantes is new Listas.Crear_Sublista(Cuantos => 3, Filtro => Es_Abundante); procedure Escribir_Contenido(L: in out Listas.Lista; Lista: String) is N: Integer; begin -- Contenido de L1 con los 10 primeros enteros Put_Line("El contenido de la Lista "&Lista&" es:"); Put("===> "); while not Listas.Es_Vacia(L) loop Listas.Obtener_Primero(L, N); Put(N,2); Put(" "); Listas.Borrar_Primero(L); end loop; New_Line; New_Line; end Escribir_Contenido; procedure Escribir_Contenidos(L1: in out Listas.Lista; L1s: String; L2: in out Listas.Lista; L2s: String) is N1, N2: Integer; begin Put_Line("===> El contenido de las Listas "&L1s&" y "&L2s&" es:"); while not Listas.Es_Vacia(L1) loop Listas.Obtener_Primero(L1, N1); Listas.Obtener_Primero(L2, N2); Put(N1, 4); Put(" -- "); Put(N2, 4); New_Line; Listas.Borrar_Primero(L1); Listas.Borrar_Primero(L2); end loop; end Escribir_Contenidos; L1, L1p, L2, L3, L4, L2p, Lp1, Lp2, L3primos, L4abudantes : Listas.Lista; N, N1, N2 : Integer; begin -- Crear lista de enteros L1 con los 10 primeros enteros Put("===> Creando L1 ..."); Listas.Crear_Vacia(L1); for I in 1..10 loop Listas.Colocar(L1, I); if Listas.Esta(L1, I) then Put(I, 0); Put(" "); else Put("NO"); Put(I, 0); Put(" "); end if; end loop; Crear_Sublista_Pares(L1, L1p); -- Los pares de L1 New_Line; New_Line; -- Crear lista de enteros L2 con los enteros desde el 11 al 23 Put("===> Creando L2 ..."); Listas.Crear_Vacia(L2); for I in 11..23 loop Listas.Colocar(L2, I); if Listas.Esta(L2, I) then Put(I, 0); Put(" "); else Put("NO"); Put(I, 0); Put(" "); end if; end loop; Crear_Sublista_Pares(L2, L2p); -- Los pares de L2 New_Line; New_Line; Put("===> Creando L3 ..."); Listas.Crear_Vacia(L3); for I in 11..23 loop Listas.Colocar(L3, I); if Listas.Esta(L3, I) then Put(I, 0); Put(" "); else Put("NO"); Put(I, 0); Put(" "); end if; end loop; Crear_Sublista_4Primos(L3, L3primos); -- Los pares de L2 New_Line; New_Line; Put("===> Creando L4 ..."); Listas.Crear_Vacia(L4); for I in 11..23 loop Listas.Colocar(L4, I); if Listas.Esta(L4, I) then Put(I, 0); Put(" "); else Put("NO"); Put(I, 0); Put(" "); end if; end loop; Crear_Sublista_3Abundantes(L4, L4abudantes); -- Los pares de L2 New_Line; New_Line; -- Contenido de L1 con los 10 primeros enteros Put("===> "); Escribir_Contenido(L1, "L1"); -- Contenido de L2 con los 10 primeros enteros Put("===> "); Escribir_Contenido(L2, "L2"); Put("===> "); Escribir_Contenido(L3, "L3"); Put("===> "); Escribir_Contenido(L3primos, "L3primos"); Put("===> "); Escribir_Contenido(L4, "L4"); Put("===> "); Escribir_Contenido(L4abudantes, "L4abudantes"); -- Crear lista de enteros pares Lp con los 5 primeros pares del 2 al 8 Listas.Crear_Vacia(Lp1); N:= 2; while N<=10 loop Listas.Colocar(Lp1, N); N:= N+2; end loop; -- Trataremos las listas de pares L1p y Lp1 if Listas.Igual(Lp1, L1p) then Put_Line("La lista Lp1 y la obtenida como sublista de pares L1p son iguales"); Escribir_Contenidos(L1p, "L1p", Lp1, "Lp1"); else Put_Line("La lista Lp1 y la obtenida como sublista de pares L1p NO son iguales"); -- Contenido de L1p Put("===> "); Escribir_Contenido(L1p, "L1p"); end if; New_Line; New_Line; -- Trataremos las listas de pares L2p y Lp2 Listas.Copiar(Lp2, L2p); if Listas.Igual(Lp2, L2p) then Put_Line("La lista Lp2 y la obtenida como copia L2p son iguales"); Escribir_Contenidos(L2p, "L2p", Lp2, "Lp2"); else Put_Line("La lista Lp2 y la obtenida como copia L2p NO son iguales"); -- Contenido de L2p Put("===> "); Escribir_Contenido(L2p, "L2p"); end if; end Probar_Listas;
electrum/src/main/resources/models/examples/systems/marksweepgc.als
haslab/Electrum
29
3604
module examples/systems/marksweepgc /* * Model of mark and sweep garbage collection. */ // a node in the heap sig Node {} sig HeapState { left, right : Node -> lone Node, marked : set Node, freeList : lone Node } pred clearMarks[hs, hs1 : HeapState] { // clear marked set no hs1.marked // left and right fields are unchanged hs1.left = hs.left hs1.right = hs.right } /** * simulate the recursion of the mark() function using transitive closure */ fun reachable[hs: HeapState, n: Node] : set Node { n + n.^(hs.left + hs.right) } pred mark[hs: HeapState, from : Node, hs1: HeapState] { hs1.marked = hs.reachable[from] hs1.left = hs.left hs1.right = hs.right } /** * complete hack to simulate behavior of code to set freeList */ pred setFreeList[hs, hs1: HeapState] { // especially hackish hs1.freeList.*(hs1.left) in (Node - hs.marked) all n: Node | (n !in hs.marked) => { no hs1.right[n] hs1.left[n] in (hs1.freeList.*(hs1.left)) n in hs1.freeList.*(hs1.left) } else { hs1.left[n] = hs.left[n] hs1.right[n] = hs.right[n] } hs1.marked = hs.marked } pred GC[hs: HeapState, root : Node, hs1: HeapState] { some hs1, hs2: HeapState | hs.clearMarks[hs1] && hs1.mark[root, hs2] && hs2.setFreeList[hs1] } assert Soundness1 { all h, h1 : HeapState, root : Node | h.GC[root, h1] => (all live : h.reachable[root] | { h1.left[live] = h.left[live] h1.right[live] = h.right[live] }) } assert Soundness2 { all h, h1 : HeapState, root : Node | h.GC[root, h1] => no h1.reachable[root] & h1.reachable[h1.freeList] } assert Completeness { all h, h1 : HeapState, root : Node | h.GC[root, h1] => (Node - h1.reachable[root]) in h1.reachable[h1.freeList] } check Soundness1 for 3 expect 0 check Soundness2 for 3 expect 0 check Completeness for 3 expect 0
programs/oeis/020/A020524.asm
ckrause/cm
22
84168
; A020524: a(n) = 4th Euler polynomial evaluated at 2^n. ; 0,2,132,3080,57360,983072,16252992,264241280,4261413120,68451041792,1097364145152,17575006177280,281337537761280,4502500115750912,72048797944922112,1152851135862702080,18446181123756195840,295143401579725586432,4722330454072626511872,75557575495538172231680,1208923513771619962060800,19342794667089993087844352,309484862247392479052562432,4951758976549900382193582080,79228153069531371854270300160,1267650524670365675582413340672,20282408999188760616632731041792,324518548822723448324639455969280,5192296819849201400862363007057920,83076749427072232235142873079611392 seq $0,267816 ; Decimal representation of the n-th iteration of the "Rule 221" elementary cellular automaton starting with a single ON (black) cell. pow $0,2 div $0,4
oeis/158/A158626.asm
neoneye/loda-programs
11
27016
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A158626: a(n) = 42*n^2 - 1. ; Submitted by <NAME> ; 41,167,377,671,1049,1511,2057,2687,3401,4199,5081,6047,7097,8231,9449,10751,12137,13607,15161,16799,18521,20327,22217,24191,26249,28391,30617,32927,35321,37799,40361,43007,45737,48551,51449,54431,57497,60647,63881,67199,70601,74087,77657,81311,85049,88871,92777,96767,100841,104999,109241,113567,117977,122471,127049,131711,136457,141287,146201,151199,156281,161447,166697,172031,177449,182951,188537,194207,199961,205799,211721,217727,223817,229991,236249,242591,249017,255527,262121,268799,275561 add $0,1 pow $0,2 mul $0,42 sub $0,1
alloy4fun_models/trashltl/models/4/nHcB37qGMq2tQjL9Y.als
Kaixi26/org.alloytools.alloy
0
2038
<gh_stars>0 open main pred idnHcB37qGMq2tQjL9Y_prop5 { eventually File' not in File } pred __repair { idnHcB37qGMq2tQjL9Y_prop5 } check __repair { idnHcB37qGMq2tQjL9Y_prop5 <=> prop5o }
projects/Kirbys_Dream_Land_2.windfish/disassembly/bank_16.asm
jverkoey/awaken
68
95413
<gh_stars>10-100 SECTION "ROM Bank 16", ROMX[$4000], BANK[$16] db $D3, $78, $15, $FF, $00, $80, $62, $7D db $06, $00, $00, $02, $0C, $07, $06, $06 db $23, $80, $E0, $25, $26, $F9, $F8, $3D db $08, $1B, $1B, $2E, $2A, $82, $80, $7C db $09, $0A, $0A, $2E, $2E, $80, $3D, $80 db $7D, $32, $08, $80, $7D, $36, $34, $80 db $80, $22, $24, $22, $7F, $32, $36, $7D db $7D, $80, $22, $32, $E0, $30, $80, $36 db $7D, $34, $80, $32, $F8, $2B, $26, $7E db $24, $7E, $22, $7D, $82, $7D, $28, $2A db $2C, $2E, $40, $80, $44, $46, $7D, $3D db $51, $80, $7D, $2B, $80, $47, $2B, $80 db $7D, $3D, $3D, $80, $51, $80, $82, $22 db $82, $34, $82, $7E, $82, $80, $48, $62 db $4A, $13, $49, $80, $82, $7D, $4A, $FD db $81, $4D, $F0, $80, $7D, $80, $7F, $7E db $82, $7D, $80, $34, $7F, $7C, $C4, $00 db $64, $19, $32, $82, $24, $7D, $0C, $82 db $7F, $F8, $F8, $7D, $2B, $F9, $F8, $80 db $48, $4A, $4C, $3D, $80, $4E, $FD, $7D db $4A, $80, $4D, $80, $83, $00, $97, $00 db $24, $23, $80, $41, $82, $80, $05, $2B db $80, $3D, $80, $F9, $F8, $83, $00, $8F db $11, $7C, $80, $F9, $F8, $80, $3C, $7D db $80, $7C, $7D, $04, $7E, $80, $39, $80 db $80, $7C, $00, $22, $80, $11, $7F, $82 db $80, $F6, $4A, $F8, $7D, $2B, $3D, $80 db $7D, $7D, $80, $09, $0A, $0A, $2B, $09 db $22, $0A, $02, $09, $0A, $4B, $41, $80 db $82, $08, $7F, $7E, $3C, $38, $7D, $26 db $36, $22, $34, $83, $00, $38, $83, $00 db $40, $06, $80, $32, $22, $7D, $32, $7C db $7C, $83, $00, $00, $06, $10, $10, $12 db $1C, $16, $16, $17, $23, $80, $E0, $4B db $36, $FB, $F8, $80, $0B, $0B, $18, $3C db $38, $84, $80, $7C, $1A, $1A, $19, $3C db $3C, $2F, $80, $80, $7D, $22, $80, $18 db $39, $26, $24, $80, $80, $32, $34, $32 db $7F, $26, $22, $7D, $7D, $22, $80, $22 db $22, $26, $80, $24, $7D, $22, $80, $F8 db $7D, $7E, $36, $7E, $34, $7D, $32, $84 db $7D, $38, $3A, $3C, $3E, $50, $80, $54 db $56, $7D, $2F, $43, $80, $39, $7D, $55 db $80, $39, $80, $7D, $41, $2F, $80, $09 db $43, $84, $32, $84, $7D, $84, $7E, $84 db $80, $58, $62, $5A, $08, $59, $80, $84 db $7D, $5A, $FD, $81, $5D, $F1, $84, $00 db $75, $E0, $29, $84, $7D, $80, $24, $7F db $7F, $84, $24, $84, $32, $84, $22, $84 db $34, $7D, $1C, $84, $7F, $F8, $F8, $39 db $7D, $FB, $F8, $80, $58, $5A, $5C, $80 db $2F, $5E, $FD, $7D, $5A, $80, $5D, $80 db $80, $FB, $F8, $39, $34, $23, $80, $41 db $84, $80, $01, $39, $80, $84, $01, $95 db $02, $FB, $F8, $80, $83, $01, $9D, $0D db $2F, $2E, $7D, $80, $7D, $7D, $14, $7E db $80, $80, $2B, $80, $10, $10, $83, $00 db $C8, $16, $84, $80, $F7, $5A, $F8, $39 db $7D, $80, $2F, $7D, $7D, $80, $1A, $1A db $19, $39, $1A, $1A, $19, $1A, $1A, $19 db $5B, $41, $80, $84, $0B, $7F, $7E, $2E db $2A, $7D, $36, $22, $32, $24, $26, $80 db $24, $84, $01, $3E, $04, $22, $80, $7D db $32, $26, $85, $00, $FD, $0F, $01, $01 db $03, $80, $08, $80, $80, $07, $06, $06 db $16, $27, $4F, $FD, $7D, $08, $C3, $00 db $0C, $02, $83, $80, $7C, $23, $80, $E0 db $3B, $07, $80, $39, $20, $21, $33, $08 db $80, $7D, $37, $35, $80, $30, $23, $25 db $23, $7F, $33, $37, $7D, $31, $80, $33 db $33, $F3, $80, $37, $7D, $35, $80, $33 db $33, $2F, $27, $7E, $25, $7E, $23, $7D db $83, $7D, $29, $80, $2D, $80, $42, $80 db $45, $80, $39, $7D, $80, $55, $39, $80 db $55, $80, $80, $2F, $39, $C3, $01, $D5 db $E0, $20, $43, $83, $23, $83, $35, $83 db $7E, $83, $80, $49, $4B, $80, $4A, $49 db $F6, $83, $7D, $4A, $7D, $81, $4A, $80 db $F1, $F7, $F1, $7F, $7E, $83, $7D, $80 db $35, $7F, $7F, $C4, $02, $62, $06, $33 db $83, $23, $F5, $80, $83, $7F, $C3, $00 db $C5, $13, $FA, $F8, $80, $49, $4B, $4A db $7D, $2F, $4F, $FD, $7D, $4A, $0A, $4A db $80, $80, $FA, $F8, $39, $25, $23, $80 db $05, $83, $80, $83, $F1, $80, $2F, $84 db $02, $8C, $00, $FA, $83, $01, $B3, $17 db $FA, $F8, $2F, $16, $F3, $80, $7D, $7D db $05, $7E, $80, $3D, $80, $80, $01, $01 db $80, $F1, $06, $7F, $83, $06, $4A, $F4 db $84, $01, $56, $01, $39, $7D, $C3, $00 db $0B, $00, $80, $22, $06, $10, $07, $07 db $06, $80, $80, $83, $F1, $83, $7F, $7E db $16, $16, $F1, $27, $37, $23, $35, $83 db $02, $36, $83, $02, $3E, $04, $80, $33 db $23, $7D, $33, $85, $00, $FD, $02, $11 db $11, $13, $22, $80, $08, $18, $16, $16 db $17, $06, $37, $FC, $F8, $3D, $84, $03 db $05, $00, $85, $85, $02, $17, $1B, $16 db $2B, $80, $30, $31, $23, $80, $18, $3D db $27, $25, $20, $80, $33, $35, $33, $7F db $27, $23, $21, $7D, $23, $80, $23, $F2 db $27, $80, $25, $83, $03, $30, $18, $7D db $7E, $37, $7E, $35, $7D, $33, $85, $7D db $80, $3B, $80, $3F, $52, $80, $80, $57 db $2B, $7D, $80, $47, $80, $2B, $80, $47 db $C3, $00, $D4, $E0, $2E, $3D, $7D, $51 db $80, $85, $33, $85, $7D, $85, $7E, $85 db $80, $59, $5B, $80, $5A, $59, $F7, $85 db $7D, $5A, $7D, $81, $5A, $80, $F0, $F6 db $F0, $7F, $7E, $85, $7D, $80, $25, $7C db $7F, $85, $25, $85, $33, $85, $23, $85 db $33, $F4, $80, $85, $C3, $00, $CB, $14 db $2B, $FC, $F8, $80, $59, $5B, $5A, $3D db $7D, $5F, $FD, $7D, $5A, $1A, $5A, $80 db $80, $FC, $F8, $80, $35, $23, $80, $03 db $85, $80, $85, $F0, $C3, $00, $AF, $01 db $FC, $F8, $83, $03, $8C, $E0, $20, $80 db $7C, $5F, $FD, $7D, $06, $F2, $80, $7D db $7C, $15, $7E, $80, $80, $2F, $80, $11 db $7C, $80, $F0, $16, $7F, $85, $16, $5A db $F5, $80, $80, $2B, $3D, $7D, $2B, $7D db $C3, $01, $0A, $03, $80, $16, $17, $16 db $84, $01, $07, $0E, $85, $F0, $85, $7F db $7E, $06, $06, $F0, $37, $23, $33, $25 db $27, $80, $25, $84, $03, $3C, $06, $23 db $80, $7D, $33, $27, $7C, $7C, $23, $00 db $22, $01, $23, $03, $24, $00, $02, $31 db $01, $00, $84, $04, $04, $01, $21, $20 db $2C, $00, $86, $04, $15, $01, $40, $10 db $86, $04, $24, $26, $00, $00, $02, $84 db $04, $15, $87, $04, $12, $00, $69, $8B db $04, $18, $00, $20, $C4, $04, $55, $43 db $00, $21, $26, $00, $00, $21, $A4, $04 db $30, $83, $04, $06, $07, $10, $10, $21 db $00, $00, $10, $FD, $FE, $89, $04, $5C db $07, $21, $10, $02, $02, $20, $20, $31 db $01, $83, $04, $53, $87, $04, $8A, $0C db $20, $30, $31, $01, $00, $08, $28, $00 db $28, $38, $59, $00, $21, $87, $04, $07 db $05, $31, $01, $20, $FE, $FD, $31, $C4 db $04, $00, $03, $FE, $FD, $41, $00, $85 db $04, $B6, $02, $40, $00, $40, $C4, $04 db $87, $02, $02, $20, $20, $CE, $04, $57 db $00, $03, $41, $00, $21, $00, $10, $22 db $38, $00, $00, $30, $38, $01, $00, $00 db $FF, $74, $05, $1D, $03, $3D, $03, $7D db $03, $41, $F9, $07, $05, $E1, $1F, $03 db $FF, $FF, $FE, $23, $00, $05, $07, $07 db $1F, $1F, $3F, $3F, $23, $7F, $01, $FF db $FF, $AF, $00, $10, $41, $FF, $00, $08 db $FF, $07, $FF, $1F, $FF, $3F, $FF, $7F db $FF, $AF, $00, $2D, $E0, $32, $FE, $FF db $FF, $55, $00, $80, $00, $81, $00, $E3 db $04, $D7, $08, $8B, $04, $85, $02, $42 db $01, $40, $03, $41, $02, $23, $04, $27 db $08, $27, $18, $23, $14, $61, $02, $40 db $01, $80, $00, $80, $01, $41, $02, $63 db $04, $57, $28, $8F, $10, $87, $08, $83 db $04, $41, $80, $00, $E0, $21, $41, $00 db $43, $00, $47, $00, $8F, $00, $05, $00 db $8A, $00, $54, $AA, $00, $01, $54, $03 db $E8, $17, $F0, $0E, $F8, $06, $FC, $03 db $FE, $01, $7E, $81, $BC, $43, $D8, $27 db $41, $E0, $1E, $03, $C0, $3F, $80, $7F db $41, $00, $FF, $09, $80, $7F, $C0, $3E db $E0, $1E, $F0, $0E, $F8, $07, $83, $00 db $9C, $85, $00, $B0, $0D, $EA, $14, $F6 db $00, $E2, $00, $41, $00, $82, $00, $3C db $3C, $42, $42, $23, $81, $15, $E7, $81 db $FF, $81, $7E, $42, $3C, $3C, $FF, $7F db $C0, $C0, $87, $80, $9F, $80, $9E, $81 db $BC, $83, $B8, $87, $41, $B0, $8F, $03 db $B8, $86, $BC, $80, $C3, $00, $E8, $01 db $A7, $98, $A3, $00, $0C, $A3, $00, $E0 db $18, $E5, $03, $F9, $07, $79, $87, $3D db $C3, $1D, $C3, $0D, $83, $0F, $0F, $30 db $30, $6A, $40, $95, $EA, $80, $FF, $C3 db $FF, $67, $C4, $00, $1A, $E0, $23, $2E db $2F, $44, $46, $A0, $C4, $D0, $A8, $C8 db $90, $84, $C8, $43, $44, $40, $43, $C1 db $82, $C3, $84, $87, $F8, $C7, $B8, $C3 db $B4, $C1, $A2, $40, $41, $40, $40, $80 db $C1, $C0, $82, $89, $01, $26, $14, $FF db $81, $7F, $C2, $3F, $E4, $1F, $F8, $1F db $F4, $3F, $E2, $7F, $C1, $FF, $80, $FF db $0F, $F0, $30, $EA, $86, $01, $15, $19 db $E7, $7F, $FF, $7F, $80, $00, $C0, $00 db $F0, $00, $FC, $04, $F8, $18, $E8, $38 db $C4, $EC, $C3, $47, $03, $03, $C4, $C4 db $28, $28, $22, $18, $02, $14, $00, $20 db $23, $00, $03, $03, $03, $04, $04, $23 db $08, $03, $38, $34, $40, $48, $27, $80 db $05, $40, $40, $20, $20, $40, $40, $C5 db $01, $A5, $07, $C0, $80, $E0, $80, $78 db $48, $3C, $34, $C7, $01, $97, $8A, $01 db $70, $C4, $01, $84, $03, $1E, $1F, $71 db $61, $C4, $01, $B0, $08, $80, $C1, $80 db $E6, $80, $6E, $50, $67, $40, $C5, $01 db $DA, $0C, $E6, $80, $BD, $C3, $42, $7E db $3C, $3C, $FF, $03, $FC, $C4, $38, $8A db $01, $85, $03, $FF, $03, $FC, $04, $41 db $F8, $08, $02, $F8, $34, $C0, $84, $01 db $9B, $83, $00, $1E, $08, $55, $00, $AA db $55, $00, $FF, $87, $FF, $CF, $23, $FF db $1A, $FE, $FF, $7C, $FF, $38, $FF, $10 db $FF, $08, $FF, $04, $FF, $02, $7F, $81 db $BE, $41, $DD, $22, $EB, $14, $F7, $08 db $FB, $04, $FD, $02, $41, $FE, $01, $0F db $7E, $81, $BD, $42, $DB, $24, $EF, $18 db $F7, $0C, $FB, $06, $FD, $03, $7E, $81 db $8C, $02, $21, $02, $FF, $01, $FF, $BB db $01, $60, $03, $2B, $37, $DC, $E3, $F4 db $93, $01, $80, $99, $02, $14, $11, $FF db $81, $FF, $41, $FE, $23, $FC, $17, $F8 db $0F, $FC, $07, $FE, $03, $FF, $01, $FF db $00, $C8, $02, $5F, $86, $03, $29, $0E db $81, $FF, $42, $FF, $24, $FF, $38, $FF db $74, $FF, $E2, $FF, $C1, $FF, $80, $A5 db $03, $40, $8A, $02, $55, $AD, $02, $70 db $01, $BB, $C7, $84, $01, $AC, $05, $40 db $E0, $20, $C0, $40, $C0, $88, $01, $AB db $02, $F8, $48, $FC, $C4, $02, $09, $02 db $FC, $04, $FF, $8A, $01, $BF, $05, $F8 db $28, $FC, $C4, $FF, $03, $42, $FF, $00 db $06, $FE, $00, $FC, $00, $F8, $00, $F0 db $41, $00, $E0, $42, $00, $C0, $43, $00 db $80, $05, $00, $FF, $00, $0F, $00, $01 db $2A, $00, $00, $E0, $C5, $03, $BB, $C7 db $03, $B7, $C6, $03, $D9, $06, $02, $00 db $04, $00, $08, $00, $10, $41, $00, $20 db $42, $00, $40, $88, $03, $C7, $8F, $02 db $10, $07, $FE, $FF, $FC, $7F, $F8, $3F db $F0, $1F, $88, $03, $36, $86, $01, $51 db $C5, $03, $35, $41, $80, $FF, $02, $C0 db $7F, $E0, $8A, $04, $25, $00, $07, $AA db $03, $61, $06, $41, $FF, $83, $FF, $47 db $FF, $2E, $A4, $02, $24, $06, $00, $FF db $20, $FF, $51, $FF, $8B, $F4, $42, $03 db $6F, $BD, $03, $D2, $BF, $03, $B0, $02 db $0F, $00, $70, $8E, $04, $B3, $02, $18 db $00, $20, $83, $04, $03, $96, $04, $09 db $A7, $02, $21, $09, $04, $FF, $22, $FF db $77, $DF, $FF, $8F, $FF, $07, $C4, $00 db $BE, $06, $0F, $F0, $1F, $E0, $3F, $C1 db $7F, $84, $04, $5E, $8C, $05, $23, $00 db $C0, $8C, $01, $31, $03, $C0, $41, $40 db $C0, $8C, $01, $42, $00, $C4, $8C, $03 db $70, $07, $FC, $BB, $CF, $FF, $1F, $EE db $2F, $C4, $8A, $01, $25, $F4, $20, $04 db $F0, $03, $00, $F8, $00, $E0, $8A, $03 db $C3, $03, $00, $FF, $07, $F8, $A3, $00 db $BA, $01, $3F, $C0, $42, $7F, $80, $06 db $80, $00, $63, $00, $14, $00, $08, $28 db $00, $03, $C0, $40, $22, $41, $8B, $05 db $D4, $06, $FF, $01, $7F, $03, $1C, $04 db $08, $88, $05, $D6, $02, $FF, $07, $7E db $8C, $05, $F3, $AF, $01, $10, $09, $78 db $F8, $3C, $FC, $1C, $FC, $0E, $FE, $06 db $FE, $41, $03, $FF, $1F, $83, $FF, $C3 db $FF, $63, $FF, $36, $FE, $1E, $FE, $36 db $FE, $66, $FE, $C3, $FF, $A3, $FF, $13 db $FF, $0B, $FF, $1E, $FE, $3E, $FE, $76 db $FE, $E6, $FE, $C6, $FE, $85, $06, $2E db $06, $37, $FE, $1F, $FE, $37, $FE, $67 db $88, $06, $3B, $0A, $1F, $FE, $3F, $FE db $77, $FE, $E7, $FE, $C7, $FE, $83, $8A db $04, $6F, $0E, $1F, $1C, $37, $3F, $E3 db $FF, $7F, $F8, $3F, $FC, $1F, $FC, $0F db $FE, $07, $86, $06, $29, $BE, $03, $F0 db $F4, $30, $05, $AF, $05, $7E, $81, $BC db $42, $18, $20, $89, $06, $D5, $03, $FF db $81, $7E, $C2, $AB, $05, $F4, $05, $11 db $FF, $08, $FE, $18, $38, $89, $06, $F6 db $03, $00, $00, $7E, $7E, $23, $42, $C5 db $07, $17, $01, $00, $00, $C7, $07, $1F db $D7, $07, $27, $FF, $89, $44, $16, $FF db $00, $80, $62, $7D, $62, $4D, $02, $F8 db $00, $20, $22, $40, $0B, $35, $F4, $FA db $02, $22, $42, $42, $35, $34, $F6, $F7 db $05, $83, $00, $09, $03, $F6, $F8, $F6 db $44, $83, $00, $11, $11, $F7, $FA, $F7 db $22, $42, $40, $24, $35, $80, $FB, $80 db $12, $04, $42, $24, $34, $80, $80, $41 db $08, $07, $00, $07, $22, $80, $1D, $0F db $0E, $09, $80, $80, $09, $5C, $5C, $27 db $80, $0F, $0E, $0E, $0A, $0B, $0B, $0E db $27, $27, $80, $80, $09, $7D, $80, $80 db $5C, $2A, $2C, $80, $2D, $23, $80, $08 db $7E, $5B, $7D, $5A, $7E, $2E, $48, $80 db $49, $23, $80, $02, $4D, $4E, $07, $22 db $7D, $03, $09, $5C, $80, $4F, $41, $80 db $5C, $07, $27, $5C, $80, $80, $5C, $5C db $82, $80, $23, $0C, $0B, $80, $7D, $67 db $7F, $82, $80, $82, $7D, $7F, $7C, $82 db $7D, $23, $80, $05, $82, $80, $FD, $F4 db $0C, $FC, $83, $00, $35, $01, $07, $F6 db $23, $80, $01, $09, $80, $84, $00, $42 db $00, $80, $84, $00, $08, $02, $7D, $80 db $80, $84, $00, $10, $02, $7E, $80, $80 db $84, $00, $18, $02, $0C, $FC, $80, $84 db $00, $20, $22, $80, $0B, $00, $05, $80 db $F8, $80, $FA, $80, $FB, $02, $44, $7C db $80, $85, $00, $94, $05, $82, $7D, $82 db $42, $82, $02, $37, $80, $62, $7D, $62 db $5D, $E0, $34, $F9, $10, $30, $50, $40 db $50, $52, $F8, $F9, $12, $32, $52, $25 db $52, $52, $FA, $FB, $10, $30, $15, $40 db $15, $F4, $80, $F4, $12, $32, $54, $25 db $54, $F6, $80, $F6, $04, $24, $40, $24 db $54, $F7, $80, $F7, $22, $42, $24, $24 db $54, $F4, $F6, $17, $18, $17, $17, $18 db $22, $80, $05, $1E, $1E, $80, $80, $19 db $4C, $C5, $01, $43, $10, $1F, $1B, $1B db $1A, $1F, $4C, $80, $80, $37, $80, $7D db $19, $37, $37, $3A, $3C, $3B, $24, $80 db $07, $4B, $7E, $4A, $7D, $7E, $3E, $58 db $3F, $24, $80, $02, $5D, $5E, $17, $22 db $7D, $03, $4C, $19, $80, $5F, $41, $4C db $80, $00, $4C, $C3, $01, $52, $02, $4C db $84, $80, $23, $1C, $83, $00, $88, $06 db $84, $80, $84, $7D, $7F, $7F, $84, $84 db $00, $93, $0B, $84, $80, $FF, $F8, $1C db $FC, $80, $80, $17, $17, $18, $FA, $25 db $80, $01, $19, $80, $83, $01, $43, $84 db $01, $07, $02, $7D, $80, $80, $84, $01 db $0F, $02, $7E, $80, $80, $84, $01, $17 db $02, $1C, $FC, $80, $84, $01, $1F, $22 db $80, $0B, $10, $10, $F4, $80, $F6, $80 db $F7, $80, $12, $12, $7E, $80, $85, $01 db $93, $05, $84, $7D, $84, $52, $84, $12 db $9A, $00, $E8, $14, $06, $26, $46, $F9 db $01, $21, $41, $41, $14, $35, $F5, $F9 db $03, $23, $43, $43, $34, $35, $F5, $80 db $47, $83, $02, $07, $03, $F5, $F9, $F5 db $45, $83, $02, $0F, $06, $80, $F9, $80 db $23, $33, $14, $25, $83, $00, $CC, $02 db $13, $23, $43, $83, $02, $29, $02, $09 db $80, $09, $84, $00, $9E, $0A, $27, $80 db $0A, $0B, $0B, $09, $80, $80, $28, $29 db $27, $24, $80, $00, $5C, $62, $27, $1C db $29, $09, $4A, $80, $29, $80, $2B, $80 db $3B, $7D, $80, $2D, $3B, $2D, $4B, $7D db $4A, $80, $4B, $2F, $80, $3F, $80, $80 db $49, $3F, $49, $80, $80, $85, $00, $48 db $0D, $06, $80, $0B, $0B, $29, $29, $28 db $29, $26, $46, $29, $0B, $83, $07, $23 db $0D, $0B, $F0, $F2, $68, $7F, $83, $80 db $83, $7D, $7F, $7F, $83, $0E, $23, $80 db $05, $83, $80, $FE, $F5, $0D, $FC, $84 db $00, $42, $00, $F5, $83, $00, $39, $02 db $0A, $0B, $0B, $83, $02, $3E, $00, $80 db $84, $02, $06, $02, $7D, $80, $80, $84 db $02, $0E, $01, $7E, $80, $85, $02, $15 db $02, $0D, $FC, $80, $85, $02, $1E, $03 db $80, $80, $01, $47, $41, $80, $F9, $03 db $80, $80, $03, $45, $85, $01, $D9, $83 db $02, $8A, $03, $83, $43, $83, $03, $9A db $00, $E8, $E0, $28, $16, $36, $56, $FA db $11, $31, $51, $14, $51, $53, $F9, $FA db $13, $33, $53, $24, $53, $53, $F9, $80 db $11, $31, $57, $14, $57, $F5, $80, $F5 db $13, $33, $55, $24, $55, $F5, $80, $F5 db $23, $43, $14, $25, $55, $22, $80, $06 db $23, $33, $25, $25, $55, $F5, $F5, $C3 db $01, $AA, $0D, $19, $17, $17, $18, $4C db $80, $1B, $1B, $1A, $80, $80, $19, $39 db $39, $83, $01, $50, $83, $01, $50, $1D db $39, $39, $38, $80, $5A, $19, $38, $37 db $80, $3D, $7D, $2D, $3B, $80, $2D, $3B db $7D, $5B, $80, $5A, $5B, $80, $59, $80 db $49, $3F, $80, $49, $3F, $80, $85, $01 db $46, $04, $1A, $16, $80, $1B, $1B, $22 db $39, $06, $38, $36, $56, $39, $1B, $85 db $17, $23, $1D, $0A, $F1, $F3, $68, $7F db $85, $80, $85, $7D, $7C, $7F, $85, $C3 db $01, $3E, $06, $80, $85, $80, $EF, $F9 db $1D, $FC, $83, $01, $7D, $04, $19, $F9 db $17, $17, $18, $84, $03, $3D, $83, $03 db $3E, $84, $03, $05, $02, $7D, $80, $80 db $84, $03, $0D, $01, $7E, $80, $85, $03 db $14, $02, $1D, $FC, $80, $84, $03, $1D db $22, $80, $01, $11, $11, $41, $F5, $80 db $05, $80, $80, $13, $13, $7E, $7C, $85 db $03, $91, $05, $85, $7D, $85, $53, $85 db $13, $36, $80, $23, $00, $22, $03, $05 db $00, $03, $03, $03, $03, $03, $29, $00 db $8F, $04, $03, $03, $00, $00, $00, $03 db $35, $00, $22, $03, $8C, $04, $04, $02 db $03, $03, $03, $83, $04, $23, $3B, $00 db $83, $04, $00, $29, $03, $00, $21, $27 db $00, $00, $10, $41, $21, $00, $0F, $FD db $FE, $21, $00, $28, $20, $38, $30, $21 db $28, $01, $28, $31, $01, $28, $00, $23 db $28, $22, $20, $83, $04, $9B, $89, $03 db $FF, $01, $08, $00, $84, $04, $9B, $01 db $28, $08, $86, $04, $12, $02, $31, $01 db $00, $C4, $04, $B8, $2C, $00, $04, $FE db $FD, $00, $00, $00, $42, $00, $21, $01 db $00, $21, $37, $00, $FF, $73, $23, $00 db $06, $01, $00, $02, $00, $04, $00, $08 db $41, $00, $10, $43, $00, $20, $0D, $00 db $10, $00, $18, $00, $0F, $00, $03, $00 db $0F, $00, $70, $00, $80, $32, $00, $04 db $03, $00, $1F, $00, $FE, $A4, $00, $1B db $00, $30, $A3, $00, $0B, $42, $00, $0C db $0B, $00, $1C, $00, $18, $00, $38, $00 db $70, $00, $E0, $00, $C0, $86, $00, $23 db $83, $00, $50, $06, $71, $00, $E2, $00 db $C4, $00, $88, $84, $00, $0B, $02, $E0 db $00, $20, $24, $00, $83, $00, $46, $06 db $0F, $00, $1D, $00, $30, $00, $60, $92 db $00, $23, $08, $01, $00, $07, $00, $0F db $00, $0E, $00, $1C, $2A, $00, $00, $38 db $41, $00, $F0, $03, $00, $1F, $00, $20 db $8E, $00, $89, $08, $01, $00, $E3, $E0 db $FA, $F8, $FE, $FC, $FF, $22, $FE, $0C db $FF, $FF, $E4, $00, $1A, $00, $07, $07 db $1F, $1F, $3F, $3F, $7F, $A4, $00, $CB db $22, $00, $AF, $00, $D3, $8C, $00, $D3 db $1D, $3F, $FF, $60, $E0, $FF, $C0, $F9 db $C7, $E6, $DF, $D8, $FF, $E0, $FF, $C0 db $FF, $C1, $FE, $C7, $F8, $DF, $E0, $FF db $C0, $FE, $C1, $F8, $C7, $E0, $DF, $8C db $01, $0E, $01, $E7, $7F, $C3, $01, $01 db $1E, $FF, $00, $00, $FF, $00, $F9, $07 db $E6, $1F, $98, $7F, $60, $FF, $80, $FF db $01, $FE, $07, $F8, $1F, $E0, $7F, $80 db $FE, $01, $F8, $07, $E0, $1F, $80, $7F db $8B, $01, $40, $23, $FF, $03, $3F, $3F db $60, $60, $8B, $01, $04, $E0, $3F, $FF db $7F, $FF, $80, $AE, $D1, $CE, $71, $C4 db $4A, $80, $84, $80, $80, $FF, $7F, $C3 db $C3, $24, $24, $FF, $3C, $FF, $24, $E7 db $3C, $FF, $3C, $24, $E7, $C3, $C3, $7F db $7F, $80, $80, $AA, $80, $BF, $80, $B7 db $88, $AB, $94, $D5, $A2, $22, $41, $21 db $40, $71, $80, $73, $80, $72, $80, $76 db $80, $6D, $80, $5A, $A0, $04, $E0, $83 db $00, $DE, $0B, $AA, $00, $FF, $00, $E7 db $18, $DB, $24, $A5, $42, $42, $81, $42 db $70, $80, $41, $30, $C0, $07, $40, $A0 db $78, $80, $47, $A0, $61, $80, $8D, $01 db $A2, $0A, $27, $00, $5C, $00, $B0, $00 db $60, $00, $40, $00, $C0, $44, $00, $80 db $41, $00, $40, $06, $00, $A0, $00, $58 db $00, $27, $00, $F4, $2D, $01, $30, $F4 db $31, $00, $FE, $BF, $01, $60, $42, $7F db $80, $09, $7E, $81, $38, $47, $40, $3C db $E0, $00, $40, $80, $A3, $01, $90, $00 db $A9, $AA, $01, $95, $05, $E0, $06, $1C db $03, $02, $05, $41, $0C, $03, $42, $0E db $01, $8F, $01, $B0, $0A, $20, $07, $58 db $07, $B6, $01, $6E, $01, $4E, $01, $CE db $41, $01, $8E, $02, $01, $E2, $05, $8D db $02, $A2, $83, $00, $D0, $00, $05, $A3 db $01, $F5, $AA, $01, $EB, $0A, $03, $00 db $02, $00, $06, $00, $0D, $00, $3A, $00 db $E4, $26, $00, $00, $02, $84, $02, $F5 db $00, $06, $C4, $00, $9D, $41, $1F, $00 db $E0, $29, $3E, $01, $34, $0B, $60, $1F db $40, $3F, $80, $7F, $01, $01, $02, $02 db $15, $04, $3B, $08, $77, $10, $EE, $21 db $D1, $4F, $AE, $9F, $C7, $31, $8E, $72 db $1D, $E4, $1A, $E9, $35, $D3, $3D, $E3 db $7D, $E3, $FA, $C7, $83, $03, $20, $0F db $05, $04, $0A, $09, $15, $13, $2D, $23 db $5D, $43, $BA, $87, $7B, $06, $FB, $06 db $41, $F7, $0C, $06, $C6, $3D, $38, $FF db $C0, $FF, $00, $8F, $01, $3F, $08, $FF db $BF, $40, $0F, $30, $13, $0C, $0C, $03 db $A7, $00, $56, $89, $03, $40, $05, $3D db $23, $7D, $63, $FA, $C7, $A5, $03, $40 db $11, $D0, $10, $E8, $08, $74, $84, $8A db $F2, $75, $F9, $0E, $FC, $07, $FA, $1F db $E1, $7F, $81, $87, $01, $48, $41, $FB db $C6, $41, $F7, $CC, $03, $C6, $FD, $F8 db $FF, $85, $01, $1C, $1D, $E7, $78, $FF db $30, $DF, $38, $3E, $CD, $BE, $47, $7B db $87, $BB, $05, $C3, $3C, $1B, $04, $0B db $04, $05, $02, $01, $02, $00, $01, $81 db $00, $83, $00, $8D, $01, $40, $00, $81 db $C3, $02, $48, $0F, $FE, $1F, $EC, $7D db $9A, $FC, $33, $FE, $61, $FE, $C1, $FC db $83, $01, $00, $03, $84, $03, $0B, $0B db $1C, $00, $3C, $00, $71, $08, $E3, $18 db $C7, $30, $8F, $70, $41, $1F, $E0, $12 db $36, $C9, $24, $DB, $40, $BF, $00, $FF db $81, $80, $43, $40, $A6, $20, $DE, $10 db $EC, $08, $74, $A4, $03, $2B, $07, $81 db $9C, $43, $7C, $A7, $38, $56, $99, $F4 db $37, $03, $38, $BF, $03, $90, $0F, $B9 db $46, $A7, $58, $DD, $20, $DA, $20, $32 db $C0, $A2, $40, $44, $80, $04, $80, $AF db $03, $80, $AF, $03, $B0, $B5, $03, $E0 db $09, $FE, $19, $EF, $1C, $9F, $66, $7F db $83, $FF, $01, $A5, $03, $C0, $03, $FC db $1B, $7F, $B0, $C3, $04, $D3, $0C, $FF db $80, $FD, $00, $FA, $00, $F6, $00, $E6 db $00, $D9, $00, $E1, $88, $00, $23, $A3 db $00, $46, $17, $60, $01, $E0, $03, $C0 db $06, $C0, $0E, $81, $1C, $83, $3C, $07 db $78, $06, $F9, $0C, $F3, $08, $F7, $10 db $EF, $00, $FF, $25, $00, $83, $00, $DF db $05, $88, $00, $54, $AA, $00, $FF, $29 db $00, $01, $22, $00, $89, $05, $2D, $06 db $01, $00, $06, $00, $18, $00, $20, $A9 db $02, $E7, $08, $01, $41, $06, $67, $18 db $5F, $20, $3F, $40, $8B, $02, $80, $83 db $01, $E6, $87, $02, $80, $04, $B8, $47 db $C0, $3C, $E0, $89, $01, $E9, $14, $01 db $C1, $06, $E7, $18, $DF, $20, $BF, $40 db $00, $07, $04, $18, $10, $20, $24, $43 db $03, $4C, $54, $88, $4A, $08, $90, $09 db $80, $18, $08, $04, $04, $E2, $C0, $32 db $22, $19, $41, $10, $09, $0A, $46, $00 db $59, $00, $21, $00, $22, $00, $C2, $00 db $42, $41, $00, $84, $01, $00, $FC, $A3 db $00, $0F, $86, $02, $E5, $83, $03, $DC db $0B, $B9, $46, $A6, $59, $DE, $21, $DD db $22, $3D, $C2, $BD, $42, $41, $84, $00 db $01, $03, $FC, $41, $FB, $04, $88, $05 db $D6, $CC, $00, $BD, $00, $60, $41, $00 db $C0, $0A, $00, $80, $40, $00, $C0, $0C db $80, $38, $80, $78, $80, $41, $F0, $00 db $01, $00, $7E, $41, $0C, $42, $09, $00 db $C3, $42, $A5, $24, $5A, $42, $BD, $00 db $E7, $41, $04, $42, $41, $08, $46, $41 db $04, $42, $03, $88, $46, $89, $46, $84 db $00, $A6, $02, $04, $DC, $02, $42, $0E db $01, $09, $1E, $01, $1C, $02, $3A, $04 db $42, $3C, $30, $CE, $42, $F8, $07, $0B db $F0, $0F, $E0, $1E, $C2, $3C, $02, $FC db $0C, $E2, $06, $81, $41, $06, $01, $08 db $0E, $01, $E1, $1E, $C3, $3C, $03, $FC db $0D, $88, $06, $67, $07, $1D, $02, $3B db $04, $43, $3C, $35, $CA, $87, $06, $58 db $F4, $2F, $05, $90, $83, $00, $40, $02 db $0C, $00, $03, $8A, $00, $B9, $85, $03 db $08, $02, $19, $00, $61, $84, $00, $23 db $08, $3F, $C0, $CF, $30, $F3, $0C, $FC db $03, $FF, $84, $05, $1E, $07, $01, $00 db $FE, $01, $FD, $02, $F9, $06, $84, $06 db $D6, $01, $00, $80, $E4, $32, $00, $FF db $75, $4C, $16, $FF, $00, $80, $62, $7D db $0B, $00, $03, $03, $01, $04, $04, $01 db $04, $04, $06, $03, $07, $62, $07, $04 db $0B, $0B, $0C, $0F, $0F, $41, $80, $29 db $12, $25, $04, $2B, $04, $2C, $04, $04 db $2E, $4C, $39, $30, $32, $30, $80, $50 db $20, $40, $40, $80, $23, $42, $1A, $52 db $80, $44, $46, $80, $46, $54, $80, $56 db $42, $56, $44, $47, $80, $59, $80, $5A db $49, $4A, $4C, $4E, $F0, $F4, $80, $F2 db $F0, $F4, $41, $80, $F0, $0F, $F4, $80 db $F2, $F1, $F5, $80, $F1, $F5, $F4, $F1 db $F5, $F3, $46, $47, $44, $44, $22, $08 db $0B, $20, $52, $80, $82, $40, $82, $30 db $82, $80, $82, $0C, $0F, $41, $80, $82 db $0F, $52, $7C, $7F, $7F, $46, $49, $5B db $82, $42, $82, $0F, $09, $0C, $0B, $30 db $4E, $41, $4C, $82, $03, $F2, $7C, $04 db $7C, $22, $80, $01, $82, $46, $E4, $6D db $80, $62, $7D, $13, $10, $10, $13, $11 db $11, $14, $11, $11, $14, $10, $16, $17 db $17, $08, $1B, $1B, $19, $0E, $0E, $1C db $41, $37, $80, $12, $11, $35, $11, $3B db $3C, $11, $11, $3E, $27, $5C, $22, $40 db $40, $20, $80, $30, $30, $50, $52, $41 db $52, $42, $1A, $80, $80, $54, $56, $44 db $56, $80, $46, $80, $18, $42, $54, $57 db $49, $80, $4A, $80, $4B, $5A, $5C, $5E db $F2, $80, $F0, $F4, $F2, $80, $41, $80 db $F2, $0F, $80, $F0, $F4, $F3, $80, $F1 db $F3, $80, $80, $F3, $80, $F5, $57, $56 db $54, $54, $22, $08, $0B, $50, $42, $80 db $84, $30, $84, $40, $84, $80, $84, $0E db $0E, $41, $80, $84, $00, $42, $22, $7F db $0B, $56, $59, $59, $84, $52, $84, $0E db $19, $1C, $1B, $4A, $5E, $41, $5C, $84 db $03, $F4, $80, $11, $11, $22, $80, $01 db $84, $56, $E4, $6D, $80, $62, $7D, $85 db $00, $07, $11, $02, $05, $05, $01, $04 db $80, $4F, $4D, $0A, $1F, $1F, $0D, $1F db $1F, $24, $2A, $28, $2A, $83, $00, $08 db $1F, $2D, $26, $04, $2F, $4D, $4D, $23 db $2A, $31, $80, $51, $21, $41, $41, $80 db $43, $43, $80, $80, $53, $43, $45, $45 db $80, $48, $55, $80, $55, $43, $55, $48 db $48, $41, $80, $5A, $10, $4A, $4A, $4D db $4D, $F1, $F5, $80, $F3, $F1, $F6, $F4 db $F1, $F0, $F7, $F5, $F0, $F9, $24, $80 db $00, $FB, $22, $80, $41, $45, $48, $13 db $80, $0D, $1F, $21, $53, $80, $83, $41 db $83, $31, $83, $43, $83, $0D, $FD, $FF db $83, $80, $83, $53, $22, $7F, $0B, $48 db $4A, $4A, $83, $43, $83, $1F, $0A, $0D db $FD, $31, $4D, $41, $4D, $83, $03, $F3 db $80, $04, $04, $22, $80, $01, $83, $48 db $E4, $6D, $80, $62, $7D, $85, $01, $06 db $11, $12, $12, $15, $11, $14, $80, $5F db $5D, $1E, $1E, $1A, $1E, $1E, $1D, $38 db $34, $38, $3A, $22, $11, $10, $14, $3D db $11, $36, $3F, $5D, $5D, $38, $33, $41 db $21, $80, $31, $31, $51, $53, $53, $C4 db $02, $32, $03, $55, $55, $45, $55, $41 db $80, $45, $02, $43, $58, $58, $41, $4A db $80, $10, $5A, $5A, $5D, $5D, $F3, $80 db $F1, $F5, $F3, $F2, $80, $FA, $F2, $F3 db $80, $F8, $F5, $24, $80, $00, $F4, $22 db $80, $41, $58, $55, $E0, $22, $80, $1E db $1D, $51, $43, $80, $85, $31, $85, $41 db $85, $43, $85, $1E, $FC, $FE, $85, $80 db $85, $43, $7F, $7C, $7F, $58, $5A, $5A db $85, $53, $85, $1E, $1A, $1D, $FC, $4A db $5D, $41, $5D, $85, $02, $F5, $80, $7C db $83, $01, $8B, $01, $85, $55, $E4, $6C db $80, $23, $00, $2A, $01, $22, $02, $22 db $03, $22, $00, $41, $04, $05, $23, $01 db $03, $06, $01, $01, $07, $83, $04, $12 db $E4, $39, $00, $04, $02, $02, $02, $00 db $00, $43, $00, $21, $86, $04, $61, $02 db $FE, $FD, $10, $86, $04, $61, $02, $03 db $00, $03, $84, $04, $61, $04, $00, $00 db $FE, $FD, $FE, $E4, $71, $00, $FF, $73 db $23, $00, $05, $E0, $E0, $F8, $F8, $FC db $FC, $23, $FE, $01, $FF, $FF, $AF, $00 db $00, $41, $FF, $00, $08, $FF, $E0, $FF db $F8, $FF, $FC, $FF, $FE, $FF, $AF, $00 db $1D, $A4, $00, $0D, $01, $7E, $7E, $27 db $42, $C3, $00, $43, $87, $00, $40, $C7 db $00, $57, $87, $00, $40, $C7, $00, $67 db $87, $00, $40, $C7, $00, $77, $87, $00 db $40, $C7, $00, $87, $87, $00, $40, $C7 db $00, $97, $F0, $5F, $00, $40, $02, $7F db $00, $FD, $42, $03, $FE, $42, $03, $FF db $41, $02, $FF, $08, $FC, $1E, $F0, $3C db $E0, $78, $C0, $F0, $80, $C3, $01, $1B db $03, $FF, $00, $FF, $81, $41, $7E, $C2 db $0B, $7C, $E4, $FC, $A4, $98, $F8, $C0 db $78, $BF, $C0, $BF, $C1, $41, $FE, $C2 db $E0, $27, $FC, $E4, $BC, $E4, $D8, $F8 db $C0, $F8, $A0, $FC, $B0, $DE, $B8, $CF db $FC, $87, $DE, $83, $CF, $81, $C1, $8F db $C3, $9E, $C7, $BC, $CF, $F8, $DE, $F0 db $FC, $E0, $F8, $C0, $B0, $C0, $C0, $F0 db $C0, $F8, $83, $00, $0E, $00, $99, $45 db $00, $FF, $02, $7F, $C0, $80, $41, $BF db $C0, $00, $BB, $41, $C0, $BF, $0E, $C0 db $AF, $D0, $BF, $C0, $B3, $CC, $A1, $DE db $8C, $FF, $92, $F3, $A1, $E1, $22, $C0 db $41, $80, $40, $06, $8C, $40, $9E, $4C db $B3, $1E, $E1, $43, $3F, $C0, $09, $33 db $CC, $21, $DE, $00, $F3, $00, $E1, $00 db $C0, $41, $40, $80, $04, $03, $00, $07 db $00, $08, $2F, $00, $0D, $01, $01, $02 db $00, $04, $00, $08, $00, $10, $10, $20 db $00, $20, $20, $41, $40, $00, $01, $40 db $40, $42, $80, $00, $41, $80, $40, $41 db $80, $60, $00, $80, $41, $30, $40, $0F db $38, $40, $1C, $20, $1F, $20, $0F, $10 db $07, $08, $03, $04, $01, $02, $00, $01 db $A6, $01, $C1, $0C, $40, $20, $20, $10 db $10, $E8, $08, $F4, $04, $F2, $02, $F1 db $01, $C3, $01, $17, $AB, $01, $14, $AF db $02, $10, $F4, $2F, $01, $30, $0F, $3C db $3C, $42, $42, $E7, $C3, $E7, $24, $24 db $FF, $C3, $FF, $42, $7E, $3C, $3C, $83 db $00, $0E, $02, $FF, $00, $FD, $84, $01 db $65, $01, $DF, $20, $41, $FF, $00, $0B db $CD, $30, $87, $78, $33, $FC, $49, $CE db $84, $87, $02, $03, $C4, $01, $C6, $0A db $30, $00, $78, $30, $CC, $78, $86, $FC db $03, $FE, $01, $41, $FF, $00, $09, $CF db $30, $87, $78, $03, $CC, $01, $86, $00 db $03, $83, $01, $FA, $B0, $01, $B0, $04 db $0F, $08, $70, $40, $80, $2A, $00, $05 db $07, $04, $18, $10, $20, $20, $83, $01 db $D5, $8A, $01, $DB, $09, $38, $40, $3F db $40, $1F, $20, $07, $18, $00, $07, $83 db $02, $AE, $00, $F8, $84, $01, $65, $05 db $7F, $80, $0F, $70, $00, $0F, $F4, $2F db $02, $00, $05, $7F, $FF, $C0, $C0, $D9 db $80, $45, $BF, $C0, $00, $BD, $42, $C3 db $BE, $42, $C3, $BF, $04, $C2, $BF, $C2 db $FF, $FC, $8B, $01, $54, $24, $00, $04 db $18, $00, $3C, $00, $7E, $83, $01, $21 db $00, $C3, $86, $02, $6F, $41, $FF, $00 db $03, $BF, $40, $FB, $00, $A4, $02, $9E db $F4, $2C, $02, $83, $C3, $03, $AF, $00 db $F0, $84, $02, $F7, $05, $1F, $60, $03 db $1C, $00, $03, $F4, $3F, $02, $C0, $F4 db $2F, $01, $00, $F4, $2F, $03, $30, $08 db $E7, $18, $FF, $00, $E7, $00, $C3, $00 db $81, $26, $00, $A3, $01, $70, $01, $BD db $43, $41, $FD, $03, $00, $ED, $84, $04 db $37, $F4, $2F, $01, $80, $AF, $03, $B0 db $F4, $3F, $01, $C0, $08, $3E, $01, $61 db $00, $E1, $00, $80, $00, $81, $41, $00 db $87, $05, $00, $6F, $80, $1E, $E1, $E1 db $84, $05, $03, $00, $01, $84, $05, $09 db $02, $EF, $00, $77, $41, $80, $61, $00 db $80, $89, $05, $06, $8F, $05, $20, $01 db $F7, $00, $8D, $05, $12, $8F, $05, $40 db $05, $00, $18, $00, $2C, $00, $46, $4C db $00, $83, $84, $02, $00, $13, $38, $10 db $1C, $E8, $0E, $F4, $07, $F3, $02, $F1 db $01, $E7, $98, $7F, $40, $27, $20, $13 db $10, $E9, $86, $02, $09, $08, $80, $80 db $70, $60, $1F, $1C, $AB, $03, $7D, $C5 db $03, $79, $F0, $50, $00, $4F, $09, $1C db $E0, $E2, $00, $E1, $00, $81, $00, $01 db $00, $41, $86, $01, $01, $EE, $01, $8F db $05, $10, $02, $F6, $01, $E1, $8C, $06 db $03, $8F, $06, $20, $F0, $20, $05, $40 db $2B, $00, $85, $03, $71, $C9, $06, $71 db $02, $55, $55, $AA, $F4, $25, $05, $80 db $02, $E3, $C0, $5D, $85, $05, $A9, $F0 db $80, $00, $4F, $FF, $7F, $53, $16, $FF db $00, $80, $62, $7D, $E0, $25, $11, $23 db $06, $06, $04, $11, $11, $10, $80, $31 db $00, $31, $24, $07, $27, $27, $09, $29 db $29, $16, $26, $40, $41, $51, $43, $45 db $55, $46, $46, $0C, $2C, $1D, $48, $26 db $1B, $80, $1B, $0E, $23, $80, $E0, $23 db $4A, $7D, $7F, $7C, $82, $80, $23, $04 db $07, $09, $7D, $80, $82, $09, $82, $26 db $82, $29, $7F, $56, $56, $82, $56, $7C db $11, $80, $82, $7F, $82, $80, $7D, $7F db $80, $80, $82, $1D, $3D, $80, $00, $7F db $26, $80, $00, $82, $E4, $86, $80, $62 db $7D, $E0, $22, $21, $06, $06, $33, $21 db $21, $14, $80, $20, $30, $01, $34, $01 db $17, $17, $37, $19, $19, $39, $16, $26 db $41, $51, $50, $45, $55, $53, $56, $80 db $1C, $3C, $2D, $26, $58, $0B, $22, $80 db $E0, $20, $3E, $0B, $80, $80, $5A, $7D db $7F, $7F, $84, $80, $33, $14, $37, $39 db $7D, $80, $84, $39, $84, $26, $84, $19 db $7F, $46, $56, $84, $56, $80, $21, $80 db $84, $7F, $84, $84, $00, $4B, $01, $84 db $2D, $F0, $25, $00, $52, $00, $84, $E4 db $86, $80, $62, $7D, $E0, $4D, $12, $03 db $02, $02, $05, $12, $12, $30, $20, $12 db $01, $21, $25, $08, $28, $28, $0A, $2A db $2A, $80, $36, $42, $54, $54, $42, $54 db $54, $47, $47, $0D, $80, $1E, $30, $59 db $80, $3B, $80, $0F, $2F, $80, $3B, $80 db $7D, $7D, $7F, $7F, $83, $80, $03, $05 db $08, $0A, $F3, $80, $83, $0A, $83, $36 db $83, $2A, $7F, $57, $57, $83, $57, $80 db $12, $80, $83, $7F, $83, $F1, $7D, $7F db $80, $F1, $83, $1E, $35, $80, $00, $F1 db $8E, $00, $69, $00, $83, $E4, $86, $80 db $62, $7D, $E0, $4D, $22, $32, $32, $13 db $22, $22, $15, $10, $00, $31, $22, $35 db $11, $18, $18, $38, $1A, $1A, $3A, $80 db $36, $44, $44, $52, $44, $44, $52, $57 db $80, $80, $3D, $2E, $49, $00, $80, $2B db $80, $1F, $3F, $80, $80, $2B, $7D, $7D db $7C, $7F, $85, $80, $13, $15, $38, $3A db $F2, $80, $85, $3A, $85, $36, $85, $1A db $7F, $47, $57, $85, $57, $80, $7C, $7C db $85, $7F, $85, $F0, $7D, $7F, $80, $F0 db $85, $2E, $35, $80, $00, $F0, $8E, $00 db $69, $00, $85, $E4, $85, $80, $23, $00 db $26, $01, $01, $05, $04, $23, $01, $22 db $03, $22, $00, $00, $02, $2B, $00, $01 db $05, $04, $27, $00, $0A, $80, $80, $FD db $FE, $21, $00, $01, $01, $03, $00, $80 db $42, $00, $21, $11, $00, $90, $00, $00 db $21, $00, $FE, $FD, $FD, $21, $10, $21 db $00, $40, $10, $40, $00, $21, $3E, $00 db $00, $10, $C5, $04, $53, $01, $00, $21 db $E4, $85, $00, $FF, $76, $02, $FF, $FF db $7F, $53, $FF, $3F, $07, $FF, $00, $80 db $00, $00, $FF, $FF, $80, $43, $80, $BF db $08, $80, $CF, $B0, $8F, $90, $AF, $90 db $CF, $B0, $8F, $00, $34, $43, $BF, $80 db $01, $C0, $BF, $23, $FF, $01, $03, $01 db $45, $FD, $03, $01, $C1, $3F, $43, $C1 db $27, $03, $D9, $27, $C1, $3F, $46, $FD db $03, $00, $01, $24, $FF, $00, $80, $41 db $FF, $BF, $02, $ED, $AD, $FF, $84, $00 db $5D, $03, $9F, $9F, $FF, $FF, $42, $FF db $BF, $8D, $00, $99, $04, $ED, $AD, $FF db $BF, $FF, $AF, $00, $8C, $A4, $00, $A4 db $04, $E7, $FD, $E7, $E5, $E7, $84, $00 db $D0, $01, $FF, $E5, $42, $FF, $FD, $AD db $00, $B3, $05, $FE, $1F, $1F, $0F, $0F db $1F, $C4, $00, $F6, $04, $FF, $FE, $FF db $00, $FF, $F4, $2A, $00, $00, $00, $01 db $22, $00, $04, $FF, $3F, $E0, $40, $E3 db $46, $80, $FF, $0C, $A0, $DF, $F0, $8F db $F8, $87, $FC, $8B, $F6, $9D, $E3, $BE db $C1, $25, $80, $09, $90, $80, $B8, $80 db $FC, $80, $FE, $80, $FF, $80, $25, $01 db $04, $11, $01, $39, $01, $7D, $A4, $01 db $35, $0E, $01, $01, $02, $02, $05, $04 db $0B, $08, $13, $10, $27, $20, $5F, $40 db $BF, $44, $80, $FF, $43, $FF, $80, $41 db $E0, $80, $0B, $E0, $90, $E0, $98, $E0 db $9C, $E0, $BE, $C0, $FF, $80, $FE, $43 db $00, $FF, $00, $FE, $42, $01, $FF, $43 db $F9, $07, $07, $E8, $07, $C0, $07, $80 db $03, $00, $01, $41, $FF, $00, $01, $81 db $7E, $44, $00, $FF, $06, $55, $00, $AA db $00, $FF, $00, $77, $88, $01, $C6, $0B db $FD, $02, $F9, $06, $F3, $0C, $63, $9C db $46, $B9, $84, $7B, $C5, $01, $A5, $19 db $00, $FD, $00, $D9, $00, $B3, $00, $23 db $00, $46, $00, $04, $00, $08, $01, $FF db $02, $FE, $05, $DC, $0B, $B8, $13, $30 db $27, $60, $83, $01, $7C, $09, $80, $FE db $40, $7D, $A0, $39, $D0, $13, $C8, $0B db $A5, $02, $0A, $41, $C0, $00, $06, $E0 db $00, $F0, $00, $F8, $00, $FC, $C5, $01 db $F2, $03, $FF, $00, $00, $C3, $46, $00 db $FF, $0B, $0C, $F3, $1E, $E1, $3F, $C0 db $77, $80, $E3, $00, $C1, $01, $88, $01 db $35, $07, $EF, $80, $C7, $80, $83, $80 db $81, $80, $43, $FF, $01, $06, $EF, $01 db $C7, $01, $83, $01, $01, $B0, $01, $9F db $87, $01, $90, $07, $18, $E0, $1C, $E0 db $3E, $C0, $7F, $80, $8F, $02, $30, $BF db $01, $70, $43, $F9, $07, $07, $E9, $07 db $C1, $07, $81, $03, $01, $01, $83, $01 db $EF, $00, $F8, $C4, $02, $25, $02, $80 db $00, $80, $24, $00, $CD, $02, $E0, $C8 db $02, $3C, $00, $3C, $42, $00, $FF, $04 db $C0, $00, $F0, $00, $FC, $8A, $02, $35 db $00, $0F, $2E, $00, $F4, $22, $02, $20 db $11, $20, $DF, $70, $8F, $F8, $07, $FC db $1B, $E6, $3D, $C3, $7E, $81, $FE, $00 db $F0, $00, $C0, $8A, $02, $DB, $43, $10 db $EC, $43, $0F, $F0, $02, $03, $00, $03 db $D2, $03, $23, $04, $10, $00, $38, $00 db $7C, $83, $02, $2B, $C6, $03, $57, $00 db $FE, $8C, $02, $35, $02, $3F, $00, $1F db $43, $00, $0F, $02, $00, $FF, $FF, $8D db $03, $82, $C6, $01, $A6, $03, $01, $F8 db $07, $C0, $A4, $03, $04, $00, $E0, $30 db $00, $00, $E0, $8C, $02, $35, $0D, $7F db $7F, $F8, $F8, $F2, $F2, $F6, $F6, $F0 db $F0, $F9, $F9, $7F, $7F, $8B, $03, $D8 db $84, $01, $A0, $D0, $03, $1F, $AB, $03 db $70, $03, $FF, $00, $00, $FF, $A4, $01 db $30, $B2, $01, $37, $08, $C1, $77, $81 db $E3, $03, $C1, $03, $81, $07, $B2, $03 db $11, $02, $C0, $00, $C0, $B8, $03, $57 db $43, $FF, $00, $06, $EF, $00, $C7, $00 db $83, $00, $01, $B0, $03, $DB, $CF, $03 db $A6, $01, $FF, $FF, $8C, $04, $82, $F4 db $30, $03, $BF, $8E, $03, $D6, $BC, $03 db $FF, $83, $04, $2C, $B3, $04, $20, $01 db $A3, $C0, $45, $9F, $E0, $07, $9F, $E1 db $5A, $E7, $24, $FC, $1C, $F8, $42, $0C db $F0, $90, $02, $30, $08, $80, $FF, $81 db $5A, $E7, $24, $3C, $18, $18, $85, $05 db $16, $B0, $05, $30, $00, $87, $A4, $05 db $42, $02, $FF, $F8, $1F, $42, $F0, $0F db $89, $03, $60, $05, $4F, $B0, $3F, $C0 db $00, $FF, $AF, $05, $90, $C4, $03, $98 db $B0, $03, $75, $00, $00, $88, $03, $91 db $BF, $02, $D0, $8F, $04, $D6, $BF, $03 db $00, $D9, $06, $1E, $00, $FE, $C7, $02 db $29, $8C, $02, $D7, $DE, $06, $4E, $F4 db $3F, $06, $2F, $00, $00, $BF, $05, $B0 db $AF, $03, $F0, $03, $7F, $7F, $FC, $FC db $27, $FE, $A5, $06, $DC, $24, $3F, $CA db $06, $F6, $03, $F0, $F0, $FF, $FF, $A3 db $00, $F2, $01, $F0, $F0, $A3, $00, $FC db $01, $FC, $FC, $86, $00, $F6, $00, $FF db $A4, $07, $0A, $86, $06, $FF, $A9, $07 db $16, $03, $00, $00, $7E, $7E, $23, $42 db $C6, $07, $37, $00, $00, $C7, $07, $3F db $D7, $07, $47, $FF, $2C, $58, $16, $FF db $00, $80, $62, $7D, $E0, $24, $00, $20 db $20, $12, $35, $35, $38, $0C, $0E, $61 db $80, $17, $14, $08, $7D, $40, $42, $42 db $05, $08, $23, $80, $24, $23, $80, $80 db $0A, $0C, $7D, $7D, $61, $61, $1A, $3A db $7D, $3B, $0F, $22, $80, $0D, $50, $4E db $58, $52, $80, $80, $7D, $7D, $22, $27 db $1A, $3A, $1B, $80, $22, $7D, $0E, $36 db $27, $61, $5B, $5B, $5D, $5D, $5F, $5F db $2C, $2C, $EE, $F1, $EE, $F7, $2B, $61 db $01, $35, $7C, $34, $61, $00, $60, $90 db $00, $5F, $26, $60, $E4, $77, $80, $62 db $7D, $19, $10, $10, $30, $25, $25, $03 db $28, $0D, $0C, $61, $04, $80, $15, $07 db $7D, $42, $42, $44, $15, $18, $33, $80 db $34, $80, $80, $34, $85, $00, $1E, $02 db $2A, $4A, $2B, $C3, $01, $00, $E0, $20 db $1F, $48, $1E, $54, $80, $80, $56, $7D db $7D, $32, $7D, $2A, $4A, $80, $4B, $7D db $7D, $26, $37, $26, $61, $5C, $5C, $5E db $5E, $FC, $FC, $5A, $5A, $FE, $F4, $FE db $FA, $2B, $61, $04, $25, $7D, $61, $61 db $60, $90, $00, $6E, $00, $60, $F0, $93 db $00, $6F, $03, $01, $21, $21, $02, $22 db $25, $18, $04, $07, $61, $04, $07, $15 db $25, $22, $41, $43, $43, $06, $25, $23 db $80, $24, $46, $3E, $3F, $0B, $80, $29 db $39, $61, $61, $84, $00, $38, $10, $2D db $4C, $4D, $51, $80, $80, $53, $4F, $59 db $1A, $3A, $26, $37, $80, $80, $7D, $3B db $C3, $01, $34, $01, $37, $61, $42, $ED db $F0, $05, $ED, $F6, $EF, $F2, $EF, $F8 db $CB, $01, $66, $01, $25, $7D, $8C, $00 db $7B, $03, $61, $60, $60, $60, $8D, $02 db $58, $01, $61, $61, $CC, $00, $82, $E4 db $77, $80, $62, $7D, $1F, $11, $11, $31 db $35, $35, $13, $35, $14, $17, $61, $14 db $17, $35, $08, $32, $43, $43, $45, $35 db $19, $33, $80, $34, $2F, $3E, $47, $0B db $80, $09, $1C, $61, $61, $83, $01, $37 db $13, $1D, $3C, $3D, $7D, $80, $80, $55 db $49, $2E, $57, $2A, $4A, $36, $7D, $80 db $80, $2B, $7D, $22, $27, $22, $7D, $00 db $61, $42, $FD, $F3, $05, $FD, $F9, $FF db $F5, $FF, $FB, $8B, $02, $4A, $00, $7C db $F0, $A5, $02, $57, $23, $00, $26, $01 db $07, $04, $05, $00, $04, $05, $01, $01 db $00, $22, $03, $01, $01, $01, $E4, $2F db $00, $02, $10, $00, $18, $2C, $00, $01 db $FD, $FE, $E4, $A4, $00, $FF, $75, $4D db $3F, $FF, $07, $00, $80, $00, $00, $FF db $FF, $03, $01, $45, $FD, $03, $01, $C1 db $3F, $43, $C1, $27, $03, $D9, $27, $C1 db $3F, $46, $FD, $03, $00, $01, $24, $FF db $00, $80, $43, $80, $BF, $08, $80, $CF db $B0, $8F, $90, $AF, $90, $CF, $B0, $8F db $00, $54, $43, $BF, $80, $01, $C0, $BF db $A4, $00, $4E, $41, $FF, $FD, $01, $B7 db $B5, $43, $FF, $FD, $04, $E7, $FD, $E7 db $E5, $E7, $84, $00, $90, $01, $FF, $E5 db $44, $FF, $FD, $01, $B7, $B5, $C4, $00 db $85, $AD, $00, $7E, $22, $FF, $03, $9F db $9F, $FF, $FF, $A5, $00, $9D, $89, $00 db $B9, $AE, $00, $A3, $01, $FF, $FE, $53 db $FF, $FC, $03, $01, $00, $00, $00, $AF db $00, $E1, $42, $00, $FF, $03, $00, $7E db $00, $3C, $42, $00, $30, $43, $9F, $E0 db $08, $9F, $F8, $BF, $E4, $FF, $C2, $FF db $81, $7F, $45, $00, $FF, $E0, $38, $00 db $FE, $01, $FD, $03, $FE, $3E, $C0, $60 db $C0, $70, $C8, $70, $DC, $60, $7E, $C0 db $FF, $80, $FE, $01, $FC, $03, $F8, $07 db $F0, $0F, $E0, $0F, $C0, $07, $80, $03 db $00, $01, $00, $80, $00, $C0, $00, $E0 db $00, $F0, $08, $F0, $1C, $E0, $3E, $C0 db $7F, $80, $3F, $3F, $60, $40, $A3, $C0 db $44, $9F, $E0, $41, $9E, $E1, $41, $9D db $E3, $41, $5B, $E6, $03, $67, $BC, $5F db $BC, $41, $67, $98, $41, $43, $A4, $41 db $01, $C2, $43, $00, $C1, $41, $00, $C2 db $41, $40, $A4, $43, $40, $98, $41, $40 db $A4, $00, $00, $CC, $01, $B7, $01, $00 db $C2, $41, $00, $E4, $12, $27, $D8, $00 db $FF, $40, $00, $A0, $00, $10, $00, $89 db $00, $46, $00, $22, $00, $11, $00, $18 db $C4, $01, $2A, $06, $BF, $00, $1F, $00 db $8F, $00, $C7, $C4, $01, $F9, $06, $00 db $00, $07, $00, $18, $00, $20, $41, $00 db $40, $43, $00, $80, $07, $00, $40, $00 db $60, $00, $38, $00, $1F, $C4, $02, $03 db $87, $01, $47, $84, $01, $26, $02, $3C db $00, $0C, $43, $FF, $00, $1A, $FB, $1C db $E7, $24, $C3, $42, $81, $81, $FD, $03 db $FF, $3E, $C3, $60, $C7, $70, $CF, $70 db $DF, $60, $7F, $C0, $FF, $80, $FF, $3F db $E0, $8C, $01, $83, $16, $00, $80, $01 db $C0, $03, $E0, $07, $F0, $0F, $F0, $1F db $E0, $3F, $C0, $7F, $80, $FE, $01, $7C db $03, $38, $07, $10, $41, $0F, $00, $04 db $07, $00, $03, $00, $01, $C3, $00, $21 db $00, $C3, $8A, $01, $41, $41, $7E, $81 db $41, $BD, $C3, $41, $DB, $66, $03, $E7 db $3C, $FF, $3C, $41, $E7, $18, $41, $C3 db $24, $41, $81, $42, $43, $00, $81, $41 db $00, $42, $41, $00, $24, $41, $00, $18 db $00, $00, $D4, $02, $BF, $85, $02, $B6 db $06, $E7, $18, $00, $FF, $20, $00, $50 db $C4, $01, $E7, $0A, $24, $00, $4E, $00 db $9F, $00, $BE, $00, $7C, $00, $38, $84 db $01, $E3, $02, $C7, $00, $EF, $C3, $02 db $24, $F4, $20, $01, $FF, $41, $18, $20 db $41, $04, $30, $86, $03, $20, $A8, $02 db $2F, $06, $FF, $18, $FF, $24, $FF, $42 db $FF, $A4, $02, $3F, $0A, $FB, $06, $F3 db $0E, $E3, $0E, $C3, $06, $82, $03, $01 db $B0, $02, $4F, $1F, $BE, $C1, $BC, $C3 db $B8, $C7, $B0, $CF, $A0, $CF, $80, $C7 db $C0, $83, $C0, $81, $C0, $80, $80, $C0 db $80, $E0, $80, $F0, $88, $F0, $9C, $E0 db $BE, $C0, $BF, $C0, $F4, $5F, $01, $80 db $08, $3F, $00, $77, $08, $E3, $1C, $C1 db $3E, $80, $86, $01, $40, $04, $FE, $00 db $EC, $10, $C6, $AA, $03, $E5, $23, $00 db $00, $30, $41, $00, $78, $01, $00, $30 db $41, $00, $06, $84, $01, $20, $00, $F3 db $41, $00, $E1, $01, $00, $F3, $41, $00 db $9F, $B0, $03, $1F, $A9, $01, $30, $04 db $E5, $27, $C3, $43, $81, $B4, $01, $3F db $02, $3B, $06, $13, $41, $0E, $03, $01 db $06, $02, $A3, $03, $70, $15, $81, $03 db $C1, $01, $E3, $05, $F3, $0D, $F3, $1D db $E3, $3D, $C3, $7D, $83, $FD, $03, $7D db $03, $39, $07, $11, $41, $0F, $01, $00 db $07, $41, $01, $03, $C4, $03, $33, $00 db $CF, $41, $78, $87, $01, $30, $CF, $41 db $06, $F9, $41, $50, $80, $43, $24, $C0 db $41, $50, $80, $AF, $04, $90, $87, $01 db $48, $41, $F1, $0E, $03, $F3, $0C, $E3 db $1C, $AF, $04, $B0, $01, $07, $F8, $42 db $0F, $F0, $01, $7F, $80, $8D, $04, $42 db $42, $0F, $F0, $01, $07, $F8, $BF, $04 db $D0, $43, $00, $FF, $41, $06, $F1, $04 db $0A, $F1, $0A, $E1, $07, $42, $00, $0F db $00, $00, $87, $01, $40, $CE, $05, $2E db $00, $00, $DF, $05, $3F, $1F, $7D, $01 db $3A, $02, $15, $04, $8B, $08, $D3, $10 db $E3, $20, $C7, $40, $BF, $80, $3F, $01 db $76, $0A, $E5, $1C, $CB, $38, $93, $70 db $23, $E0, $47, $C0, $BF, $80, $43, $00 db $FF, $41, $04, $F3, $83, $05, $1C, $41 db $18, $04, $00, $21, $84, $04, $25, $11 db $1A, $04, $23, $0C, $22, $0C, $C0, $98 db $40, $58, $A0, $24, $D0, $14, $C8, $0A db $C4, $06, $A3, $05, $7C, $0A, $80, $81 db $40, $41, $A0, $22, $D0, $12, $C8, $0C db $C4, $A4, $05, $6B, $BF, $05, $A0, $0F db $FF, $7F, $F8, $F8, $F2, $F2, $F6, $F6 db $F0, $F0, $F9, $F9, $7F, $FF, $00, $81 db $AF, $05, $E0, $03, $FF, $7F, $FC, $FC db $27, $FE, $A5, $05, $FC, $29, $3F, $83 db $05, $FC, $F4, $3F, $05, $20, $08, $BC db $80, $7E, $40, $BF, $20, $DF, $10, $CF db $A6, $05, $69, $02, $FE, $80, $6C, $AC db $05, $73, $08, $58, $20, $98, $20, $04 db $30, $84, $30, $58, $86, $03, $21, $07 db $7F, $7F, $F0, $F0, $FF, $FF, $F8, $F8 db $23, $F0, $05, $7F, $7F, $00, $00, $FE db $FE, $A3, $06, $96, $03, $1F, $1F, $FF db $FF, $A7, $06, $9A, $83, $06, $92, $A3 db $06, $A6, $8D, $06, $9A, $C7, $06, $A5 db $03, $00, $00, $7E, $7E, $23, $42, $C5 db $06, $D7, $01, $00, $00, $C7, $06, $DF db $C5, $06, $E7, $01, $00, $00, $C7, $06 db $EF, $C5, $06, $F7, $01, $00, $00, $C7 db $06, $FF, $C5, $07, $07, $F0, $3F, $06 db $CE, $01, $00, $00, $FF, $EE, $5C, $16 db $FF, $00, $80, $62, $7D, $E0, $51, $06 db $16, $16, $04, $0D, $54, $24, $04, $02 db $22, $00, $20, $06, $16, $16, $80, $38 db $3C, $38, $43, $08, $18, $18, $7D, $80 db $1F, $50, $1F, $0A, $1A, $1A, $50, $1E db $41, $0F, $0F, $0E, $80, $1E, $3C, $7E db $43, $3E, $3D, $7D, $7D, $41, $3C, $7D db $3C, $7E, $7E, $3D, $3C, $7D, $7E, $3C db $43, $80, $50, $3B, $3E, $80, $50, $80 db $80, $52, $43, $7E, $7E, $50, $52, $3D db $7D, $7D, $3C, $7E, $3D, $80, $3D, $3D db $51, $41, $80, $7D, $0F, $2F, $2E, $7D db $80, $40, $40, $7D, $2E, $50, $52, $3C db $80, $43, $41, $80, $43, $23, $80, $01 db $0D, $04, $22, $60, $18, $20, $50, $0D db $38, $7C, $43, $08, $18, $3C, $1A, $48 db $13, $16, $4E, $4E, $57, $57, $59, $59 db $4C, $4C, $EE, $F4, $EE, $FA, $E4, $73 db $80, $62, $7D, $E0, $65, $16, $16, $26 db $14, $44, $1D, $14, $34, $12, $32, $10 db $30, $16, $16, $26, $37, $80, $7D, $53 db $37, $18, $18, $28, $3E, $0F, $80, $0F db $40, $1A, $1A, $2A, $0E, $40, $7D, $40 db $40, $1E, $0E, $80, $7D, $3B, $53, $3B db $7E, $7D, $51, $7D, $7D, $51, $7D, $3B db $7E, $53, $7D, $3E, $7E, $3E, $3B, $40 db $80, $3D, $3C, $40, $80, $40, $42, $80 db $7E, $53, $3B, $80, $80, $7E, $3E, $7D db $3E, $3B, $7E, $40, $3B, $53, $41, $80 db $7D, $40, $51, $51, $42, $3E, $80, $51 db $51, $3E, $40, $2E, $40, $51, $42, $3B db $51, $80, $53, $23, $80, $01, $1D, $14 db $22, $80, $18, $30, $40, $37, $1D, $80 db $53, $18, $28, $51, $4A, $1A, $16, $23 db $4F, $4F, $58, $58, $5A, $5A, $4D, $4D db $FD, $F1, $FD, $F7, $E4, $73, $80, $62 db $7D, $E0, $54, $01, $21, $21, $05, $45 db $32, $25, $05, $03, $05, $20, $20, $07 db $17, $17, $80, $38, $3F, $38, $0C, $09 db $19, $19, $3E, $80, $80, $7D, $40, $0B db $1B, $1B, $7D, $40, $0E, $40, $80, $0F db $80, $1F, $53, $7E, $80, $3D, $7D, $51 db $51, $80, $3B, $3E, $53, $3B, $3D, $51 db $7E, $3E, $3B, $7E, $80, $40, $7D, $3C db $3D, $42, $3E, $40, $42, $7E, $80, $53 db $3B, $51, $53, $3C, $3E, $3C, $3B, $3D db $3E, $80, $7D, $7D, $50, $80, $7D, $42 db $85, $01, $58, $05, $7D, $51, $40, $7D db $3B, $53, $41, $80, $40, $06, $80, $0E db $80, $1E, $0C, $2C, $05, $22, $80, $0C db $56, $7D, $2C, $38, $80, $80, $0B, $1B db $7E, $4B, $32, $07, $17, $42, $FF, $F3 db $05, $FF, $F9, $EF, $F5, $EF, $FB, $E4 db $73, $80, $62, $7D, $1F, $11, $11, $31 db $15, $02, $55, $15, $35, $15, $33, $30 db $30, $17, $17, $27, $37, $80, $3C, $1C db $37, $19, $19, $29, $46, $80, $80, $50 db $7D, $1B, $1B, $2B, $50, $41, $7D, $41 db $E0, $28, $1F, $0F, $80, $41, $3C, $80 db $3C, $3D, $41, $80, $41, $7D, $52, $41 db $7D, $3B, $80, $3C, $7E, $3D, $7E, $41 db $7D, $50, $3E, $3B, $3C, $52, $3A, $7E db $52, $43, $80, $3E, $80, $80, $3D, $3B db $3E, $3D, $3C, $83, $03, $39, $1A, $40 db $2E, $2F, $3C, $2E, $80, $7E, $36, $40 db $80, $50, $43, $7D, $50, $7D, $80, $43 db $7D, $80, $50, $80, $1E, $0E, $80, $1C db $2D, $7C, $22, $80, $0C, $47, $7D, $37 db $2D, $80, $0F, $1B, $2B, $52, $02, $49 db $17, $27, $42, $FC, $F0, $05, $FC, $F6 db $FE, $F2, $FE, $F8, $E4, $72, $80, $23 db $00, $23, $01, $01, $04, $05, $C5, $04 db $03, $22, $03, $E4, $5B, $00, $00, $FD db $26, $00, $00, $FE, $23, $00, $01, $04 db $05, $89, $04, $0D, $02, $10, $00, $18 db $E4, $73, $00, $FF, $86, $22, $FF, $00 db $FE, $53, $FF, $FC, $00, $01, $22, $00 db $F4, $2A, $00, $01, $14, $FF, $00, $80 db $00, $00, $FE, $FE, $1F, $1F, $4F, $4F db $6F, $6F, $0F, $0F, $9F, $9F, $FE, $FF db $F0, $0F, $AF, $00, $60, $15, $FF, $FE db $1F, $1F, $0F, $0F, $1F, $1F, $FF, $FF db $0F, $0F, $FF, $FE, $3F, $00, $FF, $7F db $F0, $F0, $FF, $FF, $A3, $00, $82, $A7 db $00, $8A, $83, $00, $82, $86, $00, $82 db $01, $FE, $FF, $88, $00, $8F, $A5, $00 db $88, $03, $FF, $00, $FE, $FE, $29, $3F db $02, $FF, $FE, $7F, $A4, $00, $BF, $27 db $FE, $A3, $00, $CC, $0E, $FF, $FF, $20 db $00, $70, $00, $24, $00, $0F, $00, $1E db $00, $0F, $00, $08, $44, $00, $FF, $00 db $00, $41, $F9, $06, $42, $FF, $00, $41 db $E7, $18, $44, $FF, $00, $05, $F3, $00 db $C3, $00, $C7, $00, $8B, $01, $08, $05 db $F3, $00, $E3, $00, $E7, $00, $C6, $01 db $04, $02, $FF, $03, $01, $45, $FD, $03 db $01, $C1, $3F, $43, $C1, $27, $03, $D9 db $27, $C1, $3F, $46, $FD, $03, $00, $01 db $24, $FF, $00, $80, $43, $80, $BF, $08 db $80, $CF, $B0, $8F, $90, $AF, $90, $CF db $B0, $8F, $01, $64, $43, $BF, $80, $01 db $C0, $BF, $A4, $01, $5E, $41, $FF, $FD db $01, $B7, $B5, $43, $FF, $FD, $04, $E7 db $FD, $E7, $E5, $E7, $84, $01, $A0, $01 db $FF, $E5, $44, $FF, $FD, $01, $B7, $B5 db $C4, $01, $95, $AD, $01, $8E, $22, $FF db $03, $9F, $9F, $FF, $FF, $A5, $01, $AD db $8D, $01, $C9, $A8, $01, $B7, $8B, $01 db $08, $02, $F0, $00, $FC, $A3, $00, $F7 db $07, $00, $9F, $00, $1F, $00, $3F, $00 db $3F, $C6, $01, $1B, $04, $07, $00, $1F db $00, $FF, $46, $00, $7F, $84, $00, $EF db $04, $8F, $00, $83, $00, $E3, $22, $00 db $0A, $C0, $C0, $30, $30, $4C, $0C, $A3 db $03, $D8, $00, $FD, $41, $00, $FF, $0C db $07, $D8, $DC, $33, $30, $0F, $4C, $E3 db $43, $E4, $98, $C9, $B6, $41, $CA, $B5 db $0D, $C9, $B6, $A4, $DB, $63, $DC, $50 db $EF, $2C, $F3, $1B, $FC, $07, $FF, $29 db $00, $07, $01, $01, $02, $02, $04, $04 db $08, $08, $23, $10, $23, $20, $0C, $40 db $71, $71, $4E, $BE, $C1, $FF, $FF, $80 db $00, $06, $00, $05, $42, $00, $04, $01 db $00, $18, $29, $00, $10, $81, $00, $81 db $81, $46, $C3, $3C, $8F, $70, $FF, $E0 db $1F, $18, $07, $06, $01, $01, $2C, $00 db $E0, $28, $02, $00, $83, $81, $42, $C3 db $24, $E6, $19, $FC, $83, $FC, $C3, $BF db $B0, $CF, $8C, $A3, $83, $80, $D8, $80 db $FD, $80, $FF, $8C, $FF, $CC, $7F, $C0 db $7F, $E0, $3F, $F0, $1F, $FC, $0F, $FF db $03, $FF, $00, $44, $00, $FF, $41, $C0 db $FF, $0F, $FF, $FF, $FE, $01, $FF, $C0 db $3F, $30, $4F, $0C, $23, $83, $00, $D0 db $00, $FA, $42, $00, $FF, $01, $0C, $FF db $C5, $03, $04, $03, $07, $FF, $F8, $FF db $8A, $00, $FE, $06, $01, $FE, $02, $FC db $04, $F8, $08, $41, $F0, $10, $41, $E0 db $20, $05, $C0, $71, $F1, $4E, $BF, $C0 db $A9, $02, $30, $A6, $02, $FB, $00, $C0 db $A7, $02, $42, $00, $07, $B4, $02, $4B db $06, $7F, $00, $1F, $07, $18, $18, $60 db $B6, $02, $A7, $01, $E7, $18, $A3, $02 db $80, $06, $00, $00, $1C, $00, $E4, $00 db $04, $41, $00, $08, $B0, $02, $8F, $01 db $FF, $00, $88, $00, $FE, $00, $98, $B1 db $03, $1C, $03, $7D, $83, $FF, $00, $BB db $02, $F2, $01, $FF, $1F, $89, $02, $E4 db $A6, $02, $EA, $02, $81, $FF, $03, $AD db $02, $C4, $08, $32, $FF, $02, $FF, $04 db $FF, $08, $FF, $30, $C5, $02, $EB, $08 db $00, $C0, $C0, $78, $38, $0E, $06, $03 db $01, $2F, $00, $A5, $02, $6A, $AF, $02 db $A0, $41, $8C, $FF, $00, $40, $A4, $04 db $03, $03, $18, $FF, $07, $FF, $8D, $02 db $FE, $01, $03, $FF, $A3, $00, $59, $04 db $FF, $07, $FC, $18, $F0, $A8, $04, $17 db $0A, $20, $00, $30, $00, $2E, $00, $44 db $00, $C2, $00, $2F, $C3, $04, $73, $42 db $00, $FF, $00, $00, $89, $03, $1A, $88 db $00, $F0, $04, $80, $FF, $60, $3F, $10 db $83, $03, $B4, $00, $03, $CC, $02, $6C db $83, $04, $70, $00, $0C, $42, $00, $02 db $04, $00, $03, $00, $00, $00, $CB, $04 db $58, $00, $00, $84, $01, $BF, $01, $80 db $FF, $41, $43, $7F, $0C, $20, $3F, $D0 db $1F, $F8, $0F, $FC, $07, $FE, $03, $3F db $01, $0F, $84, $04, $BB, $00, $C0, $84 db $01, $FB, $02, $18, $FF, $18, $88, $04 db $92, $06, $70, $FF, $FF, $0F, $0C, $FF db $0C, $47, $FF, $00, $C4, $02, $DE, $03 db $30, $F0, $C0, $C0, $84, $01, $FC, $06 db $FF, $00, $00, $30, $00, $78, $00, $C4 db $05, $26, $22, $00, $AF, $02, $70, $AD db $04, $50, $00, $3F, $41, $FF, $31, $01 db $FF, $03, $A4, $02, $D3, $01, $1F, $F8 db $A3, $04, $4B, $AF, $04, $60, $B9, $04 db $90, $F4, $25, $04, $6A, $41, $04, $00 db $05, $02, $00, $3E, $00, $40, $00, $AB db $05, $69, $87, $04, $F0, $01, $FF, $FF db $BF, $05, $00, $AF, $04, $F0, $BF, $04 db $D0, $03, $FF, $F8, $07, $07, $85, $02 db $A9, $02, $60, $00, $60, $84, $05, $6D db $E0, $22, $3F, $00, $CF, $C0, $73, $30 db $18, $08, $CC, $04, $C2, $02, $01, $01 db $40, $00, $E0, $00, $40, $00, $04, $00 db $3C, $00, $1F, $00, $1E, $00, $12, $00 db $FF, $01, $3E, $02, $0C, $84, $02, $6F db $00, $E1, $83, $03, $67, $AA, $06, $1F db $83, $06, $18, $01, $03, $00, $CD, $06 db $20, $08, $7C, $70, $0F, $0F, $00, $00 db $10, $00, $38, $A7, $03, $8D, $8D, $06 db $6F, $A6, $02, $09, $01, $FF, $00, $41 db $FE, $01, $41, $FC, $03, $41, $F9, $06 db $41, $F3, $0C, $41, $E7, $18, $42, $CF db $30, $0F, $03, $0C, $01, $06, $00, $07 db $00, $03, $84, $03, $38, $C7, $01, $FE db $83, $7C, $A5, $06, $25, $09, $01, $06 db $08, $07, $F0, $0F, $02, $FD, $0F, $F0 db $C5, $02, $93, $03, $24, $18, $42, $3C db $C3, $03, $A1, $A3, $02, $16, $02, $F8 db $00, $E0, $A4, $06, $6B, $00, $80, $84 db $05, $B9, $CF, $06, $FE, $0C, $F8, $00 db $F0, $00, $E3, $00, $C7, $00, $8F, $00 db $18, $00, $30, $43, $00, $33, $09, $00 db $31, $00, $18, $00, $8C, $00, $CE, $00 db $FF, $B0, $06, $2F, $A9, $06, $50, $03 db $07, $06, $11, $01, $87, $03, $71, $C5 db $02, $92, $00, $18, $84, $00, $2D, $02 db $C0, $00, $C0, $89, $06, $65, $B4, $06 db $6F, $25, $00, $02, $0C, $00, $0C, $B2 db $06, $8D, $BF, $06, $C0, $BF, $06, $A0 db $01, $FF, $FF, $2C, $00, $F4, $20, $06 db $EF, $83, $07, $F4, $00, $F1, $A4, $02 db $05, $02, $1E, $00, $0E, $41, $00, $CE db $03, $00, $8E, $00, $8C, $C8, $08, $17 db $83, $02, $5F, $01, $7E, $7E, $23, $42 db $C6, $08, $37, $00, $00, $C7, $08, $3F db $D7, $08, $47, $FF, $3C, $63, $16, $FF db $00, $80, $62, $7D, $00, $45, $22, $2F db $18, $40, $46, $43, $EB, $52, $03, $5B db $07, $09, $0C, $0C, $0E, $1E, $09, $0C db $7D, $34, $05, $33, $7D, $47, $58, $4B db $49, $2A, $22, $3A, $06, $2D, $7D, $7D db $FE, $EF, $7D, $80, $24, $7D, $07, $5C db $80, $4D, $80, $80, $4C, $4D, $7D, $23 db $81, $22, $46, $00, $00, $22, $81, $06 db $52, $7C, $01, $45, $43, $EC, $4E, $25 db $81, $09, $EA, $EA, $E8, $E8, $E6, $E6 db $E4, $E4, $E1, $FA, $41, $E1, $F4, $E4 db $A1, $80, $62, $7D, $1C, $53, $55, $53 db $3F, $56, $50, $53, $53, $41, $13, $5B db $17, $19, $19, $1C, $20, $1F, $19, $1C db $7D, $23, $15, $26, $7D, $57, $4B, $4A db $59, $3A, $22, $2D, $00, $3D, $85, $00 db $2B, $00, $7D, $41, $7D, $4C, $07, $7D db $5D, $80, $80, $7D, $5C, $5D, $4C, $23 db $80, $22, $56, $00, $10, $22, $80, $06 db $41, $80, $11, $3F, $55, $ED, $5E, $25 db $80, $09, $E9, $E9, $E7, $E7, $E5, $E5 db $E3, $E3, $DE, $F7, $41, $DE, $F1, $E4 db $A1, $80, $62, $7D, $24, $41, $00, $42 db $22, $41, $0F, $04, $06, $08, $0A, $0B db $0D, $0F, $08, $21, $22, $7D, $35, $28 db $36, $37, $48, $22, $EC, $0B, $2B, $2C db $39, $39, $2E, $7D, $7D, $FF, $7D, $7D db $80, $5C, $23, $4C, $06, $80, $5D, $7D db $4D, $5D, $4D, $7D, $C4, $01, $00, $03 db $46, $44, $46, $46, $84, $01, $3F, $04 db $02, $41, $41, $ED, $4F, $25, $80, $42 db $E0, $F3, $03, $E0, $F9, $E2, $FB, $41 db $E2, $F5, $E4, $A1, $80, $62, $7D, $23 db $52, $00, $51, $23, $52, $06, $14, $16 db $18, $1A, $1B, $1D, $14, $62, $30, $04 db $25, $24, $38, $27, $7D, $22, $ED, $0D db $5A, $3B, $29, $29, $3C, $3E, $FC, $FD db $7D, $7D, $EE, $80, $7D, $80, $41, $80 db $5C, $06, $7D, $4D, $80, $7D, $5D, $7D db $4D, $85, $01, $37, $00, $54, $C3, $01 db $3B, $06, $7C, $80, $12, $52, $52, $EC db $5F, $25, $80, $42, $DD, $F0, $03, $DD db $F6, $DF, $F8, $41, $DF, $F2, $E4, $A0 db $80, $23, $00, $23, $01, $01, $85, $84 db $22, $01, $02, $04, $01, $05, $22, $81 db $08, $04, $05, $81, $81, $00, $04, $03 db $05, $00, $C8, $03, $FF, $36, $00, $84 db $04, $1D, $04, $80, $00, $FD, $FE, $83 db $AB, $04, $1F, $85, $04, $1F, $05, $18 db $00, $10, $00, $90, $80, $E4, $A0, $00 db $FF, $93, $22, $FF, $00, $FE, $53, $FF db $FC, $00, $01, $22, $00, $F4, $2A, $00 db $01, $06, $FF, $00, $80, $00, $00, $FF db $FE, $25, $8F, $01, $0F, $0F, $C4, $00 db $63, $00, $FF, $A9, $00, $60, $A3, $00 db $00, $08, $00, $FF, $FE, $FE, $1F, $1F db $0F, $0F, $1F, $C6, $00, $86, $03, $1C db $00, $FF, $7F, $83, $00, $78, $00, $F8 db $C4, $00, $96, $03, $FF, $7F, $78, $00 db $87, $00, $80, $A3, $00, $98, $8B, $00 db $8C, $01, $F0, $F0, $85, $00, $9A, $01 db $FF, $FE, $29, $3F, $A3, $00, $7C, $A3 db $00, $C0, $27, $FE, $A3, $00, $6C, $0D db $7F, $FF, $F8, $F8, $F2, $F2, $F6, $F6 db $F0, $F0, $F9, $F9, $FF, $7F, $AF, $00 db $DE, $00, $00, $C3, $00, $70, $08, $00 db $FE, $01, $F0, $0F, $C0, $3F, $80, $7F db $43, $00, $FF, $07, $80, $7F, $C0, $3F db $F0, $0F, $FE, $01, $42, $FF, $00, $01 db $C0, $3F, $4B, $00, $FF, $01, $C0, $3F db $BF, $01, $1E, $01, $FF, $00, $F4, $21 db $01, $00, $C5, $01, $47, $01, $E0, $1F db $8B, $01, $0A, $01, $E0, $1F, $CB, $01 db $5D, $01, $E0, $1F, $49, $00, $FF, $01 db $E0, $1F, $BF, $01, $9C, $F4, $24, $01 db $7C, $02, $FF, $03, $01, $45, $FD, $03 db $01, $C1, $3F, $43, $C1, $27, $03, $D9 db $27, $C1, $3F, $46, $FD, $03, $00, $01 db $24, $FF, $00, $80, $43, $80, $BF, $08 db $80, $CF, $B0, $8F, $90, $AF, $90, $CF db $B0, $8F, $02, $34, $43, $BF, $80, $01 db $C0, $BF, $A4, $02, $2E, $41, $FF, $FD db $01, $B7, $B5, $43, $FF, $FD, $04, $E7 db $FD, $E7, $E5, $E7, $84, $02, $70, $01 db $FF, $E5, $44, $FF, $FD, $01, $B7, $B5 db $C4, $02, $65, $AD, $02, $5E, $22, $FF db $03, $9F, $9F, $FF, $FF, $A5, $02, $7D db $8D, $02, $99, $A9, $02, $87, $86, $01 db $0C, $47, $00, $FF, $C5, $01, $33, $93 db $01, $DC, $A3, $01, $94, $D4, $01, $3D db $41, $01, $FF, $02, $02, $FF, $02, $45 db $FE, $04, $04, $FE, $03, $03, $01, $03 db $2C, $00, $07, $67, $80, $3C, $C3, $00 db $FF, $40, $BE, $41, $40, $80, $83, $02 db $C6, $07, $10, $8F, $13, $8F, $1F, $8C db $1C, $90, $41, $30, $A0, $41, $60, $C0 db $83, $01, $76, $0B, $07, $F8, $03, $9C db $01, $8E, $C0, $07, $E0, $03, $F0, $01 db $45, $08, $10, $03, $EF, $10, $00, $FF db $45, $80, $01, $0B, $FE, $01, $00, $FF db $10, $20, $D0, $E0, $F0, $30, $38, $08 db $41, $0C, $04, $07, $07, $02, $06, $03 db $FE, $03, $FF, $01, $41, $FC, $03, $41 db $F9, $06, $03, $F3, $0C, $F0, $0F, $C3 db $00, $31, $E0, $2E, $3B, $00, $08, $77 db $90, $6F, $A0, $5F, $80, $3F, $00, $7F db $81, $7E, $83, $7C, $87, $78, $8F, $70 db $9F, $60, $BE, $41, $BC, $03, $38, $07 db $F0, $8E, $60, $5C, $20, $38, $51, $10 db $AB, $48, $B7, $44, $8A, $32, $05, $79 db $82, $7C, $82, $8C, $03, $B3, $04, $03 db $00, $07, $00, $0C, $83, $03, $BD, $16 db $0F, $C1, $3E, $03, $FC, $07, $F8, $1F db $E1, $0E, $72, $05, $3C, $0B, $18, $97 db $10, $EE, $21, $DC, $43, $B8, $87, $C3 db $01, $1C, $05, $FE, $30, $F0, $40, $C0 db $80, $41, $80, $00, $00, $00, $42, $00 db $C0, $00, $00, $41, $60, $80, $05, $38 db $C0, $1F, $E0, $07, $78, $25, $00, $01 db $18, $00, $41, $24, $18, $11, $44, $38 db $82, $7C, $02, $FC, $01, $CE, $40, $87 db $40, $83, $40, $80, $40, $80, $7F, $80 db $B1, $03, $3E, $0A, $20, $C0, $19, $E0 db $0F, $70, $00, $3F, $20, $1F, $20, $84 db $03, $6B, $45, $01, $02, $03, $FD, $02 db $00, $FF, $45, $80, $00, $83, $02, $C6 db $05, $0E, $00, $00, $1D, $04, $3B, $89 db $03, $A6, $B3, $03, $90, $1E, $F8, $00 db $0F, $F0, $1F, $E0, $3E, $C1, $7C, $83 db $F8, $07, $F1, $0E, $E2, $1D, $C4, $3B db $88, $77, $10, $EF, $20, $DF, $40, $BF db $80, $7F, $C0, $00, $F0, $B0, $03, $E3 db $0B, $20, $3C, $D0, $18, $29, $C8, $37 db $C4, $4A, $B2, $85, $79, $A5, $03, $C0 db $02, $88, $08, $D7, $86, $03, $F9, $03 db $70, $0F, $E0, $1F, $8B, $01, $08, $AF db $04, $00, $02, $FF, $FF, $FF, $36, $00 db $01, $01, $00, $41, $02, $01, $AF, $04 db $50, $BD, $04, $20, $F4, $21, $04, $5E db $05, $FE, $00, $00, $FC, $07, $F8, $89 db $04, $A6, $41, $E2, $1C, $41, $CA, $34 db $41, $9A, $64, $07, $3B, $C4, $00, $FF db $FC, $FF, $FF, $03, $8B, $03, $22, $8F db $04, $C0, $07, $E0, $1F, $E3, $1F, $EF db $1C, $FC, $10, $41, $F0, $20, $41, $E0 db $40, $42, $A0, $C0, $05, $B8, $C0, $DF db $60, $C7, $78, $83, $01, $08, $07, $F0 db $0E, $E0, $1C, $C0, $38, $81, $70, $A3 db $03, $5A, $05, $0E, $80, $1C, $00, $1E db $E0, $AD, $05, $E0, $BF, $03, $00, $AF db $05, $20, $AF, $03, $50, $CC, $05, $1E db $02, $00, $00, $FF, $AF, $03, $30, $F4 db $2F, $03, $60, $AF, $05, $90, $07, $E3 db $1C, $E3, $DC, $F3, $3C, $3B, $0C, $B7 db $05, $C8, $B1, $05, $A0, $8D, $03, $E2 db $8B, $05, $F2, $04, $F0, $01, $78, $00 db $F8, $AA, $05, $F1, $04, $06, $C0, $0C db $80, $0E, $8E, $06, $E1, $05, $0C, $73 db $04, $3B, $00, $1F, $C5, $06, $3F, $03 db $F2, $01, $7A, $01, $C3, $03, $55, $0B db $E2, $1D, $C2, $39, $82, $71, $00, $E3 db $04, $C3, $0E, $81, $84, $06, $32, $00 db $3B, $83, $05, $52, $01, $06, $C1, $83 db $05, $EC, $01, $C0, $3F, $8D, $06, $F2 db $07, $01, $06, $06, $09, $00, $08, $00 db $0A, $41, $02, $05, $09, $03, $FC, $03 db $04, $53, $04, $AB, $54, $03, $FC, $44 db $03, $04, $46, $47, $00, $00, $47, $F4 db $20, $02, $DF, $0D, $7E, $80, $3C, $C0 db $18, $E0, $00, $F0, $00, $E0, $00, $C0 db $00, $80, $89, $02, $C7, $03, $FB, $04 db $F1, $0E, $86, $04, $F2, $04, $FE, $00 db $FC, $00, $F8, $84, $07, $A6, $00, $40 db $85, $02, $C7, $00, $F8, $86, $07, $A8 db $0C, $80, $00, $0C, $00, $0F, $00, $1B db $00, $B0, $00, $E1, $00, $C3, $4A, $00 db $C7, $00, $00, $AF, $03, $20, $AB, $07 db $10, $04, $4E, $80, $5C, $80, $1E, $AC db $07, $21, $01, $30, $C1, $AF, $07, $30 db $01, $06, $F8, $8D, $05, $F2, $AB, $07 db $50, $07, $80, $7F, $80, $60, $4A, $A0 db $55, $AA, $83, $08, $5C, $84, $08, $58 db $0D, $60, $80, $60, $87, $60, $67, $90 db $07, $10, $07, $50, $47, $A0, $47, $8A db $08, $5B, $01, $87, $60, $41, $47, $A0 db $41, $87, $60, $45, $FF, $00, $10, $FB db $04, $31, $0E, $00, $1F, $10, $0F, $38 db $07, $7C, $03, $F8, $01, $70, $00, $20 db $83, $06, $49, $8A, $07, $C2, $03, $C0 db $00, $00, $80, $AF, $04, $10, $B2, $07 db $D0, $06, $20, $0D, $F0, $87, $78, $C3 db $3C, $4A, $E3, $1C, $03, $00, $00, $7E db $7E, $27, $42, $C3, $09, $03, $87, $09 db $00, $D7, $09, $17, $FF, $49, $69, $16 db $FF, $00, $80, $62, $7D, $04, $0A, $18 db $0C, $2E, $00, $22, $21, $E0, $2C, $20 db $2C, $21, $2A, $09, $13, $DE, $15, $25 db $51, $2E, $2E, $14, $17, $50, $36, $37 db $51, $2E, $2E, $43, $5C, $80, $21, $21 db $4D, $4F, $7D, $45, $7D, $5D, $7D, $5F db $E0, $E4, $FC, $45, $7D, $4B, $59, $5B db $E8, $EC, $48, $FE, $22, $7D, $07, $E1 db $7E, $E5, $81, $7D, $7D, $E9, $ED, $29 db $81, $11, $18, $7C, $DD, $DD, $DB, $DB db $D9, $D9, $D7, $D7, $DE, $DE, $D4, $FA db $D4, $F4, $7D, $7D, $E4, $9F, $80, $62 db $7D, $04, $1A, $28, $3E, $1E, $10, $22 db $21, $E0, $2B, $30, $3C, $21, $3A, $03 db $23, $DF, $25, $19, $3E, $3E, $41, $07 db $06, $80, $27, $04, $40, $40, $41, $11 db $53, $02, $21, $21, $5D, $5F, $48, $55 db $4D, $7D, $4F, $7D, $E2, $E6, $FE, $57 db $59, $5B, $4B, $47, $EA, $EE, $FC, $23 db $7D, $07, $E3, $7E, $E7, $80, $7D, $7D db $EB, $EF, $29, $80, $10, $28, $7D, $DC db $DC, $DA, $DA, $D8, $D8, $D6, $D6, $DF db $DF, $D1, $F7, $D1, $F1, $5B, $F0, $A3 db $00, $5F, $19, $0B, $0B, $0D, $0F, $01 db $12, $32, $32, $80, $2D, $1C, $2B, $29 db $16, $F9, $34, $36, $52, $2F, $2F, $02 db $16, $1C, $34, $38, $52, $22, $2F, $1A db $05, $1C, $80, $1C, $4E, $4F, $7D, $46 db $7D, $5E, $7D, $5F, $E1, $E5, $FD, $46 db $4A, $4C, $5A, $80, $E9, $ED, $49, $FF db $E0, $7E, $E4, $22, $7D, $02, $80, $E8 db $EC, $8B, $00, $5E, $01, $0B, $7D, $43 db $D3, $F3, $05, $D3, $F9, $D5, $FB, $D5 db $F5, $F0, $A4, $01, $5D, $E0, $37, $1B db $1B, $1D, $1F, $80, $22, $22, $24, $31 db $3D, $0E, $3B, $06, $34, $F6, $26, $39 db $3F, $3F, $42, $08, $34, $0E, $26, $50 db $3F, $3F, $42, $33, $3F, $0E, $0E, $80 db $5E, $5F, $49, $56, $4E, $7D, $4F, $7D db $E3, $E7, $FF, $58, $5A, $80, $4C, $47 db $EB, $EF, $FD, $7D, $E2, $7E, $E6, $83 db $02, $3A, $01, $EA, $EE, $8B, $00, $5E db $01, $7C, $7D, $43, $D0, $F0, $07, $D0 db $F6, $D2, $F8, $D2, $F2, $80, $5B, $E4 db $9E, $80, $23, $00, $04, $01, $01, $05 db $04, $00, $22, $03, $03, $00, $04, $03 db $05, $27, $00, $04, $05, $00, $03, $00 db $04, $24, $00, $02, $03, $03, $03, $E4 db $28, $00, $01, $FD, $FE, $29, $00, $02 db $18, $00, $10, $E4, $A1, $00, $FF, $83 db $03, $00, $00, $7E, $7E, $27, $42, $C3 db $00, $03, $87, $00, $00, $C7, $00, $17 db $87, $00, $00, $C7, $00, $27, $F0, $2F db $00, $00, $85, $00, $00, $00, $C2, $F0 db $28, $00, $07, $22, $FF, $00, $FE, $53 db $FF, $FC, $03, $01, $00, $00, $00, $F4 db $2A, $00, $91, $0D, $FF, $00, $80, $00 db $00, $FF, $FE, $0F, $0F, $FF, $FF, $1F db $1F, $0F, $C3, $00, $F8, $06, $FE, $7F db $00, $FF, $FF, $03, $01, $45, $FD, $03 db $01, $C1, $3F, $43, $C1, $27, $03, $D9 db $27, $C1, $3F, $46, $FD, $03, $00, $01 db $24, $FF, $00, $80, $43, $80, $BF, $08 db $80, $CF, $B0, $8F, $90, $AF, $90, $CF db $B0, $8F, $01, $34, $43, $BF, $80, $01 db $C0, $BF, $A4, $01, $2E, $41, $FF, $FD db $01, $B7, $B5, $43, $FF, $FD, $04, $E7 db $FD, $E7, $E5, $E7, $84, $01, $70, $01 db $FF, $E5, $44, $FF, $FD, $01, $B7, $B5 db $C4, $01, $65, $AD, $01, $5E, $22, $FF db $03, $9F, $9F, $FF, $FF, $A5, $01, $7D db $8D, $01, $99, $A9, $01, $87, $00, $FE db $83, $00, $F6, $89, $00, $F6, $01, $7F db $7F, $25, $F1, $A3, $00, $F2, $02, $7F db $7F, $00, $AA, $01, $CF, $C6, $01, $E3 db $02, $FF, $F0, $F0, $85, $01, $D6, $C3 db $01, $F3, $01, $F0, $00, $C4, $00, $C1 db $02, $00, $FF, $00, $41, $E7, $18, $41 db $FF, $00, $E0, $3E, $DF, $27, $FF, $0F db $FF, $1F, $FF, $F8, $F8, $F7, $F0, $EF db $E0, $1F, $00, $FF, $FF, $01, $DE, $02 db $8C, $04, $09, $08, $13, $10, $27, $20 db $4C, $40, $9C, $80, $E1, $01, $C3, $03 db $87, $07, $CF, $08, $F8, $17, $F0, $2F db $E0, $5F, $C0, $BF, $FC, $00, $F8, $00 db $F0, $00, $E1, $00, $C3, $00, $87, $00 db $0F, $00, $1F, $84, $01, $FF, $05, $FF db $00, $FB, $00, $DF, $20, $41, $FF, $00 db $01, $73, $0C, $46, $FF, $00, $E0, $21 db $FF, $01, $FE, $02, $FC, $04, $F8, $08 db $F1, $10, $E3, $20, $C7, $40, $8D, $82 db $9F, $80, $1F, $E0, $0F, $F0, $07, $F8 db $83, $7C, $C1, $3E, $E0, $1F, $F0, $0F db $F8, $07, $84, $02, $00, $00, $C3, $44 db $00, $FF, $11, $FE, $01, $FC, $03, $FB db $04, $F7, $08, $EF, $10, $C7, $38, $83 db $7C, $01, $FE, $03, $FC, $C6, $02, $8F db $02, $C0, $7C, $80, $83, $02, $42, $09 db $E0, $00, $C1, $00, $83, $00, $C7, $00 db $EF, $00, $A5, $02, $A8, $17, $00, $FE db $00, $FF, $80, $FF, $40, $FF, $20, $FF db $90, $7F, $C8, $3F, $C4, $3F, $82, $7F db $01, $FF, $0C, $F3, $1E, $E1, $87, $02 db $B8, $09, $60, $FF, $90, $FF, $08, $FF db $64, $9F, $F3, $0F, $A5, $02, $82, $87 db $02, $00, $03, $FF, $00, $EF, $10, $84 db $02, $60, $00, $E0, $AD, $02, $12, $16 db $83, $FC, $47, $78, $2F, $30, $9F, $10 db $CE, $08, $E4, $04, $F2, $02, $F9, $01 db $FF, $80, $FF, $C0, $FF, $E0, $FF, $BE db $02, $37, $02, $FF, $00, $FB, $8E, $02 db $67, $07, $F0, $10, $E1, $20, $C3, $40 db $87, $80, $41, $7F, $00, $00, $FF, $41 db $00, $CF, $84, $02, $61, $05, $FD, $02 db $F8, $07, $B0, $4F, $AC, $02, $84, $83 db $02, $6F, $0A, $05, $F8, $0B, $F0, $17 db $E0, $2F, $C0, $5F, $80, $BF, $83, $02 db $D4, $05, $21, $FF, $92, $7F, $CC, $3F db $C3, $02, $E7, $A5, $03, $54, $0D, $8E db $01, $04, $03, $08, $07, $1C, $03, $3E db $01, $7F, $00, $83, $7C, $8D, $02, $B2 db $A8, $03, $90, $06, $88, $07, $C4, $03 db $EA, $01, $FD, $89, $02, $D0, $0B, $10 db $7F, $08, $3F, $64, $1F, $F2, $0F, $F9 db $07, $FC, $03, $CA, $02, $70, $83, $02 db $01, $86, $03, $34, $84, $03, $1B, $05 db $00, $FD, $02, $DF, $00, $FF, $A8, $04 db $04, $83, $01, $30, $0D, $E0, $9F, $E0 db $FF, $90, $9F, $88, $8F, $97, $87, $98 db $80, $9E, $81, $41, $93, $8C, $0C, $9F db $80, $9F, $87, $9F, $88, $98, $97, $F0 db $EF, $3F, $07, $3F, $8C, $02, $13, $00 db $F3, $86, $02, $5F, $02, $DF, $20, $FF db $A4, $03, $71, $0D, $80, $FF, $40, $7F db $20, $3F, $10, $1F, $08, $0F, $84, $07 db $C2, $03, $A8, $03, $6E, $03, $0C, $F3 db $0C, $7F, $C5, $04, $5F, $02, $00, $FF db $00, $87, $02, $BC, $03, $C3, $00, $C7 db $00, $BB, $03, $90, $83, $02, $CC, $03 db $FE, $01, $FD, $02, $8B, $02, $A4, $A3 db $02, $A0, $83, $02, $80, $07, $37, $C8 db $7B, $84, $F9, $02, $F0, $01, $BD, $03 db $D0, $09, $20, $F8, $40, $F0, $81, $E0 db $03, $C0, $47, $80, $87, $02, $C8, $AD db $04, $00, $00, $1E, $88, $02, $05, $01 db $FD, $E2, $A9, $04, $1A, $00, $01, $A3 db $03, $10, $07, $F9, $11, $F7, $E9, $E7 db $19, $07, $F9, $41, $07, $C9, $41, $07 db $F9, $0C, $E7, $F9, $17, $19, $EF, $0F db $F7, $00, $FF, $03, $FC, $0F, $F0, $A3 db $03, $F4, $A4, $03, $F6, $01, $80, $7F db $84, $02, $C9, $01, $F7, $08, $43, $FF db $00, $0F, $7F, $FF, $F8, $F8, $F2, $F2 db $F6, $F6, $F0, $F0, $F9, $F9, $FF, $7F db $F8, $07, $85, $04, $62, $09, $88, $0F db $C4, $07, $E2, $03, $B1, $41, $F9, $01 db $AF, $04, $80, $AF, $02, $80, $A9, $02 db $A0, $05, $FB, $04, $FD, $02, $FE, $01 db $A7, $04, $C0, $07, $E0, $1F, $D0, $2F db $B8, $47, $7D, $82, $A3, $04, $B0, $8B db $05, $A4, $AD, $02, $D0, $00, $27, $A4 db $03, $EF, $03, $0E, $C1, $04, $83, $86 db $03, $B8, $AA, $02, $EF, $03, $1F, $E0 db $3F, $C0, $83, $03, $51, $01, $00, $FF db $AB, $05, $04, $85, $05, $AE, $83, $05 db $B2, $02, $F8, $07, $F0, $84, $02, $F9 db $C3, $04, $C5, $C3, $04, $C3, $00, $80 db $A4, $04, $7E, $41, $01, $00, $41, $03 db $00, $00, $07, $C4, $05, $89, $83, $02 db $4C, $00, $1F, $41, $00, $3F, $02, $00 db $7F, $00, $C7, $05, $60, $04, $FC, $00 db $F0, $00, $C0, $41, $00, $80, $24, $00 db $CF, $06, $5E, $8E, $05, $40, $00, $00 db $C9, $06, $2F, $06, $0F, $F0, $03, $FC db $00, $FF, $C0, $3C, $00, $03, $C0, $00 db $3F, $C0, $4D, $FF, $00, $01, $3F, $C0 db $AF, $05, $60, $03, $7F, $FF, $FC, $FC db $27, $FE, $84, $01, $FC, $00, $FE, $29 db $3F, $02, $FF, $FE, $7F, $AE, $05, $FF db $00, $1F, $F4, $C1, $06, $0F, $A8, $00 db $F1, $01, $F0, $F0, $84, $01, $DC, $00 db $FE, $CA, $00, $FB, $86, $01, $ED, $03 db $FF, $FF, $F8, $F8, $86, $01, $F8, $F0 db $30, $00, $0F, $FF, $57, $6F, $16, $FF db $00, $80, $62, $7D, $E0, $3B, $0B, $00 db $12, $20, $22, $20, $40, $7D, $09, $29 db $7D, $0B, $1C, $2C, $1D, $08, $0E, $09 db $2E, $08, $5A, $06, $05, $26, $4C, $56 db $08, $38, $41, $43, $45, $47, $45, $59 db $47, $5B, $51, $7D, $7E, $41, $80, $53 db $43, $7D, $7E, $4B, $57, $7D, $49, $55 db $4B, $7D, $49, $80, $7E, $57, $7D, $55 db $4B, $7D, $23, $7E, $01, $4C, $58, $25 db $7D, $02, $4A, $56, $48, $22, $7D, $1F db $48, $53, $41, $43, $46, $80, $7D, $49 db $53, $1C, $80, $49, $80, $59, $4E, $4E db $5D, $5D, $5F, $5F, $FD, $FD, $7C, $40 db $ED, $F4, $ED, $FA, $FF, $FF, $36, $36 db $E4, $8D, $80, $62, $7D, $E0, $3B, $02 db $10, $1B, $30, $30, $32, $50, $19, $09 db $7D, $3B, $1B, $1B, $7D, $39, $2D, $1E db $09, $3E, $39, $56, $16, $15, $48, $53 db $28, $18, $7D, $51, $53, $55, $57, $49 db $55, $4B, $57, $7D, $41, $51, $7E, $43 db $80, $7D, $53, $47, $5B, $7E, $45, $59 db $7D, $7D, $5B, $80, $59, $47, $7E, $45 db $7D, $7D, $5B, $22, $7E, $02, $48, $5C db $7E, $24, $7D, $E0, $26, $46, $5A, $7D db $7D, $58, $46, $7D, $7D, $59, $47, $57 db $80, $56, $57, $43, $59, $02, $59, $80 db $59, $55, $4F, $4F, $5E, $5E, $FC, $FC db $FE, $FE, $80, $50, $EA, $F1, $EA, $F7 db $EF, $EF, $4D, $4D, $E4, $8D, $80, $62 db $7D, $0A, $03, $01, $24, $21, $23, $21 db $21, $0A, $0F, $2A, $2B, $22, $0C, $0A db $0D, $2D, $0C, $2A, $2F, $04, $55, $07 db $25, $27, $34, $22, $04, $0F, $42, $44 db $46, $48, $46, $5A, $48, $5C, $52, $7D db $7E, $42, $80, $54, $44, $7D, $83, $00 db $43, $0E, $4A, $56, $4C, $7D, $4A, $80 db $47, $7D, $45, $80, $7D, $7D, $57, $4B db $57, $83, $00, $41, $03, $7D, $7D, $49 db $55, $C3, $01, $47, $10, $58, $7D, $59 db $7E, $54, $42, $44, $7D, $56, $7D, $4A db $54, $03, $80, $4A, $80, $80, $43, $EC db $F3, $09, $80, $21, $EE, $F5, $EE, $FB db $EC, $F3, $EC, $F9, $E4, $8D, $80, $62 db $7D, $09, $11, $11, $13, $31, $31, $33 db $31, $1A, $3F, $3A, $22, $7D, $0B, $3C db $1D, $3D, $1F, $1A, $7D, $14, $06, $17 db $35, $37, $54, $22, $14, $12, $52, $54 db $56, $58, $4A, $56, $4C, $58, $7D, $42 db $52, $7E, $44, $80, $7D, $54, $48, $5C db $7E, $83, $01, $4A, $0B, $5C, $80, $5A db $7D, $57, $80, $55, $7D, $7D, $47, $5B db $47, $C3, $00, $42, $00, $5C, $83, $01 db $32, $08, $7D, $7D, $48, $7E, $45, $55 db $48, $5A, $48, $83, $01, $4E, $06, $44 db $5A, $11, $80, $80, $5A, $80, $43, $E9 db $F0, $09, $80, $7C, $EB, $F2, $EB, $F8 db $E9, $F0, $E9, $F6, $E4, $8C, $80, $23 db $00, $02, $04, $01, $05, $23, $01, $01 db $00, $03, $24, $00, $08, $05, $04, $03 db $03, $03, $00, $00, $00, $03, $E4, $3F db $00, $00, $04, $2B, $00, $04, $FE, $FD db $10, $00, $18, $E4, $91, $00, $FF, $A3 db $03, $00, $00, $7E, $7E, $27, $42, $C3 db $00, $03, $87, $00, $00, $C7, $00, $17 db $87, $00, $00, $F8, $27, $00, $27, $22 db $FF, $00, $FE, $53, $FF, $FC, $03, $01 db $00, $00, $00, $F4, $2A, $00, $51, $01 db $FF, $00, $A3, $00, $7C, $05, $00, $3C db $00, $66, $00, $81, $28, $00, $41, $7F db $80, $43, $FF, $00, $41, $FE, $01, $12 db $18, $00, $27, $00, $61, $00, $82, $00 db $42, $00, $21, $00, $2F, $00, $30, $00 db $E7, $00, $81, $2C, $00, $41, $FF, $00 db $04, $E7, $00, $99, $00, $7E, $44, $00 db $FF, $01, $00, $C0, $22, $00, $02, $00 db $00, $C0, $AF, $00, $FB, $45, $00, $FF db $02, $00, $1C, $E3, $45, $00, $FF, $03 db $3C, $C3, $7E, $81, $C8, $01, $31, $00 db $0C, $41, $C1, $0A, $43, $A0, $05, $43 db $40, $00, $43, $81, $00, $41, $C3, $3C db $41, $01, $DE, $43, $10, $AF, $43, $21 db $5E, $43, $90, $2F, $43, $20, $5F, $43 db $90, $2F, $01, $E7, $18, $42, $C3, $1C db $43, $81, $2E, $43, $80, $0F, $43, $10 db $07, $41, $FF, $00, $01, $DF, $20, $41 db $AF, $50, $42, $17, $A8, $41, $47, $18 db $03, $43, $1C, $41, $1E, $43, $00, $3F db $43, $40, $1F, $43, $00, $3F, $04, $C0 db $00, $BC, $00, $E6, $8B, $00, $E1, $04 db $07, $3C, $03, $66, $01, $8F, $01, $E6 db $89, $00, $F6, $05, $40, $3F, $78, $07 db $60, $07, $89, $00, $F6, $04, $E0, $00 db $E0, $00, $C0, $29, $00, $AF, $02, $1F db $02, $00, $E0, $00, $A3, $01, $D7, $04 db $3E, $00, $0E, $00, $0F, $41, $00, $07 db $AF, $02, $3F, $11, $00, $7F, $7F, $F9 db $F9, $F1, $F1, $F0, $F0, $F1, $F1, $F8 db $F8, $7F, $7F, $00, $00, $FE, $C3, $00 db $53, $02, $FF, $1F, $1F, $A7, $02, $68 db $01, $FF, $7F, $83, $02, $66, $09, $F0 db $F0, $FF, $FF, $F0, $F0, $FF, $7F, $9F db $60, $A3, $02, $80, $83, $02, $74, $00 db $0F, $C3, $02, $98, $04, $FE, $FF, $00 db $FF, $7F, $25, $F1, $03, $F0, $F0, $FF db $FF, $AD, $02, $9C, $01, $8F, $8F, $83 db $02, $9C, $00, $7F, $A5, $02, $91, $C7 db $02, $C6, $02, $00, $FE, $FE, $84, $02 db $96, $02, $1F, $0F, $0F, $89, $02, $7A db $A5, $02, $94, $01, $F0, $F0, $84, $02 db $AC, $00, $FE, $C9, $02, $9B, $A4, $02 db $8C, $02, $FF, $03, $01, $45, $FD, $03 db $01, $C1, $3F, $43, $C1, $27, $03, $D9 db $27, $C1, $3F, $46, $FD, $03, $00, $01 db $24, $FF, $00, $80, $43, $80, $BF, $08 db $80, $CF, $B0, $8F, $90, $AF, $90, $CF db $B0, $8F, $03, $34, $43, $BF, $80, $01 db $C0, $BF, $A4, $03, $2E, $41, $FF, $FD db $01, $B7, $B5, $43, $FF, $FD, $04, $E7 db $FD, $E7, $E5, $E7, $84, $03, $70, $01 db $FF, $E5, $44, $FF, $FD, $01, $B7, $B5 db $C4, $03, $65, $AD, $03, $5E, $22, $FF db $03, $9F, $9F, $FF, $FF, $A5, $03, $7D db $8D, $03, $99, $A9, $03, $87, $0A, $7F db $F8, $F8, $F2, $F2, $F6, $F6, $F0, $F0 db $F9, $F9, $83, $02, $EC, $AF, $03, $C0 db $03, $FF, $7F, $FC, $FC, $27, $FE, $A5 db $03, $DC, $29, $3F, $83, $02, $9C, $08 db $07, $07, $1F, $18, $3F, $20, $7F, $40 db $FF, $86, $00, $C3, $00, $1F, $84, $02 db $31, $02, $01, $00, $01, $85, $00, $E9 db $46, $00, $FF, $01, $00, $07, $A6, $04 db $0F, $00, $C0, $43, $00, $80, $CE, $00 db $F1, $01, $FF, $00, $43, $FE, $01, $43 db $FC, $03, $43, $00, $06, $41, $00, $0C db $41, $00, $0F, $84, $00, $C4, $01, $FF db $FF, $87, $00, $EB, $03, $FF, $FF, $FF db $FF, $8C, $04, $40, $43, $3F, $C0, $46 db $7F, $80, $03, $3F, $C0, $1C, $E3, $C5 db $00, $C5, $02, $40, $00, $78, $41, $00 db $04, $A4, $01, $51, $83, $00, $7C, $0B db $F8, $07, $F1, $0E, $E3, $1C, $C7, $38 db $8F, $70, $1F, $E0, $83, $04, $96, $03 db $3F, $C0, $7F, $80, $45, $FF, $00, $04 db $0E, $0E, $3B, $31, $60, $22, $40, $07 db $C0, $80, $C6, $80, $C7, $80, $C1, $80 db $41, $60, $40, $00, $E0, $41, $80, $C0 db $06, $80, $E0, $80, $60, $40, $78, $40 db $F4, $41, $04, $00, $86, $00, $C4, $0A db $07, $FF, $18, $F8, $20, $E1, $41, $60 db $C0, $00, $80, $8A, $05, $15, $10, $00 db $02, $00, $00, $06, $00, $0E, $11, $0E db $20, $1F, $04, $7B, $0E, $F1, $3F, $C0 db $A3, $05, $5E, $C5, $04, $37, $0C, $10 db $E0, $84, $78, $E0, $1F, $00, $00, $18 db $00, $16, $00, $11, $41, $00, $08, $06 db $00, $10, $00, $20, $00, $F3, $0C, $43 db $F9, $06, $42, $FC, $03, $41, $02, $FD db $41, $04, $FB, $03, $49, $B6, $C9, $36 db $41, $93, $6C, $41, $F0, $0F, $41, $F8 db $07, $A3, $04, $94, $01, $FE, $01, $AD db $04, $D2, $83, $04, $56, $09, $E7, $F8 db $FF, $18, $FF, $04, $FF, $02, $FF, $01 db $F4, $25, $04, $DA, $41, $FB, $04, $41 db $F1, $0E, $41, $E0, $1F, $41, $C1, $3E db $41, $83, $7C, $41, $07, $F8, $41, $8F db $70, $41, $DF, $20, $8D, $05, $C0, $01 db $FE, $01, $8F, $05, $BC, $86, $05, $44 db $00, $F8, $C3, $04, $C0, $07, $1F, $00 db $E7, $9F, $7F, $FF, $00, $07, $31, $00 db $05, $01, $00, $02, $01, $48, $87, $A3 db $04, $AA, $B1, $05, $70, $08, $30, $00 db $50, $00, $90, $00, $10, $00, $18, $83 db $04, $B5, $00, $00, $87, $04, $52, $01 db $1C, $E3, $A5, $04, $AA, $41, $C0, $3F db $41, $E0, $1F, $17, $F2, $0D, $F3, $0C db $D9, $26, $99, $66, $3F, $20, $1F, $18 db $07, $07, $01, $0E, $03, $1C, $07, $38 db $0F, $70, $1F, $E0, $42, $FF, $00, $A3 db $06, $02, $C3, $05, $B5, $08, $1F, $E0 db $FF, $0E, $FB, $31, $E0, $40, $C0, $88 db $04, $E7, $02, $E0, $40, $E0, $88, $04 db $F3, $06, $E0, $40, $F8, $40, $FF, $20 db $FF, $CC, $05, $4B, $F4, $6F, $06, $00 db $43, $E7, $18, $42, $CD, $32, $01, $C9 db $36, $43, $E7, $18, $43, $F3, $0C, $42 db $4F, $B0, $01, $DF, $20, $87, $06, $1C db $02, $0E, $00, $70, $A3, $04, $B7, $88 db $05, $15, $05, $FF, $30, $FF, $48, $FF db $87, $A9, $06, $C6, $AF, $04, $D0, $03 db $FF, $3C, $C3, $C3, $85, $00, $AE, $00 db $7E, $8E, $00, $DF, $04, $30, $00, $7C db $00, $FF, $A6, $07, $AF, $44, $FF, $00 db $41, $FC, $03, $41, $F8, $07, $41, $F0 db $0F, $41, $E0, $1F, $01, $C0, $3F, $C5 db $04, $A7, $CF, $05, $BF, $A7, $05, $B4 db $8A, $06, $F0, $A4, $00, $BF, $F4, $2F db $05, $40, $8F, $04, $50, $03, $89, $76 db $99, $66, $42, $93, $6C, $42, $27, $D8 db $8F, $05, $B8, $41, $27, $D8, $41, $4F db $B0, $41, $9F, $60, $41, $BF, $40, $AB db $07, $F0, $83, $04, $A4, $A3, $08, $06 db $83, $07, $0A, $01, $C1, $3E, $F4, $2B db $06, $CA, $F4, $3A, $07, $F6, $00, $E0 db $8D, $05, $D2, $AF, $09, $30, $CC, $04 db $3F, $02, $C0, $00, $C0, $43, $1F, $60 db $41, $0F, $30, $45, $0F, $F0, $43, $1F db $E0, $43, $F8, $07, $87, $05, $B0, $8F db $06, $2E, $41, $0C, $F3, $41, $86, $79 db $41, $C3, $3C, $41, $E1, $1E, $AF, $06 db $B0, $A7, $08, $C0, $03, $E3, $1C, $F7 db $08, $41, $FF, $00, $00, $3C, $8E, $07 db $D1, $88, $09, $30, $00, $02, $42, $FF db $01, $AF, $09, $E0, $F0, $2F, $00, $00 db $FF, $77, $75, $16, $FF, $00, $80, $62 db $7D, $00, $10, $22, $7D, $E0, $62, $04 db $04, $7D, $15, $08, $35, $55, $D1, $CE db $03, $7D, $47, $E3, $7D, $38, $3E, $3E db $D2, $29, $49, $80, $7D, $59, $7D, $4C db $E5, $4A, $2E, $3E, $3E, $7D, $53, $CE db $80, $21, $40, $E5, $32, $31, $18, $0F db $3E, $3E, $42, $53, $51, $2E, $3E, $5E db $1C, $80, $40, $1D, $23, $28, $7D, $80 db $28, $80, $E4, $E4, $80, $80, $E3, $80 db $7D, $7D, $DC, $D6, $7D, $DC, $7D, $DD db $D7, $D2, $DD, $DD, $D7, $CF, $E1, $CE db $D7, $7D, $CE, $DB, $DD, $D9, $7D, $DD db $DA, $7D, $7D, $DA, $D5, $7D, $E1, $DA db $80, $DE, $22, $7D, $17, $D0, $80, $04 db $81, $FE, $FE, $EE, $EE, $EC, $EC, $EA db $EA, $7F, $7C, $E8, $E8, $E6, $E6, $C9 db $FA, $C9, $F4, $FC, $FC, $E4, $79, $80 db $62, $7D, $00, $00, $22, $7D, $E0, $55 db $80, $D1, $05, $25, $08, $45, $04, $7D db $CE, $CD, $37, $57, $E4, $7D, $7D, $3E db $1F, $D2, $39, $7D, $80, $31, $0A, $3C db $5F, $E2, $21, $3E, $3E, $4E, $5A, $54 db $CE, $80, $7D, $7D, $E4, $7D, $7D, $28 db $3E, $3E, $4E, $40, $54, $7D, $3E, $3E db $0C, $2C, $18, $42, $54, $7D, $80, $3C db $13, $80, $E5, $E5, $CD, $18, $CD, $E4 db $80, $7D, $7D, $D4, $7D, $DA, $7D, $7D db $D5, $D2, $DA, $D2, $D5, $7D, $E0, $CF db $D5, $CE, $D0, $CE, $7D, $7D, $C3, $00 db $6E, $08, $D9, $7D, $D2, $D7, $CF, $CF db $7D, $CB, $DF, $83, $00, $05, $16, $80 db $D1, $80, $FF, $FF, $EF, $EF, $ED, $ED db $EB, $EB, $7F, $7F, $E9, $E9, $E7, $E7 db $C6, $F7, $C6, $F1, $FD, $FD, $E4, $79 db $80, $62, $7D, $E0, $41, $11, $14, $07 db $34, $7D, $7D, $04, $16, $17, $36, $56 db $7D, $5D, $80, $7D, $58, $CD, $7D, $19 db $3F, $4B, $D3, $1A, $2D, $80, $3D, $7D db $7D, $5F, $E2, $20, $43, $3F, $3F, $30 db $11, $0E, $E4, $3D, $41, $E2, $50, $2D db $0B, $2B, $3F, $3F, $CC, $11, $52, $2F db $3F, $12, $5C, $80, $41, $11, $7D, $3A db $7D, $E4, $3A, $E5, $E3, $E3, $E4, $22 db $80, $E0, $22, $DB, $7D, $DD, $D7, $04 db $80, $D1, $DD, $D8, $D3, $DD, $E1, $D7 db $7D, $7D, $CB, $DF, $DB, $80, $DC, $DD db $DA, $D0, $80, $DA, $D1, $D4, $DA, $D5 db $7D, $7D, $E0, $80, $80, $D0, $C4, $01 db $6E, $00, $80, $43, $C8, $F3, $01, $7F db $7F, $41, $C8, $F3, $05, $CA, $FB, $CA db $F5, $C8, $F9, $E4, $79, $80, $62, $7D db $E0, $38, $01, $24, $07, $44, $7D, $D0 db $06, $26, $27, $46, $7D, $7D, $1E, $E5 db $48, $09, $E3, $30, $7D, $3B, $5B, $D3 db $20, $3D, $E5, $4D, $2A, $7D, $02, $80 db $7D, $3F, $3F, $4F, $1B, $01, $5D, $80 db $4D, $22, $E3, $7D, $3D, $3A, $3F, $3F db $4F, $41, $01, $7D, $3F, $3B, $5E, $0D db $0B, $33, $01, $41, $7D, $80, $0A, $E5 db $E2, $E2, $E4, $0B, $E5, $E3, $CD, $7D db $D9, $D5, $83, $02, $69, $04, $D5, $D3 db $DA, $D3, $D5, $C3, $00, $6D, $01, $CB db $7D, $C5, $02, $6F, $0C, $04, $DA, $D6 db $D3, $D7, $7D, $CF, $CF, $80, $80, $04 db $80, $D1, $83, $01, $04, $43, $C5, $F0 db $01, $7C, $7F, $41, $C5, $F0, $05, $C7 db $F8, $C7, $F2, $C5, $F6, $E4, $78, $80 db $2A, $00, $01, $03, $03, $C3, $04, $07 db $03, $04, $00, $00, $01, $83, $04, $04 db $C5, $04, $13, $02, $00, $00, $01, $86 db $04, $06, $00, $01, $84, $04, $0E, $00 db $01, $85, $04, $07, $01, $03, $03, $85 db $04, $0E, $02, $01, $00, $05, $27, $01 db $E4, $30, $00, $01, $FD, $FE, $23, $00 db $02, $18, $00, $10, $E4, $7B, $00, $FF db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $10, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $10, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $80, $00, $00, $00, $20, $00, $01 db $00, $00, $40, $00, $00, $00, $40, $10 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $08, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $00, $00, $00, $00, $00, $00, $04 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FB, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $00, $80, $00, $00, $00, $00, $01 db $00, $00, $00, $0C, $00, $01, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $40, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $04, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $80, $00, $00, $00, $00, $00, $00 db $08, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $08, $00, $20, $00, $00, $00, $00 db $01, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $00, $80, $00, $00, $00, $00, $00 db $00, $00, $20, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $00, $00, $00, $00, $00, $00, $80 db $00, $00, $00, $00, $80, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
CSC 35/lab5.asm
jvniorrr/CSUS-Computer-Science
0
83528
.intel_syntax noprefix .data Description: .ascii "Let's play Chuck-a-Luck!\nEnter 0 to exit\n\0" # direct storage for our dies Die1: .quad 0 Die2: .quad 0 Die3: .quad 0 # funds to track the users betting allowance Funds: .quad 100 # initialize the users fund to 100 # Statements for our die functions Die1State: .ascii "First Die is: \0" Die2State: .ascii "\nSecond Die is: \0" Die3State: .ascii "\nThird Die is: \0" # Statements for the total $ left MoneyLeft: .ascii "\nYou have $\0" # Statement to retrieve betting input Betting: .ascii "\nHow much are you betting?\n\0" # Winner and loser Labels Loser: .ascii "\n\nYou Lose!\n\0" Winner: .ascii "\n\nYou win!\n\0" .text .global _start _start: lea rcx, Description call PrintStringZ # print out the description of the program Do: lea rcx, MoneyLeft call PrintStringZ # print the total ammount they currently have - You have X money left mov rcx, Funds call PrintInt lea rcx, Betting call PrintStringZ call ScanInt # retrieve input from user for the bet ammount - money ammount mov rbx, rcx # store the users bet ammount into RBX # check if the user enters a be less than 0 cmp rcx, 0 # compare the users bet with 0 to see if want to continue jle End lea rcx, Die1State call PrintStringZ mov rcx, 6 # retrieve a random num using cook library call Random add rcx, 1 mov Die1, rcx # store Die 1 call PrintInt # print the random number for Die 1 lea rcx, Die2State call PrintStringZ mov rcx, 6 # retrieve a random num using cook library call Random add rcx, 1 mov Die2, rcx # store Die 2 call PrintInt # print the random number for Die 1 lea rcx, Die3State call PrintStringZ mov rcx, 6 # retrieve a random num using cook library call Random add rcx, 1 mov Die3, rcx # store Die 3 call PrintInt # print the random number for Die 1 cmpq Die1, 6 # compare die1 with 6 to see if they the same je callWinner cmpq Die2, 6 # compare die2 with 6 to see if they the same je callWinner cmpq Die3, 6 # compare die3 with 6 to see if they the same je callWinner # if the user not a winner continue to this one and subtract jmp callLoser # call the loser statement callLoser: lea rcx, Loser call PrintStringZ sub Funds, rbx # subtract the users bet ammount from the total jmp Do # continue the while loop callWinner: lea rcx, Winner call PrintStringZ add Funds, rbx # add the users bet ammount from the total jmp Do # continue the while loop End: call Exit
LibraBFT/Impl/Consensus/ChainedBFT/EventProcessor/Properties.agda
haroldcarr/bft-consensus-agda
0
11493
<filename>LibraBFT/Impl/Consensus/ChainedBFT/EventProcessor/Properties.agda {- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} -- This module contains properties that are only about the behavior of the handlers, nothing to do -- with system state open import Optics.All open import LibraBFT.Prelude open import LibraBFT.Base.ByteString open import LibraBFT.Base.Types open import LibraBFT.Hash open import LibraBFT.Impl.Base.Types open import LibraBFT.Impl.Consensus.Types open import LibraBFT.Impl.Util.Util module LibraBFT.Impl.Consensus.ChainedBFT.EventProcessor.Properties (hash : BitString → Hash) (hash-cr : ∀{x y} → hash x ≡ hash y → Collision hash x y ⊎ x ≡ y) where open import LibraBFT.Impl.Consensus.ChainedBFT.EventProcessor hash hash-cr -- The quorum certificates sent in SyncInfo with votes are those from the peer state procPMCerts≡ : ∀ {ts pm pre vm αs} → (SendVote vm αs) ∈ LBFT-outs (processProposalMsg ts pm) pre → vm ^∙ vmSyncInfo ≡ mkSyncInfo (₋epHighestQC pre) (₋epHighestCommitQC pre) procPMCerts≡ (there x) = ⊥-elim (¬Any[] x) -- processProposalMsg sends only one vote procPMCerts≡ (here refl) = refl
audio/sfx/battle_31.asm
etdv-thevoid/pokemon-rgb-enhanced
1
5989
<gh_stars>1-10 SFX_Battle_31_Ch4: duty 2 unknownsfx0x20 15, 255, 224, 7 unknownsfx0x20 15, 255, 224, 7 unknownsfx0x20 15, 255, 224, 7 unknownsfx0x20 15, 255, 224, 7 unknownsfx0x20 15, 242, 224, 7 endchannel SFX_Battle_31_Ch5: duty 3 unknownsfx0x20 15, 255, 226, 7 unknownsfx0x20 15, 255, 225, 7 unknownsfx0x20 15, 255, 226, 7 unknownsfx0x20 15, 255, 225, 7 unknownsfx0x20 15, 242, 226, 7 endchannel
json_database/recognizer/Database.g4
tsudmi/JSONDatabase
0
2820
grammar Database; commands : (command ';')* command ; command : 'SELECT' selectStatement | 'CREATE' createStatement | 'INSERT' insertStatement | 'UPDATE' updateStatement | 'DELETE' deleteStatement | 'DROP' dropStatement ; selectStatement : ((columnName ',')* columnName | '*') 'FROM' tableName ('WHERE' where)? ; createStatement : 'TABLE' tableName ; insertStatement : 'INTO' tableName 'SET' (columnName '=' value ',')* columnName '=' value ; updateStatement : tableName 'SET' (columnName '=' value ',')* columnName '=' value ('WHERE' where)? ; deleteStatement : 'FROM' tableName ('WHERE' where)? ; dropStatement : 'TABLE' (tableName ',')* tableName ; where : whereAND 'OR' where | whereAND ; whereAND : columnName operator value 'AND' whereAND | columnName operator value ; operator : '=' | '!=' | '>' | '<' | '>=' | '<=' ; tableName : NAME ; columnName : NAME ; NAME : [a-zA-Z] [0-9a-zA-Z$_]* ; value : number | boolean | STRING ; STRING : '"' ~["\r\n]*? '"' ; number : INT | FLOAT ; INT : '-'? [1-9] [0-9]* ('.' [0-9]+)? ; FLOAT : '-'? '0' ('.' [0-9]+)? ; boolean : 'true' | 'false' ; LINE_COMMENT : ('--' | '#') ~[\r\n]* -> skip ; BLOCK_COMMENT : '/*' .*? '*/' -> skip ; WS : [ \t\n\r]+ -> skip ;
oeis/005/A005329.asm
neoneye/loda-programs
11
89816
<reponame>neoneye/loda-programs ; A005329: a(n) = Product_{i=1..n} (2^i - 1). Also called 2-factorial numbers. ; Submitted by <NAME> ; 1,1,3,21,315,9765,615195,78129765,19923090075,10180699028325,10414855105976475,21319208401933844325,87302158405919092510875,715091979502883286756577125,11715351900195736886933003038875,383876935713713710574133710574817125,25157374981998228022475852722520640286875,3297402296265489745133932492193502843040993125,864390930149924278258644465301081415783295060766875,453188927595513350075389930779308072236776417524282593125,475202579753465411055301996666912961845677832005524620086046875 mov $2,1 mov $3,1 lpb $0 sub $0,$2 add $1,1 mul $3,$1 mul $1,2 lpe mov $0,$3
libsrc/stdio/ansi/pc6001/f_ansi_bel.asm
meesokim/z88dk
0
102453
<reponame>meesokim/z88dk ; ; ANSI Video handling for the PC6001 ; ; BEL - chr(7) Beep it out ; ; ; <NAME> - Jan 2013 ; ; ; $Id: f_ansi_bel.asm,v 1.2 2015/01/19 01:33:19 pauloscustodio Exp $ ; PUBLIC ansi_BEL .ansi_BEL ld a,7 jp $26c7
oeis/211/A211813.asm
neoneye/loda-programs
11
14128
<gh_stars>10-100 ; A211813: Number of (n+1) X (n+1) -10..10 symmetric matrices with every 2 X 2 subblock having sum zero and two distinct values. ; 32,44,62,92,140,218,344,548,878,1412,2276,3674,5936,9596,15518,25100,40604,65690,106280,171956,278222,450164,728372,1178522,1906880,3085388,4992254,8077628,13069868,21147482,34217336,55364804,89582126,144946916,234529028,379475930,614004944,993480860,1607485790,2600966636,4208452412,6809419034,11017871432,17827290452,28845161870,46672452308,75517614164,122190066458,197707680608,319897747052,517605427646,837503174684,1355108602316,2192611776986,3547720379288,5740332156260,9288052535534 mov $1,6 mov $2,9 lpb $0 sub $0,2 add $1,$2 add $2,$1 lpe lpb $0 sub $0,1 add $2,$1 lpe mov $0,$2 add $0,7 mul $0,2
source/nodes/program-nodes-selected_components.ads
reznikmm/gela
0
11653
<filename>source/nodes/program-nodes-selected_components.ads -- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Expressions; with Program.Lexical_Elements; with Program.Elements.Selected_Components; with Program.Element_Visitors; package Program.Nodes.Selected_Components is pragma Preelaborate; type Selected_Component is new Program.Nodes.Node and Program.Elements.Selected_Components.Selected_Component and Program.Elements.Selected_Components.Selected_Component_Text with private; function Create (Prefix : not null Program.Elements.Expressions.Expression_Access; Dot_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Selector : not null Program.Elements.Expressions.Expression_Access) return Selected_Component; type Implicit_Selected_Component is new Program.Nodes.Node and Program.Elements.Selected_Components.Selected_Component with private; function Create (Prefix : not null Program.Elements.Expressions .Expression_Access; Selector : not null Program.Elements.Expressions .Expression_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Selected_Component with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Selected_Component is abstract new Program.Nodes.Node and Program.Elements.Selected_Components.Selected_Component with record Prefix : not null Program.Elements.Expressions.Expression_Access; Selector : not null Program.Elements.Expressions.Expression_Access; end record; procedure Initialize (Self : in out Base_Selected_Component'Class); overriding procedure Visit (Self : not null access Base_Selected_Component; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Prefix (Self : Base_Selected_Component) return not null Program.Elements.Expressions.Expression_Access; overriding function Selector (Self : Base_Selected_Component) return not null Program.Elements.Expressions.Expression_Access; overriding function Is_Selected_Component (Self : Base_Selected_Component) return Boolean; overriding function Is_Expression (Self : Base_Selected_Component) return Boolean; type Selected_Component is new Base_Selected_Component and Program.Elements.Selected_Components.Selected_Component_Text with record Dot_Token : not null Program.Lexical_Elements.Lexical_Element_Access; end record; overriding function To_Selected_Component_Text (Self : in out Selected_Component) return Program.Elements.Selected_Components .Selected_Component_Text_Access; overriding function Dot_Token (Self : Selected_Component) return not null Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Selected_Component is new Base_Selected_Component with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Selected_Component_Text (Self : in out Implicit_Selected_Component) return Program.Elements.Selected_Components .Selected_Component_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Selected_Component) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Selected_Component) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Selected_Component) return Boolean; end Program.Nodes.Selected_Components;
programs/oeis/098/A098308.asm
neoneye/loda
22
83030
<reponame>neoneye/loda ; A098308: Unsigned member r=-8 of the family of Chebyshev sequences S_r(n) defined in A092184. ; 0,1,8,81,800,7921,78408,776161,7683200,76055841,752875208,7452696241,73774087200,730288175761,7229107670408,71560788528321,708378777612800,7012226987599681,69413891098384008,687126683996240401 seq $0,1079 ; a(n) = 10*a(n-1) - a(n-2); a(0) = 1, a(1) = 5. add $0,1 div $0,6
src/utilities_package.ads
MorganPeterson/avi-editor
0
23795
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Buffer_Package; use Buffer_Package; package Utilities_Package is type ERR_TYPE is ( ENDOFFILE, NOBLOCKMARKED, INVALIDEFUNCTIONNUMBER, BEGINNINGOFLINE, ENDOFLINE, TOPOFFILE, OUTOFMEMORY, EMPTYCOMMAND, COULDNOTOPENFILE, COULDNOTOPENTEMPORARYFILE, COULDNOTFORK, NOPREVIOUSPOSITION, INVALIDBOOKMARK, BOOKMARKNOTSET, CURSORINSIDEBLOCK, INVALIDLINE, INVALIDMAPPINGSPECIFICATION, INVALIDPAGEHEIGHT, NOBLOCKDEFINED, INVALIDDELAYVALUE, LEFTMARGINWOULDEXCEEDRIGHTMARGIN, RIGHTMARINWOULDEXCEEDLEFTMARGIN, INVALIDMARGIN, SEARCHFAILED, INVALIDTABWIDTH, NOTHINGTOUNDO, UNKNOWNCOMMAND); type View is record B : Buffer; P : Pos; GB : POS; BS : Integer; BE : Integer; EX : Boolean; Status_Callback : Boolean; end record; function Read_File (Name : Unbounded_String; V : View) return Boolean; end Utilities_Package;
libsrc/stdlib/8080/asm_atol.asm
Frodevan/z88dk
640
170931
; long __FASTCALL__ atol(char *s) ; 12.2006 aralbrec SECTION code_clib PUBLIC asm_atol EXTERN l_long_neg, asm_isspace EXTERN l_long_mult ; FASTCALL ; enter : hl = char* ; exit : dehl = long result ; bc = & next char to interpret in char* .asm_atol ld a,(hl) ; eat whitespace inc hl call asm_isspace jr z, asm_atol ; ate up one too many chars, see if it's a sign cp '+' jr z, signdone dec hl cp '-' jr nz, signdone inc hl ; this is a negative number call signdone ; do atol but come back here to negate result jp l_long_neg ; dehl = -dehl .signdone ld b,h ld c,l ld de,0 ld l,e ld h,d ; bc = char * ; dehl = result dec bc .loop inc bc ld a,(bc) sub '0' ; inlined isdigit ret c cp 10 ret nc push bc push af ;Save value ; dehl *= 10 push de push hl ld hl,10 ld de,0 call l_long_mult ; dehl + value pop af ;Value pop bc ;str pointer add a,l ld l,a jp nc, loop inc h jp nz, loop inc de jp loop
src/Relation/Binary/PropositionalEquality/Extensionality.agda
metaborg/mj.agda
10
16988
import Relation.Binary.PropositionalEquality as PEq module Relation.Binary.PropositionalEquality.Extensionality (funext : ∀ {ℓ₁ ℓ₂} → PEq.Extensionality ℓ₁ ℓ₂) where funext² : ∀ {p q r}{P : Set p}{Q : P → Set q} {R : (p : P) → Q p → Set r} → {f g : ∀ (p : P)(q : Q p) → R p q} → (∀ p q → f p q PEq.≡ g p q) → f PEq.≡ g funext² f = funext λ p → funext λ q → f p q funext³ : ∀ {p q r s}{P : Set p}{Q : P → Set q} {R : (p : P) → Q p → Set r}{S : (p : P)(q : Q p) → R p q → Set s} → {f g : ∀ (p : P)(q : Q p)(r : R p q) → S p q r} → (∀ p q r → f p q r PEq.≡ g p q r) → f PEq.≡ g funext³ f = funext λ p → funext λ q → funext λ r → f p q r
FormalLanguage/Equals.agda
Lolirofle/stuff-in-agda
6
2965
<gh_stars>1-10 {-# OPTIONS --sized-types #-} module FormalLanguage.Equals{ℓ} where import Lvl open import FormalLanguage open import Lang.Size open import Logic.Propositional open import Relator.Equals using ([≡]-intro) renaming (_≡_ to _≡ₑ_) open import Relator.Equals.Proofs import Structure.Relator.Names as Names open import Structure.Setoid open import Structure.Relator.Equivalence open import Structure.Relator.Properties open import Type private variable s : Size module _ {Σ : Alphabet{ℓ}} where record _≅[_]≅_ (A : Language(Σ){∞ˢⁱᶻᵉ}) (s : Size) (B : Language(Σ){∞ˢⁱᶻᵉ}) : Type{ℓ} where constructor intro coinductive field accepts-ε : Language.accepts-ε(A) ≡ₑ Language.accepts-ε(B) suffix-lang : ∀{c : Σ}{sₛ : <ˢⁱᶻᵉ s} → (Language.suffix-lang A c ≅[ sₛ ]≅ Language.suffix-lang B c) _≅_ : ∀{s : Size} → Language(Σ){∞ˢⁱᶻᵉ} → Language(Σ){∞ˢⁱᶻᵉ} → Type _≅_ {s} = _≅[ s ]≅_ [≅]-reflexivity-raw : Names.Reflexivity(_≅[ s ]≅_) _≅[_]≅_.accepts-ε ([≅]-reflexivity-raw) = [≡]-intro _≅[_]≅_.suffix-lang ([≅]-reflexivity-raw) = [≅]-reflexivity-raw [≅]-symmetry-raw : Names.Symmetry(_≅[ s ]≅_) _≅[_]≅_.accepts-ε ([≅]-symmetry-raw ab) = symmetry(_≡ₑ_) (_≅[_]≅_.accepts-ε ab) _≅[_]≅_.suffix-lang ([≅]-symmetry-raw ab) = [≅]-symmetry-raw (_≅[_]≅_.suffix-lang ab) [≅]-transitivity-raw : Names.Transitivity(_≅[ s ]≅_) _≅[_]≅_.accepts-ε ([≅]-transitivity-raw ab bc) = transitivity(_≡ₑ_) (_≅[_]≅_.accepts-ε ab) (_≅[_]≅_.accepts-ε bc) _≅[_]≅_.suffix-lang ([≅]-transitivity-raw ab bc) = [≅]-transitivity-raw (_≅[_]≅_.suffix-lang ab) (_≅[_]≅_.suffix-lang bc) instance [≅]-reflexivity : Reflexivity(_≅[ s ]≅_) Reflexivity.proof([≅]-reflexivity) = [≅]-reflexivity-raw instance [≅]-symmetry : Symmetry(_≅[ s ]≅_) Symmetry.proof([≅]-symmetry) = [≅]-symmetry-raw instance [≅]-transitivity : Transitivity(_≅[ s ]≅_) Transitivity.proof([≅]-transitivity) = [≅]-transitivity-raw instance [≅]-equivalence : Equivalence(_≅[ s ]≅_) [≅]-equivalence = record{} instance [≅]-equiv : let _ = s in Equiv(Language(Σ)) [≅]-equiv {s = s} = intro(_≅[ s ]≅_) ⦃ [≅]-equivalence ⦄
gcc-gcc-7_3_0-release/gcc/ada/g-shshco.ads
best08618/asylo
7
5158
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . S E C U R E _ H A S H E S . S H A 2 _ C O M M O N -- -- -- -- S p e c -- -- -- -- Copyright (C) 2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides supporting code for implementation of the following -- secure hash functions described in FIPS PUB 180-3: SHA-224, SHA-256, -- SHA-384, SHA-512. It contains the generic transform operation that is -- common to the above four functions. The complete text of FIPS PUB 180-3 -- can be found at: -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf -- This is an internal unit and should not be used directly in applications. -- Use GNAT.SHA* instead. package GNAT.Secure_Hashes.SHA2_Common is Block_Words : constant := 16; -- All functions operate on blocks of 16 words generic with package Hash_State is new Hash_Function_State (<>); Rounds : Natural; -- Number of transformation rounds K : Hash_State.State; -- Constants used in the transform operation with function Sigma0 (X : Hash_State.Word) return Hash_State.Word is <>; with function Sigma1 (X : Hash_State.Word) return Hash_State.Word is <>; with function S0 (X : Hash_State.Word) return Hash_State.Word is <>; with function S1 (X : Hash_State.Word) return Hash_State.Word is <>; -- FIPS PUB 180-3 elementary functions procedure Transform (H_St : in out Hash_State.State; M_St : in out Message_State); end GNAT.Secure_Hashes.SHA2_Common;
programs/oeis/017/A017229.asm
neoneye/loda
22
80793
; A017229: a(n) = (9*n + 5)^9. ; 1953125,20661046784,1801152661463,35184372088832,327381934393961,1953125000000000,8662995818654939,31087100296429568,95151694449171437,257327417311663616,630249409724609375,1423311812421484544,3004041937984268273,5987402799531080192,11361656654439817571,20661046784000000000,36197319879620191349,61364017143100579328,101029508532509551847,162036931496379416576,253831523037259765625,389238302031137391104,585415667401849109483,865013227009378353152,1257565061957837936381,1801152661463000000000,2544374934440439784559,3548666015583712575488,4891005035897482905857,6667065620433171892736,8994856609344482421875,12018909372337102782464,15915071101130977289093,20895967619684767411712,27217203547650508966391,35184372088832000000000,45160951293313130130569,57577168359402185282048,72939918399605131977467,91843829093495002628096,114983567789585767578125,143167492898147491034624,177332756837315126431103,218561973355846012239872,268101567757470981763601,327381934393961000000000,398039531776795387285379,481941051780668983083008,581209805676014043990677,698254476132238257798656,835800390878492990234375,996923480394485762883584,1185087088830137989679513,1404181814319763175301632,1658568561963902101824011,1953125000000000000000000,2293295617071746318664989,2685145586036120469882368,3135418647416996838649487,3651599233424559404220416,4241979061410760525390625,4915728433722629794425344,5682972489147397363698323,6554872659516141795540992,7543713593546005279283621,8662995818654939000000000,9927534420277448531045399,11353564027144903357104128,12958850400069656016137897,14762808930988484877349376,16786630368377730248046875,19053414094649936325115904,21588309290779841476671533,24418664333186176456381952,27574184777814934416918431,31087100296429568000000000,34992340940313947338562609,39327723116934878511692288,44134145675592534845119907,49455796508709293449281536,55340370086170196533203125,61839296351031571325771264,69007981415958243876303143,76906060510934270593728512,85597663644117187118144441,95151694449171437000000000,105642122704022892690712619,117148291017723218524110848,129755236194000249690739517,143554025792098572676752896,158642110417683091255859375,175123692288887547886567424,193110110635039743277817153,212720244498185556943964672,234080933520264818775017651,257327417311663616000000000,282603794009879741420351429,310063498650190697436343808,339869801983506966182620727,372196330390027139029139456 mul $0,9 add $0,5 pow $0,9
oeis/212/A212323.asm
neoneye/loda-programs
11
94898
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A212323: a(n) = 3^n - Fibonacci(n). ; Submitted by <NAME>(s2) ; 1,2,8,25,78,238,721,2174,6540,19649,58994,177058,531297,1594090,4782592,14348297,43045734,129138566,387417905,1162257286,3486777636,10460342257,31381041898,94143150170,282429490113,847288534418,2541865706936,7625597288569,22876792137150,68630376850654,205891131262609,617673394937678,1853020186673532,5559060563030945,16677181693963682,50031545089772242,150094635282068769,450283905866839546,1350851717633903920,4052555152955730281,12157665458954594646,36472996377005206262,109418989131244444913 mov $1,3 pow $1,$0 seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1. mov $2,$1 sub $2,$0 mov $0,$2
alloy4fun_models/trashltl/models/0/4DBAMBnqWn5bnwqkG.als
Kaixi26/org.alloytools.alloy
0
3804
<filename>alloy4fun_models/trashltl/models/0/4DBAMBnqWn5bnwqkG.als open main pred id4DBAMBnqWn5bnwqkG_prop1 { no Trash } pred __repair { id4DBAMBnqWn5bnwqkG_prop1 } check __repair { id4DBAMBnqWn5bnwqkG_prop1 <=> prop1o }
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c8/c87b48a.ada
best08618/asylo
7
24258
-- C87B48A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT OVERLOADING RESOLUTION USES THE RULE THAT: -- -- NAMED ACTUAL PARAMETERS CAN RESOLVE OVERLOADING OF SUBPROGRAMS. -- THIS TEST USES FUNCTIONS AND OPERATOR SYMBOLS ONLY. -- TRH 13 AUG 82 WITH REPORT; USE REPORT; PROCEDURE C87B48A IS ERR, B1, B2 : BOOLEAN := FALSE; PACKAGE A IS FUNCTION "-" (X : BOOLEAN) RETURN BOOLEAN; FUNCTION TOGGLE (X : BOOLEAN) RETURN BOOLEAN RENAMES "-"; END A; PACKAGE BODY A IS FUNCTION "-" (X : BOOLEAN) RETURN BOOLEAN IS BEGIN RETURN NOT X; END "-"; END A; PACKAGE B IS FUNCTION "-" (Y : BOOLEAN) RETURN BOOLEAN; FUNCTION TOGGLE (Y : BOOLEAN) RETURN BOOLEAN RENAMES "-"; END B; PACKAGE BODY B IS FUNCTION "-" (Y : BOOLEAN) RETURN BOOLEAN IS BEGIN ERR := TRUE; RETURN NOT Y; END "-"; END B; PACKAGE C IS FUNCTION "-" (Z : BOOLEAN) RETURN BOOLEAN; FUNCTION TOGGLE (Z : BOOLEAN) RETURN BOOLEAN RENAMES "-"; END C; PACKAGE BODY C IS FUNCTION "-" (Z : BOOLEAN) RETURN BOOLEAN IS BEGIN ERR := TRUE; RETURN NOT Z; END "-"; END C; USE A, B, C; BEGIN TEST ("C87B48A","RESOLUTION OF OVERLOADED SUBPROGRAMS BY NAMED " & "ACTUAL PARAMETERS"); B1 := "-" (X => FALSE); B2 := TOGGLE (X => FALSE); IF ERR OR ELSE NOT B1 OR ELSE NOT B2 THEN FAILED ("RESOLUTION INCORRECT FOR OVERLOADED SUBPROGRAMS" & " WITH NAMED ACTUAL PARAMETERS"); END IF; RESULT; END C87B48A;
oeis/279/A279673.asm
neoneye/loda-programs
11
164256
<gh_stars>10-100 ; A279673: The maximum number of coins that can be processed in n weighings where all coins are real except for one LHR-coin starting in the light state. ; Submitted by <NAME> ; 1,3,9,19,41,99,233,531,1225,2851,6601,15251,35305,81763,189225,437907,1013641,2346275,5430537,12569363,29093289,67339363,155862889,360759571,835013705,1932719395,4473463369,10354262163,23965938537,55471468387,128394046889,297180379539,687852585737,1592100979491,3685070891401,8529451146259,19742235319081,45695303057507,105766175380969,244805988980755,566627014810569,1311512742164259,3035622425440969,7026240167959955,16262908879135977,37642067292075875,87126186376855593,201661940978179219 mul $0,2 seq $0,77882 ; Expansion of x/((1-x)*(1-x^2-2*x^3)). mul $0,2 add $0,1
programs/oeis/068/A068628.asm
karttu/loda
1
102268
<reponame>karttu/loda<gh_stars>1-10 ; A068628: Numbers occurring twice in A068627. ; 0,60,216,468,816,1260,1800,2436,3168,3996,4920,5940,7056,8268,9576,10980,12480,14076,15768,17556,19440,21420,23496,25668,27936,30300,32760,35316,37968,40716,43560,46500,49536,52668,55896,59220,62640,66156,69768,73476 mov $1,$0 mul $1,4 add $1,1 mul $1,$0 mul $1,12
asg/asm/lz4.asm
asgkafka/librdkafka
0
176746
<reponame>asgkafka/librdkafka<gh_stars>0 *PROCESS DUPALIAS * * Compiled by DCC Version 2.25.07 Mar 6 2021 08:51:07 * on Fri Apr 30 15:35:12 2021 * WXTRN @@ZARCH# * * * * Code Section * @CODE ALIAS C'@LZ4' @CODE CSECT @CODE AMODE ANY @CODE RMODE ANY @DATA ALIAS C'@lz4' rd_kafka_mem_malloc ALIAS X'99846D92818692816D9485946D948193939683' EXTRN rd_kafka_mem_malloc rd_kafka_mem_calloc ALIAS X'99846D92818692816D9485946D838193939683' EXTRN rd_kafka_mem_calloc rd_kafka_mem_free ALIAS X'99846D92818692816D9485946D86998585' EXTRN rd_kafka_mem_free memmove ALIAS C'memmove' EXTRN memmove * * * * ....... start of LZ4_isAligned @LNAME449 DS 0H DC X'0000000D' DC C'LZ4_isAligned' DC X'00' $L$Z4_is$Aligned DCCPRLG CINDEX=449,BASER=0,FRAME=168,SAVEAREA=NO,ENTRY* =NO,ARCH=ZARCH,LNAMEADDR=@LNAME449 * ******* End of Prologue * * * *** return ((size_t)ptr & (alignment -1)) == 0; LG 15,0(0,1) ; ptr LG 1,8(0,1) ; alignment AGHI 1,-1 NGR 15,1 LPGR 15,15 AGHI 15,-1 SRLG 15,15,63(0) LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue * * DSECT for automatic variables in "LZ4_isAligned" * (FUNCTION #449) * @AUTO#$L$Z4_is$Aligned DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_isLittleEndian @LNAME450 DS 0H DC X'00000012' DC C'LZ4_isLittleEndian' DC X'00' $L$Z4_is$Little$Endian DCCPRLG CINDEX=450,BASER=12,FRAME=176,ENTRY=NO,A* RCH=ZARCH,LNAMEADDR=@LNAME450 * ******* End of Prologue * * * *** const union { U32 u; BYTE c[4]; } one = { 1 }; MVHI 168(13),1 * *** return one.c[0]; LLC 15,168(0,13) LLGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_450 DC F'176' DROP 12 * * DSECT for automatic variables in "LZ4_isLittleEndian" * (FUNCTION #450) * @AUTO#$L$Z4_is$Little$Endian DSECT DS XL168 $L$Z4_is$Little$Endian#one#0 DS 4XL1 ; one * @CODE CSECT * * * * ....... start of LZ4_read16 @LNAME451 DS 0H DC X'0000000A' DC C'LZ4_read16' DC X'00' $L$Z4_read16 DCCPRLG CINDEX=451,BASER=12,FRAME=176,ENTRY=NO,ARCH=ZARCH,* LNAMEADDR=@LNAME451 * ******* End of Prologue * * * *** U16 val; __memcpy(&val,memPtr,sizeof(val)); return val; LG 15,0(0,1) LA 1,168(0,13) MVC 0(2,1),0(15) LLGH 15,168(0,13) ; val * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_451 DC F'176' DROP 12 * * DSECT for automatic variables in "LZ4_read16" * (FUNCTION #451) * @AUTO#$L$Z4_read16 DSECT DS XL168 $L$Z4_read16#val#0 DS 1H ; val * @CODE CSECT * * * * ....... start of LZ4_read32 @LNAME452 DS 0H DC X'0000000A' DC C'LZ4_read32' DC X'00' $L$Z4_read32 DCCPRLG CINDEX=452,BASER=12,FRAME=176,ENTRY=NO,ARCH=ZARCH,* LNAMEADDR=@LNAME452 * ******* End of Prologue * * * *** U32 val; __memcpy(&val,memPtr,sizeof(val)); return val; LG 15,0(0,1) LA 1,168(0,13) MVC 0(4,1),0(15) LLGF 15,168(0,13) ; val * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_452 DC F'176' DROP 12 * * DSECT for automatic variables in "LZ4_read32" * (FUNCTION #452) * @AUTO#$L$Z4_read32 DSECT DS XL168 $L$Z4_read32#val#0 DS 1F ; val * @CODE CSECT * * * * ....... start of LZ4_read_ARCH @LNAME453 DS 0H DC X'0000000D' DC C'LZ4_read_ARCH' DC X'00' $L$Z4_read_$A$R$C$H DCCPRLG CINDEX=453,BASER=12,FRAME=176,ENTRY=NO,ARCH* =ZARCH,LNAMEADDR=@LNAME453 * ******* End of Prologue * * * *** reg_t val; __memcpy(&val,memPtr,sizeof(val)); return val; LG 15,0(0,1) LA 1,168(0,13) MVC 0(8,1),0(15) LG 15,168(0,13) ; val * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_453 DC F'176' DROP 12 * * DSECT for automatic variables in "LZ4_read_ARCH" * (FUNCTION #453) * @AUTO#$L$Z4_read_$A$R$C$H DSECT DS XL168 $L$Z4_read_$A$R$C$H#val#0 DS 8XL1 ; val * @CODE CSECT * * * * ....... start of LZ4_write16 @LNAME454 DS 0H DC X'0000000B' DC C'LZ4_write16' DC X'00' $L$Z4_write16 DCCPRLG CINDEX=454,BASER=0,FRAME=168,SAVEAREA=NO,ENTRY=NO* ,ARCH=ZARCH,LNAMEADDR=@LNAME454 * ******* End of Prologue * * * *** __memcpy(memPtr,&value,sizeof(value)); LA 15,14(0,1) LG 1,0(0,1) MVC 0(2,1),0(15) * *** } @ret_lab_454 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue * * DSECT for automatic variables in "LZ4_write16" * (FUNCTION #454) * @AUTO#$L$Z4_write16 DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_write32 @LNAME455 DS 0H DC X'0000000B' DC C'LZ4_write32' DC X'00' $L$Z4_write32 DCCPRLG CINDEX=455,BASER=0,FRAME=168,SAVEAREA=NO,ENTRY=NO* ,ARCH=ZARCH,LNAMEADDR=@LNAME455 * ******* End of Prologue * * * *** __memcpy(memPtr,&value,sizeof(value)); LA 15,12(0,1) LG 1,0(0,1) MVC 0(4,1),0(15) * *** } @ret_lab_455 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue * * DSECT for automatic variables in "LZ4_write32" * (FUNCTION #455) * @AUTO#$L$Z4_write32 DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_readLE16 @LNAME456 DS 0H DC X'0000000C' DC C'LZ4_readLE16' DC X'00' $L$Z4_read$L$E16 DCCPRLG CINDEX=456,BASER=12,FRAME=184,ENTRY=NO,ARCH=ZA* RCH,LNAMEADDR=@LNAME456 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * * *** if (LZ4_isLittleEndian()) { LG 15,@lit_456_4 ; LZ4_isLittleEndian @@gen_label0 DS 0H BALR 14,15 @@gen_label1 DS 0H LTR 15,15 BZ @L17 * *** return LZ4_read16(memPtr); LG 15,0(0,2) ; memPtr STG 15,176(0,13) LA 1,176(0,13) LG 15,@lit_456_5 ; LZ4_read16 @@gen_label3 DS 0H BALR 14,15 @@gen_label4 DS 0H LLGHR 15,15 B @ret_lab_456 DS 0D @FRAMESIZE_456 DC F'184' @lit_456_4 DC AD($L$Z4_is$Little$Endian) @lit_456_5 DC AD($L$Z4_read16) * *** } else { @L17 DS 0H * *** const BYTE* p = (const BYTE*)memPtr; LG 15,0(0,2) ; memPtr * *** return (U16)((U16)p[0] + (p[1]<<8)); LLC 1,0(0,15) LLC 15,1(0,15) SLL 15,8(0) AR 1,15 LLGHR 15,1 * *** } * *** } @ret_lab_456 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_readLE16" * (FUNCTION #456) * @AUTO#$L$Z4_read$L$E16 DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_writeLE16 @LNAME457 DS 0H DC X'0000000D' DC C'LZ4_writeLE16' DC X'00' $L$Z4_write$L$E16 DCCPRLG CINDEX=457,BASER=12,FRAME=192,ENTRY=NO,ARCH=Z* ARCH,LNAMEADDR=@LNAME457 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * * *** if (LZ4_isLittleEndian()) { LG 15,@lit_457_7 ; LZ4_isLittleEndian @@gen_label5 DS 0H BALR 14,15 @@gen_label6 DS 0H LTR 15,15 BZ @L19 * *** LZ4_write16(memPtr, value); LG 15,0(0,2) ; memPtr STG 15,176(0,13) LLGH 15,14(0,2) ; value STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_457_8 ; LZ4_write16 @@gen_label8 DS 0H BALR 14,15 @@gen_label9 DS 0H * *** } else { B @ret_lab_457 DS 0D @FRAMESIZE_457 DC F'192' @lit_457_7 DC AD($L$Z4_is$Little$Endian) @lit_457_8 DC AD($L$Z4_write16) @L19 DS 0H * *** BYTE* p = (BYTE*)memPtr; LG 15,0(0,2) ; memPtr * *** p[0] = (BYTE) value; LH 1,14(0,2) ; value STC 1,0(0,15) * *** p[1] = (BYTE)(value>>8); LLHR 1,1 SRA 1,8(0) STC 1,1(0,15) * *** } @L20 DS 0H * *** } @ret_lab_457 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_writeLE16" * (FUNCTION #457) * @AUTO#$L$Z4_write$L$E16 DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_wildCopy8 @LNAME458 DS 0H DC X'0000000D' DC C'LZ4_wildCopy8' DC X'00' $L$Z4_wild$Copy8 DCCPRLG CINDEX=458,BASER=12,FRAME=176,SAVEAREA=NO,ENTR* Y=NO,ARCH=ZARCH,LNAMEADDR=@LNAME458 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * * *** BYTE* d = (BYTE*)dstPtr; LG 15,0(0,2) ; dstPtr * *** const BYTE* s = (const BYTE*)srcPtr; LMG 1,2,8(2) ; srcPtr * *** BYTE* const e = (BYTE*)dstEnd; * *** * *** do { __memcpy(d,s,8); d+=8; s+=8; } while (d<e); @L21 DS 0H MVC 0(8,15),0(1) LA 15,8(0,15) LA 1,8(0,1) CGR 15,2 BL @L21 * *** } @ret_lab_458 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_wildCopy8" * (FUNCTION #458) * @AUTO#$L$Z4_wild$Copy8 DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_NbCommonBytes @LNAME459 DS 0H DC X'00000011' DC C'LZ4_NbCommonBytes' DC X'00' $L$Z4_$Nb$Common$Bytes DCCPRLG CINDEX=459,BASER=12,FRAME=176,ENTRY=NO,A* RCH=ZARCH,LNAMEADDR=@LNAME459 * ******* End of Prologue * * * *** ((void)0); LG 2,0(0,1) ; val * *** if (LZ4_isLittleEndian()) { LG 15,@lit_459_10 ; LZ4_isLittleEndian @@gen_label11 DS 0H BALR 14,15 @@gen_label12 DS 0H LTR 15,15 BZ @L24 * *** if (sizeof(val) == 8) { * *** # 533 "C:\asgkafka\librdkafka\src\lz4.c" * *** const U64 m = 0x0101010101010101ULL; LG 15,@lit_459_12 ; 72340172838076673 * *** val ^= val - 1; LGR 1,2 AGHI 1,-1 XGR 2,1 * *** return (unsigned)(((U64)((val & (m - 1)) * m)) >> \ * 56); LGR 1,15 AGHI 1,-1 NGR 2,1 MSGR 2,15 SRLG 15,2,56(0) LLGFR 15,15 B @ret_lab_459 DS 0D @FRAMESIZE_459 DC F'176' @lit_459_10 DC AD($L$Z4_is$Little$Endian) @lit_459_12 DC FD'72340172838076673' 0x0101010101010101 @lit_459_17 DC FD'36099303471055874' 0x0080402010080402 @lit_459_16 DC AD(@DATA) * *** * *** } else { @L25 DS 0H * *** # 547 "C:\asgkafka\librdkafka\src\lz4.c" * *** const U32 m = 0x01010101; * *** return (unsigned)((((val - 1) ^ val) & (m - 1)) * \ * m) >> 24; * *** * *** } * *** } else { @L24 DS 0H * *** if (sizeof(val)==8) { * *** # 559 "C:\asgkafka\librdkafka\src\lz4.c" * *** * *** * *** static const unsigned char ctz7_tab[128] = { * *** 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0\ * , * *** 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0\ * , * *** 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0\ * , * *** 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0\ * , * *** 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0\ * , * *** 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0\ * , * *** 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0\ * , * *** 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0\ * , * *** }; * *** U64 const mask = 0x0101010101010101ULL; LG 15,@lit_459_12 ; 72340172838076673 * *** U64 const t = (((val >> 8) - mask) | val) & mask; SRLG 1,2,8(0) SLGR 1,15 OGR 1,2 NGR 1,15 * *** return ctz7_tab[(t * 0x0080402010080402ULL) >> 57]\ * ; LG 15,@lit_459_16 MSG 1,@lit_459_17 SRLG 1,1,57(0) LLC 15,68(1,15) LLGFR 15,15 * *** # 588 "C:\asgkafka\librdkafka\src\lz4.c" * *** } else { @L28 DS 0H * *** # 594 "C:\asgkafka\librdkafka\src\lz4.c" * *** val >>= 8; * *** val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) | * *** (val + 0x00FF0000)) >> 24; * *** return (unsigned)val ^ 3; * *** * *** } * *** } * *** } @ret_lab_459 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_NbCommonBytes" * (FUNCTION #459) * @AUTO#$L$Z4_$Nb$Common$Bytes DSECT DS XL168 $L$Z4_$Nb$Common$Bytes#t#5 DS 8XL1 ; t ORG @AUTO#$L$Z4_$Nb$Common$Bytes+168 $L$Z4_$Nb$Common$Bytes#mask#5 DS 8XL1 ; mask ORG @AUTO#$L$Z4_$Nb$Common$Bytes+168 $L$Z4_$Nb$Common$Bytes#m#3 DS 1F ; m ORG @AUTO#$L$Z4_$Nb$Common$Bytes+168 $L$Z4_$Nb$Common$Bytes#m#2 DS 8XL1 ; m * @CODE CSECT * * * * ....... start of LZ4_count @LNAME460 DS 0H DC X'00000009' DC C'LZ4_count' DC X'00' $L$Z4_count DCCPRLG CINDEX=460,BASER=12,FRAME=184,ENTRY=NO,ARCH=ZARCH,L* NAMEADDR=@LNAME460 * ******* End of Prologue * * * *** const BYTE* const pStart = pIn; LG 5,0(0,1) ; pIn LGR 2,5 LMG 3,4,8(1) ; pMatch * *** * *** if (((pIn < pInLimit-(sizeof(reg_t)-1)) != 0)) { LGHI 15,-7 ; -7 LA 15,0(15,4) CGR 5,15 BNL @@gen_label14 LHI 15,1 B @@gen_label15 DS 0D @FRAMESIZE_460 DC F'184' @lit_460_20 DC AD($L$Z4_read_$A$R$C$H) @lit_460_22 DC AD($L$Z4_$Nb$Common$Bytes) @lit_460_28 DC AD($L$Z4_read32) @lit_460_31 DC AD($L$Z4_read16) @@gen_label14 DS 0H LHI 15,0 @@gen_label15 DS 0H LTR 15,15 BE @L36 * *** reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_AR\ * CH(pIn); STG 3,176(0,13) LA 1,176(0,13) LG 6,@lit_460_20 ; LZ4_read_ARCH LGR 15,6 @@gen_label17 DS 0H BALR 14,15 @@gen_label18 DS 0H LGR 7,15 STG 2,176(0,13) LA 1,176(0,13) LGR 15,6 @@gen_label19 DS 0H BALR 14,15 @@gen_label20 DS 0H XGR 7,15 * *** if (!diff) { LTGR 1,7 BNZ @L31 * *** pIn+=sizeof(reg_t); pMatch+=sizeof(reg_t); LA 2,8(0,2) LA 3,8(0,3) * *** } else { B @L32 @L31 DS 0H * *** return LZ4_NbCommonBytes(diff); STG 7,176(0,13) LA 1,176(0,13) LG 15,@lit_460_22 ; LZ4_NbCommonBytes @@gen_label22 DS 0H BALR 14,15 @@gen_label23 DS 0H LLGFR 15,15 B @ret_lab_460 * *** } } @L32 DS 0H @L30 DS 0H * *** * *** while (((pIn < pInLimit-(sizeof(reg_t)-1)) != 0)) { B @L36 @L35 DS 0H * *** reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_AR\ * CH(pIn); STG 3,176(0,13) LA 1,176(0,13) LG 6,@lit_460_20 ; LZ4_read_ARCH LGR 15,6 @@gen_label24 DS 0H BALR 14,15 @@gen_label25 DS 0H LGR 7,15 STG 2,176(0,13) LA 1,176(0,13) LGR 15,6 @@gen_label26 DS 0H BALR 14,15 @@gen_label27 DS 0H XGR 7,15 * *** if (!diff) { pIn+=sizeof(reg_t); pMatch+=sizeof(reg_t)\ * ; continue; } LTGR 1,7 BNZ @L37 LA 2,8(0,2) LA 3,8(0,3) B @L36 @L37 DS 0H * *** pIn += LZ4_NbCommonBytes(diff); STG 7,176(0,13) LA 1,176(0,13) LG 15,@lit_460_22 ; LZ4_NbCommonBytes @@gen_label29 DS 0H BALR 14,15 @@gen_label30 DS 0H LLGFR 15,15 LA 15,0(15,2) * *** return (unsigned)(pIn - pStart); SGR 15,5 LLGFR 15,15 B @ret_lab_460 * *** } @L36 DS 0H LGHI 15,-7 ; -7 LA 15,0(15,4) CGR 2,15 BNL @@gen_label31 LHI 15,1 B @@gen_label32 @@gen_label31 DS 0H LHI 15,0 @@gen_label32 DS 0H LTR 15,15 BNE @L35 * *** * *** if ((sizeof(reg_t)==8) && (pIn<(pInLimit-3)) && (LZ4_read3\ * 2(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; } LGHI 15,-3 ; -3 LA 15,0(15,4) CGR 2,15 BNL @L38 STG 3,176(0,13) LA 1,176(0,13) LG 6,@lit_460_28 ; LZ4_read32 LGR 15,6 @@gen_label35 DS 0H BALR 14,15 @@gen_label36 DS 0H LR 7,15 STG 2,176(0,13) LA 1,176(0,13) LGR 15,6 @@gen_label37 DS 0H BALR 14,15 @@gen_label38 DS 0H CLR 7,15 BNE @L38 LA 2,4(0,2) LA 3,4(0,3) @L38 DS 0H * *** if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read1\ * 6(pIn))) { pIn+=2; pMatch+=2; } LGHI 15,-1 ; -1 LA 15,0(15,4) CGR 2,15 BNL @L39 STG 3,176(0,13) LA 1,176(0,13) LG 6,@lit_460_31 ; LZ4_read16 LGR 15,6 @@gen_label41 DS 0H BALR 14,15 @@gen_label42 DS 0H LLHR 7,15 STG 2,176(0,13) LA 1,176(0,13) LGR 15,6 @@gen_label43 DS 0H BALR 14,15 @@gen_label44 DS 0H LLHR 15,15 CR 7,15 BNE @L39 LA 2,2(0,2) LA 3,2(0,3) @L39 DS 0H * *** if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++; CGR 2,4 BNL @L40 CLC 0(1,3),0(2) BNE @L40 LA 2,1(0,2) @L40 DS 0H * *** return (unsigned)(pIn - pStart); SGR 2,5 LLGFR 15,2 * *** } @ret_lab_460 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_count" * (FUNCTION #460) * @AUTO#$L$Z4_count DSECT DS XL168 $L$Z4_count#diff#4 DS 8XL1 ; diff ORG @AUTO#$L$Z4_count+168 $L$Z4_count#diff#1 DS 8XL1 ; diff * @CODE CSECT * * * * ....... start of LZ4_versionNumber $L$Z4_version$Number ALIAS X'D3E9F46DA58599A2899695D5A494828599' @LNAME340 DS 0H DC X'00000011' DC C'LZ4_versionNumber' DC X'00' $L$Z4_version$Number DCCPRLG CINDEX=340,BASER=0,FRAME=168,SAVEAREA=NO,E* NTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME340 * ******* End of Prologue * * LGHI 15,10903 ; 10903 * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue * * DSECT for automatic variables in "LZ4_versionNumber" * (FUNCTION #340) * @AUTO#$L$Z4_version$Number DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_versionString $L$Z4_version$String ALIAS X'D3E9F46DA58599A2899695E2A399899587' @LNAME341 DS 0H DC X'00000011' DC C'LZ4_versionString' DC X'00' $L$Z4_version$String DCCPRLG CINDEX=341,BASER=12,FRAME=168,SAVEAREA=NO,* ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME341 * ******* End of Prologue * * LG 15,@lit_341_35 * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @lit_341_35 DC AD(@strings@) DROP 12 * * DSECT for automatic variables in "LZ4_versionString" * (FUNCTION #341) * @AUTO#$L$Z4_version$String DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_compressBound $L$Z4_compress$Bound ALIAS X'D3E9F46D839694979985A2A2C296A49584' @LNAME344 DS 0H DC X'00000011' DC C'LZ4_compressBound' DC X'00' $L$Z4_compress$Bound DCCPRLG CINDEX=344,BASER=12,FRAME=168,SAVEAREA=NO,* ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME344 * ******* End of Prologue * * L 15,4(0,1) ; isize CLFI 15,X'7E000000' BNH @L41 LHI 15,0 ; 0 B @L42 DS 0D @lit_344_37 DC F'-2139062143' 0x80808081 @L41 DS 0H LR 1,15 ; /0xff LR 3,15 ; . SRL 1,31(0) ; . M 2,@lit_344_37 ; . ALR 2,15 ; . SRA 2,7(0) ; . ALR 2,1 ; . AR 15,2 AHI 15,16 @L42 DS 0H LGFR 15,15 * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_compressBound" * (FUNCTION #344) * @AUTO#$L$Z4_compress$Bound DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_sizeofState $L$Z4_sizeof$State ALIAS X'D3E9F46DA289A9859686E2A381A385' @LNAME346 DS 0H DC X'0000000F' DC C'LZ4_sizeofState' DC X'00' $L$Z4_sizeof$State DCCPRLG CINDEX=346,BASER=0,FRAME=168,SAVEAREA=NO,ENT* RY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME346 * ******* End of Prologue * * LGHI 15,16416 ; 16416 * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue * * DSECT for automatic variables in "LZ4_sizeofState" * (FUNCTION #346) * @AUTO#$L$Z4_sizeof$State DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_hash4 @LNAME463 DS 0H DC X'00000009' DC C'LZ4_hash4' DC X'00' $L$Z4_hash4 DCCPRLG CINDEX=463,BASER=12,FRAME=168,SAVEAREA=NO,ENTRY=NO,* ARCH=ZARCH,LNAMEADDR=@LNAME463 * ******* End of Prologue * * * *** if (tableType == byU16) CHSI 12(1),3 BNE @L43 * *** return ((sequence * 2654435761U) >> ((4*8)-((14-2)+1))\ * ); L 15,4(0,1) ; sequence MSFI 15,X'9E3779B1' SRL 15,19(0) LLGFR 15,15 B @ret_lab_463 * *** else @L43 DS 0H * *** return ((sequence * 2654435761U) >> ((4*8)-(14-2))); L 15,4(0,1) ; sequence MSFI 15,X'9E3779B1' SRL 15,20(0) LLGFR 15,15 * *** } @ret_lab_463 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_hash4" * (FUNCTION #463) * @AUTO#$L$Z4_hash4 DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_hash5 @LNAME464 DS 0H DC X'00000009' DC C'LZ4_hash5' DC X'00' $L$Z4_hash5 DCCPRLG CINDEX=464,BASER=12,FRAME=176,ENTRY=NO,ARCH=ZARCH,L* NAMEADDR=@LNAME464 LGR 3,1 ; ptr to parm area * ******* End of Prologue * * * *** const U32 hashLog = (tableType == byU16) ? (14-2)+1 : (14-\ * 2); CHSI 12(3),3 BNE @L45 LHI 2,13 ; 13 B @L46 DS 0D @FRAMESIZE_464 DC F'176' @lit_464_41 DC AD($L$Z4_is$Little$Endian) @lit_464_43 DC FD'889523592379' 0x000000cf1bbcdcbb @lit_464_46 DC FD'-7046029288634856825' 0x9e3779b185ebca87 @L45 DS 0H LHI 2,12 ; 12 @L46 DS 0H * *** if (LZ4_isLittleEndian()) { LG 15,@lit_464_41 ; LZ4_isLittleEndian @@gen_label51 DS 0H BALR 14,15 @@gen_label52 DS 0H LTR 15,15 BZ @L47 * *** const U64 prime5bytes = 889523592379ULL; LG 15,@lit_464_43 ; 889523592379 * *** return (U32)(((sequence << 24) * prime5bytes) >> (64 -\ * hashLog)); LG 1,0(0,3) ; sequence SLLG 1,1,24(0) MSGR 1,15 LHI 15,64 ; 64 SLR 15,2 SRLG 15,1,0(15) LLGFR 15,15 B @ret_lab_464 * *** } else { @L47 DS 0H * *** const U64 prime8bytes = 11400714785074694791ULL; LG 15,@lit_464_46 ; -7046029288634856825 * *** return (U32)(((sequence >> 24) * prime8bytes) >> (64 -\ * hashLog)); LG 1,0(0,3) ; sequence SRLG 1,1,24(0) MSGR 1,15 LHI 15,64 ; 64 SLR 15,2 SRLG 15,1,0(15) LLGFR 15,15 * *** } * *** } @ret_lab_464 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_hash5" * (FUNCTION #464) * @AUTO#$L$Z4_hash5 DSECT DS XL168 $L$Z4_hash5#prime8bytes#2 DS 8XL1 ; prime8bytes ORG @AUTO#$L$Z4_hash5+168 $L$Z4_hash5#prime5bytes#1 DS 8XL1 ; prime5bytes ORG @AUTO#$L$Z4_hash5+168 $L$Z4_hash5#hash$Log#0 DS 1F ; hashLog * @CODE CSECT * * * * ....... start of LZ4_hashPosition @LNAME465 DS 0H DC X'00000010' DC C'LZ4_hashPosition' DC X'00' $L$Z4_hash$Position DCCPRLG CINDEX=465,BASER=12,FRAME=184,ENTRY=NO,ARCH* =ZARCH,LNAMEADDR=@LNAME465 * ******* End of Prologue * * * *** if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4\ * _hash5(LZ4_read_ARCH(p), tableType); L 2,12(0,1) ; tableType CHI 2,3 BE @L49 LG 15,0(0,1) ; p STG 15,168(0,13) LA 1,168(0,13) LG 15,@lit_465_49 ; LZ4_read_ARCH @@gen_label55 DS 0H BALR 14,15 @@gen_label56 DS 0H STG 15,168(0,13) LGFR 15,2 STG 15,176(0,13) LA 1,168(0,13) LG 15,@lit_465_50 ; LZ4_hash5 @@gen_label57 DS 0H BALR 14,15 @@gen_label58 DS 0H LLGFR 15,15 B @ret_lab_465 DS 0D @FRAMESIZE_465 DC F'184' @lit_465_49 DC AD($L$Z4_read_$A$R$C$H) @lit_465_50 DC AD($L$Z4_hash5) @lit_465_51 DC AD($L$Z4_read32) @lit_465_52 DC AD($L$Z4_hash4) @L49 DS 0H * *** return LZ4_hash4(LZ4_read32(p), tableType); LG 15,0(0,1) ; p STG 15,168(0,13) LA 1,168(0,13) LG 15,@lit_465_51 ; LZ4_read32 @@gen_label59 DS 0H BALR 14,15 @@gen_label60 DS 0H LLGFR 15,15 STG 15,168(0,13) LGFR 15,2 STG 15,176(0,13) LA 1,168(0,13) LG 15,@lit_465_52 ; LZ4_hash4 @@gen_label61 DS 0H BALR 14,15 @@gen_label62 DS 0H LLGFR 15,15 * *** } @ret_lab_465 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_hashPosition" * (FUNCTION #465) * @AUTO#$L$Z4_hash$Position DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_clearHash @LNAME466 DS 0H DC X'0000000D' DC C'LZ4_clearHash' DC X'00' $L$Z4_clear$Hash DCCPRLG CINDEX=466,BASER=12,FRAME=176,SAVEAREA=NO,ENTR* Y=NO,ARCH=ZARCH,LNAMEADDR=@LNAME466 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * * *** switch (tableType) L 15,4(0,2) ; h LG 1,8(0,2) ; tableBase B @L50 * *** { * *** default: * *** case clearedTable: { ((void)0); return; } @L53 DS 0H B @ret_lab_466 * *** case byPtr: { const BYTE** hashTable = (const BYTE**)table\ * Base; hashTable[h] = ((void *)0); return; } @L54 DS 0H LLGFR 15,15 SLLG 15,15,3(0) ; *0x8 LGHI 2,0 ; 0 STG 2,0(15,1) B @ret_lab_466 * *** case byU32: { U32* hashTable = (U32*) tableBase; hashTable\ * [h] = 0; return; } @L55 DS 0H LLGFR 15,15 SLLG 15,15,2(0) ; *0x4 LA 15,0(15,1) MVHI 0(15),0 B @ret_lab_466 * *** case byU16: { U16* hashTable = (U16*) tableBase; hashTable\ * [h] = 0; return; } @L56 DS 0H LLGFR 15,15 AGR 15,15 ; *0x2 LA 15,0(15,1) MVHHI 0(15),0 B @ret_lab_466 * *** } @L50 DS 0H L 2,20(0,2) ; tableType CLFI 2,X'00000003' BH @ret_lab_466 LGFR 2,2 LA 3,@@gen_label63 SLLG 2,2,3(0) LG 2,0(3,2) B 0(2,12) @@gen_label63 DS 0D DC AD(@L53-@REGION_466_1) DC AD(@L54-@REGION_466_1) DC AD(@L55-@REGION_466_1) DC AD(@L56-@REGION_466_1) * *** } @ret_lab_466 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_clearHash" * (FUNCTION #466) * @AUTO#$L$Z4_clear$Hash DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_putIndexOnHash @LNAME467 DS 0H DC X'00000012' DC C'LZ4_putIndexOnHash' DC X'00' $L$Z4_put$Index$On$Hash DCCPRLG CINDEX=467,BASER=12,FRAME=176,SAVEAREA=* NO,ENTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME467 * ******* End of Prologue * * * *** switch (tableType) B @L57 DS 0D @lit_467_56 DC FD'3' 0x0000000000000003 @lit_467_57 DC FD'4' 0x0000000000000004 @lit_467_58 DC FD'8' 0x0000000000000008 * *** { * *** default: * *** case clearedTable: * *** case byPtr: { ((void)0); return; } * *** case byU32: { U32* hashTable = (U32*) tableBase; hashTable\ * [h] = idx; return; } @L62 DS 0H LG 15,16(0,1) ; tableBase LLGF 2,12(0,1) ; h SLLG 2,2,2(0) ; *0x4 L 1,4(0,1) ; idx ST 1,0(2,15) B @ret_lab_467 * *** case byU16: { U16* hashTable = (U16*) tableBase; ((void)0)\ * ; hashTable[h] = (U16)idx; return; } @L63 DS 0H LG 15,16(0,1) ; tableBase LLGF 2,12(0,1) ; h AGR 2,2 ; *0x2 L 1,4(0,1) ; idx STH 1,0(2,15) B @ret_lab_467 * *** } @L57 DS 0H L 15,28(0,1) ; tableType CLFI 15,X'00000003' BH @ret_lab_467 LGFR 15,15 LGHI 2,1 SLLG 2,2,0(15) LGR 15,2 NG 15,@lit_467_56 BNZ @ret_lab_467 LGR 15,2 NG 15,@lit_467_57 BNZ @L62 NG 2,@lit_467_58 BNZ @L63 * *** } @ret_lab_467 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_putIndexOnHash" * (FUNCTION #467) * @AUTO#$L$Z4_put$Index$On$Hash DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_putPositionOnHash @LNAME468 DS 0H DC X'00000015' DC C'LZ4_putPositionOnHash' DC X'00' $L$Z4_put$Position$On$Hash DCCPRLG CINDEX=468,BASER=12,FRAME=176,SAVEAR* EA=NO,ENTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME468 LGR 3,1 ; ptr to parm area * ******* End of Prologue * * * *** switch (tableType) LG 15,0(0,3) ; p L 1,12(0,3) ; h LG 2,16(0,3) ; tableBase B @L64 * *** { * *** case clearedTable: { ((void)0); return; } @L66 DS 0H B @ret_lab_468 * *** case byPtr: { const BYTE** hashTable = (const BYTE**)table\ * Base; hashTable[h] = p; return; } @L67 DS 0H LLGFR 1,1 SLLG 1,1,3(0) ; *0x8 STG 15,0(1,2) B @ret_lab_468 * *** case byU32: { U32* hashTable = (U32*) tableBase; hashTable\ * [h] = (U32)(p-srcBase); return; } @L68 DS 0H LLGFR 1,1 SLLG 1,1,2(0) ; *0x4 SG 15,32(0,3) ST 15,0(1,2) B @ret_lab_468 * *** case byU16: { U16* hashTable = (U16*) tableBase; hashTable\ * [h] = (U16)(p-srcBase); return; } @L69 DS 0H LLGFR 1,1 AGR 1,1 ; *0x2 SG 15,32(0,3) STH 15,0(1,2) B @ret_lab_468 * *** } @L64 DS 0H L 4,28(0,3) ; tableType CLFI 4,X'00000003' BH @ret_lab_468 LGFR 4,4 LA 5,@@gen_label64 SLLG 4,4,3(0) LG 4,0(5,4) B 0(4,12) @@gen_label64 DS 0D DC AD(@L66-@REGION_468_1) DC AD(@L67-@REGION_468_1) DC AD(@L68-@REGION_468_1) DC AD(@L69-@REGION_468_1) * *** } @ret_lab_468 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_putPositionOnHash" * (FUNCTION #468) * @AUTO#$L$Z4_put$Position$On$Hash DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_putPosition @LNAME469 DS 0H DC X'0000000F' DC C'LZ4_putPosition' DC X'00' $L$Z4_put$Position DCCPRLG CINDEX=469,BASER=12,FRAME=216,ENTRY=NO,ARCH=* ZARCH,LNAMEADDR=@LNAME469 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * * *** U32 const h = LZ4_hashPosition(p, tableType); LG 15,0(0,2) ; p STG 15,176(0,13) LGF 15,20(0,2) ; tableType STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_469_60 ; LZ4_hashPosition @@gen_label65 DS 0H BALR 14,15 @@gen_label66 DS 0H * *** LZ4_putPositionOnHash(p, h, tableBase, tableType, srcBase)\ * ; LG 1,0(0,2) ; p STG 1,176(0,13) LLGFR 15,15 STG 15,184(0,13) LG 15,8(0,2) ; tableBase STG 15,192(0,13) LGF 15,20(0,2) ; tableType STG 15,200(0,13) LG 15,24(0,2) ; srcBase STG 15,208(0,13) LA 1,176(0,13) LG 15,@lit_469_61 ; LZ4_putPositionOnHash @@gen_label67 DS 0H BALR 14,15 @@gen_label68 DS 0H * *** } @ret_lab_469 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_469 DC F'216' @lit_469_60 DC AD($L$Z4_hash$Position) @lit_469_61 DC AD($L$Z4_put$Position$On$Hash) DROP 12 * * DSECT for automatic variables in "LZ4_putPosition" * (FUNCTION #469) * @AUTO#$L$Z4_put$Position DSECT DS XL168 $L$Z4_put$Position#h#0 DS 1F ; h * @CODE CSECT * * * * ....... start of LZ4_getIndexOnHash @LNAME470 DS 0H DC X'00000012' DC C'LZ4_getIndexOnHash' DC X'00' $L$Z4_get$Index$On$Hash DCCPRLG CINDEX=470,BASER=12,FRAME=176,SAVEAREA=* NO,ENTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME470 * ******* End of Prologue * * * *** { enum { LZ4_static_assert = 1/(int)(!!(14 > 2)) }; }; * *** if (tableType == byU32) { CHSI 20(1),2 BNE @L70 * *** const U32* const hashTable = (const U32*) tableBase; LG 15,8(0,1) ; tableBase * *** ((void)0); * *** return hashTable[h]; LLGF 1,4(0,1) ; h SLLG 1,1,2(0) ; *0x4 LLGF 15,0(1,15) B @ret_lab_470 * *** } @L70 DS 0H * *** if (tableType == byU16) { CHSI 20(1),3 BNE @L71 * *** const U16* const hashTable = (const U16*) tableBase; LG 15,8(0,1) ; tableBase * *** ((void)0); * *** return hashTable[h]; LLGF 1,4(0,1) ; h AGR 1,1 ; *0x2 LLH 15,0(1,15) LLGFR 15,15 B @ret_lab_470 * *** } @L71 DS 0H * *** ((void)0); return 0; LGHI 15,0 ; 0 * *** } @ret_lab_470 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_getIndexOnHash" * (FUNCTION #470) * @AUTO#$L$Z4_get$Index$On$Hash DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_getPositionOnHash @LNAME471 DS 0H DC X'00000015' DC C'LZ4_getPositionOnHash' DC X'00' $L$Z4_get$Position$On$Hash DCCPRLG CINDEX=471,BASER=12,FRAME=176,SAVEAR* EA=NO,ENTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME471 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * * *** if (tableType == byPtr) { const BYTE* const* hashTable = (\ * const BYTE* const*) tableBase; return hashTable[h]; } L 15,4(0,2) ; h LG 1,8(0,2) ; tableBase CHSI 20(2),1 BNE @L72 LLGFR 15,15 SLLG 15,15,3(0) ; *0x8 LG 15,0(15,1) B @ret_lab_471 @L72 DS 0H * *** if (tableType == byU32) { const U32* const hashTable = (co\ * nst U32*) tableBase; return hashTable[h] + srcBase; } CHSI 20(2),2 BNE @L73 LLGFR 15,15 SLLG 15,15,2(0) ; *0x4 LLGF 15,0(15,1) LG 1,24(0,2) ; srcBase LA 15,0(15,1) B @ret_lab_471 @L73 DS 0H * *** { const U16* const hashTable = (const U16*) tableBase; ret\ * urn hashTable[h] + srcBase; } LLGFR 15,15 AGR 15,15 ; *0x2 LLGH 15,0(15,1) LG 1,24(0,2) ; srcBase LA 15,0(15,1) * *** } @ret_lab_471 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_getPositionOnHash" * (FUNCTION #471) * @AUTO#$L$Z4_get$Position$On$Hash DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_getPosition @LNAME472 DS 0H DC X'0000000F' DC C'LZ4_getPosition' DC X'00' $L$Z4_get$Position DCCPRLG CINDEX=472,BASER=12,FRAME=208,ENTRY=NO,ARCH=* ZARCH,LNAMEADDR=@LNAME472 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * * *** U32 const h = LZ4_hashPosition(p, tableType); LG 15,0(0,2) ; p STG 15,176(0,13) LGF 15,20(0,2) ; tableType STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_472_64 ; LZ4_hashPosition @@gen_label73 DS 0H BALR 14,15 @@gen_label74 DS 0H * *** return LZ4_getPositionOnHash(h, tableBase, tableType, srcB\ * ase); LLGFR 15,15 STG 15,176(0,13) LG 15,8(0,2) ; tableBase STG 15,184(0,13) LGF 15,20(0,2) ; tableType STG 15,192(0,13) LG 15,24(0,2) ; srcBase STG 15,200(0,13) LA 1,176(0,13) LG 15,@lit_472_65 ; LZ4_getPositionOnHash @@gen_label75 DS 0H BALR 14,15 @@gen_label76 DS 0H * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_472 DC F'208' @lit_472_64 DC AD($L$Z4_hash$Position) @lit_472_65 DC AD($L$Z4_get$Position$On$Hash) DROP 12 * * DSECT for automatic variables in "LZ4_getPosition" * (FUNCTION #472) * @AUTO#$L$Z4_get$Position DSECT DS XL168 $L$Z4_get$Position#h#0 DS 1F ; h * @CODE CSECT * * * * ....... start of LZ4_prepareTable @LNAME473 DS 0H DC X'00000010' DC C'LZ4_prepareTable' DC X'00' $L$Z4_prepare$Table DCCPRLG CINDEX=473,BASER=12,FRAME=168,SAVEAREA=NO,E* NTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME473 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * LG 15,0(0,2) ; cctx L 1,20(0,2) ; tableType * *** * *** * *** * *** * *** if ((tableType_t)cctx->tableType != clearedTable) { LGHI 3,16388 ; 16388 LA 4,0(3,15) CHSI 0(4),0 BE @L74 * *** ((void)0); * *** if ((tableType_t)cctx->tableType != tableType * *** || ((tableType == byU16) && cctx->currentOffset + (u\ * nsigned)inputSize >= 0xFFFFU) C 1,0(3,15) BNE @L79 CHI 1,3 BNE @L75 LGHI 3,16384 ; 16384 L 3,0(3,15) ; offset of currentOffset in LZ4_stream_t_in* ternal AL 3,12(0,2) CLFI 3,X'0000FFFF' BNL @L79 * *** || ((tableType == byU32) && cctx->currentOffset > 1 \ * *(1U<<30)) @L75 DS 0H CHI 1,2 BNE @L76 LGHI 3,16384 ; 16384 LA 3,0(3,15) L 3,0(0,3) CLFI 3,X'40000000' BH @L79 * *** || tableType == byPtr @L76 DS 0H * *** || inputSize >= 4 *(1 <<10)) CHI 1,1 BE @L79 @L77 DS 0H CHSI 12(2),4096 BL @L74 @L79 DS 0H * *** { * *** {}; * *** __memset((cctx->hashTable),(0),((1 << 14))); * setting 16384 bytes to 0x00 LGR 3,15 LGHI 2,64 ; 64 @@gen_label85 DS 0H XC 0(256,3),0(3) LA 3,256(0,3) BCTG 2,@@gen_label85 * *** cctx->currentOffset = 0; LGHI 2,16384 ; 16384 LA 2,0(2,15) MVHI 0(2),0 ; offset of currentOffset in LZ4_stream_t_in* ternal * *** cctx->tableType = (U32)clearedTable; LGHI 2,16388 ; 16388 LA 2,0(2,15) MVHI 0(2),0 ; offset of tableType in LZ4_stream_t_intern* al * *** } else { * *** {}; * *** } * *** } @L74 DS 0H * *** * *** * *** * *** * *** * *** if (cctx->currentOffset != 0 && tableType == byU32) { LGHI 2,16384 ; 16384 LA 3,0(2,15) CLFHSI 0(3),0 BE @L81 CHI 1,2 BNE @L81 * *** {}; * *** cctx->currentOffset += 64 *(1 <<10); L 1,0(2,15) AFI 1,X'00010000' ST 1,0(2,15) * *** } @L81 DS 0H * *** * *** * *** cctx->dictCtx = ((void *)0); LGHI 1,16400 ; 16400 LGHI 2,0 ; 0 STG 2,0(1,15) ; offset of dictCtx in LZ4_stream_t_internal * *** cctx->dictionary = ((void *)0); LGHI 1,16392 ; 16392 STG 2,0(1,15) ; offset of dictionary in LZ4_stream_t_inter* nal * *** cctx->dictSize = 0; LGHI 1,16408 ; 16408 LA 15,0(1,15) MVHI 0(15),0 ; offset of dictSize in LZ4_stream_t_interna* l * *** } @ret_lab_473 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_prepareTable" * (FUNCTION #473) * @AUTO#$L$Z4_prepare$Table DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_compress_generic_validated @LNAME474 DS 0H DC X'0000001E' DC C'LZ4_compress_generic_validated' DC X'00' $L$Z4_compress_generic_validated DCCPRLG CINDEX=474,BASER=12,FRAME=352,* ENTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME474 LGR 7,1 * ******* End of Prologue * * LG 6,0(0,7) ; cctx LG 3,8(0,7) ; source STG 3,244(0,13) ; spill L 15,28(0,7) ; inputSize L 1,52(0,7) ; outputDirective ST 1,232(0,13) ; spill L 5,60(0,7) ; tableType L 9,68(0,7) ; dictDirective * *** int result; * *** const BYTE* ip = (const BYTE*) source; * *** * *** U32 const startIndex = cctx->currentOffset; LGHI 11,16384 ; 16384 L 1,0(11,6) ; offset of currentOffset in LZ4_stream_t_in* ternal ST 1,268(0,13) ; spill * *** const BYTE* base = (const BYTE*) source - startIndex; LLGFR 1,1 LGR 8,3 SGR 8,1 * *** const BYTE* lowLimit; * *** * *** const LZ4_stream_t_internal* dictCtx = (const LZ4_stream_t\ * _internal*) cctx->dictCtx; LGHI 14,16400 ; 16400 LG 1,0(14,6) ; offset of dictCtx in LZ4_stream_t_internal STG 1,272(0,13) ; spill * *** const BYTE* const dictionary = * *** dictDirective == usingDictCtx ? dictCtx->dictionary : \ * cctx->dictionary; CHI 9,3 BNE @L82 LGHI 1,16392 ; 16392 LG 2,272(0,13) ; spill LG 10,0(1,2) ; offset of dictionary in LZ4_stream_t_inter* nal B @L83 DS 0D @FRAMESIZE_474 DC F'352' @lit_region_diff_474_1_3 DC A(@REGION_474_3-@REGION_474_1) @lit_474_97 DC AD(@DATA) @lit_region_diff_474_1_2 DC A(@REGION_474_2-@REGION_474_1) @lit_474_107 DC AD($L$Z4_put$Position) @lit_474_108 DC AD($L$Z4_hash$Position) @lit_474_112 DC AD($L$Z4_get$Position$On$Hash) @lit_474_114 DC AD($L$Z4_put$Position$On$Hash) @lit_474_170 DC AD($L$Z4_read32) @lit_474_120 DC AD($L$Z4_get$Index$On$Hash) @lit_474_124 DC AD($L$Z4_put$Index$On$Hash) @lit_474_131 DC F'-2139062143' 0x80808081 @L82 DS 0H LGHI 1,16392 ; 16392 LG 10,0(1,6) ; offset of dictionary in LZ4_stream_t_inter* nal @L83 DS 0H * *** const U32 dictSize = * *** dictDirective == usingDictCtx ? dictCtx->dictSize : cc\ * tx->dictSize; CHI 9,3 BNE @L84 LGHI 1,16408 ; 16408 LG 2,272(0,13) ; spill L 4,0(1,2) ; offset of dictSize in LZ4_stream_t_interna* l B @L85 @L84 DS 0H LGHI 1,16408 ; 16408 L 4,0(1,6) ; offset of dictSize in LZ4_stream_t_interna* l @L85 DS 0H * *** const U32 dictDelta = (dictDirective == usingDictCtx) ? st\ * artIndex - dictCtx->currentOffset : 0; CHI 9,3 BNE @L86 L 1,268(0,13) ; spill LG 2,272(0,13) ; spill SL 1,0(11,2) B @L87 @L86 DS 0H LHI 1,0 ; 0 @L87 DS 0H ST 1,344(0,13) ; spill * *** * *** int const maybe_extMem = (dictDirective == usingExtDict) |\ * | (dictDirective == usingDictCtx); CHI 9,2 BE @L88 CHI 9,3 BNE @L90 @L88 DS 0H LHI 1,1 ; 1 B @L89 @L90 DS 0H LHI 1,0 ; 0 @L89 DS 0H ST 1,300(0,13) ; spill * *** U32 const prefixIdxLimit = startIndex - dictSize; L 1,268(0,13) ; spill SLR 1,4 ST 1,324(0,13) ; spill * *** const BYTE* const dictEnd = dictionary ? dictionary + dict\ * Size : dictionary; LTGR 1,10 BZ @L91 LLGFR 1,4 LA 1,0(1,10) B @L92 @L91 DS 0H LGR 1,10 @L92 DS 0H STG 1,328(0,13) ; spill * *** const BYTE* anchor = (const BYTE*) source; LG 1,244(0,13) ; spill STG 1,236(0,13) ; spill * *** const BYTE* const iend = ip + inputSize; LGFR 1,15 LA 1,0(1,3) STG 1,336(0,13) ; spill * *** const BYTE* const mflimitPlusOne = iend - 12 + 1; LGHI 2,-12 ; -12 LA 2,1(2,1) STG 2,304(0,13) ; spill * *** const BYTE* const matchlimit = iend - 5; LGHI 2,-5 ; -5 LA 1,0(2,1) STG 1,292(0,13) ; spill * *** * *** * *** * *** const BYTE* dictBase = !dictionary ? ((void *)0) : (dictDi\ * rective == usingDictCtx) ? LTGR 1,10 BNZ @L93 LGHI 1,0 ; 0 B @L96 @L93 DS 0H CHI 9,3 BNE @L94 * *** dictionary + dictSize - dictCtx->c\ * urrentOffset : LLGFR 1,4 LA 1,0(1,10) LG 2,272(0,13) ; spill LLGF 2,0(11,2) SGR 1,2 B @L95 @L94 DS 0H * *** dictionary + dictSize - startIndex\ * ; LLGFR 1,4 LA 1,0(1,10) LLGF 2,268(0,13) ; spill SGR 1,2 @L95 DS 0H @L96 DS 0H STG 1,280(0,13) ; spill * *** * *** BYTE* op = (BYTE*) dest; LG 2,16(0,7) ; dest * *** BYTE* const olimit = op + maxOutputSize; LGF 1,44(0,7) ; maxOutputSize LA 1,0(1,2) STG 1,252(0,13) ; spill * *** * *** U32 offset = 0; LHI 0,0 ; 0 ST 0,312(0,13) ; spill * *** U32 forwardH; * *** * *** {}; * *** ((void)0); * *** * *** * *** if (outputDirective == fillOutput && maxOutputSize < 1) { \ * return 0; } L 1,232(0,13) ; spill CHI 1,2 BNE @L97 CHSI 44(7),1 BNL @L97 LGHI 15,0 ; 0 ALGF 12,@lit_region_diff_474_1_3 DROP 12 USING @REGION_474_3,12 B @ret_lab_474 DROP 12 USING @REGION_474_1,12 @L97 DS 0H * *** if ((tableType == byU16) && (inputSize>=LZ4_64Klimit)) { r\ * eturn 0; } CHI 5,3 BNE @L98 LG 1,@lit_474_97 C 15,196(0,1) BL @L98 LGHI 15,0 ; 0 ALGF 12,@lit_region_diff_474_1_3 DROP 12 USING @REGION_474_3,12 B @ret_lab_474 DROP 12 USING @REGION_474_1,12 @L98 DS 0H * *** if (tableType==byPtr) ((void)0); CHI 5,1 @L99 DS 0H * *** ((void)0); * *** * *** lowLimit = (const BYTE*)source - (dictDirective == withPre\ * fix64k ? dictSize : 0); LG 1,244(0,13) ; spill CHI 9,1 BNE @L100 B @L101 @L100 DS 0H LR 4,0 @L101 DS 0H LLGFR 4,4 SGR 1,4 STG 1,224(0,13) ; spill * *** * *** * *** if (dictDirective == usingDictCtx) { CHI 9,3 BNE @L102 * *** * *** * *** cctx->dictCtx = ((void *)0); LGHI 1,0 ; 0 STG 1,0(14,6) ; offset of dictCtx in LZ4_stream_t_internal * *** cctx->dictSize = (U32)inputSize; LGHI 1,16408 ; 16408 ST 15,0(1,6) ; offset of dictSize in LZ4_stream_t_interna* l * *** } else { B @L103 @L102 DS 0H * *** cctx->dictSize += (U32)inputSize; LGHI 4,16408 ; 16408 LR 1,15 AL 1,0(4,6) ST 1,0(4,6) * *** } @L103 DS 0H * *** cctx->currentOffset += (U32)inputSize; LR 1,15 AL 1,0(11,6) ST 1,0(11,6) * *** cctx->tableType = (U32)tableType; LGHI 1,16388 ; 16388 ST 5,0(1,6) ; offset of tableType in LZ4_stream_t_intern* al * *** * *** if (inputSize<LZ4_minLength) goto _last_literals; LG 1,@lit_474_97 C 15,0(0,1) BNL *+14 Around region break ALGF 12,@lit_region_diff_474_1_2 DROP 12 USING @REGION_474_2,12 B @__last_literals@474@0 DROP 12 USING @REGION_474_1,12 @L104 DS 0H * *** * *** * *** LZ4_putPosition(ip, cctx->hashTable, tableType, base); STG 3,176(0,13) STG 6,184(0,13) LGFR 15,5 STG 15,192(0,13) STG 8,200(0,13) LA 1,176(0,13) LG 15,@lit_474_107 ; LZ4_putPosition @@gen_label104 DS 0H BALR 14,15 @@gen_label105 DS 0H * *** ip++; forwardH = LZ4_hashPosition(ip, tableType); LA 3,1(0,3) STG 3,176(0,13) LGFR 15,5 STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_474_108 ; LZ4_hashPosition @@gen_label106 DS 0H BALR 14,15 @@gen_label107 DS 0H ST 15,216(0,13) ; spill * *** * *** * *** for ( ; ; ) { @L105 DS 0H * *** const BYTE* match; * *** BYTE* token; * *** const BYTE* filledIp; * *** * *** * *** if (tableType == byPtr) { CHI 5,1 BNE @L108 * *** const BYTE* forwardIp = ip; LGR 11,3 ; forwardIp * *** int step = 1; LHI 15,1 ; 1 ST 15,260(0,13) ; spill * *** int searchMatchNb = acceleration << LZ4_skipTrigge\ * r; L 15,84(0,7) ; acceleration LG 1,@lit_474_97 L 1,200(0,1) ; LZ4_skipTrigger SLL 15,0(1) ST 15,220(0,13) ; spill * *** do { @L109 DS 0H * *** U32 const h = forwardH; L 15,216(0,13) ; spill ST 15,264(0,13) ; spill * *** ip = forwardIp; LGR 3,11 ; ip * *** forwardIp += step; L 15,260(0,13) ; spill LGFR 15,15 LA 11,0(15,11) * *** step = (searchMatchNb++ >> LZ4_skipTrigger); L 1,220(0,13) ; spill LR 15,1 AHI 15,1 ST 15,220(0,13) ; spill LG 15,@lit_474_97 L 15,200(0,15) ; LZ4_skipTrigger SRA 1,0(15) ST 1,260(0,13) ; spill * *** * *** if (((forwardIp > mflimitPlusOne) != 0)) goto \ * _last_literals; LG 15,304(0,13) ; spill CGR 11,15 BNH @@gen_label109 LHI 15,1 B @@gen_label110 @@gen_label109 DS 0H LHI 15,0 @@gen_label110 DS 0H LTR 15,15 BE *+14 Around region break ALGF 12,@lit_region_diff_474_1_2 DROP 12 USING @REGION_474_2,12 B @__last_literals@474@0 DROP 12 USING @REGION_474_1,12 @L112 DS 0H * *** ((void)0); * *** * *** match = LZ4_getPositionOnHash(h, cctx->hashTab\ * le, tableType, base); LLGF 15,264(0,13) ; spill STG 15,176(0,13) STG 6,184(0,13) LGFR 15,5 STG 15,192(0,13) STG 8,200(0,13) LA 1,176(0,13) LG 15,@lit_474_112 ; LZ4_getPositionOnHash @@gen_label112 DS 0H BALR 14,15 @@gen_label113 DS 0H LGR 4,15 ; match * *** forwardH = LZ4_hashPosition(forwardIp, tableTy\ * pe); STG 11,176(0,13) LGFR 15,5 STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_474_108 ; LZ4_hashPosition @@gen_label114 DS 0H BALR 14,15 @@gen_label115 DS 0H ST 15,216(0,13) ; spill * *** LZ4_putPositionOnHash(ip, h, cctx->hashTable, \ * tableType, base); STG 3,176(0,13) LLGF 15,264(0,13) ; spill STG 15,184(0,13) STG 6,192(0,13) LGFR 15,5 STG 15,200(0,13) STG 8,208(0,13) LA 1,176(0,13) LG 15,@lit_474_114 ; LZ4_putPositionOnHash @@gen_label116 DS 0H BALR 14,15 @@gen_label117 DS 0H * *** * *** } while ( (match+65535 < ip) * *** || (LZ4_read32(match) != LZ4_read32(ip)) ); LLILF 15,X'0000FFFF' ; 65535 LA 15,0(15,4) CGR 15,3 BL @L109 STG 4,176(0,13) LA 1,176(0,13) LG 15,@lit_474_170 ; LZ4_read32 @@gen_label119 DS 0H BALR 14,15 @@gen_label120 DS 0H ST 15,264(0,13) ; spill STG 3,176(0,13) LA 1,176(0,13) LG 15,@lit_474_170 ; LZ4_read32 @@gen_label121 DS 0H BALR 14,15 @@gen_label122 DS 0H L 1,264(0,13) ; spill CLR 1,15 BE @L114 B @L109 @L113 DS 0H * *** * *** } else { @L108 DS 0H * *** * *** const BYTE* forwardIp = ip; STG 3,260(0,13) ; spill * *** int step = 1; LHI 15,1 ; 1 ST 15,316(0,13) ; spill * *** int searchMatchNb = acceleration << LZ4_skipTrigge\ * r; L 15,84(0,7) ; acceleration LG 1,@lit_474_97 L 1,200(0,1) ; LZ4_skipTrigger SLL 15,0(1) ST 15,220(0,13) ; spill * *** do { @L115 DS 0H * *** U32 const h = forwardH; L 15,216(0,13) ; spill ST 15,320(0,13) ; spill * *** U32 const current = (U32)(forwardIp - base); LG 15,260(0,13) ; spill SGR 15,8 ST 15,288(0,13) ; spill * *** U32 matchIndex = LZ4_getIndexOnHash(h, cctx->h\ * ashTable, tableType); LLGF 15,216(0,13) ; spill STG 15,176(0,13) STG 6,184(0,13) LGFR 15,5 STG 15,192(0,13) LA 1,176(0,13) LG 4,@lit_474_120 ; LZ4_getIndexOnHash LGR 15,4 @@gen_label124 DS 0H BALR 14,15 @@gen_label125 DS 0H LR 11,15 ; matchIndex * *** ((void)0); * *** ((void)0); * *** ip = forwardIp; * *** forwardIp += step; L 15,316(0,13) ; spill LGFR 15,15 LG 3,260(0,13) ; spill LA 14,0(15,3) STG 14,260(0,13) ; spill * *** step = (searchMatchNb++ >> LZ4_skipTrigger); L 1,220(0,13) ; spill LR 15,1 AHI 15,1 ST 15,220(0,13) ; spill LG 15,@lit_474_97 L 15,200(0,15) ; LZ4_skipTrigger SRA 1,0(15) ST 1,316(0,13) ; spill * *** * *** if (((forwardIp > mflimitPlusOne) != 0)) goto \ * _last_literals; LG 15,304(0,13) ; spill CGR 14,15 BNH @@gen_label126 LHI 15,1 B @@gen_label127 @@gen_label126 DS 0H LHI 15,0 @@gen_label127 DS 0H LTR 15,15 BE *+14 Around region break ALGF 12,@lit_region_diff_474_1_2 DROP 12 USING @REGION_474_2,12 B @__last_literals@474@0 DROP 12 USING @REGION_474_1,12 @L118 DS 0H * *** ((void)0); * *** * *** if (dictDirective == usingDictCtx) { CHI 9,3 BNE @L119 * *** if (matchIndex < startIndex) { L 1,268(0,13) ; spill CLR 11,1 BNL @L120 * *** * *** ((void)0); * *** matchIndex = LZ4_getIndexOnHash(h, dic\ * tCtx->hashTable, byU32); LLGF 15,320(0,13) ; spill STG 15,176(0,13) LG 1,272(0,13) ; spill STG 1,184(0,13) MVGHI 192(13),2 LA 1,176(0,13) LGR 15,4 @@gen_label131 DS 0H BALR 14,15 @@gen_label132 DS 0H LR 11,15 * *** match = dictBase + matchIndex; LLGFR 15,11 LG 1,280(0,13) ; spill LA 4,0(15,1) * *** matchIndex += dictDelta; L 1,344(0,13) ; spill ALR 11,1 * *** lowLimit = dictionary; STG 10,224(0,13) ; spill * *** } else { B @L122 @L120 DS 0H * *** match = base + matchIndex; LLGFR 15,11 LA 4,0(15,8) * *** lowLimit = (const BYTE*)source; LG 1,244(0,13) ; spill STG 1,224(0,13) ; spill * *** } @L121 DS 0H * *** } else if (dictDirective==usingExtDict) { B @L122 @L119 DS 0H CHI 9,2 BNE @L123 * *** if (matchIndex < startIndex) { L 1,268(0,13) ; spill CLR 11,1 BNL @L124 * *** {}; * *** ((void)0); * *** match = dictBase + matchIndex; LLGFR 15,11 LG 1,280(0,13) ; spill LA 4,0(15,1) * *** lowLimit = dictionary; STG 10,224(0,13) ; spill * *** } else { B @L122 @L124 DS 0H * *** match = base + matchIndex; LLGFR 15,11 LA 4,0(15,8) * *** lowLimit = (const BYTE*)source; LG 1,244(0,13) ; spill STG 1,224(0,13) ; spill * *** } @L125 DS 0H * *** } else { B @L122 @L123 DS 0H * *** match = base + matchIndex; LLGFR 15,11 LA 4,0(15,8) * *** } @L126 DS 0H * *** forwardH = LZ4_hashPosition(forwardIp, tableTy\ * pe); @L122 DS 0H LG 15,260(0,13) ; spill STG 15,176(0,13) LGFR 15,5 STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_474_108 ; LZ4_hashPosition @@gen_label135 DS 0H BALR 14,15 @@gen_label136 DS 0H ST 15,216(0,13) ; spill * *** LZ4_putIndexOnHash(current, h, cctx->hashTable\ * , tableType); LLGF 15,288(0,13) ; spill STG 15,176(0,13) LLGF 15,320(0,13) ; spill STG 15,184(0,13) STG 6,192(0,13) LGFR 15,5 STG 15,200(0,13) LA 1,176(0,13) LG 15,@lit_474_124 ; LZ4_putIndexOnHash @@gen_label137 DS 0H BALR 14,15 @@gen_label138 DS 0H * *** * *** {}; * *** if ((dictIssue == dictSmall) && (matchIndex < \ * prefixIdxLimit)) { continue; } CHSI 76(7),1 BNE @L127 L 1,324(0,13) ; spill CLR 11,1 BL @L115 @L127 DS 0H * *** ((void)0); * *** if ( ((tableType != byU16) || (65535 < 65535)) * *** && (matchIndex+65535 < current)) { CHI 5,3 BE @L128 LR 15,11 AFI 15,X'0000FFFF' L 1,288(0,13) ; spill CLR 15,1 BNL @L128 * *** continue; B @L115 * *** } @L128 DS 0H * *** ((void)0); * *** * *** if (LZ4_read32(match) == LZ4_read32(ip)) { STG 4,176(0,13) LA 1,176(0,13) LG 15,@lit_474_170 ; LZ4_read32 @@gen_label143 DS 0H BALR 14,15 @@gen_label144 DS 0H ST 15,320(0,13) ; spill STG 3,176(0,13) LA 1,176(0,13) LG 15,@lit_474_170 ; LZ4_read32 @@gen_label145 DS 0H BALR 14,15 @@gen_label146 DS 0H L 1,320(0,13) ; spill CLR 1,15 BNE @L129 * *** if (maybe_extMem) offset = current - match\ * Index; LT 1,300(0,13) ; spill BZ @L116 L 15,288(0,13) ; spill SLR 15,11 ST 15,312(0,13) ; spill @L130 DS 0H * *** break; B @L116 * *** } @L129 DS 0H * *** * *** } while(1); @L117 DS 0H B @L115 @L116 DS 0H * *** } @L114 DS 0H * *** * *** * *** filledIp = ip; STG 3,316(0,13) ; spill * *** while (((ip>anchor) & (match > lowLimit)) && (((ip[-1]\ * ==match[-1]) != 0))) { ip--; match--; } B @L134 @L133 DS 0H LGHI 15,-1 ; -1 LA 3,0(15,3) LA 4,0(15,4) @L134 DS 0H LG 1,236(0,13) ; spill CGR 3,1 BNH @@gen_label149 LHI 15,1 B @@gen_label150 @@gen_label149 DS 0H LHI 15,0 @@gen_label150 DS 0H LG 1,224(0,13) ; spill CGR 4,1 BNH @@gen_label151 LHI 1,1 B @@gen_label152 @@gen_label151 DS 0H LHI 1,0 @@gen_label152 DS 0H NR 15,1 BZ @L135 LGHI 15,-1 ; -1 LLC 1,0(15,3) LLC 15,0(15,4) XR 1,15 LPR 15,1 AHI 15,-1 SRL 15,31(0) LTR 15,15 BNE @L133 @L135 DS 0H * *** * *** * *** { unsigned const litLength = (unsigned)(ip - anchor)\ * ; LGR 11,3 LG 1,236(0,13) ; spill SGR 11,1 * *** token = op++; LGR 15,2 LA 2,1(0,2) STG 15,216(0,13) ; spill * *** if ((outputDirective == limitedOutput) && L 1,232(0,13) ; spill CHI 1,1 BNE @L136 * *** (((op + litLength + (2 + 1 + 5) + (litLength/2\ * 55) > olimit) != 0)) ) { LLGFR 1,11 LR 15,11 ; . ML 14,@lit_474_131 ; . SRL 14,7(0) ; . LLGFR 15,14 LA 15,0(1,15) LA 15,8(15,2) LG 1,252(0,13) ; spill CGR 15,1 BNH @@gen_label156 LHI 15,1 B @@gen_label157 @@gen_label156 DS 0H LHI 15,0 @@gen_label157 DS 0H LTR 15,15 BE @L136 * *** return 0; LGHI 15,0 ; 0 ALGF 12,@lit_region_diff_474_1_3 DROP 12 USING @REGION_474_3,12 B @ret_lab_474 DROP 12 USING @REGION_474_1,12 * *** } @L136 DS 0H * *** if ((outputDirective == fillOutput) && L 1,232(0,13) ; spill CHI 1,2 BE *+14 Around region break ALGF 12,@lit_region_diff_474_1_2 DROP 12 USING @REGION_474_2,12 B @L137 DROP 12 USING @REGION_474_1,12 ALGF 12,@lit_region_diff_474_1_2 @REGION_474_2 DS 0H DROP 12 USING @REGION_474_2,12 * *** (((op + (litLength+240)/255 + litLength + 2 + \ * 1 + 12 - 4 > olimit) != 0))) { LR 15,11 AHI 15,240 ML 14,@lit_474_133 ; . SRL 14,7(0) ; . LLGFR 15,14 LLGFR 1,11 LA 15,0(15,1) LA 15,11(15,2) LG 1,252(0,13) ; spill CGR 15,1 BNH @@gen_label160 LHI 15,1 B @@gen_label161 DS 0D @lit_474_133 DC F'-2139062143' 0x80808081 @lit_474_135 DC AD($L$Z4_wild$Copy8) @lit_474_136 DC AD($L$Z4_write$L$E16) @lit_474_174 DC AD($L$Z4_count) @lit_474_142 DC AD($L$Z4_hash$Position) @lit_474_143 DC AD($L$Z4_clear$Hash) @lit_region_diff_474_2_3 DC A(@REGION_474_3-@REGION_474_2) @lit_474_146 DC AD($L$Z4_write32) @lit_474_150 DC F'255' 0x000000ff @lit_474_152 DC AD($L$Z4_put$Position) @lit_474_153 DC AD($L$Z4_get$Position) @lit_474_156 DC AD($L$Z4_read32) @lit_474_159 DC AD($L$Z4_get$Index$On$Hash) @lit_474_161 DC AD($L$Z4_put$Index$On$Hash) @lit_region_diff_474_2_1 DC A(@REGION_474_2-@REGION_474_1) @lit_474_167 DC FD'255' 0x00000000000000ff @@gen_label160 DS 0H LHI 15,0 @@gen_label161 DS 0H LTR 15,15 BE @L137 * *** op--; LGHI 15,-1 ; -1 LA 2,0(15,2) * *** goto _last_literals; B @__last_literals@474@0 * *** } @L137 DS 0H * *** if (litLength >= ((1U<<(8-4))-1)) { CLFI 11,X'0000000F' BL @L138 * *** int len = (int)(litLength - ((1U<<(8-4))-1)); LR 15,11 AHI 15,-15 * *** *token = (((1U<<(8-4))-1)<<4); LG 1,216(0,13) ; spill MVI 0(1),240 ; token * *** for(; len >= 255 ; len-=255) *op++ = 255; B @L140 @L139 DS 0H LGR 1,2 LA 2,1(0,2) MVI 0(1),255 AHI 15,-255 @L140 DS 0H CHI 15,255 BNL @L139 * *** *op++ = (BYTE)len; LGR 1,2 LA 2,1(0,2) STC 15,0(0,1) * *** } B @L143 * *** else *token = (BYTE)(litLength<<4); @L138 DS 0H LR 15,11 SLL 15,4(0) LG 1,216(0,13) ; spill STC 15,0(0,1) ; token @L143 DS 0H * *** * *** * *** LZ4_wildCopy8(op, anchor, op+litLength); STG 2,176(0,13) LG 1,236(0,13) ; spill STG 1,184(0,13) LLGFR 15,11 LA 15,0(15,2) STG 15,192(0,13) LA 1,176(0,13) LG 15,@lit_474_135 ; LZ4_wildCopy8 @@gen_label165 DS 0H BALR 14,15 @@gen_label166 DS 0H * *** op+=litLength; LLGFR 15,11 LA 2,0(15,2) * *** {}; * *** * *** } * *** * *** _next_match: * *** * *** * *** # 1060 "C:\asgkafka\librdkafka\src\lz4.c" * *** if ((outputDirective == fillOutput) && @__next_match@474@1 DS 0H L 1,232(0,13) ; spill CHI 1,2 BNE @L144 * *** (op + 2 + 1 + 12 - 4 > olimit)) { LA 15,11(0,2) LG 1,252(0,13) ; spill CGR 15,1 BNH @L144 * *** * *** op = token; LG 2,216(0,13) ; spill * *** goto _last_literals; B @__last_literals@474@0 * *** } @L144 DS 0H * *** * *** * *** if (maybe_extMem) { LT 1,300(0,13) ; spill BZ @L145 * *** {}; * *** ((void)0); * *** LZ4_writeLE16(op, (U16)offset); op+=2; STG 2,176(0,13) L 0,312(0,13) ; spill LLGHR 15,0 STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_474_136 ; LZ4_writeLE16 @@gen_label170 DS 0H BALR 14,15 @@gen_label171 DS 0H LA 2,2(0,2) * *** } else { B @L146 @L145 DS 0H * *** {}; * *** ((void)0); * *** LZ4_writeLE16(op, (U16)(ip - match)); op+=2; STG 2,176(0,13) LGR 15,3 SGR 15,4 LLGHR 15,15 STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_474_136 ; LZ4_writeLE16 @@gen_label172 DS 0H BALR 14,15 @@gen_label173 DS 0H LA 2,2(0,2) * *** } @L146 DS 0H * *** * *** * *** { unsigned matchCode; * *** * *** if ( (dictDirective==usingExtDict || dictDirective\ * ==usingDictCtx) CHI 9,2 BE @L147 CHI 9,3 BNE @L148 * *** && (lowLimit==dictionary) ) { @L147 DS 0H LG 1,224(0,13) ; spill CGR 1,10 BNE @L148 * *** const BYTE* limit = ip + (dictEnd-match); LG 15,328(0,13) ; spill SGR 15,4 LA 11,0(15,3) * *** ((void)0); * *** if (limit > matchlimit) limit = matchlimit; LG 1,292(0,13) ; spill CGR 11,1 BNH @L149 LG 11,292(0,13) ; spill @L149 DS 0H * *** matchCode = LZ4_count(ip+4, match+4, limit); LA 15,4(0,3) STG 15,176(0,13) LA 15,4(0,4) STG 15,184(0,13) STG 11,192(0,13) LA 1,176(0,13) LG 15,@lit_474_174 ; LZ4_count @@gen_label178 DS 0H BALR 14,15 @@gen_label179 DS 0H LR 4,15 ; matchCode * *** ip += (size_t)matchCode + 4; LLGFR 15,15 AGHI 15,4 LA 3,0(15,3) * *** if (ip==limit) { CGR 3,11 BNE @L151 * *** unsigned const more = LZ4_count(limit, (co\ * nst BYTE*)source, matchlimit); STG 11,176(0,13) LG 1,244(0,13) ; spill STG 1,184(0,13) LG 1,292(0,13) ; spill STG 1,192(0,13) LA 1,176(0,13) LG 15,@lit_474_174 ; LZ4_count @@gen_label181 DS 0H BALR 14,15 @@gen_label182 DS 0H * *** matchCode += more; ALR 4,15 * *** ip += more; LLGFR 15,15 LA 3,0(15,3) * *** } @L150 DS 0H * *** {}; * *** } else { B @L151 @L148 DS 0H * *** matchCode = LZ4_count(ip+4, match+4, matchlimi\ * t); LA 15,4(0,3) STG 15,176(0,13) LA 15,4(0,4) STG 15,184(0,13) LG 1,292(0,13) ; spill STG 1,192(0,13) LA 1,176(0,13) LG 15,@lit_474_174 ; LZ4_count @@gen_label183 DS 0H BALR 14,15 @@gen_label184 DS 0H LR 4,15 ; matchCode * *** ip += (size_t)matchCode + 4; LLGFR 15,15 AGHI 15,4 LA 3,0(15,3) * *** {}; * *** } @L151 DS 0H * *** * *** if ((outputDirective) && LT 1,232(0,13) ; spill BZ @L152 * *** (((op + (1 + 5) + (matchCode+240)/255 > olimit\ * ) != 0)) ) { LR 15,4 AHI 15,240 ML 14,@lit_474_133 ; . SRL 14,7(0) ; . LLGFR 15,14 LA 15,6(15,2) LG 1,252(0,13) ; spill CGR 15,1 BNH @@gen_label186 LHI 15,1 B @@gen_label187 @@gen_label186 DS 0H LHI 15,0 @@gen_label187 DS 0H LTR 15,15 BE @L152 * *** if (outputDirective == fillOutput) { L 1,232(0,13) ; spill CHI 1,2 BNE @L153 * *** * *** U32 newMatchCode = 15 - 1 + ((U32)(olimi\ * t - op) - 1 - 5) * 255; LG 15,252(0,13) ; spill SGR 15,2 AHI 15,-1 AHI 15,-5 LR 1,15 ; *0xff SLL 1,8(0) ; . SLR 1,15 ; . AHI 1,14 * *** ip -= matchCode - newMatchCode; SLR 4,1 LLGFR 15,4 SGR 3,15 * *** ((void)0); * *** matchCode = newMatchCode; LR 4,1 ; matchCode * *** if (((ip <= filledIp) != 0)) { LG 15,316(0,13) ; spill CGR 3,15 BH @@gen_label190 LHI 15,1 B @@gen_label191 @@gen_label190 DS 0H LHI 15,0 @@gen_label191 DS 0H LTR 15,15 BE @L152 * *** * *** * *** * *** * *** * *** const BYTE* ptr; * *** {}; * *** for (ptr = ip; ptr <= filledIp; ++ptr)\ * { LGR 11,3 B @L156 @L155 DS 0H * *** U32 const h = LZ4_hashPosition(ptr\ * , tableType); STG 11,176(0,13) LGFR 15,5 STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_474_142 ; LZ4_hashPosition @@gen_label193 DS 0H BALR 14,15 @@gen_label194 DS 0H * *** LZ4_clearHash(h, cctx->hashTable, \ * tableType); LLGFR 15,15 STG 15,176(0,13) STG 6,184(0,13) LGFR 15,5 STG 15,192(0,13) LA 1,176(0,13) LG 15,@lit_474_143 ; LZ4_clearHash @@gen_label195 DS 0H BALR 14,15 @@gen_label196 DS 0H * *** } LA 11,1(0,11) @L156 DS 0H LG 15,316(0,13) ; spill CGR 11,15 BNH @L155 * *** } @L154 DS 0H * *** } else { B @L152 @L153 DS 0H * *** ((void)0); * *** return 0; LGHI 15,0 ; 0 ALGF 12,@lit_region_diff_474_2_3 DROP 12 USING @REGION_474_3,12 B @ret_lab_474 DROP 12 USING @REGION_474_2,12 * *** } * *** } @L152 DS 0H * *** if (matchCode >= ((1U<<4)-1)) { CLFI 4,X'0000000F' BL @L160 * *** *token += ((1U<<4)-1); LG 1,216(0,13) ; spill LLC 15,0(0,1) AHI 15,15 LG 1,216(0,13) ; spill STC 15,0(0,1) * *** matchCode -= ((1U<<4)-1); AHI 4,-15 * *** LZ4_write32(op, 0xFFFFFFFF); STG 2,176(0,13) LLILF 15,X'FFFFFFFF' ; 4294967295 STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_474_146 ; LZ4_write32 @@gen_label199 DS 0H BALR 14,15 @@gen_label200 DS 0H * *** while (matchCode >= 4*255) { B @L164 @L163 DS 0H * *** op+=4; LA 2,4(0,2) * *** LZ4_write32(op, 0xFFFFFFFF); STG 2,176(0,13) LLILF 15,X'FFFFFFFF' ; 4294967295 STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_474_146 ; LZ4_write32 @@gen_label201 DS 0H BALR 14,15 @@gen_label202 DS 0H * *** matchCode -= 4*255; AHI 4,-1020 * *** } @L164 DS 0H CLFI 4,X'000003FC' BNL @L163 * *** op += matchCode / 255; LR 15,4 ; . ML 14,@lit_474_133 ; . SRL 14,7(0) ; . LLGFR 15,14 LA 15,0(15,2) * *** *op++ = (BYTE)(matchCode % 255); LA 2,1(0,15) LHI 0,0 LR 1,4 DL 0,@lit_474_150 STC 0,0(0,15) * *** } else B @L165 @L160 DS 0H * *** *token += (BYTE)(matchCode); LG 1,216(0,13) ; spill LLC 15,0(0,1) NILF 4,X'000000FF' AR 15,4 LG 1,216(0,13) ; spill STC 15,0(0,1) @L165 DS 0H * *** } * *** * *** ((void)0); * *** * *** anchor = ip; STG 3,236(0,13) ; spill * *** * *** * *** if (ip >= mflimitPlusOne) break; LG 15,304(0,13) ; spill CGR 3,15 BNL @__last_literals@474@0 @L166 DS 0H * *** * *** * *** LZ4_putPosition(ip-2, cctx->hashTable, tableType, base\ * ); LGHI 15,-2 ; -2 LA 15,0(15,3) STG 15,176(0,13) STG 6,184(0,13) LGFR 15,5 STG 15,192(0,13) STG 8,200(0,13) LA 1,176(0,13) LG 11,@lit_474_152 ; LZ4_putPosition LGR 15,11 @@gen_label205 DS 0H BALR 14,15 @@gen_label206 DS 0H * *** * *** * *** if (tableType == byPtr) { CHI 5,1 BNE @L167 * *** * *** match = LZ4_getPosition(ip, cctx->hashTable, table\ * Type, base); STG 3,176(0,13) STG 6,184(0,13) LGFR 15,5 STG 15,192(0,13) STG 8,200(0,13) LA 1,176(0,13) LG 15,@lit_474_153 ; LZ4_getPosition @@gen_label208 DS 0H BALR 14,15 @@gen_label209 DS 0H LGR 4,15 ; match * *** LZ4_putPosition(ip, cctx->hashTable, tableType, ba\ * se); STG 3,176(0,13) STG 6,184(0,13) LGFR 15,5 STG 15,192(0,13) STG 8,200(0,13) LA 1,176(0,13) LGR 15,11 @@gen_label210 DS 0H BALR 14,15 @@gen_label211 DS 0H * *** if ( (match+65535 >= ip) * *** && (LZ4_read32(match) == LZ4_read32(ip)) ) LLILF 15,X'0000FFFF' ; 65535 LA 15,0(15,4) CGR 15,3 BL @L169 STG 4,176(0,13) LA 1,176(0,13) LG 11,@lit_474_156 ; LZ4_read32 LGR 15,11 @@gen_label213 DS 0H BALR 14,15 @@gen_label214 DS 0H ST 15,216(0,13) ; spill STG 3,176(0,13) LA 1,176(0,13) LGR 15,11 @@gen_label215 DS 0H BALR 14,15 @@gen_label216 DS 0H L 1,216(0,13) ; spill CLR 1,15 BNE @L169 * *** { token=op++; *token=0; goto _next_match; } LGR 15,2 LA 2,1(0,2) STG 15,216(0,13) ; spill MVI 0(15),0 ; token B @__next_match@474@1 * *** * *** } else { @L167 DS 0H * *** * *** U32 const h = LZ4_hashPosition(ip, tableType); STG 3,176(0,13) LGFR 15,5 STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_474_142 ; LZ4_hashPosition @@gen_label218 DS 0H BALR 14,15 @@gen_label219 DS 0H ST 15,216(0,13) ; spill * *** U32 const current = (U32)(ip-base); LGR 1,3 SGR 1,8 ST 1,260(0,13) ; spill * *** U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashT\ * able, tableType); LLGFR 15,15 STG 15,176(0,13) STG 6,184(0,13) LGFR 15,5 STG 15,192(0,13) LA 1,176(0,13) LG 4,@lit_474_159 ; LZ4_getIndexOnHash LGR 15,4 @@gen_label220 DS 0H BALR 14,15 @@gen_label221 DS 0H LR 11,15 * *** ((void)0); * *** if (dictDirective == usingDictCtx) { CHI 9,3 BNE @L170 * *** if (matchIndex < startIndex) { L 1,268(0,13) ; spill CLR 11,1 BNL @L171 * *** * *** matchIndex = LZ4_getIndexOnHash(h, dictCtx\ * ->hashTable, byU32); LLGF 15,216(0,13) ; spill STG 15,176(0,13) LG 1,272(0,13) ; spill STG 1,184(0,13) MVGHI 192(13),2 LA 1,176(0,13) LGR 15,4 @@gen_label224 DS 0H BALR 14,15 @@gen_label225 DS 0H LR 1,15 * *** match = dictBase + matchIndex; LLGFR 15,1 LG 4,280(0,13) ; spill LA 4,0(15,4) * *** lowLimit = dictionary; STG 10,224(0,13) ; spill * *** matchIndex += dictDelta; LR 15,1 L 1,344(0,13) ; spill ALR 15,1 LR 11,15 * *** } else { B @L173 @L171 DS 0H * *** match = base + matchIndex; LLGFR 15,11 LA 4,0(15,8) * *** lowLimit = (const BYTE*)source; LG 1,244(0,13) ; spill STG 1,224(0,13) ; spill * *** } @L172 DS 0H * *** } else if (dictDirective==usingExtDict) { B @L173 @L170 DS 0H CHI 9,2 BNE @L174 * *** if (matchIndex < startIndex) { L 1,268(0,13) ; spill CLR 11,1 BNL @L175 * *** match = dictBase + matchIndex; LLGFR 15,11 LG 1,280(0,13) ; spill LA 4,0(15,1) * *** lowLimit = dictionary; STG 10,224(0,13) ; spill * *** } else { B @L173 @L175 DS 0H * *** match = base + matchIndex; LLGFR 15,11 LA 4,0(15,8) * *** lowLimit = (const BYTE*)source; LG 1,244(0,13) ; spill STG 1,224(0,13) ; spill * *** } @L176 DS 0H * *** } else { B @L173 @L174 DS 0H * *** match = base + matchIndex; LLGFR 15,11 LA 4,0(15,8) * *** } @L177 DS 0H * *** LZ4_putIndexOnHash(current, h, cctx->hashTable, ta\ * bleType); @L173 DS 0H L 1,260(0,13) ; spill LLGFR 15,1 STG 15,176(0,13) LLGF 15,216(0,13) ; spill STG 15,184(0,13) STG 6,192(0,13) LGFR 15,5 STG 15,200(0,13) LA 1,176(0,13) LG 15,@lit_474_161 ; LZ4_putIndexOnHash @@gen_label228 DS 0H BALR 14,15 @@gen_label229 DS 0H * *** ((void)0); * *** if ( ((dictIssue==dictSmall) ? (matchIndex >= pref\ * ixIdxLimit) : 1) CHSI 76(7),1 BNE @L178 L 1,324(0,13) ; spill CLR 11,1 BL @@gen_label231 LHI 15,1 B @@gen_label232 @@gen_label231 DS 0H LHI 15,0 @@gen_label232 DS 0H B @L179 @L178 DS 0H LHI 15,1 ; 1 @L179 DS 0H * *** && (((tableType==byU16) && (65535 == 65535)) ? 1\ * : (matchIndex+65535 >= current)) LTR 15,15 BZ @L182 CHI 5,3 BNE @L180 LHI 15,1 ; 1 B @L181 @L180 DS 0H LR 15,11 AFI 15,X'0000FFFF' L 1,260(0,13) ; spill CLR 15,1 BL @@gen_label235 LHI 15,1 B @@gen_label236 @@gen_label235 DS 0H LHI 15,0 @@gen_label236 DS 0H @L181 DS 0H * *** && (LZ4_read32(match) == LZ4_read32(ip)) ) { LTR 15,15 BZ @L182 STG 4,176(0,13) LA 1,176(0,13) LG 15,@lit_474_156 ; LZ4_read32 @@gen_label238 DS 0H BALR 14,15 @@gen_label239 DS 0H ST 15,216(0,13) ; spill STG 3,176(0,13) LA 1,176(0,13) LG 15,@lit_474_156 ; LZ4_read32 @@gen_label240 DS 0H BALR 14,15 @@gen_label241 DS 0H L 1,216(0,13) ; spill CLR 1,15 BNE @L182 * *** token=op++; LGR 15,2 LA 2,1(0,2) STG 15,216(0,13) ; spill * *** *token=0; MVI 0(15),0 ; token * *** if (maybe_extMem) offset = current - matchInde\ * x; LT 1,300(0,13) ; spill BZ @__next_match@474@1 L 1,260(0,13) ; spill SLR 1,11 ST 1,312(0,13) ; spill @L183 DS 0H * *** {}; * *** * *** goto _next_match; B @__next_match@474@1 * *** } @L182 DS 0H * *** } @L169 DS 0H * *** * *** * *** forwardH = LZ4_hashPosition(++ip, tableType); LGR 15,3 LA 3,1(0,3) LA 15,1(0,15) STG 15,176(0,13) LGFR 15,5 STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_474_142 ; LZ4_hashPosition @@gen_label244 DS 0H BALR 14,15 @@gen_label245 DS 0H ST 15,216(0,13) ; spill * *** * *** } SLGF 12,@lit_region_diff_474_2_1 DROP 12 USING @REGION_474_1,12 B @L105 DROP 12 USING @REGION_474_2,12 * *** * *** _last_literals: * *** * *** { size_t lastRun = (size_t)(iend - anchor); @__last_literals@474@0 DS 0H LG 1,336(0,13) ; spill LG 3,236(0,13) ; spill SGR 1,3 * *** if ( (outputDirective) && LT 15,232(0,13) ; spill BZ @L184 * *** (op + lastRun + 1 + ((lastRun+255-((1U<<(8-4))-1))\ * /255) > olimit)) { LGR 5,1 AGHI 5,255 AGHI 5,-15 LGHI 4,0 DLG 4,@lit_474_167 LA 15,0(1,5) LA 15,1(15,2) LG 3,252(0,13) ; spill CGR 15,3 BNH @L184 * *** if (outputDirective == fillOutput) { L 1,232(0,13) ; spill CHI 1,2 BNE @L185 * *** * *** ((void)0); * *** lastRun = (size_t)(olimit-op) - 1; LG 1,252(0,13) ; spill SGR 1,2 AGHI 1,-1 * *** lastRun -= (lastRun + 256 - ((1U<<(8-4))-1)) /\ * 256; LGR 15,1 AGHI 15,256 AGHI 15,-15 SRLG 15,15,8(0) ; /0x100 SLGR 1,15 * *** } else { B @L184 @L185 DS 0H * *** ((void)0); * *** return 0; LGHI 15,0 ; 0 ALGF 12,@lit_region_diff_474_2_3 DROP 12 USING @REGION_474_3,12 B @ret_lab_474 DROP 12 USING @REGION_474_2,12 * *** } * *** } @L184 DS 0H * *** {}; * *** if (lastRun >= ((1U<<(8-4))-1)) { CLGFI 1,X'0000000F' BL @L187 * *** size_t accumulator = lastRun - ((1U<<(8-4))-1); LGR 15,1 AGHI 15,-15 * *** *op++ = ((1U<<(8-4))-1) << 4; LGR 3,2 LA 2,1(0,2) MVI 0(3),240 * *** for(; accumulator >= 255 ; accumulator-=255) *op++\ * = 255; B @L189 @L188 DS 0H LGR 3,2 LA 2,1(0,2) MVI 0(3),255 AGHI 15,-255 @L189 DS 0H CLGFI 15,X'000000FF' BNL @L188 * *** *op++ = (BYTE) accumulator; LGR 3,2 LA 2,1(0,2) STC 15,0(0,3) * *** } else { B @L192 @L187 DS 0H * *** *op++ = (BYTE)(lastRun<<4); LGR 15,2 LA 2,1(0,2) SLLG 3,1,4(0) STC 3,0(0,15) * *** } @L192 DS 0H * *** __memcpy(op,anchor,lastRun); LG 3,236(0,13) ; spill LGR 4,2 LTGR 15,1 BNZ *+14 Around region break ALGF 12,@lit_region_diff_474_2_3 DROP 12 USING @REGION_474_3,12 B @@gen_label253 DROP 12 USING @REGION_474_2,12 ALGF 12,@lit_region_diff_474_2_3 @REGION_474_3 DS 0H DROP 12 USING @REGION_474_3,12 AGHI 15,-1 SRAG 5,15,8(0) LTGR 5,5 BZ @@gen_label252 @@gen_label251 DS 0H MVC 0(256,4),0(3) LA 4,256(0,4) LA 3,256(0,3) BCTG 5,@@gen_label251 @@gen_label252 DS 0H EX 15,@lit_474_169 @@gen_label253 DS 0H * *** ip = anchor + lastRun; LG 3,236(0,13) ; spill LA 3,0(1,3) * *** op += lastRun; LA 2,0(1,2) * *** } * *** * *** if (outputDirective == fillOutput) { L 1,232(0,13) ; spill CHI 1,2 BNE @L193 * *** *inputConsumed = (int) (((const char*)ip)-source); LG 15,32(0,7) ; inputConsumed LG 8,244(0,13) ; spill SGR 3,8 ST 3,0(0,15) ; inputConsumed * *** } @L193 DS 0H * *** result = (int)(((char*)op) - dest); SG 2,16(0,7) * *** ((void)0); * *** {}; * *** return result; LGFR 15,2 B @ret_lab_474 DS 0D @lit_474_169 MVC 0(1,4),0(3) * *** } @ret_lab_474 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_compress_generic_validated" * (FUNCTION #474) * @AUTO#$L$Z4_compress_generic_validated DSECT DS XL168 $L$Z4_compress_generic_validated#accumulator#65 DS 8XL1 ; accumulator ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#last$Run#60 DS 8XL1 ; lastRun ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#match$Index#50 DS 1F ; matchIndex ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#current#50 DS 1F ; current ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#h#50 DS 1F ; h ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#h#44 DS 1F ; h ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#new$Match$Code#41 DS 1F ; newMatchCode ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#more#36 DS 1F ; more ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#match$Code#34 DS 1F ; matchCode ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#len#27 DS 1F ; len ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#lit$Length#24 DS 1F ; litLength ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#match$Index#10 DS 1F ; matchIndex ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#current#10 DS 1F ; current ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#h#10 DS 1F ; h ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#search$Match$Nb#9 DS 1F ; searchMatchN* b ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#step#9 DS 1F ; step ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#h#8 DS 1F ; h ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#search$Match$Nb#7 DS 1F ; searchMatchN* b ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#step#7 DS 1F ; step ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#forward$H#0 DS 1F ; forwardH ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#offset#0 DS 1F ; offset ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#prefix$Idx$Limit#0 DS 1F ; prefixIdxLi* mit ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#maybe_ext$Mem#0 DS 1F ; maybe_extMem ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#dict$Delta#0 DS 1F ; dictDelta ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#dict$Size#0 DS 1F ; dictSize ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#start$Index#0 DS 1F ; startIndex ORG @AUTO#$L$Z4_compress_generic_validated+168 $L$Z4_compress_generic_validated#result#0 DS 1F ; result * @CODE CSECT * * * * ....... start of LZ4_compress_generic @LNAME475 DS 0H DC X'00000014' DC C'LZ4_compress_generic' DC X'00' $L$Z4_compress_generic DCCPRLG CINDEX=475,BASER=12,FRAME=256,ENTRY=NO,A* RCH=ZARCH,LNAMEADDR=@LNAME475 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * L 15,28(0,2) ; srcSize L 1,52(0,2) ; outputDirective * *** {}; * *** * *** * *** if ((U32)srcSize > (U32)0x7E000000) { return 0; } CLFI 15,X'7E000000' BNH @L194 LGHI 15,0 ; 0 B @ret_lab_475 DS 0D @FRAMESIZE_475 DC F'256' @lit_475_198 DC AD($L$Z4_compress_generic_validated) @L194 DS 0H * *** if (srcSize == 0) { LTR 15,15 BNE @L195 * *** if (outputDirective != notLimited && dstCapacity <= 0)\ * return 0; LTR 1,1 BE @L196 CHSI 44(2),0 BH @L196 LGHI 15,0 ; 0 B @ret_lab_475 @L196 DS 0H * *** {}; * *** ((void)0); * *** ((void)0); * *** dst[0] = 0; LG 15,16(0,2) ; dst MVI 0(15),0 * *** if (outputDirective == fillOutput) { CHI 1,2 BNE @L197 * *** ((void)0); * *** *inputConsumed = 0; LG 15,32(0,2) ; inputConsumed MVHI 0(15),0 ; inputConsumed * *** } @L197 DS 0H * *** return 1; LGHI 15,1 ; 1 B @ret_lab_475 * *** } @L195 DS 0H * *** ((void)0); * *** * *** return LZ4_compress_generic_validated(cctx, src, dst, srcS\ * ize, * *** inputConsumed, * *** dstCapacity, outputDirective, * *** tableType, dictDirective, dictIssue, accelerat\ * ion); LG 3,0(0,2) ; cctx STG 3,168(0,13) LG 3,8(0,2) ; src STG 3,176(0,13) LG 3,16(0,2) ; dst STG 3,184(0,13) LGFR 15,15 STG 15,192(0,13) LG 15,32(0,2) ; inputConsumed STG 15,200(0,13) LGF 15,44(0,2) ; dstCapacity STG 15,208(0,13) LGFR 15,1 STG 15,216(0,13) LGF 15,60(0,2) ; tableType STG 15,224(0,13) LGF 15,68(0,2) ; dictDirective STG 15,232(0,13) LGF 15,76(0,2) ; dictIssue STG 15,240(0,13) LGF 15,84(0,2) ; acceleration STG 15,248(0,13) LA 1,168(0,13) LG 15,@lit_475_198 ; LZ4_compress_generic_validated @@gen_label260 DS 0H BALR 14,15 @@gen_label261 DS 0H LGFR 15,15 * *** } @ret_lab_475 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_compress_generic" * (FUNCTION #475) * @AUTO#$L$Z4_compress_generic DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_compress_fast_extState $L$Z4_compress_fast_ext$State ALIAS X'D3E9F46D839694979985A2A26D8681A2A* 36D85A7A3E2A381A385' @LNAME347 DS 0H DC X'0000001A' DC C'LZ4_compress_fast_extState' DC X'00' $L$Z4_compress_fast_ext$State DCCPRLG CINDEX=347,BASER=12,FRAME=264,ENT* RY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME347 * ******* End of Prologue * * * *** LZ4_stream_t_internal* const ctx = & LZ4_initStream(state,\ * sizeof(LZ4_stream_t)) -> internal_donotuse; LMG 3,4,8(1) ; source L 5,28(0,1) ; inputSize L 6,36(0,1) ; maxOutputSize L 2,44(0,1) ; acceleration LG 15,0(0,1) ; state STG 15,176(0,13) MVGHI 184(13),16416 LA 1,176(0,13) LG 15,@lit_347_200 ; LZ4_initStream @@gen_label262 DS 0H BALR 14,15 @@gen_label263 DS 0H LGR 7,15 * *** ((void)0); * *** if (acceleration < 1) acceleration = 1; CHI 2,1 BNL @L198 LHI 2,1 ; 1 @L198 DS 0H * *** if (acceleration > 65537) acceleration = 65537; CFI 2,X'00010001' BNH @L199 IILF 2,X'00010001' ; 65537 @L199 DS 0H * *** if (maxOutputSize >= LZ4_compressBound(inputSize)) { LGFR 15,5 STG 15,176(0,13) LA 1,176(0,13) LG 15,@lit_347_203 ; LZ4_compressBound @@gen_label266 DS 0H BALR 14,15 @@gen_label267 DS 0H CR 6,15 BL @L200 * *** if (inputSize < LZ4_64Klimit) { LG 15,@lit_347_204 C 5,196(0,15) BNL @L201 * *** return LZ4_compress_generic(ctx, source, dest, inp\ * utSize, ((void *)0), 0, notLimited, byU16, noDict, noDictIssue, acce\ * leration); STG 7,176(0,13) STMG 3,4,184(13) LGFR 15,5 STG 15,200(0,13) XC 208(24,13),208(13) MVGHI 232(13),3 XC 240(16,13),240(13) LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_347_205 ; LZ4_compress_generic @@gen_label270 DS 0H BALR 14,15 @@gen_label271 DS 0H LGFR 15,15 B @ret_lab_347 DS 0D @FRAMESIZE_347 DC F'264' @lit_347_200 DC AD($L$Z4_init$Stream) @lit_347_203 DC AD($L$Z4_compress$Bound) @lit_347_204 DC AD(@DATA) @lit_347_205 DC AD($L$Z4_compress_generic) * *** } else { @L201 DS 0H * *** const tableType_t tableType = ((sizeof(void*)==4) \ * && ((uptrval)source > 65535)) ? byPtr : byU32; LHI 15,2 ; 2 * *** return LZ4_compress_generic(ctx, source, dest, inp\ * utSize, ((void *)0), 0, notLimited, tableType, noDict, noDictIssue, \ * acceleration); STG 7,176(0,13) STMG 3,4,184(13) LGFR 1,5 STG 1,200(0,13) XC 208(24,13),208(13) LGFR 15,15 STG 15,232(0,13) XC 240(16,13),240(13) LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_347_205 ; LZ4_compress_generic @@gen_label272 DS 0H BALR 14,15 @@gen_label273 DS 0H LGFR 15,15 B @ret_lab_347 * *** } * *** } else { @L200 DS 0H * *** if (inputSize < LZ4_64Klimit) { LG 15,@lit_347_204 C 5,196(0,15) BNL @L204 * *** return LZ4_compress_generic(ctx, source, dest, inp\ * utSize, ((void *)0), maxOutputSize, limitedOutput, byU16, noDict, no\ * DictIssue, acceleration); STG 7,176(0,13) STMG 3,4,184(13) LGFR 15,5 STG 15,200(0,13) XC 208(8,13),208(13) LGFR 15,6 STG 15,216(0,13) MVGHI 224(13),1 MVGHI 232(13),3 XC 240(16,13),240(13) LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_347_205 ; LZ4_compress_generic @@gen_label275 DS 0H BALR 14,15 @@gen_label276 DS 0H LGFR 15,15 B @ret_lab_347 * *** } else { @L204 DS 0H * *** const tableType_t tableType = ((sizeof(void*)==4) \ * && ((uptrval)source > 65535)) ? byPtr : byU32; LHI 15,2 ; 2 * *** return LZ4_compress_generic(ctx, source, dest, inp\ * utSize, ((void *)0), maxOutputSize, limitedOutput, tableType, noDict\ * , noDictIssue, acceleration); STG 7,176(0,13) STMG 3,4,184(13) LGFR 1,5 STG 1,200(0,13) XC 208(8,13),208(13) LGFR 1,6 STG 1,216(0,13) MVGHI 224(13),1 LGFR 15,15 STG 15,232(0,13) XC 240(16,13),240(13) LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_347_205 ; LZ4_compress_generic @@gen_label277 DS 0H BALR 14,15 @@gen_label278 DS 0H LGFR 15,15 * *** } * *** } * *** } @ret_lab_347 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_compress_fast_extState" * (FUNCTION #347) * @AUTO#$L$Z4_compress_fast_ext$State DSECT DS XL168 $L$Z4_compress_fast_ext$State#table$Type#6 DS 1F ; tableType ORG @AUTO#$L$Z4_compress_fast_ext$State+168 $L$Z4_compress_fast_ext$State#table$Type#3 DS 1F ; tableType * @CODE CSECT * * * * ....... start of LZ4_compress_fast_extState_fastReset $L$Z4_compress_fast_ext$State_fast$Reset ALIAS X'D3E9F46D839694979985A2* A26D8681A2A36D85A7A3E2A381A3856D8681A2A3D985A285A3' @LNAME362 DS 0H DC X'00000024' DC C'LZ4_compress_fast_extState_fastR' DC C'eset' DC X'00' $L$Z4_compress_fast_ext$State_fast$Reset DCCPRLG CINDEX=362,BASER=12,FR* AME=264,ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME362 * ******* End of Prologue * * * *** LZ4_stream_t_internal* ctx = &((LZ4_stream_t*)state)->inte\ * rnal_donotuse; LMG 3,4,8(1) ; src L 5,28(0,1) ; srcSize L 6,36(0,1) ; dstCapacity L 2,44(0,1) ; acceleration LG 7,0(0,1) ; state * *** if (acceleration < 1) acceleration = 1; CHI 2,1 BNL @L206 LHI 2,1 ; 1 @L206 DS 0H * *** if (acceleration > 65537) acceleration = 65537; CFI 2,X'00010001' BNH @L207 IILF 2,X'00010001' ; 65537 @L207 DS 0H * *** * *** if (dstCapacity >= LZ4_compressBound(srcSize)) { LGFR 15,5 STG 15,176(0,13) LA 1,176(0,13) LG 15,@lit_362_215 ; LZ4_compressBound @@gen_label281 DS 0H BALR 14,15 @@gen_label282 DS 0H CR 6,15 BL @L208 * *** if (srcSize < LZ4_64Klimit) { LG 15,@lit_362_216 C 5,196(0,15) BNL @L209 * *** const tableType_t tableType = byU16; LHI 6,3 ; 3 * *** LZ4_prepareTable(ctx, srcSize, tableType); STG 7,176(0,13) LGFR 15,5 STG 15,184(0,13) LGFR 15,6 STG 15,192(0,13) LA 1,176(0,13) LG 15,@lit_362_218 ; LZ4_prepareTable @@gen_label285 DS 0H BALR 14,15 @@gen_label286 DS 0H * *** if (ctx->currentOffset) { LGHI 15,16384 ; 16384 LT 15,0(15,7) ; offset of currentOffset in LZ4_stream_t_in* ternal BZ @L210 * *** return LZ4_compress_generic(ctx, src, dst, src\ * Size, ((void *)0), 0, notLimited, tableType, noDict, dictSmall, acce\ * leration); STG 7,176(0,13) STMG 3,4,184(13) LGFR 15,5 STG 15,200(0,13) XC 208(24,13),208(13) LGFR 15,6 STG 15,232(0,13) XC 240(8,13),240(13) MVGHI 248(13),1 LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_362_220 ; LZ4_compress_generic @@gen_label288 DS 0H BALR 14,15 @@gen_label289 DS 0H LGFR 15,15 B @ret_lab_362 DS 0D @FRAMESIZE_362 DC F'264' @lit_362_215 DC AD($L$Z4_compress$Bound) @lit_362_216 DC AD(@DATA) @lit_362_218 DC AD($L$Z4_prepare$Table) @lit_362_220 DC AD($L$Z4_compress_generic) * *** } else { @L210 DS 0H * *** return LZ4_compress_generic(ctx, src, dst, src\ * Size, ((void *)0), 0, notLimited, tableType, noDict, noDictIssue, ac\ * celeration); STG 7,176(0,13) STMG 3,4,184(13) LGFR 15,5 STG 15,200(0,13) XC 208(24,13),208(13) LGFR 15,6 STG 15,232(0,13) XC 240(16,13),240(13) LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_362_220 ; LZ4_compress_generic @@gen_label290 DS 0H BALR 14,15 @@gen_label291 DS 0H LGFR 15,15 B @ret_lab_362 * *** } * *** } else { @L209 DS 0H * *** const tableType_t tableType = ((sizeof(void*)==4) \ * && ((uptrval)src > 65535)) ? byPtr : byU32; LHI 6,2 ; 2 * *** LZ4_prepareTable(ctx, srcSize, tableType); STG 7,176(0,13) LGFR 15,5 STG 15,184(0,13) LGFR 15,6 STG 15,192(0,13) LA 1,176(0,13) LG 15,@lit_362_218 ; LZ4_prepareTable @@gen_label292 DS 0H BALR 14,15 @@gen_label293 DS 0H * *** return LZ4_compress_generic(ctx, src, dst, srcSize\ * , ((void *)0), 0, notLimited, tableType, noDict, noDictIssue, accele\ * ration); STG 7,176(0,13) STMG 3,4,184(13) LGFR 15,5 STG 15,200(0,13) XC 208(24,13),208(13) LGFR 15,6 STG 15,232(0,13) XC 240(16,13),240(13) LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_362_220 ; LZ4_compress_generic @@gen_label294 DS 0H BALR 14,15 @@gen_label295 DS 0H LGFR 15,15 B @ret_lab_362 * *** } * *** } else { @L208 DS 0H * *** if (srcSize < LZ4_64Klimit) { LG 15,@lit_362_216 C 5,196(0,15) BNL @L214 * *** const tableType_t tableType = byU16; LHI 8,3 ; 3 * *** LZ4_prepareTable(ctx, srcSize, tableType); STG 7,176(0,13) LGFR 15,5 STG 15,184(0,13) LGFR 15,8 STG 15,192(0,13) LA 1,176(0,13) LG 15,@lit_362_218 ; LZ4_prepareTable @@gen_label297 DS 0H BALR 14,15 @@gen_label298 DS 0H * *** if (ctx->currentOffset) { LGHI 15,16384 ; 16384 LT 15,0(15,7) ; offset of currentOffset in LZ4_stream_t_in* ternal BZ @L215 * *** return LZ4_compress_generic(ctx, src, dst, src\ * Size, ((void *)0), dstCapacity, limitedOutput, tableType, noDict, di\ * ctSmall, acceleration); STG 7,176(0,13) STMG 3,4,184(13) LGFR 15,5 STG 15,200(0,13) XC 208(8,13),208(13) LGFR 15,6 STG 15,216(0,13) MVGHI 224(13),1 LGFR 15,8 STG 15,232(0,13) XC 240(8,13),240(13) MVGHI 248(13),1 LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_362_220 ; LZ4_compress_generic @@gen_label300 DS 0H BALR 14,15 @@gen_label301 DS 0H LGFR 15,15 B @ret_lab_362 * *** } else { @L215 DS 0H * *** return LZ4_compress_generic(ctx, src, dst, src\ * Size, ((void *)0), dstCapacity, limitedOutput, tableType, noDict, no\ * DictIssue, acceleration); STG 7,176(0,13) STMG 3,4,184(13) LGFR 15,5 STG 15,200(0,13) XC 208(8,13),208(13) LGFR 15,6 STG 15,216(0,13) MVGHI 224(13),1 LGFR 15,8 STG 15,232(0,13) XC 240(16,13),240(13) LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_362_220 ; LZ4_compress_generic @@gen_label302 DS 0H BALR 14,15 @@gen_label303 DS 0H LGFR 15,15 B @ret_lab_362 * *** } * *** } else { @L214 DS 0H * *** const tableType_t tableType = ((sizeof(void*)==4) \ * && ((uptrval)src > 65535)) ? byPtr : byU32; LHI 8,2 ; 2 * *** LZ4_prepareTable(ctx, srcSize, tableType); STG 7,176(0,13) LGFR 15,5 STG 15,184(0,13) LGFR 15,8 STG 15,192(0,13) LA 1,176(0,13) LG 15,@lit_362_218 ; LZ4_prepareTable @@gen_label304 DS 0H BALR 14,15 @@gen_label305 DS 0H * *** return LZ4_compress_generic(ctx, src, dst, srcSize\ * , ((void *)0), dstCapacity, limitedOutput, tableType, noDict, noDict\ * Issue, acceleration); STG 7,176(0,13) STMG 3,4,184(13) LGFR 15,5 STG 15,200(0,13) XC 208(8,13),208(13) LGFR 15,6 STG 15,216(0,13) MVGHI 224(13),1 LGFR 15,8 STG 15,232(0,13) XC 240(16,13),240(13) LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_362_220 ; LZ4_compress_generic @@gen_label306 DS 0H BALR 14,15 @@gen_label307 DS 0H LGFR 15,15 * *** } * *** } * *** } @ret_lab_362 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_compress_fast_extState_fastR * eset" * (FUNCTION #362) * @AUTO#$L$Z4_compress_fast_ext$State_fast$Reset DSECT DS XL168 $L$Z4_compress_fast_ext$State_fast$Reset#table$Type#10 DS 1F ; tableTyp* e ORG @AUTO#$L$Z4_compress_fast_ext$State_fast$Reset+168 $L$Z4_compress_fast_ext$State_fast$Reset#table$Type#7 DS 1F ; tableType ORG @AUTO#$L$Z4_compress_fast_ext$State_fast$Reset+168 $L$Z4_compress_fast_ext$State_fast$Reset#table$Type#5 DS 1F ; tableType ORG @AUTO#$L$Z4_compress_fast_ext$State_fast$Reset+168 $L$Z4_compress_fast_ext$State_fast$Reset#table$Type#2 DS 1F ; tableType * @CODE CSECT * * * * ....... start of LZ4_compress_fast $L$Z4_compress_fast ALIAS X'D3E9F46D839694979985A2A26D8681A2A3' @LNAME345 DS 0H DC X'00000011' DC C'LZ4_compress_fast' DC X'00' $L$Z4_compress_fast DCCPRLG CINDEX=345,BASER=12,FRAME=16736,ENTRY=YES,A* RCH=ZARCH,LNAMEADDR=@LNAME345 * ******* End of Prologue * * * *** int result; * *** * *** * *** * *** * *** LZ4_stream_t ctx; * *** LZ4_stream_t* const ctxPtr = &ctx; LA 15,272(0,13) * *** * *** result = LZ4_compress_fast_extState(ctxPtr, source, dest, \ * inputSize, maxOutputSize, acceleration); LGR 2,13 AGHI 2,16384 STG 15,304(0,2) LG 15,0(0,1) ; source STG 15,312(0,2) LG 15,8(0,1) ; dest STG 15,320(0,2) LGF 15,20(0,1) ; inputSize STG 15,328(0,2) LGF 15,28(0,1) ; maxOutputSize STG 15,336(0,2) LGF 15,36(0,1) ; acceleration STG 15,344(0,2) LA 1,304(0,2) LG 15,@lit_345_235 ; LZ4_compress_fast_extState @@gen_label308 DS 0H BALR 14,15 @@gen_label309 DS 0H * *** * *** * *** * *** * *** return result; LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_345 DC F'16736' @lit_345_235 DC AD($L$Z4_compress_fast_ext$State) DROP 12 * * DSECT for automatic variables in "LZ4_compress_fast" * (FUNCTION #345) * @AUTO#$L$Z4_compress_fast DSECT DS XL272 $L$Z4_compress_fast#ctx#0 DS 16416XL1 ; ctx ORG @AUTO#$L$Z4_compress_fast+272 $L$Z4_compress_fast#result#0 DS 1F ; result * @CODE CSECT * * * * ....... start of LZ4_compress_default $L$Z4_compress_default ALIAS X'D3E9F46D839694979985A2A26D84858681A493A3* ' @LNAME342 DS 0H DC X'00000014' DC C'LZ4_compress_default' DC X'00' $L$Z4_compress_default DCCPRLG CINDEX=342,BASER=12,FRAME=208,ENTRY=YES,* ARCH=ZARCH,LNAMEADDR=@LNAME342 * ******* End of Prologue * * * *** return LZ4_compress_fast(src, dst, srcSize, maxOutputSize,\ * 1); LG 15,0(0,1) ; src STG 15,168(0,13) LG 15,8(0,1) ; dst STG 15,176(0,13) LGF 15,20(0,1) ; srcSize STG 15,184(0,13) LGF 15,28(0,1) ; maxOutputSize STG 15,192(0,13) MVGHI 200(13),1 LA 1,168(0,13) LG 15,@lit_342_237 ; LZ4_compress_fast @@gen_label310 DS 0H BALR 14,15 @@gen_label311 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_342 DC F'208' @lit_342_237 DC AD($L$Z4_compress_fast) DROP 12 * * DSECT for automatic variables in "LZ4_compress_default" * (FUNCTION #342) * @AUTO#$L$Z4_compress_default DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_compress_destSize_extState @LNAME476 DS 0H DC X'0000001E' DC C'LZ4_compress_destSize_extState' DC X'00' $L$Z4_compress_dest$Size_ext$State DCCPRLG CINDEX=476,BASER=12,FRAME=26* 4,ENTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME476 * ******* End of Prologue * * * *** void* const s = LZ4_initStream(state, sizeof (*state)); LMG 2,5,0(1) ; state L 6,36(0,1) ; targetDstSize STG 2,176(0,13) MVGHI 184(13),16416 LA 1,176(0,13) LG 15,@lit_476_239 ; LZ4_initStream @@gen_label312 DS 0H BALR 14,15 @@gen_label313 DS 0H * *** ((void)0); (void)s; * *** * *** if (targetDstSize >= LZ4_compressBound(*srcSizePtr)) { LGF 15,0(0,5) STG 15,176(0,13) LA 1,176(0,13) LG 15,@lit_476_240 ; LZ4_compressBound @@gen_label314 DS 0H BALR 14,15 @@gen_label315 DS 0H CR 6,15 BL @L218 * *** return LZ4_compress_fast_extState(state, src, dst, *sr\ * cSizePtr, targetDstSize, 1); STMG 2,4,176(13) LGF 15,0(0,5) STG 15,200(0,13) LGFR 15,6 STG 15,208(0,13) MVGHI 216(13),1 LA 1,176(0,13) LG 15,@lit_476_241 ; LZ4_compress_fast_extState @@gen_label317 DS 0H BALR 14,15 @@gen_label318 DS 0H LGFR 15,15 B @ret_lab_476 DS 0D @FRAMESIZE_476 DC F'264' @lit_476_239 DC AD($L$Z4_init$Stream) @lit_476_240 DC AD($L$Z4_compress$Bound) @lit_476_241 DC AD($L$Z4_compress_fast_ext$State) @lit_476_242 DC AD(@DATA) @lit_476_243 DC AD($L$Z4_compress_generic) * *** } else { @L218 DS 0H * *** if (*srcSizePtr < LZ4_64Klimit) { L 15,0(0,5) ; srcSizePtr LG 1,@lit_476_242 C 15,196(0,1) BNL @L220 * *** return LZ4_compress_generic(&state->internal_donot\ * use, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, b\ * yU16, noDict, noDictIssue, 1); STMG 2,4,176(13) LGF 15,0(0,5) STG 15,200(0,13) STG 5,208(0,13) LGFR 15,6 STG 15,216(0,13) MVGHI 224(13),2 MVGHI 232(13),3 XC 240(16,13),240(13) MVGHI 256(13),1 LA 1,176(0,13) LG 15,@lit_476_243 ; LZ4_compress_generic @@gen_label320 DS 0H BALR 14,15 @@gen_label321 DS 0H LGFR 15,15 B @ret_lab_476 * *** } else { @L220 DS 0H * *** tableType_t const addrMode = ((sizeof(void*)==4) &\ * & ((uptrval)src > 65535)) ? byPtr : byU32; LHI 15,2 ; 2 * *** return LZ4_compress_generic(&state->internal_donot\ * use, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, a\ * ddrMode, noDict, noDictIssue, 1); STMG 2,4,176(13) LGF 1,0(0,5) STG 1,200(0,13) STG 5,208(0,13) LGFR 1,6 STG 1,216(0,13) MVGHI 224(13),2 LGFR 15,15 STG 15,232(0,13) XC 240(16,13),240(13) MVGHI 256(13),1 LA 1,176(0,13) LG 15,@lit_476_243 ; LZ4_compress_generic @@gen_label322 DS 0H BALR 14,15 @@gen_label323 DS 0H LGFR 15,15 * *** } } * *** } @ret_lab_476 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_compress_destSize_extState" * (FUNCTION #476) * @AUTO#$L$Z4_compress_dest$Size_ext$State DSECT DS XL168 $L$Z4_compress_dest$Size_ext$State#addr$Mode#4 DS 1F ; addrMode * @CODE CSECT * * * * ....... start of LZ4_compress_destSize $L$Z4_compress_dest$Size ALIAS X'D3E9F46D839694979985A2A26D8485A2A3E289* A985' @LNAME348 DS 0H DC X'00000015' DC C'LZ4_compress_destSize' DC X'00' $L$Z4_compress_dest$Size DCCPRLG CINDEX=348,BASER=12,FRAME=16728,ENTRY=* YES,ARCH=ZARCH,LNAMEADDR=@LNAME348 * ******* End of Prologue * * * *** * *** * *** * *** * *** LZ4_stream_t ctxBody; * *** LZ4_stream_t* ctx = &ctxBody; LA 15,272(0,13) * *** * *** * *** int result = LZ4_compress_destSize_extState(ctx, src, dst,\ * srcSizePtr, targetDstSize); LGR 2,13 AGHI 2,16384 STG 15,304(0,2) LG 15,0(0,1) ; src STG 15,312(0,2) LG 15,8(0,1) ; dst STG 15,320(0,2) LG 15,16(0,1) ; srcSizePtr STG 15,328(0,2) LGF 15,28(0,1) ; targetDstSize STG 15,336(0,2) LA 1,304(0,2) LG 15,@lit_348_247 ; LZ4_compress_destSize_extState @@gen_label324 DS 0H BALR 14,15 @@gen_label325 DS 0H * *** * *** * *** * *** * *** return result; LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_348 DC F'16728' @lit_348_247 DC AD($L$Z4_compress_dest$Size_ext$State) DROP 12 * * DSECT for automatic variables in "LZ4_compress_destSize" * (FUNCTION #348) * @AUTO#$L$Z4_compress_dest$Size DSECT DS XL272 $L$Z4_compress_dest$Size#result#0 DS 1F ; result ORG @AUTO#$L$Z4_compress_dest$Size+272 $L$Z4_compress_dest$Size#ctx$Body#0 DS 16416XL1 ; ctxBody * @CODE CSECT * * * * ....... start of LZ4_createStream $L$Z4_create$Stream ALIAS X'D3E9F46D83998581A385E2A399858194' @LNAME350 DS 0H DC X'00000010' DC C'LZ4_createStream' DC X'00' $L$Z4_create$Stream DCCPRLG CINDEX=350,BASER=12,FRAME=192,ENTRY=YES,ARC* H=ZARCH,LNAMEADDR=@LNAME350 * ******* End of Prologue * * * *** LZ4_stream_t* const lz4s = (LZ4_stream_t*)rd_kafka_mem_mal\ * loc(((void *)0), sizeof(LZ4_stream_t)); XC 176(8,13),176(13) MVGHI 184(13),16416 LA 1,176(0,13) LG 15,@lit_350_249 ; rd_kafka_mem_malloc @@gen_label326 DS 0H BALR 14,15 @@gen_label327 DS 0H LGR 2,15 * *** { enum { LZ4_static_assert = 1/(int)(!!(16416 >= sizeof(LZ\ * 4_stream_t_internal))) }; }; * *** {}; * *** if (lz4s == ((void *)0)) return ((void *)0); LTGR 15,2 BNE @L222 LGHI 15,0 ; 0 B @ret_lab_350 DS 0D @FRAMESIZE_350 DC F'192' @lit_350_249 DC AD(rd_kafka_mem_malloc) @lit_350_251 DC AD($L$Z4_init$Stream) @L222 DS 0H * *** LZ4_initStream(lz4s, sizeof(*lz4s)); STG 2,176(0,13) MVGHI 184(13),16416 LA 1,176(0,13) LG 15,@lit_350_251 ; LZ4_initStream @@gen_label329 DS 0H BALR 14,15 @@gen_label330 DS 0H * *** return lz4s; LGR 15,2 * *** } @ret_lab_350 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_createStream" * (FUNCTION #350) * @AUTO#$L$Z4_create$Stream DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_stream_t_alignment @LNAME477 DS 0H DC X'00000016' DC C'LZ4_stream_t_alignment' DC X'00' $L$Z4_stream_t_alignment DCCPRLG CINDEX=477,BASER=0,FRAME=168,SAVEAREA=* NO,ENTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME477 * ******* End of Prologue * * * *** * *** typedef struct { char c; LZ4_stream_t t; } t_a; * *** return sizeof(t_a) - sizeof(LZ4_stream_t); LGHI 15,8 ; 8 * *** * *** * *** * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue * * DSECT for automatic variables in "LZ4_stream_t_alignment" * (FUNCTION #477) * @AUTO#$L$Z4_stream_t_alignment DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_initStream $L$Z4_init$Stream ALIAS X'D3E9F46D899589A3E2A399858194' @LNAME364 DS 0H DC X'0000000E' DC C'LZ4_initStream' DC X'00' $L$Z4_init$Stream DCCPRLG CINDEX=364,BASER=12,FRAME=184,ENTRY=YES,ARCH=* ZARCH,LNAMEADDR=@LNAME364 * ******* End of Prologue * * LG 2,0(0,1) ; buffer * *** {}; * *** if (buffer == ((void *)0)) { return ((void *)0); } LTGR 15,2 BNE @L223 LGHI 15,0 ; 0 B @ret_lab_364 DS 0D @FRAMESIZE_364 DC F'184' @lit_364_256 DC AD($L$Z4_stream_t_alignment) @lit_364_257 DC AD($L$Z4_is$Aligned) @L223 DS 0H * *** if (size < sizeof(LZ4_stream_t)) { return ((void *)0); } CLGHSI 8(1),16416 BNL @L224 LGHI 15,0 ; 0 B @ret_lab_364 @L224 DS 0H * *** if (!LZ4_isAligned(buffer, LZ4_stream_t_alignment())) retu\ * rn ((void *)0); LG 15,@lit_364_256 ; LZ4_stream_t_alignment @@gen_label333 DS 0H BALR 14,15 @@gen_label334 DS 0H STG 2,168(0,13) STG 15,176(0,13) LA 1,168(0,13) LG 15,@lit_364_257 ; LZ4_isAligned @@gen_label335 DS 0H BALR 14,15 @@gen_label336 DS 0H LTR 15,15 BNZ @L225 LGHI 15,0 ; 0 B @ret_lab_364 @L225 DS 0H * *** __memset((buffer),(0),(sizeof(LZ4_stream_t_internal))); * setting 16416 bytes to 0x00 LGR 1,2 LGHI 15,64 ; 64 @@gen_label338 DS 0H XC 0(256,1),0(1) LA 1,256(0,1) BCTG 15,@@gen_label338 XC 0(32,1),0(1) * *** return (LZ4_stream_t*)buffer; LGR 15,2 * *** } @ret_lab_364 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_initStream" * (FUNCTION #364) * @AUTO#$L$Z4_init$Stream DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_resetStream $L$Z4_reset$Stream ALIAS X'D3E9F46D9985A285A3E2A399858194' @LNAME382 DS 0H DC X'0000000F' DC C'LZ4_resetStream' DC X'00' $L$Z4_reset$Stream DCCPRLG CINDEX=382,BASER=12,FRAME=168,SAVEAREA=NO,EN* TRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME382 * ******* End of Prologue * * * *** {}; * *** __memset((LZ4_stream),(0),(sizeof(LZ4_stream_t_internal)))\ * ; LG 1,0(0,1) * setting 16416 bytes to 0x00 LGHI 15,64 ; 64 @@gen_label339 DS 0H XC 0(256,1),0(1) LA 1,256(0,1) BCTG 15,@@gen_label339 XC 0(32,1),0(1) * *** } @ret_lab_382 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_resetStream" * (FUNCTION #382) * @AUTO#$L$Z4_reset$Stream DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_resetStream_fast $L$Z4_reset$Stream_fast ALIAS X'D3E9F46D9985A285A3E2A3998581946D8681A2A* 3' @LNAME352 DS 0H DC X'00000014' DC C'LZ4_resetStream_fast' DC X'00' $L$Z4_reset$Stream_fast DCCPRLG CINDEX=352,BASER=12,FRAME=192,ENTRY=YES* ,ARCH=ZARCH,LNAMEADDR=@LNAME352 * ******* End of Prologue * * * *** LZ4_prepareTable(&(ctx->internal_donotuse), 0, byU32); LG 15,0(0,1) ; ctx STG 15,168(0,13) XC 176(8,13),176(13) MVGHI 184(13),2 LA 1,168(0,13) LG 15,@lit_352_262 ; LZ4_prepareTable @@gen_label340 DS 0H BALR 14,15 @@gen_label341 DS 0H * *** } @ret_lab_352 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_352 DC F'192' @lit_352_262 DC AD($L$Z4_prepare$Table) DROP 12 * * DSECT for automatic variables in "LZ4_resetStream_fast" * (FUNCTION #352) * @AUTO#$L$Z4_reset$Stream_fast DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_freeStream $L$Z4_free$Stream ALIAS X'D3E9F46D86998585E2A399858194' @LNAME351 DS 0H DC X'0000000E' DC C'LZ4_freeStream' DC X'00' $L$Z4_free$Stream DCCPRLG CINDEX=351,BASER=12,FRAME=184,ENTRY=YES,ARCH=* ZARCH,LNAMEADDR=@LNAME351 * ******* End of Prologue * * * *** if (!LZ4_stream) return 0; LG 15,0(0,1) ; LZ4_stream LTGR 1,15 BNZ @L226 LGHI 15,0 ; 0 B @ret_lab_351 DS 0D @FRAMESIZE_351 DC F'184' @lit_351_265 DC AD(rd_kafka_mem_free) @L226 DS 0H * *** {}; * *** rd_kafka_mem_free(((void *)0), LZ4_stream); XC 168(8,13),168(13) STG 15,176(0,13) LA 1,168(0,13) LG 15,@lit_351_265 ; rd_kafka_mem_free @@gen_label343 DS 0H BALR 14,15 @@gen_label344 DS 0H * *** return (0); LGHI 15,0 ; 0 * *** } @ret_lab_351 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_freeStream" * (FUNCTION #351) * @AUTO#$L$Z4_free$Stream DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_loadDict $L$Z4_load$Dict ALIAS X'D3E9F46D93968184C48983A3' @LNAME353 DS 0H DC X'0000000C' DC C'LZ4_loadDict' DC X'00' $L$Z4_load$Dict DCCPRLG CINDEX=353,BASER=12,FRAME=208,ENTRY=YES,ARCH=ZA* RCH,LNAMEADDR=@LNAME353 LGR 6,1 ; ptr to parm area * ******* End of Prologue * * * *** LZ4_stream_t_internal* dict = &LZ4_dict->internal_donotuse\ * ; LG 3,0(0,6) ; LZ4_dict * *** const tableType_t tableType = byU32; LHI 4,2 ; 2 * *** const BYTE* p = (const BYTE*)dictionary; LG 2,8(0,6) ; dictionary * *** const BYTE* const dictEnd = p + dictSize; LGF 15,20(0,6) ; dictSize LA 5,0(15,2) * *** const BYTE* base; * *** * *** {}; * *** * *** * *** * *** * *** * *** LZ4_resetStream(LZ4_dict); STG 3,176(0,13) LA 1,176(0,13) LG 15,@lit_353_269 ; LZ4_resetStream @@gen_label345 DS 0H BALR 14,15 @@gen_label346 DS 0H * *** * *** * *** # 1500 "C:\asgkafka\librdkafka\src\lz4.c" * *** dict->currentOffset += 64 *(1 <<10); LGHI 15,16384 ; 16384 L 1,0(15,3) AFI 1,X'00010000' ST 1,0(15,3) * *** * *** if (dictSize < (int)sizeof(reg_t)) { CHSI 20(6),8 BNL @L227 * *** return 0; LGHI 15,0 ; 0 B @ret_lab_353 DS 0D @FRAMESIZE_353 DC F'208' @lit_353_269 DC AD($L$Z4_reset$Stream) @lit_353_273 DC F'-65536' 0xffff0000 @lit_353_278 DC AD($L$Z4_put$Position) * *** } @L227 DS 0H * *** * *** if ((dictEnd - p) > 64 *(1 <<10)) p = dictEnd - 64 *(1 <<1\ * 0); LGR 1,5 SGR 1,2 CGFI 1,X'00010000' BNH @L228 LGF 1,@lit_353_273 ; -65536 LA 2,0(1,5) @L228 DS 0H * *** base = dictEnd - dict->currentOffset; LLGF 15,0(15,3) LGR 6,5 SGR 6,15 * *** dict->dictionary = p; LGHI 15,16392 ; 16392 STG 2,0(15,3) ; offset of dictionary in LZ4_stream_t_inter* nal * *** dict->dictSize = (U32)(dictEnd - p); LGHI 15,16408 ; 16408 LGR 1,5 SGR 1,2 ST 1,0(15,3) ; offset of dictSize in LZ4_stream_t_interna* l * *** dict->tableType = (U32)tableType; LGHI 15,16388 ; 16388 ST 4,0(15,3) ; offset of tableType in LZ4_stream_t_intern* al * *** * *** while (p <= dictEnd-sizeof(reg_t)) { B @L232 @L231 DS 0H * *** LZ4_putPosition(p, dict->hashTable, tableType, base); STMG 2,3,176(13) LGFR 15,4 STG 15,192(0,13) STG 6,200(0,13) LA 1,176(0,13) LG 15,@lit_353_278 ; LZ4_putPosition @@gen_label349 DS 0H BALR 14,15 @@gen_label350 DS 0H * *** p+=3; LA 2,3(0,2) * *** } @L232 DS 0H LGHI 15,-8 ; -8 LA 15,0(15,5) CGR 2,15 BNH @L231 * *** * *** return (int)dict->dictSize; LGHI 15,16408 ; 16408 LGF 15,0(15,3) * *** } @ret_lab_353 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_loadDict" * (FUNCTION #353) * @AUTO#$L$Z4_load$Dict DSECT DS XL168 $L$Z4_load$Dict#table$Type#0 DS 1F ; tableType * @CODE CSECT * * * * ....... start of LZ4_attach_dictionary $L$Z4_attach_dictionary ALIAS X'D3E9F46D81A3A38183886D848983A3899695819* 9A8' @LNAME363 DS 0H DC X'00000015' DC C'LZ4_attach_dictionary' DC X'00' $L$Z4_attach_dictionary DCCPRLG CINDEX=363,BASER=12,FRAME=176,SAVEAREA=* NO,ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME363 * ******* End of Prologue * * * *** const LZ4_stream_t_internal* dictCtx = dictionaryStream ==\ * ((void *)0) ? ((void *)0) : LG 15,0(0,1) ; workingStream LG 1,8(0,1) ; dictionaryStream LTGR 2,1 BNE @L233 LGHI 1,0 ; 0 B @L234 @L233 DS 0H * *** &(dictionaryStream->internal_donotuse); @L234 DS 0H * *** * *** {}; * *** * *** * *** * *** if (dictCtx != ((void *)0)) { LTGR 2,1 BE @L235 * *** * *** * *** * *** * *** * *** if (workingStream->internal_donotuse.currentOffset == \ * 0) { LGHI 2,16384 ; 16384 LA 3,0(2,15) CLFHSI 0(3),0 BNE @L236 * *** workingStream->internal_donotuse.currentOffset = 6\ * 4 *(1 <<10); LA 2,0(2,15) IILF 3,X'00010000' ; 65536 ST 3,0(0,2) ; offset of currentOffset in LZ4_stream_t_in* ternal * *** } @L236 DS 0H * *** * *** * *** * *** if (dictCtx->dictSize == 0) { LGHI 2,16408 ; 16408 LA 2,0(2,1) CLFHSI 0(2),0 BNE @L235 * *** dictCtx = ((void *)0); LGHI 1,0 ; 0 * *** } @L237 DS 0H * *** } @L235 DS 0H * *** workingStream->internal_donotuse.dictCtx = dictCtx; LGHI 2,16400 ; 16400 STG 1,0(2,15) ; offset of dictCtx in LZ4_stream_t_internal * *** } @ret_lab_363 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_attach_dictionary" * (FUNCTION #363) * @AUTO#$L$Z4_attach_dictionary DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_renormDictT @LNAME478 DS 0H DC X'0000000F' DC C'LZ4_renormDictT' DC X'00' $L$Z4_renorm$Dict$T DCCPRLG CINDEX=478,BASER=12,FRAME=176,SAVEAREA=NO,E* NTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME478 * ******* End of Prologue * * * *** ((void)0); LG 15,0(0,1) ; LZ4_dict * *** if (LZ4_dict->currentOffset + (unsigned)nextSize > 0x80000\ * 000) { LGHI 2,16384 ; 16384 L 3,0(2,15) ; offset of currentOffset in LZ4_stream_t_in* ternal AL 3,12(0,1) CLFI 3,X'80000000' BNH @ret_lab_478 * *** * *** U32 const delta = LZ4_dict->currentOffset - 64 *(1 <<1\ * 0); L 1,0(2,15) ; offset of currentOffset in LZ4_stream_t_in* ternal SLFI 1,X'00010000' * *** const BYTE* dictEnd = LZ4_dict->dictionary + LZ4_dict-\ * >dictSize; LGHI 2,16392 ; 16392 LG 2,0(2,15) ; offset of dictionary in LZ4_stream_t_inter* nal LGHI 3,16408 ; 16408 LLGF 3,0(3,15) LA 2,0(3,2) * *** int i; * *** {}; * *** for (i=0; i<(1 << (14-2)); i++) { LHI 3,0 ; 0 B @L240 @L239 DS 0H * *** if (LZ4_dict->hashTable[i] < delta) LZ4_dict->hash\ * Table[i]=0; LGFR 4,3 SLLG 4,4,2(0) ; *0x4 L 4,0(4,15) CLR 4,1 BNL @L243 LGFR 4,3 SLLG 4,4,2(0) ; *0x4 LA 4,0(4,15) MVHI 0(4),0 B @L244 * *** else LZ4_dict->hashTable[i] -= delta; @L243 DS 0H LGFR 4,3 SLLG 4,4,2(0) ; *0x4 L 5,0(4,15) SLR 5,1 ST 5,0(4,15) @L244 DS 0H * *** } AHI 3,1 @L240 DS 0H CHI 3,4096 BL @L239 * *** LZ4_dict->currentOffset = 64 *(1 <<10); LGHI 1,16384 ; 16384 LA 1,0(1,15) IILF 3,X'00010000' ; 65536 ST 3,0(0,1) ; offset of currentOffset in LZ4_stream_t_in* ternal * *** if (LZ4_dict->dictSize > 64 *(1 <<10)) LZ4_dict->dictS\ * ize = 64 *(1 <<10); LGHI 1,16408 ; 16408 LA 4,0(1,15) L 4,0(0,4) CLFI 4,X'00010000' BNH @L245 LA 4,0(1,15) ST 3,0(0,4) ; offset of dictSize in LZ4_stream_t_interna* l @L245 DS 0H * *** LZ4_dict->dictionary = dictEnd - LZ4_dict->dictSize; LGHI 3,16392 ; 16392 LLGF 1,0(1,15) SGR 2,1 STG 2,0(3,15) ; offset of dictionary in LZ4_stream_t_inter* nal * *** } @L238 DS 0H * *** } @ret_lab_478 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_renormDictT" * (FUNCTION #478) * @AUTO#$L$Z4_renorm$Dict$T DSECT DS XL168 $L$Z4_renorm$Dict$T#i#1 DS 1F ; i ORG @AUTO#$L$Z4_renorm$Dict$T+168 $L$Z4_renorm$Dict$T#delta#1 DS 1F ; delta * @CODE CSECT * * * * ....... start of LZ4_compress_fast_continue $L$Z4_compress_fast_continue ALIAS X'D3E9F46D839694979985A2A26D8681A2A3* 6D839695A38995A485' @LNAME354 DS 0H DC X'0000001A' DC C'LZ4_compress_fast_continue' DC X'00' $L$Z4_compress_fast_continue DCCPRLG CINDEX=354,BASER=12,FRAME=264,ENTR* Y=YES,ARCH=ZARCH,LNAMEADDR=@LNAME354 * ******* End of Prologue * * * *** const tableType_t tableType = byU32; LMG 4,5,8(1) ; source L 6,28(0,1) ; inputSize L 7,36(0,1) ; maxOutputSize L 2,44(0,1) ; acceleration LHI 8,2 ; 2 * *** LZ4_stream_t_internal* streamPtr = &LZ4_stream->internal_d\ * onotuse; LG 9,0(0,1) ; LZ4_stream * *** const BYTE* dictEnd = streamPtr->dictionary + streamPtr->d\ * ictSize; LGHI 10,16392 ; 16392 LG 15,0(10,9) ; offset of dictionary in LZ4_stream_t_inter* nal LGHI 11,16408 ; 16408 LLGF 1,0(11,9) LA 3,0(1,15) * *** * *** {}; * *** * *** LZ4_renormDictT(streamPtr, inputSize); STG 9,176(0,13) LGFR 15,6 STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_354_304 ; LZ4_renormDictT @@gen_label360 DS 0H BALR 14,15 @@gen_label361 DS 0H * *** if (acceleration < 1) acceleration = 1; CHI 2,1 BNL @L246 LHI 2,1 ; 1 @L246 DS 0H * *** if (acceleration > 65537) acceleration = 65537; CFI 2,X'00010001' BNH @L247 IILF 2,X'00010001' ; 65537 @L247 DS 0H * *** * *** * *** if ( (streamPtr->dictSize-1 < 4-1) * *** && (dictEnd != (const BYTE*)source) ) { L 15,0(11,9) ; offset of dictSize in LZ4_stream_t_interna* l AHI 15,-1 CLFI 15,X'00000003' BNL @L248 CGR 3,4 BE @L248 * *** {}; * *** streamPtr->dictSize = 0; LA 15,0(11,9) MVHI 0(15),0 ; offset of dictSize in LZ4_stream_t_interna* l * *** streamPtr->dictionary = (const BYTE*)source; STG 4,0(10,9) ; offset of dictionary in LZ4_stream_t_inter* nal * *** dictEnd = (const BYTE*)source; LGR 3,4 ; dictEnd * *** } @L248 DS 0H * *** * *** * *** { const BYTE* sourceEnd = (const BYTE*) source + inputSi\ * ze; LGFR 15,6 LA 15,0(15,4) * *** if ((sourceEnd > streamPtr->dictionary) && (sourceEnd \ * < dictEnd)) { LG 1,0(10,9) ; offset of dictionary in LZ4_stream_t_inter* nal CGR 15,1 BNH @L249 CGR 15,3 BNL @L249 * *** streamPtr->dictSize = (U32)(dictEnd - sourceEnd); LGR 1,3 SGR 1,15 ST 1,0(11,9) ; offset of dictSize in LZ4_stream_t_interna* l * *** if (streamPtr->dictSize > 64 *(1 <<10)) streamPtr-\ * >dictSize = 64 *(1 <<10); LA 15,0(11,9) L 15,0(0,15) CLFI 15,X'00010000' BNH @L250 LA 15,0(11,9) IILF 1,X'00010000' ; 65536 ST 1,0(0,15) ; offset of dictSize in LZ4_stream_t_interna* l @L250 DS 0H * *** if (streamPtr->dictSize < 4) streamPtr->dictSize =\ * 0; LA 15,0(11,9) CLFHSI 0(15),4 BNL @L251 LA 15,0(11,9) MVHI 0(15),0 ; offset of dictSize in LZ4_stream_t_interna* l @L251 DS 0H * *** streamPtr->dictionary = dictEnd - streamPtr->dictS\ * ize; LLGF 15,0(11,9) LGR 1,3 SGR 1,15 STG 1,0(10,9) ; offset of dictionary in LZ4_stream_t_inter* nal * *** } @L249 DS 0H * *** } * *** * *** * *** if (dictEnd == (const BYTE*)source) { CGR 3,4 BNE @L252 * *** if ((streamPtr->dictSize < 64 *(1 <<10)) && (streamPtr\ * ->dictSize < streamPtr->currentOffset)) LA 15,0(11,9) L 15,0(0,15) CLFI 15,X'00010000' BNL @L253 L 15,0(11,9) ; offset of dictSize in LZ4_stream_t_interna* l LGHI 1,16384 ; 16384 CL 15,0(1,9) BNL @L253 * *** return LZ4_compress_generic(streamPtr, source, des\ * t, inputSize, ((void *)0), maxOutputSize, limitedOutput, tableType, \ * withPrefix64k, dictSmall, acceleration); STG 9,176(0,13) STMG 4,5,184(13) LGFR 15,6 STG 15,200(0,13) XC 208(8,13),208(13) LGFR 15,7 STG 15,216(0,13) MVGHI 224(13),1 LGFR 15,8 STG 15,232(0,13) MVGHI 240(13),1 MVGHI 248(13),1 LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_354_322 ; LZ4_compress_generic @@gen_label373 DS 0H BALR 14,15 @@gen_label374 DS 0H LGFR 15,15 B @ret_lab_354 DS 0D @FRAMESIZE_354 DC F'264' @lit_354_304 DC AD($L$Z4_renorm$Dict$T) @lit_354_322 DC AD($L$Z4_compress_generic) * *** else @L253 DS 0H * *** return LZ4_compress_generic(streamPtr, source, des\ * t, inputSize, ((void *)0), maxOutputSize, limitedOutput, tableType, \ * withPrefix64k, noDictIssue, acceleration); STG 9,176(0,13) STMG 4,5,184(13) LGFR 15,6 STG 15,200(0,13) XC 208(8,13),208(13) LGFR 15,7 STG 15,216(0,13) MVGHI 224(13),1 LGFR 15,8 STG 15,232(0,13) MVGHI 240(13),1 XC 248(8,13),248(13) LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_354_322 ; LZ4_compress_generic @@gen_label375 DS 0H BALR 14,15 @@gen_label376 DS 0H LGFR 15,15 B @ret_lab_354 * *** } @L252 DS 0H * *** * *** * *** { int result; * *** if (streamPtr->dictCtx) { LGHI 15,16400 ; 16400 LTG 1,0(15,9) ; offset of dictCtx in LZ4_stream_t_internal BZ @L255 * *** * *** # 1619 "C:\asgkafka\librdkafka\src\lz4.c" * *** if (inputSize > 4 *(1 <<10)) { CHI 6,4096 BNH @L256 * *** * *** * *** * *** * *** __memcpy(streamPtr,streamPtr->dictCtx,sizeof(*\ * streamPtr)); LG 15,0(15,9) LGR 1,9 LGHI 3,64 ; 64 @@gen_label379 DS 0H MVC 0(256,1),0(15) LA 1,256(0,1) LA 15,256(0,15) BCTG 3,@@gen_label379 MVC 0(32,1),0(15) * *** result = LZ4_compress_generic(streamPtr, sourc\ * e, dest, inputSize, ((void *)0), maxOutputSize, limitedOutput, table\ * Type, usingExtDict, noDictIssue, acceleration); STG 9,176(0,13) STMG 4,5,184(13) LGFR 15,6 STG 15,200(0,13) XC 208(8,13),208(13) LGFR 15,7 STG 15,216(0,13) MVGHI 224(13),1 LGFR 15,8 STG 15,232(0,13) MVGHI 240(13),2 XC 248(8,13),248(13) LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_354_322 ; LZ4_compress_generic @@gen_label380 DS 0H BALR 14,15 @@gen_label381 DS 0H * *** } else { B @L258 @L256 DS 0H * *** result = LZ4_compress_generic(streamPtr, sourc\ * e, dest, inputSize, ((void *)0), maxOutputSize, limitedOutput, table\ * Type, usingDictCtx, noDictIssue, acceleration); STG 9,176(0,13) STMG 4,5,184(13) LGFR 15,6 STG 15,200(0,13) XC 208(8,13),208(13) LGFR 15,7 STG 15,216(0,13) MVGHI 224(13),1 LGFR 15,8 STG 15,232(0,13) MVGHI 240(13),3 XC 248(8,13),248(13) LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_354_322 ; LZ4_compress_generic @@gen_label382 DS 0H BALR 14,15 @@gen_label383 DS 0H * *** } @L257 DS 0H * *** } else { B @L258 @L255 DS 0H * *** if ((streamPtr->dictSize < 64 *(1 <<10)) && (strea\ * mPtr->dictSize < streamPtr->currentOffset)) { LA 15,0(11,9) L 15,0(0,15) CLFI 15,X'00010000' BNL @L259 L 15,0(11,9) ; offset of dictSize in LZ4_stream_t_interna* l LGHI 1,16384 ; 16384 CL 15,0(1,9) BNL @L259 * *** result = LZ4_compress_generic(streamPtr, sourc\ * e, dest, inputSize, ((void *)0), maxOutputSize, limitedOutput, table\ * Type, usingExtDict, dictSmall, acceleration); STG 9,176(0,13) STMG 4,5,184(13) LGFR 15,6 STG 15,200(0,13) XC 208(8,13),208(13) LGFR 15,7 STG 15,216(0,13) MVGHI 224(13),1 LGFR 15,8 STG 15,232(0,13) MVGHI 240(13),2 MVGHI 248(13),1 LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_354_322 ; LZ4_compress_generic @@gen_label386 DS 0H BALR 14,15 @@gen_label387 DS 0H * *** } else { B @L258 @L259 DS 0H * *** result = LZ4_compress_generic(streamPtr, sourc\ * e, dest, inputSize, ((void *)0), maxOutputSize, limitedOutput, table\ * Type, usingExtDict, noDictIssue, acceleration); STG 9,176(0,13) STMG 4,5,184(13) LGFR 15,6 STG 15,200(0,13) XC 208(8,13),208(13) LGFR 15,7 STG 15,216(0,13) MVGHI 224(13),1 LGFR 15,8 STG 15,232(0,13) MVGHI 240(13),2 XC 248(8,13),248(13) LGFR 15,2 STG 15,256(0,13) LA 1,176(0,13) LG 15,@lit_354_322 ; LZ4_compress_generic @@gen_label388 DS 0H BALR 14,15 @@gen_label389 DS 0H * *** } @L260 DS 0H * *** } @L258 DS 0H * *** streamPtr->dictionary = (const BYTE*)source; LGHI 1,16392 ; 16392 STG 4,0(1,9) ; offset of dictionary in LZ4_stream_t_inter* nal * *** streamPtr->dictSize = (U32)inputSize; LGHI 1,16408 ; 16408 ST 6,0(1,9) ; offset of dictSize in LZ4_stream_t_interna* l * *** return result; LGFR 15,15 * *** } * *** } @ret_lab_354 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_compress_fast_continue" * (FUNCTION #354) * @AUTO#$L$Z4_compress_fast_continue DSECT DS XL168 $L$Z4_compress_fast_continue#result#7 DS 1F ; result ORG @AUTO#$L$Z4_compress_fast_continue+168 $L$Z4_compress_fast_continue#table$Type#0 DS 1F ; tableType * @CODE CSECT * * * * ....... start of LZ4_compress_forceExtDict $L$Z4_compress_force$Ext$Dict ALIAS X'D3E9F46D839694979985A2A26D8696998* 385C5A7A3C48983A3' @LNAME461 DS 0H DC X'00000019' DC C'LZ4_compress_forceExtDict' DC X'00' $L$Z4_compress_force$Ext$Dict DCCPRLG CINDEX=461,BASER=12,FRAME=264,ENT* RY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME461 LGR 5,1 ; ptr to parm area * ******* End of Prologue * * * *** LZ4_stream_t_internal* streamPtr = &LZ4_dict->internal_don\ * otuse; LG 2,8(0,5) ; source L 3,28(0,5) ; srcSize LG 4,0(0,5) ; LZ4_dict * *** int result; * *** * *** LZ4_renormDictT(streamPtr, srcSize); STG 4,176(0,13) LGFR 15,3 STG 15,184(0,13) LA 1,176(0,13) LG 15,@lit_461_337 ; LZ4_renormDictT @@gen_label390 DS 0H BALR 14,15 @@gen_label391 DS 0H * *** * *** if ((streamPtr->dictSize < 64 *(1 <<10)) && (streamPtr->di\ * ctSize < streamPtr->currentOffset)) { LGHI 6,16408 ; 16408 LA 15,0(6,4) L 15,0(0,15) CLFI 15,X'00010000' BNL @L261 L 15,0(6,4) ; offset of dictSize in LZ4_stream_t_interna* l LGHI 1,16384 ; 16384 CL 15,0(1,4) BNL @L261 * *** result = LZ4_compress_generic(streamPtr, source, dest,\ * srcSize, ((void *)0), 0, notLimited, byU32, usingExtDict, dictSmall\ * , 1); STG 4,176(0,13) STG 2,184(0,13) LG 15,16(0,5) ; dest STG 15,192(0,13) LGFR 15,3 STG 15,200(0,13) XC 208(24,13),208(13) MVGHI 232(13),2 MVGHI 240(13),2 MVGHI 248(13),1 MVGHI 256(13),1 LA 1,176(0,13) LG 15,@lit_461_341 ; LZ4_compress_generic @@gen_label394 DS 0H BALR 14,15 @@gen_label395 DS 0H * *** } else { B @L262 DS 0D @FRAMESIZE_461 DC F'264' @lit_461_337 DC AD($L$Z4_renorm$Dict$T) @lit_461_341 DC AD($L$Z4_compress_generic) @L261 DS 0H * *** result = LZ4_compress_generic(streamPtr, source, dest,\ * srcSize, ((void *)0), 0, notLimited, byU32, usingExtDict, noDictIss\ * ue, 1); STG 4,176(0,13) STG 2,184(0,13) LG 15,16(0,5) ; dest STG 15,192(0,13) LGFR 15,3 STG 15,200(0,13) XC 208(24,13),208(13) MVGHI 232(13),2 MVGHI 240(13),2 XC 248(8,13),248(13) MVGHI 256(13),1 LA 1,176(0,13) LG 15,@lit_461_341 ; LZ4_compress_generic @@gen_label396 DS 0H BALR 14,15 @@gen_label397 DS 0H * *** } @L262 DS 0H * *** * *** streamPtr->dictionary = (const BYTE*)source; LGHI 1,16392 ; 16392 STG 2,0(1,4) ; offset of dictionary in LZ4_stream_t_inter* nal * *** streamPtr->dictSize = (U32)srcSize; ST 3,0(6,4) ; offset of dictSize in LZ4_stream_t_interna* l * *** * *** return result; LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_compress_forceExtDict" * (FUNCTION #461) * @AUTO#$L$Z4_compress_force$Ext$Dict DSECT DS XL168 $L$Z4_compress_force$Ext$Dict#result#0 DS 1F ; result * @CODE CSECT * * * * ....... start of LZ4_saveDict $L$Z4_save$Dict ALIAS X'D3E9F46DA281A585C48983A3' @LNAME355 DS 0H DC X'0000000C' DC C'LZ4_saveDict' DC X'00' $L$Z4_save$Dict DCCPRLG CINDEX=355,BASER=12,FRAME=200,ENTRY=YES,ARCH=ZA* RCH,LNAMEADDR=@LNAME355 * ******* End of Prologue * * * *** LZ4_stream_t_internal* const dict = &LZ4_dict->internal_do\ * notuse; LG 3,8(0,1) ; safeBuffer L 2,20(0,1) ; dictSize LG 4,0(0,1) ; LZ4_dict * *** const BYTE* const previousDictEnd = dict->dictionary + dic\ * t->dictSize; LGHI 5,16392 ; 16392 LG 15,0(5,4) ; offset of dictionary in LZ4_stream_t_inter* nal LGHI 6,16408 ; 16408 LLGF 1,0(6,4) LA 15,0(1,15) * *** * *** if ((U32)dictSize > 64 *(1 <<10)) { dictSize = 64 *(1 <<10\ * ); } CLFI 2,X'00010000' BNH @L263 IILF 2,X'00010000' ; 65536 @L263 DS 0H * *** if ((U32)dictSize > dict->dictSize) { dictSize = (int)dict\ * ->dictSize; } CL 2,0(6,4) BNH @L264 L 2,0(6,4) ; offset of dictSize in LZ4_stream_t_interna* l @L264 DS 0H * *** * *** if (safeBuffer == ((void *)0)) ((void)0); LTGR 1,3 @L265 DS 0H * *** if (dictSize > 0) LTR 2,2 BNH @L266 * *** memmove(safeBuffer, previousDictEnd - dictSize, dictSi\ * ze); STG 3,176(0,13) LGFR 1,2 SGR 15,1 STG 15,184(0,13) LGFR 15,2 STG 15,192(0,13) LA 1,176(0,13) LG 15,@lit_355_351 ; memmove @@gen_label402 DS 0H BALR 14,15 @@gen_label403 DS 0H @L266 DS 0H * *** * *** dict->dictionary = (const BYTE*)safeBuffer; STG 3,0(5,4) ; offset of dictionary in LZ4_stream_t_inter* nal * *** dict->dictSize = (U32)dictSize; ST 2,0(6,4) ; offset of dictSize in LZ4_stream_t_interna* l * *** * *** return dictSize; LGFR 15,2 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_355 DC F'200' @lit_355_351 DC AD(memmove) DROP 12 * * DSECT for automatic variables in "LZ4_saveDict" * (FUNCTION #355) * @AUTO#$L$Z4_save$Dict DSECT DS XL168 * @CODE CSECT * * * * ....... start of read_variable_length @LNAME479 DS 0H DC X'00000014' DC C'read_variable_length' DC X'00' read_variable_length DCCPRLG CINDEX=479,BASER=12,FRAME=176,SAVEAREA=NO,* ENTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME479 LGR 3,1 ; ptr to parm area * ******* End of Prologue * * * *** U32 length = 0; LG 15,0(0,3) ; ip LHI 1,0 ; 0 * *** U32 s; * *** if (initial_check && (((*ip) >= lencheck) != 0)) { LT 2,28(0,3) ; initial_check BZ @L268 LG 2,0(0,15) ; ip LG 4,8(0,3) ; lencheck CGR 2,4 BL @@gen_label405 LHI 2,1 B @@gen_label406 @@gen_label405 DS 0H LHI 2,0 @@gen_label406 DS 0H LTR 2,2 BE @L268 * *** *error = initial_error; LG 15,32(0,3) ; error MVHI 0(15),-1 ; error * *** return length; LLGFR 15,1 B @ret_lab_479 * *** } * *** do { @L268 DS 0H * *** s = **ip; LG 2,0(0,15) ; ip LLC 2,0(0,2) * *** (*ip)++; LG 4,0(0,15) LA 4,1(0,4) STG 4,0(0,15) * *** length += s; ALR 1,2 * *** if (loop_check && (((*ip) >= lencheck) != 0)) { LT 4,20(0,3) ; loop_check BZ @L271 LG 4,0(0,15) ; ip LG 5,8(0,3) ; lencheck CGR 4,5 BL @@gen_label409 LHI 4,1 B @@gen_label410 @@gen_label409 DS 0H LHI 4,0 @@gen_label410 DS 0H LTR 4,4 BE @L271 * *** *error = loop_error; LG 15,32(0,3) ; error MVHI 0(15),-2 ; error * *** return length; LLGFR 15,1 B @ret_lab_479 * *** } @L271 DS 0H * *** } while (s==255); CHI 2,255 BE @L268 * *** * *** return length; LLGFR 15,1 * *** } @ret_lab_479 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "read_variable_length" * (FUNCTION #479) * @AUTO#read_variable_length DSECT DS XL168 read_variable_length#s#0 DS 1F ; s ORG @AUTO#read_variable_length+168 read_variable_length#length#0 DS 1F ; length * @CODE CSECT * * * * ....... start of LZ4_decompress_generic @LNAME480 DS 0H DC X'00000016' DC C'LZ4_decompress_generic' DC X'00' $L$Z4_decompress_generic DCCPRLG CINDEX=480,BASER=12,FRAME=288,ENTRY=NO* ,ARCH=ZARCH,LNAMEADDR=@LNAME480 STG 1,276(0,13) ; spill * ******* End of Prologue * * * *** if (src == ((void *)0)) { return -1; } LG 10,0(0,1) ; src LG 1,276(0,13) ; spill L 15,20(0,1) ; srcSize LG 1,276(0,13) ; spill L 1,28(0,1) ; outputSize LG 2,276(0,13) ; spill L 6,36(0,2) ; endOnInput LG 2,276(0,13) ; spill L 11,44(0,2) ; partialDecoding LG 2,276(0,13) ; spill LG 8,56(0,2) ; lowPrefix LG 2,276(0,13) ; spill LG 2,72(0,2) ; dictSize STG 2,232(0,13) ; spill LTGR 2,10 BNE @L272 LGHI 15,-1 ; -1 ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @ret_lab_480 DROP 12 USING @REGION_480_1,12 DS 0D @FRAMESIZE_480 DC F'288' @lit_region_diff_480_1_2 DC A(@REGION_480_2-@REGION_480_1) @lit_480_375 MVC 0(1,4),0(1) @lit_480_376 DC AD($L$Z4_read$L$E16) @lit_480_378 DC AD(read_variable_length) @lit_480_382 DC AD(memmove) @lit_480_384 DC AD($L$Z4_wild$Copy8) @L272 DS 0H * *** * *** { const BYTE* ip = (const BYTE*) src; STG 10,168(0,13) ; ip * *** const BYTE* const iend = ip + srcSize; LGFR 2,15 LA 9,0(2,10) * *** * *** BYTE* op = (BYTE*) dst; LG 3,276(0,13) ; spill LG 2,8(0,3) ; dst * *** BYTE* const oend = op + outputSize; LGFR 3,1 LA 5,0(3,2) * *** BYTE* cpy; * *** * *** const BYTE* const dictEnd = (dictStart == ((void *)0))\ * ? ((void *)0) : dictStart + dictSize; LG 3,276(0,13) ; spill LG 3,64(0,3) ; dictStart LTGR 4,3 BNE @L273 LGHI 3,0 ; 0 B @L274 @L273 DS 0H LG 4,232(0,13) ; spill LA 3,0(4,3) @L274 DS 0H STG 3,244(0,13) ; spill * *** * *** const int safeDecode = (endOnInput==endOnInputSize); LR 3,6 XILF 3,X'00000001' LPR 3,3 AHI 3,-1 SRL 3,31(0) ST 3,240(0,13) ; spill * *** const int checkOffset = ((safeDecode) && (dictSize < (\ * int)(64 *(1 <<10)))); LTR 3,3 BZ @L276 LG 4,232(0,13) ; spill CLGFI 4,X'00010000' BNL @L276 LHI 3,1 ; 1 B @L275 @L276 DS 0H LHI 3,0 ; 0 @L275 DS 0H ST 3,256(0,13) ; spill * *** * *** * *** * *** const BYTE* const shortiend = iend - (endOnInput ? 14 \ * : 8) - 2 ; LTR 6,6 BZ @L277 LHI 3,14 ; 14 B @L278 @L277 DS 0H LHI 3,8 ; 8 @L278 DS 0H LGFR 4,3 LGR 3,9 SGR 3,4 LGHI 4,-2 ; -2 LA 3,0(4,3) STG 3,260(0,13) ; spill * *** const BYTE* const shortoend = oend - (endOnInput ? 14 \ * : 8) - 18 ; LTR 6,6 BZ @L279 LHI 3,14 ; 14 B @L280 @L279 DS 0H LHI 3,8 ; 8 @L280 DS 0H LGFR 4,3 LGR 3,5 SGR 3,4 LGHI 4,-18 ; -18 LA 3,0(4,3) STG 3,268(0,13) ; spill * *** * *** const BYTE* match; * *** size_t offset; * *** unsigned token; * *** size_t length; * *** * *** * *** {}; * *** * *** * *** ((void)0); * *** if ((endOnInput) && (((outputSize==0) != 0))) { LTR 6,6 BZ @L281 LPR 3,1 AHI 3,-1 SRL 3,31(0) LTR 3,3 BE @L281 * *** * *** if (partialDecoding) return 0; LTR 11,11 BZ @L282 LGHI 15,0 ; 0 ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @ret_lab_480 DROP 12 USING @REGION_480_1,12 @L282 DS 0H * *** return ((srcSize==1) && (*ip==0)) ? 0 : -1; CHI 15,1 BNE @L283 CLI 0(10),0 BNE @L283 LHI 15,0 ; 0 B @L284 @L283 DS 0H LHI 15,-1 ; -1 @L284 DS 0H LGFR 15,15 ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @ret_lab_480 DROP 12 USING @REGION_480_1,12 * *** } @L281 DS 0H * *** if ((!endOnInput) && (((outputSize==0) != 0))) { retur\ * n (*ip==0 ? 1 : -1); } LTR 6,6 BNZ @L285 LPR 1,1 AHI 1,-1 SRL 1,31(0) LTR 1,1 BE @L285 CLI 0(10),0 BNE @L286 LHI 15,1 ; 1 B @L287 @L286 DS 0H LHI 15,-1 ; -1 @L287 DS 0H LGFR 15,15 ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @ret_lab_480 DROP 12 USING @REGION_480_1,12 @L285 DS 0H * *** if ((endOnInput) && ((srcSize==0) != 0)) { return -1; \ * } LTR 6,6 BZ @L291 LPR 15,15 AHI 15,-1 SRL 15,31(0) LTR 15,15 BE @L291 LGHI 15,-1 ; -1 ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @ret_lab_480 DROP 12 USING @REGION_480_1,12 * *** * *** * *** * *** # 1931 "C:\asgkafka\librdkafka\src\lz4.c" * *** * *** while (1) { @L291 DS 0H * *** token = *ip++; LG 15,168(0,13) ; ip LA 1,1(0,15) STG 1,168(0,13) ; ip LLC 15,0(0,15) ST 15,252(0,13) ; spill * *** length = token >> 4; SRL 15,4(0) LLGFR 3,15 * *** * *** ((void)0); * *** * *** * *** # 1947 "C:\asgkafka\librdkafka\src\lz4.c" * *** if ( (endOnInput ? length != ((1U<<(8-4))-1) : len\ * gth <= 8) LTR 6,6 BZ @L293 CGHI 3,15 BE @L298 B @L297 @L293 DS 0H CLGFI 3,X'00000008' BH @L298 * *** * *** && (((endOnInput ? ip < shortiend : 1) & (op <= \ * shortoend)) != 0) ) { @L297 DS 0H LTR 6,6 BZ @L295 LG 15,260(0,13) ; spill CGR 1,15 BNL @@gen_label433 LHI 15,1 B @@gen_label434 @@gen_label433 DS 0H LHI 15,0 @@gen_label434 DS 0H B @L296 @L295 DS 0H LHI 15,1 ; 1 @L296 DS 0H LG 4,268(0,13) ; spill CGR 2,4 BH @@gen_label435 LHI 4,1 B @@gen_label436 @@gen_label435 DS 0H LHI 4,0 @@gen_label436 DS 0H NR 15,4 LTR 15,15 BE @L298 * *** * *** __memcpy(op,ip,endOnInput ? 16 : 8); LTR 6,6 BZ @L299 LHI 15,16 ; 16 B @L300 @L299 DS 0H LHI 15,8 ; 8 @L300 DS 0H LGFR 15,15 LGR 4,2 LTGR 15,15 BZ @@gen_label441 AGHI 15,-1 SRAG 7,15,8(0) LTGR 7,7 BZ @@gen_label440 @@gen_label439 DS 0H MVC 0(256,4),0(1) LA 4,256(0,4) LA 1,256(0,1) BCTG 7,@@gen_label439 @@gen_label440 DS 0H EX 15,@lit_480_375 @@gen_label441 DS 0H * *** op += length; ip += length; LA 2,0(3,2) LG 15,168(0,13) ; ip LA 1,0(3,15) STG 1,168(0,13) ; ip * *** * *** * *** * *** length = token & ((1U<<4)-1); L 15,252(0,13) ; spill NILF 15,X'0000000F' LLGFR 3,15 * *** offset = LZ4_readLE16(ip); ip += 2; STG 1,184(0,13) LA 1,184(0,13) LG 15,@lit_480_376 ; LZ4_readLE16 @@gen_label442 DS 0H BALR 14,15 @@gen_label443 DS 0H LLGHR 15,15 STG 15,224(0,13) ; spill LG 1,168(0,13) ; ip LA 1,2(0,1) STG 1,168(0,13) ; ip * *** match = op - offset; LGR 4,2 SGR 4,15 * *** ((void)0); * *** * *** * *** if ( (length != ((1U<<4)-1)) * *** && (offset >= 8) CGHI 3,15 BE @__copy_match@480@2 * *** && (dict==withPrefix64k || match >= lowPrefi\ * x) ) { LG 15,224(0,13) ; spill CLGFI 15,X'00000008' BL @__copy_match@480@2 LG 1,276(0,13) ; spill CHSI 52(1),1 BE @L302 CGR 4,8 BL @__copy_match@480@2 @L302 DS 0H * *** * *** __memcpy(op + 0,match + 0,8); MVC 0(8,2),0(4) * *** __memcpy(op + 8,match + 8,8); LA 15,8(0,4) LA 1,8(0,2) MVC 0(8,1),0(15) * *** __memcpy(op +16,match +16,2); LA 15,16(0,4) LA 1,16(0,2) MVC 0(2,1),0(15) * *** op += length + 4; AGHI 3,4 LA 2,0(3,2) * *** * *** continue; B @L291 * *** } * *** * *** * *** * *** goto _copy_match; * *** } @L298 DS 0H * *** * *** * *** if (length == ((1U<<(8-4))-1)) { CGHI 3,15 BNE @L303 * *** variable_length_error error = ok; MVHI 176(13),0 ; error * *** length += read_variable_length(&ip, iend-((1U<\ * <(8-4))-1), (int)endOnInput, (int)endOnInput, &error); LA 15,168(0,13) STG 15,184(0,13) LGHI 15,-15 ; -15 LA 15,0(15,9) STG 15,192(0,13) LGFR 15,6 STG 15,200(0,13) LGFR 15,6 STG 15,208(0,13) LA 15,176(0,13) STG 15,216(0,13) LA 1,184(0,13) LG 15,@lit_480_378 ; read_variable_length @@gen_label449 DS 0H BALR 14,15 @@gen_label450 DS 0H ALGFR 3,15 * *** if (error == initial_error) { goto _output_err\ * or; } CHSI 176(13),-1 BNE *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @__output_error@480@3 DROP 12 USING @REGION_480_1,12 @L304 DS 0H * *** if ((safeDecode) && (((uptrval)(op)+length<(up\ * trval)(op)) != 0)) { goto _output_error; } LT 15,240(0,13) ; spill BZ @L305 LGR 15,2 ALGR 15,3 CLGR 15,2 BNL @@gen_label453 LHI 15,1 B @@gen_label454 @@gen_label453 DS 0H LHI 15,0 @@gen_label454 DS 0H LTR 15,15 BE *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @__output_error@480@3 DROP 12 USING @REGION_480_1,12 @L305 DS 0H * *** if ((safeDecode) && (((uptrval)(ip)+length<(up\ * trval)(ip)) != 0)) { goto _output_error; } LT 15,240(0,13) ; spill BZ @L306 LG 1,168(0,13) ; ip LGR 15,1 ALGR 15,3 CLGR 15,1 BNL @@gen_label457 LHI 15,1 B @@gen_label458 @@gen_label457 DS 0H LHI 15,0 @@gen_label458 DS 0H LTR 15,15 BE *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @__output_error@480@3 DROP 12 USING @REGION_480_1,12 @L306 DS 0H * *** } @L303 DS 0H * *** * *** * *** cpy = op+length; LA 7,0(3,2) * *** * *** * *** * *** { enum { LZ4_static_assert = 1/(int)(!!(12 >= 8)) \ * }; }; * *** if ( ((endOnInput) && ((cpy>oend-12) || (ip+length\ * >iend-(2+1+5))) ) LTR 6,6 BZ @L307 LGHI 15,-12 ; -12 LA 15,0(15,5) CGR 7,15 BH @L309 LG 15,168(0,13) ; ip LA 15,0(3,15) LGHI 1,-8 ; -8 LA 1,0(1,9) CGR 15,1 BH @L309 * *** || ((!endOnInput) && (cpy>oend-8)) ) @L307 DS 0H LTR 6,6 BNZ @L308 LGHI 15,-8 ; -8 LA 15,0(15,5) CGR 7,15 BNH @L308 @L309 DS 0H * *** { * *** * *** * *** * *** * *** * *** if (partialDecoding) { LTR 11,11 BZ @L310 * *** * *** * *** * *** ((void)0); * *** {} * *** {}; * *** {}; * *** {}; * *** * *** * *** * *** if (ip+length > iend) { LG 15,168(0,13) ; ip LA 1,0(3,15) CGR 1,9 BNH @L311 * *** length = (size_t)(iend-ip); LGR 3,9 SGR 3,15 * *** cpy = op + length; LA 7,0(3,2) * *** } @L311 DS 0H * *** * *** * *** * *** if (cpy > oend) { CGR 7,5 BNH @L313 * *** cpy = oend; LGR 7,5 ; cpy * *** ((void)0); * *** length = (size_t)(oend-op); LGR 3,5 SGR 3,2 * *** } @L312 DS 0H * *** } else { B @L313 @L310 DS 0H * *** * *** * *** * *** if ((!endOnInput) && (cpy != oend)) { goto\ * _output_error; } LTR 6,6 BNZ @L314 CGR 7,5 BE *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @__output_error@480@3 DROP 12 USING @REGION_480_1,12 @L314 DS 0H * *** * *** * *** * *** if ((endOnInput) && ((ip+length != iend) |\ * | (cpy > oend))) { LTR 6,6 BZ @L313 LG 15,168(0,13) ; ip LA 15,0(3,15) CGR 15,9 BE *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @__output_error@480@3 DROP 12 USING @REGION_480_1,12 CGR 7,5 BNH @L313 @L316 DS 0H * *** {} * *** {}; * *** {}; * *** goto _output_error; ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @__output_error@480@3 DROP 12 USING @REGION_480_1,12 * *** } * *** } @L313 DS 0H * *** memmove(op, ip, length); STG 2,184(0,13) LG 15,168(0,13) ; ip STG 15,192(0,13) STG 3,200(0,13) LA 1,184(0,13) LG 15,@lit_480_382 ; memmove @@gen_label473 DS 0H BALR 14,15 @@gen_label474 DS 0H * *** ip += length; LG 15,168(0,13) ; ip LA 15,0(3,15) STG 15,168(0,13) ; ip * *** op += length; LA 2,0(3,2) * *** * *** * *** * *** * *** * *** if (!partialDecoding || (cpy == oend) || (ip >\ * = (iend-2))) { LTR 11,11 BNZ *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @L289 DROP 12 USING @REGION_480_1,12 CGR 7,5 BNE *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @L289 DROP 12 USING @REGION_480_1,12 @L317 DS 0H LGHI 1,-2 ; -2 LA 1,0(1,9) CGR 15,1 BL @L320 @L319 DS 0H * *** break; ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @L289 DROP 12 USING @REGION_480_1,12 * *** } * *** } else { @L308 DS 0H * *** LZ4_wildCopy8(op, ip, cpy); STG 2,184(0,13) LG 15,168(0,13) ; ip STG 15,192(0,13) STG 7,200(0,13) LA 1,184(0,13) LG 15,@lit_480_384 ; LZ4_wildCopy8 @@gen_label478 DS 0H BALR 14,15 @@gen_label479 DS 0H * *** ip += length; op = cpy; LG 15,168(0,13) ; ip LA 15,0(3,15) STG 15,168(0,13) ; ip LGR 2,7 ; op * *** } @L320 DS 0H * *** * *** * *** offset = LZ4_readLE16(ip); ip+=2; LG 15,168(0,13) ; ip STG 15,184(0,13) LA 1,184(0,13) LG 15,@lit_480_376 ; LZ4_readLE16 @@gen_label480 DS 0H BALR 14,15 @@gen_label481 DS 0H LLGHR 15,15 STG 15,224(0,13) ; spill LG 1,168(0,13) ; ip LA 1,2(0,1) STG 1,168(0,13) ; ip * *** match = op - offset; LGR 4,2 SGR 4,15 * *** * *** * *** length = token & ((1U<<4)-1); L 15,252(0,13) ; spill NILF 15,X'0000000F' LLGFR 3,15 * *** * *** _copy_match: * *** if (length == ((1U<<4)-1)) { @__copy_match@480@2 DS 0H CGHI 3,15 BNE @L321 * *** variable_length_error error = ok; MVHI 176(13),0 ; error * *** length += read_variable_length(&ip, iend - 5 + 1\ * , (int)endOnInput, 0, &error); LA 15,168(0,13) STG 15,184(0,13) LGHI 15,-5 ; -5 LA 15,1(15,9) STG 15,192(0,13) LGFR 15,6 STG 15,200(0,13) XC 208(8,13),208(13) LA 15,176(0,13) STG 15,216(0,13) LA 1,184(0,13) LG 15,@lit_480_378 ; read_variable_length @@gen_label483 DS 0H BALR 14,15 @@gen_label484 DS 0H ALGFR 3,15 * *** if (error != ok) goto _output_error; CHSI 176(13),0 BE *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @__output_error@480@3 DROP 12 USING @REGION_480_1,12 @L322 DS 0H * *** if ((safeDecode) && (((uptrval)(op)+length<(up\ * trval)op) != 0)) goto _output_error; LT 15,240(0,13) ; spill BZ @L323 LGR 15,2 ALGR 15,3 CLGR 15,2 BNL @@gen_label487 LHI 15,1 B @@gen_label488 @@gen_label487 DS 0H LHI 15,0 @@gen_label488 DS 0H LTR 15,15 BE *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @__output_error@480@3 DROP 12 USING @REGION_480_1,12 @L323 DS 0H * *** } @L321 DS 0H * *** length += 4; AGHI 3,4 * *** * *** * *** * *** * *** if ((checkOffset) && (((match + dictSize < lowPref\ * ix) != 0))) goto _output_error; LT 15,256(0,13) ; spill BZ @L324 LG 15,232(0,13) ; spill LA 15,0(15,4) CGR 15,8 BNL @@gen_label491 LHI 15,1 B @@gen_label492 @@gen_label491 DS 0H LHI 15,0 @@gen_label492 DS 0H LTR 15,15 BE *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @__output_error@480@3 DROP 12 USING @REGION_480_1,12 @L324 DS 0H * *** * *** if ((dict==usingExtDict) && (match < lowPrefix)) { LG 1,276(0,13) ; spill CHSI 52(1),2 BE *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @L325 DROP 12 USING @REGION_480_1,12 CGR 4,8 BL *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @L325 DROP 12 USING @REGION_480_1,12 * *** if (((op+length > oend-5) != 0)) { LA 15,0(3,2) LGHI 1,-5 ; -5 LA 1,0(1,5) CGR 15,1 BNH @@gen_label496 LHI 15,1 B @@gen_label497 @@gen_label496 DS 0H LHI 15,0 @@gen_label497 DS 0H LTR 15,15 BNE *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @L326 DROP 12 USING @REGION_480_1,12 * *** if (partialDecoding) length = ( (length) <\ * ((size_t)(oend-op)) ? (length) : ((size_t)(oend-op)) ); LTR 11,11 BNZ *+14 Around region break ALGF 12,@lit_region_diff_480_1_2 DROP 12 USING @REGION_480_2,12 B @__output_error@480@3 DROP 12 USING @REGION_480_1,12 ALGF 12,@lit_region_diff_480_1_2 @REGION_480_2 DS 0H DROP 12 USING @REGION_480_2,12 LGR 15,5 SGR 15,2 CLGR 3,15 BNL @L328 B @L329 DS 0D @lit_480_389 DC AD(memmove) @lit_region_diff_480_2_1 DC A(@REGION_480_2-@REGION_480_1) @lit_480_390 MVC 0(1,3),0(1) @lit_480_393 MVC 0(1,2),0(4) @lit_480_394 DC AD($L$Z4_write32) @lit_480_395 DC AD(@DATA) @lit_480_399 DC AD($L$Z4_wild$Copy8) @L328 DS 0H LGR 3,5 SGR 3,2 @L329 DS 0H * *** else goto _output_error; * *** } @L326 DS 0H * *** * *** if (length <= (size_t)(lowPrefix-match)) { LGR 15,8 SGR 15,4 CLGR 3,15 BH @L331 * *** * *** memmove(op, dictEnd - (lowPrefix-match), l\ * ength); STG 2,184(0,13) LGR 1,8 SGR 1,4 LG 15,244(0,13) ; spill SGR 15,1 STG 15,192(0,13) STG 3,200(0,13) LA 1,184(0,13) LG 15,@lit_480_389 ; memmove @@gen_label502 DS 0H BALR 14,15 @@gen_label503 DS 0H * *** op += length; LA 2,0(3,2) * *** } else { SLGF 12,@lit_region_diff_480_2_1 DROP 12 USING @REGION_480_1,12 B @L291 DROP 12 USING @REGION_480_2,12 @L331 DS 0H * *** * *** size_t const copySize = (size_t)(lowPrefix\ * - match); LGR 7,8 SGR 7,4 * *** size_t const restSize = length - copySize; LGR 14,3 SLGR 14,7 * *** __memcpy(op,dictEnd - copySize,copySize); LG 1,244(0,13) ; spill SGR 1,7 LGR 3,2 LTGR 15,7 BZ @@gen_label506 AGHI 15,-1 SRAG 4,15,8(0) LTGR 4,4 BZ @@gen_label505 @@gen_label504 DS 0H MVC 0(256,3),0(1) LA 3,256(0,3) LA 1,256(0,1) BCTG 4,@@gen_label504 @@gen_label505 DS 0H EX 15,@lit_480_390 @@gen_label506 DS 0H * *** op += copySize; LA 2,0(7,2) * *** if (restSize > (size_t)(op - lowPrefix)) {\ * LGR 15,2 SGR 15,8 CLGR 14,15 BNH @L333 * *** BYTE* const endOfMatch = op + restSize\ * ; LA 1,0(14,2) * *** const BYTE* copyFrom = lowPrefix; LGR 15,8 ; copyFrom * *** while (op < endOfMatch) *op++ = *copyF\ * rom++; B @L337 @L336 DS 0H LGR 3,2 LA 2,1(0,2) LGR 4,15 LA 15,1(0,15) IC 4,0(0,4) STC 4,0(0,3) @L337 DS 0H CGR 2,1 BL @L336 * *** } else { B @L338 @L333 DS 0H * *** __memcpy(op,lowPrefix,restSize); LGR 1,8 LGR 3,2 LTGR 15,14 BZ @@gen_label511 AGHI 15,-1 SRAG 4,15,8(0) LTGR 4,4 BZ @@gen_label510 @@gen_label509 DS 0H MVC 0(256,3),0(1) LA 3,256(0,3) LA 1,256(0,1) BCTG 4,@@gen_label509 @@gen_label510 DS 0H EX 15,@lit_480_390 @@gen_label511 DS 0H * *** op += restSize; LA 2,0(14,2) * *** } } @L338 DS 0H @L332 DS 0H * *** continue; SLGF 12,@lit_region_diff_480_2_1 DROP 12 USING @REGION_480_1,12 B @L291 DROP 12 USING @REGION_480_2,12 * *** } @L325 DS 0H * *** ((void)0); * *** * *** * *** cpy = op + length; LA 7,0(3,2) * *** * *** * *** ((void)0); * *** if (partialDecoding && (cpy > oend-((2*8) - 4))) { LTR 11,11 BZ @L339 LGHI 15,-12 ; -12 LA 15,0(15,5) CGR 7,15 BNH @L339 * *** size_t const mlen = ( (length) < ((size_t)(oen\ * d-op)) ? (length) : ((size_t)(oend-op)) ); LGR 15,5 SGR 15,2 CLGR 3,15 BNL @L340 B @L341 @L340 DS 0H LGR 3,5 SGR 3,2 @L341 DS 0H * *** const BYTE* const matchEnd = match + mlen; LA 15,0(3,4) * *** BYTE* const copyEnd = op + mlen; LA 7,0(3,2) * *** if (matchEnd > op) { CGR 15,2 BNH @L342 * *** while (op < copyEnd) { *op++ = *match++; } B @L346 @L345 DS 0H LGR 15,2 LA 2,1(0,2) LGR 1,4 LA 4,1(0,4) IC 1,0(0,1) STC 1,0(0,15) @L346 DS 0H CGR 2,7 BL @L345 * *** } else { B @L347 @L342 DS 0H * *** __memcpy(op,match,mlen); LTGR 15,3 BZ @@gen_label519 AGHI 15,-1 SRAG 1,15,8(0) LTGR 1,1 BZ @@gen_label518 @@gen_label517 DS 0H MVC 0(256,2),0(4) LA 2,256(0,2) LA 4,256(0,4) BCTG 1,@@gen_label517 @@gen_label518 DS 0H EX 15,@lit_480_393 @@gen_label519 DS 0H * *** } @L347 DS 0H * *** op = copyEnd; LGR 2,7 ; op * *** if (op == oend) { break; } CGR 7,5 BE *+14 Around region break SLGF 12,@lit_region_diff_480_2_1 DROP 12 USING @REGION_480_1,12 B @L291 DROP 12 USING @REGION_480_2,12 B @L289 * *** continue; * *** } @L339 DS 0H * *** * *** if (((offset<8) != 0)) { LG 15,224(0,13) ; spill CLGFI 15,X'00000008' BNL @@gen_label521 LHI 15,1 B @@gen_label522 @@gen_label521 DS 0H LHI 15,0 @@gen_label522 DS 0H LTR 15,15 BE @L349 * *** LZ4_write32(op, 0); STG 2,184(0,13) XC 192(8,13),192(13) LA 1,184(0,13) LG 15,@lit_480_394 ; LZ4_write32 @@gen_label524 DS 0H BALR 14,15 @@gen_label525 DS 0H * *** op[0] = match[0]; IC 15,0(0,4) STC 15,0(0,2) * *** op[1] = match[1]; IC 15,1(0,4) STC 15,1(0,2) * *** op[2] = match[2]; IC 15,2(0,4) STC 15,2(0,2) * *** op[3] = match[3]; IC 15,3(0,4) STC 15,3(0,2) * *** match += inc32table[offset]; LG 15,@lit_480_395 LG 1,224(0,13) ; spill SLLG 1,1,2(0) ; *0x4 LLGF 1,4(1,15) LA 4,0(1,4) * *** __memcpy(op+4,match,4); LA 1,4(0,2) MVC 0(4,1),0(4) * *** match -= dec64table[offset]; LG 1,224(0,13) ; spill SLLG 1,1,2(0) ; *0x4 LGF 15,36(1,15) SGR 4,15 * *** } else { B @L350 @L349 DS 0H * *** __memcpy(op,match,8); MVC 0(8,2),0(4) * *** match += 8; LA 4,8(0,4) * *** } @L350 DS 0H * *** op += 8; LA 2,8(0,2) * *** * *** if (((cpy > oend-((2*8) - 4)) != 0)) { LGHI 15,-12 ; -12 LA 15,0(15,5) CGR 7,15 BNH @@gen_label526 LHI 15,1 B @@gen_label527 @@gen_label526 DS 0H LHI 15,0 @@gen_label527 DS 0H LTR 15,15 BE @L351 * *** BYTE* const oCopyLimit = oend - (8-1); LGHI 15,-7 ; -7 LA 3,0(15,5) * *** if (cpy > oend-5) { goto _output_error; } LGHI 15,-5 ; -5 LA 15,0(15,5) CGR 7,15 BH @__output_error@480@3 @L352 DS 0H * *** if (op < oCopyLimit) { CGR 2,3 BNL @L357 * *** LZ4_wildCopy8(op, match, oCopyLimit); STG 2,184(0,13) STG 4,192(0,13) STG 3,200(0,13) LA 1,184(0,13) LG 15,@lit_480_399 ; LZ4_wildCopy8 @@gen_label531 DS 0H BALR 14,15 @@gen_label532 DS 0H * *** match += oCopyLimit - op; LGR 15,3 SGR 15,2 LA 4,0(15,4) * *** op = oCopyLimit; LGR 2,3 ; op * *** } @L353 DS 0H * *** while (op < cpy) { *op++ = *match++; } B @L357 @L356 DS 0H LGR 15,2 LA 2,1(0,2) LGR 1,4 LA 4,1(0,4) IC 1,0(0,1) STC 1,0(0,15) @L357 DS 0H CGR 2,7 BL @L356 * *** } else { B @L358 @L351 DS 0H * *** __memcpy(op,match,8); MVC 0(8,2),0(4) * *** if (length > 16) { LZ4_wildCopy8(op+8, match+\ * 8, cpy); } CLGFI 3,X'00000010' BNH @L358 LA 15,8(0,2) STG 15,184(0,13) LA 15,8(0,4) STG 15,192(0,13) STG 7,200(0,13) LA 1,184(0,13) LG 15,@lit_480_399 ; LZ4_wildCopy8 @@gen_label535 DS 0H BALR 14,15 @@gen_label536 DS 0H @L359 DS 0H * *** } @L358 DS 0H * *** op = cpy; LGR 2,7 ; op * *** } @L290 DS 0H @L292 DS 0H SLGF 12,@lit_region_diff_480_2_1 DROP 12 USING @REGION_480_1,12 B @L291 DROP 12 USING @REGION_480_2,12 @L289 DS 0H * *** * *** * *** if (endOnInput) { LTR 6,6 BZ @L360 * *** {}; * *** return (int) (((char*)op)-dst); LG 1,276(0,13) ; spill SG 2,8(0,1) LGFR 15,2 B @ret_lab_480 * *** } else { @L360 DS 0H * *** return (int) (((const char*)ip)-src); LG 15,168(0,13) ; ip SGR 15,10 LGFR 15,15 B @ret_lab_480 * *** } * *** * *** * *** _output_error: * *** return (int) (-(((const char*)ip)-src))-1; @__output_error@480@3 DS 0H LG 15,168(0,13) ; ip SGR 15,10 LCGR 15,15 AHI 15,-1 LGFR 15,15 * *** } * *** } @ret_lab_480 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_decompress_generic" * (FUNCTION #480) * @AUTO#$L$Z4_decompress_generic DSECT DS XL168 $L$Z4_decompress_generic#mlen#38 DS 8XL1 ; mlen ORG @AUTO#$L$Z4_decompress_generic+168 $L$Z4_decompress_generic#rest$Size#35 DS 8XL1 ; restSize ORG @AUTO#$L$Z4_decompress_generic+168 $L$Z4_decompress_generic#copy$Size#35 DS 8XL1 ; copySize ORG @AUTO#$L$Z4_decompress_generic+168 $L$Z4_decompress_generic#length#2 DS 8XL1 ; length ORG @AUTO#$L$Z4_decompress_generic+168 $L$Z4_decompress_generic#token#2 DS 1F ; token ORG @AUTO#$L$Z4_decompress_generic+168 $L$Z4_decompress_generic#offset#2 DS 8XL1 ; offset ORG @AUTO#$L$Z4_decompress_generic+168 $L$Z4_decompress_generic#check$Offset#2 DS 1F ; checkOffset ORG @AUTO#$L$Z4_decompress_generic+168 $L$Z4_decompress_generic#safe$Decode#2 DS 1F ; safeDecode ORG @AUTO#$L$Z4_decompress_generic+176 $L$Z4_decompress_generic#error#31 DS 1F ; error ORG @AUTO#$L$Z4_decompress_generic+176 $L$Z4_decompress_generic#error#10 DS 1F ; error * @CODE CSECT * * * * ....... start of LZ4_decompress_safe $L$Z4_decompress_safe ALIAS X'D3E9F46D8485839694979985A2A26DA2818685' @LNAME343 DS 0H DC X'00000013' DC C'LZ4_decompress_safe' DC X'00' $L$Z4_decompress_safe DCCPRLG CINDEX=343,BASER=12,FRAME=248,ENTRY=YES,A* RCH=ZARCH,LNAMEADDR=@LNAME343 * ******* End of Prologue * * * *** return LZ4_decompress_generic(source, dest, compressedSize\ * , maxDecompressedSize, * *** endOnInputSize, decode_full_\ * block, noDict, * *** (BYTE*)dest, ((void *)0), 0)\ * ; LG 15,0(0,1) ; source STG 15,168(0,13) LG 15,8(0,1) ; dest STG 15,176(0,13) LGF 15,20(0,1) ; compressedSize STG 15,184(0,13) LGF 15,28(0,1) ; maxDecompressedSize STG 15,192(0,13) MVGHI 200(13),1 XC 208(16,13),208(13) LG 15,8(0,1) ; dest STG 15,224(0,13) XC 232(16,13),232(13) LA 1,168(0,13) LG 15,@lit_343_436 ; LZ4_decompress_generic @@gen_label538 DS 0H BALR 14,15 @@gen_label539 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_343 DC F'248' @lit_343_436 DC AD($L$Z4_decompress_generic) DROP 12 * * DSECT for automatic variables in "LZ4_decompress_safe" * (FUNCTION #343) * @AUTO#$L$Z4_decompress_safe DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_decompress_safe_partial $L$Z4_decompress_safe_partial ALIAS X'D3E9F46D8485839694979985A2A26DA28* 186856D978199A3898193' @LNAME349 DS 0H DC X'0000001B' DC C'LZ4_decompress_safe_partial' DC X'00' $L$Z4_decompress_safe_partial DCCPRLG CINDEX=349,BASER=12,FRAME=248,ENT* RY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME349 * ******* End of Prologue * * * *** dstCapacity = ( (targetOutputSize) < (dstCapacity) ? (targ\ * etOutputSize) : (dstCapacity) ); L 15,36(0,1) ; dstCapacity L 2,28(0,1) ; targetOutputSize CR 2,15 BNL @L362 B @L363 DS 0D @FRAMESIZE_349 DC F'248' @lit_349_438 DC AD($L$Z4_decompress_generic) @L362 DS 0H LR 2,15 @L363 DS 0H * *** return LZ4_decompress_generic(src, dst, compressedSize, ds\ * tCapacity, * *** endOnInputSize, partial_deco\ * de, * *** noDict, (BYTE*)dst, ((void *\ * )0), 0); LG 15,0(0,1) ; src STG 15,168(0,13) LG 15,8(0,1) ; dst STG 15,176(0,13) LGF 15,20(0,1) ; compressedSize STG 15,184(0,13) LGFR 15,2 STG 15,192(0,13) MVGHI 200(13),1 MVGHI 208(13),1 XC 216(8,13),216(13) LG 15,8(0,1) ; dst STG 15,224(0,13) XC 232(16,13),232(13) LA 1,168(0,13) LG 15,@lit_349_438 ; LZ4_decompress_generic @@gen_label541 DS 0H BALR 14,15 @@gen_label542 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_decompress_safe_partial" * (FUNCTION #349) * @AUTO#$L$Z4_decompress_safe_partial DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_decompress_fast $L$Z4_decompress_fast ALIAS X'D3E9F46D8485839694979985A2A26D8681A2A3' @LNAME379 DS 0H DC X'00000013' DC C'LZ4_decompress_fast' DC X'00' $L$Z4_decompress_fast DCCPRLG CINDEX=379,BASER=12,FRAME=248,ENTRY=YES,A* RCH=ZARCH,LNAMEADDR=@LNAME379 * ******* End of Prologue * * * *** return LZ4_decompress_generic(source, dest, 0, originalSiz\ * e, * *** endOnOutputSize, decode_full\ * _block, withPrefix64k, * *** (BYTE*)dest - 64 *(1 <<10), \ * ((void *)0), 0); LG 15,0(0,1) ; source STG 15,168(0,13) LG 15,8(0,1) ; dest STG 15,176(0,13) XC 184(8,13),184(13) LGF 15,20(0,1) ; originalSize STG 15,192(0,13) XC 200(16,13),200(13) MVGHI 216(13),1 LG 15,8(0,1) ; dest LGF 1,@lit_379_441 ; -65536 LA 15,0(1,15) STG 15,224(0,13) XC 232(16,13),232(13) LA 1,168(0,13) LG 15,@lit_379_442 ; LZ4_decompress_generic @@gen_label543 DS 0H BALR 14,15 @@gen_label544 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_379 DC F'248' @lit_379_442 DC AD($L$Z4_decompress_generic) @lit_379_441 DC F'-65536' 0xffff0000 DROP 12 * * DSECT for automatic variables in "LZ4_decompress_fast" * (FUNCTION #379) * @AUTO#$L$Z4_decompress_fast DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_decompress_safe_withPrefix64k $L$Z4_decompress_safe_with$Prefix64k ALIAS X'D3E9F46D8485839694979985A2* A26DA28186856DA689A388D799858689A7F6F492' @LNAME377 DS 0H DC X'00000021' DC C'LZ4_decompress_safe_withPrefix64' DC C'k' DC X'00' $L$Z4_decompress_safe_with$Prefix64k DCCPRLG CINDEX=377,BASER=12,FRAME=* 248,ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME377 * ******* End of Prologue * * * *** return LZ4_decompress_generic(source, dest, compressedSize\ * , maxOutputSize, * *** endOnInputSize, decode_full_\ * block, withPrefix64k, * *** (BYTE*)dest - 64 *(1 <<10), \ * ((void *)0), 0); LG 15,0(0,1) ; source STG 15,168(0,13) LG 15,8(0,1) ; dest STG 15,176(0,13) LGF 15,20(0,1) ; compressedSize STG 15,184(0,13) LGF 15,28(0,1) ; maxOutputSize STG 15,192(0,13) MVGHI 200(13),1 XC 208(8,13),208(13) MVGHI 216(13),1 LG 15,8(0,1) ; dest LGF 1,@lit_377_445 ; -65536 LA 15,0(1,15) STG 15,224(0,13) XC 232(16,13),232(13) LA 1,168(0,13) LG 15,@lit_377_446 ; LZ4_decompress_generic @@gen_label545 DS 0H BALR 14,15 @@gen_label546 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_377 DC F'248' @lit_377_446 DC AD($L$Z4_decompress_generic) @lit_377_445 DC F'-65536' 0xffff0000 DROP 12 * * DSECT for automatic variables in "LZ4_decompress_safe_withPrefix64 * k" * (FUNCTION #377) * @AUTO#$L$Z4_decompress_safe_with$Prefix64k DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_decompress_fast_withPrefix64k $L$Z4_decompress_fast_with$Prefix64k ALIAS X'D3E9F46D8485839694979985A2* A26D8681A2A36DA689A388D799858689A7F6F492' @LNAME378 DS 0H DC X'00000021' DC C'LZ4_decompress_fast_withPrefix64' DC C'k' DC X'00' $L$Z4_decompress_fast_with$Prefix64k DCCPRLG CINDEX=378,BASER=12,FRAME=* 192,ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME378 * ******* End of Prologue * * * *** * *** * *** return LZ4_decompress_fast(source, dest, originalSize); LG 15,0(0,1) ; source STG 15,168(0,13) LG 15,8(0,1) ; dest STG 15,176(0,13) LGF 15,20(0,1) ; originalSize STG 15,184(0,13) LA 1,168(0,13) LG 15,@lit_378_448 ; LZ4_decompress_fast @@gen_label547 DS 0H BALR 14,15 @@gen_label548 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_378 DC F'192' @lit_378_448 DC AD($L$Z4_decompress_fast) DROP 12 * * DSECT for automatic variables in "LZ4_decompress_fast_withPrefix64 * k" * (FUNCTION #378) * @AUTO#$L$Z4_decompress_fast_with$Prefix64k DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_decompress_safe_withSmallPrefix @LNAME481 DS 0H DC X'00000023' DC C'LZ4_decompress_safe_withSmallPre' DC C'fix' DC X'00' $L$Z4_decompress_safe_with$Small$Prefix DCCPRLG CINDEX=481,BASER=12,FRA* ME=248,ENTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME481 * ******* End of Prologue * * * *** return LZ4_decompress_generic(source, dest, compressedSize\ * , maxOutputSize, * *** endOnInputSize, decode_full_\ * block, noDict, * *** (BYTE*)dest-prefixSize, ((vo\ * id *)0), 0); LG 15,0(0,1) ; source STG 15,168(0,13) LG 15,8(0,1) ; dest STG 15,176(0,13) LGF 15,20(0,1) ; compressedSize STG 15,184(0,13) LGF 15,28(0,1) ; maxOutputSize STG 15,192(0,13) MVGHI 200(13),1 XC 208(16,13),208(13) LG 15,8(0,1) ; dest LG 1,32(0,1) ; prefixSize SGR 15,1 STG 15,224(0,13) XC 232(16,13),232(13) LA 1,168(0,13) LG 15,@lit_481_450 ; LZ4_decompress_generic @@gen_label549 DS 0H BALR 14,15 @@gen_label550 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_481 DC F'248' @lit_481_450 DC AD($L$Z4_decompress_generic) DROP 12 * * DSECT for automatic variables in "LZ4_decompress_safe_withSmallPre * fix" * (FUNCTION #481) * @AUTO#$L$Z4_decompress_safe_with$Small$Prefix DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_decompress_safe_forceExtDict $L$Z4_decompress_safe_force$Ext$Dict ALIAS X'D3E9F46D8485839694979985A2* A26DA28186856D8696998385C5A7A3C48983A3' @LNAME462 DS 0H DC X'00000020' DC C'LZ4_decompress_safe_forceExtDict' DC X'00' $L$Z4_decompress_safe_force$Ext$Dict DCCPRLG CINDEX=462,BASER=12,FRAME=* 248,ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME462 * ******* End of Prologue * * * *** return LZ4_decompress_generic(source, dest, compressedSize\ * , maxOutputSize, * *** endOnInputSize, decode_full_\ * block, usingExtDict, * *** (BYTE*)dest, (const BYTE*)di\ * ctStart, dictSize); LG 15,0(0,1) ; source STG 15,168(0,13) LG 15,8(0,1) ; dest STG 15,176(0,13) LGF 15,20(0,1) ; compressedSize STG 15,184(0,13) LGF 15,28(0,1) ; maxOutputSize STG 15,192(0,13) MVGHI 200(13),1 XC 208(8,13),208(13) MVGHI 216(13),2 LG 15,8(0,1) ; dest STG 15,224(0,13) LG 15,32(0,1) ; dictStart STG 15,232(0,13) LG 15,40(0,1) ; dictSize STG 15,240(0,13) LA 1,168(0,13) LG 15,@lit_462_452 ; LZ4_decompress_generic @@gen_label551 DS 0H BALR 14,15 @@gen_label552 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_462 DC F'248' @lit_462_452 DC AD($L$Z4_decompress_generic) DROP 12 * * DSECT for automatic variables in "LZ4_decompress_safe_forceExtDict" * (FUNCTION #462) * @AUTO#$L$Z4_decompress_safe_force$Ext$Dict DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_decompress_fast_extDict @LNAME482 DS 0H DC X'0000001B' DC C'LZ4_decompress_fast_extDict' DC X'00' $L$Z4_decompress_fast_ext$Dict DCCPRLG CINDEX=482,BASER=12,FRAME=248,EN* TRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME482 * ******* End of Prologue * * * *** return LZ4_decompress_generic(source, dest, 0, originalSiz\ * e, * *** endOnOutputSize, decode_full\ * _block, usingExtDict, * *** (BYTE*)dest, (const BYTE*)di\ * ctStart, dictSize); LG 15,0(0,1) ; source STG 15,168(0,13) LG 15,8(0,1) ; dest STG 15,176(0,13) XC 184(8,13),184(13) LGF 15,20(0,1) ; originalSize STG 15,192(0,13) XC 200(16,13),200(13) MVGHI 216(13),2 LG 15,8(0,1) ; dest STG 15,224(0,13) LG 15,24(0,1) ; dictStart STG 15,232(0,13) LG 15,32(0,1) ; dictSize STG 15,240(0,13) LA 1,168(0,13) LG 15,@lit_482_454 ; LZ4_decompress_generic @@gen_label553 DS 0H BALR 14,15 @@gen_label554 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_482 DC F'248' @lit_482_454 DC AD($L$Z4_decompress_generic) DROP 12 * * DSECT for automatic variables in "LZ4_decompress_fast_extDict" * (FUNCTION #482) * @AUTO#$L$Z4_decompress_fast_ext$Dict DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_decompress_safe_doubleDict @LNAME483 DS 0H DC X'0000001E' DC C'LZ4_decompress_safe_doubleDict' DC X'00' $L$Z4_decompress_safe_double$Dict DCCPRLG CINDEX=483,BASER=12,FRAME=248* ,ENTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME483 * ******* End of Prologue * * * *** return LZ4_decompress_generic(source, dest, compressedSize\ * , maxOutputSize, * *** endOnInputSize, decode_full_\ * block, usingExtDict, * *** (BYTE*)dest-prefixSize, (con\ * st BYTE*)dictStart, dictSize); LG 15,0(0,1) ; source STG 15,168(0,13) LG 15,8(0,1) ; dest STG 15,176(0,13) LGF 15,20(0,1) ; compressedSize STG 15,184(0,13) LGF 15,28(0,1) ; maxOutputSize STG 15,192(0,13) MVGHI 200(13),1 XC 208(8,13),208(13) MVGHI 216(13),2 LG 15,8(0,1) ; dest LG 2,32(0,1) ; prefixSize SGR 15,2 STG 15,224(0,13) LG 15,40(0,1) ; dictStart STG 15,232(0,13) LG 15,48(0,1) ; dictSize STG 15,240(0,13) LA 1,168(0,13) LG 15,@lit_483_456 ; LZ4_decompress_generic @@gen_label555 DS 0H BALR 14,15 @@gen_label556 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_483 DC F'248' @lit_483_456 DC AD($L$Z4_decompress_generic) DROP 12 * * DSECT for automatic variables in "LZ4_decompress_safe_doubleDict" * (FUNCTION #483) * @AUTO#$L$Z4_decompress_safe_double$Dict DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_decompress_fast_doubleDict @LNAME484 DS 0H DC X'0000001E' DC C'LZ4_decompress_fast_doubleDict' DC X'00' $L$Z4_decompress_fast_double$Dict DCCPRLG CINDEX=484,BASER=12,FRAME=248* ,ENTRY=NO,ARCH=ZARCH,LNAMEADDR=@LNAME484 * ******* End of Prologue * * * *** return LZ4_decompress_generic(source, dest, 0, originalSiz\ * e, * *** endOnOutputSize, decode_full\ * _block, usingExtDict, * *** (BYTE*)dest-prefixSize, (con\ * st BYTE*)dictStart, dictSize); LG 15,0(0,1) ; source STG 15,168(0,13) LG 15,8(0,1) ; dest STG 15,176(0,13) XC 184(8,13),184(13) LGF 15,20(0,1) ; originalSize STG 15,192(0,13) XC 200(16,13),200(13) MVGHI 216(13),2 LG 15,8(0,1) ; dest LG 2,24(0,1) ; prefixSize SGR 15,2 STG 15,224(0,13) LG 15,32(0,1) ; dictStart STG 15,232(0,13) LG 15,40(0,1) ; dictSize STG 15,240(0,13) LA 1,168(0,13) LG 15,@lit_484_458 ; LZ4_decompress_generic @@gen_label557 DS 0H BALR 14,15 @@gen_label558 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_484 DC F'248' @lit_484_458 DC AD($L$Z4_decompress_generic) DROP 12 * * DSECT for automatic variables in "LZ4_decompress_fast_doubleDict" * (FUNCTION #484) * @AUTO#$L$Z4_decompress_fast_double$Dict DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_createStreamDecode $L$Z4_create$Stream$Decode ALIAS X'D3E9F46D83998581A385E2A399858194C485* 83968485' @LNAME356 DS 0H DC X'00000016' DC C'LZ4_createStreamDecode' DC X'00' $L$Z4_create$Stream$Decode DCCPRLG CINDEX=356,BASER=12,FRAME=200,ENTRY=* YES,ARCH=ZARCH,LNAMEADDR=@LNAME356 * ******* End of Prologue * * * *** LZ4_streamDecode_t* lz4s = (LZ4_streamDecode_t*) rd_kafka_\ * mem_calloc(((void *)0), 1, sizeof(LZ4_streamDecode_t)); XC 176(8,13),176(13) MVGHI 184(13),1 MVGHI 192(13),32 LA 1,176(0,13) LG 15,@lit_356_460 ; rd_kafka_mem_calloc @@gen_label559 DS 0H BALR 14,15 @@gen_label560 DS 0H * *** { enum { LZ4_static_assert = 1/(int)(!!(((4 + ((sizeof(voi\ * d*)==16) ? 2 : 0) ) * sizeof(unsigned long long)) >= sizeof(LZ4_stre\ * amDecode_t_internal))) }; }; * *** return lz4s; * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_356 DC F'200' @lit_356_460 DC AD(rd_kafka_mem_calloc) DROP 12 * * DSECT for automatic variables in "LZ4_createStreamDecode" * (FUNCTION #356) * @AUTO#$L$Z4_create$Stream$Decode DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_freeStreamDecode $L$Z4_free$Stream$Decode ALIAS X'D3E9F46D86998585E2A399858194C485839684* 85' @LNAME357 DS 0H DC X'00000014' DC C'LZ4_freeStreamDecode' DC X'00' $L$Z4_free$Stream$Decode DCCPRLG CINDEX=357,BASER=12,FRAME=184,ENTRY=YE* S,ARCH=ZARCH,LNAMEADDR=@LNAME357 * ******* End of Prologue * * * *** if (LZ4_stream == ((void *)0)) { return 0; } LG 15,0(0,1) ; LZ4_stream LTGR 1,15 BNE @L364 LGHI 15,0 ; 0 B @ret_lab_357 DS 0D @FRAMESIZE_357 DC F'184' @lit_357_463 DC AD(rd_kafka_mem_free) @L364 DS 0H * *** rd_kafka_mem_free(((void *)0), LZ4_stream); XC 168(8,13),168(13) STG 15,176(0,13) LA 1,168(0,13) LG 15,@lit_357_463 ; rd_kafka_mem_free @@gen_label562 DS 0H BALR 14,15 @@gen_label563 DS 0H * *** return 0; LGHI 15,0 ; 0 * *** } @ret_lab_357 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_freeStreamDecode" * (FUNCTION #357) * @AUTO#$L$Z4_free$Stream$Decode DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_setStreamDecode $L$Z4_set$Stream$Decode ALIAS X'D3E9F46DA285A3E2A399858194C48583968485' @LNAME358 DS 0H DC X'00000013' DC C'LZ4_setStreamDecode' DC X'00' $L$Z4_set$Stream$Decode DCCPRLG CINDEX=358,BASER=0,FRAME=176,SAVEAREA=N* O,ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME358 * ******* End of Prologue * * * *** LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->in\ * ternal_donotuse; LG 15,0(0,1) ; LZ4_streamDecode * *** lz4sd->prefixSize = (size_t) dictSize; LGF 2,20(0,1) ; dictSize STG 2,24(0,15) ; offset of prefixSize in 0000012 * *** lz4sd->prefixEnd = (const BYTE*) dictionary + dictSize; LG 2,8(0,1) ; dictionary LGF 1,20(0,1) ; dictSize LA 1,0(1,2) STG 1,16(0,15) ; offset of prefixEnd in 0000012 * *** lz4sd->externalDict = ((void *)0); LGHI 1,0 ; 0 STG 1,0(0,15) ; lz4sd * *** lz4sd->extDictSize = 0; MVGHI 8(15),0 ; offset of extDictSize in 0000012 * *** return 1; LGHI 15,1 ; 1 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue * * DSECT for automatic variables in "LZ4_setStreamDecode" * (FUNCTION #358) * @AUTO#$L$Z4_set$Stream$Decode DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_decoderRingBufferSize $L$Z4_decoder$Ring$Buffer$Size ALIAS X'D3E9F46D84858396848599D9899587C2* A486868599E289A985' @LNAME359 DS 0H DC X'00000019' DC C'LZ4_decoderRingBufferSize' DC X'00' $L$Z4_decoder$Ring$Buffer$Size DCCPRLG CINDEX=359,BASER=12,FRAME=168,SA* VEAREA=NO,ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME359 * ******* End of Prologue * * * *** if (maxBlockSize < 0) return 0; LT 15,4(0,1) ; maxBlockSize BNL @L365 LGHI 15,0 ; 0 B @ret_lab_359 @L365 DS 0H * *** if (maxBlockSize > 0x7E000000) return 0; CFI 15,X'7E000000' BNH @L366 LGHI 15,0 ; 0 B @ret_lab_359 @L366 DS 0H * *** if (maxBlockSize < 16) maxBlockSize = 16; CHI 15,16 BNL @L367 LHI 15,16 ; 16 @L367 DS 0H * *** return (65536 + 14 + (maxBlockSize)); AFI 15,X'0001000E' LGFR 15,15 * *** } @ret_lab_359 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_decoderRingBufferSize" * (FUNCTION #359) * @AUTO#$L$Z4_decoder$Ring$Buffer$Size DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_decompress_safe_continue $L$Z4_decompress_safe_continue ALIAS X'D3E9F46D8485839694979985A2A26DA2* 8186856D839695A38995A485' @LNAME360 DS 0H DC X'0000001C' DC C'LZ4_decompress_safe_continue' DC X'00' $L$Z4_decompress_safe_continue DCCPRLG CINDEX=360,BASER=12,FRAME=232,EN* TRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME360 LGR 4,1 ; ptr to parm area * ******* End of Prologue * * * *** LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->in\ * ternal_donotuse; LG 15,8(0,4) ; source LG 2,16(0,4) ; dest L 1,28(0,4) ; compressedSize L 3,36(0,4) ; maxOutputSize LG 4,0(0,4) ; LZ4_streamDecode * *** int result; * *** * *** if (lz4sd->prefixSize == 0) { CLGHSI 24(4),0 BNE @L368 * *** * *** ((void)0); * *** result = LZ4_decompress_safe(source, dest, compressedS\ * ize, maxOutputSize); STG 15,176(0,13) STG 2,184(0,13) LGFR 15,1 STG 15,192(0,13) LGFR 15,3 STG 15,200(0,13) LA 1,176(0,13) LG 15,@lit_360_471 ; LZ4_decompress_safe @@gen_label568 DS 0H BALR 14,15 @@gen_label569 DS 0H * *** if (result <= 0) return result; LTR 15,15 BH @L369 LGFR 15,15 B @ret_lab_360 DS 0D @FRAMESIZE_360 DC F'232' @lit_360_471 DC AD($L$Z4_decompress_safe) @lit_360_472 DC AD($L$Z4_decompress_safe_with$Prefix64k) @lit_360_473 DC AD($L$Z4_decompress_safe_with$Small$Prefix) @lit_360_474 DC AD($L$Z4_decompress_safe_double$Dict) @lit_360_475 DC AD($L$Z4_decompress_safe_force$Ext$Dict) @L369 DS 0H * *** lz4sd->prefixSize = (size_t)result; LGFR 1,15 STG 1,24(0,4) ; offset of prefixSize in 0000012 * *** lz4sd->prefixEnd = (BYTE*)dest + result; LGFR 1,15 LA 1,0(1,2) STG 1,16(0,4) ; offset of prefixEnd in 0000012 * *** } else if (lz4sd->prefixEnd == (BYTE*)dest) { B @L370 @L368 DS 0H LG 5,16(0,4) ; offset of prefixEnd in 0000012 CGR 5,2 BNE @L371 * *** * *** if (lz4sd->prefixSize >= 64 *(1 <<10) - 1) CLGHSI 24(4),65535 BL @L372 * *** result = LZ4_decompress_safe_withPrefix64k(source,\ * dest, compressedSize, maxOutputSize); STG 15,176(0,13) STG 2,184(0,13) LGFR 15,1 STG 15,192(0,13) LGFR 15,3 STG 15,200(0,13) LA 1,176(0,13) LG 15,@lit_360_472 ; LZ4_decompress_safe_withPrefix64k @@gen_label573 DS 0H BALR 14,15 @@gen_label574 DS 0H B @L373 * *** else if (lz4sd->extDictSize == 0) @L372 DS 0H CLGHSI 8(4),0 BNE @L374 * *** result = LZ4_decompress_safe_withSmallPrefix(sourc\ * e, dest, compressedSize, maxOutputSize, * *** lz4sd\ * ->prefixSize); STG 15,176(0,13) STG 2,184(0,13) LGFR 15,1 STG 15,192(0,13) LGFR 15,3 STG 15,200(0,13) LG 15,24(0,4) STG 15,208(0,13) LA 1,176(0,13) LG 15,@lit_360_473 ; LZ4_decompress_safe_withSmallPrefix @@gen_label576 DS 0H BALR 14,15 @@gen_label577 DS 0H B @L373 * *** else @L374 DS 0H * *** result = LZ4_decompress_safe_doubleDict(source, de\ * st, compressedSize, maxOutputSize, * *** lz4sd->pre\ * fixSize, lz4sd->externalDict, lz4sd->extDictSize); STG 15,176(0,13) STG 2,184(0,13) LGFR 15,1 STG 15,192(0,13) LGFR 15,3 STG 15,200(0,13) LG 15,24(0,4) STG 15,208(0,13) LG 15,0(0,4) STG 15,216(0,13) LG 15,8(0,4) STG 15,224(0,13) LA 1,176(0,13) LG 15,@lit_360_474 ; LZ4_decompress_safe_doubleDict @@gen_label578 DS 0H BALR 14,15 @@gen_label579 DS 0H @L375 DS 0H * *** if (result <= 0) return result; @L373 DS 0H LTR 15,15 BH @L376 LGFR 15,15 B @ret_lab_360 @L376 DS 0H * *** lz4sd->prefixSize += (size_t)result; LGFR 1,15 ALG 1,24(0,4) STG 1,24(0,4) * *** lz4sd->prefixEnd += result; LG 1,16(0,4) LGFR 2,15 LA 1,0(2,1) STG 1,16(0,4) * *** } else { B @L370 @L371 DS 0H * *** * *** lz4sd->extDictSize = lz4sd->prefixSize; LG 5,24(0,4) ; offset of prefixSize in 0000012 STG 5,8(0,4) ; offset of extDictSize in 0000012 * *** lz4sd->externalDict = lz4sd->prefixEnd - lz4sd->extDic\ * tSize; LG 5,16(0,4) ; offset of prefixEnd in 0000012 LG 6,8(0,4) ; offset of extDictSize in 0000012 SGR 5,6 STG 5,0(0,4) ; lz4sd * *** result = LZ4_decompress_safe_forceExtDict(source, dest\ * , compressedSize, maxOutputSize, * *** lz4sd->exter\ * nalDict, lz4sd->extDictSize); STG 15,176(0,13) STG 2,184(0,13) LGFR 15,1 STG 15,192(0,13) LGFR 15,3 STG 15,200(0,13) LG 15,0(0,4) STG 15,208(0,13) LG 15,8(0,4) STG 15,216(0,13) LA 1,176(0,13) LG 15,@lit_360_475 ; LZ4_decompress_safe_forceExtDict @@gen_label581 DS 0H BALR 14,15 @@gen_label582 DS 0H * *** if (result <= 0) return result; LTR 15,15 BH @L378 LGFR 15,15 B @ret_lab_360 @L378 DS 0H * *** lz4sd->prefixSize = (size_t)result; LGFR 1,15 STG 1,24(0,4) ; offset of prefixSize in 0000012 * *** lz4sd->prefixEnd = (BYTE*)dest + result; LGFR 1,15 LA 1,0(1,2) STG 1,16(0,4) ; offset of prefixEnd in 0000012 * *** } @L377 DS 0H * *** * *** return result; @L370 DS 0H LGFR 15,15 * *** } @ret_lab_360 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_decompress_safe_continue" * (FUNCTION #360) * @AUTO#$L$Z4_decompress_safe_continue DSECT DS XL168 $L$Z4_decompress_safe_continue#result#0 DS 1F ; result * @CODE CSECT * * * * ....... start of LZ4_decompress_fast_continue $L$Z4_decompress_fast_continue ALIAS X'D3E9F46D8485839694979985A2A26D86* 81A2A36D839695A38995A485' @LNAME380 DS 0H DC X'0000001C' DC C'LZ4_decompress_fast_continue' DC X'00' $L$Z4_decompress_fast_continue DCCPRLG CINDEX=380,BASER=12,FRAME=224,EN* TRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME380 * ******* End of Prologue * * * *** LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->in\ * ternal_donotuse; LG 15,8(0,1) ; source LG 2,16(0,1) ; dest L 3,28(0,1) ; originalSize LG 4,0(0,1) ; LZ4_streamDecode * *** int result; * *** ((void)0); * *** * *** if (lz4sd->prefixSize == 0) { CLGHSI 24(4),0 BNE @L379 * *** ((void)0); * *** result = LZ4_decompress_fast(source, dest, originalSiz\ * e); STG 15,176(0,13) STG 2,184(0,13) LGFR 15,3 STG 15,192(0,13) LA 1,176(0,13) LG 15,@lit_380_477 ; LZ4_decompress_fast @@gen_label585 DS 0H BALR 14,15 @@gen_label586 DS 0H * *** if (result <= 0) return result; LTR 15,15 BH @L380 LGFR 15,15 B @ret_lab_380 DS 0D @FRAMESIZE_380 DC F'224' @lit_380_477 DC AD($L$Z4_decompress_fast) @lit_380_479 DC AD($L$Z4_decompress_fast_double$Dict) @lit_380_480 DC AD($L$Z4_decompress_fast_ext$Dict) @L380 DS 0H * *** lz4sd->prefixSize = (size_t)originalSize; LGFR 1,3 STG 1,24(0,4) ; offset of prefixSize in 0000012 * *** lz4sd->prefixEnd = (BYTE*)dest + originalSize; LGFR 1,3 LA 1,0(1,2) STG 1,16(0,4) ; offset of prefixEnd in 0000012 * *** } else if (lz4sd->prefixEnd == (BYTE*)dest) { B @L381 @L379 DS 0H LG 1,16(0,4) ; offset of prefixEnd in 0000012 CGR 1,2 BNE @L382 * *** if (lz4sd->prefixSize >= 64 *(1 <<10) - 1 || lz4sd->ex\ * tDictSize == 0) CLGHSI 24(4),65535 BNL @L384 CLGHSI 8(4),0 BNE @L383 @L384 DS 0H * *** result = LZ4_decompress_fast(source, dest, origina\ * lSize); STG 15,176(0,13) STG 2,184(0,13) LGFR 15,3 STG 15,192(0,13) LA 1,176(0,13) LG 15,@lit_380_477 ; LZ4_decompress_fast @@gen_label591 DS 0H BALR 14,15 @@gen_label592 DS 0H B @L385 * *** else @L383 DS 0H * *** result = LZ4_decompress_fast_doubleDict(source, de\ * st, originalSize, * *** lz4sd->pre\ * fixSize, lz4sd->externalDict, lz4sd->extDictSize); STG 15,176(0,13) STG 2,184(0,13) LGFR 15,3 STG 15,192(0,13) LG 15,24(0,4) STG 15,200(0,13) LG 15,0(0,4) STG 15,208(0,13) LG 15,8(0,4) STG 15,216(0,13) LA 1,176(0,13) LG 15,@lit_380_479 ; LZ4_decompress_fast_doubleDict @@gen_label593 DS 0H BALR 14,15 @@gen_label594 DS 0H @L385 DS 0H * *** if (result <= 0) return result; LTR 15,15 BH @L386 LGFR 15,15 B @ret_lab_380 @L386 DS 0H * *** lz4sd->prefixSize += (size_t)originalSize; LGFR 1,3 ALG 1,24(0,4) STG 1,24(0,4) * *** lz4sd->prefixEnd += originalSize; LG 1,16(0,4) LGFR 2,3 LA 1,0(2,1) STG 1,16(0,4) * *** } else { B @L381 @L382 DS 0H * *** lz4sd->extDictSize = lz4sd->prefixSize; LG 1,24(0,4) ; offset of prefixSize in 0000012 STG 1,8(0,4) ; offset of extDictSize in 0000012 * *** lz4sd->externalDict = lz4sd->prefixEnd - lz4sd->extDic\ * tSize; LG 1,16(0,4) ; offset of prefixEnd in 0000012 LG 5,8(0,4) ; offset of extDictSize in 0000012 SGR 1,5 STG 1,0(0,4) ; lz4sd * *** result = LZ4_decompress_fast_extDict(source, dest, ori\ * ginalSize, * *** lz4sd->externalDi\ * ct, lz4sd->extDictSize); STG 15,176(0,13) STG 2,184(0,13) LGFR 15,3 STG 15,192(0,13) LG 15,0(0,4) STG 15,200(0,13) LG 15,8(0,4) STG 15,208(0,13) LA 1,176(0,13) LG 15,@lit_380_480 ; LZ4_decompress_fast_extDict @@gen_label596 DS 0H BALR 14,15 @@gen_label597 DS 0H * *** if (result <= 0) return result; LTR 15,15 BH @L388 LGFR 15,15 B @ret_lab_380 @L388 DS 0H * *** lz4sd->prefixSize = (size_t)originalSize; LGFR 1,3 STG 1,24(0,4) ; offset of prefixSize in 0000012 * *** lz4sd->prefixEnd = (BYTE*)dest + originalSize; LGFR 1,3 LA 1,0(1,2) STG 1,16(0,4) ; offset of prefixEnd in 0000012 * *** } @L387 DS 0H * *** * *** return result; @L381 DS 0H LGFR 15,15 * *** } @ret_lab_380 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_decompress_fast_continue" * (FUNCTION #380) * @AUTO#$L$Z4_decompress_fast_continue DSECT DS XL168 $L$Z4_decompress_fast_continue#result#0 DS 1F ; result * @CODE CSECT * * * * ....... start of LZ4_decompress_safe_usingDict $L$Z4_decompress_safe_using$Dict ALIAS X'D3E9F46D8485839694979985A2A26D* A28186856DA4A2899587C48983A3' @LNAME361 DS 0H DC X'0000001D' DC C'LZ4_decompress_safe_usingDict' DC X'00' $L$Z4_decompress_safe_using$Dict DCCPRLG CINDEX=361,BASER=12,FRAME=216,* ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME361 LGR 5,1 ; ptr to parm area * ******* End of Prologue * * * *** if (dictSize==0) LG 15,0(0,5) ; source LG 1,8(0,5) ; dest L 2,20(0,5) ; compressedSize L 3,28(0,5) ; maxOutputSize LT 4,44(0,5) ; dictSize BNE @L389 * *** return LZ4_decompress_safe(source, dest, compressedSiz\ * e, maxOutputSize); STG 15,168(0,13) STG 1,176(0,13) LGFR 15,2 STG 15,184(0,13) LGFR 15,3 STG 15,192(0,13) LA 1,168(0,13) LG 15,@lit_361_482 ; LZ4_decompress_safe @@gen_label600 DS 0H BALR 14,15 @@gen_label601 DS 0H LGFR 15,15 B @ret_lab_361 DS 0D @FRAMESIZE_361 DC F'216' @lit_361_482 DC AD($L$Z4_decompress_safe) @lit_361_483 DC AD($L$Z4_decompress_safe_with$Prefix64k) @lit_361_484 DC AD($L$Z4_decompress_safe_with$Small$Prefix) @lit_361_485 DC AD($L$Z4_decompress_safe_force$Ext$Dict) @L389 DS 0H * *** if (dictStart+dictSize == dest) { LG 5,32(0,5) ; dictStart LGFR 6,4 LA 6,0(6,5) CGR 6,1 BNE @L390 * *** if (dictSize >= 64 *(1 <<10) - 1) { CFI 4,X'0000FFFF' BL @L391 * *** return LZ4_decompress_safe_withPrefix64k(source, d\ * est, compressedSize, maxOutputSize); STG 15,168(0,13) STG 1,176(0,13) LGFR 15,2 STG 15,184(0,13) LGFR 15,3 STG 15,192(0,13) LA 1,168(0,13) LG 15,@lit_361_483 ; LZ4_decompress_safe_withPrefix64k @@gen_label604 DS 0H BALR 14,15 @@gen_label605 DS 0H LGFR 15,15 B @ret_lab_361 * *** } @L391 DS 0H * *** ((void)0); * *** return LZ4_decompress_safe_withSmallPrefix(source, des\ * t, compressedSize, maxOutputSize, (size_t)dictSize); STG 15,168(0,13) STG 1,176(0,13) LGFR 15,2 STG 15,184(0,13) LGFR 15,3 STG 15,192(0,13) LGFR 15,4 STG 15,200(0,13) LA 1,168(0,13) LG 15,@lit_361_484 ; LZ4_decompress_safe_withSmallPrefix @@gen_label606 DS 0H BALR 14,15 @@gen_label607 DS 0H LGFR 15,15 B @ret_lab_361 * *** } @L390 DS 0H * *** ((void)0); * *** return LZ4_decompress_safe_forceExtDict(source, dest, comp\ * ressedSize, maxOutputSize, dictStart, (size_t)dictSize); STG 15,168(0,13) STG 1,176(0,13) LGFR 15,2 STG 15,184(0,13) LGFR 15,3 STG 15,192(0,13) STG 5,200(0,13) LGFR 15,4 STG 15,208(0,13) LA 1,168(0,13) LG 15,@lit_361_485 ; LZ4_decompress_safe_forceExtDict @@gen_label608 DS 0H BALR 14,15 @@gen_label609 DS 0H LGFR 15,15 * *** } @ret_lab_361 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_decompress_safe_usingDict" * (FUNCTION #361) * @AUTO#$L$Z4_decompress_safe_using$Dict DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_decompress_fast_usingDict $L$Z4_decompress_fast_using$Dict ALIAS X'D3E9F46D8485839694979985A2A26D* 8681A2A36DA4A2899587C48983A3' @LNAME381 DS 0H DC X'0000001D' DC C'LZ4_decompress_fast_usingDict' DC X'00' $L$Z4_decompress_fast_using$Dict DCCPRLG CINDEX=381,BASER=12,FRAME=208,* ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME381 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * * *** if (dictSize==0 || dictStart+dictSize == dest) LG 15,8(0,2) ; dest LT 1,36(0,2) ; dictSize BE @L393 LG 3,24(0,2) ; dictStart LGFR 4,1 LA 4,0(4,3) CGR 4,15 BNE @L392 @L393 DS 0H * *** return LZ4_decompress_fast(source, dest, originalSize)\ * ; LG 1,0(0,2) ; source STG 1,168(0,13) STG 15,176(0,13) LGF 15,20(0,2) ; originalSize STG 15,184(0,13) LA 1,168(0,13) LG 15,@lit_381_487 ; LZ4_decompress_fast @@gen_label612 DS 0H BALR 14,15 @@gen_label613 DS 0H LGFR 15,15 B @ret_lab_381 DS 0D @FRAMESIZE_381 DC F'208' @lit_381_487 DC AD($L$Z4_decompress_fast) @lit_381_488 DC AD($L$Z4_decompress_fast_ext$Dict) @L392 DS 0H * *** ((void)0); * *** return LZ4_decompress_fast_extDict(source, dest, originalS\ * ize, dictStart, (size_t)dictSize); LG 4,0(0,2) ; source STG 4,168(0,13) STG 15,176(0,13) LGF 15,20(0,2) ; originalSize STG 15,184(0,13) STG 3,192(0,13) LGFR 15,1 STG 15,200(0,13) LA 1,168(0,13) LG 15,@lit_381_488 ; LZ4_decompress_fast_extDict @@gen_label614 DS 0H BALR 14,15 @@gen_label615 DS 0H LGFR 15,15 * *** } @ret_lab_381 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "LZ4_decompress_fast_usingDict" * (FUNCTION #381) * @AUTO#$L$Z4_decompress_fast_using$Dict DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_compress_limitedOutput $L$Z4_compress_limited$Output ALIAS X'D3E9F46D839694979985A2A26D9389948* 9A38584D6A4A397A4A3' @LNAME366 DS 0H DC X'0000001A' DC C'LZ4_compress_limitedOutput' DC X'00' $L$Z4_compress_limited$Output DCCPRLG CINDEX=366,BASER=12,FRAME=200,ENT* RY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME366 * ******* End of Prologue * * * *** return LZ4_compress_default(source, dest, inputSize, maxOu\ * tputSize); LG 15,0(0,1) ; source STG 15,168(0,13) LG 15,8(0,1) ; dest STG 15,176(0,13) LGF 15,20(0,1) ; inputSize STG 15,184(0,13) LGF 15,28(0,1) ; maxOutputSize STG 15,192(0,13) LA 1,168(0,13) LG 15,@lit_366_490 ; LZ4_compress_default @@gen_label616 DS 0H BALR 14,15 @@gen_label617 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_366 DC F'200' @lit_366_490 DC AD($L$Z4_compress_default) DROP 12 * * DSECT for automatic variables in "LZ4_compress_limitedOutput" * (FUNCTION #366) * @AUTO#$L$Z4_compress_limited$Output DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_compress $L$Z4_compress ALIAS X'D3E9F46D839694979985A2A2' @LNAME365 DS 0H DC X'0000000C' DC C'LZ4_compress' DC X'00' $L$Z4_compress DCCPRLG CINDEX=365,BASER=12,FRAME=200,ENTRY=YES,ARCH=ZAR* CH,LNAMEADDR=@LNAME365 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * * *** return LZ4_compress_default(src, dest, srcSize, LZ4_compre\ * ssBound(srcSize)); LGF 15,20(0,2) ; srcSize STG 15,168(0,13) LA 1,168(0,13) LG 15,@lit_365_492 ; LZ4_compressBound @@gen_label618 DS 0H BALR 14,15 @@gen_label619 DS 0H LG 1,0(0,2) ; src STG 1,168(0,13) LG 1,8(0,2) ; dest STG 1,176(0,13) LGF 1,20(0,2) ; srcSize STG 1,184(0,13) LGFR 15,15 STG 15,192(0,13) LA 1,168(0,13) LG 15,@lit_365_493 ; LZ4_compress_default @@gen_label620 DS 0H BALR 14,15 @@gen_label621 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_365 DC F'200' @lit_365_492 DC AD($L$Z4_compress$Bound) @lit_365_493 DC AD($L$Z4_compress_default) DROP 12 * * DSECT for automatic variables in "LZ4_compress" * (FUNCTION #365) * @AUTO#$L$Z4_compress DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_compress_limitedOutput_withState $L$Z4_compress_limited$Output_with$State ALIAS X'D3E9F46D839694979985A2* A26D93899489A38584D6A4A397A4A36DA689A388E2A381A385' @LNAME368 DS 0H DC X'00000024' DC C'LZ4_compress_limitedOutput_withS' DC C'tate' DC X'00' $L$Z4_compress_limited$Output_with$State DCCPRLG CINDEX=368,BASER=12,FR* AME=216,ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME368 * ******* End of Prologue * * * *** return LZ4_compress_fast_extState(state, src, dst, srcSize\ * , dstSize, 1); LG 15,0(0,1) ; state STG 15,168(0,13) LG 15,8(0,1) ; src STG 15,176(0,13) LG 15,16(0,1) ; dst STG 15,184(0,13) LGF 15,28(0,1) ; srcSize STG 15,192(0,13) LGF 15,36(0,1) ; dstSize STG 15,200(0,13) MVGHI 208(13),1 LA 1,168(0,13) LG 15,@lit_368_495 ; LZ4_compress_fast_extState @@gen_label622 DS 0H BALR 14,15 @@gen_label623 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_368 DC F'216' @lit_368_495 DC AD($L$Z4_compress_fast_ext$State) DROP 12 * * DSECT for automatic variables in "LZ4_compress_limitedOutput_withS * tate" * (FUNCTION #368) * @AUTO#$L$Z4_compress_limited$Output_with$State DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_compress_withState $L$Z4_compress_with$State ALIAS X'D3E9F46D839694979985A2A26DA689A388E2A* 381A385' @LNAME367 DS 0H DC X'00000016' DC C'LZ4_compress_withState' DC X'00' $L$Z4_compress_with$State DCCPRLG CINDEX=367,BASER=12,FRAME=216,ENTRY=Y* ES,ARCH=ZARCH,LNAMEADDR=@LNAME367 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * * *** return LZ4_compress_fast_extState(state, src, dst, srcSize\ * , LZ4_compressBound(srcSize), 1); LGF 15,28(0,2) ; srcSize STG 15,168(0,13) LA 1,168(0,13) LG 15,@lit_367_497 ; LZ4_compressBound @@gen_label624 DS 0H BALR 14,15 @@gen_label625 DS 0H LG 1,0(0,2) ; state STG 1,168(0,13) LG 1,8(0,2) ; src STG 1,176(0,13) LG 1,16(0,2) ; dst STG 1,184(0,13) LGF 1,28(0,2) ; srcSize STG 1,192(0,13) LGFR 15,15 STG 15,200(0,13) MVGHI 208(13),1 LA 1,168(0,13) LG 15,@lit_367_498 ; LZ4_compress_fast_extState @@gen_label626 DS 0H BALR 14,15 @@gen_label627 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_367 DC F'216' @lit_367_497 DC AD($L$Z4_compress$Bound) @lit_367_498 DC AD($L$Z4_compress_fast_ext$State) DROP 12 * * DSECT for automatic variables in "LZ4_compress_withState" * (FUNCTION #367) * @AUTO#$L$Z4_compress_with$State DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_compress_limitedOutput_continue $L$Z4_compress_limited$Output_continue ALIAS X'D3E9F46D839694979985A2A2* 6D93899489A38584D6A4A397A4A36D839695A38995A485' @LNAME370 DS 0H DC X'00000023' DC C'LZ4_compress_limitedOutput_conti' DC C'nue' DC X'00' $L$Z4_compress_limited$Output_continue DCCPRLG CINDEX=370,BASER=12,FRAM* E=216,ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME370 * ******* End of Prologue * * * *** return LZ4_compress_fast_continue(LZ4_stream, src, dst, sr\ * cSize, dstCapacity, 1); LG 15,0(0,1) ; LZ4_stream STG 15,168(0,13) LG 15,8(0,1) ; src STG 15,176(0,13) LG 15,16(0,1) ; dst STG 15,184(0,13) LGF 15,28(0,1) ; srcSize STG 15,192(0,13) LGF 15,36(0,1) ; dstCapacity STG 15,200(0,13) MVGHI 208(13),1 LA 1,168(0,13) LG 15,@lit_370_500 ; LZ4_compress_fast_continue @@gen_label628 DS 0H BALR 14,15 @@gen_label629 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_370 DC F'216' @lit_370_500 DC AD($L$Z4_compress_fast_continue) DROP 12 * * DSECT for automatic variables in "LZ4_compress_limitedOutput_conti * nue" * (FUNCTION #370) * @AUTO#$L$Z4_compress_limited$Output_continue DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_compress_continue $L$Z4_compress_continue ALIAS X'D3E9F46D839694979985A2A26D839695A38995A* 485' @LNAME369 DS 0H DC X'00000015' DC C'LZ4_compress_continue' DC X'00' $L$Z4_compress_continue DCCPRLG CINDEX=369,BASER=12,FRAME=216,ENTRY=YES* ,ARCH=ZARCH,LNAMEADDR=@LNAME369 LGR 2,1 ; ptr to parm area * ******* End of Prologue * * * *** return LZ4_compress_fast_continue(LZ4_stream, source, dest\ * , inputSize, LZ4_compressBound(inputSize), 1); LGF 15,28(0,2) ; inputSize STG 15,168(0,13) LA 1,168(0,13) LG 15,@lit_369_502 ; LZ4_compressBound @@gen_label630 DS 0H BALR 14,15 @@gen_label631 DS 0H LG 1,0(0,2) ; LZ4_stream STG 1,168(0,13) LG 1,8(0,2) ; source STG 1,176(0,13) LG 1,16(0,2) ; dest STG 1,184(0,13) LGF 1,28(0,2) ; inputSize STG 1,192(0,13) LGFR 15,15 STG 15,200(0,13) MVGHI 208(13),1 LA 1,168(0,13) LG 15,@lit_369_503 ; LZ4_compress_fast_continue @@gen_label632 DS 0H BALR 14,15 @@gen_label633 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_369 DC F'216' @lit_369_502 DC AD($L$Z4_compress$Bound) @lit_369_503 DC AD($L$Z4_compress_fast_continue) DROP 12 * * DSECT for automatic variables in "LZ4_compress_continue" * (FUNCTION #369) * @AUTO#$L$Z4_compress_continue DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_uncompress $L$Z4_uncompress ALIAS X'D3E9F46DA495839694979985A2A2' @LNAME371 DS 0H DC X'0000000E' DC C'LZ4_uncompress' DC X'00' $L$Z4_uncompress DCCPRLG CINDEX=371,BASER=12,FRAME=192,ENTRY=YES,ARCH=Z* ARCH,LNAMEADDR=@LNAME371 * ******* End of Prologue * * * *** return LZ4_decompress_fast(source, dest, outputSize); LG 15,0(0,1) ; source STG 15,168(0,13) LG 15,8(0,1) ; dest STG 15,176(0,13) LGF 15,20(0,1) ; outputSize STG 15,184(0,13) LA 1,168(0,13) LG 15,@lit_371_505 ; LZ4_decompress_fast @@gen_label634 DS 0H BALR 14,15 @@gen_label635 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_371 DC F'192' @lit_371_505 DC AD($L$Z4_decompress_fast) DROP 12 * * DSECT for automatic variables in "LZ4_uncompress" * (FUNCTION #371) * @AUTO#$L$Z4_uncompress DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_uncompress_unknownOutputSize $L$Z4_uncompress_unknown$Output$Size ALIAS X'D3E9F46DA495839694979985A2* A26DA495929596A695D6A4A397A4A3E289A985' @LNAME372 DS 0H DC X'00000020' DC C'LZ4_uncompress_unknownOutputSize' DC X'00' $L$Z4_uncompress_unknown$Output$Size DCCPRLG CINDEX=372,BASER=12,FRAME=* 200,ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME372 * ******* End of Prologue * * * *** return LZ4_decompress_safe(source, dest, isize, maxOutputS\ * ize); LG 15,0(0,1) ; source STG 15,168(0,13) LG 15,8(0,1) ; dest STG 15,176(0,13) LGF 15,20(0,1) ; isize STG 15,184(0,13) LGF 15,28(0,1) ; maxOutputSize STG 15,192(0,13) LA 1,168(0,13) LG 15,@lit_372_507 ; LZ4_decompress_safe @@gen_label636 DS 0H BALR 14,15 @@gen_label637 DS 0H LGFR 15,15 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_372 DC F'200' @lit_372_507 DC AD($L$Z4_decompress_safe) DROP 12 * * DSECT for automatic variables in "LZ4_uncompress_unknownOutputSize" * (FUNCTION #372) * @AUTO#$L$Z4_uncompress_unknown$Output$Size DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_sizeofStreamState $L$Z4_sizeof$Stream$State ALIAS X'D3E9F46DA289A9859686E2A399858194E2A38* 1A385' @LNAME374 DS 0H DC X'00000015' DC C'LZ4_sizeofStreamState' DC X'00' $L$Z4_sizeof$Stream$State DCCPRLG CINDEX=374,BASER=0,FRAME=168,SAVEAREA* =NO,ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME374 * ******* End of Prologue * * LGHI 15,16416 ; 16416 * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue * * DSECT for automatic variables in "LZ4_sizeofStreamState" * (FUNCTION #374) * @AUTO#$L$Z4_sizeof$Stream$State DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_resetStreamState $L$Z4_reset$Stream$State ALIAS X'D3E9F46D9985A285A3E2A399858194E2A381A3* 85' @LNAME375 DS 0H DC X'00000014' DC C'LZ4_resetStreamState' DC X'00' $L$Z4_reset$Stream$State DCCPRLG CINDEX=375,BASER=12,FRAME=176,ENTRY=YE* S,ARCH=ZARCH,LNAMEADDR=@LNAME375 * ******* End of Prologue * * * *** (void)inputBuffer; * *** LZ4_resetStream((LZ4_stream_t*)state); LG 15,0(0,1) ; state STG 15,168(0,13) LA 1,168(0,13) LG 15,@lit_375_510 ; LZ4_resetStream @@gen_label638 DS 0H BALR 14,15 @@gen_label639 DS 0H * *** return 0; LGHI 15,0 ; 0 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_375 DC F'176' @lit_375_510 DC AD($L$Z4_reset$Stream) DROP 12 * * DSECT for automatic variables in "LZ4_resetStreamState" * (FUNCTION #375) * @AUTO#$L$Z4_reset$Stream$State DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_create $L$Z4_create ALIAS X'D3E9F46D83998581A385' @LNAME373 DS 0H DC X'0000000A' DC C'LZ4_create' DC X'00' $L$Z4_create DCCPRLG CINDEX=373,BASER=12,FRAME=168,ENTRY=YES,ARCH=ZARCH* ,LNAMEADDR=@LNAME373 * ******* End of Prologue * * * *** (void)inputBuffer; * *** return LZ4_createStream(); LG 15,@lit_373_513 ; LZ4_createStream @@gen_label640 DS 0H BALR 14,15 @@gen_label641 DS 0H * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DS 0D @FRAMESIZE_373 DC F'168' @lit_373_513 DC AD($L$Z4_create$Stream) DROP 12 * * DSECT for automatic variables in "LZ4_create" * (FUNCTION #373) * @AUTO#$L$Z4_create DSECT DS XL168 * @CODE CSECT * * * * ....... start of LZ4_slideInputBuffer $L$Z4_slide$Input$Buffer ALIAS X'D3E9F46DA293898485C99597A4A3C2A4868685* 99' @LNAME376 DS 0H DC X'00000014' DC C'LZ4_slideInputBuffer' DC X'00' $L$Z4_slide$Input$Buffer DCCPRLG CINDEX=376,BASER=0,FRAME=168,SAVEAREA=* NO,ENTRY=YES,ARCH=ZARCH,LNAMEADDR=@LNAME376 * ******* End of Prologue * * * *** * *** return (char *)(uptrval)((LZ4_stream_t*)state)->internal_d\ * onotuse.dictionary; LG 15,0(0,1) ; state LGHI 1,16392 ; 16392 LG 15,0(1,15) ; offset of dictionary in LZ4_stream_t_inter* nal * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue * * DSECT for automatic variables in "LZ4_slideInputBuffer" * (FUNCTION #376) * @AUTO#$L$Z4_slide$Input$Buffer DSECT DS XL168 * @CODE CSECT @@STATIC ALIAS X'7C93A9F450' @@STATIC DXD 64D * * Non-Re-Entrant Data Section * @DATA CSECT @DATA RMODE ANY @DATA AMODE ANY $L$Z4_min$Length DC X'0000000D' .... inc32table DC 4X'00' DC X'00000001000000020000000100000000' ................ DC X'000000040000000400000004' ............ dec64table DC 12X'00' DC X'FFFFFFFFFFFFFFFC0000000100000002' ................ DC X'00000003' .... @@T212 DC X'07000100020001000300010002000100' ................ DC X'04000100020001000300010002000100' ................ DC X'05000100020001000300010002000100' ................ DC X'04000100020001000300010002000100' ................ DC X'06000100020001000300010002000100' ................ DC X'04000100020001000300010002000100' ................ DC X'05000100020001000300010002000100' ................ DC X'040001000200010003000100020001' ............... DC 1X'00' $L$Z4_64$Klimit DC X'0001000B' .... $L$Z4_skip$Trigger DC X'00000006' .... @strings@ DS 0H DC X'F14BF94BF300' 1.9.3. * * * Re-entrant Data Initialization Section * @@INIT@ ALIAS C'@lz4:' @@INIT@ CSECT @@INIT@ AMODE ANY @@INIT@ RMODE ANY DC XL1'5' DC AL3(0) DC AL4(288) DC 4X'00' DC Q(@@STATIC) DC X'00000000' DC X'00000001' DC X'00000000' DC X'000000FF' DC X'0102039C09867F978D8E0B0C0D0E0F10' .....f.p........ DC X'1112139D8508871819928F1C1D1E1F80' ....e.g..k...... DC X'818283840A171B88898A8B8C05060790' abcd...hi....... DC X'9116939495960498999A9B14159E1A20' j.lmno.qr....... DC X'A0E2E4E0E1E3E5E7F1A22E3C282B7C26' .SU..TVX1s...... DC X'E9EAEBE8EDEEEFECDF21242A293B5E2D' Z..Y............ DC X'2FC2C4C0C1C3C5C7D1A62C255F3E3FF8' .BD.ACEGJw.....8 DC X'C9CACBC8CDCECFCC603A2340273D22D8' I..H...........Q DC X'616263646566676869ABBBF0FDFEB1B0' ...........0.... DC X'6A6B6C6D6E6F707172AABAE6B8C6A4B5' ...........W.Fu. DC X'7E737475767778797AA1BFD05BDEAEAC' ................ DC X'A3A5B7A9A7B6BCBDBEDDA8AF5DB4D77B' tv.zx.....y...P. DC X'414243444546474849ADF4F6F2F3F57D' ..........46235. DC X'4A4B4C4D4E4F505152B9FBFCF9FAFF5C' ............9... DC X'F7535455565758595AB2D4D6D2D3D530' 7.........MOKLN. DC X'313233343536373839B3DBDCD9DA9F40' ............R... * DC XL1'5' DC AL3(0) DC AL4(480) DC 4X'00' DC Q(@@STATIC) DC X'00000000' DC X'00000101' DC X'00000000' DC X'000000A0' DC X'010203372D2E2F1605150B0C0D0E0F10' ................ DC X'1112133C3D322618193F271C1D1E1F40' ................ DC X'5A7F7B5B6C507D4D5D5C4E6B604B61F0' ...............0 DC X'F1F2F3F4F5F6F7F8F97A5E4C7E6E6F7C' 123456789....... DC X'C1C2C3C4C5C6C7C8C9D1D2D3D4D5D6D7' ABCDEFGHIJKLMNOP DC X'D8D9E2E3E4E5E6E7E8E9ADE0BD5F6D79' QRSTUVWXYZ...... DC X'81828384858687888991929394959697' abcdefghijklmnop DC X'9899A2A3A4A5A6A7A8A9C04FD0A10720' qrstuvwxyz...... DC X'2122232425061728292A2B2C090A1B30' ................ DC X'311A333435360838393A3B04143EFF80' ................ * DC XL1'5' DC AL3(0) DC AL4(520) DC 4X'00' DC Q(@@STATIC) DC X'00000000' DC X'000001C0' DC X'00000000' DC X'00000001' DC X'8A40404040404040' ........ * DC XL1'5' DC AL3(0) DC AL4(0) DC 4X'00' DC Q(@@STATIC) DC X'00000000' DC X'000001E0' DC X'00000000' DC X'00000001' DC X'8B40404040404040' ........ * END
code/core/expression/src/main/antlr/com/castlemock/core/expression/Expression.g4
keroberos99/castlemock
0
3910
grammar Expression; expression : '${' type=expressionName ('(' (WS+)? (arguments+=argument (',' (WS+)? arguments+=argument )*)? ')')? '}' ; expressionName : value=(CHAR | DIGIT | UNDER_SCORE)+ ; argument : name=argumentName '=' value=argumentValue ; argumentName : value=CHAR ((CHAR| DIGIT)+)? ; argumentValue : (argumentNumber | argumentString | array) ; argumentString : ('\\')? '"' (value=string)? ('\\')? '"' ; argumentNumber : value=number ; number : value=DIGIT+ ('.' DIGIT+)? ; array : ('[' (WS+)? (value+=argumentValue ( ',' (WS+)? value+=argumentValue)*)? ']') ; string : value=(DIGIT | CHAR | WS | '<' | '>' | '|' | '(' | ')' | '?' | '!' | '@' | '#' | '€' | '%' | '&' | '/' | '=' | '+' | '-' | '*' | '^' | '^' | '.' | ',' | ':' | ';' | '^')+ ; CHAR: ('a'..'z' | 'A'..'Z'); DIGIT: ('0'..'9'); UNDER_SCORE: '_'; WS : [ \t\r\n]+;
source/a-ioexce.ads
ytomino/drake
33
14989
<filename>source/a-ioexce.ads<gh_stars>10-100 pragma License (Unrestricted); package Ada.IO_Exceptions is pragma Pure; Status_Error : exception; Mode_Error : exception; Name_Error : exception; Use_Error : exception; Device_Error : exception; End_Error : exception; Data_Error : exception; Layout_Error : exception; end Ada.IO_Exceptions;
oeis/016/A016103.asm
neoneye/loda-programs
11
28189
<filename>oeis/016/A016103.asm ; A016103: Expansion of 1/((1-4x)(1-5x)(1-6x)). ; Submitted by <NAME> ; 1,15,151,1275,9751,70035,481951,3216795,20991751,134667555,852639151,5343198315,33212784151,205111785075,1260114546751,7708980203835,46999640806951,285743822630595,1733261544204751,10493837185241355,63435462223140151,382979366943812115,2309726761873773151,13917683741041318875,83802999770218023751,504303611141065537635,3033254233044807571951,18236706243659426644395,109606213746503503857751,658567452132131894815155,3956056713979850334081151,23759604901500415257825915,142673970943853131523202151 mov $1,1 mov $2,1 mov $3,2 lpb $0 sub $0,1 mul $1,5 mul $3,6 add $3,$2 add $3,2 add $1,$3 mul $2,4 add $2,1 sub $1,$2 lpe mov $0,$1
apple-scripts/flickr-uploadr.applescript
lloydde/mac-preferences
0
1580
-- Configure "Flickr Uploader" -- Set "Flickr Uploadr" menu bar icon to black & white # # (C) Copyright 2017 <NAME> # License: MIT <https://spdx.org/licenses/MIT.html> # # Developed by trial and error on macOS Sierra 10.12.2 (16c67) # Initiate "Flickr Uploadr" so I can adjust the preferencs tell application "Flickr Uploadr" to launch delay 1 tell application "Flickr Uploadr" to quit delay 1 do shell script "defaults write com.yahoo.flickrmac TrayIconBW -bool YES" tell application "Flickr Uploadr" to launch
examples/linux/src/app.ads
jonashaggstrom/ada-canopen
6
30425
package App is procedure Run_Local; procedure Run_Remote; end App;
src/sh1107-spi.adb
hgrodriguez/sh1107
1
4944
--=========================================================================== -- -- This package is the implementation of the SPI connection implementation -- THIS IS NOT IMPLEMENTED YET, IT IS WIP!!! -- --=========================================================================== -- -- Copyright 2022 (C) <NAME> -- -- SPDX-License-Identifier: BSD-3-Clause -- package body SH1107.SPI is -------------------------------------------------------------------------- -- Selects the data transfer mode procedure Select_Data_Mode (DC_SPI : not null HAL.GPIO.Any_GPIO_Point); -------------------------------------------------------------------------- -- Selects the command transfer mode procedure Select_Command_Mode (DC_SPI : not null HAL.GPIO.Any_GPIO_Point); -------------------------------------------------------------------------- -- see .ads procedure Write_Command (Port : not null HAL.SPI.Any_SPI_Port; DC_SPI : not null HAL.GPIO.Any_GPIO_Point; Cmd : HAL.UInt8) is use HAL; Data : constant HAL.SPI.SPI_Data_8b := (1 => (Cmd)); Status : HAL.SPI.SPI_Status; use HAL.SPI; begin Select_Command_Mode (DC_SPI); Port.Transmit (Data => Data, Status => Status); if Status /= HAL.SPI.Ok then -- No error handling... raise Program_Error; end if; end Write_Command; -------------------------------------------------------------------------- -- see .ads procedure Write_Command_Argument (Port : not null HAL.SPI.Any_SPI_Port; DC_SPI : not null HAL.GPIO.Any_GPIO_Point; Cmd : HAL.UInt8; Arg : HAL.UInt8) is begin Write_Command (Port, DC_SPI, Cmd); Write_Command (Port, DC_SPI, Arg); end Write_Command_Argument; -------------------------------------------------------------------------- -- see .ads procedure Write_Data (Port : not null HAL.SPI.Any_SPI_Port; DC_SPI : not null HAL.GPIO.Any_GPIO_Point; Data : HAL.SPI.SPI_Data_8b) is Status : HAL.SPI.SPI_Status; use HAL.SPI; begin if False then for Idx in Data'First .. Data'Last loop if Idx = Data'First then Select_Command_Mode (DC_SPI); else Select_Data_Mode (DC_SPI); end if; Port.Transmit (Data => Data, Status => Status); if Status /= HAL.SPI.Ok then -- No error handling... raise Program_Error; end if; end loop; else Select_Command_Mode (DC_SPI); Port.Transmit (Data => Data (Data'First .. Data'First), Status => Status); if Status /= HAL.SPI.Ok then -- No error handling... raise Program_Error; end if; Select_Data_Mode (DC_SPI); Port.Transmit (Data => Data (Data'First + 1 .. Data'Last), Status => Status); if Status /= HAL.SPI.Ok then -- No error handling... raise Program_Error; end if; end if; end Write_Data; -------------------------------------------------------------------------- -------------------------------------------------------------------------- -------------------------------------------------------------------------- procedure Select_Data_Mode (DC_SPI : not null HAL.GPIO.Any_GPIO_Point) is begin DC_SPI.Set; end Select_Data_Mode; procedure Select_Command_Mode (DC_SPI : not null HAL.GPIO.Any_GPIO_Point) is begin DC_SPI.Clear; end Select_Command_Mode; end SH1107.SPI;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_80.asm
ljhsiun2/medusa
9
85100
<filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_80.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x7bc3, %rsi lea addresses_UC_ht+0xff9f, %rdi nop nop nop nop xor $2994, %rax mov $121, %rcx rep movsw nop nop nop nop dec %rbx lea addresses_WT_ht+0x1c707, %rsi lea addresses_WT_ht+0x1dc83, %rdi clflush (%rdi) nop and $35083, %r12 mov $83, %rcx rep movsq xor $18047, %rdi lea addresses_D_ht+0xea83, %rbx nop nop nop nop cmp %r12, %r12 movb $0x61, (%rbx) nop nop nop inc %r12 lea addresses_UC_ht+0x1d995, %rdi nop nop xor $20977, %r11 mov (%rdi), %bx nop nop nop nop cmp $53475, %rbx lea addresses_D_ht+0xa183, %rax nop nop and $7302, %rcx movw $0x6162, (%rax) nop cmp $28940, %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r8 push %r9 push %rcx push %rdi // Store lea addresses_WC+0x1e683, %rdi clflush (%rdi) nop nop and %r13, %r13 movl $0x51525354, (%rdi) nop nop nop inc %r9 // Store lea addresses_US+0xd923, %r11 nop nop nop xor $2252, %r12 mov $0x5152535455565758, %rcx movq %rcx, %xmm2 vmovups %ymm2, (%r11) nop nop nop inc %r9 // Faulty Load lea addresses_RW+0x1aa83, %r8 nop nop inc %r9 mov (%r8), %r12 lea oracles, %rcx and $0xff, %r12 shlq $12, %r12 mov (%rcx,%r12,1), %r12 pop %rdi pop %rcx pop %r9 pop %r8 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 7, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 5, 'size': 32, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': False, 'NT': False}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
llvm-gcc-4.2-2.9/gcc/ada/a-coprnu.ads
vidkidz/crossbridge
1
868
<reponame>vidkidz/crossbridge<gh_stars>1-10 ------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A . C O N T A I N E R S . P R I M E _ N U M B E R S -- -- -- -- S p e c -- -- -- -- This specification is adapted from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ package Ada.Containers.Prime_Numbers is pragma Pure; type Primes_Type is array (Positive range <>) of Hash_Type; Primes : constant Primes_Type := (53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, 49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, 805306457, 1610612741, 3221225473, 4294967291); function To_Prime (Length : Count_Type) return Hash_Type; end Ada.Containers.Prime_Numbers;
oeis/113/A113605.asm
neoneye/loda-programs
11
246792
; A113605: a(1) = a(2) = a(3) = 1; a(n) = a(n-3) + gcd(a(n-1), a(n-2)). ; Submitted by <NAME> ; 1,1,1,2,2,3,3,5,4,4,9,5,5,14,6,7,15,7,8,16,15,9,19,16,10,21,17,11,22,28,13,23,29,14,24,31,15,25,36,16,29,37,17,30,38,19,49,39,20,50,49,21,57,52,22,59,53,23,60,54,29,61,55,30,66,61,31,67,62,32,69,63,35,76,64,39,77,65,40,82,67,41,83,68,42,85,69,43,86,112,45,87,115,46,110,117,47,111,118,48 mov $2,3 mov $3,3 lpb $0 sub $0,1 gcd $2,$1 add $2,$4 mov $4,$1 mov $1,$3 mov $3,$2 lpe mov $0,$2 div $0,3
CS2610/Lab7/problem5.asm
shariefsmm/College-Codes
0
245629
<gh_stars>0 #problem1.asm .data sgpa: .float 8.96, 7.64, 9.4, 7.8 newLine: .asciiz "\n" .text .globl main main: la $t0, sgpa li $t1, 0 #counter li.s $f0, 0.0 #sum li.s $f1, 1.0 #product li.s $f2, 0.0 #average l.s $f3, ($t0) #minimum l.s $f4, ($t0) #maximum loop: beq $t1, 4, average l.s $f5, ($t0) add.s $f0, $f0, $f5 mul.s $f1, $f1, $f5 c.lt.s $f5, $f3 bc1t min next: c.lt.s $f4, $f5 bc1t max now: addi $t0, 4 addi $t1, 1 j loop min: mov.s $f3, $f5 j next max: mov.s $f4, $f5 j now average: li.s $f6, 4.0 div.s $f2, $f0, $f6 li $v0, 2 #print float mov.s $f12, $f0 #print sum syscall li $v0, 4 la $a0, newLine syscall li $v0, 2 #print float mov.s $f12, $f1 #print product syscall li $v0, 4 la $a0, newLine syscall li $v0, 2 #print float mov.s $f12, $f2 #print average syscall li $v0, 4 la $a0, newLine syscall li $v0, 2 #print float mov.s $f12, $f3 #print minimum syscall li $v0, 4 la $a0, newLine syscall li $v0, 2 #print float mov.s $f12, $f4 #print maximum syscall li $v0, 4 la $a0, newLine syscall li $v0, 10 syscall
client/src/discovery-template-syntax/CascadingTemplates.g4
endeavourhealth-discovery/IMQuery
1
4186
grammar CascadingTemplates; // lexer // // fragments to enable case insensitivity fragment A:('a'|'A'); fragment B:('b'|'B'); fragment C:('c'|'C'); fragment D:('d'|'D'); fragment E:('e'|'E'); fragment F:('f'|'F'); fragment G:('g'|'G'); fragment H:('h'|'H'); fragment I:('i'|'I'); fragment J:('j'|'J'); fragment K:('k'|'K'); fragment L:('l'|'L'); fragment M:('m'|'M'); fragment N:('n'|'N'); fragment O:('o'|'O'); fragment P:('p'|'P'); fragment Q:('q'|'Q'); fragment R:('r'|'R'); fragment S:('s'|'S'); fragment T:('t'|'T'); fragment U:('u'|'U'); fragment V:('v'|'V'); fragment W:('w'|'W'); fragment X:('x'|'X'); fragment Y:('y'|'Y'); fragment Z:('z'|'Z'); // fragments for: number, decimal number fragment DIGIT : [0-9]; // templates // // action INCLUDE : I N C L U D E ; EXCLUDE : E X C L U D E ; // INDEFINITE_ARTICLE : A N? ; // DEFINITE_ARTICLE : T H E? // ; PRONOUN : (I T | T H E Y | S? H E) ; HAVE_VERB : (H A D | H A S | H A V E) ; WITH : W I T H ; // WHERE : W H E R E // ; // WHERE_WITH : (WHERE | WITH) // ; THAT : T H A T ; IS : I S ; IS_NOT : (I S ' ' N O T | I S N '\'' T | I S N T) ; // ? todo: exists, doesn't exist // main entity PERSON : P E R S O N ; ORGANISATION : O R G A N I S A T I O N ; PROPERTY : P R O P E R T Y ; // linked entity -> todo: support wilccards? HEALTHRECORD : H E A L T H ' ' R E C O R D ; CLINICAL_CODE : C L I N I C A L ' ' C O D E ; VALUE : V A L U E ; DATE : (D A T E | S T A R T ' ' D A T E) ; // // specialised token // BLOOD_PRESSURE : [1-400] '\\' [1-400] // ; // basic tokens OR : O R ; AND : A N D ; operator: (OR | AND) ; NUMBER : DIGIT+ ; DECIMAL_NUMBER : DIGIT+ ('.' DIGIT+)? ; WORD: [a-zA-Z]+ ; ALPHANUMERIC_WORD: [a-zA-Z0-9]+ ; WHITEPSPACE : ([\t\r\n\u000C] | ' ')+ -> skip ; // parser // // article : (INDEFINITE_ARTICLE | DEFINITE_ARTICLE) // ; main_entity : (PERSON | ORGANISATION | PROPERTY) ; linked_entity : (HEALTHRECORD | ALPHANUMERIC_WORD) ; linked_entity_property : (CLINICAL_CODE | VALUE | DATE) ;
oeis/301/A301879.asm
neoneye/loda-programs
11
15718
; A301879: Number of nX3 0..1 arrays with every element equal to 0, 1 or 3 horizontally or antidiagonally adjacent elements, with upper left element zero. ; Submitted by <NAME> ; 3,10,29,95,289,917,2841,8921,27801,87009,271657,849313,2653273,8292465,25910729,80972065,253021369,790675217,2470747561,7720841601,24126677401,75393222129,235594969737,736207657313,2300563919993,7188999803345,22464798637929,70199925297985,219366716732249,685495865796017,2142096016785481,6693804645026081,20917372477331001,65364392381058449,204256236535096617,638277335776109313,1994543539748805913,6232720027475655025,19476535937520709129,60861943181872251105,190186598861947815929 lpb $0 sub $0,1 mov $2,$1 add $1,$3 add $1,1 mul $1,2 add $1,12 sub $4,2 sub $3,$4 add $3,$5 mov $4,$2 sub $5,$3 add $5,$2 mov $3,$5 add $4,$1 lpe mov $0,$4 div $0,2 add $0,3
tests/data/small/ts_mbthom.adb
j-lawrence-b1/string-path-search
0
4414
<filename>tests/data/small/ts_mbthom.adb<gh_stars>0 with text_io; use text_io; with Communications_with_User; use Communications_with_User; with Standard_Natural_Numbers; use Standard_Natural_Numbers; with Standard_Natural_Numbers_io; use Standard_Natural_Numbers_io; with Standard_Integer_Numbers; use Standard_Integer_Numbers; with Standard_Floating_Numbers; use Standard_Floating_Numbers; with Double_Double_Numbers; use Double_Double_Numbers; with Quad_Double_Numbers; use Quad_Double_Numbers; with Standard_Complex_Numbers; with DoblDobl_Complex_Numbers; with QuadDobl_Complex_Numbers; with Standard_Complex_VecVecs; with DoblDobl_Complex_VecVecs; with QuadDobl_Complex_VecVecs; with Standard_Complex_Poly_Systems; with Standard_Complex_Laur_Systems; with DoblDobl_Complex_Poly_Systems; with DoblDobl_Complex_Laur_Systems; with QuadDobl_Complex_Poly_Systems; with QuadDobl_Complex_Laur_Systems; with Standard_Complex_Solutions; with Standard_Complex_Solutions_io; use Standard_Complex_Solutions_io; with DoblDobl_Complex_Solutions; with DoblDobl_Complex_Solutions_io; use DoblDobl_Complex_Solutions_io; with QuadDobl_Complex_Solutions; with QuadDobl_Complex_Solutions_io; use QuadDobl_Complex_Solutions_io; with Witness_Sets; with Witness_Sets_io; use Witness_Sets_io; with Sampling_Machine; with Sampling_Laurent_Machine; with DoblDobl_Sampling_Machine; with DoblDobl_Sampling_Laurent_Machine; with QuadDobl_Sampling_Machine; with QuadDobl_Sampling_Laurent_Machine; with Homotopy_Membership_Tests; use Homotopy_Membership_Tests; with Homotopy_Membership_Filters; procedure ts_mbthom is -- DESCRIPTION : -- Test on membership with homotopy. function Standard_Random_Point ( file : file_type; p : Standard_Complex_Poly_Systems.Poly_Sys; s : Standard_Complex_Solutions.Solution_List; d : natural32 ) return Standard_Complex_Solutions.Solution_List is -- DESCRIPTION : -- For a given witness set, takes the first point and applies -- path tracking to another set of slices to compute another point. -- ON ENTRY : -- file for output during sampling; -- p embedded polynomial system; -- s generic points on the solution set; -- d dimension of the solution set; res : Standard_Complex_Solutions.Solution_List; n : constant natural32 := natural32(p'last); hyp : Standard_Complex_VecVecs.VecVec(1..integer32(d)) := Witness_Sets.Random_Hyperplanes(d,n); startsol : Standard_Complex_Solutions.Solution(integer32(n)); newsol : Standard_Complex_Solutions.Solution(integer32(n)); begin Sampling_Machine.Initialize(p); Sampling_Machine.Default_Tune_Sampler(0); Sampling_Machine.Default_Tune_Refiner; startsol := Standard_Complex_Solutions.Head_Of(s).all; startsol.t := Standard_Complex_Numbers.Create(0.0); Sampling_Machine.Sample(file,true,startsol,hyp,newsol); Standard_Complex_Solutions.Add(res,newsol); Sampling_Machine.Clear; return res; end Standard_Random_Point; function Standard_Random_Point ( file : file_type; p : Standard_Complex_Laur_Systems.Laur_Sys; s : Standard_Complex_Solutions.Solution_List; d : natural32 ) return Standard_Complex_Solutions.Solution_List is -- DESCRIPTION : -- For a given witness set, takes the first point and applies -- path tracking to another set of slices to compute another point. -- ON ENTRY : -- file for output during sampling; -- p embedded polynomial system; -- s generic points on the solution set; -- d dimension of the solution set; res : Standard_Complex_Solutions.Solution_List; n : constant natural32 := natural32(p'last); hyp : Standard_Complex_VecVecs.VecVec(1..integer32(d)) := Witness_Sets.Random_Hyperplanes(d,n); startsol : Standard_Complex_Solutions.Solution(integer32(n)); newsol : Standard_Complex_Solutions.Solution(integer32(n)); begin Sampling_Laurent_Machine.Initialize(p); Sampling_Laurent_Machine.Default_Tune_Sampler(0); Sampling_Laurent_Machine.Default_Tune_Refiner; startsol := Standard_Complex_Solutions.Head_Of(s).all; startsol.t := Standard_Complex_Numbers.Create(0.0); Sampling_Laurent_Machine.Sample(file,true,startsol,hyp,newsol); Standard_Complex_Solutions.Add(res,newsol); Sampling_Laurent_Machine.Clear; return res; end Standard_Random_Point; function DoblDobl_Random_Point ( file : file_type; p : DoblDobl_Complex_Poly_Systems.Poly_Sys; s : DoblDobl_Complex_Solutions.Solution_List; d : natural32 ) return DoblDobl_Complex_Solutions.Solution_List is -- DESCRIPTION : -- For a given witness set, takes the first point and applies -- path tracking to another set of slices to compute another point. -- ON ENTRY : -- file for output during sampling; -- p embedded polynomial system; -- s generic points on the solution set; -- d dimension of the solution set; res : DoblDobl_Complex_Solutions.Solution_List; n : constant natural32 := natural32(p'last); hyp : DoblDobl_Complex_VecVecs.VecVec(1..integer32(d)) := Witness_Sets.Random_Hyperplanes(d,n); startsol : DoblDobl_Complex_Solutions.Solution(integer32(n)); newsol : DoblDobl_Complex_Solutions.Solution(integer32(n)); ddzero : double_double := Double_Double_Numbers.Create(0.0); begin DoblDobl_Sampling_Machine.Initialize(p); DoblDobl_Sampling_Machine.Default_Tune_Sampler(0); DoblDobl_Sampling_Machine.Default_Tune_Refiner; startsol := DoblDobl_Complex_Solutions.Head_Of(s).all; startsol.t := DoblDobl_Complex_Numbers.Create(ddzero); DoblDobl_Sampling_Machine.Sample(file,true,startsol,hyp,newsol); DoblDobl_Complex_Solutions.Add(res,newsol); DoblDobl_Sampling_Machine.Clear; return res; end DoblDobl_Random_Point; function DoblDobl_Random_Point ( file : file_type; p : DoblDobl_Complex_Laur_Systems.Laur_Sys; s : DoblDobl_Complex_Solutions.Solution_List; d : natural32 ) return DoblDobl_Complex_Solutions.Solution_List is -- DESCRIPTION : -- For a given witness set, takes the first point and applies -- path tracking to another set of slices to compute another point. -- ON ENTRY : -- file for output during sampling; -- p embedded polynomial system; -- s generic points on the solution set; -- d dimension of the solution set; res : DoblDobl_Complex_Solutions.Solution_List; n : constant natural32 := natural32(p'last); hyp : DoblDobl_Complex_VecVecs.VecVec(1..integer32(d)) := Witness_Sets.Random_Hyperplanes(d,n); startsol : DoblDobl_Complex_Solutions.Solution(integer32(n)); newsol : DoblDobl_Complex_Solutions.Solution(integer32(n)); ddzero : double_double := Double_Double_Numbers.Create(0.0); begin DoblDobl_Sampling_Laurent_Machine.Initialize(p); DoblDobl_Sampling_Laurent_Machine.Default_Tune_Sampler(0); DoblDobl_Sampling_Laurent_Machine.Default_Tune_Refiner; startsol := DoblDobl_Complex_Solutions.Head_Of(s).all; startsol.t := DoblDobl_Complex_Numbers.Create(ddzero); DoblDobl_Sampling_Laurent_Machine.Sample(file,true,startsol,hyp,newsol); DoblDobl_Complex_Solutions.Add(res,newsol); DoblDobl_Sampling_Laurent_Machine.Clear; return res; end DoblDobl_Random_Point; function QuadDobl_Random_Point ( file : file_type; p : QuadDobl_Complex_Poly_Systems.Poly_Sys; s : QuadDobl_Complex_Solutions.Solution_List; d : natural32 ) return QuadDobl_Complex_Solutions.Solution_List is -- DESCRIPTION : -- For a given witness set, takes the first point and applies -- path tracking to another set of slices to compute another point. -- ON ENTRY : -- file for output during sampling; -- p embedded polynomial system; -- s generic points on the solution set; -- d dimension of the solution set; res : QuadDobl_Complex_Solutions.Solution_List; n : constant natural32 := natural32(p'last); hyp : QuadDobl_Complex_VecVecs.VecVec(1..integer32(d)) := Witness_Sets.Random_Hyperplanes(d,n); startsol : QuadDobl_Complex_Solutions.Solution(integer32(n)); newsol : QuadDobl_Complex_Solutions.Solution(integer32(n)); qdzero : quad_double := Quad_Double_Numbers.Create(0.0); begin QuadDobl_Sampling_Machine.Initialize(p); QuadDobl_Sampling_Machine.Default_Tune_Sampler(0); QuadDobl_Sampling_Machine.Default_Tune_Refiner; startsol := QuadDobl_Complex_Solutions.Head_Of(s).all; startsol.t := QuadDobl_Complex_Numbers.Create(qdzero); QuadDobl_Sampling_Machine.Sample(file,true,startsol,hyp,newsol); QuadDobl_Complex_Solutions.Add(res,newsol); QuadDobl_Sampling_Machine.Clear; return res; end QuadDobl_Random_Point; function QuadDobl_Random_Point ( file : file_type; p : QuadDobl_Complex_Laur_Systems.Laur_Sys; s : QuadDobl_Complex_Solutions.Solution_List; d : natural32 ) return QuadDobl_Complex_Solutions.Solution_List is -- DESCRIPTION : -- For a given witness set, takes the first point and applies -- path tracking to another set of slices to compute another point. -- ON ENTRY : -- file for output during sampling; -- p embedded polynomial system; -- s generic points on the solution set; -- d dimension of the solution set; res : QuadDobl_Complex_Solutions.Solution_List; n : constant natural32 := natural32(p'last); hyp : QuadDobl_Complex_VecVecs.VecVec(1..integer32(d)) := Witness_Sets.Random_Hyperplanes(d,n); startsol : QuadDobl_Complex_Solutions.Solution(integer32(n)); newsol : QuadDobl_Complex_Solutions.Solution(integer32(n)); qdzero : quad_double := Quad_Double_Numbers.Create(0.0); begin QuadDobl_Sampling_Laurent_Machine.Initialize(p); QuadDobl_Sampling_Laurent_Machine.Default_Tune_Sampler(0); QuadDobl_Sampling_Laurent_Machine.Default_Tune_Refiner; startsol := QuadDobl_Complex_Solutions.Head_Of(s).all; startsol.t := QuadDobl_Complex_Numbers.Create(qdzero); QuadDobl_Sampling_Laurent_Machine.Sample(file,true,startsol,hyp,newsol); QuadDobl_Complex_Solutions.Add(res,newsol); QuadDobl_Sampling_Laurent_Machine.Clear; return res; end QuadDobl_Random_Point; procedure Standard_Membership is -- DESCRIPTION : -- Prompts the user for a witness set, a list of test points, -- and then applies the homotopy membership test -- using standard double precision arithmetic. file : file_type; lp : Standard_Complex_Poly_Systems.Link_to_Poly_Sys; genpts,sols : Standard_Complex_Solutions.Solution_List; dim : natural32; restol : constant double_float := 1.0E-10; homtol : constant double_float := 1.0E-6; out2file : boolean; ans : character; begin Standard_Read_Embedding(lp,genpts,dim); new_line; put("Do you want the output to a file ? (y/n) "); Ask_Yes_or_No(ans); if ans /= 'y' then out2file := false; else out2file := true; new_line; put_line("Reading the name of the output file."); Read_Name_and_Create_File(file); end if; new_line; put_line("MENU for test points : "); put_line(" 0. generate a random point on the solution set; or"); put_line(" 1. give a file name with a list of test points."); put("Type 0 or 1 for test points : "); Ask_Alternative(ans,"01"); new_line; if ans = '1' then Read(sols); else put_line("Computing a random point on the solution set ..."); if out2file then sols := Standard_Random_Point(file,lp.all,genpts,dim); else sols := Standard_Random_Point(standard_output,lp.all,genpts,dim); end if; end if; new_line; put_line("See the output file for results..."); new_line; if out2file then Homotopy_Membership_Test(file,lp.all,dim,genpts,sols,restol,homtol); else Homotopy_Membership_Test(true,lp.all,dim,genpts,sols,restol,homtol); end if; end Standard_Membership; procedure Standard_Membership_Filter is -- DESCRIPTION : -- Prompts the user for a witness set, a list of test points, -- and then applies the homotopy membership test -- using standard double precision arithmetic. file : file_type; lp : Standard_Complex_Poly_Systems.Link_to_Poly_Sys; genpts,sols,mempts,outpts : Standard_Complex_Solutions.Solution_List; dim : natural32; restol : constant double_float := 1.0E-10; homtol : constant double_float := 1.0E-6; out2file : boolean; ans : character; begin Standard_Read_Embedding(lp,genpts,dim); new_line; put("Do you want the output to a file ? (y/n) "); Ask_Yes_or_No(ans); if ans /= 'y' then out2file := false; else out2file := true; new_line; put_line("Reading the name of the output file."); Read_Name_and_Create_File(file); end if; new_line; put_line("MENU for test points : "); put_line(" 0. generate a random point on the solution set; or"); put_line(" 1. give a file name with a list of test points."); put("Type 0 or 1 for test points : "); Ask_Alternative(ans,"01"); new_line; if ans = '1' then Read(sols); else put_line("Computing a random point on the solution set ..."); if out2file then sols := Standard_Random_Point(file,lp.all,genpts,dim); else sols := Standard_Random_Point(standard_output,lp.all,genpts,dim); end if; end if; if out2file then new_line; put_line("See the output file for results ..."); new_line; Homotopy_Membership_Filters.Filter (file,lp.all,genpts,dim,restol,homtol,sols,mempts,outpts); put(file,"Number of points that are member : "); put(file,Standard_Complex_Solutions.Length_Of(mempts),1); new_line(file); put(file,"Number of points that are outside : "); put(file,Standard_Complex_Solutions.Length_Of(outpts),1); new_line(file); else new_line; put("Verbose ? (y/n) "); Ask_Yes_or_No(ans); Homotopy_Membership_Filters.Filter (ans = 'y',lp.all,genpts,dim,restol,homtol,sols,mempts,outpts); put("Number of points that are member : "); put(Standard_Complex_Solutions.Length_Of(mempts),1); new_line; put("Number of points that are outside : "); put(Standard_Complex_Solutions.Length_Of(outpts),1); new_line; end if; end Standard_Membership_Filter; procedure DoblDobl_Membership is -- DESCRIPTION : -- Prompts the user for a witness set, a list of test points, -- and then applies the homotopy membership test -- using double double precision arithmetic. file : file_type; lp : DoblDobl_Complex_Poly_Systems.Link_to_Poly_Sys; genpts,sols : DoblDobl_Complex_Solutions.Solution_List; dim : natural32; restol : constant double_float := 1.0E-10; homtol : constant double_float := 1.0E-6; out2file : boolean; ans : character; begin DoblDobl_Read_Embedding(lp,genpts,dim); new_line; put("Do you want the output to a file ? (y/n) "); Ask_Yes_or_No(ans); if ans /= 'y' then out2file := false; else out2file := true; new_line; put_line("Reading the name of the output file."); Read_Name_and_Create_File(file); end if; new_line; put_line("MENU for test points : "); put_line(" 0. generate a random point on the solution set; or"); put_line(" 1. give a file name with a list of test points."); put("Type 0 or 1 for test points : "); Ask_Alternative(ans,"01"); new_line; if ans = '1' then Read(sols); else put_line("Computing a random point on the solution set ..."); if out2file then sols := DoblDobl_Random_Point(file,lp.all,genpts,dim); else sols := DoblDobl_Random_Point(standard_output,lp.all,genpts,dim); end if; end if; new_line; put_line("See the output file for results..."); new_line; if out2file then Homotopy_Membership_Test(file,lp.all,dim,genpts,sols,restol,homtol); else Homotopy_Membership_Test(true,lp.all,dim,genpts,sols,restol,homtol); end if; end DoblDobl_Membership; procedure QuadDobl_Membership is -- DESCRIPTION : -- Prompts the user for a witness set, a list of test points, -- and then applies the homotopy membership test -- using quad double precision arithmetic. file : file_type; lp : QuadDobl_Complex_Poly_Systems.Link_to_Poly_Sys; genpts,sols : QuadDobl_Complex_Solutions.Solution_List; dim : natural32; restol : constant double_float := 1.0E-10; homtol : constant double_float := 1.0E-6; out2file : boolean; ans : character; begin QuadDobl_Read_Embedding(lp,genpts,dim); new_line; put("Do you want the output to a file ? (y/n) "); Ask_Yes_or_No(ans); if ans /= 'y' then out2file := false; else out2file := true; new_line; put_line("Reading the name of the output file."); Read_Name_and_Create_File(file); end if; new_line; put_line("MENU for test points : "); put_line(" 0. generate a random point on the solution set; or"); put_line(" 1. give a file name with a list of test points."); put("Type 0 or 1 for test points : "); Ask_Alternative(ans,"01"); new_line; if ans = '1' then Read(sols); else put_line("Computing a random point on the solution set ..."); if out2file then sols := QuadDobl_Random_Point(file,lp.all,genpts,dim); else sols := QuadDobl_Random_Point(standard_output,lp.all,genpts,dim); end if; end if; new_line; put_line("See the output file for results..."); new_line; if out2file then Homotopy_Membership_Test(file,lp.all,dim,genpts,sols,restol,homtol); else Homotopy_Membership_Test(true,lp.all,dim,genpts,sols,restol,homtol); end if; end QuadDobl_Membership; procedure Standard_Laurent_Membership is -- DESCRIPTION : -- Prompts the user for a witness set, a list of test points, -- and then applies the homotopy membership test -- using standard double precision arithmetic. file : file_type; lp : Standard_Complex_Laur_Systems.Link_to_Laur_Sys; genpts,sols : Standard_Complex_Solutions.Solution_List; dim : natural32; restol : constant double_float := 1.0E-10; homtol : constant double_float := 1.0E-6; out2file : boolean; ans : character; begin Standard_Read_Embedding(lp,genpts,dim); new_line; put("Do you want the output to a file ? (y/n) "); Ask_Yes_or_No(ans); if ans /= 'y' then out2file := false; else out2file := true; new_line; put_line("Reading the name of the output file."); Read_Name_and_Create_File(file); end if; new_line; put_line("MENU for test points : "); put_line(" 0. generate a random point on the solution set; or"); put_line(" 1. give a file name with a list of test points."); put("Type 0 or 1 for test points : "); Ask_Alternative(ans,"01"); new_line; if ans = '1' then Read(sols); else put_line("Computing a random point on the solution set ..."); if out2file then sols := Standard_Random_Point(file,lp.all,genpts,dim); else sols := Standard_Random_Point(standard_output,lp.all,genpts,dim); end if; end if; new_line; put_line("See the output file for results..."); new_line; if out2file then Homotopy_Membership_Test(file,lp.all,dim,genpts,sols,restol,homtol); else Homotopy_Membership_Test(true,lp.all,dim,genpts,sols,restol,homtol); end if; end Standard_Laurent_Membership; procedure DoblDobl_Laurent_Membership is -- DESCRIPTION : -- Prompts the user for a witness set, a list of test points, -- and then applies the homotopy membership test -- using double double precision arithmetic. file : file_type; lp : DoblDobl_Complex_Laur_Systems.Link_to_Laur_Sys; genpts,sols : DoblDobl_Complex_Solutions.Solution_List; dim : natural32; restol : constant double_float := 1.0E-10; homtol : constant double_float := 1.0E-6; out2file : boolean; ans : character; begin DoblDobl_Read_Embedding(lp,genpts,dim); new_line; put("Do you want the output to a file ? (y/n) "); Ask_Yes_or_No(ans); if ans /= 'y' then out2file := false; else out2file := true; new_line; put_line("Reading the name of the output file."); Read_Name_and_Create_File(file); end if; new_line; put_line("MENU for test points : "); put_line(" 0. generate a random point on the solution set; or"); put_line(" 1. give a file name with a list of test points."); put("Type 0 or 1 for test points : "); Ask_Alternative(ans,"01"); new_line; if ans = '1' then Read(sols); else put_line("Computing a random point on the solution set ..."); if out2file then sols := DoblDobl_Random_Point(file,lp.all,genpts,dim); else sols := DoblDobl_Random_Point(standard_output,lp.all,genpts,dim); end if; end if; new_line; put_line("See the output file for results..."); new_line; if out2file then Homotopy_Membership_Test(file,lp.all,dim,genpts,sols,restol,homtol); else Homotopy_Membership_Test(true,lp.all,dim,genpts,sols,restol,homtol); end if; end DoblDobl_Laurent_Membership; procedure QuadDobl_Laurent_Membership is -- DESCRIPTION : -- Prompts the user for a witness set, a list of test points, -- and then applies the homotopy membership test -- using quad double precision arithmetic. file : file_type; lp : QuadDobl_Complex_Laur_Systems.Link_to_Laur_Sys; genpts,sols : QuadDobl_Complex_Solutions.Solution_List; dim : natural32; restol : constant double_float := 1.0E-10; homtol : constant double_float := 1.0E-6; out2file : boolean; ans : character; begin QuadDobl_Read_Embedding(lp,genpts,dim); new_line; put("Do you want the output to a file ? (y/n) "); Ask_Yes_or_No(ans); if ans /= 'y' then out2file := false; else out2file := true; new_line; put_line("Reading the name of the output file."); Read_Name_and_Create_File(file); end if; new_line; put_line("MENU for test points : "); put_line(" 0. generate a random point on the solution set; or"); put_line(" 1. give a file name with a list of test points."); put("Type 0 or 1 for test points : "); Ask_Alternative(ans,"01"); new_line; if ans = '1' then Read(sols); else put_line("Computing a random point on the solution set ..."); if out2file then sols := QuadDobl_Random_Point(file,lp.all,genpts,dim); else sols := QuadDobl_Random_Point(standard_output,lp.all,genpts,dim); end if; end if; new_line; put_line("See the output file for results..."); new_line; if out2file then Homotopy_Membership_Test(file,lp.all,dim,genpts,sols,restol,homtol); else Homotopy_Membership_Test(true,lp.all,dim,genpts,sols,restol,homtol); end if; end QuadDobl_Laurent_Membership; procedure Main is ans : character; begin new_line; put_line("Membership test with homotopy :"); put_line(" Input : embedded polynomial system with generic points, and"); put_line(" list of test points."); put_line(" Output : decision whether test point lies on component."); new_line; put_line("MENU to choose the precision : "); put_line(" 0. standard double precision homotopy continuation;"); put_line(" 1. double double precision homotopy continuation;"); put_line(" 2. quad double precision homotopy continuation;"); put_line(" 3. Laurent homotopy in standard double precision;"); put_line(" 4. Laurent homotopy in double double precision;"); put_line(" 5. Laurent homotopy in quad double precision;"); put_line(" 6. test membership filter in standard double precision."); put("Type 0, 1, 2, 3, 4, 5, or 6 to select the test : "); Ask_Alternative(ans,"0123456"); case ans is when '0' => Standard_Membership; when '1' => DoblDobl_Membership; when '2' => QuadDobl_Membership; when '3' => Standard_Laurent_Membership; when '4' => DoblDobl_Laurent_Membership; when '5' => QuadDobl_Laurent_Membership; when '6' => Standard_Membership_Filter; when others => null; end case; end Main; begin Main; end ts_mbthom;
bb-runtimes/runtimes/ravenscar-sfp-stm32g474/gnarl/a-intnam.ads
JCGobbi/Nucleo-STM32G474RE
0
11120
<filename>bb-runtimes/runtimes/ravenscar-sfp-stm32g474/gnarl/a-intnam.ads -- -- Copyright (C) 2021, AdaCore -- pragma Style_Checks (Off); -- This spec has been automatically generated from STM32G474xx.svd -- This is a version for the STM32G474xx MCU package Ada.Interrupts.Names is -- All identifiers in this unit are implementation defined pragma Implementation_Defined; ---------------- -- Interrupts -- ---------------- -- System tick Sys_Tick_Interrupt : constant Interrupt_ID := -1; -- Window Watchdog interrupt WWDG_Interrupt : constant Interrupt_ID := 0; -- PVD through EXTI line detection PVD_PVM_Interrupt : constant Interrupt_ID := 1; -- RTC_TAMP_CSS_LSE RTC_TAMP_CSS_LSE_Interrupt : constant Interrupt_ID := 2; -- RTC Wakeup timer RTC_WKUP_Interrupt : constant Interrupt_ID := 3; -- FLASH FLASH_Interrupt : constant Interrupt_ID := 4; -- RCC RCC_Interrupt : constant Interrupt_ID := 5; -- EXTI Line0 interrupt EXTI0_Interrupt : constant Interrupt_ID := 6; -- EXTI Line1 interrupt EXTI1_Interrupt : constant Interrupt_ID := 7; -- EXTI Line2 interrupt EXTI2_Interrupt : constant Interrupt_ID := 8; -- EXTI Line3 interrupt EXTI3_Interrupt : constant Interrupt_ID := 9; -- EXTI Line4 interrupt EXTI4_Interrupt : constant Interrupt_ID := 10; -- DMA1 channel 1 interrupt DMA1_CH1_Interrupt : constant Interrupt_ID := 11; -- DMA1 channel 2 interrupt DMA1_CH2_Interrupt : constant Interrupt_ID := 12; -- DMA1 channel 3 interrupt DMA1_CH3_Interrupt : constant Interrupt_ID := 13; -- DMA1 channel 4 interrupt DMA1_CH4_Interrupt : constant Interrupt_ID := 14; -- DMA1 channel 5 interrupt DMA1_CH5_Interrupt : constant Interrupt_ID := 15; -- DMA1 channel 6 interrupt DMA1_CH6_Interrupt : constant Interrupt_ID := 16; -- DMA1 channel 7 interrupt DMA1_CH7_Interrupt : constant Interrupt_ID := 17; -- ADC1 and ADC2 global interrupt ADC1_2_Interrupt : constant Interrupt_ID := 18; -- USB_HP USB_HP_Interrupt : constant Interrupt_ID := 19; -- USB_LP USB_LP_Interrupt : constant Interrupt_ID := 20; -- FDCAN1_intr1_it FDCAN1_intr1_it_Interrupt : constant Interrupt_ID := 21; -- FDCAN1_intr0_it FDCAN1_intr0_it_Interrupt : constant Interrupt_ID := 22; -- EXTI9_5 EXTI9_5_Interrupt : constant Interrupt_ID := 23; -- TIM1_BRK_TIM15 TIM1_BRK_TIM15_Interrupt : constant Interrupt_ID := 24; -- TIM1_UP_TIM16 TIM1_UP_TIM16_Interrupt : constant Interrupt_ID := 25; -- TIM1_TRG_COM/ TIM1_TRG_COM_Interrupt : constant Interrupt_ID := 26; -- TIM1 capture compare interrupt TIM1_CC_Interrupt : constant Interrupt_ID := 27; -- TIM2 TIM2_Interrupt : constant Interrupt_ID := 28; -- TIM3 TIM3_Interrupt : constant Interrupt_ID := 29; -- TIM4 TIM4_Interrupt : constant Interrupt_ID := 30; -- I2C1_EV I2C1_EV_Interrupt : constant Interrupt_ID := 31; -- I2C1_ER I2C1_ER_Interrupt : constant Interrupt_ID := 32; -- I2C2_EV I2C2_EV_Interrupt : constant Interrupt_ID := 33; -- I2C2_ER I2C2_ER_Interrupt : constant Interrupt_ID := 34; -- SPI1 SPI1_Interrupt : constant Interrupt_ID := 35; -- SPI2 SPI2_Interrupt : constant Interrupt_ID := 36; -- USART1 USART1_Interrupt : constant Interrupt_ID := 37; -- USART2 USART2_Interrupt : constant Interrupt_ID := 38; -- USART3 USART3_Interrupt : constant Interrupt_ID := 39; -- EXTI15_10 EXTI15_10_Interrupt : constant Interrupt_ID := 40; -- RTC_ALARM RTC_ALARM_Interrupt : constant Interrupt_ID := 41; -- USBWakeUP USBWakeUP_Interrupt : constant Interrupt_ID := 42; -- TIM8_BRK TIM8_BRK_Interrupt : constant Interrupt_ID := 43; -- TIM8_UP TIM8_UP_Interrupt : constant Interrupt_ID := 44; -- TIM8_TRG_COM TIM8_TRG_COM_Interrupt : constant Interrupt_ID := 45; -- TIM8_CC TIM8_CC_Interrupt : constant Interrupt_ID := 46; -- ADC3 ADC3_Interrupt : constant Interrupt_ID := 47; -- FMC FMC_Interrupt : constant Interrupt_ID := 48; -- LPTIM1 LPTIM1_Interrupt : constant Interrupt_ID := 49; -- TIM5 TIM5_Interrupt : constant Interrupt_ID := 50; -- SPI3 SPI3_Interrupt : constant Interrupt_ID := 51; -- UART4 UART4_Interrupt : constant Interrupt_ID := 52; -- UART5 UART5_Interrupt : constant Interrupt_ID := 53; -- TIM6_DACUNDER TIM6_DACUNDER_Interrupt : constant Interrupt_ID := 54; -- TIM7 TIM7_Interrupt : constant Interrupt_ID := 55; -- DMA2_CH1 DMA2_CH1_Interrupt : constant Interrupt_ID := 56; -- DMA2_CH2 DMA2_CH2_Interrupt : constant Interrupt_ID := 57; -- DMA2_CH3 DMA2_CH3_Interrupt : constant Interrupt_ID := 58; -- DMA2_CH4 DMA2_CH4_Interrupt : constant Interrupt_ID := 59; -- DMA2_CH5 DMA2_CH5_Interrupt : constant Interrupt_ID := 60; -- ADC4 ADC4_Interrupt : constant Interrupt_ID := 61; -- ADC5 ADC5_Interrupt : constant Interrupt_ID := 62; -- UCPD1 UCPD1_Interrupt : constant Interrupt_ID := 63; -- COMP1_2_3 COMP1_2_3_Interrupt : constant Interrupt_ID := 64; -- COMP4_5_6 COMP4_5_6_Interrupt : constant Interrupt_ID := 65; -- COMP7 COMP7_Interrupt : constant Interrupt_ID := 66; -- HRTIM_Master_IRQn HRTIM_Master_IRQn_Interrupt : constant Interrupt_ID := 67; -- HRTIM_TIMA_IRQn HRTIM_TIMA_IRQn_Interrupt : constant Interrupt_ID := 68; -- HRTIM_TIMB_IRQn HRTIM_TIMB_IRQn_Interrupt : constant Interrupt_ID := 69; -- HRTIM_TIMC_IRQn HRTIM_TIMC_IRQn_Interrupt : constant Interrupt_ID := 70; -- HRTIM_TIMD_IRQn HRTIM_TIMD_IRQn_Interrupt : constant Interrupt_ID := 71; -- HRTIM_TIME_IRQn HRTIM_TIME_IRQn_Interrupt : constant Interrupt_ID := 72; -- HRTIM_TIM_FLT_IRQn HRTIM_TIM_FLT_IRQn_Interrupt : constant Interrupt_ID := 73; -- HRTIM_TIMF_IRQn HRTIM_TIMF_IRQn_Interrupt : constant Interrupt_ID := 74; -- CRS CRS_Interrupt : constant Interrupt_ID := 75; -- SAI SAI_Interrupt : constant Interrupt_ID := 76; -- TIM20_BRK TIM20_BRK_Interrupt : constant Interrupt_ID := 77; -- TIM20_UP TIM20_UP_Interrupt : constant Interrupt_ID := 78; -- TIM20_TRG_COM TIM20_TRG_COM_Interrupt : constant Interrupt_ID := 79; -- TIM20_CC TIM20_CC_Interrupt : constant Interrupt_ID := 80; -- FPU global interrupt FPU_Interrupt : constant Interrupt_ID := 81; -- I2C4_EV I2C4_EV_Interrupt : constant Interrupt_ID := 82; -- I2C4_ER I2C4_ER_Interrupt : constant Interrupt_ID := 83; -- SPI4 SPI4_Interrupt : constant Interrupt_ID := 84; -- FDCAN2_intr0 FDCAN2_intr0_Interrupt : constant Interrupt_ID := 86; -- FDCAN2_intr1 FDCAN2_intr1_Interrupt : constant Interrupt_ID := 87; -- FDCAN3_intr0 FDCAN3_intr0_Interrupt : constant Interrupt_ID := 88; -- FDCAN3_intr1 FDCAN3_intr1_Interrupt : constant Interrupt_ID := 89; -- RNG RNG_Interrupt : constant Interrupt_ID := 90; -- LPUART LPUART_Interrupt : constant Interrupt_ID := 91; -- I2C3_EV I2C3_EV_Interrupt : constant Interrupt_ID := 92; -- I2C3_ER I2C3_ER_Interrupt : constant Interrupt_ID := 93; -- DMAMUX_OVR DMAMUX_OVR_Interrupt : constant Interrupt_ID := 94; -- QUADSPI QUADSPI_Interrupt : constant Interrupt_ID := 95; -- DMA1_CH8 DMA1_CH8_Interrupt : constant Interrupt_ID := 96; -- DMA2_CH6 DMA2_CH6_Interrupt : constant Interrupt_ID := 97; -- DMA2_CH7 DMA2_CH7_Interrupt : constant Interrupt_ID := 98; -- DMA2_CH8 DMA2_CH8_Interrupt : constant Interrupt_ID := 99; -- Cordic Cordic_Interrupt : constant Interrupt_ID := 100; -- FMAC FMAC_Interrupt : constant Interrupt_ID := 101; end Ada.Interrupts.Names;
Transynther/x86/_processed/NC/_zr_/i3-7100_9_0xca_notsx.log_21829_1822.asm
ljhsiun2/medusa
9
91677
<filename>Transynther/x86/_processed/NC/_zr_/i3-7100_9_0xca_notsx.log_21829_1822.asm .global s_prepare_buffers s_prepare_buffers: push %r14 push %r9 push %rbp push %rdx lea addresses_A_ht+0x16369, %rbp nop nop nop nop dec %r14 movb $0x61, (%rbp) nop nop nop cmp $19403, %rdx pop %rdx pop %rbp pop %r9 pop %r14 ret .global s_faulty_load s_faulty_load: push %r11 push %r8 push %rax push %rcx push %rdi push %rdx push %rsi // REPMOV lea addresses_WT+0x1dc69, %rsi lea addresses_D+0x40d, %rdi nop nop sub %r8, %r8 mov $28, %rcx rep movsl nop nop nop nop sub $31070, %r11 // Store lea addresses_normal+0xa229, %rdx nop nop cmp $12415, %rax mov $0x5152535455565758, %r8 movq %r8, (%rdx) and %rsi, %rsi // Faulty Load mov $0x2fd6770000000569, %r11 clflush (%r11) nop sub $64573, %rdx movb (%r11), %al lea oracles, %rdi and $0xff, %rax shlq $12, %rax mov (%rdi,%rax,1), %rax pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r8 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_normal', 'size': 8, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': 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 */
FormalAnalyzer/models/apps/RiseandShine.als
Mohannadcse/IoTCOM_BehavioralRuleExtractor
0
268
<gh_stars>0 module app_RiseandShine open IoTBottomUp as base open cap_runIn open cap_now open cap_userInput open cap_motionSensor open cap_switch open cap_location one sig app_RiseandShine extends IoTApp { location : one cap_location, motionSensors : some cap_motionSensor, switches : some cap_switch, timeOfDay : one cap_userInput, state : one cap_state, dateString : one cap_userInput, newMode : one cap_location_attr_mode_val, } { rules = r //capabilities = motionSensors + switches + state } one sig cap_state extends cap_runIn {} { attributes = cap_state_attr + cap_runIn_attr } abstract sig cap_state_attr extends Attribute {} one sig cap_userInput_attr_timeOfDay extends cap_userInput_attr {} { values = cap_userInput_attr_timeOfDay_val } abstract sig cap_userInput_attr_timeOfDay_val extends cap_userInput_attr_value_val {} one sig range_0,range_1 extends cap_userInput_attr_timeOfDay_val {} one sig cap_userInput_attr_dateString extends cap_userInput_attr {} { values = cap_userInput_attr_dateString_val } abstract sig cap_userInput_attr_dateString_val extends cap_userInput_attr_value_val {} //one sig cap_now_attr_now_val_gt_noValue extends cap_now_attr_now_val {} abstract sig r extends Rule {} one sig r0 extends r {}{ no triggers conditions = r0_cond commands = r0_comm } abstract sig r0_cond extends Condition {} one sig r0_cond0 extends r0_cond {} { capabilities = app_RiseandShine.timeOfDay //now attribute = cap_userInput_attr_timeOfDay //cap_now_attr_now value = range_1 } one sig r0_cond1 extends r0_cond {} { capabilities = app_RiseandShine.location attribute = cap_location_attr_mode value = cap_location_attr_mode_val - app_RiseandShine.newMode } abstract sig r0_comm extends Command {} one sig r0_comm0 extends r0_comm {} { capability = app_RiseandShine.location attribute = cap_location_attr_mode value = app_RiseandShine.newMode } one sig r1 extends r {}{ no triggers conditions = r1_cond commands = r1_comm } abstract sig r1_cond extends Condition {} one sig r1_cond0 extends r1_cond {} { capabilities = app_RiseandShine.timeOfDay //now attribute = cap_userInput_attr_timeOfDay value = range_1 } /* one sig r1_cond1 extends r1_cond {} { capabilities = app_RiseandShine.state attribute = cap_state_attr_actionTakenOn value = cap_state_attr_actionTakenOn_val - cap_userInput_attr_dateString_val //cap_state_attr_actionTakenOn_val_dateString } */ one sig r1_cond2 extends r1_cond {} { capabilities = app_RiseandShine.location attribute = cap_location_attr_mode value = cap_location_attr_mode_val - app_RiseandShine.newMode } abstract sig r1_comm extends Command {} /* one sig r1_comm0 extends r1_comm {} { capability = app_RiseandShine.state attribute = cap_state_attr_actionTakenOn value = cap_state_attr_actionTakenOn_val_not_null } */ one sig r1_comm1 extends r1_comm {} { capability = app_RiseandShine.switches attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on }
programs/oeis/021/A021652.asm
neoneye/loda
22
88280
<reponame>neoneye/loda<gh_stars>10-100 ; A021652: Decimal expansion of 1/648. ; 0,0,1,5,4,3,2,0,9,8,7,6,5,4,3,2,0,9,8,7,6,5,4,3,2,0,9,8,7,6,5,4,3,2,0,9,8,7,6,5,4,3,2,0,9,8,7,6,5,4,3,2,0,9,8,7,6,5,4,3,2,0,9,8,7,6,5,4,3,2,0,9,8,7,6,5,4,3,2,0,9,8,7,6,5,4,3,2,0,9,8,7,6,5,4,3,2,0,9 add $0,1 mov $1,10 pow $1,$0 mul $1,7 div $1,4536 mod $1,10 mov $0,$1
oeis/142/A142404.asm
neoneye/loda-programs
11
4552
; A142404: Primes congruent to 19 mod 48. ; Submitted by <NAME> ; 19,67,163,211,307,499,547,643,691,739,787,883,1123,1171,1459,1699,1747,1987,2083,2131,2179,2371,2467,2659,2707,2803,2851,3187,3331,3571,3907,4003,4051,4099,4243,4339,4483,4723,5011,5059,5107,5347,5443,5683,5779,5827,5923,6067,6163,6211,6451,6547,6691,6883,7027,7219,7411,7459,7507,7603,7699,8179,8419,8467,8563,8707,8803,9043,9091,9187,9283,9619,9811,9859,9907,10099,10243,10531,10627,10723,10771,10867,11059,11251,11299,11443,11491,11587,11731,11779,11827,11923,11971,12163,12211,12451,12547,12739 mov $2,$0 pow $2,2 lpb $2 mov $3,$4 add $3,18 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $1,$0 max $1,0 cmp $1,$0 mul $2,$1 sub $2,1 add $4,48 lpe mov $0,$4 add $0,19
source/slim-menu_views.adb
reznikmm/slimp
0
3432
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Unchecked_Deallocation; with League.Strings; with Slim.Menu_Commands; with Slim.Players.Displays; package body Slim.Menu_Views is ---------- -- Back -- ---------- procedure Back (Self : in out Menu_View'Class) is use type Slim.Menu_Models.Menu_Path; Ignore : Boolean; begin Self.Current_Menu := Self.Menu.Parent (Self.Current_Menu); if Self.Current_Menu = Self.Menu.Root then Self.Current_Menu := Self.Menu.Root; Ignore := Self.Menu.Child (Self.Current_Menu); end if; end Back; ---------- -- Down -- ---------- procedure Down (Self : in out Menu_View'Class) is Ignore : Boolean; begin Ignore := Self.Menu.Next (Self.Current_Menu); end Down; ---------- -- Draw -- ---------- procedure Draw (Self : in out Menu_View'Class; Display : in out Slim.Players.Displays.Display) is Text : constant League.Strings.Universal_String := Self.Menu.Label (Self.Current_Menu); begin Slim.Players.Displays.Draw_Text (Self => Display, X => 1, Y => 2 - Slim.Fonts.Size (Self.Font.all, Text).Bottom, Font => Self.Font.all, Text => Text); end Draw; ----------- -- Enter -- ----------- procedure Enter (Self : in out Menu_View'Class) is procedure Free is new Ada.Unchecked_Deallocation (Slim.Menu_Commands.Menu_Command'Class, Slim.Menu_Commands.Menu_Command_Access); Command : Slim.Menu_Commands.Menu_Command_Access; begin if not Self.Menu.Child (Self.Current_Menu) then Command := Self.Menu.Enter_Command (Self.Current_Menu); if Command not in null then Command.Run; Free (Command); end if; end if; end Enter; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out Menu_View'Class; Menu : Slim.Menu_Models.Menu_Model_Access; Font : Slim.Fonts.Font_Access) is Ignore : Boolean; begin Self.Font := Font; Self.Menu := Menu; Self.Current_Menu := Menu.Root; Ignore := Menu.Child (Self.Current_Menu); end Initialize; ---------- -- Play -- ---------- procedure Play (Self : in out Menu_View'Class) is procedure Free is new Ada.Unchecked_Deallocation (Slim.Menu_Commands.Menu_Command'Class, Slim.Menu_Commands.Menu_Command_Access); Command : Slim.Menu_Commands.Menu_Command_Access; begin Command := Self.Menu.Play_Command (Self.Current_Menu); if Command not in null then Command.Run; Free (Command); end if; end Play; -------- -- Up -- -------- procedure Up (Self : in out Menu_View'Class) is Ignore : Boolean; begin Ignore := Self.Menu.Previous (Self.Current_Menu); end Up; end Slim.Menu_Views;
programs/oeis/096/A096978.asm
neoneye/loda
22
83601
; A096978: Sum of the areas of the first n Jacobsthal rectangles. ; 0,1,4,19,74,305,1208,4863,19398,77709,310612,1242907,4970722,19884713,79535216,318148151,1272578046,5090341317,20361307020,81445344595,325781145370,1303125047521,5212499258024,20849998896239,83399991856694,333599974883325,1334399884620228,5337599568307083,21350398213576018,85401592973608729,341606371655825632,1366425487100521127,5465701947447647342,21862807791699463733,87451231162980106236,349804924659555922371,1399219698622952694666,5596878794522352768337,22387515178028327094040,89550060712235476334815,358200242848697569421990,1432800971395278949522541,5731203885580138454421044,22924815542322508505022459,91699262169286124645413314,366797048677152317331006345,1467188194708593631825319248,5868752778834405802298689303,23475011115337560659199932638,93900044461350367736789379749,375600177845401220747178220652,1502400711381605383388671479347,6009602845526420532754768723962,24038411382105684132618909282753,96153645528422732527275968357256,384614582113690938115503210976591,1538458328454763736449214168811286,6153833313819054977822454025435357,24615333255276219847238621401361060,98461333021104879517056875006205035,393845332084419517812022721223298610 sub $1,$0 seq $0,110953 ; Starting a priori with the fraction 1/1, the denominators of fractions built according to the rule: add top and bottom to get the new bottom, add top and 9 times the bottom to get the new top. add $1,$0 div $1,9 mov $0,$1
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c45342a.ada
best08618/asylo
7
11114
-- C45342A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT CATENATION OF TWO OR MORE NON-NULL OPERANDS YIELDS THE -- CORRECT RESULT, WITH THE CORRECT BOUNDS, WHETHER BOUNDS ARE STATIC OR -- DYNAMIC. -- BHS 6/27/84 WITH REPORT; PROCEDURE C45342A IS USE REPORT; SUBTYPE S IS INTEGER RANGE 1..100; TYPE ARR IS ARRAY (S RANGE <>) OF INTEGER; A,B : ARR (2..9); FUNCTION F (AR_VAR1, AR_VAR2, AR_VAR3 : ARR) RETURN ARR IS BEGIN RETURN AR_VAR1 & AR_VAR2 & AR_VAR3; END F; PROCEDURE CAT (A : ARR; I1,I2 : INTEGER; NUM : CHARACTER) IS BEGIN IF A'FIRST /= I1 OR A'LAST /= I2 THEN FAILED ("INCORRECT CATENATION BOUNDS - " & NUM); END IF; END CAT; BEGIN TEST ("C45342A", "CHECK THAT CATENATION OF NON-NULL OPERANDS " & "YIELDS CORRECT RESULT WITH CORRECT BOUNDS"); BEGIN A := (1,2,3,4,5,6,7,8); B := A(2..4) & A(2..5) & A(2..2); IF B /= (1,2,3,1,2,3,4,1) THEN FAILED ("INCORRECT CATENATION RESULT - 1"); END IF; A := (8,7,6,5,4,3,2,1); IF F(A(2..3), A(2..4), A(2..4)) /= (8,7,8,7,6,8,7,6) THEN FAILED ("INCORRECT CATENATION RESULT - 2"); END IF; CAT ( A(3..5) & A(2..3), 3, 7, '3' ); END; DECLARE DYN2 : INTEGER := IDENT_INT(2); DYN3 : INTEGER := IDENT_INT(3); DYN4 : INTEGER := IDENT_INT(4); DYN6 : INTEGER := IDENT_INT(6); BEGIN A := (1,2,3,4,5,6,7,8); B := A(DYN2..DYN3) & A(DYN2..DYN4) & A(DYN2..DYN4); IF B /= (1,2,1,2,3,1,2,3) THEN FAILED ("INCORRECT CATENATION RESULT - 4"); END IF; A := (8,7,6,5,4,3,2,1); IF F ( A(DYN2..DYN6), A(DYN2..DYN3), A(DYN2..DYN2) ) /= (8,7,6,5,4,8,7,8) THEN FAILED ("INCORRECT CATENATION RESULT - 5"); END IF; CAT ( A(DYN3..5) & A(2..3), 3, 7, '6'); END; RESULT; END C45342A;
4-high/gel/source/world/gel-world-client.ads
charlie5/lace-alire
1
7193
with gel.World; limited with openGL.Renderer.lean; package gel.World.client -- -- Provides a gel world. -- is type Item is limited new gel.World.item with private; type View is access all Item'Class; type Views is array (Positive range <>) of View; --------- -- Forge -- package Forge is function to_World (Name : in String; Id : in world_Id; space_Kind : in physics.space_Kind; Renderer : access openGL.Renderer.lean.item'Class) return gel.World.client.item; function new_World (Name : in String; Id : in world_Id; space_Kind : in physics.space_Kind; Renderer : access openGL.Renderer.lean.item'Class) return gel.World.client.view; end Forge; overriding procedure destroy (Self : in out Item); procedure free (Self : in out View); -------------- --- Operations -- overriding procedure add (Self : access Item; the_Sprite : in gel.Sprite.view; and_Children : in Boolean := False); overriding procedure evolve (Self : in out Item); -- overriding -- procedure wait_on_evolve (Self : in out Item); -------------------- --- Server Mirroring -- procedure is_a_Mirror (Self : access Item'Class; of_World : in remote.World.view); overriding procedure motion_Updates_are (Self : in Item; Now : in remote.World.motion_Updates); -- -- 'Self' must use 'in' as mode to ensure async transmission with DSA. private protected type safe_id_Map_of_sprite is procedure add (the_Sprite : in Sprite.view); procedure rid (the_Sprite : in Sprite.view); function fetch (Id : in sprite_Id) return Sprite.view; function fetch_all return id_Maps_of_sprite.Map; private Map : id_Maps_of_sprite.Map; end safe_id_Map_of_sprite; type sprite_Map is limited new World.sprite_Map with record Map : safe_id_Map_of_sprite; end record; overriding function fetch (From : in sprite_Map) return id_Maps_of_sprite.Map; overriding procedure add (To : in out sprite_Map; the_Sprite : in Sprite.view); overriding procedure rid (To : in out sprite_Map; the_Sprite : in Sprite.view); -------------- --- World Item -- type Item is limited new gel.World.item with record Age_at_last_mirror_update : Duration := 0.0; all_Sprites : aliased sprite_Map; end record; overriding function all_Sprites (Self : access Item) return access World.sprite_Map'Class; end gel.World.client;
C.g4
Hofsiedge/OptimizingCompiler_for_C_subset
0
5977
grammar C; options { language=Python3; } @header { from nametable import SymbolTable, Int, Const, UnknownIDException from graph_colouring import colour_graph from tokens import * from operation_utils import * # BasicBlock, Definition, Usage, DUChain, InterferenceGraph } @members { name_table = SymbolTable() code = '' # generated code loops = 0 # current amount of loops du_chains = [] # list of definition-usage chains webs = [] # list of webs flow_graph = [BasicBlock()] # graph of basic-blocks (linear in this case) operations = flow_graph[0].operations # list of operations eax = EAX() } source_code @after { debug = True du_graph = DUNode.from_flowgraph(CParser.flow_graph) du_chains = DUChain.build_chains(du_graph) webs = Web.from_chains(du_chains) mapping = dict(enumerate(webs)) interference_graph = InterferenceGraph(du_graph, webs) colour_lists, priorities, registers = interference_graph.colour() interference_graph.allocate(colour_lists, priorities, registers) print('%include "io.inc"\n\nsection .bss') for var in (registers[3:] if len(registers) > 3 else []): print(f'{var}: resd 1') print('__temp: resd 1') print('\nsection .text\nglobal CMAIN\nCMAIN:\n\tMOV ebp,\tesp; for correct debugging') for block in CParser.flow_graph: for op in block.operations: print(op.code) if type(CParser.flow_graph[-1].operations[-1]) != RET: print('\tmov eax,\t0\n\tret') if debug: for block in CParser.flow_graph: print(f'\n; {block},\tl: {block.left},\tr: {block.right}') print('; <' + '-' * 20 + '>') for operation in block.operations: print('; ', type(operation), '\t', operation, '\t', operation.du) print('\n; du-chains:') for chain in du_chains: print('; ', chain) print('\n; Webs: ', webs) print("\n; Mapping: ", mapping) print('\n; Colours: ', colour_lists) """ print('\n; Adjacency list: ') for key in adj_list: print('; ', key, adj_list[key]) print('\n; Colour_lists:\n; ', colour_lists) for colour in colour_lists: print('\n; ', colour, sum([len(mapping[i].nodes) + 1 for i in colour_lists[colour]])) """ print(f'\n; priorities: {priorities}') print(f'\n; registers: {registers}') } : ( const_declaration | variable_declaration )* function_declaration+ ; expr returns [value, simplex, is_literal] : '(' expr ')' {$value = $expr.value} | return_expr // | conditional_expr // | '++' expr // | '--' expr // | expr '++' // | expr '--' // | '-' expr // | '~' expr // | '!' expr | l=expr operator=(MUL | DIV) r=expr {$l.value.in_stack = not ($l.simplex or $r.simplex)} {cls = MUL if $operator.text == '*' else DIV} {op = cls($l.value, $r.value, CParser.eax)} {CParser.operations.append(op)} {$value, $simplex = op, $l.is_literal and $r.is_literal} | l=expr operator=(ADD | SUB) r=expr {$l.value.in_stack = not ($l.simplex or $r.simplex)} {cls = ADD if $operator.text == '+' else SUB} {op = cls($l.value, $r.value, CParser.eax)} {CParser.operations.append(op)} {$value, $simplex = op, $l.is_literal and $r.is_literal} // | l=expr '&&' r=expr // | l=expr '||' r=expr // | expr '?' expr ':' expr | ID '=' expr {entity = CParser.name_table[$ID.text] } {if entity is None or not entity.mutable: } { raise UnknownIDException($ID.text) } {CParser.name_table.rewrite_var($ID.text)} {op = Assign(CParser.name_table[$ID.text].var, $expr.value, CParser.eax)} {CParser.operations.append(op)} {$value, $simplex = op, True} | ID '(' (expr (',' expr)*) ')' // function call placeholder | ID {if CParser.name_table[$ID.text] is None: } { raise UnknownIDException($ID.text) } {entity = CParser.name_table[$ID.text] } {$value = entity.var if entity.mutable else entity.value} {$simplex = True} | literal {$value, $simplex, $is_literal = $literal.value, True, True} ; body @init {CParser.name_table.push_scope()} @after {CParser.name_table.pop_scope()} : '{' ( expr SEMICOLON | variable_declaration | const_declaration | while_loop[CParser.loops] )* '}' ; condition returns [jmp] : l=expr ( '<' {$jmp = 'jge'} // jumps are inverted | '<=' {$jmp = 'jg'} | '>' {$jmp = 'jle'} | '>=' {$jmp = 'jl'} | '==' {$jmp = 'jne'} | '!=' {$jmp = 'je'} ) r=expr {CParser.operations.append(Condition($l.value, $r.value, CParser.eax))} ; variable_declaration : TYPE var=variable_subdeclaration {CParser.name_table[$var.name] = Int($var.name)} {if $var.expr_val != None: } { op = Assign(CParser.name_table[$var.name].var, $var.expr_val, CParser.eax) } { CParser.operations.append(op) } ( COMMA var=variable_subdeclaration {CParser.name_table[$var.name] = Int($var.name)} {if $var.expr_val != None: } { op = Assign(CParser.name_table[$var.name].var, $var.expr_val, CParser.eax) } { CParser.operations.append(op) } )* SEMICOLON ; variable_subdeclaration returns [name, expr_val] : ID {$name, $expr_val = $ID.text, None} (ASSIGN expr {$expr_val = $expr.value} )? ; const_declaration : (TYPE 'const'| 'const' TYPE) ID ASSIGN literal SEMICOLON {CParser.name_table[$ID.text] = Const($ID.text, $literal.value)} ; function_declaration : TYPE ID '(' ')' body ; /* conditional_expr : 'if' expr (body | expr SEMICOLON) ('else' (body | expr SEMICOLON))? ; */ while_loop[loop_id] @init { CParser.loops += 1 new_block_0 = BasicBlock(CParser.flow_graph[-1:]) CParser.flow_graph[-1].left = new_block_0 CParser.flow_graph.append(new_block_0) new_block_0.add(START_WHILE(loop_id)) new_block_1 = BasicBlock([new_block_0]) new_block_0.left = new_block_1 new_block_1.right = new_block_0 CParser.operations = new_block_0.operations } @after { new_block_2 = BasicBlock([new_block_1]) CParser.flow_graph[-1].left = new_block_2 CParser.flow_graph[-1].add(END_WHILE(loop_id)) CParser.flow_graph.append(new_block_2) CParser.operations = CParser.flow_graph[-1].operations } : 'while' '(' condition ')' {CParser.operations.append(MID_WHILE(loop_id, $condition.jmp))} {CParser.flow_graph.append(new_block_1) } {CParser.operations = new_block_1.operations} body ; return_expr : 'return' expr {CParser.operations.append(RET($expr.value, CParser.eax))} ; literal returns [value] : LITERAL {$value = Integer(int($LITERAL.text))} ; SEMICOLON : ';' ; TYPE : 'int' ; COMMA : ',' ; ASSIGN : '=' ; LITERAL : '-'? DIGIT+ ; ID : ALPHA (ALPHA | DIGIT)* ; WS : [ \r\n\t] + -> skip ; MUL : '*' ; ADD : '+' ; SUB : '-' ; DIV : '/' ; // MOD : '%' ; fragment DIGIT : [0-9] ; fragment ALPHA : [a-zA-Z] ;
drivers/video/ms/cirrus/mini/i386/clhard.asm
npocmaka/Windows-Server-2003
17
92719
<reponame>npocmaka/Windows-Server-2003 title "Cirrus Logic ASM routines" ; ;ONE_64K_BANK equ 1 TWO_32K_BANKS equ 1 ;++ ; ; Copyright (c) 1992 Microsoft Corporation ; ; Module Name: ; ; vgahard.asm ; ; Abstract: ; ; This module implements the banding code for the Cirrus Logic 6410,6420 ; and 542x VGA's. ; ; Environment: ; ; Kernel mode only. ; ; Revision History: ; ; ;-- .386p .xlist include callconv.inc .list ;---------------------------------------------------------------------------- ; ; Cirrus Logic banking control ports. ; GRAPHICS_ADDRESS_PORT equ 03ceh ;banking control here CL6420_BANKING_INDEX_PORT_A equ 0eh ;banking index register A is GR0E CL6420_BANKING_INDEX_PORT_B equ 0fh ;banking index register B is GR0F CL542x_BANKING_INDEX_PORT_A equ 09h ;banking index register A is GR09 CL542x_BANKING_INDEX_PORT_B equ 0ah ;banking index register B is GR0A SEQ_ADDRESS_PORT equ 03C4h ;Sequencer Address register IND_MEMORY_MODE equ 04h ;Memory Mode reg. index in Sequencer CHAIN4_MASK equ 08h ;Chain4 bit in Memory Mode register ;---------------------------------------------------------------------------- ;_TEXT SEGMENT DWORD USE32 PUBLIC 'CODE' ; ASSUME CS:FLAT, DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING _TEXT SEGMENT DWORD PUBLIC 'CODE' ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING ; ; Bank switching code. This is a 1-64K-read/1-64K-write bank adapter ; (VideoBanked1R1W). ; ; Input: ; EAX = desired read bank mapping ; EDX = desired write bank mapping ; ; Note: values must be correct, with no stray bits set; no error ; checking is performed. ; public _CL64xxBankSwitchStart public _CL64xxBankSwitchEnd public _CL64xxPlanarHCBankSwitchStart public _CL64xxPlanarHCBankSwitchEnd public _CL64xxEnablePlanarHCStart public _CL64xxEnablePlanarHCEnd public _CL64xxDisablePlanarHCStart public _CL64xxDisablePlanarHCEnd public _CL542xBankSwitchStart public _CL542xBankSwitchEnd public _CL542xPlanarHCBankSwitchStart public _CL542xPlanarHCBankSwitchEnd public _CL542xEnablePlanarHCStart public _CL542xEnablePlanarHCEnd public _CL542xDisablePlanarHCStart public _CL542xDisablePlanarHCEnd public _CL543xBankSwitchStart public _CL543xBankSwitchEnd public _CL543xPlanarHCBankSwitchStart public _CL543xPlanarHCBankSwitchEnd align 4 ;---------------------------------------------------------------------------- _CL64xxBankSwitchStart proc ;start of bank switch code _CL64xxPlanarHCBankSwitchStart: ;start of planar HC bank switch code, ; which is the same code as normal ; bank switching shl eax,3 ;shift them to bits 7-4 shl edx,3 ;shift them to bits 7-4 ;!!!! NOTE: The October 1992 release NT VGA driver assumes that the Graphics ; index is not changed by the bank switch code. We save it on the ; stack (and save the write bank value in the high order of edx) ; and restore it at the end of the routine. If the NT VGA driver ; changes so that it is the index need not be preserved, this code ; could be simplified (and speeded up!) rol edx,16 ; save write value mov ah,al mov dx,GRAPHICS_ADDRESS_PORT ;banking control port in al,dx ; save graphics index push eax mov al,CL6420_BANKING_INDEX_PORT_A out dx,ax ;select the READ bank rol edx,16 mov ah,dl mov al,CL6420_BANKING_INDEX_PORT_B mov dx,GRAPHICS_ADDRESS_PORT ;banking control port out dx,ax ;select the WRITE bank pop eax out dx,al ret _CL64xxBankSwitchEnd: _CL64xxPlanarHCBankSwitchEnd: align 4 _CL64xxEnablePlanarHCStart: mov dx,SEQ_ADDRESS_PORT in al,dx push eax ;preserve the state of the Seq Address mov al,IND_MEMORY_MODE out dx,al ;point to the Memory Mode register inc edx in al,dx ;get the state of the Memory Mode reg and al,NOT CHAIN4_MASK ;turn off Chain4 to make memory planar out dx,al dec edx pop eax out dx,al ;restore the original Seq Address ERA1_INDEX equ 0A1h mov dx,GRAPHICS_ADDRESS_PORT in al,dx push eax ;preserve the Graphics Index mov al,ERA1_INDEX out dx,al ;point to ERA1 inc edx in al,dx ; get ERA1 and al,not 30h ; turn off the shift bits out dx,al dec edx pop eax out dx,al ;restore the original Graphics Index ret _CL64xxEnablePlanarHCEnd: align 4 _CL64xxDisablePlanarHCStart: mov dx,SEQ_ADDRESS_PORT in al,dx push eax ;preserve the state of the Seq Address mov al,IND_MEMORY_MODE out dx,al ;point to the Memory Mode register inc edx in al,dx ;get the state of the Memory Mode reg or al,CHAIN4_MASK ;turn on Chain4 to make memory linear out dx,al dec edx pop eax out dx,al ;restore the original Seq Address mov dx,GRAPHICS_ADDRESS_PORT in al,dx push eax ;preserve the Graphics Index mov al,ERA1_INDEX out dx,al ;point to ERA1 inc edx in al,dx ; get ERA1 and al,not 30h or al,20h out dx,al dec edx pop eax out dx,al ;restore the original Graphics Index ret _CL64xxDisablePlanarHCEnd: _CL64xxBankSwitchStart endp _CL542xBankSwitchStart proc ;start of bank switch code _CL542xPlanarHCBankSwitchStart: ;start of planar HC bank switch code, ; which is the same code as normal ; bank switching shl eax,3 ;shift them to bits 7-4 shl edx,3 ;shift them to bits 7-4 ;!!!! NOTE: The October 1992 release NT VGA driver assumes that the Graphics ; index is not changed by the bank switch code. We save it on the ; stack (and save the write bank value in the high order of edx) ; and restore it at the end of the routine. If the NT VGA driver ; changes so that it is the index need not be preserved, this code ; could be simplified (and speeded up!) rol edx,16 ; save write value mov ah,al mov dx,GRAPHICS_ADDRESS_PORT ;banking control port in al,dx push eax mov al,CL542x_BANKING_INDEX_PORT_A out dx,ax ;select the READ bank rol edx,16 ; restore write value mov ah,dl mov al,CL542x_BANKING_INDEX_PORT_B mov dx,GRAPHICS_ADDRESS_PORT ;banking control port out dx,ax ;select the WRITE bank pop eax out dx,al ret _CL542xBankSwitchEnd: _CL542xPlanarHCBankSwitchEnd: align 4 _CL542xEnablePlanarHCStart: mov dx,SEQ_ADDRESS_PORT in al,dx push eax ;preserve the state of the Seq Address mov al,IND_MEMORY_MODE out dx,al ;point to the Memory Mode register inc edx in al,dx ;get the state of the Memory Mode reg and al,NOT CHAIN4_MASK ;turn off Chain4 to make memory planar out dx,al dec edx pop eax out dx,al ;restore the original Seq Address ret _CL542xEnablePlanarHCEnd: align 4 _CL542xDisablePlanarHCStart: mov dx,SEQ_ADDRESS_PORT in al,dx push eax ;preserve the state of the Seq Address mov al,IND_MEMORY_MODE out dx,al ;point to the Memory Mode register inc edx in al,dx ;get the state of the Memory Mode reg or al,CHAIN4_MASK ;turn on Chain4 to make memory linear out dx,al dec edx pop eax out dx,al ;restore the original Seq Address ret _CL542xDisablePlanarHCEnd: _CL542xBankSwitchStart endp ; ; 543x banking assumes 16k granularity to allow up to 4-meg modes ; _CL543xBankSwitchStart proc ;start of bank switch code _CL543xPlanarHCBankSwitchStart: ;start of planar HC bank switch code, ; which is the same code as normal ; bank switching shl eax,1 ;shift them to bits 4-1 shl edx,1 ;shift them to bits 4-1 ;!!!! NOTE: The October 1992 release NT VGA driver assumes that the Graphics ; index is not changed by the bank switch code. We save it on the ; stack (and save the write bank value in the high order of edx) ; and restore it at the end of the routine. If the NT VGA driver ; changes so that it is the index need not be preserved, this code ; could be simplified (and speeded up!) rol edx,16 ; save write value mov ah,al mov dx,GRAPHICS_ADDRESS_PORT ;banking control port in al,dx push eax mov al,CL542x_BANKING_INDEX_PORT_A out dx,ax ;select the READ bank rol edx,16 ; restore write value mov ah,dl mov al,CL542x_BANKING_INDEX_PORT_B mov dx,GRAPHICS_ADDRESS_PORT ;banking control port out dx,ax ;select the WRITE bank pop eax out dx,al ret _CL543xBankSwitchEnd: _CL543xPlanarHCBankSwitchEnd: _CL543xBankSwitchStart endp _TEXT ends end
libsrc/_DEVELOPMENT/string/c/sdcc_iy/stricmp.asm
jpoikela/z88dk
640
29178
; int stricmp(const char *s1, const char *s2) SECTION code_clib SECTION code_string PUBLIC _stricmp EXTERN _strcasecmp defc _stricmp = _strcasecmp
patches/bank3e.asm/link.asm
spicefather/LADXR
0
247308
InitLink: ; Switch on the link port in receive mode with interrupts enabled. ld a, $0F ldh [$01], a ld a, $82 ldh [$02], a ld a, $01 ; switch to RunLink ld [$CEFF], a ret RunLink: ; Load the command byte, and only continue if there is a command. ld a, [$CEFE] and a ret z ; Reset our command byte to zero, and set HL to point at the data byte ld hl, $CEFE ld b, $00 ld [hl], b and $0F rst 0 dw LinkTestMessage dw LinkItem LinkTestMessage: ld a, $41 call $3273 ; open dialog in table 1 ret LinkItem: ld a, [$CEFD] ; get data byte ldh [$F1], a call GiveItemFromChestNoLink call ItemMessageNoLink ret LinkSendByte: ld e, a .repeat: ld a, e ldh [$01], a ld a, $83 ldh [$02], a .sendWait: ldh a, [$02] and $80 jr nz, .sendWait ldh a, [$01] cp $0F ; Check if our byte is acknowledged. jr nz, .repeat ; Back to receive mode ld a, $0F ldh [$01], a ld a, $82 ldh [$02], a ret
libsrc/_DEVELOPMENT/alloc/balloc/c/sccz80/balloc_alloc.asm
teknoplop/z88dk
0
80650
<reponame>teknoplop/z88dk<gh_stars>0 ; void *balloc_alloc(unsigned int queue) SECTION code_clib SECTION code_alloc_balloc PUBLIC balloc_alloc EXTERN asm_balloc_alloc defc balloc_alloc = asm_balloc_alloc
Appl/Icon/Document/documentOptions.asm
steakknife/pcgeos
504
83858
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: Icon Editor FILE: documentOptions.asm AUTHOR: <NAME>, Apr 8, 1993 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/ 8/93 Initial revision DESCRIPTION: Code to implement various options in the Options menu. $Id: documentOptions.asm,v 1.1 97/04/04 16:06:05 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OptionsCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IASetOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sends options to all documents. CALLED BY: MSG_ICON_APPLICATION_SET_OPTIONS PASS: *ds:si = IconApplicationClass object ds:di = IconApplicationClass instance data RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/23/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IASetOptions method dynamic IconApplicationClass, MSG_ICON_APPLICATION_SET_OPTIONS uses ax, cx, dx, bp .enter ; ; Get the options. ; GetResourceHandleNS OptionsBooleanGroup, bx mov si, offset OptionsBooleanGroup mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_GEN_BOOLEAN_GROUP_GET_SELECTED_BOOLEANS call ObjMessage ; ; Record a classed event for the options. ; mov_tr cx, ax ; cx = options GetResourceSegmentNS DBViewerClass, es mov bx, es mov si, offset DBViewerClass mov ax, MSG_DB_VIEWER_SET_OPTIONS mov di, mask MF_RECORD call ObjMessage ; ^hdi = event ; ; Send the options to each document ; mov cx, di ; ^hcx = event GetResourceHandleNS IconDocumentGroup, bx mov si, offset IconDocumentGroup clr di mov ax, MSG_GEN_SEND_TO_CHILDREN call ObjMessage .leave ret IASetOptions endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DBViewerSetOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Deals with the user changing an option in the options menu. CALLED BY: MSG_DB_VIEWER_SET_OPTIONS PASS: *ds:si = DBViewer object ds:di = DBViewerInstance cx = IconOptions RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 9/29/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DBViewerSetOptions method dynamic DBViewerClass, MSG_DB_VIEWER_SET_OPTIONS call ViewerSetDatabase call ViewerSetFormatArea ; deal with that option call ViewerSetFatbits ; deal with fatbits ret DBViewerSetOptions endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ViewerSetFormatArea %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Shows or hides the format area CALLED BY: DBViewerSetOptions PASS: *ds:si = DBViewer object ds:di = DBViewerInstance cx = selected booleans RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: Set the format view usable or not-usable, depending on the passed option. The catch is, we resize the primary if it's set not-usable, to keep the blank space from just generally loooking ugly. REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 10/26/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ViewerSetFormatArea proc near class DBViewerClass uses ax,bx,cx,dx,si,di,bp .enter test cx, mask IO_SHOW_FORMAT ; mask out other bits jnz setUsable ; ; Set format view not-usable ; mov ax, MSG_GEN_SET_NOT_USABLE jmp short setIt setUsable: mov ax, MSG_GEN_SET_USABLE setIt: mov bx, ds:[di].GDI_display mov si, offset FormatView mov di, mask MF_CALL or mask MF_FIXUP_DS mov dl, VUM_NOW call ObjMessage .leave ret ViewerSetFormatArea endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ViewerSetFatbits %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Shows or hides the fatbits CALLED BY: DBViewerSetOptions PASS: *ds:si = DBViewer object ds:di = DBViewerInstance cx = selected booleans RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: - sets the fatbits usable or not-usable - if they were set not-usable, redraw the primary (turning off the fatbits has a large effect on the geometry; redrawing the primary may help it out some.) REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 10/26/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ViewerSetFatbits proc near class DBViewerClass uses ax,bx,cx,dx,si,di,bp .enter ; ; See what the user's doing with the fatbits ; test cx, mask IO_SHOW_FATBITS jnz setFatbitsUsable mov ax, MSG_GEN_SET_NOT_USABLE jmp short setThem setFatbitsUsable: mov ax, MSG_GEN_SET_USABLE setThem: mov bx, ds:[di].GDI_display mov si, offset FatbitsView mov di, mask MF_CALL mov dl, VUM_NOW call ObjMessage .leave ret ViewerSetFatbits endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ViewerSetDatabase %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Shows or hides the database viewer. CALLED BY: DBViewerSetOptions PASS: *ds:si = DBViewer object ds:di = DBViewerInstance cx = selected booleans RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/ 8/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ViewerSetDatabase proc near class DBViewerClass uses ax,bx,cx,dx,si,di,bp .enter ; ; See whether we should show them or hide them. ; test cx, mask IO_SHOW_DATABASE jnz setUsable ; ; Do it. ; mov ax, MSG_GEN_SET_NOT_USABLE jmp short setIt setUsable: mov ax, MSG_GEN_SET_USABLE setIt: mov bx, ds:[di].GDI_display mov si, offset IconDBView mov di, mask MF_CALL or mask MF_FIXUP_DS mov dl, VUM_NOW call ObjMessage .leave ret ViewerSetDatabase endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DBViewerSetFormatOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Basically pops in or out the format list. CALLED BY: MSG_DB_VIEWER_SET_FORMAT_OPTIONS PASS: *ds:si = DBViewerClass object ds:di = DBViewerClass instance data cx = FormatOptions RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/24/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DBViewerSetFormatOptions method dynamic DBViewerClass, MSG_DB_VIEWER_SET_FORMAT_OPTIONS uses ax, cx, dx, bp .enter call PopFormatList .leave ret DBViewerSetFormatOptions endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PopFormatList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: pops out or pops in the format view interaction CALLED BY: DBViewerSetFormatOptions PASS: *ds:si = DBViewer object ds:di = DBViewerInstance cx = options (selected booleans) RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 11/25/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PopFormatList proc near class DBViewerClass uses ax,bx,cx,dx,si,di,bp .enter test cx, mask FO_FLOATING_FORMATS ; isolate our bit jz popin ; ; Pop out the format list ; mov ax, MSG_GEN_INTERACTION_POP_OUT jmp short setIt popin: mov ax, MSG_GEN_INTERACTION_POP_IN setIt: mov bx, ds:[di].GDI_display mov si, offset FormatViewGroup mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage .leave ret PopFormatList endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IASaveOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: save-options handler for IconApplicationClass CALLED BY: MSG_META_SAVE_OPTIONS PASS: *ds:si = IconApplicationClass object ds:di = IconApplicationClass instance data RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/14/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IASaveOptions method dynamic IconApplicationClass, MSG_META_SAVE_OPTIONS .enter call IconMarkBusy ; ; Call the superclass. ; mov di, offset IconApplicationClass call ObjCallSuperNoLock ; ; Get the show/hide options. ; push si GetResourceHandleNS OptionsBooleanGroup, bx mov si, offset OptionsBooleanGroup mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_GEN_BOOLEAN_GROUP_GET_SELECTED_BOOLEANS call ObjMessage pop si mov bp, ax ; bp <- options ; ; Get our category. ; sub sp, INI_CATEGORY_BUFFER_SIZE movdw cxdx, sssp push bp ; save options mov ax, MSG_META_GET_INI_CATEGORY call ObjCallInstanceNoLock pop bp ; restore options ; ; Write the show/hide options. ; mov ax, sp push si, ds segmov ds, ss mov_tr si, ax ; ds:si = category mov cx, cs mov dx, offset featuresKey call InitFileWriteInteger ; ; Write the current fatbit size. ; mov dx, offset IBSKey ; cx:dx = key call IconAppGetImageBitSize ; ax = ImageBitSize mov_tr bp, ax call InitFileWriteInteger pop si, ds add sp, INI_CATEGORY_BUFFER_SIZE call IconMarkNotBusy .leave ret featuresKey char "features", 0 IBSKey char "imageBitSize", 0 IASaveOptions endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IALoadOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Load our options from the ini file. CALLED BY: MSG_META_LOAD_OPTIONS PASS: *ds:si = IconApplicationClass object ds:di = IconApplicationClass instance data RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/14/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IALoadOptions method dynamic IconApplicationClass, MSG_META_LOAD_OPTIONS .enter ; ; Call the superclass. ; mov di, offset IconApplicationClass call ObjCallSuperNoLock ; ; Get the ini file category. ; sub sp, INI_CATEGORY_BUFFER_SIZE movdw cxdx, sssp mov ax, MSG_META_GET_INI_CATEGORY call ObjCallInstanceNoLock mov ax, sp push si, ds segmov ds, ss mov_tr si, ax mov cx, cs mov dx, offset featuresKey call InitFileReadInteger jc doneFeatures ; ; Set the options in the boolean group. ; call SetBooleans doneFeatures: mov dx, offset IBSKey call InitFileReadInteger pop si, ds ; instance mov bp, sp lea sp, ss:[bp+INI_CATEGORY_BUFFER_SIZE] jc doneFatbits ; ; Set the fatbit size. ; call SetFatbits doneFatbits: ; ; tools. ; .leave ret IALoadOptions endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SetBooleans %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sets options in OptionsBooleanGroup CALLED BY: IALoadOptions PASS: ax = booleans RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/14/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SetBooleans proc near uses ax,bx,cx,dx,si,di,bp .enter GetResourceHandleNS OptionsBooleanGroup, bx mov si, offset OptionsBooleanGroup mov di, mask MF_CALL or mask MF_FIXUP_DS mov_tr cx, ax clr dx mov ax, MSG_GEN_BOOLEAN_GROUP_SET_GROUP_STATE call ObjMessage .leave ret SetBooleans endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SetFatbits %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sets the fatbit size in FatbitImageSizeGroup CALLED BY: IALoadOptions PASS: ax = fatbit size RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 4/14/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SetFatbits proc near uses ax,bx,cx,dx,si,di,bp .enter GetResourceHandleNS FatbitImageSizeGroup, bx mov si, offset FatbitImageSizeGroup mov di, mask MF_CALL or mask MF_FIXUP_DS mov_tr cx, ax clr dx mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION call ObjMessage .leave ret SetFatbits endp OptionsCode ends
4-high/gel/source/dolly/gel-dolly.adb
charlie5/lace
20
3889
with ada.unchecked_Deallocation; package body gel.Dolly is use Math; procedure free (Self : in out View) is procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View); begin if Self = null then return; end if; Self.destroy; deallocate (Self); end free; -------------- --- Attributes -- procedure add_Camera (Self : in out Item'Class; the_Camera : in Camera.view) is begin Self.Cameras.append (the_Camera); end add_Camera; procedure is_moving (Self : in out Item'Class; Direction : dolly.Direction; Now : in Boolean := True) is begin Self.Motion (Direction) := Now; end is_moving; procedure is_spinning (Self : in out Item'Class; Direction : dolly.Direction; Now : in Boolean := True) is begin Self.Spin (Direction) := Now; end is_spinning; procedure is_orbiting (Self : in out Item'Class; Direction : dolly.Direction; Now : in Boolean := True) is begin Self.Orbit (Direction) := Now; end is_orbiting; procedure Speed_is (Self : in out Item; Now : in Real) is begin Self.Speed := Now; end Speed_is; function Speed (Self : in Item) return Real is begin return Self.Speed; end Speed; procedure speed_Multiplier_is (Self : in out Item; Now : in Real) is begin Self.Multiplier := Now; end speed_Multiplier_is; end gel.Dolly;
src/dovado_rtl/antlr/grammars/VerilogLexer.g4
DavideConficconi/dovado
0
1825
// Author: <NAME> // License: MIT lexer grammar VerilogLexer; channels { COMMENTS, DIRECTIVES } // Keywords ALWAYS : 'always' ; AND : 'and' ; ASSIGN : 'assign' ; AUTOMATIC : 'automatic' ; BEGIN : 'begin' ; BUF : 'buf' ; BUFIF0 : 'bufif0' ; BUFIF1 : 'bufif1' ; CASE : 'case' ; CASEX : 'casex' ; CASEZ : 'casez' ; CELL : 'cell' ; CMOS : 'cmos' ; CONFIG : 'config' ; DEASSIGN : 'deassign' ; DEFAULT : 'default' ; DEFPARAM : 'defparam' ; DESIGN : 'design' ; DISABLE : 'disable' ; EDGE : 'edge' ; ELSE : 'else' ; END : 'end' ; ENDCASE : 'endcase' ; ENDCONFIG : 'endconfig' ; ENDFUNCTION : 'endfunction' ; ENDGENERATE : 'endgenerate' ; ENDMODULE : 'endmodule' ; ENDPRIMITIVE : 'endprimitive' ; ENDSPECIFY : 'endspecify' ; ENDTABLE : 'endtable' ; ENDTASK : 'endtask' ; EVENT : 'event' ; FOR : 'for' ; FORCE : 'force' ; FOREVER : 'forever' ; FORK : 'fork' ; FUNCTION : 'function' ; GENERATE : 'generate' ; GENVAR : 'genvar' ; HIGHZ0 : 'highz0' ; HIGHZ1 : 'highz1' ; IF : 'if' ; IFNONE : 'ifnone' ; INCDIR : 'incdir' ; INCLUDE : 'include' -> mode(LIBRARY_SOURCE_TEXT_MODE) ; INITIAL : 'initial' ; INOUT : 'inout' ; INPUT : 'input' ; INSTANCE : 'instance' ; INTEGER : 'integer' ; JOIN : 'join' ; LARGE : 'large' ; LIBLIST : 'liblist' ; LIBRARY : 'library' -> mode(LIBRARY_SOURCE_TEXT_MODE) ; LOCALPARAM : 'localparam' ; MACROMODULE : 'macromodule' ; MEDIUM : 'medium' ; MODULE : 'module' ; NAND : 'nand' ; NEGEDGE : 'negedge' ; NMOS : 'nmos' ; NOR : 'nor' ; NOSHOWCANCELLED : 'noshowcancelled' ; NOT : 'not' ; NOTIF0 : 'notif0' ; NOTIF1 : 'notif1' ; OR : 'or' ; OUTPUT : 'output' ; PARAMETER : 'parameter' ; PMOS : 'pmos' ; POSEDGE : 'posedge' ; PRIMITIVE : 'primitive' ; PULL0 : 'pull0' ; PULL1 : 'pull1' ; PULLDOWN : 'pulldown' ; PULLUP : 'pullup' ; PULSESTYLE_ONEVENT : 'pulsestyle_onevent' ; PULSESTYLE_ONDETECT : 'pulsestyle_ondetect' ; RCMOS : 'rcmos' ; REAL : 'real' ; REALTIME : 'realtime' ; REG : 'reg' ; RELEASE : 'release' ; REPEAT : 'repeat' ; RNMOS : 'rnmos' ; RPMOS : 'rpmos' ; RTRAN : 'rtran' ; RTRANIF0 : 'rtranif0' ; RTRANIF1 : 'rtranif1' ; SCALARED : 'scalared' ; SHOWCANCELLED : 'showcancelled' ; SIGNED : 'signed' ; SMALL : 'small' ; SPECIFY : 'specify' ; SPECPARAM : 'specparam' ; STRONG0 : 'strong0' ; STRONG1 : 'strong1' ; SUPPLY0 : 'supply0' ; SUPPLY1 : 'supply1' ; TABLE : 'table' ; TASK : 'task' ; TIME : 'time' ; TRAN : 'tran' ; TRANIF0 : 'tranif0' ; TRANIF1 : 'tranif1' ; TRI : 'tri' ; TRI0 : 'tri0' ; TRI1 : 'tri1' ; TRIAND : 'triand' ; TRIOR : 'trior' ; TRIREG : 'trireg' ; UNSIGNED : 'unsigned' ; USE : 'use' ; UWIRE : 'uwire' ; VECTORED : 'vectored' ; WAIT : 'wait' ; WAND : 'wand' ; WEAK0 : 'weak0' ; WEAK1 : 'weak1' ; WHILE : 'while' ; WIRE : 'wire' ; WOR : 'wor' ; XNOR : 'xnor' ; XOR : 'xor' ; // System tasks and functions // Display tasks DOLLAR_DISPLAY : '$display' ; DOLLAR_DISPLAYB : '$displayb' ; DOLLAR_DISPLAYH : '$displayh' ; DOLLAR_DISPLAYO : '$displayo' ; DOLLAR_WRITE : '$write' ; DOLLAR_WRITEB : '$writeb' ; DOLLAR_WRITEH : '$writeh' ; DOLLAR_WRITEO : '$writeo' ; DOLLAR_STROBE : '$strobe' ; DOLLAR_STROBEB : '$strobeb' ; DOLLAR_STROBEH : '$strobeh' ; DOLLAR_STROBEO : '$strobeo' ; DOLLAR_MONITOR : '$monitor' ; DOLLAR_MONITORB : '$monitorb' ; DOLLAR_MONITORH : '$monitorh' ; DOLLAR_MONITORO : '$monitoro' ; DOLLAR_MONITOROFF : '$monitoroff' ; DOLLAR_MONITORON : '$monitoron' ; // File I/O tasks DOLLAR_FCLOSE : '$fclose' ; DOLLAR_FDISPLAY : '$fdisplay' ; DOLLAR_FDISPLAYB : '$fdisplayb' ; DOLLAR_FDISPLAYH : '$fdisplayh' ; DOLLAR_FDISPLAYO : '$fdisplayo' ; DOLLAR_FSTROBE : '$fstrobe' ; DOLLAR_FSTROBEB : '$fstrobeb' ; DOLLAR_FSTROBEH : '$fstrobeh' ; DOLLAR_FSTROBEO : '$fstrobeo' ; DOLLAR_SWRITE : '$swrite' ; DOLLAR_SWRITEB : '$swriteb' ; DOLLAR_SWRITEH : '$swriteh' ; DOLLAR_SWRITEO : '$swriteo' ; DOLLAR_FSCANF : '$fscanf' ; DOLLAR_FREAD : '$fread' ; DOLLAR_FSEEK : '$fseek' ; DOLLAR_FFLUSH : '$fflush' ; DOLLAR_FEOF : '$feof' ; DOLLAR_SDF_ANNOTATE : '$sdf_annotate' ; DOLLAR_FOPEN : '$fopen' ; DOLLAR_FWRITE : '$fwrite' ; DOLLAR_FWRITEB : '$fwriteb' ; DOLLAR_FWRITEH : '$fwriteh' ; DOLLAR_FWRITEO : '$fwriteo' ; DOLLAR_FMONITOR : '$fmonitor' ; DOLLAR_FMONITORB : '$fmonitorb' ; DOLLAR_FMONITORH : '$fmonitorh' ; DOLLAR_FMONITORO : '$fmonitoro' ; DOLLAR_SFORMAT : '$sformat' ; DOLLAR_FGETC : '$fgetc' ; DOLLAR_UNGETC : '$ungetc' ; DOLLAR_FGETS : '$fgets' ; DOLLAR_SSCANF : '$sscanf' ; DOLLAR_REWIND : '$rewind' ; DOLLAR_FTELL : '$ftell' ; DOLLAR_FERROR : '$ferror' ; DOLLAR_READMEMB : '$readmemb' ; DOLLAR_READMEMH : '$readmemh' ; // Timescale tasks DOLLAR_PRINTTIMESCALE : '$printtimescale' ; DOLLAR_TIMEFORMAT : '$timeformat' ; // Simulation control tasks DOLLAR_FINISH : '$finish' ; DOLLAR_STOP : '$stop' ; // PLA modeling tasks DOLLAR_ASYNC_AND_ARRAY : '$async$and$array' ; DOLLAR_ASYNC_NAND_ARRAY : '$async$nand$array' ; DOLLAR_ASYNC_OR_ARRAY : '$async$or$array' ; DOLLAR_ASYNC_NOR_ARRAY : '$async$nor$array' ; DOLLAR_SYNC_AND_ARRAY : '$sync$and$array' ; DOLLAR_SYNC_NAND_ARRAY : '$sync$nand$array' ; DOLLAR_SYNC_OR_ARRAY : '$sync$or$array' ; DOLLAR_SYNC_NOR_ARRAY : '$sync$nor$array' ; DOLLAR_ASYNC_AND_PLANE : '$async$and$plane' ; DOLLAR_ASYNC_NAND_PLANE : '$async$nand$plane' ; DOLLAR_ASYNC_OR_PLANE : '$async$or$plane' ; DOLLAR_ASYNC_NOR_PLANE : '$async$nor$plane' ; DOLLAR_SYNC_AND_PLANE : '$sync$and$plane' ; DOLLAR_SYNC_NAND_PLANE : '$sync$nand$plane' ; DOLLAR_SYNC_OR_PLANE : '$sync$or$plane' ; DOLLAR_SYNC_NOR_PLANE : '$sync$nor$plane' ; // Stochastic analysis tasks DOLLAR_Q_INITIALIZE : '$q_initialize' ; DOLLAR_Q_REMOVE : '$q_remove' ; DOLLAR_Q_EXAM : '$q_exam' ; DOLLAR_Q_ADD : '$q_add' ; DOLLAR_Q_FULL : '$q_full' ; // Simulation time functions DOLLAR_REALTIME : '$realtime' ; DOLLAR_TIME : '$time' ; DOLLAR_STIME : '$stime' ; // Conversion functions DOLLAR_BITSTOREAL : '$bitstoreal' ; DOLLAR_ITOR : '$itor' ; DOLLAR_SIGNED : '$signed' ; DOLLAR_REALTOBITS : '$realtobits' ; DOLLAR_RTOI : '$rtoi' ; DOLLAR_UNSIGNED : '$unsigned' ; // Probabilistic distribution functions DOLLAR_RANDOM : '$random' ; DOLLAR_DIST_ERLANG : '$dist_erlang' ; DOLLAR_DIST_NORMAL : '$dist_normal' ; DOLLAR_DIST_T : '$dist_t' ; DOLLAR_DIST_CHI_SQUARE : '$dist_chi_square' ; DOLLAR_DIST_EXPONENTIAL : '$dist_exponential' ; DOLLAR_DIST_POISSON : '$dist_poisson' ; DOLLAR_DIST_UNIFORM : '$dist_uniform' ; // Command line input DOLLAR_TEST_PLUSARGS : '$test$plusargs' ; DOLLAR_VALUE_PLUSARGS : '$value$plusargs' ; // Math functions DOLLAR_CLOG2 : '$clog2' ; DOLLAR_LN : '$ln' ; DOLLAR_LOG10 : '$log10' ; DOLLAR_EXP : '$exp' ; DOLLAR_SQRT : '$sqrt' ; DOLLAR_POW : '$pow' ; DOLLAR_FLOOR : '$floor' ; DOLLAR_CEIL : '$ceil' ; DOLLAR_SIN : '$sin' ; DOLLAR_COS : '$cos' ; DOLLAR_TAN : '$tan' ; DOLLAR_ASIN : '$asin' ; DOLLAR_ACOS : '$acos' ; DOLLAR_ATAN : '$atan' ; DOLLAR_ATAN2 : '$atan2' ; DOLLAR_HYPOT : '$hypot' ; DOLLAR_SINH : '$sinh' ; DOLLAR_COSH : '$cosh' ; DOLLAR_TANH : '$tanh' ; DOLLAR_ASINH : '$asinh' ; DOLLAR_ACOSH : '$acosh' ; DOLLAR_ATANH : '$atanh' ; // Value change dump (VCD) functions DOLLAR_DUMPFILE : '$dumpfile' ; DOLLAR_DUMPVARS : '$dumpvars' ; DOLLAR_DUMPOFF : '$dumpoff' ; DOLLAR_DUMPON : '$dumpon' ; DOLLAR_DUMPALL : '$dumpall' ; DOLLAR_DUMPLIMIT : '$dumplimit' ; DOLLAR_DUMPFLUSH : '$dumpflush' ; DOLLAR_END : '$end' ; DOLLAR_COMMENT : '$comment' ; DOLLAR_DATE : '$date' ; DOLLAR_ENDDEFINITIONS : '$enddefinitions' ; DOLLAR_SCOPE : '$scope' ; DOLLAR_TIMESCALE : '$timescale' ; DOLLAR_UPSCOPE : '$upscope' ; DOLLAR_VAR : '$var' ; DOLLAR_VERSION : '$version' ; DOLLAR_DUMPPORTS : '$dumpports' ; DOLLAR_DUMPPORTSOFF : '$dumpportsoff' ; DOLLAR_DUMPPORTSON : '$dumpportson' ; DOLLAR_DUMPPORTSALL : '$dumpportsall' ; DOLLAR_DUMPPORTSLIMIT : '$dumpportslimit' ; DOLLAR_DUMPPORTSFLUSH : '$dumpportsflush' ; DOLLAR_VCDCLOSE : '$vcdclose' ; // System timing check commands DOLLAR_SETUP : '$setup' ; DOLLAR_HOLD : '$hold' ; DOLLAR_SETUPHOLD : '$setuphold' ; DOLLAR_RECOVERY : '$recovery' ; DOLLAR_REMOVAL : '$removal' ; DOLLAR_RECREM : '$recrem' ; DOLLAR_SKEW : '$skew' ; DOLLAR_TIMESKEW : '$timeskew' ; DOLLAR_FULLSKEW : '$fullskew' ; DOLLAR_PERIOD : '$period' ; DOLLAR_WIDTH : '$width' ; DOLLAR_NOCHANGE : '$nochange' ; // Numbers REAL_NUMBER : UNSIGNED_NUMBER DOT UNSIGNED_NUMBER | UNSIGNED_NUMBER (DOT UNSIGNED_NUMBER)? EXP SIGN? UNSIGNED_NUMBER ; fragment EXP : [eE] ; DECIMAL_NUMBER : UNSIGNED_NUMBER | SIZE? DECIMAL_BASE DECIMAL_VALUE ; BINARY_NUMBER : SIZE? BINARY_BASE BINARY_VALUE ; OCTAL_NUMBER : SIZE? OCTAL_BASE OCTAL_VALUE ; HEX_NUMBER : SIZE? HEX_BASE HEX_VALUE ; fragment SIGN : PLUS | MINUS ; fragment SIZE : NON_ZERO_UNSIGNED_NUMBER ; fragment NON_ZERO_UNSIGNED_NUMBER : NON_ZERO_DECIMAL_DIGIT (UNDERSCORE | DECIMAL_DIGIT)* ; fragment UNSIGNED_NUMBER : DECIMAL_DIGIT (UNDERSCORE | DECIMAL_DIGIT)* ; fragment DECIMAL_VALUE : UNSIGNED_NUMBER | (X_DIGIT | Z_DIGIT) UNDERSCORE* ; fragment BINARY_VALUE : BINARY_DIGIT (UNDERSCORE | BINARY_DIGIT)* ; fragment OCTAL_VALUE : OCTAL_DIGIT (UNDERSCORE | OCTAL_DIGIT)* ; fragment HEX_VALUE : HEX_DIGIT (UNDERSCORE | HEX_DIGIT)* ; fragment DECIMAL_BASE : APOSTROPHE [sS]? [dD] ; fragment BINARY_BASE : APOSTROPHE [sS]? [bB] ; fragment OCTAL_BASE : APOSTROPHE [sS]? [oO] ; fragment HEX_BASE : APOSTROPHE [sS]? [hH] ; fragment NON_ZERO_DECIMAL_DIGIT : [1-9] ; fragment DECIMAL_DIGIT : [0-9] ; fragment BINARY_DIGIT : X_DIGIT | Z_DIGIT | [01] ; fragment OCTAL_DIGIT : X_DIGIT | Z_DIGIT | [0-7] ; fragment HEX_DIGIT : X_DIGIT | Z_DIGIT | [0-9a-fA-F] ; fragment X_DIGIT : [xX] ; fragment Z_DIGIT : [zZ?] ; fragment APOSTROPHE : '\'' ; // Strings STRING : DOUBLE_QUOTE ~["\r\n]* DOUBLE_QUOTE ; fragment DOUBLE_QUOTE : '"' ; // Comments ONE_LINE_COMMENT : DOUBLE_SLASH ~[\r\n]* -> channel(COMMENTS) ; BLOCK_COMMENT : SLASH_ASTERISK TEXT ASTERISK_SLASH -> channel(COMMENTS) ; fragment TEXT : .*? ; fragment DOUBLE_SLASH : '//' ; fragment SLASH_ASTERISK : '/*' ; fragment ASTERISK_SLASH : '*/' ; fragment NEWLINE : CARRIAGE_RETURN? LINE_FEED ; // Identifiers ESCAPED_IDENTIFIER : BACKSLASH ASCII_PRINTABLE_EXCEPT_SPACE+ WHITE_SPACE ; SIMPLE_IDENTIFIER : (LETTER | UNDERSCORE) (LETTER | UNDERSCORE | DECIMAL_DIGIT | DOLLAR_SIGN)* ; SYSTEM_TF_IDENTIFIER : DOLLAR_SIGN (LETTER | UNDERSCORE | DECIMAL_DIGIT | DOLLAR_SIGN) (LETTER | UNDERSCORE | DECIMAL_DIGIT | DOLLAR_SIGN)* ; fragment ASCII_PRINTABLE_EXCEPT_SPACE : [\u0021-\u007e] ; fragment UNDERSCORE : '_' ; fragment DOLLAR_SIGN : '$' ; fragment BACKSLASH : '\\' ; fragment LETTER : [a-zA-Z] ; // White space WHITE_SPACE_REGION : WHITE_SPACE+ -> channel(HIDDEN) ; fragment WHITE_SPACE : SPACE | TAB | CARRIAGE_RETURN | LINE_FEED ; fragment SPACE : ' ' ; fragment TAB : '\t' ; fragment CARRIAGE_RETURN : '\r' ; fragment LINE_FEED : '\n' ; // Separators LEFT_PARENTHESIS : '(' ; RIGHT_PARENTHESIS : ')' ; LEFT_BRACKET : '[' ; RIGHT_BRACKET : ']' ; LEFT_BRACE : '{' ; RIGHT_BRACE : '}' ; // Operator symbols PLUS : '+' ; MINUS : '-' ; EXCLAMATION_MARK : '!' ; TILDE : '~' ; AMPERSAND : '&' ; TILDE_AMPERSAND : '~&' ; VERTICAL_BAR : '|' ; TILDE_VERTICAL_BAR : '~|' ; CARET : '^' ; TILDE_CARET : '~^' ; CARET_TILDE : '^~' ; ASTERISK : '*' ; PERCENT : '%' ; DOUBLE_EQUAL : '==' ; EXCLAMATION_MARK_EQUAL : '!=' ; TRIPLE_EQUAL : '===' ; EXCLAMATION_MARK_DOUBLE_EQUAL : '!==' ; DOUBLE_AMPERSAND : '&&' ; DOUBLE_VERTICAL_BAR : '||' ; DOUBLE_ASTERISK : '**' ; LESS_THAN : '<' ; LESS_THAN_EQUAL : '<=' ; GREATER_THAN : '>' ; GREATER_THAN_EQUAL : '>=' ; DOUBLE_GREATER_THAN : '>>' ; DOUBLE_LESS_THAN : '<<' ; TRIPLE_GREATER_THAN : '>>>' ; TRIPLE_LESS_THAN : '<<<' ; // Other symbols DOT : '.' ; COMMA : ',' ; COLON : ':' ; SEMICOLON : ';' ; SLASH : '/' ; EQUAL : '=' ; QUESTION_MARK : '?' ; AT : '@' ; HASH : '#' ; GRAVE_ACCENT : '`' -> channel(DIRECTIVES), pushMode(DIRECTIVE_MODE) ; PLUS_COLON : '+:' ; MINUS_COLON : '-:' ; MINUS_GREATER_THAN : '->' ; EQUAL_GREATER_THAN : '=>' ; ASTERISK_GREATER_THAN : '*>' ; TRIPLE_AMPERSAND : '&&&' ; // A.2.4 Declaration assignments PATHPULSE_DOLLAR : 'PATHPULSE$' ; // Context-specific rules /* // A.5.3 UDP body INIT_VAL : '1' APOSTROPHE [bB] [01xX] | [01] ; OUTPUT_SYMBOL : [01xX] ; LEVEL_SYMBOL : [01xX?bB] ; EDGE_SYMBOL : [rRfFpPnN*] ; // A.7.5.3 System timing check event definitions EDGE_DESCRIPTOR : '01' | '10' | [xXzZ] [01] | [01] [xXzZ] ; SCALAR_CONSTANT : '1' APOSTROPHE [bB] [01] | [01] ; */ mode LIBRARY_SOURCE_TEXT_MODE; LIBRARY_SIMPLE_IDENTIFIER : (LETTER | UNDERSCORE) (LETTER | UNDERSCORE | DECIMAL_DIGIT | DOLLAR_SIGN)* -> type(SIMPLE_IDENTIFIER) ; LIBRARY_ESCAPED_IDENTIFIER : BACKSLASH ASCII_PRINTABLE_EXCEPT_SPACE+ WHITE_SPACE -> type(ESCAPED_IDENTIFIER) ; FILE_PATH_SPEC : ~[ \t\r\n,;]+ ; MINUS_INCDIR : '-incdir' ; LIBRARY_COMMA : ',' -> type(COMMA) ; LIBRARY_SEMICOLON : ';' -> type(SEMICOLON), mode(DEFAULT_MODE) ; LIBRARY_ONE_LINE_COMMENT : DOUBLE_SLASH ~[\r\n]* -> channel(COMMENTS), type(ONE_LINE_COMMENT) ; LIBRARY_BLOCK_COMMENT : SLASH_ASTERISK TEXT ASTERISK_SLASH -> channel(COMMENTS), type(BLOCK_COMMENT) ; LIBRARY_WHITE_SPACE : WHITE_SPACE+ -> channel(HIDDEN), type(WHITE_SPACE_REGION) ; LIBRARY_NEWLINE : NEWLINE -> channel(HIDDEN) ; // Compiler directives mode DIRECTIVE_MODE; DIRECTIVE_BEGIN_KEYWORDS : 'begin_keywords' -> channel(DIRECTIVES) ; DIRECTIVE_CELLDEFINE : 'celldefine' -> channel(DIRECTIVES), popMode ; DIRECTIVE_DEFAULT_NETTYPE : 'default_nettype' -> channel(DIRECTIVES) ; DIRECTIVE_DEFINE : 'define' -> channel(DIRECTIVES), mode(DEFINE_DIRECTIVE_MODE) ; DIRECTIVE_ELSE : 'else' -> channel(DIRECTIVES), mode(SOURCE_TEXT_MODE) ; DIRECTIVE_ELSIF : 'elsif' -> channel(DIRECTIVES), mode(CONDITIONAL_DIRECTIVE_MODE) ; DIRECTIVE_END_KEYWORDS : 'end_keywords' -> channel(DIRECTIVES), popMode ; DIRECTIVE_ENDCELLDEFINE : 'endcelldefine' -> channel(DIRECTIVES), popMode ; DIRECTIVE_ENDIF : 'endif' -> channel(DIRECTIVES), popMode ; DIRECTIVE_IFDEF : 'ifdef' -> channel(DIRECTIVES), mode(CONDITIONAL_DIRECTIVE_MODE) ; DIRECTIVE_IFNDEF : 'ifndef' -> channel(DIRECTIVES), mode(CONDITIONAL_DIRECTIVE_MODE) ; DIRECTIVE_INCLUDE : 'include' -> channel(DIRECTIVES) ; DIRECTIVE_LINE : 'line' -> channel(DIRECTIVES) ; DIRECTIVE_NOUNCONNECTED_DRIVE : 'nounconnected_drive' -> channel(DIRECTIVES), popMode ; //DIRECTIVE_PRAGMA : 'pragma' -> channel(DIRECTIVES) ; DIRECTIVE_RESETALL : 'resetall' -> channel(DIRECTIVES), popMode ; DIRECTIVE_TIMESCALE : 'timescale' -> channel(DIRECTIVES) ; DIRECTIVE_UNCONNECTED_DRIVE : 'unconnected_drive' -> channel(DIRECTIVES) ; DIRECTIVE_UNDEF : 'undef' -> channel(DIRECTIVES), mode(UNDEF_DIRECTIVE_MODE) ; DEFAULT_NETTYPE_VALUE : ('wire' | 'tri' | 'tri0' | 'tri1' | 'wand' | 'triand' | 'wor' | 'trior' | 'trireg' | 'uwire' | 'none') -> channel(DIRECTIVES), popMode ; TIME_UNIT : [munpf]? 's' -> channel(DIRECTIVES) ; UNCONNECTED_DRIVE_VALUE : ('pull0' | 'pull1') -> channel(DIRECTIVES), popMode ; DIRECTIVE_NUMBER : UNSIGNED_NUMBER -> channel(DIRECTIVES) ; DIRECTIVE_STRING : DOUBLE_QUOTE ~["\r\n]* DOUBLE_QUOTE -> channel(DIRECTIVES) ; DIRECTIVE_IDENTIFIER : DIRECTIVE_IDENTIFIER_ -> channel(DIRECTIVES), mode(MACRO_USAGE_MODE) ; fragment DIRECTIVE_IDENTIFIER_ : DIRECTIVE_SIMPLE_IDENTIFIER | DIRECTIVE_ESCAPED_IDENTIFIER ; fragment DIRECTIVE_SIMPLE_IDENTIFIER : (LETTER | UNDERSCORE) (LETTER | UNDERSCORE | DECIMAL_DIGIT | DOLLAR_SIGN)* ; fragment DIRECTIVE_ESCAPED_IDENTIFIER : BACKSLASH ASCII_PRINTABLE_EXCEPT_SPACE+ WHITE_SPACE ; DIRECTIVE_SLASH : '/' -> channel(DIRECTIVES) ; //DIRECTIVE_COMMA : ',' -> channel(DIRECTIVES) ; //DIRECTIVE_EQUAL : '=' -> channel(DIRECTIVES) ; DIRECTIVE_COMMENT : DIRECTIVE_COMMENT_ -> channel(COMMENTS) ; fragment DIRECTIVE_COMMENT_ : DIRECTIVE_ONE_LINE_COMMENT | DIRECTIVE_BLOCK_COMMENT ; fragment DIRECTIVE_ONE_LINE_COMMENT : DOUBLE_SLASH ~[\r\n]* ; fragment DIRECTIVE_BLOCK_COMMENT : SLASH_ASTERISK TEXT ASTERISK_SLASH ; DIRECTIVE_WHITE_SPACE : [ \t]+ -> channel(HIDDEN) ; DIRECTIVE_NEWLINE : NEWLINE -> channel(HIDDEN), popMode ; mode DEFINE_DIRECTIVE_MODE; DEFINE_DIRECTIVE_IDENTIFIER : DIRECTIVE_IDENTIFIER_ -> channel(DIRECTIVES), type(DIRECTIVE_IDENTIFIER), mode(MACRO_TEXT_MODE) ; DEFINE_DIRECTIVE_WHITE_SPACE : [ \t]+ -> channel(HIDDEN), type(DIRECTIVE_WHITE_SPACE) ; mode UNDEF_DIRECTIVE_MODE; UNDEF_DIRECTIVE_IDENTIFIER : DIRECTIVE_IDENTIFIER_ -> channel(DIRECTIVES), type(DIRECTIVE_IDENTIFIER), popMode ; UNDEF_DIRECTIVE_COMMENT : DIRECTIVE_COMMENT_ -> channel(COMMENTS), type(DIRECTIVE_COMMENT) ; UNDEF_DIRECTIVE_WHITE_SPACE : [ \t]+ -> channel(HIDDEN), type(DIRECTIVE_WHITE_SPACE) ; UNDEF_DIRECTIVE_NEWLINE : NEWLINE -> channel(HIDDEN), type(DIRECTIVE_NEWLINE) ; mode CONDITIONAL_DIRECTIVE_MODE; CONDITIONAL_DIRECTIVE_IDENTIFIER : DIRECTIVE_IDENTIFIER_ -> channel(DIRECTIVES), type(DIRECTIVE_IDENTIFIER), mode(SOURCE_TEXT_MODE) ; CONDITIONAL_DIRECTIVE_COMMENT : DIRECTIVE_COMMENT_ -> channel(COMMENTS), type(DIRECTIVE_COMMENT) ; CONDITIONAL_DIRECTIVE_WHITE_SPACE : [ \t]+ -> channel(HIDDEN), type(DIRECTIVE_WHITE_SPACE) ; CONDITIONAL_DIRECTIVE_NEWLINE : NEWLINE -> channel(HIDDEN), type(DIRECTIVE_NEWLINE) ; mode MACRO_TEXT_MODE; MACRO_TEXT : ~[\r\n\\]+ -> channel(DIRECTIVES) ; MACRO_TEXT_BACKSLASH_NEWLINE : BACKSLASH NEWLINE -> channel(DIRECTIVES) ; MACRO_TEXT_BACKSLASH_ESCAPE : BACKSLASH . -> channel(DIRECTIVES), type(MACRO_TEXT) ; MACRO_TEXT_COMMENT : DIRECTIVE_COMMENT_ -> channel(COMMENTS), type(DIRECTIVE_COMMENT) ; MACRO_TEXT_NEWLINE : NEWLINE -> channel(HIDDEN), type(DIRECTIVE_NEWLINE), popMode ; mode MACRO_USAGE_MODE; DIRECTIVE_LIST_OF_ARGUMENTS : '(' TEXT ')' -> channel(DIRECTIVES), popMode ; MACRO_USAGE_BACKSLASH_NEWLINE : BACKSLASH NEWLINE -> channel(HIDDEN) ; MACRO_USAGE_COMMENT : DIRECTIVE_COMMENT_ -> channel(COMMENTS), type(DIRECTIVE_COMMENT) ; MACRO_USAGE_WHITE_SPACE : [ \t]+ -> channel(HIDDEN), type(DIRECTIVE_WHITE_SPACE) ; MACRO_USAGE_NEWLINE : NEWLINE -> channel(HIDDEN), type(DIRECTIVE_NEWLINE) ; // TODO: the following does not always work (e.g. if we're inside SOURCE_TEXT), fix it ANY_OTHER_TOKEN : . -> channel(DEFAULT_TOKEN_CHANNEL), mode(DEFAULT_MODE) ; mode SOURCE_TEXT_MODE; SOURCE_TEXT : ~[`\r\n\\]+ -> channel(DIRECTIVES) ; SOURCE_TEXT_GRAVE_ACCENT : '`' -> channel(DIRECTIVES), type(GRAVE_ACCENT), mode(DIRECTIVE_MODE) ; SOURCE_TEXT_BACKSLASH_NEWLINE : BACKSLASH NEWLINE -> channel(HIDDEN) ; SOURCE_TEXT_BACKSLASH_ESCAPE : BACKSLASH . -> channel(DIRECTIVES), type(SOURCE_TEXT) ; SOURCE_TEXT_COMMENT : DIRECTIVE_COMMENT_ -> channel(COMMENTS), type(DIRECTIVE_COMMENT) ; SOURCE_TEXT_NEWLINE : NEWLINE -> channel(HIDDEN), type(DIRECTIVE_NEWLINE) ;
awa/plugins/awa-sysadmin/src/awa-sysadmin-beans.ads
twdroeger/ada-awa
81
26614
----------------------------------------------------------------------- -- awa-sysadmin-beans -- Sysadmin specific Ada beans -- 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.Strings.Unbounded; with Util.Beans.Basic; with AWA.Sysadmin.Modules; with AWA.Sysadmin.Models; package AWA.Sysadmin.Beans is use Ada.Strings.Unbounded; type Authenticate_Bean is new AWA.Sysadmin.Models.Authenticate_Bean with null record; type Authenticate_Bean_Access is access all Authenticate_Bean'Class; -- Action to authenticate the sysadmin user. overriding procedure Authenticate (Data : in out Authenticate_Bean; Outcome : in out Unbounded_String); -- Create an authenticate bean. function Create_Authenticate_Bean (Module : in AWA.Sysadmin.Modules.Sysadmin_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; end AWA.Sysadmin.Beans;
oeis/348/A348660.asm
neoneye/loda-programs
11
91756
; A348660: a(n) = Sum_{d|n, d <= sqrt(n)} (-1)^(n/d + 1) * d. ; Submitted by <NAME> ; 1,-1,1,-3,1,1,1,-3,4,1,1,-6,1,1,4,-7,1,-2,1,1,4,1,1,-10,6,1,4,1,1,-7,1,-7,4,1,6,-8,1,1,4,-12,1,4,1,1,9,1,1,-16,8,-4,4,1,1,4,6,-14,4,1,1,-13,1,1,11,-15,6,4,1,1,4,-11,1,-8,1,1,9,1,8,4,1,-20,13,1,1,-15,6,1,4,1,1,-10,8,1,4,1,6,-24,1,-6,13,-14 add $0,1 mov $2,$0 lpb $0 mov $3,$2 dif $3,$0 lpb $3 trn $3,$0 cmp $3,0 mul $3,$0 lpe sub $0,1 mul $1,-1 add $1,$3 lpe mov $0,$1
wayland_ada_scanner/src/wayland_xml.adb
onox/wayland-ada
5
10294
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 - 2019 <NAME> <<EMAIL>> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package body Wayland_XML is procedure Set_Summary (This : in out Arg_Tag; Value : String) is begin This.My_Summary := (Exists => True, Value => new String'(Value)); end Set_Summary; procedure Set_Interface_Attribute (This : in out Arg_Tag; Value : String) is begin This.My_Interface_Attribute := (Exists => True, Value => new String'(Value)); end Set_Interface_Attribute; procedure Set_Type_Attribute (This : in out Arg_Tag; Value : String) is begin if Value = "int" then This.My_Type_Attribute := (Exists => True, Value => Type_Integer); elsif Value = "uint" then This.My_Type_Attribute := (Exists => True, Value => Type_Unsigned_Integer); elsif Value = "string" then This.My_Type_Attribute := (Exists => True, Value => Type_String); elsif Value = "fd" then This.My_Type_Attribute := (Exists => True, Value => Type_FD); elsif Value = "new_id" then This.My_Type_Attribute := (Exists => True, Value => Type_New_Id); elsif Value = "object" then This.My_Type_Attribute := (Exists => True, Value => Type_Object); elsif Value = "fixed" then This.My_Type_Attribute := (Exists => True, Value => Type_Fixed); elsif Value = "array" then This.My_Type_Attribute := (Exists => True, Value => Type_Array); else raise TYPE_ATTRIBUTE_EXCEPTION with Value; end if; end Set_Type_Attribute; procedure Set_Name (This : in out Arg_Tag; Value : String) is begin This.My_Name := (Exists => True, Value => new String'(Value)); end Set_Name; procedure Set_Allow_Null (This : in out Arg_Tag; Value : Boolean) is begin This.My_Allow_Null := (Exists => True, Value => Value); end Set_Allow_Null; procedure Set_Enum (This : in out Arg_Tag; Value : String) is begin This.My_Enum := (Exists => True, Value => new String'(Value)); end Set_Enum; procedure Set_Text (This : in out Copyright_Tag; Value : String) is begin This.My_Text := (Exists => True, Value => new String'(Value)); end Set_Text; procedure Set_Text (This : in out Description_Tag; Value : String) is begin This.My_Text := (Exists => True, Value => new String'(Value)); end Set_Text; procedure Set_Summary (This : in out Description_Tag; Value : String) is begin This.My_Summary := (Exists => True, Value => new String'(Value)); end Set_Summary; procedure Set_Value (This : in out Entry_Tag; V : Entry_Value) is begin This.My_Value := (Exists => True, Value => V); end Set_Value; procedure Set_Summary (This : in out Entry_Tag; Value : String) is begin This.My_Summary := (Exists => True, Value => new String'(Value)); end Set_Summary; procedure Set_Name (This : in out Entry_Tag; Value : String) is begin This.My_Name := (Exists => True, Value => new String'(Value)); end Set_Name; procedure Set_Since (This : in out Entry_Tag; Value : Version_Number) is begin This.My_Since := (Exists => True, Value => Value); end Set_Since; procedure Set_Name (This : in out Enum_Tag; Value : String) is begin This.My_Name := (Exists => True, Value => new String'(Value)); end Set_Name; procedure Set_Bitfield (This : in out Enum_Tag; Value : Boolean) is begin This.My_Bitfield := (Exists => True, Value => Value); end Set_Bitfield; procedure Set_Since (This : in out Enum_Tag; Value : Version_Number) is begin This.My_Since := (Exists => True, Value => Value); end Set_Since; procedure Append_Child (This : in out Enum_Tag; Item : not null Wayland_XML.Description_Tag_Ptr) is Child : constant Enum_Child := (Child_Description, Item); begin This.My_Children.Append (Child); end Append_Child; procedure Append_Child (This : in out Enum_Tag; Item : not null Entry_Tag_Ptr) is Child : constant Enum_Child := (Child_Entry, Item); begin This.My_Children.Append (Child); This.My_Entries.Append (Child); end Append_Child; procedure Sort_Entries (This : in out Enum_Tag) is begin Enum_Child_Sorting.Sort (This.My_Entries); end Sort_Entries; procedure Set_Name (This : in out Event_Tag; Value : String) is begin This.My_Name := (Exists => True, Value => new String'(Value)); end Set_Name; procedure Set_Since (This : in out Event_Tag; Value : Version_Number) is begin This.My_Since_Attribute := (Exists => True, Value => Value); end Set_Since; procedure Append_Child (This : in out Event_Tag; Item : not null Wayland_XML.Description_Tag_Ptr) is C : constant Event_Child := (Child_Description, Item); begin This.My_Children.Append (C); end Append_Child; procedure Append_Child (This : in out Event_Tag; Item : not null Wayland_XML.Arg_Tag_Ptr) is C : constant Event_Child := (Child_Arg, Item); begin This.My_Children.Append (C); end Append_Child; procedure Set_Name (This : in out Request_Tag; Value : String) is begin This.My_Name := (Exists => True, Value => new String'(Value)); end Set_Name; procedure Append_Child (This : in out Request_Tag; Item : not null Description_Tag_Ptr) is C : constant Request_Child := (Child_Description, Item); begin This.My_Children.Append (C); end Append_Child; procedure Append_Child (This : in out Request_Tag; Item : not null Wayland_XML.Arg_Tag_Ptr) is C : constant Request_Child := (Child_Arg, Item); begin This.My_Children.Append (C); end Append_Child; procedure Set_Type_Attribute (This : in out Request_Tag; Value : String) is begin This.My_Type_Attribute := (Exists => True, Value => new String'(Value)); end Set_Type_Attribute; procedure Set_Since (This : in out Request_Tag; Value : Version_Number) is begin This.My_Since := (Exists => True, Value => Value); end Set_Since; function Exists_Description (This : aliased Request_Tag) return Boolean is N : Natural := 0; begin for Child of Children (This) loop if Child.Kind_Id = Child_Description and then Exists_Text (Child.Description_Tag.all) then N := N + 1; end if; end loop; return N = 1; end Exists_Description; function Description (This : aliased Request_Tag) return String is begin for Child of Children (This) loop if Child.Kind_Id = Child_Description then return Text (Child.Description_Tag.all); end if; end loop; raise Program_Error; end Description; function Exists_Events (This : aliased Interface_Tag) return Boolean is (for some Child of Children (This) => Child.Kind_Id = Child_Event); procedure Set_Name (This : in out Interface_Tag; Value : String) is begin This.My_Name := (Exists => True, Value => new String'(Value)); end Set_Name; procedure Set_Version (This : in out Interface_Tag; Value : Version_Number) is begin This.My_Version := (Exists => True, Value => Value); end Set_Version; procedure Append_Child (This : in out Interface_Tag; Item : not null Description_Tag_Ptr) is C : constant Interface_Child := (Child_Description, Item); begin This.My_Children.Append (C); end Append_Child; procedure Append_Child (This : in out Interface_Tag; Item : not null Request_Tag_Ptr) is C : constant Interface_Child := (Child_Request, Item); begin This.My_Children.Append (C); end Append_Child; procedure Append_Child (This : in out Interface_Tag; Item : not null Event_Tag_Ptr) is C : constant Interface_Child := (Child_Event, Item); begin This.My_Children.Append (C); end Append_Child; procedure Append_Child (This : in out Interface_Tag; Item : not null Enum_Tag_Ptr) is C : constant Interface_Child := (Child_Enum, Item); begin This.My_Children.Append (C); end Append_Child; procedure Set_Name (This : in out Protocol_Tag; Value : String) is begin This.My_Name := (Exists => True, Value => new String'(Value)); end Set_Name; procedure Append_Child (This : in out Protocol_Tag; Item : not null Wayland_XML.Copyright_Ptr) is C : constant Protocol_Child := (Kind_Id => Child_Copyright, Copyright_Tag => Item); begin This.My_Children.Append (C); end Append_Child; procedure Append_Child (This : in out Protocol_Tag; Item : not null Interface_Tag_Ptr) is C : constant Protocol_Child := (Kind_Id => Child_Interface, Interface_Tag => Item); begin This.My_Children.Append (C); end Append_Child; procedure Append_Child (This : in out Protocol_Tag; Item : not null Description_Tag_Ptr) is C : constant Protocol_Child := (Kind_Id => Child_Description, Description_Tag => Item); begin This.My_Children.Append (C); end Append_Child; end Wayland_XML;
apps/gp.asm
jpbottaro/minios
2
105137
global main main: int 13
oeis/305/A305728.asm
neoneye/loda-programs
11
160831
; A305728: Numbers of the form 216*p^3, where p is a Pythagorean prime (A002144). ; 27000,474552,1061208,5268024,10941048,14886936,32157432,49027896,84027672,152273304,197137368,222545016,279726264,311665752,555412248,714516984,835896888,1118386872,1280824056,1552836312,1651400568,2593941624,2732256792,3023464536,3666512088,4204463544,4590849528,4792616856,5433211512,6623488152,6880682808,8266914648,9181846584,9501187032,11209345272,12714595704,13515286968,13927939416,14778272664,16117587576,17535471192,19552071384,20615902488,21161991096,28484401464,30546884376,34201530936 seq $0,2144 ; Pythagorean primes: primes of form 4*k + 1. pow $0,3 mul $0,216
server/src/main/antlr4/org/eclipse/lsp/cobol/core/parser/CobolParser.g4
SWETAS04/che-che4z-lsp-for-cobol
0
6126
/* * Copyright (C) 2017, <NAME> <<EMAIL>> * All rights reserved. * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ parser grammar CobolParser; options {tokenVocab = CobolLexer; superClass = MessageServiceParser;} startRule : compilationUnit EOF; compilationUnit : programUnit+ ; programUnit : compilerOptions* identificationDivision environmentDivision? dataDivision? procedureDivision? programUnit* endProgramStatement? ; endProgramStatement : END PROGRAM programName DOT_FS ; // compiler options compilerOptions : (PROCESS | CBL) (COMMACHAR? compilerOption)+ ; // https://www.ibm.com/docs/en/cobol-zos/6.3?topic=program-compiler-options compilerOption : ADATA | NOADATA | ADV | NOADV | AFP LPARENCHAR (NOVOLATILE | VOLATILE) RPARENCHAR | APOST | QUOTE | Q_CHAR | ARCH LPARENCHAR integerLiteral RPARENCHAR | (ARITH | AR) LPARENCHAR (EXTEND | E_CHAR | COMPAT | C_CHAR) RPARENCHAR | AWO | NOAWO | BLOCK0 | NOBLOCK0 | (BUFSIZE | BUF) LPARENCHAR (integerLiteral | INTEGERLITERAL_WITH_K) RPARENCHAR | CICS (LPARENCHAR literal RPARENCHAR)? | NOCICS | (CODEPAGE | CP) LPARENCHAR integerLiteral RPARENCHAR | COMPILE | C_CHAR | (NOCOMPILE | NOC) (LPARENCHAR (S_CHAR | E_CHAR | W_CHAR) RPARENCHAR)? | (COPYLOC | CPLC) LPARENCHAR ((SYSLIB | dataName) COMMACHAR)? (DSN | PATH) LPARENCHAR (literal | dataSetName) RPARENCHAR RPARENCHAR | NOCOPYLOC | NOCPLC | (COPYRIGHT | CPYR) LPARENCHAR literal RPARENCHAR | NOCOPYRIGHT | NOCPYR | (CURRENCY | CURR) LPARENCHAR CURRENCY_SYMBOL RPARENCHAR | NOCURRENCY | NOCURR | DATA LPARENCHAR integerLiteral RPARENCHAR | DBCS | NODBCS | DECK | D_CHAR | NODECK | NOD | (DEFINE | DEF) LPARENCHAR dataName ((COMMACHAR | EQUALCHAR) dataName)? RPARENCHAR | NODEFINE | NODEF | DIAGTRUNC | DTR | NODIAGTRUNC | NODTR | (DISPSIGN | DS) LPARENCHAR (COMPAT | SEP | C_CHAR | S_CHAR) RPARENCHAR | DLL | NODLL | DUMP | DU | NODUMP | NODU | DYNAM | DYN | NODYNAM | NODYN | (EXIT | EX) LPARENCHAR ( ((INEXIT | INX | LIBEXIT | LIBX | PRTEXIT | PRTX | ADEXIT | ADX | MSGEXIT | MSGX) LPARENCHAR dataName (COMMACHAR dataName)? RPARENCHAR) | (NOINEXIT | NOINX | NOLIBEXIT | NOLIBX | NOPRTEXIT | NOPRTX | NOADEXIT | NOADX | NOMSGEXIT | NOMSGX) )* RPARENCHAR | NOEXIT | NOEX | EXPORTALL | EXP | NOEXPORTALL | NOEXP | FASTSRT | FSRT | NOFASTSRT | NOFSRT | (FLAG | F_CHAR) LPARENCHAR (E_CHAR | I_CHAR | S_CHAR | U_CHAR | W_CHAR) (COMMACHAR (E_CHAR | I_CHAR | S_CHAR | U_CHAR | W_CHAR))? RPARENCHAR | NOFLAG | NOF | FLAGSTD LPARENCHAR (M_CHAR | I_CHAR | H_CHAR) (D_CHAR | N_CHAR | S_CHAR | DN | DS | ND | NS | SD | SN)? (COMMACHAR O_CHAR)? RPARENCHAR | NOFLAGSTD | HGPR LPARENCHAR (PRESERVE | NOPRESERVE) RPARENCHAR | (INITCHECK | IC) (LPARENCHAR (LAX | STRICT)? RPARENCHAR)? | NOINITCHECK | NOIC | INITIAL | NOINITIAL | INLINE | INL | NOINLINE | NOINL | INTDATE LPARENCHAR (ANSI | LILIAN) RPARENCHAR | (INVDATA | INVD) (LPARENCHAR invdataSuboptions (COMMACHAR invdataSuboptions)* RPARENCHAR)? | NOINVDATA | NOINVD | (LANGUAGE | LANG) LPARENCHAR (ENGLISH | EN | JAPANESE | JA | JP | UENGLISH | UE) RPARENCHAR | (LINECOUNT | LC) LPARENCHAR integerLiteral RPARENCHAR | LIST | NOLIST | LP LPARENCHAR integerLiteral RPARENCHAR | MAP (LPARENCHAR (HEX | DEC) RPARENCHAR)? | NOMAP | MAXPCF LPARENCHAR integerLiteral RPARENCHAR | (MDECK | MD) (LPARENCHAR (C_CHAR | COMPILE | NOC | NOCOMPILE) RPARENCHAR)? | NOMDECK | NOMD | NAME (LPARENCHAR (ALIAS | NOALIAS) RPARENCHAR)? | NONAME | (NSYMBOL | NS) LPARENCHAR (NATIONAL | NAT | DBCS) RPARENCHAR | NUMBER | NUM | NONUMBER | NONUM | (NUMCHECK | NC) (LPARENCHAR numcheckSuboptions (COMMACHAR numcheckSuboptions)* RPARENCHAR)? | NONUMCHECK | NONC | NUMPROC LPARENCHAR (NOPFD | PFD) RPARENCHAR | OBJECT | OBJ | NOOBJECT | NOOBJ | OFFSET | OFF | NOOFFSET | NOOFF | OPTFILE | (OPTIMIZE | OPT) (LPARENCHAR integerLiteral RPARENCHAR) | (OUTDD | OUT) LPARENCHAR dataSetName RPARENCHAR | (PARMCHECK | PC) (LPARENCHAR (MSG | ABD) (COMMACHAR integerLiteral)? RPARENCHAR)? | NOPARMCHECK | NOPC | (PGMNAME | PGMN) LPARENCHAR (CO | COMPAT | LM | LONGMIXED | LONGUPPER | LU | M_CHAR | MIXED | U_CHAR | UPPER) RPARENCHAR | (QUALIFY | QUA) LPARENCHAR (COMPAT | C_CHAR | EXTEND | E_CHAR) RPARENCHAR | RENT | NORENT | RMODE LPARENCHAR (ANY | AUTO | integerLiteral) RPARENCHAR | RULES LPARENCHAR rulesSuboptions (COMMACHAR rulesSuboptions)* RPARENCHAR | NORULES | SEQUENCE | SEQ | NOSEQUENCE | NOSEQ | (SERVICE | SERV) LPARENCHAR literal RPARENCHAR | NOSERVICE | NOSERV | (SOURCE | S_CHAR) (LPARENCHAR (HEX | DEC) RPARENCHAR)? | NOSOURCE | NOS | SPACE LPARENCHAR integerLiteral RPARENCHAR | SQL (LPARENCHAR literal RPARENCHAR)? | NOSQL | SQLCCSID | SQLC | NOSQLCCSID | NOSQLC | SQLIMS (LPARENCHAR literal RPARENCHAR)? | NOSQLIMS | (SSRANGE | SSR) LPARENCHAR (ssrangeSuboptions (COMMACHAR ssrangeSuboptions)*)? RPARENCHAR | (NOSSRANGE | NOSSR) | STGOPT | SO | NOSTGOPT | NOSO | SUPPRESS | SUPP | NOSUPPRESS | NOSUPP | TERMINAL | TERM | NOTERMINAL | NOTERM | (TEST | NOTEST) (LPARENCHAR (testSuboptions (COMMACHAR testSuboptions)*)? RPARENCHAR)? | THREAD | NOTHREAD | TRUNC LPARENCHAR (BIN | OPT | STD) RPARENCHAR | TUNE LPARENCHAR integerLiteral RPARENCHAR | VBREF | NOVBREF | VLR LPARENCHAR (STANDARD | S_CHAR | COMPAT | C_CHAR) RPARENCHAR | (VSAMOPENFS | VS) LPARENCHAR (SUCC | S_CHAR | COMPAT | C_CHAR) RPARENCHAR | (WORD | WD) LPARENCHAR (integerLiteral | cobolWord) RPARENCHAR | NOWORD | NOWD | (XMLPARSE | XP) LPARENCHAR (COMPAT | C_CHAR | XMLSS | X_CHAR) RPARENCHAR | (XREF | X_CHAR) (LPARENCHAR (FULL | SHORT) RPARENCHAR)? | NOXREF | NOX | (ZONECHECK | ZC) LPARENCHAR (MSG | ABD) RPARENCHAR | NOZONECHECK | NOZC | (ZONEDATA | ZD) LPARENCHAR (PFD | MIG | NOPFD) RPARENCHAR | ZWB | NOZWB ; invdataSuboptions : CLEANSIGN | CS | NOCLEANSIGN | NOCS | FORCENUMCMP | FNC | NOFORCENUMCMP | NOFNC ; numcheckSuboptions : ZON (LPARENCHAR numcheckZonSuboptions (COMMACHAR numcheckZonSuboptions)* RPARENCHAR)? | NOZON | PAC | NOPAC | BIN (LPARENCHAR (TRUNCBIN | NOTRUNCBIN) RPARENCHAR)? | NOBIN | MSG | ABD ; numcheckZonSuboptions : ALPHNUM | NOALPHNUM | LAX | STRICT ; rulesSuboptions : ENDPERIOD | ENDP | NOENDPERIOD | EVENPACK | EVENP | NOEVENPACK | LAXPERF | LXPRF | NOLAXPERF | SLACKBYTES | SLCKB | NOSLACKBYTES | OMITODOMIN | OOM | NOOMITODOMIN | UNREF | NOUNREFALL | NOUNRA | NOUNREFSOURCE | NOUNRS | LAXREDEF | LXRDF | NOLAXREDEF ; ssrangeSuboptions : NOZLEN | ZLEN | ABD | MSG ; testSuboptions : DWARF | NODWARF | EJPD | NOEJPD | (SEPARATE | SEP) (LPARENCHAR (DSNAME | NODSNAME) RPARENCHAR)? | NOSEPARATE | NOSEP | SOURCE | SO | NOSOURCE | NOSO ; // --- identification division -------------------------------------------------------------------- identificationDivision : (IDENTIFICATION | ID) DIVISION DOT_FS programIdParagraph identificationDivisionBody* ; identificationDivisionBody : authorParagraph | installationParagraph | dateWrittenParagraph | dateCompiledParagraph | securityParagraph | remarksParagraph ; // - program id paragraph ---------------------------------- programIdParagraph : PROGRAM_ID DOT_FS programName (IS? (COMMON | INITIAL | LIBRARY | DEFINITION | RECURSIVE) PROGRAM?)? DOT_FS? ; // - author paragraph ---------------------------------- authorParagraph : AUTHOR DOT_FS? optionalParagraphTermination ; // - installation paragraph ---------------------------------- installationParagraph : INSTALLATION DOT_FS? optionalParagraphTermination ; // - date written paragraph ---------------------------------- dateWrittenParagraph : DATE_WRITTEN DOT_FS? optionalParagraphTermination ; // - date compiled paragraph ---------------------------------- dateCompiledParagraph : DATE_COMPILED DOT_FS? optionalParagraphTermination ; // - security paragraph ---------------------------------- securityParagraph : SECURITY DOT_FS? optionalParagraphTermination ; // remarks paragraph remarksParagraph : {notifyError("cobolParser.remarksUnsupported");} REMARKS DOT_FS? optionalParagraphTermination ; // - end of comment entry optionalParagraphTermination : ~(AUTHOR | CBL| DATE_COMPILED | DATE_WRITTEN | IDENTIFICATION | INSTALLATION | DATA | END | ENVIRONMENT | ID | PROCEDURE | PROCESS | SECURITY | REMARKS)*? ; // --- environment division -------------------------------------------------------------------- environmentDivision : ENVIRONMENT DIVISION DOT_FS environmentDivisionBody* ; environmentDivisionBody : configurationSection | inputOutputSection | idmsControlSection ; // -- configuration section ---------------------------------- configurationSection : CONFIGURATION SECTION DOT_FS configurationSectionParagraph* ; // - configuration section paragraph ---------------------------------- configurationSectionParagraph : sourceComputerParagraph | objectComputerParagraph | specialNamesParagraph // strictly, specialNamesParagraph does not belong into configurationSectionParagraph, but IBM-COBOL allows this ; // - source computer paragraph ---------------------------------- sourceComputerParagraph : SOURCE_COMPUTER DOT_FS (computerName (WITH? DEBUGGING MODE)? DOT_FS)? ; // - object computer paragraph ---------------------------------- objectComputerParagraph : OBJECT_COMPUTER DOT_FS (computerName objectComputerClause* DOT_FS)? ; objectComputerClause : memorySizeClause | diskSizeClause | collatingSequenceClause | segmentLimitClause | characterSetClause ; memorySizeClause : MEMORY SIZE? (integerLiteral | cobolWord) (WORDS | CHARACTERS | MODULES)? ; diskSizeClause : DISK SIZE? IS? (integerLiteral | cobolWord) (WORDS | MODULES)? ; collatingSequenceClause : PROGRAM? COLLATING? SEQUENCE IS? alphabetName+ collatingSequenceClauseAlphanumeric? collatingSequenceClauseNational? ; collatingSequenceClauseAlphanumeric : FOR? ALPHANUMERIC IS? alphabetName ; collatingSequenceClauseNational : FOR? NATIONAL IS? alphabetName ; segmentLimitClause : SEGMENT_LIMIT IS? integerLiteral ; characterSetClause : CHARACTER SET DOT_FS ; // - special names paragraph ---------------------------------- specialNamesParagraph : SPECIAL_NAMES DOT_FS (specialNameClause+ DOT_FS)? ; specialNameClause : channelClause | odtClause | alphabetClause | classClause | currencySignClause | decimalPointClause | symbolicCharactersClause | environmentSwitchNameClause | environmentSwitchNameSpecialNamesStatusPhrase | defaultDisplaySignClause | defaultComputationalSignClause | reserveNetworkClause ; alphabetClause : ALPHABET (alphabetClauseFormat1 | alphabetClauseFormat2) ; alphabetClauseFormat1 : alphabetName (FOR ALPHANUMERIC)? IS? (EBCDIC | ASCII | STANDARD_1 | STANDARD_2 | NATIVE | cobolWord | alphabetLiterals+) ; alphabetLiterals : literal (alphabetThrough | (ALSO? literal)+)? ; alphabetThrough : (THROUGH | THRU) literal ; alphabetClauseFormat2 : alphabetName FOR? NATIONAL IS? (NATIVE | CCSVERSION literal) ; channelClause : CHANNEL integerLiteral IS? mnemonicName ; classClause : CLASS className (FOR? (ALPHANUMERIC | NATIONAL))? IS? classClauseThrough+ ; classClauseThrough : classClauseFrom ((THROUGH | THRU) classClauseTo)? ; classClauseFrom : literal | generalIdentifier ; classClauseTo : literal | generalIdentifier ; currencySignClause : CURRENCY SIGN? IS? literal (WITH? PICTURE SYMBOL literal)? ; decimalPointClause : DECIMAL_POINT IS? COMMA ; defaultComputationalSignClause : DEFAULT (COMPUTATIONAL | COMP)? (SIGN IS?)? (LEADING | TRAILING)? (SEPARATE CHARACTER?) ; defaultDisplaySignClause : DEFAULT_DISPLAY (SIGN IS?)? (LEADING | TRAILING) (SEPARATE CHARACTER?)? ; environmentSwitchNameClause : environmentName IS? mnemonicName ; environmentSwitchNameSpecialNamesStatusPhrase : (ON | OFF) STATUS? IS? condition ; odtClause : ODT IS? mnemonicName ; reserveNetworkClause : RESERVE WORDS? LIST? IS? NETWORK CAPABLE? ; symbolicCharactersClause : SYMBOLIC CHARACTERS? (FOR? (ALPHANUMERIC | NATIONAL))? symbolicCharacters+ (IN alphabetName)? ; symbolicCharacters : symbolicCharacter+ (IS | ARE)? integerLiteral+ ; // -- input output section ---------------------------------- inputOutputSection : INPUT_OUTPUT SECTION DOT_FS inputOutputSectionParagraph* ; // - input output section paragraph ---------------------------------- inputOutputSectionParagraph : fileControlParagraph | ioControlParagraph ; // - file control paragraph ---------------------------------- fileControlParagraph : FILE_CONTROL DOT_FS fileControlEntry* ; fileControlEntry : selectClause fileControlClauses DOT_FS ; fileControlClauses : fileControlClause* ; selectClause : SELECT OPTIONAL? fileName ; fileControlClause : assignClause | reserveClause | organizationClause | paddingCharacterClause | accessModeClause | recordClause | alternateRecordKeyClause | fileStatusClause | passwordClause | relativeKeyClause ; assignClause : ASSIGN TO? (DISK | DISPLAY | KEYBOARD | PORT | PRINTER | READER | REMOTE | TAPE | VIRTUAL | (DYNAMIC | EXTERNAL | VARYING)? assignmentName | literal) ; reserveClause : RESERVE (NO | integerLiteral) ALTERNATE? (AREA | AREAS)? ; organizationClause : (ORGANIZATION IS?)? (LINE | RECORD BINARY | RECORD | BINARY)? (SEQUENTIAL | RELATIVE | INDEXED) ; paddingCharacterClause : PADDING CHARACTER? IS? (qualifiedDataName | literal) ; recordClause : RECORD (recordDelimiterClause | recordKeyClause) ; recordDelimiterClause : DELIMITER IS? (STANDARD_1 | IMPLICIT | assignmentName) ; accessModeClause : ACCESS MODE? IS? (SEQUENTIAL | RANDOM | DYNAMIC | EXCLUSIVE) ; recordKeyClause : KEY? IS? qualifiedDataName passwordClause? (WITH? DUPLICATES)? ; alternateRecordKeyClause : ALTERNATE RECORD KEY? IS? qualifiedDataName passwordClause? (WITH? DUPLICATES)? ; passwordClause : PASSWORD IS? dataName ; fileStatusClause : FILE? STATUS IS? qualifiedDataName qualifiedDataName? ; relativeKeyClause : RELATIVE KEY? IS? qualifiedDataName ; // - io control paragraph ---------------------------------- ioControlParagraph : I_O_CONTROL DOT_FS (fileName DOT_FS)? (ioControlClause+ DOT_FS)? ; ioControlClause : rerunClause | sameClause | multipleFileClause | commitmentControlClause | applyWriteOnlyClause ; rerunClause : RERUN (ON (assignmentName | fileName))? EVERY (rerunEveryRecords | rerunEveryOf | rerunEveryClock) ; rerunEveryRecords : integerLiteral RECORDS ; rerunEveryOf : END? OF? (REEL | UNIT) OF fileName ; rerunEveryClock : integerLiteral CLOCK_UNITS? ; sameClause : SAME (RECORD | SORT | SORT_MERGE)? AREA? FOR? fileName+ ; multipleFileClause : MULTIPLE FILE TAPE? CONTAINS? multipleFilePosition+ ; multipleFilePosition : fileName (POSITION integerLiteral)? ; applyWriteOnlyClause : APPLY WRITE_ONLY (ON)? fileName+ ; commitmentControlClause : COMMITMENT CONTROL FOR? fileName ; // -- idms control section ---------------------------------- idmsControlSection : IDMS_CONTROL SECTION DOT_FS idmsControlSectionParagraph ; // - idms control section paragraph ---------------------------------- idmsControlSectionParagraph : protocolParagraph (protocolParagraphs COMMACHAR?)* ; protocolParagraphs : ssNamesLengthParagraph | idmsRecordLocationParagraph ; protocolParagraph : PROTOCOL DOT_FS? protocolEntry? ; protocolEntry : modeClause DEBUG? endClause? ; modeClause : MODE IS? dataName ; ssNamesLengthParagraph : SUBSCHEMA_NAMES LENGTH IS? ss_names_length endClause? ; idmsRecordLocationParagraph : IDMS_RECORDS withinClause endClause? ; withinClause : (withinEntry | MANUAL) levelsClause? ; withinEntry : WITHIN (WORKING_STORAGE | LINKAGE) SECTION? ; levelsClause : LEVELS? INCREMENTED BY? LEVEL_NUMBER ; endClause : (DOT_FS | SEMICOLON_FS) ; ss_names_length : {validateSubSchemaNameLength(_input.LT(1).getText());} LEVEL_NUMBER ; // --- data division -------------------------------------------------------------------- dataDivision : DATA DIVISION DOT_FS dataDivisionSection* ; dataDivisionSection : fileSection | workingStorageSection | linkageSection | localStorageSection | schemaSection | mapSection | execSqlStatementInDataDivision ; // -- file section ---------------------------------- fileSection : FILE SECTION DOT_FS fileDescriptionEntry* ; fileDescriptionEntry : fileDescriptionEntryClauses dataDescriptionEntry* ; fileDescriptionEntryClauses : (FD | SD) cobolWord (DOT_FS? fileDescriptionEntryClause)* DOT_FS ; fileDescriptionEntryClause : externalClause | globalClause | blockContainsClause | recordContainsClause | labelRecordsClause | valueOfClause | dataRecordsClause | linageClause | codeSetClause | reportClause | recordingModeClause ; externalClause : IS? EXTERNAL ; globalClause : IS? GLOBAL ; blockContainsClause : BLOCK CONTAINS? integerLiteral blockContainsTo? (RECORDS | CHARACTERS)? ; blockContainsTo : TO integerLiteral ; recordContainsClause : RECORD (recordContainsClauseFormat1 | recordContainsClauseFormat2 | recordContainsClauseFormat3) ; recordContainsClauseFormat1 : CONTAINS? integerLiteral CHARACTERS? ; recordContainsClauseFormat2 : IS? VARYING IN? SIZE? (FROM? integerLiteral recordContainsTo? CHARACTERS?)? (DEPENDING ON? qualifiedDataName)? ; recordContainsClauseFormat3 : CONTAINS? integerLiteral recordContainsTo CHARACTERS? ; recordContainsTo : TO integerLiteral ; labelRecordsClause : LABEL (RECORD IS? | RECORDS ARE?) (OMITTED | STANDARD | dataName*) ; valueOfClause : VALUE OF valuePair+ ; valuePair : systemName IS? (qualifiedDataName | literal) ; dataRecordsClause : DATA (RECORD IS? | RECORDS ARE?) dataName+ ; linageClause : LINAGE IS? (dataName | integerLiteral) LINES? linageAt* ; linageAt : linageFootingAt | linageLinesAtTop | linageLinesAtBottom ; linageFootingAt : WITH? FOOTING AT? (dataName | integerLiteral) ; linageLinesAtTop : LINES? AT? TOP (dataName | integerLiteral) ; linageLinesAtBottom : LINES? AT? BOTTOM (dataName | integerLiteral) ; recordingModeClause : RECORDING MODE? IS? modeStatement ; modeStatement : cobolWord ; codeSetClause : CODE_SET IS? alphabetName ; reportClause : (REPORT IS? | REPORTS ARE?) reportName+ ; // -- working storage section ---------------------------------- workingStorageSection : WORKING_STORAGE SECTION DOT_FS dataDescriptionEntryForWorkingStorageSection* ; // -- linkage section ---------------------------------- linkageSection : LINKAGE SECTION DOT_FS dataDescriptionEntryForWorkingStorageAndLinkageSection* ; // -- local storage section ---------------------------------- localStorageSection : LOCAL_STORAGE SECTION DOT_FS dataDescriptionEntries ; dataDescriptionEntries : dataDescriptionEntry* ; dataDescriptionEntryForWorkingStorageSection : execSqlStatementInWorkingStorage | dataDescriptionEntryForWorkingStorageAndLinkageSection ; dataDescriptionEntryForWorkingStorageAndLinkageSection : execSqlStatementInWorkingStorageAndLinkageSection | dataDescriptionEntry ; dataDescriptionEntry : dataDescriptionEntryFormat1 | dataDescriptionEntryFormat2 | dataDescriptionEntryFormat1Level77 | dataDescriptionEntryFormat3 ; dataDescriptionEntryFormat1 : levelNumber entryName? (dataGroupUsageClause | dataRedefinesClause | dataExternalClause | dataGlobalClause | dataPictureClause | dataUsageClause | dataValueClause | dataOccursClause | dataSignClause | dataSynchronizedClause | dataJustifiedClause | dataBlankWhenZeroClause | dataDynamicLengthClause | dataVolatileClause)* DOT_FS ; levelNumber : LEVEL_NUMBER ; dataDescriptionEntryFormat2 : LEVEL_NUMBER_66 entryName? dataRenamesClause DOT_FS ; dataDescriptionEntryFormat1Level77 : LEVEL_NUMBER_77 entryName? (dataGroupUsageClause | dataRedefinesClause | dataExternalClause | dataGlobalClause | dataPictureClause | dataUsageClause | dataValueClause | dataOccursClause | dataSignClause | dataSynchronizedClause | dataJustifiedClause | dataBlankWhenZeroClause | dataDynamicLengthClause | dataVolatileClause)* DOT_FS ; dataDescriptionEntryFormat3 : LEVEL_NUMBER_88 entryName? dataValueClause DOT_FS ; entryName : (FILLER | dataName) ; dataGroupUsageClause : GROUP_USAGE IS? (NATIONAL | UTF_8) ; dataBlankWhenZeroClause : BLANK WHEN? (ZERO | ZEROS | ZEROES) ; dataExternalClause : IS? EXTERNAL (BY literal)? ; dataGlobalClause : IS? GLOBAL ; dataJustifiedClause : (JUSTIFIED | JUST) RIGHT? ; dataOccursClause : OCCURS integerLiteral dataOccursTo? TIMES? (DEPENDING ON? qualifiedDataName)? dataOccursSort* (INDEXED BY? LOCAL? indexName+)? ; dataOccursTo : TO integerLiteral ; dataOccursSort : (ASCENDING | DESCENDING) KEY? IS? qualifiedDataName+ ; dataPictureClause : (PICTURE | PIC) IS? pictureString+ ; pictureString : charString ; dataDynamicLengthClause : DYNAMIC LENGTH? (LIMIT IS? integerLiteral)? ; dataVolatileClause : VOLATILE ; dataRedefinesClause : REDEFINES dataName ; dataRenamesClause : RENAMES dataName thruDataName? ; thruDataName : (THROUGH | THRU) dataName ; dataSignClause : (SIGN IS?)? (LEADING | TRAILING) (SEPARATE CHARACTER?)? ; dataSynchronizedClause : (SYNCHRONIZED | SYNC) (LEFT | RIGHT)? ; dataUsageClause : (USAGE IS?)? usageFormat ; usageFormat : BINARY NATIVE? | COMP NATIVE? | COMP_1 NATIVE? | COMP_2 NATIVE? | COMP_3 NATIVE? | COMP_4 NATIVE? | COMP_5 NATIVE? | COMPUTATIONAL NATIVE? | COMPUTATIONAL_1 NATIVE? | COMPUTATIONAL_2 NATIVE? | COMPUTATIONAL_3 NATIVE? | COMPUTATIONAL_4 NATIVE? | COMPUTATIONAL_5 NATIVE? | DISPLAY NATIVE? | DISPLAY_1 NATIVE? | INDEX | NATIONAL NATIVE? | UTF_8 NATIVE? | OBJECT REFERENCE cobolWord? | PACKED_DECIMAL NATIVE? | POINTER | POINTER_32 | PROCEDURE_POINTER | FUNCTION_POINTER ; dataValueClause : valueIsToken dataValueClauseLiteral ; valueIsToken : valueToken isAreToken? ; valueToken : VALUE | VALUES ; isAreToken : IS | ARE ; dataValueClauseLiteral : dataValueInterval (COMMACHAR? dataValueInterval)* ; dataValueInterval : dataValueIntervalFrom dataValueIntervalTo? ; dataValueIntervalFrom : literal | cobolWord ; dataValueIntervalTo : thruToken literal ; thruToken : (THROUGH | THRU) ; // -- schema section ---------------------------------- schemaSection : SCHEMA SECTION DOT_FS schemaDBEntry ; schemaDBEntry : DB idms_subschema_name WITHIN idms_schema_name versionClause? DOT_FS ; // -- map section ---------------------------------- mapSection : MAP SECTION DOT_FS maxFieldListClause? mapClause+ ; maxFieldListClause : MAX FIELD LIST IS? integerLiteral DOT_FS? ; mapClause : MAP idms_map_name_definition versionClause? (TYPE IS? (STANDARD | EXTENDED) PAGING?)? DOT_FS? ; versionClause : VERSION integerLiteral ; // --- procedure division -------------------------------------------------------------------- procedureDivision : PROCEDURE DIVISION procedureDivisionUsingClause? procedureDivisionGivingClause? DOT_FS procedureDeclaratives? procedureDivisionBody ; procedureDivisionUsingClause : (USING | CHAINING) procedureDivisionUsingParameter (COMMACHAR? procedureDivisionUsingParameter)* ; procedureDivisionGivingClause : RETURNING dataName ; procedureDivisionUsingParameter : BY? (REFERENCE | VALUE)? generalIdentifier ; procedureDeclaratives : DECLARATIVES DOT_FS procedureDeclarative+ END DECLARATIVES DOT_FS ; procedureDeclarative : procedureSectionHeader DOT_FS (useStatement DOT_FS) paragraphs ; procedureSectionHeader : sectionName SECTION integerLiteral? ; procedureDivisionBody : paragraphs procedureSection* ; // -- procedure section ---------------------------------- procedureSection : procedureSectionHeader DOT_FS paragraphs ; paragraphs : sentence* paragraph* ; paragraph : paragraphDefinitionName DOT_FS (alteredGoTo | sentence*) ; sentence : idmsStmtsMandTermOn (SEMICOLON_FS idmsOnClause? | DOT_FS) | ((idmsStmtsOptTermOn endClause? idmsOnClause? | statement)* endClause) ; conditionalStatementCall : (statement | idmsStatements) SEMICOLON_FS? ; statement : acceptStatement | addStatement | alterStatement | callStatement | cancelStatement | closeStatement | computeStatement | continueStatement | deleteStatement | disableStatement | displayStatement | divideStatement | enableStatement | entryStatement | evaluateStatement | exhibitStatement | execCicsStatement | execSqlStatementInProcedureDivision | execSqlImsStatement | exitStatement | generateStatement | gobackStatement | goToStatement | ifStatement | initializeStatement | initiateStatement | inspectStatement | mergeStatement | moveStatement | multiplyStatement | openStatement | performStatement | purgeStatement | readStatement | readyResetTraceStatement | receiveStatement | releaseStatement | returnStatement | rewriteStatement | searchStatement | sendStatement | serviceReloadStatement | serviceLabelStatement | setStatement | sortStatement | startStatement | stopStatement | stringStatement | subtractStatement | terminateStatement | unstringStatement | writeStatement | xmlStatement ; idmsStatements : idmsStmtsOptTermOn endClause? idmsOnClause? | idmsStmtsMandTermOn (SEMICOLON_FS idmsOnClause? | DOT_FS) ; idmsStmtsOptTermOn : abendCodeStatement | attachTaskCodeStatement | bindStatement | changePriorityStatement | checkTerminalStatement | commitStatement | connectStatement | dcStatement | dequeueStatement | disconnectStatement | endStatement | endpageStatement | enqueueStatement | eraseStatement | findStatement | finishStatement | freeStatement | getStatement | inquireMapStatement | keepStatement | loadStatement | mapStatement | modifyStatement | obtainStatement | postStatement | putStatement | readyStatement |rollbackStatement | snapStatement | startpageStatement | storeStatement | waitStatement ; idmsStmtsMandTermOn : transferStatement ; idmsOnClause : ON generalIdentifier ; // abend code statement abendCodeStatement : ABEND CODE (literal | generalIdentifier) abendCodeDumpClause? abendCodeExitClause? ; abendCodeDumpClause : (DUMP | NODUMP) ; abendCodeExitClause : EXITS (INVOKED | IGNORED) ; // accept statement acceptStatement : ACCEPT (acceptIdmsDcClause idmsOnClause? | acceptIdmsDbClause idmsOnClause? | (generalIdentifier (acceptFromDateStatement | acceptFromEscapeKeyStatement | acceptFromMnemonicStatement | acceptMessageCountStatement)? onExceptionClause? notOnExceptionClause? END_ACCEPT?)) ; acceptFromDateStatement : FROM (DATE YYYYMMDD? | DAY YYYYDDD? | DAY_OF_WEEK | TIME | TIMER | TODAYS_DATE MMDDYYYY? | TODAYS_NAME | YEAR | YYYYMMDD | YYYYDDD) ; acceptFromMnemonicStatement : FROM mnemonicName ; acceptFromEscapeKeyStatement : FROM ESCAPE KEY ; acceptIdmsDcClause : acceptTransactionStatisticsClause | ((LTERM ID | PTERM ID | SCREENSIZE | SYSTEM ID | SYSVERSION | TASK CODE | TASK ID | USER ID) INTO generalIdentifier) ; acceptMessageCountStatement : MESSAGE? COUNT ; acceptTransactionStatisticsClause : TRANSACTION STATISTICS acceptTransactionStatisticsWriteClause? acceptTransactionStatisticsIntoClause? acceptTransactionStatisticsLengthClause? ; acceptTransactionStatisticsWriteClause : (WRITE | NOWRITE) ; acceptTransactionStatisticsIntoClause : INTO generalIdentifier ; acceptTransactionStatisticsLengthClause : LENGTH (integerLiteral | generalIdentifier) ; acceptIdmsDbClause : generalIdentifier ((FROM acceptIdmsDbOptions) | FOR idms_db_entity_name) ; acceptIdmsDbOptions : (idms_procedure_name PROCEDURE) | currencyPageInfo | (idms_db_entity_name acceptIdmsTypes) | (IDMS_STATISTICS (EXTENDED generalIdentifier)?) ; acceptIdmsTypes : (BIND | ((NEXT | PRIOR |OWNER)? currencyPageInfo)) ; currencyPageInfo : CURRENCY (PAGE_INFO generalIdentifier)? ; // add statement addStatement : ADD (addToStatement | addToGivingStatement | addCorrespondingStatement) onSizeErrorPhrase? notOnSizeErrorPhrase? END_ADD? ; addToStatement : addFrom (COMMACHAR? addFrom)* TO addTo (COMMACHAR? addTo)*? ; addToGivingStatement : addFrom (COMMACHAR? addFrom)* (TO addToGiving (COMMACHAR? addToGiving)*)? GIVING addGiving (COMMACHAR? addGiving)*? ; addCorrespondingStatement : (CORRESPONDING | CORR) generalIdentifier TO addTo ; addFrom : literal | generalIdentifier ; addTo : generalIdentifier ROUNDED? ; addToGiving : literal | generalIdentifier ; addGiving : generalIdentifier ROUNDED? ; // altered go to statement alteredGoTo : GO TO? DOT_FS ; // alter statement alterStatement : ALTER alterProceedTo+ ; alterProceedTo : procedureName TO (PROCEED TO)? procedureName ; // accept transaction statistics statement attachTaskCodeStatement : ATTACH TASK CODE (generalIdentifier | literal) attachTaskCodePriorityClause? idmsWaitNowaitClause? ; attachTaskCodePriorityClause : PRIORITY (integerLiteral | generalIdentifier) ; // bind statement bindStatement : BIND (bindTaskClause | bindTransactionClause | bindRunUnitClause | bindMapClause | bindProcedureClause |bindRecordClause) ; bindMapClause : MAP idms_map_name (RECORD idms_db_entity_name (TO (NULL | generalIdentifier))?)? ; bindProcedureClause : PROCEDURE FOR idms_procedure_name TO generalIdentifier ; bindTaskClause : TASK bindTaskStatementNodenameClause? ; bindTaskStatementNodenameClause : NODENAME (generalIdentifier | literal) ; bindTransactionClause : TRANSACTION STATISTICS ; bindRunUnitClause : RUN_UNIT (FOR generalIdentifier)? (DBNODE bindDbNodeName)? (DBNAME bindDbNodeName)? (DICTNODE bindDbNodeName)? (DICTNAME bindDbNodeName)? ; bindRecordClause : (idms_db_entity_name (TO generalIdentifier)?) | (generalIdentifier WITH idms_db_entity_name) ; bindDbNodeName : literal | generalIdentifier ; // call statement callStatement : CALL (generalIdentifier | constantName) callUsingPhrase? callGivingPhrase? onOverflowPhrase? onExceptionClause? notOnExceptionClause? END_CALL? ; constantName : literal ; callUsingPhrase : USING callUsingParameter (COMMACHAR? callUsingParameter)* ; callUsingParameter : callByReferencePhrase | callByValuePhrase | callByContentPhrase ; callByReferencePhrase : (BY? REFERENCE)? callByReference ; callByReference : ((INTEGER | STRING)? literal | generalIdentifier) | OMITTED ; callByValuePhrase : BY? VALUE (literal | generalIdentifier) ; callByContentPhrase : BY? CONTENT (literal | generalIdentifier | OMITTED) ; callGivingPhrase : (GIVING | RETURNING) generalIdentifier ; // cancel statement cancelStatement : CANCEL cancelCall+ ; cancelCall : libraryName (BYTITLE | BYFUNCTION) | literal | generalIdentifier ; // change priority statement changePriorityStatement : CHANGE PRIORITY TO? (integerLiteral | generalIdentifier) ; // check terminal statement checkTerminalStatement : CHECK TERMINAL checkTerminalGetStorageClause? INTO generalIdentifier (checkTerminalIntoClause | checkTerminalMaxLengthClause) checkTerminalReturnLengthClause? ; checkTerminalGetStorageClause : GET STORAGE ; checkTerminalIntoClause : TO generalIdentifier ; checkTerminalMaxLengthClause : MAX LENGTH (generalIdentifier | integerLiteral) ; checkTerminalReturnLengthClause : RETURN LENGTH INTO? generalIdentifier ; // close statement closeStatement : CLOSE closeFile (COMMACHAR? closeFile)*? ; closeFile : fileName (closeReelUnitStatement | closeRelativeStatement | closePortFileIOStatement)? ; closeReelUnitStatement : (REEL | UNIT) (FOR? REMOVAL)? (WITH? (NO REWIND | LOCK))? ; closeRelativeStatement : WITH? (NO REWIND | LOCK) ; closePortFileIOStatement : (WITH? NO WAIT | WITH WAIT) (USING closePortFileIOUsing+)? ; closePortFileIOUsing : closePortFileIOUsingCloseDisposition | closePortFileIOUsingAssociatedData | closePortFileIOUsingAssociatedDataLength ; closePortFileIOUsingCloseDisposition : CLOSE_DISPOSITION OF? (ABORT | ORDERLY) ; closePortFileIOUsingAssociatedData : ASSOCIATED_DATA (integerLiteral | generalIdentifier) ; closePortFileIOUsingAssociatedDataLength : ASSOCIATED_DATA_LENGTH OF? (integerLiteral | generalIdentifier) ; // commit statement commitStatement : COMMIT TASK? ALL? ; // compute statement computeStatement : COMPUTE computeStore+ (EQUALCHAR | EQUAL) COMMACHAR? arithmeticExpression COMMACHAR? onSizeErrorPhrase? COMMACHAR? notOnSizeErrorPhrase? END_COMPUTE? ; computeStore : generalIdentifier ROUNDED? ; // connect statement connectStatement : CONNECT idms_db_entity_name TO idms_db_entity_name ; // continue statement continueStatement : CONTINUE ; // dc statement dcStatement : DC RETURN dcNextTaskCodeClause? dcOptionClause? dcTimeoutClause? dcNextTaskIntervalClause? ; dcNextTaskCodeClause : NEXT TASK CODE (generalIdentifier | literal) ; dcOptionClause : (NORMAL | ABORT | CONTINUE | IMMEDIATE) ; dcTimeoutClause : TIMEOUT (dcIntervalClause | dcProgramClause)* ; dcNextTaskIntervalClause : NEXT TASK INTERVAL (generalIdentifier | integerLiteral) EVENT TYPE (INTERNAL | EXTERNAL) dcEventClause? ; dcIntervalClause : INTERVAL (generalIdentifier | integerLiteral) ; dcProgramClause : PROGRAM (generalIdentifier | literal) ; dcEventClause : (EVENT generalIdentifier) | (EVENT NAME (generalIdentifier | literal)) ; // delete statement deleteStatement : DELETE (deleteFilenameClause | deleteIdmsDCStatement idmsOnClause?) ; deleteIdmsDCStatement : deleteQueueClause | deleteScratchClause | deleteTableClause ; deleteFilenameClause : fileName RECORD? invalidKeyPhrase? notInvalidKeyPhrase? END_DELETE? ; deleteQueueClause : QUEUE deleteQueueIdClause? (CURRENT | ALL)? ; deleteQueueIdClause : ID (generalIdentifier | literal) ; deleteScratchClause : SCRATCH deleteScratchIdClause? (CURRENT | FIRST | LAST | NEXT | PRIOR | ALL | RECORD ID generalIdentifier)? (RETURN RECORD ID INTO? generalIdentifier)? ; deleteScratchIdClause : AREA ID (generalIdentifier | literal) ; deleteTableClause : TABLE FROM? (generalIdentifier | idms_table_name) idmsDictnodeClause? idmsDictnameClause? (LOADLIB (generalIdentifier | literal))? ; // dequeue statement dequeueStatement : DEQUEUE (ALL | dequeueNameStatement+) ; dequeueNameStatement : NAME generalIdentifier LENGTH (generalIdentifier | integerLiteral) ; // disable statement disableStatement : DISABLE (INPUT TERMINAL? | I_O TERMINAL | OUTPUT) cdName WITH? KEY (literal | generalIdentifier) ; // disconnect statement disconnectStatement : DISCONNECT idms_db_entity_name FROM idms_db_entity_name ; // display statement displayStatement : DISPLAY displayOperand (COMMACHAR? displayOperand)*? displayAt? displayUpon? displayWith? ; displayOperand : literal | generalIdentifier ; displayAt : AT (literal | generalIdentifier) ; displayUpon : UPON cobolWord ; displayWith : WITH? NO ADVANCING ; // divide statement divideStatement : DIVIDE (literal | generalIdentifier) (divideIntoStatement | divideIntoGivingStatement | divideByGivingStatement) divideRemainder? onSizeErrorPhrase? notOnSizeErrorPhrase? END_DIVIDE? ; divideIntoStatement : INTO divideInto+ ; divideIntoGivingStatement : INTO (literal | generalIdentifier) divideGivingPhrase? ; divideByGivingStatement : BY (literal | generalIdentifier) divideGivingPhrase? ; divideGivingPhrase : GIVING divideGiving+ ; divideInto : generalIdentifier ROUNDED? ; divideGiving : generalIdentifier ROUNDED? ; divideRemainder : REMAINDER generalIdentifier ; // enable statement enableStatement : ENABLE (INPUT TERMINAL? | I_O TERMINAL | OUTPUT) cdName WITH? KEY (literal | generalIdentifier) ; // end statement endStatement : END (endLineClause | endTransactionClause) ; endLineClause : LINE TERMINAL SESSION? ; endTransactionClause : TRANSACTION STATISTICS endTransactionWriteClause? endTransactionIntoClause? endTransactionLengthClause? ; endTransactionWriteClause : (WRITE | NOWRITE) ; endTransactionIntoClause : INTO generalIdentifier ; endTransactionLengthClause : LENGTH (generalIdentifier | integerLiteral) ; // endpage statement endpageStatement : ENDPAGE SESSION? ; // enqueue statement enqueueStatement : ENQUEUE (WAIT | NOWAIT | TEST)? enqueueNameClause* ; enqueueNameClause : NAME generalIdentifier LENGTH (generalIdentifier | integerLiteral) (EXCLUSIVE | SHARED)? ; // entry statement entryStatement : ENTRY literal (USING generalIdentifier (COMMACHAR? generalIdentifier)*?)? ; // erase statement eraseStatement : ERASE idms_db_entity_name ((PERMANENT | SELECTIVE | ALL) MEMBERS)? ; // evaluate statement evaluateStatement : EVALUATE evaluateSelect evaluateAlsoSelect* evaluateWhenPhrase+ evaluateWhenOther? END_EVALUATE? ; evaluateSelect : arithmeticExpression | condition ; evaluateAlsoSelect : ALSO evaluateSelect ; evaluateWhenPhrase : evaluateWhen+ (COMMACHAR? conditionalStatementCall)* ; evaluateWhen : WHEN evaluateCondition evaluateAlsoCondition* ; evaluateCondition : ANY | NOT? evaluateValue evaluateThrough? | condition | booleanLiteral ; evaluateThrough : (THROUGH | THRU) evaluateValue ; evaluateAlsoCondition : ALSO evaluateCondition ; evaluateWhenOther : WHEN OTHER (COMMACHAR? conditionalStatementCall)* ; evaluateValue : arithmeticExpression ; // exec cics statement execCicsStatement : EXEC CICS cicsRules END_EXEC ; cicsRules : ~END_EXEC*? ; // exec sql statement for specific divisions or sections of COBOL program execSqlStatementInProcedureDivision : execSqlStatement ; execSqlStatementInWorkingStorage : execSqlStatement DOT_FS ; execSqlStatementInWorkingStorageAndLinkageSection : execSqlStatement DOT_FS ; execSqlStatementInDataDivision : execSqlStatement DOT_FS ; execSqlStatement : EXEC SQL sqlCode END_EXEC ; sqlCode : ~END_EXEC*? ; // exec sql ims statement execSqlImsStatement : EXEC SQLIMS ~END_EXEC*? END_EXEC DOT_FS? ; // exhibit statement exhibitStatement : EXHIBIT NAMED? CHANGED? exhibitOperand+? ; exhibitOperand : literal | generalIdentifier ; // exit statement exitStatement : EXIT PROGRAM? ; // find statement findStatement : FIND keepClause? findObtainClause ; // free statement freeStatement : FREE STORAGE (freeStgidClause | freeForClause) ; freeStgidClause : STGID (generalIdentifier | literal) ; freeForClause : FOR generalIdentifier (FROM generalIdentifier)? ; keepClause : KEEP EXCLUSIVE? ; findObtainClause : calcClause | currentClause | ownerClause | recnameClause | dbkeyClause | positionClause ; calcClause : (CALC | ANY | DUPLICATE) idms_db_entity_name ; currentClause : CURRENT idms_db_entity_name? (WITHIN idms_db_entity_name)? ; ownerClause : OWNER WITHIN idms_db_entity_name ; recnameClause : idms_db_entity_name (DB_KEY IS? generalIdentifier | WITHIN idms_db_entity_name CURRENT? USING generalIdentifier) ; dbkeyClause : DB_KEY IS? generalIdentifier (PAGE_INFO generalIdentifier)? ; positionClause : (orderClause | integerLiteral | generalIdentifier) idms_db_entity_name? WITHIN idms_db_entity_name ; orderClause : ( NEXT | PRIOR | FIRST | LAST ) ; // finish statement finishStatement : FINISH TASK? ; // generate statement generateStatement : GENERATE reportName ; // get statement getStatement : GET (getTimeClause | idms_db_entity_name | getQueueClause | getScratchClause | getStorageClause)? ; getQueueClause : QUEUE (ID (generalIdentifier | literal))? getQueueTypeClause? getStatClause? getQueueLockClause? idmsWaitNowaitClause? INTO generalIdentifier getLengthClause getReturnClause? ; getQueueTypeClause : (NEXT | FIRST | LAST | PRIOR | (SEQUENCE (generalIdentifier | integerLiteral)) | (RECORD ID (generalIdentifier | literal))) ; getStatClause : (DELETE | KEEP) ; getQueueLockClause : (LOCK | NOLOCK) ; getLengthClause : ((TO generalIdentifier) | (MAX LENGTH (generalIdentifier | literal))) ; getReturnClause : RETURN LENGTH INTO generalIdentifier ; getScratchClause : SCRATCH getScratchAreaClause? getScratchNextClause? getStatClause? INTO generalIdentifier getLengthClause getReturnClause? ; getScratchAreaClause : AREA ID (generalIdentifier | literal)? ; getScratchNextClause : (NEXT | FIRST | LAST | PRIOR | CURRENT | (RECORD ID generalIdentifier)) ; getStorageClause : STORAGE FOR generalIdentifier (TO generalIdentifier)? (LENGTH generalIdentifier)? (POINTER generalIdentifier)? idmsWaitNowaitClause? KEEP? (LONG | SHORT)? (USER | SHARED)? (STGID (generalIdentifier | literal))? getStorageValueClause? getStorageLocClause? ; getStorageValueClause : VALUE IS (LOW_VALUE | HIGH_VALUE | generalIdentifier) ; getStorageLocClause : LOCATION IS? (ANY | BELOW)? ; getTimeClause : TIME getTimeIntoClause? (DATE INTO generalIdentifier)? ; getTimeIntoClause : INTO generalIdentifier (COMP | COMP_3 | EDIT) ; // goback statement gobackStatement : GOBACK ; // goto statement goToStatement : GO TO? procedureName+ (DEPENDING ON? generalIdentifier)? ; // if statement ifStatement : IF (idmsIfCondition | condition) ifThen ifElse? END_IF? ; ifThen : THEN? (NEXT SENTENCE | conditionalStatementCall+) ; ifElse : ELSE (NEXT SENTENCE | conditionalStatementCall+) ; idmsIfCondition : (idms_db_entity_name idmsIfEmpty) | (idmsIfMember) ; idmsIfEmpty : IS? NOT? EMPTY ; idmsIfMember : NOT? idms_db_entity_name MEMBER ; // initialize statement initializeStatement : INITIALIZE generalIdentifier (COMMACHAR? generalIdentifier)*? initializeReplacingPhrase? ; initializeReplacingPhrase : REPLACING initializeReplacingBy+ ; initializeReplacingBy : (ALPHABETIC | ALPHANUMERIC | ALPHANUMERIC_EDITED | NATIONAL | NATIONAL_EDITED | NUMERIC | NUMERIC_EDITED | DBCS | EGCS) DATA? BY (literal | generalIdentifier) ; // initiate statement initiateStatement : INITIATE reportName+ ; // inquire map statement inquireMapStatement : INQUIRE MAP idms_map_name (MOVE inqMapMovePhrase | IF inqMapIfPhrase) ; inqMapMovePhrase : (AID TO generalIdentifier) | (CURSOR TO generalIdentifier generalIdentifier) | (IN LENGTH FOR generalIdentifier TO generalIdentifier) ; inqMapIfPhrase : (INPUT (UNFORMATTED | TRUNCATED | CHANGED | EXTRANEOUS) | (CURSOR AT? DFLD generalIdentifier) | (inqMapWhichFields | inqMapWhichDflds) inqMapFieldTestPhrase) ifThen ifElse? ; inqMapWhichFields : CURRENT | ALL | NONE | ANY | SOME | ALL (BUT | EXCEPT) CURRENT ; inqMapWhichDflds : (ALL | NONE | ANY | SOME | ALL (BUT | EXCEPT))? (DFLD generalIdentifier)+? ; inqMapFieldTestPhrase : DATA IS? (YES | NO | ERASE | TRUNCATED | IDENTICAL | DIFFERENT) | mapEditPhrase ; mapEditPhrase : EDIT IS? (ERROR | CORRECT) ; // inspect statement inspectStatement : INSPECT generalIdentifier (inspectTallyingPhrase | inspectReplacingPhrase | inspectTallyingReplacingPhrase | inspectConvertingPhrase) ; inspectTallyingPhrase : TALLYING inspectFor+ ; inspectReplacingPhrase : REPLACING (inspectReplacingCharacters | inspectReplacingAllLeadings)+ ; inspectTallyingReplacingPhrase : TALLYING inspectFor+ inspectReplacingPhrase+ ; inspectConvertingPhrase : CONVERTING (literal | generalIdentifier) inspectTo inspectBeforeAfter* ; inspectFor : generalIdentifier FOR (inspectCharacters | inspectAllLeadings)+ ; inspectCharacters : CHARACTERS inspectBeforeAfter* ; inspectReplacingCharacters : CHARACTERS inspectBy inspectBeforeAfter* ; inspectAllLeadings : (ALL | LEADING) inspectAllLeading+ ; inspectReplacingAllLeadings : (ALL | LEADING | FIRST) inspectReplacingAllLeading+ ; inspectAllLeading : (literal | generalIdentifier) inspectBeforeAfter* ; inspectReplacingAllLeading : (literal | generalIdentifier) inspectBy inspectBeforeAfter* ; inspectBy : BY (literal | generalIdentifier) ; inspectTo : TO (literal | generalIdentifier) ; inspectBeforeAfter : (BEFORE | AFTER) INITIAL? (literal | generalIdentifier) ; // keep statement keepStatement : KEEP (keepCurrentClause | keepLongtermClause) ; keepCurrentClause : EXCLUSIVE? currentClause ; keepLongtermClause : LONGTERM (ALL | (generalIdentifier | literal)) keepLongtermRestClause ; keepLongtermRestClause : (keepLongtermNotifyClause | keepLongtermLockClause | keepLongtermTestClause | RELEASE) ; keepLongtermNotifyClause : NOTIFY CURRENT idms_db_entity_name ; keepLongtermLockClause : ((UPGRADE (SHARE | EXCLUSIVE) (RETURN NOTIFICATION INTO? generalIdentifier)) | ((SHARE | EXCLUSIVE) CURRENT idms_db_entity_name)) (WAIT | NOWAIT | NODEADLOCK)? ; keepLongtermTestClause : TEST (RETURN NOTIFICATION INTO? generalIdentifier)? ; // load Statement loadStatement : LOAD TABLE (generalIdentifier | idms_table_name) INTO generalIdentifier loadLocationClause idmsDictnodeClause? idmsDictnameClause? loadLoadlibClause? idmsWaitNowaitClause ; loadLocationClause : (TO | POINTER) generalIdentifier ; loadLoadlibClause : LOADLIB (generalIdentifier | literal) ; // map statement mapStatement : MAP (mapInClause | mapOutClause | mapOutInClause) ; mapInClause : IN USING idms_map_name mapIoInputPhrase? mapDetailPhrase? ; mapIoInputPhrase : mapInIoPhrase | mapInputPhrase ; mapInIoPhrase : (IO mapInputPhrase? | (NOIO DATASTREAM idmsDmlFromClause)) ; mapInputPhrase : INPUT DATA IS? (YES | NO) ; mapDetailPhrase : ((DETAIL mapDetailOptions?) | HEADER ) ((PAGE IS? generalIdentifier) | MODIFIED)* ; mapDetailOptions : (NEXT | FIRST | (SEQUENCE NUMBER IS? generalIdentifier) | (KEY IS? generalIdentifier)) (RETURNKEY IS? generalIdentifier)? ; mapOutClause : OUT USING idms_map_name idmsWaitNowaitClause? mapOutIoPhrase? mapOutputPhrase? mapMessagePhrase? mapOutDetailPhrase? ; mapOutIoPhrase : (IO | (NOIO DATASTREAM mapOutIntoClause)) ; mapOutIntoClause : INTO? generalIdentifier ((TO generalIdentifier) | (MAX? LENGTH (generalIdentifier | integerLiteral))) (RETURN LENGTH INTO? generalIdentifier)? ; mapOutputPhrase : OUTPUT ((DATA IS? (YES | NO | ERASE | ATTRIBUTE))? (NEWPAGE | ERASE)? LITERALS?) ; mapMessagePhrase : MESSAGE IS? generalIdentifier idmsDmlLengthClause ; mapOutDetailPhrase : (DETAIL (NEW | CURRENT)? (KEY IS? generalIdentifier)?) | (RESUME (PAGE IS? (CURRENT | NEXT | PRIOR | FIRST | LAST | generalIdentifier))?) ; mapOutInClause : OUTIN USING idms_map_name mapOutputPhrase? mapInputPhrase? mapMessagePhrase? ; idmsDictnameClause : DICTNAME (generalIdentifier | idms_dictionary_name) ; idmsDictnodeClause : DICTNODE (generalIdentifier | idms_node_name) ; idmsDmlFromClause : FROM generalIdentifier idmsDmlLengthClause ; idmsDmlLengthClause : ((TO generalIdentifier) | (LENGTH (generalIdentifier | integerLiteral))) ; idmsWaitNowaitClause : (WAIT | NOWAIT) ; // merge statement mergeStatement : MERGE fileName mergeOnKeyClause+ mergeCollatingSequencePhrase? mergeUsing* mergeOutputProcedurePhrase? mergeGivingPhrase* ; mergeOnKeyClause : ON? (ASCENDING | DESCENDING) KEY? qualifiedDataName+? ; mergeCollatingSequencePhrase : COLLATING? SEQUENCE IS? alphabetName+? mergeCollatingAlphanumeric? mergeCollatingNational? ; mergeCollatingAlphanumeric : FOR? ALPHANUMERIC IS alphabetName ; mergeCollatingNational : FOR? NATIONAL IS? alphabetName ; mergeUsing : USING fileName+ ; mergeOutputProcedurePhrase : OUTPUT PROCEDURE IS? procedureName mergeOutputThrough? ; mergeOutputThrough : (THROUGH | THRU) procedureName ; mergeGivingPhrase : GIVING mergeGiving+? ; mergeGiving : fileName (LOCK | SAVE | NO REWIND | CRUNCH | RELEASE | WITH REMOVE CRUNCH)? ; // modify statement modifyStatement : MODIFY ((MAP modifyMapClause) | idms_db_entity_name ) ; // modify map statement modifyMapClause : idms_map_name (PERMANENT | TEMPORARY)? (CURSOR AT? ((DFLD generalIdentifier) | (generalIdentifier | integerLiteral) (generalIdentifier | integerLiteral)))? (WCC ((RESETMDT | NOMDT) | (RESETKBD | NOKBD) | (ALARM | NOALARM) | (STARTPRT | NOPRT) | (NLCR | FORTYCR | SIXTYFOURCR | EIGHTYCR))+)? (modifyMapForClause modifyMapFieldOptionsClause)? ; modifyMapForClause : FOR ((ALL ((BUT | EXCEPT) (CURRENT | (DFLD generalIdentifier)+) | (ERROR | CORRECT)? FIELDS)) | (ALL? (DFLD generalIdentifier)+)) ; modifyMapFieldOptionsClause : (BACKSCAN | NOBACKSCAN)? (OUTPUT DATA IS? (YES | NO | ERASE | ATTRIBUTE))? mapInputPhrase? ((RIGHT | LEFT)? JUSTIFY)? (PAD (LOW_VALUE | HIGH_VALUE | (literal | generalIdentifier)))? mapEditPhrase? (REQUIRED | OPTIONAL)? (ERROR MESSAGE IS? (ACTIVE | SUPPRESS))? (ATTRIBUTES (attributeList)+)? ; attributeList : SKIPCHAR | ALPHANUMERIC | NUMERIC | PROTECTED | UNPROTECTED | DISPLAY | DARK | BRIGHT | DETECT | NOMDT | MDT | BLINK | NOBLINK | REVERSE_VIDEO | NORMAL_VIDEO | UNDERSCORE | NOUNDERSCORE | NOCOLOR | BLUE | RED | PINK | GREEN | TURQUOISE | YELLOW | WHITE ; // move statement moveStatement : MOVE ALL? (moveToStatement | moveCorrespondingToStatement) ; moveToStatement : moveToSendingArea TO generalIdentifier (COMMACHAR? generalIdentifier)*? ; moveToSendingArea : literal | generalIdentifier ; moveCorrespondingToStatement : (CORRESPONDING | CORR) moveCorrespondingToSendingArea TO generalIdentifier (COMMACHAR? generalIdentifier)*? ; moveCorrespondingToSendingArea : generalIdentifier ; // multiply statement multiplyStatement : MULTIPLY (literal | generalIdentifier) BY (multiplyRegular | multiplyGiving) onSizeErrorPhrase? notOnSizeErrorPhrase? END_MULTIPLY? ; multiplyRegular : multiplyRegularOperand+? ; multiplyRegularOperand : generalIdentifier ROUNDED? ; multiplyGiving : multiplyGivingOperand GIVING multiplyGivingResult+? ; multiplyGivingOperand : literal | generalIdentifier ; multiplyGivingResult : generalIdentifier ROUNDED? ; // obtain statement obtainStatement : OBTAIN keepClause? findObtainClause ; // open statement openStatement : OPEN (openInputStatement | openOutputStatement | openIOStatement | openExtendStatement)+ ; openInputStatement : INPUT openInput (COMMACHAR? openInput)*? ; openInput : fileName (REVERSED | WITH? NO REWIND)? ; openOutputStatement : OUTPUT openOutput (COMMACHAR? openOutput)*? ; openOutput : fileName (WITH? NO REWIND)? ; openIOStatement : I_O fileName (COMMACHAR? fileName)*? ; openExtendStatement : EXTEND fileName (COMMACHAR? fileName)*? ; // perform statement performStatement : PERFORM (performProcedureStatement | performInlineStatement) ; performInlineStatement : performType? conditionalStatementCall*? END_PERFORM ; performProcedureStatement : procedureName ((THROUGH | THRU) procedureName)? performType? ; performType : performTimes | performUntil | performVarying ; performTimes : (integerLiteral | generalIdentifier) TIMES ; performUntil : performTestClause? UNTIL condition ; performVarying : performTestClause performVaryingClause | performVaryingClause performTestClause? ; performVaryingClause : VARYING performVaryingPhrase performAfter* ; performVaryingPhrase : (literal | generalIdentifier) performFrom performBy performUntil ; performAfter : AFTER performVaryingPhrase ; performFrom : FROM (literal | generalIdentifier) ; performBy : BY (literal | generalIdentifier) ; performTestClause : WITH? TEST (BEFORE | AFTER) ; // IDMS post statement postStatement : POST ((EVENT generalIdentifier) | (EVENT NAME (generalIdentifier | literal) CLEAR?)) ; // purge statement purgeStatement : PURGE cdName+ ; // IDMS put statement putStatement : PUT (putQueueStatement | putScratchClause) ; putQueueStatement : QUEUE (ID (generalIdentifier | literal))? (FIRST | LAST)? idmsDmlFromClause putReturnClause? putRetentionClause? ; putReturnClause : RETURN RECORD ID INTO generalIdentifier? ; putRetentionClause : RETENTION (generalIdentifier | integerLiteral) ; putScratchClause : SCRATCH putAreaIdClause? idmsDmlFromClause putRecordClause? putReturnClause ; putAreaIdClause : AREA ID (generalIdentifier | literal) ; putRecordClause : RECORD ID (generalIdentifier | integerLiteral) REPLACE? ; // read statement readStatement : READ (readFilenameClause | readIdmsDcStatement idmsOnClause?) ; readIdmsDcStatement : readLineFromTerminalClause | readTerminalClause ; readFilenameClause : fileName NEXT? RECORD? readInto? readWith? readKey? invalidKeyPhrase? notInvalidKeyPhrase? atEndPhrase? notAtEndPhrase? END_READ? ; readInto : INTO generalIdentifier ; readWith : WITH? ((KEPT | NO) LOCK | WAIT) ; readKey : KEY IS? qualifiedDataName ; readTerminalClause : TERMINAL idmsWaitNowaitClause? (BUFFER | (MODIFIED FROM POSITION (generalIdentifier | literal)))? (GET STORAGE)? INTO generalIdentifier ((TO generalIdentifier) | (MAX LENGTH (generalIdentifier | integerLiteral))) (RETURN LENGTH INTO? generalIdentifier)? ; readLineFromTerminalClause : LINE FROM? TERMINAL ECHO? NOBACKPAGE? INTO generalIdentifier ((TO generalIdentifier) | (MAX LENGTH (generalIdentifier | integerLiteral))) (RETURN LENGTH INTO? generalIdentifier)? ; // ready statement readyStatement : READY idms_db_entity_name? (USAGE_MODE IS? (PROTECTED | EXCLUSIVE)? (RETRIEVAL | UPDATE))? ; // READY/RESET TRACE statement readyResetTraceStatement : (READY | RESET) TRACE ; // receive statement receiveStatement : RECEIVE (receiveFromStatement | receiveIntoStatement) onExceptionClause? notOnExceptionClause? END_RECEIVE? ; receiveFromStatement : dataName FROM receiveFrom (receiveBefore | receiveWith | receiveThread | receiveSize | receiveStatus)* ; receiveFrom : THREAD dataName | LAST THREAD | ANY THREAD ; receiveIntoStatement : cdName (MESSAGE | SEGMENT) INTO? generalIdentifier receiveNoData? receiveWithData? ; receiveNoData : NO DATA conditionalStatementCall (COMMACHAR? conditionalStatementCall)*? ; receiveWithData : WITH DATA conditionalStatementCall (COMMACHAR? conditionalStatementCall)*? ; receiveBefore : BEFORE TIME? (numericLiteral | generalIdentifier) ; receiveWith : WITH? NO WAIT ; receiveThread : THREAD IN? dataName ; receiveSize : SIZE IN? (numericLiteral | generalIdentifier) ; receiveStatus : STATUS IN? (generalIdentifier) ; // release statement releaseStatement : RELEASE recordName (FROM qualifiedDataName)? ; // return statement returnStatement : RETURN (cobolReturn | idmsReturn idmsOnClause?) ; cobolReturn : fileName RECORD? returnInto? atEndPhrase notAtEndPhrase? END_RETURN? ; returnInto : INTO qualifiedDataName ; idmsReturn : generalIdentifier FROM idms_db_entity_name (CURRENCY | orderClause CURRENCY? | USING generalIdentifier) (KEY INTO? generalIdentifier)? ; // rewrite statement rewriteStatement : REWRITE recordName rewriteFrom? invalidKeyPhrase? notInvalidKeyPhrase? END_REWRITE? ; rewriteFrom : FROM generalIdentifier ; // rollback statement rollbackStatement : ROLLBACK TASK? CONTINUE? ; // search statement searchStatement : SEARCH ALL? qualifiedDataName searchVarying? atEndPhrase? searchWhen+ END_SEARCH? ; searchVarying : VARYING qualifiedDataName ; searchWhen : WHEN condition (NEXT SENTENCE | conditionalStatementCall (COMMACHAR? conditionalStatementCall)*?) ; // send statement sendStatement : SEND (((sendStatementSync | sendStatementAsync) onExceptionClause? notOnExceptionClause?) | sendIdmsClause) ; sendStatementSync : (literal | generalIdentifier) sendFromPhrase? sendWithPhrase? sendReplacingPhrase? sendAdvancingPhrase? ; sendStatementAsync : TO (TOP | BOTTOM) generalIdentifier ; sendFromPhrase : FROM generalIdentifier ; sendWithPhrase : WITH (EGI | EMI | ESI | generalIdentifier) ; sendReplacingPhrase : REPLACING LINE? ; sendAdvancingPhrase : (BEFORE | AFTER) ADVANCING? (sendAdvancingPage | sendAdvancingLines | sendAdvancingMnemonic) ; sendAdvancingPage : PAGE ; sendAdvancingLines : (literal | generalIdentifier) (LINE | LINES)? ; sendAdvancingMnemonic : mnemonicName ; sendIdmsClause : MESSAGE (ONLY | ALWAYS)? TO sendIdmsToClause idmsDmlFromClause ; sendIdmsToClause : (DEST ID (generalIdentifier | literal)) | (USER ID generalIdentifier) | (LTERM ID (generalIdentifier | literal)) ; // set statement setStatement : SET (setToOnOff+ | setToBoolean | setToStatement | setUpDownByStatement | setToEntry | setIdmsDcStatement idmsOnClause?) ; setIdmsDcStatement : setAbendExitStatement | setTimerStatement ; setToStatement : receivingField+ TO sendingField ; setUpDownByStatement : receivingField+ (UP BY | DOWN BY) sendingField ; setToBoolean : receivingField+ TO booleanLiteral ; setToOnOff : receivingField+ TO (ON | OFF) ; setToEntry : receivingField+ TO ENTRY sendingField ; receivingField : generalIdentifier ; sendingField : literal | generalIdentifier ; setAbendExitStatement : ABEND EXIT ((ON? PROGRAM (generalIdentifier | literal)) | OFF) ; setTimerStatement : TIMER (setTimerWaitClause | setTimerPostClause | setTimerStartClause | (CANCEL setTimerIdClause)) ; setTimerWaitClause : WAIT setTimerIntervalClause ; setTimerPostClause : POST setTimerIntervalClause setTimerEventClause? setTimerIdClause? ; setTimerStartClause : START setTimerIntervalClause (TASK CODE (generalIdentifier | literal) (PRIORITY (generalIdentifier | integerLiteral))?)? setTimerIdClause? setTimerDataClause? ; setTimerIntervalClause : INTERVAL (generalIdentifier | integerLiteral) SECONDS? ; setTimerEventClause : EVENT generalIdentifier ; setTimerIdClause : TIMER ID generalIdentifier ; setTimerDataClause : DATA idmsDmlFromClause ; // service statement serviceLabelStatement : SERVICE LABEL ; serviceReloadStatement : SERVICE RELOAD generalIdentifier ; // snap statement snapStatement : SNAP (TITLE IS? generalIdentifier)? (ALL | SYSTEM | TASK)? idmsDmlFromClause* ; // sort statement sortStatement : SORT fileName sortOnKeyClause+ sortDuplicatesPhrase? sortCollatingSequencePhrase? sortInputProcedurePhrase? sortUsing* sortOutputProcedurePhrase? sortGivingPhrase* ; sortOnKeyClause : ON? (ASCENDING | DESCENDING) KEY? qualifiedDataName+? ; sortDuplicatesPhrase : WITH? DUPLICATES IN? ORDER? ; sortCollatingSequencePhrase : COLLATING? SEQUENCE IS? alphabetName+ sortCollatingAlphanumeric? sortCollatingNational? ; sortCollatingAlphanumeric : FOR? ALPHANUMERIC IS alphabetName ; sortCollatingNational : FOR? NATIONAL IS? alphabetName ; sortInputProcedurePhrase : INPUT PROCEDURE IS? procedureName sortInputThrough? ; sortInputThrough : (THROUGH | THRU) procedureName ; sortUsing : USING fileName+? ; sortOutputProcedurePhrase : OUTPUT PROCEDURE IS? procedureName sortOutputThrough? ; sortOutputThrough : (THROUGH | THRU) procedureName ; sortGivingPhrase : GIVING sortGiving+? ; sortGiving : fileName (LOCK | SAVE | NO REWIND | CRUNCH | RELEASE | WITH REMOVE CRUNCH)? ; // startpage statement startpageStatement : STARTPAGE SESSION? idms_map_name (WAIT | NOWAIT | RETURN)? (BACKPAGE | NOBACKPAGE)? (UPDATE | BROWSE)? (AUTODISPLAY | NOAUTODISPLAY)? ; // startPosition statement startStatement : START fileName startKey? invalidKeyPhrase? notInvalidKeyPhrase? END_START? ; startKey : KEY IS? (EQUAL TO? | EQUALCHAR | GREATER THAN? | MORETHANCHAR | NOT LESS THAN? | NOT LESSTHANCHAR | GREATER THAN? OR EQUAL TO? | MORETHANOREQUAL) qualifiedDataName ; // stopPosition statement stopStatement : STOP (RUN | literal | stopStatementGiving) ; stopStatementGiving : RUN (GIVING | RETURNING) (integerLiteral | generalIdentifier) ; // store statement storeStatement : STORE idms_db_entity_name ; // string statement stringStatement : STRING stringSendingPhrase+ stringIntoPhrase stringWithPointerPhrase? onOverflowPhrase? notOnOverflowPhrase? END_STRING? ; stringSendingPhrase : stringSending (COMMACHAR? stringSending)*? (stringDelimitedByPhrase | stringForPhrase) ; stringSending : literal | generalIdentifier ; stringDelimitedByPhrase : DELIMITED BY? (SIZE | literal | generalIdentifier) ; stringForPhrase : FOR (literal | generalIdentifier) ; stringIntoPhrase : INTO generalIdentifier ; stringWithPointerPhrase : WITH? POINTER qualifiedDataName ; // subtract statement subtractStatement : SUBTRACT (subtractFromStatement | subtractFromGivingStatement | subtractCorrespondingStatement) onSizeErrorPhrase? notOnSizeErrorPhrase? END_SUBTRACT? ; subtractFromStatement : subtractSubtrahend (COMMACHAR? subtractSubtrahend)* FROM subtractMinuend (COMMACHAR? subtractMinuend)*? ; subtractFromGivingStatement : subtractSubtrahend (COMMACHAR? subtractSubtrahend)* FROM subtractMinuendGiving GIVING subtractGiving (COMMACHAR? subtractGiving)*? ; subtractCorrespondingStatement : (CORRESPONDING | CORR) qualifiedDataName FROM subtractMinuendCorresponding ; subtractSubtrahend : literal | generalIdentifier ; subtractMinuend : generalIdentifier ROUNDED? ; subtractMinuendGiving : literal | generalIdentifier ; subtractGiving : generalIdentifier ROUNDED? ; subtractMinuendCorresponding : qualifiedDataName ROUNDED? ; // terminate statement terminateStatement : TERMINATE reportName ; // transfer statement transferStatement : TRANSFER CONTROL? TO? (generalIdentifier | idms_program_name) (RETURN | LINK | NORETURN | XCTL)? (USING generalIdentifier (COMMACHAR? generalIdentifier)*?)? ; // unstring statement unstringStatement : UNSTRING unstringSendingPhrase COMMACHAR? unstringIntoPhrase COMMACHAR? unstringWithPointerPhrase? COMMACHAR? unstringTallyingPhrase? COMMACHAR? onOverflowPhrase? COMMACHAR? notOnOverflowPhrase? END_UNSTRING? ; unstringSendingPhrase : generalIdentifier (unstringDelimitedByPhrase unstringOrAllPhrase*)? ; unstringDelimitedByPhrase : DELIMITED BY? ALL? (literal | generalIdentifier) ; unstringOrAllPhrase : OR ALL? (literal | generalIdentifier) ; unstringIntoPhrase : INTO unstringInto (COMMACHAR? unstringInto)*? ; unstringInto : generalIdentifier unstringDelimiterIn? unstringCountIn? ; unstringDelimiterIn : DELIMITER IN? generalIdentifier ; unstringCountIn : COUNT IN? generalIdentifier ; unstringWithPointerPhrase : WITH? POINTER qualifiedDataName ; unstringTallyingPhrase : TALLYING IN? qualifiedDataName ; // use statement useStatement : USE (useAfterClause | useDebugClause) ; useAfterClause : GLOBAL? AFTER STANDARD? (EXCEPTION | ERROR) PROCEDURE ON? useAfterOn ; useAfterOn : INPUT | OUTPUT | I_O | EXTEND | fileName (COMMACHAR? fileName)*? ; useDebugClause : FOR? DEBUGGING ON? useDebugOn (COMMACHAR? useDebugOn)* ; useDebugOn : ALL PROCEDURES | ALL REFERENCES? OF? generalIdentifier | procedureName ; // wait statement waitStatement : WAIT (((LONG | SHORT)? (waitEventTypeClause | waitEventListClause (COMMACHAR? waitEventListClause)*)) | (REDISPATCH (waitEventTypeClause | waitEventListClause (COMMACHAR? waitEventListClause)*)?)) ; waitEventTypeClause : EVENT NAME (generalIdentifier | literal) ; waitEventListClause : EVENT generalIdentifier ; // write statement writeStatement : WRITE (writeStatementClause | writeIdmsDCStatement idmsOnClause?) ; writeIdmsDCStatement : writeJournalClause | writeLineClause | writeLogClause | writePrinterClause | writeTerminalClause | writeThenReadClause ; writeStatementClause : recordName writeFromPhrase? writeAdvancingPhrase? writeAtEndOfPagePhrase? writeNotAtEndOfPagePhrase? invalidKeyPhrase? notInvalidKeyPhrase? END_WRITE? ; writeFromPhrase : FROM (literal | generalIdentifier) ; writeAdvancingPhrase : (BEFORE | AFTER) ADVANCING? (writeAdvancingPage | writeAdvancingLines) ; writeAdvancingPage : PAGE ; writeAdvancingLines : (literal | generalIdentifier) (LINE | LINES)? ; writeAtEndOfPagePhrase : AT? (END_OF_PAGE | EOP) conditionalStatementCall (COMMACHAR? conditionalStatementCall)* ; writeNotAtEndOfPagePhrase : NOT AT? (END_OF_PAGE | EOP) conditionalStatementCall (COMMACHAR? conditionalStatementCall)* ; writeJournalClause : JOURNAL idmsWaitNowaitClause? (SPAN | NOSPAN)? idmsDmlFromClause ; writeLineClause : LINE TO? TERMINAL idmsWaitNowaitClause? (NEWPAGE | ERASE)? NOBACKPAGE? idmsDmlFromClause (HEADER (generalIdentifier | integerLiteral))? ; writeLogClause : LOG MESSAGE ID (generalIdentifier | integerLiteral) writeLogParmsClause? writeLogReplyClause? writeLogMessagePrefixClause? writeLogTextClause? ; writeLogParmsClause : PARMS idmsDmlFromClause+ ; writeLogReplyClause : REPLY INTO generalIdentifier ((TO generalIdentifier) | (MAX LENGTH (generalIdentifier | integerLiteral))) ; writeLogMessagePrefixClause : MESSAGE PREFIX IS (generalIdentifier | literal) ; writeLogTextClause : TEXT INTO? generalIdentifier ((TO generalIdentifier) | (MAX LENGTH (generalIdentifier | integerLiteral))) (MESSAGE? PREFIX IS? (YES | NO))? (TEXT IS? ONLY)? ; writePrinterClause : PRINTER (NEWPAGE | ERASE)? ENDRPT? (SCREEN CONTENTS | writePrinterNativeClause) (COPIES (generalIdentifier | integerLiteral))? (REPORT ID (generalIdentifier | integerLiteral))? writePrinterTypeClause? HOLD? KEEP? ; writePrinterNativeClause : NATIVE? idmsDmlFromClause ; writePrinterTypeClause : (CLASS (generalIdentifier | integerLiteral)) | (DESTINATION (generalIdentifier | literal) ALL?) ; writeTerminalClause : TERMINAL idmsWaitNowaitClause? writeTerminalEraseClause? (FREE STORAGE)? idmsDmlFromClause ; writeTerminalEraseClause : NEWPAGE | ERASE | EAU | (ERASE ALL UNPROTECTED) ; writeThenReadClause : THEN READ TERMINAL idmsWaitNowaitClause? writeTerminalEraseClause? (FREE STORAGE)? idmsDmlFromClause ((MODIFIED | BUFFER) FROM POSITION (generalIdentifier | literal))? (GET STORAGE)? INTO generalIdentifier ((TO generalIdentifier) | (MAX LENGTH (generalIdentifier | integerLiteral))) (RETURN LENGTH INTO? generalIdentifier)? ; // xml statement xmlStatement : XML PARSE generalIdentifier xmlEncoding? xmlNational? xmlValidating? xmlProcessinProcedure xmlThru? onExceptionClause? notOnExceptionClause? END_XML? ; xmlEncoding : WITH? ENCODING integerLiteral ; xmlNational : RETURNING NATIONAL ; xmlValidating : VALIDATING WITH? (generalIdentifier | FILE literal) ; xmlThru : (THROUGH | THRU) procedureName ; xmlProcessinProcedure : PROCESSING PROCEDURE IS? procedureName ; // statement phrases ---------------------------------- atEndPhrase : AT? END (COMMACHAR? conditionalStatementCall)+ ; notAtEndPhrase : NOT AT? END (COMMACHAR? conditionalStatementCall)+ ; invalidKeyPhrase : INVALID KEY? (COMMACHAR? conditionalStatementCall)+ ; notInvalidKeyPhrase : NOT INVALID KEY? (COMMACHAR? conditionalStatementCall)+ ; onOverflowPhrase : ON? OVERFLOW (COMMACHAR? conditionalStatementCall)+ ; notOnOverflowPhrase : NOT ON? OVERFLOW (COMMACHAR? conditionalStatementCall)+ ; onSizeErrorPhrase : ON? SIZE ERROR (COMMACHAR? conditionalStatementCall)+ ; notOnSizeErrorPhrase : NOT ON? SIZE ERROR (COMMACHAR? conditionalStatementCall)+ ; // statement clauses ---------------------------------- onExceptionClause : ON? EXCEPTION (COMMACHAR? conditionalStatementCall)+ ; notOnExceptionClause : NOT ON? EXCEPTION (COMMACHAR? conditionalStatementCall)+ ; // condition ---------------------------------- condition : NOT? (simpleCondition | nestedCondition) ((AND | OR) NOT? (simpleCondition | nestedCondition | relationCombinedComparison))* ; simpleCondition : arithmeticExpression (relationCombinedComparison | fixedComparison)? ; nestedCondition : LPARENCHAR condition RPARENCHAR ; relationCombinedComparison : relationalOperator (arithmeticExpression | LPARENCHAR arithmeticExpression ((AND | OR) arithmeticExpression)+ RPARENCHAR) ; fixedComparison : IS? NOT? (NUMERIC | ALPHABETIC | ALPHABETIC_LOWER | ALPHABETIC_UPPER | DBCS | KANJI | POSITIVE | NEGATIVE | ZERO | className) ; relationalOperator : (IS | ARE)? (NOT? (GREATER THAN? | MORETHANCHAR | LESS THAN? | LESSTHANCHAR | EQUAL TO? | EQUALCHAR) | NOTEQUALCHAR | GREATER THAN? OR EQUAL TO? | MORETHANOREQUAL | LESS THAN? OR EQUAL TO? | LESSTHANOREQUAL) ; idms_map_name : {validateLength(_input.LT(1).getText(), "map name", 8);} variableUsageName ; idms_map_name_definition : {validateLength(_input.LT(1).getText(), "map name", 8);} dataName ; idms_db_entity_name : {validateLength(_input.LT(1).getText(), "db entity name", 16);} variableUsageName ; idms_dictionary_name : {validateLength(_input.LT(1).getText().substring(1, _input.LT(1).getText().length() -1), "dictionary name", 8);} literal ; idms_node_name : {validateLength(_input.LT(1).getText().substring(1, _input.LT(1).getText().length() -1), "node name", 8);} literal ; idms_procedure_name : {validateLength(_input.LT(1).getText(), "procedure name", 8);} variableUsageName ; idms_program_name : {validateLength(_input.LT(1).getText().substring(1, _input.LT(1).getText().length() -1), "program name", 8);} literal ; idms_schema_name : {validateLength(_input.LT(1).getText(), "schema name", 8);} dataName ; idms_subschema_name : {validateLength(_input.LT(1).getText(), "subschema name", 8);} dataName ; idms_table_name : {validateLength(_input.LT(1).getText().substring(1, _input.LT(1).getText().length() -1), "table name", 8);} literal ; // identifier ---------------------------------- generalIdentifier : specialRegister | qualifiedDataName | functionCall ; functionCall : FUNCTION functionName (LPARENCHAR argument (COMMACHAR? argument)* RPARENCHAR)* referenceModifier? ; referenceModifier : LPARENCHAR characterPosition COLONCHAR length? RPARENCHAR ; characterPosition : arithmeticExpression ; length : arithmeticExpression ; argument : arithmeticExpression ; // qualified data name ---------------------------------- qualifiedDataName : variableUsageName tableCall? referenceModifier? inData* ; tableCall : LPARENCHAR (ALL | arithmeticExpression) (COMMACHAR? (ALL | arithmeticExpression))* RPARENCHAR ; specialRegister : ADDRESS OF generalIdentifier | DATE | DAY | DAY_OF_WEEK | DEBUG_CONTENTS | DEBUG_ITEM | DEBUG_LINE | DEBUG_NAME | DEBUG_SUB_1 | DEBUG_SUB_2 | DEBUG_SUB_3 | JNIENVPTR | LENGTH OF? generalIdentifier | LINAGE_COUNTER | LINE_COUNTER | PAGE_COUNTER | RETURN_CODE | SHIFT_IN | SHIFT_OUT | SORT_CONTROL | SORT_CORE_SIZE | SORT_FILE_SIZE | SORT_MESSAGE | SORT_MODE_SIZE | SORT_RETURN | TALLY | TIME | WHEN_COMPILED ; // in ---------------------------------- inData : (IN | OF) variableUsageName tableCall? referenceModifier? ; inSection : (IN | OF) sectionName ; // names ---------------------------------- alphabetName : cobolWord ; assignmentName : systemName ; cdName : cobolWord ; className : cobolWord ; computerName : systemName ; dataName : cobolWord ; dataSetName : cobolWord | FILENAME (DOT_FS cobolWord)* ; variableUsageName : cobolWord ; environmentName : systemName ; fileName : cobolWord ; functionName : INTEGER | LENGTH | RANDOM | SUM | WHEN_COMPILED | cobolWord ; indexName : cobolWord ; libraryName : cobolWord ; mnemonicName : cobolWord ; paragraphName : cobolWord | integerLiteral ; paragraphDefinitionName : cobolWord | integerLiteral ; procedureName : paragraphName inSection? ; programName : literal | cobolWord | OR | AND ; recordName : qualifiedDataName ; reportName : qualifiedDataName ; sectionName : cobolWord | integerLiteral ; systemName : cobolWord ; symbolicCharacter : cobolWord ; figurativeConstant : ALL literal | HIGH_VALUE | HIGH_VALUES | LOW_VALUE | LOW_VALUES | NULL | NULLS | QUOTE | QUOTES | SPACE | SPACES | ZEROS | ZEROES ; booleanLiteral : TRUE | FALSE ; numericLiteral : NUMERICLITERAL | ZERO | integerLiteral ; integerLiteral : INTEGERLITERAL | LEVEL_NUMBER | LEVEL_NUMBER_66 | LEVEL_NUMBER_77 | LEVEL_NUMBER_88 ; cicsDfhRespLiteral : DFHRESP LPARENCHAR (cics_conditions | cobolWord | literal) RPARENCHAR ; cicsDfhValueLiteral : DFHVALUE LPARENCHAR (cics_conditions | cobolWord | literal) RPARENCHAR ; cics_conditions: EOC | EODS | INVMPSZ | INVPARTN | INVREQ | MAPFAIL | PARTNFAIL | RDATT | UNEXPIN; literal : NONNUMERICLITERAL | figurativeConstant | numericLiteral | booleanLiteral | charString | cicsDfhRespLiteral | cicsDfhValueLiteral ; charString : FINALCHARSTRING ; // arithmetic expression ---------------------------------- arithmeticExpression : multDivs plusMinus* ; plusMinus : (PLUSCHAR | MINUSCHAR) multDivs ; multDivs : powers multDiv* ; multDiv : (ASTERISKCHAR | SLASHCHAR) powers ; powers : (PLUSCHAR | MINUSCHAR)? basis power* ; power : DOUBLEASTERISKCHAR basis ; basis : generalIdentifier | literal | LPARENCHAR arithmeticExpression RPARENCHAR ; cobolWord : IDENTIFIER | idms_only_words | cobolCompilerDirectivesKeywords | cobolKeywords ; cobolKeywords : ABEND | ADDRESS | BOTTOM | BUFFER | CHECK | COUNT | CR | FIELD | FIRST | HEADER | LINK | MMDDYYYY | PRINTER | REMARKS | RESUME | TIMER | TODAYS_DATE | TODAYS_NAME | TOP | UPDATE | YEAR | YYYYDDD | YYYYMMDD ; cobolCompilerDirectivesKeywords : ABD | ADATA | ADEXIT | ADV | ADX | AFP | ALIAS | ALPHNUM | ANSI | ANY | APOST | AR | ARCH | ARITH | AUTO | AWO | BIN | BLOCK0 | BUF | BUFSIZE | C_CHAR | CICS | CLEANSIGN | CO | CODEPAGE | COMPAT | COMPILE | COPYLOC | COPYRIGHT | CP | CPLC | CPYR | CS | CURR | CURRENCY | D_CHAR | DATA | DBCS | DEC | DECK | DEF | DEFINE | DIAGTRUNC | DISPSIGN | DLL | DN | DS | DSN | DSNAME | DTR | DU | DUMP | DWARF | DYN | DYNAM | E_CHAR | EJPD | EN | ENDP | ENDPERIOD | ENGLISH | EVENP | EVENPACK | EX | EXIT | EXP | EXPORTALL | EXTEND | F_CHAR | FASTSRT | FLAG | FLAGSTD | FNC | FORCENUMCMP | FSRT | FULL | H_CHAR | HEX | HGPR | I_CHAR | IC | INEXIT | INITCHECK | INITIAL | INL | INLINE | INTDATE | INVD | INVDATA | INX | JA | JAPANESE | JP | K_CHAR | LANG | LANGUAGE | LAX | LAXPERF | LAXREDEF | LC | LIBEXIT | LIBX | LILIAN | LINECOUNT | LIST | LM | LONGMIXED | LONGUPPER | LP | LU | LXPRF | LXRDF | M_CHAR | MAP | MAXPCF | MD | MDECK | MIG | MIXED | MSG | MSGEXIT | MSGX | N_CHAR | NAME | NAT | NATIONAL | NC | ND | NOADATA | NOADEXIT | NOADV | NOADX | NOALIAS | NOALPHNUM | NOAWO | NOBIN | NOBLOCK0 | NOC | NOCICS | NOCLEANSIGN | NOCOMPILE | NOCOPYLOC | NOCOPYRIGHT | NOCPLC | NOCPYR | NOCS | NOCURR | NOCURRENCY | NOD | NODBCS | NODECK | NODEF | NODEFINE | NODIAGTRUNC | NODLL | NODSNAME | NODTR | NODU | NODUMP | NODWARF | NODYN | NODYNAM | NOEJPD | NOENDPERIOD | NOEVENPACK | NOEX | NOEXIT | NOEXP | NOEXPORTALL | NOF | NOFASTSRT | NOFLAG | NOFLAGSTD | NOFNC | NOFORCENUMCMP | NOFSRT | NOIC | NOINEXIT | NOINITCHECK | NOINITIAL | NOINL | NOINLINE | NOINVD | NOINVDATA | NOINX | NOLAXPERF | NOLAXREDEF | NOLIBEXIT | NOLIBX | NOLIST | NOMAP | NOMD | NOMDECK | NOMSGEXIT | NOMSGX | NONAME | NONC | NONUM | NONUMBER | NONUMCHECK | NOOBJ | NOOBJECT | NOOFF | NOOFFSET | NOOMITODOMIN | NOPAC | NOPARMCHECK | NOPC | NOPFD | NOPRESERVE | NOPRTEXIT | NOPRTX | NORENT | NORULES | NOS | NOSEP | NOSEPARATE | NOSEQ | NOSEQUENCE | NOSERV | NOSERVICE | NOSLACKBYTES | NOSO | NOSOURCE | NOSQL | NOSQLC | NOSQLCCSID | NOSQLIMS | NOSSR | NOSSRANGE | NOSTGOPT | NOSUPP | NOSUPPRESS | NOTERM | NOTERMINAL | NOTEST | NOTHREAD | NOTRUNCBIN | NOUNRA | NOUNREFALL | NOUNREFSOURCE | NOUNRS | NOVBREF | NOVOLATILE | NOWD | NOWORD | NOX | NOXREF | NOZC | NOZLEN | NOZON | NOZONECHECK | NOZWB | NS | NSYMBOL | NUM | NUMBER | NUMCHECK | NUMPROC | O_CHAR | OBJ | OBJECT | OFF | OFFSET | OMITODOMIN | OOM | OPT | OPTFILE | OPTIMIZE | OUT | OUTDD | PAC | PARMCHECK | PATH | PC | PFD | PGMN | PGMNAME | PRESERVE | PRTEXIT | PRTX | Q_CHAR | QUA | QUALIFY | QUOTE | RENT | RMODE | RULES | S_CHAR | SEP | SEPARATE | SEQ | SEQUENCE | SERV | SERVICE | SHORT | SLACKBYTES | SLCKB | SN | SO | SOURCE | SQL | SQLC | SQLCCSID | SQLIMS | SSR | SSRANGE | STANDARD | STD | STGOPT | STRICT | SUCC | SUPP | SUPPRESS | SYSLIB | TERM | TERMINAL | TEST | THREAD | TRUNC | TRUNCBIN | TUNE | U_CHAR | UE | UENGLISH | UNREF | UPPER | VBREF | VLR | VOLATILE | VS | VSAMOPENFS | W_CHAR | WD | WORD | X_CHAR | XMLPARSE | XMLSS | XP | XREF | ZC | ZD | ZLEN | ZON | ZONECHECK | ZONEDATA | ZWB ; idms_only_words : ATTRIBUTE | AUTODISPLAY | BACKPAGE | BACKSCAN | BLINK | BLUE | BRIGHT | BROWSE | BUT | CALC | CONTENTS | COPIES | CORRECT | DARK | DATASTREAM | DBNAME | DBNODE | DB_KEY | DC | DEQUEUE | DEST | DETECT | DFLD | DICTNAME | DICTNODE | DIFFERENT | DUPLICATE | EAU | ECHO | EDIT | EIGHTYCR | ENDPAGE | ENDRPT | ENQUEUE | EXITS | EXTRANEOUS | FIELDS | FIND | FORTYCR | GREEN | IDENTICAL | IDMS | INTERNAL | JOURNAL | LOADLIB | LOCATION | LOG | LONGTERM | MAPS | MDT | MEMBERS | MODIFIED | MODIFY | NEWPAGE | NOALARM | NOAUTODISPLAY | NOBACKPAGE | NOBACKSCAN | NOBLINK | NOCOLOR | NODEADLOCK | NODENAME | NOIO | NOKBD | NOLOCK | NOMDT | NOPRT | NORETURN | NORMAL | NORMAL_VIDEO | NOSPAN | NOTIFICATION | NOTIFY | NOUNDERSCORE | OBTAIN | OUTIN | OWNER | PAGE_INFO | PARMS | PERMANENT | PINK | PROTECTED | RED | REDISPATCH | RESETKBD | RESETMDT | RETENTION | RETRIEVAL | REPLY | RETURNKEY | REVERSE_VIDEO | RUN_UNIT | SCREEN | SELECTIVE | SHORT | SIXTYFOURCR | SPAN | SCRATCH | STARTPAGE | STARTPRT | STGID | STORE | SCHEMA | TURQUOISE | UNDERSCORE | UNFORMATTED | UNPROTECTED | UPGRADE | USAGE_MODE | WCC | WHITE | WITHIN | YELLOW ;
source/quickSearch.applescript
465499642/bookends-tools
76
4169
<reponame>465499642/bookends-tools #!/usr/bin/osascript tell application "System Events" keystroke "c" using command down --we use sed to remove ( ) , . ; @ and et al and uniqueID from a formatted ref and copy it back to clipboard --for example selecting {Hulme et al., 2010, #42249} should become "Hulme 2010" in the Bookends quick search field do shell script "pbpaste | sed -Ee 's/ et[ .]+al//g' -e 's/ and //g' -e 's/[\\{\\}\\(\\),\\.;@]//g' -e 's/#[0-9]+//g' | pbcopy" tell application "Bookends" activate delay 0.1 end tell tell application "System Events" keystroke "f" using {command down, option down} delay 0.5 keystroke "v" using command down delay 0.1 keystroke return --comment this out if you want to edit text before search end tell end tell
models/mondex/bop.als
transclosure/Amalgam
4
3033
<gh_stars>1-10 module mondex/bop open mondex/cw as mondexCW open mondex/c as mondexC open mondex/common as mondexCOMMON pred BOp (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { m_in in s.ether p in s.conAuthPurse s'.conAuthPurse = s.conAuthPurse XiConPurse [s, s', s.conAuthPurse - p] s'.archive = s.archive s'.ether = s.ether + m_out } pred Ignore (s, s' : ConWorld, m_out : MESSAGE) { s'.conAuthPurse = s.conAuthPurse XiConPurse [s, s', s.conAuthPurse] s'.archive = s.archive s'.ether = s.ether } pred IncreaseOkay (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { BOp [s, s', p, m_in, m_out] IncreasePurseOkay [s, s', p, m_out] } pred Increase (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { Ignore [s, s', m_out] or IncreaseOkay [s, s', p, m_in, m_out] } pred AbortOkay (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { BOp [s, s', p, m_in, m_out] AbortPurseOkay [s, s', p] m_out = bottom } pred Abort (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { Ignore [s, s', m_out] or AbortOkay [s, s', p, m_in, m_out] } pred StartFrom (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { Ignore [s, s', m_out] or Abort [s, s', p, m_in, m_out] or { BOp [s, s', p, m_in, m_out] StartFromPurseOkay [s, s', p, m_in, m_out] -- ADDED : PayDetails canonicalization (because this operation creates a PayDetails -- which may exist before) PayDetails_canon [s'] } } pred StartFromEafrom (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { BOp [s, s', p, m_in, m_out] StartFromPurseEafromOkay [s, s', p, m_in, m_out] PayDetails_canon [s'] -- ADDED } pred StartTo (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { Ignore [s, s', m_out] or Abort [s, s', p, m_in, m_out] or { BOp [s, s', p, m_in, m_out] StartToPurseOkay [s, s', p, m_in, m_out] PayDetails_canon [s'] -- ADDED } } pred StartToEafrom (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { BOp [s, s', p, m_in, m_out] StartToPurseEafromOkay [s, s', p, m_in, m_out] PayDetails_canon [s'] -- ADDED } pred ReqOkay (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { BOp [s, s', p, m_in, m_out] ReqPurseOkay [s, s', p, m_in, m_out] } pred Req (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { Ignore [s, s', m_out] or ReqOkay [s, s', p, m_in, m_out] } pred ValOkay (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { BOp [s, s', p, m_in, m_out] ValPurseOkay [s, s', p, m_in, m_out] } pred Val (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { Ignore [s, s', m_out] or ValOkay [s, s', p, m_in, m_out] } pred AckOkay (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { BOp [s, s', p, m_in, m_out] AckPurseOkay [s, s', p, m_in, m_out] } pred Ack (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { Ignore [s, s', m_out] or AckOkay [s, s', p, m_in, m_out] } pred ReadExceptionLog (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { Ignore [s, s', m_out] or Abort [s, s', p, m_in, m_out] or { BOp [s, s', p, m_in, m_out] ReadExceptionLogPurseOkay [s, s', p, m_in, m_out] } } pred ReadExceptionLogEafrom (s, s' : ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { BOp [s, s', p, m_in, m_out] ReadExceptionLogPurseEafromOkay [s, s', p, m_in, m_out] } pred ClearExceptionLog (s, s' :ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { Ignore [s, s', m_out] or Abort [s, s', p, m_in, m_out] or { BOp [s, s', p, m_in, m_out] ClearExceptionLogPurseOkay [s, s', p, m_in, m_out] } } pred ClearExceptionLogEafrom (s, s' :ConWorld, p : ConPurse, m_in, m_out : MESSAGE) { BOp [s, s', p, m_in, m_out] ClearExceptionLogPurseEafromOkay [s, s', p, m_in, m_out] } pred AuthorizeExLogClearOkay (s, s' : ConWorld, p : ConPurse, m_out : MESSAGE) { s'.conAuthPurse = s.conAuthPurse XiConPurse [s, s', s.conAuthPurse] m_out in exceptionLogClear ~(m_out <: name).pds in s.archive m_out.(exceptionLogClear <: name) = p s'.ether = s.ether + m_out s'.archive = s.archive } pred AuthorizeExLogClear (s, s' : ConWorld, p : ConPurse, m_out : MESSAGE) { Ignore [s, s', m_out] or AuthorizeExLogClearOkay [s, s', p, m_out] } pred Archive (s, s' : ConWorld, m_out : MESSAGE) { s'.conAuthPurse = s.conAuthPurse XiConPurse [s, s', s.conAuthPurse] s'.ether = s.ether s.archive in s'.archive s'.archive in s.archive + ~(s.ether <: name).details m_out = bottom }
Tests/sample1.nasm
13xforever/x86-assembly-textmate-bundle
69
241059
<reponame>13xforever/x86-assembly-textmate-bundle ; ; nasm -felf32 -g sseMove.asm ; ld -g sseMove.o ; global _start section .data align 16 v1: dd 1.1, 2.2, 3.3, 4.4 ; Four Single precision floats 32 bits each v1dp: dq 1.1, 2.2 ; Two Double precision floats 64 bits each v2: dd 5.5, 6.6, 7.7, 8.8 v2s1: dd 5.5, 6.6, 7.7, -8.8 v2s2: dd 5.5, 6.6, -7.7, -8.8 v2s3: dd 5.5, -6.6, -7.7, -8.8 v2s4: dd -5.5, -6.6, -7.7, -8.8 num1: dd 1.2 v3: dd 1.2, 2.3, 4.5, 6.7 ; No longer 16 byte aligned v3dp: dq 1.2, 2.3 ; No longer 16 byte aligned section .bss mask1: resd 1 mask2: resd 1 mask3: resd 1 mask4: resd 1 section .text _start: ; ; op dst, src ; ; ; SSE ; ; Using movaps since vectors are 16 byte aligned movaps xmm0, [v1] ; Move four 32-bit(single precision) floats to xmm0 movaps xmm1, [v2] movups xmm2, [v3] ; Need to use movups since v3 is not 16 byte aligned ;movaps xmm3, [v3] ; This would seg fault if uncommented movss xmm3, [num1] ; Move 32-bit float num1 to the least significant element of xmm4 movss xmm3, [v3] ; Move first 32-bit float of v3 to the least significant element of xmm4 movlps xmm4, [v3] ; Move 64-bits(two single precision floats) from memory to the lower 64-bit elements of xmm4 movhps xmm4, [v2] ; Move 64-bits(two single precision floats) from memory to the higher 64-bit elements of xmm4 ; Source and destination for movhlps and movlhps must be xmm registers movhlps xmm5, xmm4 ; Transfers the lower 64-bits of the source xmm4 to the higher 64-bits of the destination xmm5 movlhps xmm5, xmm4 ; Transfers the higher 64-bits of the source xmm4 to the lower 64-bits of the destination xmm5 movaps xmm6, [v2s1] movmskps eax, xmm6 ; Extract the sign bits from four 32-bits floats in xmm6 and create 4 bit mask in eax mov [mask1], eax ; Should be 8 movaps xmm6, [v2s2] movmskps eax, xmm6 ; Extract the sign bits from four 32-bits floats in xmm6 and create 4 bit mask in eax mov [mask2], eax ; Should be 12 movaps xmm6, [v2s3] movmskps eax, xmm6 ; Extract the sign bits from four 32-bits floats in xmm6 and create 4 bit mask in eax mov [mask3], eax ; Should be 14 movaps xmm6, [v2s4] movmskps eax, xmm6 ; Extract the sign bits from four 32-bits floats in xmm6 and create 4 bit mask in eax mov [mask4], eax ; Should be 15 ; ; SSE2 ; movapd xmm6, [v1dp] ; Move two 64-bit(double precision) floats to xmm6, using movapd since vector is 16 byte aligned ; Next two instruction should have equivalent results to movapd xmm6, [vldp] movhpd xmm6, [v1dp+8] ; Move a 64-bit(double precision) float into the higher 64-bit elements of xmm6 movlpd xmm6, [v1dp] ; Move a 64-bit(double precision) float into the lower 64-bit elements of xmm6 movupd xmm6, [v3dp] ; Move two 64-bit floats to xmm6, using movupd since vector is not 16 byte aligned
Source/eu.modelwriter.core.alloyinecore/src/main/java/eu/modelwriter/core/alloyinecore/recognizer/imports/Imports.g4
ModelWriter/AlloyInEcore
2
4912
grammar Imports; //https://github.com/antlr/antlr4/blob/master/doc/wildcard.md @parser::header { import eu.modelwriter.core.alloyinecore.structure.base.Element; import eu.modelwriter.core.alloyinecore.structure.imports.ImportedPackage; import eu.modelwriter.core.alloyinecore.structure.imports.ImportedClass; import eu.modelwriter.core.alloyinecore.structure.imports.ImportedInterface; import eu.modelwriter.core.alloyinecore.structure.imports.ImportedDataType; import eu.modelwriter.core.alloyinecore.structure.imports.ImportedEnum; import eu.modelwriter.core.alloyinecore.structure.model.Import; } @parser::members { private Element owningElement; } importModel[Element owner] @init{owningElement=owner;}: .*? iPackage[owningElement]* ; iPackage[Element owner] locals[ImportedPackage current] @after{if(owner != null) owner.addOwnedElement($current); else owningElement= $current;}: visibility? 'package' name= unrestrictedName {$current = new ImportedPackage($ctx);} ':' nsPrefix= identifier '=' nsURI= SINGLE_QUOTED_STRING ('{' (iClassifier[$current] | iPackage[$current] | . )*? '}' | ';') ; iClassifier[Element owner]: (iClass[$owner] | iDataType[$owner]) (block | ';'); iClass[Element owner] locals[ImportedClass current] @after{owner.addOwnedElement($current);}: visibility? (isAbstract= 'abstract'? isClass='class' | isInterface= 'interface') name= unrestrictedName templateSignature? ('extends' iGenericType (',' iGenericType)*)? {if ($isInterface!=null) $current = new ImportedInterface($ctx); else $current = new ImportedClass($ctx);} ; iDataType[Element owner] locals[ImportedDataType current] @after{owner.addOwnedElement($current);}: visibility? (isDataType= 'datatype' | isEnum= 'enum') name= unrestrictedName templateSignature? (':' instanceClassName= SINGLE_QUOTED_STRING)? {if ($isDataType!=null) $current = new ImportedDataType($ctx); else $current = new ImportedEnum($ctx);} ; visibility: 'public' | 'protected'| 'private' ; block : '{' (block | .)*? '}' ; templateSignature: '<' iTypeParameter (',' iTypeParameter)* '>'; iTypeParameter: unrestrictedName ('extends' iGenericType ('&' iGenericType)* )?; iGenericType: pathName ('<' iGenericTypeArgument (',' iGenericTypeArgument)* '>')? ; iGenericTypeArgument: iGenericType | iGenericWildcard ; iGenericWildcard: '?' (bound=('extends' | 'super') iGenericType)? ; pathName:firstSegment= unrestrictedName ('.' index= INT)? (midSegments+= segment* lastSegment= segment)? ; segment: '::' '@'? name= unrestrictedName ('.' index= INT)? ; unrestrictedName: identifier | 'abstract' | 'attribute' | 'body' | 'callable' | 'class' | 'composes' | 'datatype' | 'definition' | 'derivation' | 'derived' | 'enum' | 'ensure' | 'extends' | 'id' | 'import' | 'initial' | 'interface' | 'key' | 'model' | 'operation' | 'ordered' | 'package' | 'postcondition' | 'precondition' | 'primitive' | 'property' | 'readonly' | 'reference' | 'require' | 'resolve' | 'static' | 'throws' | 'transient' | 'unique' | 'unsettable' | 'volatile' | 'invariant' | 'literal' | 'serializable' | 'annotation' | 'model' ; identifier: IDENTIFIER; //upper: INT | '*'; //lower: INT; INT : DIGIT+ ; IDENTIFIER : (UNDERSCORE | LETTER) (LETTER | APOSTROPHE | DIGIT | UNDERSCORE | DOLLAR)* ; SINGLE_CHARACTER: '\'' ~['\\] '\''; DOUBLE_QUOTED_STRING: '"' ( ESCAPED_CHARACTER | ~('\\' | '"' ) )* '"' ; SINGLE_QUOTED_STRING: '\'' ( ESCAPED_CHARACTER | ~('\'' | '\\') )* '\'' ; fragment LETTER: [a-zA-Z]; fragment DIGIT: [0-9]; fragment ESCAPED_CHARACTER: '\\' ('b' | 't' | 'n' | 'f' | 'r' | 'u' | '"' | '\'' | '\\'); fragment UNDERSCORE: '_'; fragment APOSTROPHE: '\''; fragment DOLLAR: '$'; fragment EXCLAMINATION_MARK: '!'; fragment MINUS: '-'; ML_SINGLE_QUOTED_STRING : '\'' .*? '\'' -> skip; MULTILINE_COMMENT : '/*' .*? '*/' -> skip; SINGLELINE_COMMENT : ('--' | '//') .*? '\r'? '\n' -> skip; WS: [ \t\r\n]+ -> skip ; // toss out whitespace ANY : . ;
src/drivers/emulations/OPN2OnSFGTurboRPCM.asm
sharksym/vgmplay-sharksym
6
247139
; ; OPN2 on SFG + turboR PCM driver ; OPN2OnSFGTurboRPCM_CLOCK: equ 7670453 OPN2OnSFGTurboRPCM: MACRO super: Driver Device_noName, OPN2OnSFGTurboRPCM_CLOCK, OPN2OnSFGTurboRPCM_PrintInfoImpl opnFMOnSFGDriver: dw 0 turboRPCMDriver: dw 0 ; e = register ; d = value SafeWriteRegister: PROC ld a,e cp 2AH jp z,System_Return writePCMRegister: equ $ - 2 jp System_Return writeFMRegister: equ $ - 2 ENDP ; e = register ; d = value SafeWriteRegister2: PROC ld a,e jp System_Return writeFMRegister: equ $ - 2 ENDP ; d = value SafeWritePCMRegister: PROC jp System_Return writePCMRegister: equ $ - 2 ENDP ENDM ; ix = this ; iy = drivers OPN2OnSFGTurboRPCM_Construct: call Driver_Construct call OPN2OnSFGTurboRPCM_TryCreateOPNFMOnSFGDirect jp nc,Driver_NotFound ld (ix + OPN2OnSFGTurboRPCM.opnFMOnSFGDriver),e ld (ix + OPN2OnSFGTurboRPCM.opnFMOnSFGDriver + 1),d ld bc,OPN2OnSFGTurboRPCM.SafeWriteRegister.writeFMRegister call Device_ConnectInterface ld bc,OPN2OnSFGTurboRPCM.SafeWriteRegister2.writeFMRegister call Device_ConnectInterface push ix ld ixl,e ld ixh,d ld de,38464 call OPNFMOnSFG_SetFrequencyOffset pop ix call OPN2OnSFGTurboRPCM_TryCreatePCM ret nc ld (ix + OPN2OnSFGTurboRPCM.turboRPCMDriver),e ld (ix + OPN2OnSFGTurboRPCM.turboRPCMDriver + 1),d ld bc,OPN2OnSFGTurboRPCM.SafeWriteRegister.writePCMRegister call Device_ConnectInterface ld bc,OPN2OnSFGTurboRPCM.SafeWritePCMRegister.writePCMRegister jp Device_ConnectInterfaceAgain ; ix = this OPN2OnSFGTurboRPCM_Destruct: equ System_Return ; ret ; iy = drivers ; ix = this ; de <- driver ; hl <- device interface ; f <- c: succeeded OPN2OnSFGTurboRPCM_TryCreateOPNFMOnSFGDirect: equ OPNOnSFGPSG_TryCreateOPNFMOnSFGDirect ; jp OPNOnSFGPSG_TryCreateOPNFMOnSFGDirect ; iy = drivers ; ix = this ; de <- driver ; hl <- device interface ; f <- c: succeeded OPN2OnSFGTurboRPCM_TryCreatePCM: equ OPN2OnTurboRPCM_TryCreatePCM ; jp OPN2OnTurboRPCM_TryCreatePCM ; ix = this OPN2OnSFGTurboRPCM_PrintInfoImpl: ld de,OPN2OnSFGTurboRPCM.opnFMOnSFGDriver call Driver_PrintInfoIXOffset ld de,OPN2OnSFGTurboRPCM.turboRPCMDriver jp Driver_PrintInfoIXOffset ; SECTION RAM OPN2OnSFGTurboRPCM_instance: OPN2OnSFGTurboRPCM ENDS OPN2OnSFGTurboRPCM_interface: InterfaceOffset OPN2OnSFGTurboRPCM.SafeWriteRegister InterfaceOffset OPN2OnSFGTurboRPCM.SafeWriteRegister2 InterfaceOffset OPN2OnSFGTurboRPCM.SafeWritePCMRegister
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_712.asm
ljhsiun2/medusa
9
26359
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r15 push %r8 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x176de, %r8 nop nop nop nop xor $33039, %rax mov $0x6162636465666768, %rdx movq %rdx, %xmm3 vmovups %ymm3, (%r8) nop nop nop sub $47330, %rsi lea addresses_WC_ht+0x8e9e, %rcx nop sub $22915, %r10 movw $0x6162, (%rcx) nop nop nop nop nop dec %r15 lea addresses_WC_ht+0x949e, %rsi lea addresses_D_ht+0x1639e, %rdi clflush (%rdi) nop nop cmp %r8, %r8 mov $102, %rcx rep movsw nop nop add %rsi, %rsi lea addresses_normal_ht+0xbd2c, %rsi lea addresses_UC_ht+0x1549e, %rdi clflush (%rsi) clflush (%rdi) nop and %r15, %r15 mov $83, %rcx rep movsq nop nop nop nop nop xor %r15, %r15 lea addresses_WC_ht+0x1331e, %rcx nop nop nop nop lfence movups (%rcx), %xmm4 vpextrq $0, %xmm4, %r10 nop nop nop nop sub $21237, %r15 lea addresses_D_ht+0x549e, %r8 clflush (%r8) nop nop dec %rax movups (%r8), %xmm4 vpextrq $1, %xmm4, %rdx nop nop xor $30404, %rsi lea addresses_WC_ht+0xe15e, %rdi nop sub %rdx, %rdx movb $0x61, (%rdi) nop nop nop nop dec %r8 lea addresses_UC_ht+0x1483e, %rsi lea addresses_WT_ht+0x1a0e, %rdi clflush (%rsi) nop nop nop nop nop xor %r15, %r15 mov $68, %rcx rep movsl nop cmp %r10, %r10 lea addresses_normal_ht+0x1bade, %rdx nop nop sub %rax, %rax movb $0x61, (%rdx) nop nop xor $18084, %r10 lea addresses_normal_ht+0x928e, %rsi lea addresses_A_ht+0x1069e, %rdi nop cmp %rdx, %rdx mov $73, %rcx rep movsq nop nop nop nop nop and $26681, %rdi lea addresses_UC_ht+0x31dc, %rax nop nop nop xor %r8, %r8 movb $0x61, (%rax) nop nop nop xor $23271, %r8 lea addresses_WT_ht+0x7d1e, %r8 nop nop nop nop nop xor %rax, %rax mov (%r8), %edx nop nop nop nop dec %r15 lea addresses_WT_ht+0x2e9e, %rsi lea addresses_normal_ht+0x1d446, %rdi nop nop nop nop nop dec %rdx mov $41, %rcx rep movsw nop xor %rsi, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r8 pop %r15 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %r8 push %rax push %rcx push %rdi push %rsi // Store lea addresses_WC+0x69e, %r8 nop nop nop nop nop and %r11, %r11 mov $0x5152535455565758, %r10 movq %r10, (%r8) nop nop nop nop nop add $2116, %r10 // REPMOV lea addresses_D+0x13d0c, %rsi lea addresses_UC+0xe09e, %rdi and $44655, %r10 mov $6, %rcx rep movsq nop nop and $26713, %r14 // Load lea addresses_RW+0x1bf9e, %r8 nop nop nop nop xor $3519, %rax movups (%r8), %xmm4 vpextrq $1, %xmm4, %rcx xor %rdi, %rdi // REPMOV lea addresses_RW+0x269e, %rsi lea addresses_UC+0x1578e, %rdi nop nop sub $50201, %r10 mov $69, %rcx rep movsw nop add %rdi, %rdi // Store lea addresses_UC+0xce1e, %rax add $18449, %rcx mov $0x5152535455565758, %rdi movq %rdi, %xmm0 vmovups %ymm0, (%rax) nop nop xor %rcx, %rcx // Faulty Load lea addresses_RW+0x269e, %rsi sub %rax, %rax movb (%rsi), %r8b lea oracles, %r14 and $0xff, %r8 shlq $12, %r8 mov (%r14,%r8,1), %r8 pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WC', 'size': 8, 'AVXalign': False}} {'src': {'type': 'addresses_D', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC', 'congruent': 8, 'same': False}} {'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_RW', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_RW', 'congruent': 0, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_UC', 'size': 32, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}} {'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 5, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': True}} {'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
programs/oeis/062/A062298.asm
neoneye/loda
22
162393
<filename>programs/oeis/062/A062298.asm ; A062298: Number of nonprimes <= n. ; 1,1,1,2,2,3,3,4,5,6,6,7,7,8,9,10,10,11,11,12,13,14,14,15,16,17,18,19,19,20,20,21,22,23,24,25,25,26,27,28,28,29,29,30,31,32,32,33,34,35,36,37,37,38,39,40,41,42,42,43,43,44,45,46,47,48,48,49,50,51,51,52,52,53,54,55,56,57,57,58,59,60,60,61,62,63,64,65,65,66,67,68,69,70,71,72,72,73,74,75 mov $1,1 max $1,$0 mov $2,$1 seq $2,33270 ; Number of odd primes <= n. sub $1,$2 mov $0,$1
week3/max_int_array.adb
adammw/rtp_labs
0
28964
<reponame>adammw/rtp_labs with Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO; procedure Max_Int_Array is type Int_Array is array(Character range <>) of Integer; function Max(Items : in Int_Array) return Integer is Max_Value : Integer := Items(Items'First); begin for I in Items'Range loop if Items(I) > Max_Value then Max_Value := Items(I); end if; end loop; return Max_Value; end Max; Test_Array : Int_Array := (5, 9, -1, 22, 8, 74, -9); begin Put("Max="); Put(Max(Test_Array)); end Max_Int_Array;
Transynther/x86/_processed/US/_st_4k_/i3-7100_9_0xca_notsx.log_322_831.asm
ljhsiun2/medusa
9
91531
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0xebe6, %rcx add $50848, %rbp movw $0x6162, (%rcx) nop nop sub %rbx, %rbx lea addresses_UC_ht+0xd476, %r13 nop nop nop nop xor %rsi, %rsi movb (%r13), %al nop nop nop nop nop and $46080, %rcx lea addresses_WT_ht+0x14596, %rsi lea addresses_A_ht+0x7976, %rdi nop nop nop nop nop and %r13, %r13 mov $109, %rcx rep movsl xor %rbp, %rbp lea addresses_D_ht+0x6836, %rsi lea addresses_UC_ht+0xd76, %rdi nop nop nop sub %rbp, %rbp mov $107, %rcx rep movsl nop nop nop nop nop xor $10929, %rax lea addresses_WT_ht+0x39ce, %rsi lea addresses_A_ht+0xbf76, %rdi nop nop nop nop nop cmp %rbp, %rbp mov $40, %rcx rep movsl nop nop nop and %rsi, %rsi lea addresses_A_ht+0x1c51e, %rsi lea addresses_A_ht+0x12078, %rdi clflush (%rsi) nop dec %rbx mov $91, %rcx rep movsb nop nop nop xor %r11, %r11 lea addresses_UC_ht+0x77be, %rdi nop nop nop nop nop cmp $52256, %rsi mov $0x6162636465666768, %rbx movq %rbx, %xmm7 and $0xffffffffffffffc0, %rdi movaps %xmm7, (%rdi) nop nop nop inc %r11 lea addresses_normal_ht+0x625a, %rcx nop nop nop nop nop xor %rbx, %rbx vmovups (%rcx), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %rax nop nop nop xor %rdi, %rdi lea addresses_WT_ht+0x1c319, %rax nop nop nop nop inc %r11 movups (%rax), %xmm4 vpextrq $0, %xmm4, %r13 nop nop nop nop nop cmp %rbp, %rbp lea addresses_UC_ht+0x2576, %rsi lea addresses_A_ht+0xdd6, %rdi nop nop nop xor $13635, %r11 mov $35, %rcx rep movsl nop nop nop nop nop add $9206, %rcx lea addresses_D_ht+0x586e, %rbp nop nop dec %rdi mov $0x6162636465666768, %r13 movq %r13, %xmm4 movups %xmm4, (%rbp) nop nop nop nop xor %r13, %r13 lea addresses_D_ht+0x3406, %r11 nop add $853, %rcx mov (%r11), %si nop nop nop nop nop mfence lea addresses_D_ht+0x19176, %rsi lea addresses_D_ht+0xb876, %rdi clflush (%rdi) cmp $56765, %r11 mov $39, %rcx rep movsb nop nop nop nop nop sub $44540, %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r14 push %rax push %rbx push %rcx push %rsi // Store lea addresses_UC+0x1ed76, %rsi nop nop nop add %rax, %rax mov $0x5152535455565758, %rbx movq %rbx, (%rsi) nop nop nop inc %rax // Store lea addresses_A+0x1a09a, %rax nop nop nop nop nop add %r12, %r12 mov $0x5152535455565758, %r14 movq %r14, (%rax) nop nop nop nop nop cmp %rbx, %rbx // Store mov $0x7bf2d700000002e6, %r13 nop sub $54388, %rcx mov $0x5152535455565758, %r14 movq %r14, %xmm5 vmovups %ymm5, (%r13) nop nop nop nop nop inc %rbx // Store lea addresses_D+0x8ad6, %r12 nop nop add %rbx, %rbx movb $0x51, (%r12) nop nop add $63727, %r12 // Store lea addresses_normal+0xf576, %rsi cmp %r12, %r12 mov $0x5152535455565758, %rcx movq %rcx, %xmm0 vmovntdq %ymm0, (%rsi) nop nop nop sub $60639, %r12 // Faulty Load lea addresses_US+0x15d76, %rax nop nop nop nop sub %rsi, %rsi mov (%rax), %r14 lea oracles, %rcx and $0xff, %r14 shlq $12, %r14 mov (%rcx,%r14,1), %r14 pop %rsi pop %rcx pop %rbx pop %rax pop %r14 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_UC', 'size': 8, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_A', 'size': 8, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_NC', 'size': 32, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_D', 'size': 1, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': True, 'type': 'addresses_normal', 'size': 32, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False}} {'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}} {'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}} {'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': True}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': True}} {'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False}} {'src': {'same': False, 'congruent': 2, 'NT': True, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': True}} {'58': 322} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
src/wiki-filters-variables.adb
jquorning/ada-wiki
18
10516
----------------------------------------------------------------------- -- wiki-filters-variables -- Expand variables in text and links -- Copyright (C) 2020 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Wiki.Filters.Variables is function Need_Expand (Text : in Wiki.Strings.WString) return Boolean; function Need_Expand (Text : in Wiki.Strings.WString) return Boolean is begin return Wiki.Strings.Index (Text, "$") > 0; end Need_Expand; procedure Add_Variable (Chain : in Wiki.Filters.Filter_Chain; Name : in Wiki.Strings.WString; Value : in Wiki.Strings.WString) is Filter : Filter_Type_Access := Chain.Next; begin while Filter /= null loop if Filter.all in Variable_Filter'Class then Variable_Filter'Class (Filter.all).Add_Variable (Name, Value); return; end if; Filter := Filter.Next; end loop; end Add_Variable; -- ------------------------------ -- Add a variable to replace the given name by its value. -- ------------------------------ procedure Add_Variable (Filter : in out Variable_Filter; Name : in Wiki.Strings.WString; Value : in Wiki.Strings.WString) is begin Filter.Variables.Include (Name, Value); end Add_Variable; procedure Add_Variable (Filter : in out Variable_Filter; Name : in String; Value : in Wiki.Strings.WString) is begin Filter.Variables.Include (Wiki.Strings.To_WString (Name), Value); end Add_Variable; -- ------------------------------ -- Add a section header with the given level in the document. -- ------------------------------ overriding procedure Add_Header (Filter : in out Variable_Filter; Document : in out Wiki.Documents.Document; Header : in Wiki.Strings.WString; Level : in Natural) is begin if Need_Expand (Header) then Filter_Type (Filter).Add_Header (Document, Filter.Expand (Header), Level); else Filter_Type (Filter).Add_Header (Document, Header, Level); end if; end Add_Header; -- ------------------------------ -- Add a text content with the given format to the document. Replace variables -- that are contained in the text. -- ------------------------------ overriding procedure Add_Text (Filter : in out Variable_Filter; Document : in out Wiki.Documents.Document; Text : in Wiki.Strings.WString; Format : in Wiki.Format_Map) is begin if Need_Expand (Text) then Filter_Type (Filter).Add_Text (Document, Filter.Expand (Text), Format); else Filter_Type (Filter).Add_Text (Document, Text, Format); end if; end Add_Text; -- ------------------------------ -- Add a link. -- ------------------------------ overriding procedure Add_Link (Filter : in out Variable_Filter; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List) is begin if Need_Expand (Name) then Filter_Type (Filter).Add_Link (Document, Filter.Expand (Name), Attributes); else Filter_Type (Filter).Add_Link (Document, Name, Attributes); end if; end Add_Link; -- ------------------------------ -- Add a quote. -- ------------------------------ overriding procedure Add_Quote (Filter : in out Variable_Filter; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List) is begin if Need_Expand (Name) then Filter_Type (Filter).Add_Quote (Document, Filter.Expand (Name), Attributes); else Filter_Type (Filter).Add_Quote (Document, Name, Attributes); end if; end Add_Quote; -- ------------------------------ -- Expand the variables contained in the text. -- ------------------------------ function Expand (Filter : in Variable_Filter; Text : in Wiki.Strings.WString) return Wiki.Strings.WString is First : Natural := Text'First; Pos : Natural; Last : Natural; Name_Start : Natural; Name_End : Natural; Result : Wiki.Strings.BString (256); Item : Variable_Cursor; Match_End : Wiki.Strings.WChar; begin while First <= Text'Last loop Pos := First; while Pos <= Text'Last and then Text (Pos) /= '$' loop Pos := Pos + 1; end loop; exit when Pos >= Text'Last; Strings.Wide_Wide_Builders.Append (Result, Text (First .. Pos - 1)); First := Pos; Name_Start := Pos + 1; if Text (Name_Start) = '(' or Text (Name_Start) = '{' then Match_End := (if Text (Name_Start) = '(' then ')' else '}'); Name_Start := Name_Start + 1; Name_End := Name_Start; while Name_End <= Text'Last and then Text (Name_End) /= Match_End loop Name_End := Name_End + 1; end loop; exit when Name_End > Text'Last; exit when Text (Name_End) /= Match_End; Last := Name_End + 1; Name_End := Name_End - 1; else Name_End := Name_Start; while Name_End <= Text'Last and then Text (Name_End) /= ' ' loop Name_End := Name_End + 1; end loop; Last := Name_End; Name_End := Name_End - 1; end if; Item := Filter.Variables.Find (Text (Name_Start .. Name_End)); if Variable_Maps.Has_Element (Item) then Strings.Wide_Wide_Builders.Append (Result, Variable_Maps.Element (Item)); First := Last; elsif Last > Text'Last then exit; else Strings.Wide_Wide_Builders.Append (Result, Text (First .. Last)); First := Last + 1; end if; end loop; if First <= Text'Last then Strings.Wide_Wide_Builders.Append (Result, Text (First .. Text'Last)); end if; return Strings.Wide_Wide_Builders.To_Array (Result); end Expand; -- ------------------------------ -- Iterate over the filter variables. -- ------------------------------ procedure Iterate (Filter : in Variable_Filter; Process : not null access procedure (Name, Value : in Strings.WString)) is Iter : Variable_Cursor := Filter.Variables.First; begin while Variable_Maps.Has_Element (Iter) loop Variable_Maps.Query_Element (Iter, Process); Variable_Maps.Next (Iter); end loop; end Iterate; procedure Iterate (Chain : in Wiki.Filters.Filter_Chain; Process : not null access procedure (Name, Value : in Strings.WString)) is Filter : Filter_Type_Access := Chain.Next; begin while Filter /= null loop if Filter.all in Variable_Filter'Class then Variable_Filter'Class (Filter.all).Iterate (Process); return; end if; Filter := Filter.Next; end loop; end Iterate; end Wiki.Filters.Variables;