├── environment ├── other_platforms │ ├── win │ │ ├── garbage │ │ │ └── temp │ │ ├── zombies │ │ │ └── temp.txt │ │ ├── nasm │ │ │ ├── assembly_temp.asm │ │ │ ├── nasmpath.bat │ │ │ ├── nasm.exe │ │ │ ├── nasm.ico │ │ │ ├── nasmdoc.pdf │ │ │ ├── ndisasm.exe │ │ │ ├── Uninstall.exe │ │ │ ├── rdoff │ │ │ │ ├── rdx.exe │ │ │ │ ├── ldrdf.exe │ │ │ │ ├── rdflib.exe │ │ │ │ ├── rdf2bin.exe │ │ │ │ ├── rdf2com.exe │ │ │ │ ├── rdf2ihx.exe │ │ │ │ ├── rdf2ith.exe │ │ │ │ ├── rdf2srec.exe │ │ │ │ └── rdfdump.exe │ │ │ ├── contrib │ │ │ │ └── VSrules │ │ │ │ │ ├── nasm.README │ │ │ │ │ └── nasm.rules │ │ │ └── LICENSE │ │ ├── work_directory │ │ │ └── temp │ │ ├── debugger.bat │ │ ├── silent.bat │ │ ├── cgx.bat │ │ ├── lib │ │ │ ├── debugger.jar │ │ │ ├── temp_disassemblr │ │ │ ├── corewars8086-4.0.0.jar │ │ │ └── commons-math3-3.4.1.jar │ │ ├── survivors │ │ │ ├── bimp1 │ │ │ ├── bimp2 │ │ │ ├── example │ │ │ ├── shooterA1 │ │ │ ├── shooterA2 │ │ │ ├── shooterB │ │ │ └── shooterC │ │ ├── scores.csv │ │ ├── course-asm-to-opcode.bat │ │ ├── course-script-to-run.bat │ │ └── course-tron-arena.bat │ └── mac │ │ ├── mac-script-to-run.command │ │ ├── mac_debugger.sh │ │ ├── debugger.command │ │ ├── nasm_mac │ │ ├── ldrdf │ │ ├── nasm │ │ ├── rdx │ │ ├── ndisasm │ │ ├── rdf2bin │ │ ├── rdf2com │ │ ├── rdf2ihx │ │ ├── rdf2ith │ │ ├── rdfdump │ │ ├── rdflib │ │ ├── .DS_Store │ │ ├── rdf2srec │ │ ├── ._.DS_Store │ │ ├── nasmdoc.pdf │ │ ├── README │ │ └── LICENSE │ │ └── mac-course-script-to-run.sh ├── techniques │ ├── riscv │ │ ├── still.asm │ │ ├── ranger.asm │ │ ├── warrior.asm │ │ ├── scanner.asm │ │ ├── duplicate.asm │ │ └── scout.asm │ └── i8086 │ │ ├── step-8-cgx-callfar.asm │ │ ├── step-4-cgx-call-far.asm │ │ ├── step-3-cgx-ab50.asm │ │ ├── step-5-cgx-copy-to-es.asm │ │ ├── step-1-cgx-attack-loop-stosw.asm │ │ ├── step-2-cgx-traps.asm │ │ ├── step-6-cgx-copy.asm │ │ └── step-7-cgx-traps-copy.asm ├── zombies │ └── ZOMA ├── survivors │ ├── bimp1 │ ├── bimp2 │ ├── shooterA1 │ ├── shooterA2 │ ├── shooterB │ └── shooterC ├── cgx_i8086_run.sh ├── cgx_i8086_debug.sh └── cgx_riscv_build.sh ├── configure.sh ├── misc └── logo0 ├── README.md └── setup.sh /environment/other_platforms/win/garbage/temp: -------------------------------------------------------------------------------- 1 | temp -------------------------------------------------------------------------------- /environment/other_platforms/win/zombies/temp.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/assembly_temp.asm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /environment/other_platforms/win/work_directory/temp: -------------------------------------------------------------------------------- 1 | temp 2 | -------------------------------------------------------------------------------- /environment/techniques/riscv/still.asm: -------------------------------------------------------------------------------- 1 | # Technieque - Still 2 | j x1 3 | 4 | -------------------------------------------------------------------------------- /environment/other_platforms/mac/mac-script-to-run.command: -------------------------------------------------------------------------------- 1 | sudo sh ./mac-course-script-to-run.sh 2 | -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/nasmpath.bat: -------------------------------------------------------------------------------- 1 | @set path=C:\Users\yoda\AppData\Local\nasm;%path% 2 | @%comspec% -------------------------------------------------------------------------------- /environment/zombies/ZOMA: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/zombies/ZOMA -------------------------------------------------------------------------------- /environment/survivors/bimp1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/survivors/bimp1 -------------------------------------------------------------------------------- /environment/survivors/bimp2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/survivors/bimp2 -------------------------------------------------------------------------------- /environment/other_platforms/win/debugger.bat: -------------------------------------------------------------------------------- 1 | java -cp lib\debugger.jar;lib\* il.co.codeguru.corewars8086.CoreWarsEngine 2 | -------------------------------------------------------------------------------- /environment/other_platforms/win/silent.bat: -------------------------------------------------------------------------------- 1 | java -cp lib\debugger.jar;lib\* il.co.codeguru.corewars8086.AutoCoreWars 2 | -------------------------------------------------------------------------------- /environment/survivors/shooterA1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/survivors/shooterA1 -------------------------------------------------------------------------------- /environment/survivors/shooterA2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/survivors/shooterA2 -------------------------------------------------------------------------------- /environment/survivors/shooterB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/survivors/shooterB -------------------------------------------------------------------------------- /environment/survivors/shooterC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/survivors/shooterC -------------------------------------------------------------------------------- /environment/other_platforms/mac/mac_debugger.sh: -------------------------------------------------------------------------------- 1 | java -cp lib/debugger.jar;lib/* il.co.codeguru.corewars8086.CoreWarsEngine 2 | -------------------------------------------------------------------------------- /environment/other_platforms/win/cgx.bat: -------------------------------------------------------------------------------- 1 | java -cp lib\corewars8086-4.0.0.jar;lib\* il.co.codeguru.corewars8086.CoreWarsEngine 2 | -------------------------------------------------------------------------------- /environment/other_platforms/mac/debugger.command: -------------------------------------------------------------------------------- 1 | sudo java -cp lib/debugger.jar:lib/* il.co.codeguru.corewars8086.CoreWarsEngine 2 | -------------------------------------------------------------------------------- /environment/techniques/riscv/ranger.asm: -------------------------------------------------------------------------------- 1 | # Technique - Ranger 2 | ranger: 3 | add x1, x1, 750 4 | sw zero, 32(x1) 5 | j ranger 6 | 7 | -------------------------------------------------------------------------------- /environment/techniques/riscv/warrior.asm: -------------------------------------------------------------------------------- 1 | # Technique - Warrior 2 | warrior: 3 | add x1, x1, 4 4 | sw zero, 32(x1) 5 | j warrior 6 | 7 | -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/ldrdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/ldrdf -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/nasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/nasm -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/rdx -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/nasm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/nasm.exe -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/nasm.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/nasm.ico -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/ndisasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/ndisasm -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/rdf2bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/rdf2bin -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/rdf2com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/rdf2com -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/rdf2ihx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/rdf2ihx -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/rdf2ith: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/rdf2ith -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/rdfdump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/rdfdump -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/rdflib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/rdflib -------------------------------------------------------------------------------- /environment/other_platforms/win/lib/debugger.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/lib/debugger.jar -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/nasmdoc.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/nasmdoc.pdf -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/ndisasm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/ndisasm.exe -------------------------------------------------------------------------------- /environment/other_platforms/win/survivors/bimp1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/survivors/bimp1 -------------------------------------------------------------------------------- /environment/other_platforms/win/survivors/bimp2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/survivors/bimp2 -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/.DS_Store -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/rdf2srec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/rdf2srec -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/Uninstall.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/Uninstall.exe -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/rdoff/rdx.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/rdoff/rdx.exe -------------------------------------------------------------------------------- /environment/other_platforms/win/survivors/example: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/survivors/example -------------------------------------------------------------------------------- /environment/other_platforms/win/survivors/shooterA1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/survivors/shooterA1 -------------------------------------------------------------------------------- /environment/other_platforms/win/survivors/shooterA2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/survivors/shooterA2 -------------------------------------------------------------------------------- /environment/other_platforms/win/survivors/shooterB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/survivors/shooterB -------------------------------------------------------------------------------- /environment/other_platforms/win/survivors/shooterC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/survivors/shooterC -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/._.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/._.DS_Store -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/nasmdoc.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/mac/nasm_mac/nasmdoc.pdf -------------------------------------------------------------------------------- /environment/other_platforms/win/lib/temp_disassemblr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/lib/temp_disassemblr -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/rdoff/ldrdf.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/rdoff/ldrdf.exe -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/rdoff/rdflib.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/rdoff/rdflib.exe -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/rdoff/rdf2bin.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/rdoff/rdf2bin.exe -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/rdoff/rdf2com.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/rdoff/rdf2com.exe -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/rdoff/rdf2ihx.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/rdoff/rdf2ihx.exe -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/rdoff/rdf2ith.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/rdoff/rdf2ith.exe -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/rdoff/rdf2srec.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/rdoff/rdf2srec.exe -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/rdoff/rdfdump.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/nasm/rdoff/rdfdump.exe -------------------------------------------------------------------------------- /environment/other_platforms/win/lib/corewars8086-4.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/lib/corewars8086-4.0.0.jar -------------------------------------------------------------------------------- /environment/other_platforms/win/lib/commons-math3-3.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eLoopWoo/codeguru-extreme/HEAD/environment/other_platforms/win/lib/commons-math3-3.4.1.jar -------------------------------------------------------------------------------- /environment/other_platforms/win/scores.csv: -------------------------------------------------------------------------------- 1 | bimp,0.0,bimp1,0.0,bimp2,0.0 2 | example,16.0,example,16.0 3 | shooterA,14.0,shooterA1,9.0,shooterA2,5.0 4 | shooterB,10.0,shooterB,10.0 5 | shooterC,9.0,shooterC,9.0 6 | -------------------------------------------------------------------------------- /environment/techniques/i8086/step-8-cgx-callfar.asm: -------------------------------------------------------------------------------- 1 | call get_ip 2 | get_ip: 3 | pop bx 4 | add bx,callfar_ - get_ip 5 | mov si,0x50 6 | mov word [si],bx 7 | 8 | push cs 9 | pop bx 10 | 11 | push ds 12 | pop ss 13 | mov word [si + 2],bx 14 | mov sp,ax 15 | callfar_: 16 | call far [si] 17 | -------------------------------------------------------------------------------- /environment/techniques/riscv/scanner.asm: -------------------------------------------------------------------------------- 1 | # Technique - Scanner 2 | 3 | add x1, x1, 0x512 4 | 5 | scan: 6 | add x1, x1, 64 7 | lw x3,(x1) 8 | bne x3, zero, detected 9 | j scan 10 | 11 | detected: 12 | sw zero, (x1) 13 | #j scan 14 | 15 | ranger: 16 | add x1, x1, 750 17 | sw zero, 32(x1) 18 | j ranger 19 | 20 | -------------------------------------------------------------------------------- /environment/techniques/riscv/duplicate.asm: -------------------------------------------------------------------------------- 1 | # Technique - Duplicate 2 | 3 | 4 | li x2, 0x256 # Offset 5 | li x6, 0x256-28 6 | li x7, 0x256-24 7 | 8 | addi x1, x1, 14 # start: 9 | 10 | start: 11 | li x5, 7 # 4 * 10 bytes to copy 12 | 13 | duplicate_loop: 14 | addi x5, x5, -1 # Increment counter 15 | lw x4, (x1) 16 | 17 | add x15, x1, x2 18 | sw x4,(x15) 19 | 20 | add x1, x1, 4 21 | 22 | bne x5, zero, duplicate_loop 23 | 24 | add x1, x1, x6 25 | jr x7 26 | 27 | -------------------------------------------------------------------------------- /environment/techniques/riscv/scout.asm: -------------------------------------------------------------------------------- 1 | # Technique - Scout ( Low Address ) 2 | 3 | set_scout: 4 | li x5, 0 5 | sw x1, -74(x1) 6 | li x4, 10 7 | mv x6, x1 8 | 9 | scout: 10 | lw x3, -74(x1) 11 | bne x3,x1,scout_low_addr 12 | j scout 13 | 14 | scout_low_addr: 15 | mv x6, x1 16 | scout_copy_loop: 17 | add x4, x4, -1 18 | lw x2, (x1) 19 | sw x2, -74(x1) 20 | add x1, x1, 4 21 | bne x4, x5, scout_copy_loop 22 | mv x1, x6 23 | add x1, x1, -74 24 | j x1-74 25 | 26 | -------------------------------------------------------------------------------- /environment/techniques/i8086/step-4-cgx-call-far.asm: -------------------------------------------------------------------------------- 1 | ; prepare to use call far technique 2 | ; USE SS pArena 3 | ; USE DS pArena 4 | ; USE BX wAddress_dword_address 5 | ; USE AX survivor_location 6 | ; USE CS pArena 7 | %macro fCallfar_prepare 0 8 | push ds 9 | pop ss 10 | 11 | mov bx,ax 12 | mov sp,ax 13 | 14 | add ax,call_far 15 | add bx,end_survivor 16 | 17 | mov [bx],ax 18 | mov [bx+2],cs 19 | %endmacro 20 | 21 | ; call far to dword address pointed to by bx 22 | %macro fCallfar_start 0 23 | call far [bx] 24 | %endmacro 25 | 26 | fCallfar_prepare 27 | call_far: fCallfar_start ; arena:bx -> arena:sp 28 | 29 | end_survivor: -------------------------------------------------------------------------------- /environment/techniques/i8086/step-3-cgx-ab50.asm: -------------------------------------------------------------------------------- 1 | ; stosw ax -> es:di 2 | %define wOpcode_bomb 0xAB50 ; stosw push ax 3 | 4 | ; es & ds & ss point to arena 5 | %macro fSegments_arena 0 6 | push ds 7 | pop es 8 | push ds 9 | pop ss 10 | %endmacro 11 | 12 | ; di -> survivor_location & ax = wOpcode_bomb 13 | %macro fPrepare_load_below 0 14 | xchg ax,di 15 | mov ax, wOpcode_bomb 16 | %endmacro 17 | 18 | ; sp -> survivor_location & di = survivor_tail_location 19 | %macro fPrepare_load_above 0 20 | mov sp,di 21 | add di,tail 22 | %endmacro 23 | 24 | fPrepare_load_below 25 | fSegments_arena 26 | fPrepare_load_above 27 | 28 | stosw 29 | 30 | tail: 31 | -------------------------------------------------------------------------------- /environment/techniques/i8086/step-5-cgx-copy-to-es.asm: -------------------------------------------------------------------------------- 1 | %define movsw_movsb 0xa4a5 ; movsb = 0xA4 2 | %define movsw_ 0xa5 ; movsw = 0xA5 3 | %define xor_si_si 0xf631 ; xor si,si = 0x31F6 4 | 5 | ; make di point to tail 6 | %macro fDestination_tail 0 7 | xchg ax,di 8 | add di, tail 9 | %endmacro 10 | 11 | %macro fSet_private_code 0 12 | mov word [0x0000], movsw_movsb 13 | mov word [0x0002], xor_si_si 14 | mov byte [0x0004], movsw_ 15 | %endmacro 16 | 17 | fDestination_tail 18 | ; make ds point to private memory 19 | push es 20 | pop ds 21 | fSet_private_code 22 | ; make es point to arena 23 | push cs 24 | pop es 25 | ; ds:si -> es:di 26 | movsw 27 | tail: 28 | 29 | -------------------------------------------------------------------------------- /environment/techniques/i8086/step-1-cgx-attack-loop-stosw.asm: -------------------------------------------------------------------------------- 1 | %define wBombing_value 0xcccc 2 | 3 | ; arena:di point to tail of survivor 4 | ; USE AX survivor_location 5 | ; USE DI survivor_tail_location 6 | %macro fSet_di_tail 0 7 | mov di,ax 8 | add di,tail 9 | %endmacro 10 | 11 | ; es point to arena 12 | ; USE DS arena 13 | ; USE ES arena 14 | %macro fSet_es_arena 0 15 | push ds 16 | pop es 17 | %endmacro 18 | 19 | ; bombing arena 20 | ; IN WORD wBombing_value 21 | %macro fBegin_bombing_arena 1 22 | mov ax, %1 23 | bombing_loop: 24 | rep stosw ; ax -> es:di & di += 2 25 | loop bombing_loop 26 | %endmacro 27 | 28 | 29 | fSet_di_tail 30 | fSet_es_arena 31 | fBegin_bombing_arena wBombing_value 32 | 33 | tail: -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/contrib/VSrules/nasm.README: -------------------------------------------------------------------------------- 1 | Visual Studio 2008 NASM integration 2 | 3 | 4 | In order to use nasm seamlessly in your VS2k8, follow the steps below. 5 | 6 | 1. First install nasm by running its installer 7 | 2. copy nasm.rules to c:\Program Files\Microsoft Visual Studio 2008\VC\VCProjectDefaults 8 | 3. Start Visual Studio 2008 9 | 4. go to Tools->Options->VC++ Directories 10 | 5. click on Show Directories for Executables 11 | 6. add C:\Program Files\NASM to the list of paths 12 | 7. Open a solution that you want to use NASM with 13 | 8. Right click on the project name and select Custom Build Rules 14 | 9. Check the box next to the NASM line 15 | 10. Add any .asm files to the project 16 | 11. click on build to test 17 | -------------------------------------------------------------------------------- /environment/cgx_i8086_run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | function welcome(){ 5 | base64 "$CGX_RESEARCH_HOME/misc/logo$(( ( RANDOM % $(ls $CGX_RESEARCH_HOME/misc/ | grep logo | wc -l) ) ))" --decode 6 | echo "** CGX Linux Environment **" 7 | if [ -z $CGX_RESEARCH_ENABLE ] ; then 8 | echo "error: \$CGX_RESEARCH_ENABLE is not set" 9 | exit 1 10 | fi 11 | 12 | } 13 | 14 | function cgx_run(){ 15 | echo "[*] Run i8086 CGX..." 16 | cd $CGX_RESEARCH_CGX 17 | $CGX_RESEARCH_JDK/bin/java -cp "lib/corewars8086-$CGX_RESEARCH_CGX_VERSION.jar:lib/commons-math3-3.4.1.jar" il.co.codeguru.corewars8086.CoreWarsEngine 18 | cd - 19 | } 20 | function main(){ 21 | welcome 22 | cgx_run 23 | } 24 | 25 | main 26 | echo "[*] Done!" 27 | -------------------------------------------------------------------------------- /environment/cgx_i8086_debug.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | function welcome(){ 5 | base64 "$CGX_RESEARCH_HOME/misc/logo$(( ( RANDOM % $(ls $CGX_RESEARCH_HOME/misc/ | grep logo | wc -l) ) ))" --decode 6 | echo "** CGX Linux Environment **" 7 | if [ -z $CGX_RESEARCH_ENABLE ] ; then 8 | echo "error: \$CGX_RESEARCH_ENABLE is not set" 9 | exit 1 10 | fi 11 | 12 | } 13 | 14 | function cgx_debug(){ 15 | echo "[*] Debug i8086 CGX..." 16 | cd $CGX_RESEARCH_CGX 17 | $CGX_RESEARCH_JDK/bin/java -cp "lib/cgx_debugger_$CGX_RESEARCH_CGX_DEBUGGER_VERSION.jar:lib/commons-math3-3.4.1.jar" il.co.codeguru.corewars8086.CoreWarsEngine 18 | cd - 19 | } 20 | function main(){ 21 | welcome 22 | cgx_debug 23 | } 24 | 25 | main 26 | echo "[*] Done!" 27 | -------------------------------------------------------------------------------- /environment/techniques/i8086/step-2-cgx-traps.asm: -------------------------------------------------------------------------------- 1 | %define wTrap_above_distance -128 2 | %define wTrap_below_distance 404 3 | 4 | ; set traps with uniuqe value 5 | ; IN WORD wTrap_above_distance 6 | ; IN WORD wTrap_below_distance 7 | ; USE BX survivor_location 8 | ; USE AX uniuqe_value 9 | %macro fTraps_set 2 10 | mov bx,ax 11 | mov [bx+%1], ax 12 | mov [bx+%2], ax 13 | %endmacro 14 | 15 | ; [bx+@param1] == [bx+@param2] ? continue : break 16 | ; IN WORD wTrap_above_distance 17 | ; IN WORD wTrap_below_distance 18 | ; USE BX survivor_location 19 | ; USE BP [wTrap_above_distance] 20 | %macro fTraps_check 2 21 | traps_check: 22 | mov bp, [bx+%1] 23 | cmp bp, [bx+%2] 24 | je traps_check 25 | %endmacro 26 | 27 | fTraps_set wTrap_above_distance, wTrap_below_distance 28 | 29 | fTraps_check wTrap_above_distance, wTrap_below_distance 30 | 31 | tail: 32 | 33 | -------------------------------------------------------------------------------- /configure.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | function welcome(){ 5 | base64 "misc/logo$(( ( RANDOM % $(ls misc/ | grep logo | wc -l) ) ))" --decode 6 | export CGX_RESEARCH_ENABLE="1" 7 | if [ -z "$1" ]; then 8 | echo "****" 9 | echo "usage: source configure project_path" 10 | echo "****" 11 | export CGX_RESEARCH_ENABLE="0" 12 | fi 13 | } 14 | 15 | function configure(){ 16 | export CGX_RESEARCH_ENABLE="1" 17 | export CGX_RESEARCH_CGX_VERSION="4.0.2" 18 | export CGX_RESEARCH_CGX_DEBUGGER_VERSION="v5" 19 | export CGX_RESEARCH_JDK_VERSION="jdk1.8.0_191" 20 | export CGX_RESEARCH_NASM_VERSION="2.13" 21 | 22 | export CGX_RESEARCH_HOME=$(readlink -f $1) 23 | export CGX_RESEARCH_ENV=$CGX_RESEARCH_HOME/environment 24 | export CGX_RESEARCH_JDK=$CGX_RESEARCH_HOME/jdk1.8.0_191 25 | export CGX_RESEARCH_CGX=$CGX_RESEARCH_HOME/cgx_engine_$CGX_RESEARCH_CGX_VERSION 26 | } 27 | 28 | function main(){ 29 | welcome $1 30 | configure $1 31 | } 32 | 33 | main $1 34 | echo "Done!" 35 | -------------------------------------------------------------------------------- /misc/logo0: -------------------------------------------------------------------------------- 1 | IF9fX19fIF9fX19fIF9fICAgX18gIF9fX19fICAgICAgICAgICAKLyAgX18gXCAgX18gXFwgXCAv 2 | IC8gfCAgX19ffCAgICAgICAgICAKfCAvICBcLyB8ICBcLyBcIFYgLyAgfCB8X18gXyBfX19fICAg 3 | X18KfCB8ICAgfCB8IF9fICAvICAgXCAgfCAgX198ICdfIFwgXCAvIC8KfCBcX18vXCB8X1wgXC8g 4 | L15cIFwgfCB8X198IHwgfCBcIFYgLyAKIFxfX19fL1xfX19fL1wvICAgXC8gXF9fX18vX3wgfF98 5 | XF8vICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAg 6 | ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg 7 | ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICBfbm5ubl8KICAgICAgICBkR0dHR01N 8 | YgogICAgICAgQHB+cXB+fnFNYgogICAgICAgTXxAfHxAKSBNfAogICAgICAgQCwtLS0tLkpNfAog 9 | ICAgICBKU15cX18vICBxS0wKICAgICBkWlAgICAgICAgIHFLUmIKICAgIGRaUCAgICAgICAgICBx 10 | S0tiCiAgIGZaUCAgICAgICAgICAgIFNNTWIKICAgSFpNICAgICAgICAgICAgTU1NTQogICBGcU0g 11 | ICAgICAgICAgICBNTU1NCiBfX3wgIi4gICAgICAgIHxcZFMicU1MCiB8ICAgIGAuICAgICAgIHwg 12 | YCcgXFpxCl8pICAgICAgXC5fX18uLHwgICAgIC4nClxfX19fICAgKU1NTU1NUHwgICAuJwogICAg 13 | IGAtJyAgICAgICBgLS0nIGhqbQo= 14 | -------------------------------------------------------------------------------- /environment/techniques/i8086/step-6-cgx-copy.asm: -------------------------------------------------------------------------------- 1 | %define wSize_survivor (tail - $$) 2 | %define wSize_clone (tail - hClone + 1) 3 | 4 | %define wClone_number_of_words (wSize_clone / 2) 5 | 6 | %define wEscape_distance 1000 7 | 8 | 9 | ; flip ds_es 10 | %macro fFlip_ds_es 0 11 | push ds 12 | push es 13 | pop ds 14 | pop es 15 | %endmacro 16 | 17 | ; access clone words 18 | ; IN WORD wClone_number_of_words 19 | ; USE CX clone_words 20 | ; USE AX clone_arena_addres 21 | %macro fClone_access 1 22 | mov cx, %1 23 | rep movsw ; ds:si -> es:di 24 | %endmacro 25 | 26 | set_hClone: ; store hClone bytes in private memory 27 | xchg si,ax 28 | add si, hClone 29 | push si 30 | fClone_access wClone_number_of_words ; arena:hClone -> private_memory:0x0000 31 | pop di 32 | mov dx, wEscape_distance 33 | fFlip_ds_es ; ds -> private_memory & es -> arena 34 | hClone: 35 | add di,dx 36 | mov bx,di 37 | xor si,si 38 | fClone_access wClone_number_of_words ; private_memory:0x0000 -> arena:new_hClone 39 | jmp bx ; bx -> hClone 40 | tail: -------------------------------------------------------------------------------- /environment/cgx_riscv_build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | function welcome(){ 5 | base64 "$CGX_RESEARCH_HOME/misc/logo$(( ( RANDOM % $(ls $CGX_RESEARCH_HOME/misc/ | grep logo | wc -l) ) ))" --decode 6 | echo "** CGX Linux Environment **" 7 | if [ -z $CGX_RESEARCH_ENABLE ] ; then 8 | echo "error: \$CGX_RESEARCH_ENABLE is not set" 9 | exit 1 10 | fi 11 | 12 | if [ -z "$1" ]; then 13 | echo "usage: ./cgx_riscv_build.sh file_path" 14 | exit 1 15 | fi 16 | 17 | } 18 | 19 | function build(){ 20 | echo "[*] Building riscv survivor $1..." 21 | survivor_name=$(basename $1 .asm) 22 | echo $survivor_name 23 | /opt/riscv/bin/riscv32-unknown-linux-gnu-as $1 -o $2 24 | /opt/riscv/bin/riscv32-unknown-linux-gnu-objcopy -O binary $2 $survivor_name 25 | /opt/riscv/bin/riscv32-unknown-linux-gnu-objdump -D -b binary -mriscv $survivor_name 26 | echo "[*] Built $survivor_name..." 27 | } 28 | function main(){ 29 | welcome $1 30 | tmp_file="/tmp/.cgx_tmp_elf_$(date +%Y-%m-%d_%H:%M)" 31 | build $1 $tmp_file 32 | } 33 | 34 | main $1 35 | echo "[*] Done!" 36 | -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/README: -------------------------------------------------------------------------------- 1 | NASM, the Netwide Assembler. 2 | 3 | Many many developers all over the net respect NASM for what it is 4 | - a widespread (thus netwide), portable (thus netwide!), very 5 | flexible and mature assembler tool with support for many output 6 | formats (thus netwide!!). 7 | 8 | Now we have good news for you: NASM is licensed under the "simplified" 9 | (2-clause) BSD license. This means its development is open to even 10 | wider society of programmers wishing to improve their lovely 11 | assembler. 12 | 13 | The NASM project is now situated at SourceForge.net, the most 14 | popular Open Source development site on the Internet. 15 | 16 | Visit our website at http://nasm.sourceforge.net/ and our 17 | SourceForge project at http://sourceforge.net/projects/nasm/ 18 | 19 | See the file CHANGES for the description of changes between revisions, 20 | and the file AUTHORS for a list of contributors. 21 | 22 | With best regards, 23 | NASM crew. 24 | -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/LICENSE: -------------------------------------------------------------------------------- 1 | NASM is now licensed under the 2-clause BSD license, also known as the 2 | simplified BSD license. 3 | 4 | Copyright 1996-2010 the NASM Authors - All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following 8 | conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following 14 | disclaimer in the documentation and/or other materials provided 15 | with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 18 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 19 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /environment/other_platforms/mac/nasm_mac/LICENSE: -------------------------------------------------------------------------------- 1 | NASM is now licensed under the 2-clause BSD license, also known as the 2 | simplified BSD license. 3 | 4 | Copyright 1996-2010 the NASM Authors - All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following 8 | conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following 14 | disclaimer in the documentation and/or other materials provided 15 | with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 18 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 19 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /environment/other_platforms/win/course-asm-to-opcode.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | echo ----------------------------- 3 | echo ~~Script by Tomer Eyzenberg~~ 4 | echo ----------------------------- 5 | echo ----------------------------- 6 | echo ~~Assembly to Opcode~~ 7 | echo ----------------------------- 8 | SET /p home_path=Enter cgx root path ( if you don't know what to do just type ./): 9 | if %home_path%==./ ( 10 | set home_folder=%cd% 11 | ) else ( set home_folder=%home_path%) 12 | echo {cgx_root_path} = %home_folder% 13 | chdir %home_folder% 14 | :begin 15 | set nasm_folder=%cd%\nasm 16 | chdir /d %nasm_folder% 17 | set temp_file=%cd%\assembly_temp.asm 18 | 19 | :help 20 | echo ----------------------------- 21 | echo ~~Help~~ 22 | echo ----------------------------- 23 | echo This script can help you disassemble assembly instruction's 24 | echo and view their opcode's interactively. 25 | echo ----------------------------- 26 | echo ~~Assembly to Opcode~~ 27 | echo ----------------------------- 28 | :assembly-opcode 29 | echo Enter assembly lines 30 | echo Press Enter twice when finished 31 | echo (may not contain ^<, ^>, ^|, ^&, or un-closed quotes) 32 | set new_line="" 33 | break > %temp_file% 34 | :still_typing 35 | set /p new_line=">" 36 | if errorlevel 1 echo. >> %temp_file% & set /p new_line=">" 37 | if errorlevel 1 echo ----------------------------- & goto done_typing 38 | echo %new_line% >> %temp_file% 39 | goto still_typing 40 | 41 | :done_typing 42 | nasm.exe %temp_file% 43 | SET temp_com=%temp_file:~0,-4% 44 | start "code" /B /D %nasm_folder% "ndisasm.exe" %temp_com% 45 | timeout /t 1 >nul 46 | del %temp_file% 47 | del %temp_com% 48 | echo ----------------------------- 49 | goto assembly-opcode 50 | 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # codeguru-extreme 2 | 3 | CodeGuru Extreme Environment 4 | 5 | ## About CodeGuru 6 | ``` 7 | We're looking for the best people to lead us all! 8 | If computers speak your language, 9 | smart and original coding is your uniqueness - we're looking for you. 10 | ``` 11 | 12 | ## About CoreWars 13 | ``` 14 | Core War is a programming competition in which two or more programs 15 | compete for control of a virtual computer. 16 | These programs are written in i8086 or risc-v. 17 | ``` 18 | ## Architectures 19 | 20 | ### Intel 8086 21 | 22 | http://dsearls.org/courses/C391OrgSys/IntelAL/8086_instruction_set.html 23 | 24 | ### Risc-V 25 | 26 | https://en.wikichip.org/wiki/risc-v/registers 27 | 28 | https://riscv.org/specifications 29 | 30 | https://github.com/riscv 31 | 32 | ### Getting Started 33 | 34 | These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. 35 | 36 | ### Prerequisites 37 | ``` 38 | Ubuntu (See other_environments for Windows & Mac versions codeguru-extreme/environment/other_platforms) 39 | ``` 40 | 41 | ### Configure 42 | ``` 43 | source configure.sh `pwd` 44 | ``` 45 | 46 | ### Installing 47 | ``` 48 | ./setup.sh 49 | ``` 50 | ### Running scripts 51 | ``` 52 | ./cgx_i8086_debug.sh 53 | ./cgx_i8086_run.sh 54 | 55 | ./cgx_riscv_build.sh 56 | ``` 57 | ### Common Techniques 58 | ``` 59 | codeguru-extreme/environment/techniques/riscv|i8086 60 | ``` 61 | 62 | ### Additional sources 63 | 64 | CGX10 Debugger [YoavKa](https://github.com/YoavKa) 65 | 66 | CoreWars8086 4.0.0 [codeguru-il](https://github.com/codeguru-il) 67 | 68 | corewars-risc-v [erikik8090](https://github.com/erikik8090/corewars-risc-v) 69 | 70 | 71 | -------------------------------------------------------------------------------- /environment/other_platforms/mac/mac-course-script-to-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | function starta { 3 | echo ----------------------------- 4 | echo ~~Script by Tomer Eyzenberg~~ 5 | echo ----------------------------- 6 | nasm_folder="$home_folder"/nasm_mac 7 | survivors_folder="$home_folder"/survivors 8 | work_folder="$home_folder"/work_directory 9 | echo ~~"$work_folder"~~ 10 | echo $(ls "$work_folder" | grep .asm) 11 | echo ----------------------------- 12 | echo ~~Choose survivor~~ 13 | cd "$work_folder" 14 | echo "Enter survivor (with extension .asm)": 15 | read survivor_asm 16 | echo ----------------------------- 17 | echo ~~Copy "$survivor_asm"~~ 18 | echo ""$work_folder"//"$survivor_asm" "$nasm_folder"" 19 | cp "$work_folder"//"$survivor_asm" "$nasm_folder" 20 | echo ~~Assembling "$survivor_asm" 21 | cd "$nasm_folder" 22 | ./nasm "$survivor_asm" 23 | rm "$survivor_asm" 24 | echo ----------------------------- 25 | len=${#survivor_asm} 26 | four=4 27 | l=`expr $len - $four` 28 | zero=0 29 | echo "$l" 30 | survivor_com="${survivor_asm:zero:l}" 31 | echo ~~Disassembling "$survivor_com" 32 | ./ndisasm "$survivor_com" 33 | echo ----------------------------- 34 | echo ~~Copy "$survivor_com"~~ 35 | mv "$nasm_folder/$survivor_com" "$survivors_folder" 36 | echo ----------------------------- 37 | echo ~~Run corewars8086~~ 38 | cd "$home_folder" 39 | sudo java -cp lib/debugger.jar:lib/* il.co.codeguru.corewars8086.CoreWarsEngine 40 | read -rsn1 -p"Press any key to continue";echo 41 | } 42 | echo off 43 | echo ----------------------------- 44 | echo ~~Script by Tomer Eyzenberg~~ 45 | echo ----------------------------- 46 | 47 | echo "Enter cgx root path ( enter ./ for default use current path)" 48 | read a 49 | 50 | # Equality Comparison 51 | if [ "$a" == "./" ]; then 52 | home_folder=$PWD 53 | else 54 | home_folder="$a" 55 | fi 56 | echo "$home_folder" 57 | cd "$home_folder" 58 | while true; do 59 | starta 60 | done 61 | -------------------------------------------------------------------------------- /environment/techniques/i8086/step-7-cgx-traps-copy.asm: -------------------------------------------------------------------------------- 1 | %define wSize_survivor (end_survivor - $$) 2 | %define wSize_clone (end_survivor - hClone + 1) 3 | 4 | %define wClone_words (wSize_clone / 2) 5 | %define wTrap_above_distance -128 6 | %define wTrap_below_distance 404 7 | 8 | %define wEscape_below_distance 706 9 | %define wEscape_above_distance ~wEscape_below_distance 10 | 11 | ; flip ds_es 12 | %macro fFlip_ds_es 0 13 | push ds 14 | push es 15 | pop ds 16 | pop es 17 | %endmacro 18 | 19 | ; set traps with uniuqe value 20 | ; IN WORD wTrap_above_distance 21 | ; IN WORD wTrap_below_distance 22 | ; USE BX survivor_location 23 | ; USE AX uniuqe_value 24 | %macro fTraps_set 2 25 | mov bx,ax 26 | mov [bx+%1], ax 27 | mov [bx+%2], ax 28 | %endmacro 29 | 30 | ; [bx+@param1] == [bx+@param2] ? continue : break 31 | ; IN WORD wTrap_above_distance 32 | ; IN WORD wTrap_below_distance 33 | ; USE BX survivor_location 34 | ; USE BP [wTrap_above_distance] 35 | %macro fTraps_check 2 36 | traps_check: 37 | mov bp, [bx+%1] 38 | cmp bp, [bx+%2] 39 | je traps_check 40 | %endmacro 41 | 42 | ; ax == bp ? escape_distance = wEscape_below_distance : escape_distance = wEscape_above_distance 43 | ; IN WORD wEscape_above_distance 44 | ; IN WORD wEscape_below_distance 45 | ; USE DX escape_distance 46 | ; USE AX uniuqe_value 47 | ; USE BP [wTrap_above_distance] 48 | %macro fTraps_activate 2 49 | mov dx, %1 50 | cmp bp, ax 51 | je trap_below_activate 52 | trap_above_activate: mov dx, %2 53 | trap_below_activate: 54 | %endmacro 55 | 56 | ; access clone words 57 | ; IN WORD wClone_words 58 | ; USE CX clone_words 59 | ; USE AX clone_arena_address 60 | %macro fClone_access 1 61 | mov cx, %1 62 | rep movsw 63 | %endmacro 64 | 65 | 66 | set_hClone: ; store hClone bytes in private memory 67 | mov si,ax 68 | add si, hClone 69 | xor di,di 70 | fClone_access wClone_words ; arena:hClone -> private_memory:0x0000 71 | add ax, hClone 72 | 73 | hClone: 74 | fTraps_set wTrap_above_distance, wTrap_below_distance 75 | 76 | fTraps_check wTrap_above_distance, wTrap_below_distance 77 | 78 | fTraps_activate wTrap_above_distance, wEscape_below_distance 79 | 80 | fFlip_ds_es ; ds->private_memory & es->arena 81 | 82 | get_hClone: 83 | add bx, dx 84 | mov di,bx 85 | 86 | xor si,si 87 | fClone_access wClone_words ; private_memory:0x0000 -> arena:new_hClone 88 | 89 | fFlip_ds_es ; ds->arena & es->private_memory 90 | mov ax,bx 91 | jmp bx ; bx -> hClone 92 | end_survivor: -------------------------------------------------------------------------------- /environment/other_platforms/win/nasm/contrib/VSrules/nasm.rules: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 25 | 34 | 43 | 51 | 60 | 67 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /environment/other_platforms/win/course-script-to-run.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | setlocal ENABLEDELAYEDEXPANSION 3 | echo ----------------------------- 4 | echo ~~Script by Tomer Eyzenberg, modified by Alexey Shapovalov~~ 5 | echo ----------------------------- 6 | echo ~~script-to-run-~~ 7 | echo ----------------------------- 8 | 9 | SET /p home_path=Enter cgx root path ( if you don't know what to do just type ./): 10 | 11 | if %home_path%==./ ( 12 | set home_folder=%cd% 13 | ) else ( set home_folder=%home_path%) 14 | echo {cgx_root_path} = %home_folder% 15 | chdir %home_folder% 16 | 17 | :help 18 | echo ----------------------------- 19 | echo ~~Help~~ 20 | echo This script assumes work_directory is used to store survivors .asm files. 21 | echo It provides a way to automate the proccess: assemble->copy->run 22 | echo It processes a .asm files stored in {cgx_root_path}/work_directory 23 | echo ----------------------------- 24 | 25 | :begin 26 | set nasm_folder=%cd%\nasm 27 | set survivors_folder=%cd%\survivors 28 | set work_folder=%cd%\work_directory 29 | 30 | echo ~~Searching for .asm files in '%work_folder%'~~ 31 | 32 | chdir /d %work_folder% 33 | 34 | for /r %%g in (*.asm) do ( 35 | SET temp=%%g 36 | SET temp=!temp:%cd%=! 37 | echo !temp:~1! 38 | ) 39 | 40 | echo ----------------------------- 41 | 42 | echo ~~Choose survivor~~ 43 | SET /p survivor=Enter survivor name (without '.asm' or numerical extention): 44 | SET survivor=%survivor:/=\% 45 | 46 | for /f "delims=\" %%a in ("%survivor%") do ( 47 | set survivor_file=%%a 48 | ) 49 | 50 | echo ----------------------------- 51 | 52 | choice /C YN /M "Compile 2 survivors?" 53 | SET isSingle=%ERRORLEVEL% 54 | if %isSingle% EQU 2 goto singleAssembly 55 | 56 | echo ~~Copy %survivor%1.asm and %survivor%2.asm~~ 57 | xcopy /s /y "%work_folder%\%survivor%1.asm" "%nasm_folder%" 58 | xcopy /s /y "%work_folder%\%survivor%2.asm" "%nasm_folder%" 59 | 60 | echo ~~Assembling %survivor%1.asm and %survivor%2.asm~~ 61 | chdir /d %nasm_folder% 62 | nasm.exe %survivor_file%1.asm 63 | nasm.exe %survivor_file%2.asm 64 | del %survivor_file%1.asm 65 | del %survivor_file%2.asm 66 | 67 | goto endAssembly 68 | :singleAssembly 69 | 70 | echo ~~Copy %survivor%.asm~~ 71 | xcopy /s /y "%work_folder%\%survivor%.asm" "%nasm_folder%" 72 | 73 | echo ~~Assembling %survivor%.asm~~ 74 | chdir /d %nasm_folder% 75 | nasm.exe %survivor_file%.asm 76 | del %survivor_file%.asm 77 | 78 | :endAssembly 79 | echo ----------------------------- 80 | 81 | if %isSingle% EQU 2 goto singleDisassembly 82 | 83 | echo ~~Disassembling %survivor%1~~ 84 | start "code" /B /D %nasm_folder% "ndisasm.exe" %survivor_file%1 85 | timeout /t 1 >nul 86 | echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 87 | echo ~~Disassembling %survivor%2~~ 88 | start "code" /B /D %nasm_folder% "ndisasm.exe" %survivor_file%2 89 | timeout /t 1 >nul 90 | 91 | goto endDisassembly 92 | :singleDisassembly 93 | 94 | echo ~~Disassembling %survivor%~~ 95 | start "code" /B /D %nasm_folder% "ndisasm.exe" %survivor_file% 96 | timeout /t 1 >nul 97 | 98 | :endDisassembly 99 | echo ----------------------------- 100 | 101 | if %isSingle% EQU 2 goto singleCopy 102 | 103 | echo ~~Move %survivor%1 and %survivor%2~~ 104 | move /y "%nasm_folder%\%survivor_file%1" "%survivors_folder%" 105 | move /y "%nasm_folder%\%survivor_file%2" "%survivors_folder%" 106 | goto endCopy 107 | :singleCopy 108 | echo ~~Move %survivor%~~ 109 | move /y "%nasm_folder%\%survivor_file%" "%survivors_folder%" 110 | :endCopy 111 | 112 | echo ----------------------------- 113 | chdir /d %home_folder% 114 | 115 | choice /C YN /M "Run arena?" 116 | if ERRORLEVEL 2 goto begin 117 | 118 | echo ~~Run corewars8086~~ 119 | java -cp lib\debugger.jar;lib\* il.co.codeguru.corewars8086.CoreWarsEngine 120 | 121 | pause 122 | goto begin 123 | 124 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | function welcome(){ 5 | echo "** CGX Linux Environment **" 6 | if [ -z $CGX_RESEARCH_ENABLE ] ; then 7 | echo "error: \$CGX_RESEARCH_ENABLE is not set" 8 | exit 1 9 | fi 10 | base64 "$CGX_RESEARCH_HOME/misc/logo$(( ( RANDOM % $(ls $CGX_RESEARCH_HOME/misc/ | grep logo | wc -l) ) ))" --decode 11 | 12 | } 13 | 14 | function download_survivors_i8086(){ 15 | echo "[*] Donwloading CGX survirors..." 16 | git clone https://github.com/codeguru-il/corewars8086-survivors.git 17 | } 18 | 19 | function download_cgx_i8086_debugger(){ 20 | echo "[*] Donwloading CGX debugger..." 21 | wget --no-cookies \ 22 | --no-check-certificate \ 23 | https://github.com/YoavKa/corewars8086/releases/download/$CGX_RESEARCH_CGX_DEBUGGER_VERSION/debugger.jar \ 24 | -O cgx_debugger_$CGX_RESEARCH_CGX_DEBUGGER_VERSION.jar --append-output $1 25 | mv cgx_debugger_$CGX_RESEARCH_CGX_DEBUGGER_VERSION.jar cgx_engine_$CGX_RESEARCH_CGX_VERSION/lib/ 26 | } 27 | 28 | function download_cgx_i8086(){ 29 | echo "[*] Donwloading CGX..." 30 | wget --no-cookies \ 31 | --no-check-certificate \ 32 | https://github.com/codeguru-il/corewars8086/releases/download/corewars8086-$CGX_RESEARCH_CGX_VERSION/corewars8086-$CGX_RESEARCH_CGX_VERSION.zip \ 33 | -O cgx_$CGX_RESEARCH_CGX_VERSION.zip --append-output $1 34 | unzip -qq cgx_$CGX_RESEARCH_CGX_VERSION.zip 35 | rm cgx_$CGX_RESEARCH_CGX_VERSION.zip 36 | mv corewars8086-$CGX_RESEARCH_CGX_VERSION cgx_engine_$CGX_RESEARCH_CGX_VERSION 37 | } 38 | 39 | function download_jdk(){ 40 | echo "[*] Donwloading JDK..." 41 | wget --no-cookies \ 42 | --no-check-certificate \ 43 | --header "Cookie: oraclelicense=accept-securebackup-cookie" \ 44 | http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz \ 45 | -O jdk-8u191-linux-x64.tar.gz --append-output $1 46 | 47 | tar -xf jdk-8u191-linux-x64.tar.gz 48 | rm jdk-8u191-linux-x64.tar.gz 49 | } 50 | 51 | function set_symbolic_link(){ 52 | echo "[*] Symbolic link for survivros/zombies..." 53 | rm -r $CGX_RESEARCH_CGX/survivors 54 | rm -r $CGX_RESEARCH_CGX/zombies 55 | 56 | ln -s $CGX_RESEARCH_ENV/survivors $CGX_RESEARCH_CGX/survivors 57 | ln -s $CGX_RESEARCH_ENV/zombies $CGX_RESEARCH_CGX/zombies 58 | 59 | } 60 | 61 | function download_nasm(){ 62 | echo "[*] Installing nasm..." 63 | rm -r nasm_dir 64 | mkdir nasm_dir 65 | cd nasm_dir 66 | wget https://www.nasm.us/pub/nasm/releasebuilds/$CGX_RESEARCH_NASM_VERSION/nasm-$CGX_RESEARCH_NASM_VERSION.zip -O nasm-$CGX_RESEARCH_NASM_VERSION.zip --append-output $1 67 | unzip -qq nasm-$CGX_RESEARCH_NASM_VERSION.zip 68 | sed -i 's/\r//' configure 69 | ./configure 70 | make 71 | mv nasm ../environment 72 | mv ndisasm ../environment 73 | cd ../ 74 | rm -r nasm_dir 75 | 76 | } 77 | 78 | function download_ant(){ 79 | echo "[*] Downloading ant..." 80 | apt-get install ant 81 | } 82 | 83 | function download_depend_riscv_toolchain(){ 84 | echo "[*] Downloading dependancies for risc-v toolchain" 85 | sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev 86 | } 87 | 88 | function download_riscv_toolchain(){ 89 | echo "[*] Downloading risc-v toolchain..." 90 | git clone https://github.com/riscv/riscv-gnu-toolchain 91 | cd riscv-gnu-toolchain 92 | git submodule update --init --recursive 93 | } 94 | 95 | function build_riscv_toolchain(){ 96 | echo "[*] Build risc-v toolchain..." 97 | ./configure --prefix=/opt/riscv 98 | make linux 99 | } 100 | 101 | function download_cgx_riscv(){ 102 | echo "[*] Downloading risc-v cgx" 103 | git clone https://github.com/erikik8090/corewars-risc-v 104 | cd corewars-risc-v 105 | git checkout --track origin/feature/rv32c 106 | cd - 107 | } 108 | 109 | function start_cgx_riscv(){ 110 | echo "[*] Start risc-v cgx..." 111 | cd corewars-risc-v 112 | ant bootstrap 113 | ant devmode 114 | cd - 115 | } 116 | 117 | function download_build_i8086(){ 118 | echo "[*] Donwloading setup for cgx i8086..." 119 | download_jdk $1 120 | download_cgx_i8086 $1 121 | download_cgx_i8086_debugger $1 122 | download_i8086_survivors 123 | set_symbolic_link 124 | download_nasm $1 125 | } 126 | 127 | function download_build_riscv(){ 128 | echo "[*] Donwloading setup for cgx risc-v..." 129 | download_ant $1 130 | download_depend_riscv_toolchain $1 131 | download_riscv_toolchain $1 132 | build_riscv_toolchain $1 133 | } 134 | 135 | 136 | function main(){ 137 | welcome 138 | log_file=".setup_log_$(date +%Y-%m-%d_%H:%M)" 139 | download_build_i8086 $log_file 140 | download_build_riscv $log_file 141 | start_cgx_riscv 142 | } 143 | 144 | main 145 | echo "[*] Done!" 146 | -------------------------------------------------------------------------------- /environment/other_platforms/win/course-tron-arena.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | echo ----------------------------- 3 | echo ~~Script by Tomer Eyzenberg~~ 4 | echo ----------------------------- 5 | echo ----------------------------- 6 | echo ~~tron-arena~~ 7 | echo ----------------------------- 8 | SET /p home_path=Enter cgx root path ( if you don't know what to do just type ./): 9 | if %home_path%==./ ( 10 | set home_folder=%cd% 11 | ) else ( set home_folder=%home_path%) 12 | 13 | echo {cgx_root_path} = %home_folder% 14 | chdir %home_folder% 15 | 16 | echo "`-._,-'"`-._,-'"`-._,-'"`-._,-'"`-._,-'"`-._,-'"`-._,-'"`-._,-' 17 | echo The Grid. A digital frontier. 18 | echo I tried to picture clusters of information as they moved through the computer. 19 | echo What did they look like? Ships? Motorcycles? Were the circuits like freeways? 20 | echo I kept dreaming of a world I thought I'd never see. And then one day . . . 21 | echo "`-._,-'"`-._,-'"`-._,-'"`-._,-'"`-._,-'"`-._,-'"`-._,-'"`-._,-' 22 | 23 | echo ----------------------------- 24 | echo ~~Script by Tomer Eyzenberg~~ 25 | echo ----------------------------- 26 | 27 | set temp_directory=tempo 28 | mkdir %temp_directory% 2>NUL 29 | ::echo ----------------------------- 30 | ::echo ~~Moving survivors to %cd%\%temp_directory%~~ 31 | ::echo ----------------------------- 32 | ::move "%cd%\survivors\*." "%cd%\%temp_directory%" 2>NUL 33 | :begin 34 | echo ----------------------------- 35 | echo ~~Enter an option (number)~~ 36 | echo ----------------------------- 37 | echo 0)Help 38 | echo 1)Run Tron 39 | echo 2)Run Script-To-Run once 40 | echo 3)Run Script-To-Run loop 41 | echo + 42 | 43 | set /p input=Enter option: 44 | if %input%==0 ( 45 | goto help 46 | ) 47 | if %input%==1 ( 48 | goto tron-legacy 49 | ) 50 | if %input%==2 ( 51 | goto run-once 52 | ) 53 | if %input%==3 ( 54 | goto run-loop 55 | ) 56 | echo ----------------------------- 57 | echo ~~Bad Input~~ 58 | echo ----------------------------- 59 | goto begin 60 | 61 | :help 62 | echo ----------------------------- 63 | echo ~~Help~~ 64 | echo ----------------------------- 65 | echo Run Tron provides a cli way for development process, 66 | echo assumes work_directory is used to store survivors .asm 67 | echo files. This script provides automated ways 68 | echo to assemble->copy->run flows as add/remove/list files from 69 | echo /survivors directory and /work_directory. 70 | echo + 71 | echo Run Script-To-Run once/loop help 72 | echo Assumes work_directory is used to store survivors .asm files. 73 | echo This script provides a way to automate assemble->copy->run 74 | echo proccess a .asm files stored in {cgx_root_path}/work_directory 75 | goto begin 76 | 77 | :run-once 78 | echo ----------------------------- 79 | echo ~~run-once~~ 80 | echo ----------------------------- 81 | set home_folder=%cd% 82 | set nasm_folder=%cd%\nasm 83 | set survivors_folder=%cd%\survivors 84 | set work_folder=%cd%\work_directory 85 | echo ~~%work_folder%~~ 86 | dir /OD /b %work_folder%\*.asm 87 | echo ----------------------------- 88 | echo ~~Choose survivor~~ 89 | chdir /d %work_folder% 90 | SET /p survivor_asm=Enter survivor ( with extension .asm ): 91 | echo ----------------------------- 92 | echo ~~Copy %survivor_asm%~~ 93 | xcopy /s /y "%work_folder%\%survivor_asm%" "%nasm_folder%" 94 | echo ~~Assembling %survivor_asm%~~ 95 | chdir /d %nasm_folder% 96 | nasm.exe %survivor_asm% 97 | del %survivor_asm% 98 | echo ----------------------------- 99 | SET survivor_com=%survivor_asm:~0,-4% 100 | echo ~~Disassembling %survivor_com%~~ 101 | start "code" /B /D %nasm_folder% "ndisasm.exe" %survivor_com% 102 | timeout /t 1 >nul 103 | echo ----------------------------- 104 | echo ~~Copy %survivor_com%~~ 105 | move /y "%nasm_folder%\%survivor_com%" "%survivors_folder%" 106 | echo ----------------------------- 107 | echo ~~Run corewars8086~~ 108 | chdir /d %home_folder% 109 | java -cp lib\debugger.jar;lib\* il.co.codeguru.corewars8086.CoreWarsEngine 110 | goto begin 111 | 112 | 113 | 114 | :run-loop 115 | echo ----------------------------- 116 | echo ~~run-loop~~ 117 | echo ----------------------------- 118 | set home_folder=%cd% 119 | set nasm_folder=%cd%\nasm 120 | set survivors_folder=%cd%\survivors 121 | set work_folder=%cd%\work_directory 122 | echo ~~%work_folder%~~ 123 | dir /OD /b %work_folder%\*.asm 124 | echo ----------------------------- 125 | echo ~~Choose survivor~~ 126 | chdir /d %work_folder% 127 | SET /p survivor_asm=Enter survivor ( with extension .asm ): 128 | echo ----------------------------- 129 | echo ~~Copy %survivor_asm%~~ 130 | xcopy /s /y "%work_folder%\%survivor_asm%" "%nasm_folder%" 131 | echo ~~Assembling %survivor_asm%~~ 132 | chdir /d %nasm_folder% 133 | nasm.exe %survivor_asm% 134 | del %survivor_asm% 135 | echo ----------------------------- 136 | SET survivor_com=%survivor_asm:~0,-4% 137 | echo ~~Disassembling %survivor_com%~~ 138 | start "code" /B /D %nasm_folder% "ndisasm.exe" %survivor_com% 139 | timeout /t 1 >nul 140 | echo ----------------------------- 141 | echo ~~Copy %survivor_com%~~ 142 | move /y "%nasm_folder%\%survivor_com%" "%survivors_folder%" 143 | echo ----------------------------- 144 | echo ~~Run corewars8086~~ 145 | chdir /d %home_folder% 146 | java -cp lib\debugger.jar;lib\* il.co.codeguru.corewars8086.CoreWarsEngine 147 | goto run-loop 148 | 149 | :tron-legacy 150 | echo ----------------------------- 151 | echo ~~tron-legacy~~ 152 | echo ----------------------------- 153 | :tron-legacy-config 154 | echo ----------------------------- 155 | echo ~~Enter an option~~ 156 | echo ----------------------------- 157 | echo 0)Help 158 | echo 1)Add survivor 159 | echo 2)Add survivor-asm (.asm) 160 | echo 3)Del survivor 161 | echo 4)Run debugger 162 | echo 5)Run silent 163 | echo 6)Show /survivors 164 | echo 7)Show /work_directory 165 | set /p input-config=Enter an option: 166 | if %input-config%==0 ( 167 | goto help-tron 168 | ) 169 | if %input-config%==1 ( 170 | goto add-survivor 171 | ) 172 | if %input-config%==2 ( 173 | goto add-survivor-asm 174 | ) 175 | if %input-config%==3 ( 176 | goto del-survivor 177 | ) 178 | if %input-config%==4 ( 179 | goto run-debugger 180 | ) 181 | if %input-config%==5 ( 182 | goto run-silent 183 | ) 184 | if %input-config%==6 ( 185 | goto show-survivors 186 | ) 187 | if %input-config%==7 ( 188 | goto show-work-directory 189 | ) 190 | echo ~~Bad Input~~ 191 | echo ----------------------------- 192 | goto tron-legacy-config 193 | 194 | :help-tron 195 | echo ----------------------------- 196 | echo ~~Help~~ 197 | echo ----------------------------- 198 | echo This script can help you automate development 199 | echo process and assumes work_directory is used to store 200 | echo survivors .asm files. This script provides automated ways 201 | echo to assemble->copy->run flows as add/remove/list files from 202 | echo /survivors directory and /work_directory. 203 | goto tron-legacy-config 204 | 205 | :add-survivor 206 | echo ----------------------------- 207 | echo ~~tron-legacy-add-survivor~~ 208 | echo ----------------------------- 209 | set nasm_folder=%cd%\nasm 210 | set survivors_folder=%cd%\survivors 211 | set work_folder=%cd%\work_directory 212 | echo ~~%work_folder%~~ 213 | dir /OD /b %work_folder%\*. 214 | echo ----------------------------- 215 | echo ~~Choose survivor~~ 216 | chdir /d %work_folder% 217 | SET /p survivor_com=Enter survivor: 218 | echo ~~Copy %survivor_com%~~ 219 | copy /y "%work_folder%\%survivor_com%" "%survivors_folder%" 220 | chdir /d %home_folder% 221 | goto tron-legacy-config 222 | :add-survivor-asm 223 | echo ----------------------------- 224 | echo ~~tron-legacy-add-survivor-asm~~ 225 | echo ----------------------------- 226 | set nasm_folder=%cd%\nasm 227 | set survivors_folder=%cd%\survivors 228 | set work_folder=%cd%\work_directory 229 | echo ~~%work_folder%~~ 230 | dir /OD /b %work_folder%\*.asm 231 | echo ----------------------------- 232 | echo ~~Choose survivor~~ 233 | chdir /d %work_folder% 234 | SET /p survivor_asm=Enter survivor ( with extension .asm ): 235 | echo ----------------------------- 236 | echo ~~Copy %survivor_asm%~~ 237 | xcopy /s /y "%work_folder%\%survivor_asm%" "%nasm_folder%" 238 | echo ~~Assembling %survivor_asm%~~ 239 | chdir /d %nasm_folder% 240 | nasm.exe %survivor_asm% 241 | del %survivor_asm% 242 | echo ----------------------------- 243 | SET survivor_com=%survivor_asm:~0,-4% 244 | echo ~~Disassembling %survivor_com%~~ 245 | start "code" /B /D %nasm_folder% "ndisasm.exe" %survivor_com% 246 | timeout /t 1 >nul 247 | echo ----------------------------- 248 | echo ~~Copy %survivor_com%~~ 249 | move /y "%nasm_folder%\%survivor_com%" "%survivors_folder%" 250 | chdir /d %home_folder% 251 | goto tron-legacy-config 252 | :del-survivor 253 | echo ----------------------------- 254 | echo ~~tron-legacy-del-survivor~~ 255 | echo ----------------------------- 256 | set survivors_folder=%cd%\survivors 257 | echo ~~%survivors_folder%~~ 258 | dir /OD /b %survivors_folder%\* 259 | echo ----------------------------- 260 | echo ~~Choose survivor~~ 261 | chdir /d %survivors_folder% 262 | SET /p survivor=Enter survivor: 263 | SET survivor_ready=%survivor% 264 | echo ----------------------------- 265 | del %survivors_folder%\%survivor% 266 | chdir /d %home_folder% 267 | goto tron-legacy-config 268 | :run-debugger 269 | echo ----------------------------- 270 | echo ~~tron-legacy-run-debugger~~ 271 | echo ----------------------------- 272 | java -cp lib\debugger.jar;lib\* il.co.codeguru.corewars8086.CoreWarsEngine 273 | goto tron-legacy-config 274 | :run-silent 275 | echo ----------------------------- 276 | echo ~~tron-legacy-run-silent~~ 277 | echo ----------------------------- 278 | java -cp lib\debugger.jar;lib\* il.co.codeguru.corewars8086.AutoCoreWars 279 | goto tron-legacy-config 280 | :show-survivors 281 | echo ----------------------------- 282 | echo ~~tron-legacy-show-survivors~~ 283 | echo ----------------------------- 284 | set survivors_folder=%cd%\survivors 285 | echo ~~%survivors_folder%~~ 286 | dir /OD /b %survivors_folder%\* 287 | goto tron-legacy-config 288 | :show-work-directory 289 | echo ----------------------------- 290 | echo ~~tron-legacy-show-work-directory~~ 291 | echo ----------------------------- 292 | set work_folder=%cd%\work_directory 293 | echo ~~%work_folder%~~ 294 | dir /OD /b %work_folder%\*.asm 295 | dir /OD /b %work_folder%\*. 296 | goto tron-legacy-config 297 | goto begin 298 | 299 | 300 | --------------------------------------------------------------------------------