https://github.com/shirriff/virtualagc/blob/master/Borealis/BITCOIN.agc ``` ### FILE="Main.annotation" ## Copyright: Public domain. ## Filename: AGC_VERSION_CHECK.agc ## Purpose: Hack to mine bitcoin. ## Assembler: yaYUL ## Contact: Ken Shirriff <ken.shirriff@gmail.com>. ## Website: http://www.ibiblio.org/apollo/index.html ## Mod history: 2019-06-13 KWS Created. BANK 25 EBANK= MH0 BITCOIN CAF MBK TS EBANK CAF N23 H0LOOP TS MCNT # Copy 24 words from H0INIT to MH0 INDEX A CAF H0INIT INDEX MCNT TS MH0 CCS MCNT TC H0LOOP CCS NEWJOB # See if any jobs pending so we TC CHANG1 # don't crash into the Moon CAF N47 INLOOP TS MCNT # Copy 48 words (16 32words) from INPUT to MW INDEX A CAF INPUT INDEX MCNT TS MW CCS MCNT TC INLOOP # Loop to initialize W 16-63 # Instead of looping i from 16 to 63, we loop from 0 to 47. # But we step by 3 since the elements are 3 words each. # So MCNT = (i-16) * 3 CAF N0 TS MCNT INITLOOP INDEX MCNT CA MW +3D # W[i-15] to ROR TS RORBUF INDEX MCNT CA MW +4D TS RORBUF +1 INDEX MCNT CA MW +5D TS RORBUF +2 CCS NEWJOB # See if any jobs pending TC CHANG1 # Don't crash into the moon # Rotate 3 CA N3 TS RORCNT TC RORN # rightrotate 3 # S0 = W[i-15] rightshift 3. Zero top 3 bits for shift instead of rotate CA RORBUF MASK N1 # Zero 3 bits, keep 1 bit TS MS0 CA RORBUF +1 TS MS0 +1 CA RORBUF +2 TS MS0 +2 # Rotate 4 more to get rightrotate 7 CA N4 TS RORCNT TC RORN # rightrotate # XOR into s0. CAF MS0A TS MPAC CAF RORBUFA TS MPAC +1 TC XOR # Rotate 11 more to get rightrotate 18 CA N11 TS RORCNT TC RORN # rightrotate # XOR into s0 TC XOR # MPAC, MPAC+1 still set up # Now compute S1 # Put w[i-2] in ROR # Index is MCNT[(16-2)*3] = MCNT[42] INDEX MCNT CA MW +42D TS RORBUF INDEX MCNT CA MW +43D TS RORBUF +1 INDEX MCNT CA MW +44D TS RORBUF +2 # Rightrotate 10 CA N10 TS RORCNT TC RORN # rightrotate # Mask to get rightshift 10 and store in S1 # Remove 4 bits from first word, top 6 from second word CA N0 TS MS1 # Top 4 bits 0 CA RORBUF +1 MASK N255 # Leave 8 bits in next word TS MS1 +1 CA RORBUF +2 TS MS1 +2 # Rightrotate 7 more to get rightrotate 17 CA N7 TS RORCNT TC RORN # rightrotate # XOR into S1 CAF MS1A TS MPAC # MPAC +1 still RORBUFA TC XOR # Rightrotate 2 more to get rightrotate 19 CA N2 TS RORCNT TC RORN # rightrotate # XOR into S1 TC XOR # Copy W[i-16] to W[i]. I.e. MCNT to MCNT + 3*16 INDEX MCNT CA MW INDEX MCNT TS MW +48D INDEX MCNT CA MW +1 INDEX MCNT TS MW +49D INDEX MCNT CA MW +2 INDEX MCNT TS MW +50D # Add S0 to W[i] (i.e. MCNT + 48) CAF MW48A AD MCNT TS MPAC CAF MS0A TS MPAC +1 TC ADD # Add W[i-7] (i.e. MCNT + (16-7)*3 = 27) CAF MW27A AD MCNT TS MPAC +1 TC ADD # Add S1 CAF MS1A TS MPAC +1 TC ADD # End of init loop, loop back. CA MCNT # MCNT += 3 AD N3 TS MCNT AD NM141 # loop while MCNT <= 141 (i.e. i <= 63) EXTEND BZMF INITLOOP # Copy H0 to H7 into A to H CAF N23 COPYAH TS MCNT # Copy 24 words from H0... to A... INDEX A CAF MH0 INDEX MCNT TS MA CCS MCNT TC COPYAH CCS NEWJOB # See if any jobs pending TC CHANG1 # Main loop, 64 times # MCNT is the memory index from 0 to 63*3 in steps of 3. CAF N0 TS MCNT MAINLOOP CCS NEWJOB # See if any jobs pending TC CHANG1 # E rightrotate 6 CA ME TS RORBUF CA ME +1 TS RORBUF +1 CA ME +2 TS RORBUF +2 CA N6 TS RORCNT TC RORN # Store in S1 CA RORBUF TS MS1 CA RORBUF +1 TS …