summary refs log tree commit diff
path: root/code/memman.a
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2025-03-31 19:47:54 +0300
committerWlodekM <[email protected]>2025-03-31 19:47:54 +0300
commitcccb99226d3951fd9dfe1c4cf1c43126a1309d51 (patch)
tree518d3e965558ba313f103cee6161cd2b6aedb3b9 /code/memman.a
parentef4e8c20719822eebd6318a878cc37902c2b85a5 (diff)
move to pc-thing/
Diffstat (limited to 'code/memman.a')
-rw-r--r--code/memman.a154
1 files changed, 0 insertions, 154 deletions
diff --git a/code/memman.a b/code/memman.a
deleted file mode 100644
index 2398cd6..0000000
--- a/code/memman.a
+++ /dev/null
@@ -1,154 +0,0 @@
-; MEMMAN - memory manager
-
-jmp start
-
-#using code/printer.a
-
-; code from calc.a
-; call with length in A
-str_to_num:
-    ; pointer to current character
-    ; ld a len
-    ld b [stm_start]
-    add
-    str c [ptr]
-    mov a 1
-    str a [mult]
-    mov a 0
-    str a [num]
-    .label zero 48
-    stm_loop:
-        ;load char, subtract zero, multiply by 10
-        ld b [ptr]
-        ldr a b
-        mov b zero
-        sub
-        swp c a
-        ld b [mult]
-        mul
-
-        ; add to num
-        swp c b
-        ld a [num]
-        add
-        str c [num]
-
-        ld a [mult]
-        mov b 10
-        mul
-        str c [mult]
-
-        ; move pointer
-        ld a [ptr]
-        mov b 1
-        sub
-        str c [ptr]
-        ld b [stm_start]
-        cmr c b
-        jz stm_loop
-    ret
-
-get_input:
-    mov a 0
-    mov b 0
-    mov c [input]
-    sys
-    str a [len]
-    ret
-
-parse_input:
-    mov a 0
-    str a [inp_ptr]
-
-    .macro case(addr, val, ln) \
-        ld a @addr\
-        cmp a @val\
-        jnz @ln
-    .macro break() jmp default
-
-    case [input] 'g' case_g
-    break
-
-    case_g:
-        ; get pointer to number
-            mov a [input]
-            mov b 1
-            add
-            str c [stm_start]
-        ; get new length
-            ld a [len]
-            mov b 2 ; subtract 2 for command + \n at the end
-            sub
-            swp c a 
-        jmr str_to_num
-        ld a [num]
-        dbg 3
-        str a 16
-        jmr print_num
-        ; print the output
-            mov a 1 ; write
-            mov b 1 ; stdout
-            mov c 32 ; address
-            sys ; syscall
-        mov a 1
-        mov b 1
-        mov c [colon_space]
-        sys
-        ldm a [num]
-        str a 16
-        jmr print_num
-        ; print the output
-            mov a 1 ; write
-            mov b 1 ; stdout
-            mov c 32 ; address
-            sys ; syscall
-        break
-
-    default:
-        ret
-
-
-start:
-    mov a 2
-    mov b 0
-    sys
-    jmr get_input
-    jmr parse_input
-    halt
-
-startup_message:
-.str "welcome to mem man the memory manager of the memory of managing the memory"
-.hex 0xa
-.str "yeah"
-.hex 0xa
-.hex 0xa
-.hex 0
-err:
-.str "what the fuck is this"
-.hex 0xa
-.hex 0
-ptr:
-.hex 0
-mult:
-.hex 0
-num:
-.hex 0
-; 256 bytes of input
-input:
-.str "0000000000000000000000000000000000000000000000000000000000000000"
-.str "0000000000000000000000000000000000000000000000000000000000000000"
-.str "0000000000000000000000000000000000000000000000000000000000000000"
-.str "0000000000000000000000000000000000000000000000000000000000000000"
-.str "0000000000000000000000000000000000000000000000000000000000000000"
-.str "0000000000000000000000000000000000000000000000000000000000000000"
-.str "0000000000000000000000000000000000000000000000000000000000000000"
-.str "0000000000000000000000000000000000000000000000000000000000000000"
-len:
-.hex 0
-inp_ptr:
-.hex 0
-stm_start:
-.hex 0
-colon_space:
-.str ": "
-.hex 0
\ No newline at end of file