aboutsummaryrefslogtreecommitdiffstats
path: root/src/uxn-core.s
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-08-29 16:41:13 +0200
committerBad Diode <bd@badd10de.dev>2023-08-29 16:41:13 +0200
commit19776f5720806bef0f4c6d1439f76da80603f054 (patch)
tree890f6f4235a8963bd0f1d63b78c6ae464a7f5e2b /src/uxn-core.s
parent50a369576e85c8ff6187ca808101a9008690be15 (diff)
downloaduxngba-19776f5720806bef0f4c6d1439f76da80603f054.tar.gz
uxngba-19776f5720806bef0f4c6d1439f76da80603f054.zip
Add dei functions
Diffstat (limited to 'src/uxn-core.s')
-rw-r--r--src/uxn-core.s269
1 files changed, 150 insertions, 119 deletions
diff --git a/src/uxn-core.s b/src/uxn-core.s
index 17f57a3..333b4a6 100644
--- a/src/uxn-core.s
+++ b/src/uxn-core.s
@@ -17,41 +17,6 @@ rst: .space 256
17.global rst_ptr 17.global rst_ptr
18rst_ptr: .word rst 18rst_ptr: .word rst
19 19
20.global device_data
21device_data:
22 .global device_0
23 device_0: .space 16
24 .global device_1
25 device_1: .space 16
26 .global device_2
27 device_2: .space 16
28 .global device_3
29 device_3: .space 16
30 .global device_4
31 device_4: .space 16
32 .global device_5
33 device_5: .space 16
34 .global device_6
35 device_6: .space 16
36 .global device_7
37 device_7: .space 16
38 .global device_8
39 device_8: .space 16
40 .global device_9
41 device_9: .space 16
42 .global device_a
43 device_a: .space 16
44 .global device_b
45 device_b: .space 16
46 .global device_c
47 device_c: .space 16
48 .global device_d
49 device_d: .space 16
50 .global device_e
51 device_e: .space 16
52 .global device_f
53 device_f: .space 16
54
55@ UXN evaluation function. 20@ UXN evaluation function.
56@ 21@
57@ r0: PC pointer (argument for this function is the offset from UXN RAM). 22@ r0: PC pointer (argument for this function is the offset from UXN RAM).
@@ -804,90 +769,6 @@ sta2:
804 asave16 r3, r4 769 asave16 r3, r4
805 b uxn_decode 770 b uxn_decode
806 771
807.global dei_map
808dei_map:
809 .word uxn_ret
810 .word uxn_ret
811 .word uxn_ret
812 .word uxn_ret
813 .word uxn_ret
814 .word uxn_ret
815 .word uxn_ret
816 .word uxn_ret
817 .word uxn_ret
818 .word uxn_ret
819 .word uxn_ret
820 .word uxn_ret
821 .word uxn_ret
822 .word uxn_ret
823 .word uxn_ret
824 .word uxn_ret
825
826dei:
827 b uxn_decode
828
829dei2:
830 b uxn_decode
831
832.global deo_map
833deo_map:
834 .word uxn_ret
835 .word uxn_ret
836 .word uxn_ret
837 .word uxn_ret
838 .word uxn_ret
839 .word uxn_ret
840 .word uxn_ret
841 .word uxn_ret
842 .word uxn_ret
843 .word uxn_ret
844 .word uxn_ret
845 .word uxn_ret
846 .word uxn_ret
847 .word uxn_ret
848 .word uxn_ret
849 .word uxn_ret
850
851deo:
852 wpop8 r3
853 mov r4, r3, lsr #4 @ idx
854 and r3, #0x0f @ port
855 wpop8 r5 @ value
856 adr r6, deo_map
857 ldr r6, [r6, r4, lsl #2]
858 stmfd sp!, {r0, r7, lr}
859 adr r0, device_data
860 lsl r4, #4
861 add r0, r4
862 strb r5, [r0, r3]
863 mov r1, r3
864 mov lr, pc
865 bx r6
866 ldmfd sp!, {r0, r7, lr}
867 ldr r1, wst_ptr
868 ldr r2, rst_ptr
869 b uxn_decode
870
871deo2:
872 wpop8 r3
873 mov r4, r3, lsr #4 @ idx
874 and r3, #0x0f @ port
875 wpop16 r5, r6 @ value
876 adr r6, deo_map
877 ldr r6, [r6, r4, lsl #2]
878 stmfd sp!, {r0, r7, lr}
879 adr r0, device_data
880 lsl r4, #4
881 add r0, r4
882 strh r5, [r0, r3]
883 mov r1, r3
884 mov lr, pc
885 bx r6
886 ldmfd sp!, {r0, r7, lr}
887 ldr r1, wst_ptr
888 ldr r2, rst_ptr
889 b uxn_decode
890
891add: 772add:
892 wpop8 r3 773 wpop8 r3
893 wpop8 r4 774 wpop8 r4
@@ -1016,3 +897,153 @@ sft2:
1016 wpush16 r3 897 wpush16 r3
1017 b uxn_decode 898 b uxn_decode
1018 899
900dei:
901 wpop8 r3
902 mov r4, r3, lsr #4 @ idx
903 and r3, #0x0f @ port
904 adr r6, dei_map
905 ldr r6, [r6, r4, lsl #2]
906 stmfd sp!, {r0, r7, lr}
907 adr r0, device_data
908 lsl r4, #4
909 add r0, r4
910 mov r1, r3
911 mov lr, pc
912 bx r6
913 ldr r1, wst_ptr
914 ldr r2, rst_ptr
915 wpush8 r0
916 ldmfd sp!, {r0, r7, lr}
917 b uxn_decode
918
919dei2:
920 wpop8 r3
921 mov r4, r3, lsr #4 @ idx
922 and r3, #0x0f @ port
923 adr r6, dei_map
924 ldr r6, [r6, r4, lsl #2]
925 stmfd sp!, {r0, r7, lr}
926 adr r0, device_data
927 lsl r4, #4
928 add r0, r4
929 mov r1, r3
930 mov lr, pc
931 bx r6
932 ldr r1, wst_ptr
933 ldr r2, rst_ptr
934 wpush16 r0
935 ldmfd sp!, {r0, r7, lr}
936 b uxn_decode
937
938deo:
939 wpop8 r3
940 mov r4, r3, lsr #4 @ idx
941 and r3, #0x0f @ port
942 wpop8 r5 @ value
943 adr r6, deo_map
944 ldr r6, [r6, r4, lsl #2]
945 stmfd sp!, {r0, r7, lr}
946 adr r0, device_data
947 lsl r4, #4
948 add r0, r4
949 strb r5, [r0, r3]
950 mov r1, r3
951 mov lr, pc
952 bx r6
953 ldmfd sp!, {r0, r7, lr}
954 ldr r1, wst_ptr
955 ldr r2, rst_ptr
956 b uxn_decode
957
958deo2:
959 wpop8 r3
960 mov r4, r3, lsr #4 @ idx
961 and r3, #0x0f @ port
962 wpop16 r5, r6 @ value
963 adr r6, deo_map
964 ldr r6, [r6, r4, lsl #2]
965 stmfd sp!, {r0, r7, lr}
966 adr r0, device_data
967 lsl r4, #4
968 add r0, r4
969 strh r5, [r0, r3]
970 mov r1, r3
971 mov lr, pc
972 bx r6
973 ldmfd sp!, {r0, r7, lr}
974 ldr r1, wst_ptr
975 ldr r2, rst_ptr
976 b uxn_decode
977
978.global device_data
979device_data:
980 .global device_0
981 device_0: .space 16
982 .global device_1
983 device_1: .space 16
984 .global device_2
985 device_2: .space 16
986 .global device_3
987 device_3: .space 16
988 .global device_4
989 device_4: .space 16
990 .global device_5
991 device_5: .space 16
992 .global device_6
993 device_6: .space 16
994 .global device_7
995 device_7: .space 16
996 .global device_8
997 device_8: .space 16
998 .global device_9
999 device_9: .space 16
1000 .global device_a
1001 device_a: .space 16
1002 .global device_b
1003 device_b: .space 16
1004 .global device_c
1005 device_c: .space 16
1006 .global device_d
1007 device_d: .space 16
1008 .global device_e
1009 device_e: .space 16
1010 .global device_f
1011 device_f: .space 16
1012
1013.global dei_map
1014dei_map:
1015 .word uxn_ret
1016 .word uxn_ret
1017 .word uxn_ret
1018 .word uxn_ret
1019 .word uxn_ret
1020 .word uxn_ret
1021 .word uxn_ret
1022 .word uxn_ret
1023 .word uxn_ret
1024 .word uxn_ret
1025 .word uxn_ret
1026 .word uxn_ret
1027 .word uxn_ret
1028 .word uxn_ret
1029 .word uxn_ret
1030 .word uxn_ret
1031
1032.global deo_map
1033deo_map:
1034 .word uxn_ret
1035 .word uxn_ret
1036 .word uxn_ret
1037 .word uxn_ret
1038 .word uxn_ret
1039 .word uxn_ret
1040 .word uxn_ret
1041 .word uxn_ret
1042 .word uxn_ret
1043 .word uxn_ret
1044 .word uxn_ret
1045 .word uxn_ret
1046 .word uxn_ret
1047 .word uxn_ret
1048 .word uxn_ret
1049 .word uxn_ret