Today's addition was simple enough. For safe access to "not yet allocated" memory, I created 2 new helper functions:
; Reads a value from memory(defnread-mem[process-stateaddress](let[mem(:memoryprocess-state)](if(>=address(countmem))0(memaddress)))); Writes a value to memory and returns the new process state(defnwrite-mem[process-stateaddressvalue](let[mem(:memoryprocess-state)](if(>=address(countmem))(assocprocess-state:memory(conj(intomem(repeat(-address(countmem))0))value))(assoc-inprocess-state[:memoryaddress]value))))
And after changing the instruction type from int to long (which is the default number type in clojure anyway), I could just add the new stuff to my existing framework:
; new parameter mode function(fn[process-stateaddress](+(read-memprocess-stateaddress)(:rel-baseprocess-state))); new opcode(defrel-base-offset-opcode{:operator(fn[process-stateoffset-pointer](->process-state(update:rel-base+(read-memprocess-stateoffset-pointer))(update:pointer+2))):params1})
Today's addition was simple enough. For safe access to "not yet allocated" memory, I created 2 new helper functions:
And after changing the instruction type from int to long (which is the default number type in clojure anyway), I could just add the new stuff to my existing framework:
As always, here's the whole code: github.com/jkoenig134/AdventOfCode...