;redcode-94 ;name RedOS v3.6 ;author jkl ;assert 1 org start version equ 3,6 ; version number errcnt equ 10 ; allowable error count before clear users equ 2 ; number of users allowed. ;----------header---------- head dat CORESIZE,CORESIZE-toe ; CORESIZE, CORESIZE-OS dat version ;----------input registry---------- ; user commands are set here. input dat 0,0 ; B field = command ; A field = target (if any) ;----------user registry---------- for users ; create user space. dat 1,1 ; A field = preliminary score. rof ;----------boot process---------- start ldp #0,#0 ; last state request sne.b start,#-1 ; check for start up jmp cold ; goto cold_boot sne.b start,#0 ; check for error after hard crash jmp error ; goto error stp #1,#1 ;----------wait state---------- wait jmz.f wait,input ; wait for input sne input,#1 ; check for 'run' jmp run sne input,#2 ; check for 'clear' jmp clear sne input,#3 ; check for 'cold boot' jmp cold sne input,#4 jmp kill ; check for 'kill' mov clean,input ; erroneous input, clear input buffer jmp error ; jump to error handling ;----------error handling---------- error ldp #1,#0 ; load previous error count add #1,error stp.b -2,#1 ; store error codes slt.b #10,error jmp wait ;----------user controllable commands---------- ;--------------------------------------------- ;----------clear core---------- clear mov.b head,2 ; cc1 mov clean,>toe ; clear memory cc2 djn cc1,#0 mov.ab #1,toe mov fix,head ; bug fix mov clean,input jmp wait ; goto wait ;----------cold boot---------- cold stp #0,#1 ; clean error count mov clean,input jmp wait ;----------run program---------- run spl *input ; run sub process for user. mov clean,input jmp wait ;----------kill program---------- kill mov clear,*input ; kill user defined process. mov clean,input jmp wait ;----------footer---------- fix dat CORESIZE,CORESIZE-toe+head ;CORESIZE, CORESIZE-OS clean dat 0,0 toe dat 1,1 ;----------end os----------