summary refs log tree commit diff
path: root/pc-thing/code
diff options
context:
space:
mode:
Diffstat (limited to 'pc-thing/code')
-rw-r--r--pc-thing/code/.vscode/settings.json3
-rw-r--r--pc-thing/code/bootloader.a109
-rw-r--r--pc-thing/code/calc.a74
-rw-r--r--pc-thing/code/code-1.a6
-rw-r--r--pc-thing/code/disk.a7
-rw-r--r--pc-thing/code/glumbo-buff.a285
-rw-r--r--pc-thing/code/glumbo.a271
-rw-r--r--pc-thing/code/hi.a11
-rw-r--r--pc-thing/code/memman.a154
-rw-r--r--pc-thing/code/move-bootloader.a62
-rw-r--r--pc-thing/code/move-bootloader.c11
-rw-r--r--pc-thing/code/printer.a111
-rw-r--r--pc-thing/code/strlib.a128
-rw-r--r--pc-thing/code/sub1.a6
-rw-r--r--pc-thing/code/test_aliases.a3
-rw-r--r--pc-thing/code/test_clock.a53
-rw-r--r--pc-thing/code/test_strlib.a10
-rw-r--r--pc-thing/code/wozmon.a160
18 files changed, 1464 insertions, 0 deletions
diff --git a/pc-thing/code/.vscode/settings.json b/pc-thing/code/.vscode/settings.json
new file mode 100644
index 0000000..b943dbc
--- /dev/null
+++ b/pc-thing/code/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+    "deno.enable": true
+}
\ No newline at end of file
diff --git a/pc-thing/code/bootloader.a b/pc-thing/code/bootloader.a
new file mode 100644
index 0000000..66a221c
--- /dev/null
+++ b/pc-thing/code/bootloader.a
@@ -0,0 +1,109 @@
+.offset 0x6000 ; bootloader is in 0x6000, copied there by another script
+start:
+    mov a 0
+    str a [gottenNZ]
+    ; currSector -> A
+    mov a [currSector]
+    ld a a
+    str a 0x7cff
+
+    mov b 512
+    mul
+    str c [sectorOffset]
+
+    mov a 0
+    str a [bytePointer]
+
+    mov a 0
+    str a [ptrThing]
+
+    copySector:
+        mov a [sectorOffset]
+        ld a a
+        mov b [bytePointer]
+        ld b b
+        add c a b
+        ;
+        swp a c
+        mov b 0x8000 ; default code position
+        add c a b
+        str c [targetPointer]
+
+        ; ld a [sectorOffset]
+        mov a 0x7d00
+        ; add
+        ; swp c a
+        mov b [ptrThing]
+        ld b b
+        add c a b
+        mov b [targetPointer]
+        ld b b
+        ; swp c b
+        ; a <- $b
+        ld a b
+        push a ; push b
+        ld a c
+        ; push c ; push c
+        str b a ; $b <- c
+        pop a
+        ; $c <- b
+        str c a
+        ; swpm c b
+
+        ld a c
+        mov b 0
+        cmr a a b
+        mov b 1
+        xor c a b
+        swp a c
+        mov b [gottenNZ]
+        ld b b
+        or c a b
+        mov a [gottenNZ]
+        str c a
+
+        ;continue loop
+        ; pointer to 8xxx
+        mov a [ptrThing]
+        ld a a
+        mov b 1
+        add c a b
+        mov a [ptrThing]
+        str c a
+
+        ; pointer offset for sector thing
+        mov a [bytePointer]
+        ld a a
+        mov b 1
+        add
+        str c [bytePointer]
+
+        ; offset == 513
+        cmp c 513
+        jz copySector
+    ; continue main loop
+    mov a [currSector]
+    ld a a
+    mov b 1
+    add c a b
+    mov a [currSector]
+    str c a
+    mov a [gottenNZ]
+    ld a a
+    cmp a 0
+    jz start
+    ;escaped
+    jmp 0x8001
+
+ptrThing:
+.hex 0
+currSector:
+.hex 0
+sectorOffset:
+.hex 0
+bytePointer:
+.hex 0
+gottenNZ:
+.hex 0
+targetPointer:
+.hex 0
\ No newline at end of file
diff --git a/pc-thing/code/calc.a b/pc-thing/code/calc.a
new file mode 100644
index 0000000..2aa1b02
--- /dev/null
+++ b/pc-thing/code/calc.a
@@ -0,0 +1,74 @@
+.label len 1
+
+jmp start
+read_input:
+    mov a 0
+    mov b 0
+    mov c 64
+    sys
+    mov b 1
+    sub
+    str c len
+    ret
+
+str_to_num:
+    ; pointer to current character
+    .label ptr 2
+    ld a len
+    mov b 63
+    add
+    str c ptr
+    .label mult 3
+    mov a 1
+    str a mult
+    .label num 4
+    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
+        cmp c 63
+        jz stm_loop
+    ret
+
+start:
+    jmr read_input
+    jmr str_to_num
+    ld a 4
+    str a 8 ; store number 1 to 8
+    jmr read_input
+    jmr str_to_num
+    ld a 4 ; load number from read
+    ld b 8
+    add
+    str c 16 ; put our number into 16
+    #using printer.a
+    jmr print_num ; print number at 16 (well not print but stringify)
+    mov a 1 ; write
+    mov b 1 ; stdout
+    mov c 32 ; address
+    sys ; syscall
\ No newline at end of file
diff --git a/pc-thing/code/code-1.a b/pc-thing/code/code-1.a
new file mode 100644
index 0000000..02be1b2
--- /dev/null
+++ b/pc-thing/code/code-1.a
@@ -0,0 +1,6 @@
+start:
+    mov a 42
+    str a 0
+    #using sub1.a
+    jmr do_the_thing
+    ld a 0
\ No newline at end of file
diff --git a/pc-thing/code/disk.a b/pc-thing/code/disk.a
new file mode 100644
index 0000000..35eb106
--- /dev/null
+++ b/pc-thing/code/disk.a
@@ -0,0 +1,7 @@
+start:
+    ; get sector 0
+    mov a 0
+    str a 0x7cff
+
+    ; jump to the sector
+    jmp 0x7d01
\ No newline at end of file
diff --git a/pc-thing/code/glumbo-buff.a b/pc-thing/code/glumbo-buff.a
new file mode 100644
index 0000000..8964ef3
--- /dev/null
+++ b/pc-thing/code/glumbo-buff.a
@@ -0,0 +1,285 @@
+; GLUMBO - the 2d game thing
+
+.macro store(reg, val, addr) \
+    put @reg @val\
+    str @reg @addr
+.macro storer(reg, val, addr) \
+    put @reg @val\
+    srr @reg @addr
+.macro inc(addr) \
+    ld a @addr\
+    put b 1\
+    add\
+    str c @addr
+
+jmp start
+get_coord:
+    ld a tmp2              ; Y(0-4) -> a
+    mov b width            ; width (5) -> b
+    mul                    ; Y(0-4) * width (5)
+
+    mov a grid_start       ; grid start address -> a
+    swp c b                ; (offset from y) -> b
+    add                    ; offsetY + gridStart
+    swp c a                ; -> a
+    ld b tmp1              ; X(0-4) -> b
+    add                    ; loc + X
+
+    str c tmp3             ; location -> tmp3
+    ret
+
+start:
+    .label width 20
+    .label height 10
+
+    .label grid_start 512
+    ; temp vars
+    .label tmp1 0
+    .label tmp2 1
+    .label tmp3 2
+    .label tmp4 3
+    .label tmp5 4
+
+    .label px 16
+    .label py 17
+    .label inp 128
+    .label rowBuff 256
+    store a 2 px
+    store a 2 py
+
+    store a 0 tmp1 ; x
+    store a 0 tmp2 ; y
+    mov a 2
+    mov b 1
+    sys
+    grid_loop:
+        ;get coord
+            jmr get_coord
+        ;store tile
+            ; storer a 46 c
+        ;main loop stuff
+        ; place tile
+            ; get X % (width - 1) to check if on x edge
+                store a 46 tmp4
+                mov a width         ; width -> A
+                mov b 1             ; 1 -> b
+                sub                 ; c = width - 1
+                swp c b             ; -> b
+                ld a tmp1           ; x -> a
+                mod                 ; c = x % (w - 1)
+                mov a 0             ;
+                crr c c a           ; c = c == 0?
+                str c tmp5          ; c -> tmp5
+
+            ; Y % (height - 1 )
+                mov a height        ; height -> A
+                mov b 1             ; 1 -> b
+                sub                 ; c = height - 1
+                swp c b             ; -> b
+                ld a tmp2           ; x -> a
+                mod                 ; c = x % (w - 1)
+                mov a 0
+                crr a c a           ; a = c == 0?
+
+            ld b tmp5
+            or
+            cmp c 1
+
+            jz do_the_store     ; edge ? continue : jmp do_the_store
+            store a 35 tmp4     ; store 35 at tmp4
+            do_the_store:
+                ld b tmp3       ; location -> b
+                ld a tmp4       ; tmp4 (character) -> a
+                srr a b         ; store the tile
+        ;;;;;;;;;;;;;;;;;;;;;;;;;
+        mov a width             ; width -> a
+        mov b 1                 ; 1 -> b
+        sub                     ; c = width - 1
+        ld a tmp1               ; X(0-4) -> a
+        cmr a c                 ; X(0-4) == width
+        jnz ifz                 ; go to ifz if X(0-4) == width (5)
+        ifnz:                   ; X is not 0
+            ld a tmp1           ; X -> a
+            mov b 1             ; 1 -> b
+            add                 ; X + 1
+            str c tmp1          ; X = X + 1
+            jmp continue_loop   ; continue
+        ifz:                    ; X is 0
+            store a 0 tmp1      ; set X to 1
+            ld a tmp2           ; Y(0-4) -> a
+            mov b 1             ; 1 -> b
+            add                 ; c = Y + 1
+            str c tmp2          ; Y = c
+            jmp continue_loop   ; continue
+        continue_loop:
+            mov a height
+            mov b 0
+            sub
+            ld a tmp2           ; get Y (0-4)
+            cmr a c             ; Y == height+1 ?
+            jz grid_loop        ; if not, continue
+    ; escaped
+    main_loop:
+        jmr print
+        ; get input
+            mov a 0
+            mov b 0
+            mov c inp
+            sys
+            jmr parse_input
+        jmp main_loop
+
+parse_input:
+    .macro case(addr, val, ln) \
+        ld a @addr\
+        cmp a @val\
+        jnz @ln
+    .macro break() jmp default
+
+    case inp 119 case_w
+    case inp 115 case_s
+    case inp 97 case_a
+    case inp 100 case_d
+
+    case inp 99 case_c
+    case inp 3 case_c
+    break
+
+    case_w:
+        ld a py
+        cmp a 0
+        jnz default
+        mov b 1
+        sub
+        str c py
+        break
+    
+    case_s:
+        ; width-1
+            mov a height
+            mov b 1
+            sub
+
+        ld a py
+        cmr a c
+        jnz default
+        mov b 1
+        add
+        str c py
+        break
+    
+    case_a:
+        ld a px
+        cmp a 0
+        jnz default
+        mov b 1
+        sub
+        str c px
+        break
+    
+    case_d:
+        ; width-1
+            mov a width
+            mov b 1
+            sub
+
+        ld a px
+        cmr a c
+        jnz default
+        mov b 1
+        add
+        str c px
+        break
+    
+    case_c:
+        end
+        break
+
+    default:
+        ret
+
+print:
+    .label tmp6 5
+    mov a 1
+    mov b 1
+    mov c [clear]
+    sys
+    store a 0 tmp1 ; x
+    store a 0 tmp2 ; y
+    store a 0 tmp6 ; rowBuff index
+    print_loop:
+        ;get coord
+            jmr get_coord
+        ; get tile
+            ld a tmp1 ; x
+            ld b px   ; player x
+            crr c a b
+            str c tmp4
+            ld a tmp2 ; y
+            ld b py   ; player y
+            crr b a b
+            ld a tmp4
+            and
+            cmp c 1
+            
+            ld a tmp6 ; buff pointer
+            mov b rowBuff ; + buff loc
+            add ;
+            ld a tmp3 ; tile pointer?
+            ldr b a ; load tile into b
+
+            jz set_normal
+                mov b 64
+            set_normal:
+            srr b c ; store b to c
+            ; store a 0 129
+        ;loop
+            mov a width
+            mov b 1
+            sub
+            ld a tmp1              ; X(0-4) -> a
+            cmr a c                ; X(0-4) == width
+            jnz p_ifz              ; go to ifz if X(0-4) == width
+            p_ifnz:                ; X is not 0
+                ld a tmp1          ; X -> a
+                mov b 1            ; 1 -> b
+                add                ; X + 1
+                str c tmp1         ; X = X + 1
+                inc tmp6
+                jmp continue_ploop ; continue
+            p_ifz:                 ; X is 0
+                store a 0 tmp6
+                store a 10 128
+                store a 0 129
+                mov a 1
+                mov b 1
+                mov c 128
+                sys
+                store a 0 tmp1     ; set X to 1
+                ld a tmp2          ; Y(0-4) -> a
+                mov b 1            ; 1 -> b
+                add                ; c = Y + 1
+                str c tmp2         ; Y = c
+                ; print
+                    ; print
+                    mov a 1
+                    mov b 1
+                    mov c rowBuff
+                    sys
+                    ; ld c 128
+                    ; dbg a
+                jmp continue_ploop ; continue
+            continue_ploop:
+                mov a height
+                mov b 0
+                sub
+                ld a tmp2          ; get Y (0-4)
+                cmr a c            ; Y == width+1 ?
+                jz print_loop      ; if not, continue
+    ret
+clear:
+.hex 1b
+.str "[2J"
+.hex 1b
+.str "[0;0H"
+.hex 0
\ No newline at end of file
diff --git a/pc-thing/code/glumbo.a b/pc-thing/code/glumbo.a
new file mode 100644
index 0000000..72accf6
--- /dev/null
+++ b/pc-thing/code/glumbo.a
@@ -0,0 +1,271 @@
+; GLUMBO - the 2d game thing
+
+.macro store(reg, val, addr) \
+    put @reg @val\
+    str @reg @addr
+.macro storer(reg, val, addr) \
+    put @reg @val\
+    srr @reg @addr
+
+jmp start
+get_coord:
+    ld a tmp2              ; Y(0-4) -> a
+    mov b width            ; width (5) -> b
+    mul                    ; Y(0-4) * width (5)
+
+    mov a grid_start       ; grid start address -> a
+    swp c b                ; (offset from y) -> b
+    add                    ; offsetY + gridStart
+    swp c a                ; -> a
+    ld b tmp1              ; X(0-4) -> b
+    add                    ; loc + X
+
+    str c tmp3             ; location -> tmp3
+    ret
+
+start:
+    .label width 20
+    .label height 10
+
+    .label grid_start 512
+    ; temp vars
+    .label tmp1 0
+    .label tmp2 1
+    .label tmp3 2
+    .label tmp4 3
+    .label tmp5 4
+
+    .label px 16
+    .label py 17
+    .label inp 256
+    store a 2 px
+    store a 2 py
+
+    store a 0 tmp1 ; x
+    store a 0 tmp2 ; y
+    mov a 2
+    mov b 1
+    sys
+    grid_loop:
+        ;get coord
+            jmr get_coord
+        ;store tile
+            ; storer a 46 c
+        ;main loop stuff
+        ; place tile
+            ; get X % (width - 1) to check if on x edge
+                store a 46 tmp4
+                mov a width         ; width -> A
+                mov b 1             ; 1 -> b
+                sub                 ; c = width - 1
+                swp c b             ; -> b
+                ld a tmp1           ; x -> a
+                mod                 ; c = x % (w - 1)
+                mov a 0             ;
+                crr c c a           ; c = c == 0?
+                str c tmp5          ; c -> tmp5
+
+            ; Y % (height - 1 )
+                mov a height        ; height -> A
+                mov b 1             ; 1 -> b
+                sub                 ; c = height - 1
+                swp c b             ; -> b
+                ld a tmp2           ; x -> a
+                mod                 ; c = x % (w - 1)
+                mov a 0
+                crr a c a           ; a = c == 0?
+
+            ld b tmp5
+            or
+            cmp c 1
+
+            jz do_the_store     ; edge ? continue : jmp do_the_store
+            store a 35 tmp4     ; store 35 at tmp4
+            do_the_store:
+                ld b tmp3       ; location -> b
+                ld a tmp4       ; tmp4 (character) -> a
+                srr a b         ; store the tile
+        ;;;;;;;;;;;;;;;;;;;;;;;;;
+        mov a width             ; width -> a
+        mov b 1                 ; 1 -> b
+        sub                     ; c = width - 1
+        ld a tmp1               ; X(0-4) -> a
+        cmr a c                 ; X(0-4) == width
+        jnz ifz                 ; go to ifz if X(0-4) == width (5)
+        ifnz:                   ; X is not 0
+            ld a tmp1           ; X -> a
+            mov b 1             ; 1 -> b
+            add                 ; X + 1
+            str c tmp1          ; X = X + 1
+            jmp continue_loop   ; continue
+        ifz:                    ; X is 0
+            store a 0 tmp1      ; set X to 1
+            ld a tmp2           ; Y(0-4) -> a
+            mov b 1             ; 1 -> b
+            add                 ; c = Y + 1
+            str c tmp2          ; Y = c
+            jmp continue_loop   ; continue
+        continue_loop:
+            mov a height
+            mov b 0
+            sub
+            ld a tmp2           ; get Y (0-4)
+            cmr a c             ; Y == height+1 ?
+            jz grid_loop        ; if not, continue
+    ; escaped
+    main_loop:
+        jmr print
+        ; get input
+            mov a 0
+            mov b 0
+            mov c inp
+            sys
+            jmr parse_input
+        jmp main_loop
+
+parse_input:
+    .macro case(addr, val, ln) \
+        ld a @addr\
+        cmp a @val\
+        jnz @ln
+    .macro break() jmp default
+
+    case inp 119 case_w
+    case inp 115 case_s
+    case inp 97 case_a
+    case inp 100 case_d
+
+    case inp 99 case_c
+    case inp 3 case_c
+    break
+
+    case_w:
+        ld a py
+        cmp a 0
+        jnz default
+        mov b 1
+        sub
+        str c py
+        break
+    
+    case_s:
+        ; width-1
+            mov a width
+            mov b 1
+            sub
+
+        ld a py
+        cmr a c
+        jnz default
+        mov b 1
+        add
+        str c py
+        break
+    
+    case_a:
+        ld a px
+        cmp a 0
+        jnz default
+        mov b 1
+        sub
+        str c px
+        break
+    
+    case_d:
+        ; width-1
+            mov a width
+            mov b 1
+            sub
+
+        ld a px
+        cmr a c
+        jnz default
+        mov b 1
+        add
+        str c px
+        break
+    
+    case_c:
+        halt
+        break
+
+    default:
+        ret
+
+print:
+    mov a 1
+    mov b 1
+    mov c [clear]
+    sys
+    store a 0 tmp1 ; x
+    store a 0 tmp2 ; y
+    print_loop:
+        ;get coord
+            jmr get_coord
+        ; get tile
+            ld a tmp3
+            ldr b a
+            str b 128
+            store a 0 129
+
+            ;TODO - make player tile be a @ or something
+            ld a tmp1 ; x
+            ld b px   ; player x
+            crr c a b
+            str c tmp4
+            ld a tmp2 ; y
+            ld b py   ; player y
+            crr b a b
+            ld a tmp4
+            and
+            cmp c 1
+            jz print_normal
+                store a 64 128
+            print_normal:
+                ; print
+                mov a 1
+                mov b 1
+                mov c 128
+                sys
+                ; ld c 128
+                ; dbg a
+        ;loop
+            mov a width
+            mov b 1
+            sub
+            ld a tmp1              ; X(0-4) -> a
+            cmr a c                ; X(0-4) == width
+            jnz p_ifz              ; go to ifz if X(0-4) == width
+            p_ifnz:                ; X is not 0
+                ld a tmp1          ; X -> a
+                mov b 1            ; 1 -> b
+                add                ; X + 1
+                str c tmp1         ; X = X + 1
+                jmp continue_ploop ; continue
+            p_ifz:                 ; X is 0
+                store a 10 128
+                store a 0 129
+                mov a 1
+                mov b 1
+                mov c 128
+                sys
+                store a 0 tmp1     ; set X to 1
+                ld a tmp2          ; Y(0-4) -> a
+                mov b 1            ; 1 -> b
+                add                ; c = Y + 1
+                str c tmp2         ; Y = c
+                jmp continue_ploop ; continue
+            continue_ploop:
+                mov a height
+                mov b 0
+                sub
+                ld a tmp2          ; get Y (0-4)
+                cmr a c            ; Y == width+1 ?
+                jz print_loop      ; if not, continue
+    ret
+clear:
+.hex 1b
+.str "[2J"
+.hex 1b
+.str "[0;0H"
+.hex 0
\ No newline at end of file
diff --git a/pc-thing/code/hi.a b/pc-thing/code/hi.a
new file mode 100644
index 0000000..62b1db8
--- /dev/null
+++ b/pc-thing/code/hi.a
@@ -0,0 +1,11 @@
+start:
+    mov a 1
+    mov b 1
+    mov c [helloworld]
+    sys
+    halt
+
+helloworld:
+.str "Hello, World!"
+.hex 0xA
+.hex 0
\ No newline at end of file
diff --git a/pc-thing/code/memman.a b/pc-thing/code/memman.a
new file mode 100644
index 0000000..2398cd6
--- /dev/null
+++ b/pc-thing/code/memman.a
@@ -0,0 +1,154 @@
+; 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
diff --git a/pc-thing/code/move-bootloader.a b/pc-thing/code/move-bootloader.a
new file mode 100644
index 0000000..306f2fe
--- /dev/null
+++ b/pc-thing/code/move-bootloader.a
@@ -0,0 +1,62 @@
+start:
+    ; init stack
+    mov a 0x6000
+    mov b 0x7000
+    str b a
+    copyLoop:
+        mov a [codePointer]
+        ld a a
+        mov b 0x6000
+        add c a b
+        mov a [targetPointer]
+        str c a
+
+        mov a codeStart
+        mov b [codePointer]
+        ld b b
+        add c a b
+        
+        mov a [targetPointer]
+        ld a a
+        ; swp a c
+        ; a <- $b
+        ld d c
+        push d ; push b
+        ld d a
+        ; push a ; push a
+        str c d ; $b <- a
+        pop d
+        ; $a <- b
+        str a d
+        ; swpm c b
+        
+        mov a [codePointer]
+        ld a a
+        mov b 1
+        add c a b
+        ; mov a
+        str c [codePointer] 
+        ; continue loop
+            mov b [targetPointer]
+            ; (byte we just copied) -> B
+            ld b b
+            ; (next byte) -> A
+            ld a c
+            ; C = A (aka next byte) == 0
+            cmr c a 0
+            ; A = B (aka last byte) == 1E (end instruction)
+            cmr a b 0x1e
+            swp c b ; C -> B
+            and c a b; c=a&&b
+            mov a 1
+            cmp c a ; c==1?
+            jz copyLoop ; continue if c != 1
+    jmp 0x6001
+
+
+targetPointer:
+.hex 0
+codePointer:
+.hex 0
+; start of bootloader
+codeStart:
\ No newline at end of file
diff --git a/pc-thing/code/move-bootloader.c b/pc-thing/code/move-bootloader.c
new file mode 100644
index 0000000..1aa938a
--- /dev/null
+++ b/pc-thing/code/move-bootloader.c
@@ -0,0 +1,11 @@
+#define codeStart 900
+
+int main() {
+    // set up stack
+    *(volatile unsigned char *)0x7000 = 0x6000;
+    volatile unsigned char* codePointer = 0;
+    while ()
+    {
+        volatile unsigned char* targetPointer = 0x6000 + codePointer;
+    }
+}
\ No newline at end of file
diff --git a/pc-thing/code/printer.a b/pc-thing/code/printer.a
new file mode 100644
index 0000000..87b66ba
--- /dev/null
+++ b/pc-thing/code/printer.a
@@ -0,0 +1,111 @@
+; print the number at 0xF
+print_num:
+    ; non-address definitions
+    .label zero 48
+    .label out_start 32
+    ; define stuff in memory
+    .label number 16
+    .label mult 17
+    mov a 1
+    str a mult
+    .label currnum 18
+    .label tmp1 19
+    .label out_pointer 20
+    mov a out_start
+    str a out_pointer
+    .label swap_counter 21
+
+    loop_start:
+        ; get num-(num%mult)
+            ld a number
+            ld b mult
+            mod
+            swp c b
+            sub
+            str c tmp1
+
+        ; get num-(num%(mult*10))
+            mov a 10
+            ld b mult
+            mul
+            swp c b
+            ld a number
+            mod
+            swp c b
+            sub
+        
+        ; subtract the thingies to get the current digit
+        swp c b
+        ld a tmp1
+        sub
+        swp c a
+        ld b mult
+        div
+        str c currnum
+
+        ; add zero to currnum and store at out_pointer
+        swp a c ; currnum -> A
+        mov b zero
+        add
+        ld a out_pointer
+        srr c a ; store c to address at a (which is out_pointer)
+
+        ; continue loop
+            ; increment out_pointer
+            ld a out_pointer
+            mov b 1
+            add
+            str c out_pointer
+            ; increment mult
+            ld a mult
+            mov b 10
+            mul
+            str c mult
+        
+            swp c b ; mult -> b
+            ld a number ; get number
+            mod ; get mod, will be equal to number if reached end
+            cmr c a ; compare result of mod and number (which is still in a)
+            jz loop_start ; jump if not equal
+    ; escaped from loop; swapping around memory to flip the text
+    ld a out_pointer
+    mov b out_start
+    sub
+    swp c a
+    mov b 2
+    div
+    str c swap_counter
+    cmp c 0
+    jnz end_swap
+    start_swap:
+        ; ptr - counter
+            ld b swap_counter
+            ld a out_pointer
+            sub
+            str c tmp1
+        ; start + counter
+            ld a swap_counter ; 1
+            mov b 1
+            sub ; 1
+            swp c b ; 1 -> b
+            mov a out_start ; 32
+            add ; 32 + 1 = 33
+        swp c b
+        ld a tmp1
+        swpm a b
+        ld a swap_counter
+        mov b 1
+        sub
+        str c swap_counter
+        cmp c 0
+        jz start_swap
+    end_swap:
+    ; add \n\0
+    ld b out_pointer
+    mov a 10 ; \n
+    srr a b
+    mov a 1
+    add
+    mov a 0 ; \0
+    srr a c
+    ret
diff --git a/pc-thing/code/strlib.a b/pc-thing/code/strlib.a
new file mode 100644
index 0000000..a18da3b
--- /dev/null
+++ b/pc-thing/code/strlib.a
@@ -0,0 +1,128 @@
+; number to string
+; a - pointer to output
+; b - number to print
+num_to_str:
+    str a out_pointer
+    str a out_start
+    str b [number]
+    ; non-address definitions
+    .label zero 48
+    ; define stuff in memory
+    ; .label number 16
+    ; .label mult 17
+    ; mov a 1
+    ; str a mult
+    ; .label currnum 18
+    ; .label tmp1 19
+    ; .label swap_counter 21
+
+    loop_start:
+        ; get num-(num%mult)
+            ld a [number]
+            ld b [mult]
+            mod
+            swp c b
+            sub
+            str c [tmp1]
+
+        ; get num-(num%(mult*10))
+            mov a 10
+            ld b [mult]
+            mul
+            swp c b
+            ld a [number]
+            mod
+            swp c b
+            sub
+        
+        ; subtract the thingies to get the current digit
+        swp c b
+        ld a [tmp1]
+        sub
+        swp c a
+        ld b [mult]
+        div
+        str c [currnum]
+
+        ; add zero to currnum and store at out_pointer
+        swp a c ; currnum -> A
+        mov b zero
+        add
+        ld a [out_pointer]
+        srr c a ; store c to address at a (which is out_pointer)
+
+        ; continue loop
+            ; increment out_pointer
+            ld a [out_pointer]
+            mov b 1
+            add
+            str c [out_pointer]
+            ; increment mult
+            ld a [mult]
+            mov b 10
+            mul
+            str c [mult]
+        
+            swp c b ; mult -> b
+            ld a [number] ; get number
+            mod ; get mod, will be equal to number if reached end
+            cmr c a ; compare result of mod and number (which is still in a)
+            jz loop_start ; jump if not equal
+    ; escaped from loop; swapping around memory to flip the text
+    ld a [out_pointer]
+    ld b [out_start]
+    sub
+    swp c a
+    mov b 2
+    div
+    str c [swap_counter]
+    cmp c 0
+    jnz end_swap
+    start_swap:
+        ; ptr - counter
+            ld b [swap_counter]
+            ld a [out_pointer]
+            sub
+            str c [tmp1]
+        ; start + counter
+            ld a [swap_counter] ; 1
+            mov b 1
+            sub ; 1
+            swp c b ; 1 -> b
+            ld a [out_start] ; 32
+            add ; 32 + 1 = 33
+        swp c b
+        ld a [tmp1]
+        dbg 304
+        swpm a b
+        ld a [swap_counter]
+        mov b 1
+        sub
+        str c [swap_counter]
+        cmp c 0
+        jz start_swap
+    end_swap:
+    ; add \n\0
+    ld b [out_pointer]
+    mov a 10 ; \n
+    srr a b
+    mov a 1
+    add
+    mov a 0 ; \0
+    srr a c
+    ret
+
+out_pointer:
+.hex 0
+out_start:
+.hex 0
+number:
+.hex 0
+mult:
+.hex 1
+currnum:
+.hex 0
+tmp1:
+.hex 0
+swap_counter:
+.hex 0
\ No newline at end of file
diff --git a/pc-thing/code/sub1.a b/pc-thing/code/sub1.a
new file mode 100644
index 0000000..e84f782
--- /dev/null
+++ b/pc-thing/code/sub1.a
@@ -0,0 +1,6 @@
+do_the_thing:
+    ld a 0
+    mov b 1
+    sub
+    str c 0
+    ret
\ No newline at end of file
diff --git a/pc-thing/code/test_aliases.a b/pc-thing/code/test_aliases.a
new file mode 100644
index 0000000..f63b4f5
--- /dev/null
+++ b/pc-thing/code/test_aliases.a
@@ -0,0 +1,3 @@
+start:
+    mov a 50
+    mov $0 a
\ No newline at end of file
diff --git a/pc-thing/code/test_clock.a b/pc-thing/code/test_clock.a
new file mode 100644
index 0000000..fe0f539
--- /dev/null
+++ b/pc-thing/code/test_clock.a
@@ -0,0 +1,53 @@
+.label counter 0
+
+jmp start
+
+interrupt:
+    ld a counter
+    mov b 1
+    add
+    swp c a
+    mov b 100
+    mod
+    str c counter
+    cmp c 0
+    jnz print_numb
+    ret
+
+#using code/printer.a
+
+print_numb:
+    ld a [counter]
+    mov b 1
+    add
+    str c [counter]
+    str c 16 ; put our number into 16
+    jmr print_num ; print number at 16 (well not print but stringify)
+    mov a 1 ; write
+    mov b 1 ; stdout
+    mov c 32 ; address
+    sys ; syscall
+    ret
+
+
+start:
+    mov a helloworld
+    mov b 1
+    sub
+    mov a 1
+    mov b 1
+    sys
+    mov a interrupt
+    mov b 1
+    sub
+    str c 0x7000
+    ; nl:
+    ; jmp nl
+    halt
+
+helloworld:
+.str "Hello, World!"
+.hex a
+.hex 0
+counter:
+.hex 0
\ No newline at end of file
diff --git a/pc-thing/code/test_strlib.a b/pc-thing/code/test_strlib.a
new file mode 100644
index 0000000..ce65675
--- /dev/null
+++ b/pc-thing/code/test_strlib.a
@@ -0,0 +1,10 @@
+#using code/strlib.a
+start:
+    mov a 16
+    mov b -1
+    jmr num_to_str
+    mov a 1
+    mov b 1
+    mov c 16
+    sys
+    end
\ No newline at end of file
diff --git a/pc-thing/code/wozmon.a b/pc-thing/code/wozmon.a
new file mode 100644
index 0000000..5462c4d
--- /dev/null
+++ b/pc-thing/code/wozmon.a
@@ -0,0 +1,160 @@
+;  The WOZ Monitor for the Apple 1
+;  Written by Steve Wozniak in 1976
+
+
+; Page 0 Variables
+
+.label XAML            0x24           ;  Last "opened" location Low
+.label XAMH            0x25           ;  Last "opened" location High
+.label STL             0x26           ;  Store address Low
+.label STH             0x27           ;  Store address High
+.label L               0x28           ;  Hex value parsing Low
+.label H               0x29           ;  Hex value parsing High
+.label YSAV            0x2A           ;  Used to see if hex value is given
+.label MODE            0x2B           ;  $00=XAM, $7F=STOR, $AE=BLOCK XAM
+
+
+; Other Variables
+
+.label IN              0x0200         ;  Input buffer to $027F
+.label KBD             0xD010         ;  PIA.A keyboard input
+.label KBDCR           0xD011         ;  PIA.A keyboard control register
+.label DSP             0xD012         ;  PIA.B display output register
+.label DSPCR           0xD013         ;  PIA.B display control register
+
+               .org $FF00
+               .export RESET
+
+RESET:          ;CLD             ; Clear decimal arithmetic mode.
+                ;CLI
+                MOV Y 0x7F        ; Mask for DSP data direction register.
+                STY DSP         ; Set it up.
+                MOV A 0xA7        ; KBD and DSP control register mask.
+                STA KBDCR       ; Enable interrupts, set CA1, CB1, for
+                STA DSPCR       ;  positive edge sense/output mode.
+NOTCR:          CMP #'_'+$80    ; "_"?
+                BEQ BACKSPACE   ; Yes.
+                CMP 0x9B        ; ESC?
+                BEQ ESCAPE      ; Yes.
+                INY             ; Advance text index.
+                BPL NEXTCHAR    ; Auto ESC if > 127.
+ESCAPE:         LD A #'\'+$80    ; "\".
+                JSR ECHO        ; Output it.
+GETLINE:        LD A 0x8D        ; CR.
+                JSR ECHO        ; Output it.
+                LD Y 0x01        ; Initialize text index.
+BACKSPACE:      DEY             ; Back up text index.
+                BMI GETLINE     ; Beyond start of line, reinitialize.
+NEXTCHAR:       LD A KBDCR       ; Key ready?
+                BPL NEXTCHAR    ; Loop until ready.
+                LD A KBD         ; Load character. B7 should be ‘1’.
+                STA IN,Y        ; Add to text buffer.
+                JSR ECHO        ; Display character.
+                CMP 0x8D        ; CR?
+                BNE NOTCR       ; No.
+                LD Y 0xFF        ; Reset text index.
+                LD A 0x00        ; For XAM mode.
+                TAX             ; 0->X.
+SETSTOR:        ASL             ; Leaves $7B if setting STOR mode.
+SETMODE:        STA MODE        ; $00=XAM, $7B=STOR, $AE=BLOCK XAM.
+BLSKIP:         INY             ; Advance text index.
+NEXTITEM:       LD A IN,Y        ; Get character.
+                CMP 0x8D        ; CR?
+                BEQ GETLINE     ; Yes, done this line.
+                CMP #'.'+$80    ; "."?
+                BCC BLSKIP      ; Skip delimiter.
+                BEQ SETMODE     ; Set BLOCK XAM mode.
+                CMP #':'+$80    ; ":"?
+                BEQ SETSTOR     ; Yes. Set STOR mode.
+                CMP #'R'+$80    ; "R"?
+                BEQ RUN         ; Yes. Run user program.
+                STX L           ; $00->L.
+                STX H           ;  and H.
+                STY YSAV        ; Save Y for comparison.
+NEXTHEX:        LD A IN,Y        ; Get character for hex test.
+                EOR 0xB0        ; Map digits to $0-9.
+                CMP 0x0A        ; Digit?
+                BCC DIG         ; Yes.
+                ADC 0x88        ; Map letter "A"-"F" to $FA-FF.
+                CMP 0xFA        ; Hex letter?
+                BCC NOTHEX      ; No, character not hex.
+DIG:            ASL
+                ASL             ; Hex digit to MSD of A.
+                ASL
+                ASL
+                LD X 0x04        ; Shift count.
+HEXSHIFT:       ASL             ; Hex digit left, MSB to carry.
+                ROL L           ; Rotate into LSD.
+                ROL H           ; Rotate into MSD’s.
+                DEX             ; Done 4 shifts?
+                BNE HEXSHIFT    ; No, loop.
+                INY             ; Advance text index.
+                BNE NEXTHEX     ; Always taken. Check next character for hex.
+NOTHEX:         CPY YSAV        ; Check if L, H empty (no hex digits).
+                BEQ ESCAPE      ; Yes, generate ESC sequence.
+                BIT MODE        ; Test MODE byte.
+                BVC NOTSTOR     ; B6=0 STOR, 1 for XAM and BLOCK XAM
+                LD A L           ; LSD’s of hex data.
+                STA (STL,X)     ; Store at current ‘store index’.
+                INC STL         ; Increment store index.
+                BNE NEXTITEM    ; Get next item. (no carry).
+                INC STH         ; Add carry to ‘store index’ high order.
+TONEXTITEM:     JMP NEXTITEM    ; Get next command item.
+RUN:            JMP (XAML)      ; Run at current XAM index.
+NOTSTOR:        BMI XAMNEXT     ; B7=0 for XAM, 1 for BLOCK XAM.
+                LD X 0x02        ; Byte count.
+SETADR:         LD A L-1,X       ; Copy hex data to
+                STA STL-1,X     ;  ‘store index’.
+                STA XAML-1,X    ; And to ‘XAM index’.
+                DEX             ; Next of 2 bytes.
+                BNE SETADR      ; Loop unless X=0.
+NXTPRNT:        BNE PRDATA      ; NE means no address to print.
+                LD A 0x8D        ; CR.
+                JSR ECHO        ; Output it.
+                LD A XAMH        ; ‘Examine index’ high-order byte.
+                JSR PRBYTE      ; Output it in hex format.
+                LD A XAML        ; Low-order ‘examine index’ byte.
+                JSR PRBYTE      ; Output it in hex format.
+                LD A #':'+$80    ; ":".
+                JSR ECHO        ; Output it.
+PRDATA:         LD A 0xA0        ; Blank.
+                JSR ECHO        ; Output it.
+                LD A (XAML,X)    ; Get data byte at ‘examine index’.
+                JSR PRBYTE      ; Output it in hex format.
+XAMNEXT:        STX MODE        ; 0->MODE (XAM mode).
+                LD A XAML
+                CMP L           ; Compare ‘examine index’ to hex data.
+                LD A XAMH
+                SBC H
+                BCS TONEXTITEM  ; Not less, so no more data to output.
+                INC XAML
+                BNE MOD8CHK     ; Increment ‘examine index’.
+                INC XAMH
+MOD8CHK:        LD A XAML        ; Check low-order ‘examine index’ byte
+                AND 0x07        ;  For MOD 8=0
+                BPL NXTPRNT     ; Always taken.
+PRBYTE:         PHA             ; Save A for LSD.
+                LSR
+                LSR
+                LSR             ; MSD to LSD position.
+                LSR
+                JSR PRHEX       ; Output hex digit.
+                PLA             ; Restore A.
+PRHEX:          AND 0x0F        ; Mask LSD for hex print.
+                ORA #'0'+$80    ; Add "0".
+                CMP 0xBA        ; Digit?
+                BCC ECHO        ; Yes, output it.
+                ADC 0x06        ; Add offset for letter.
+ECHO:           BIT DSP         ; DA bit (B7) cleared yet?
+                BMI ECHO        ; No, wait for display.
+                STA DSP         ; Output character. Sets DA.
+                RTS             ; Return.
+
+                BRK             ; unused
+                BRK             ; unused
+
+; Interrupt Vectors
+
+                .WORD $0F00     ; NMI
+                .WORD RESET     ; RESET
+                .WORD $0000     ; BRK/IRQ
\ No newline at end of file