Compare commits

..
52 Commits
Author SHA1 Message Date
ShatteredMINT 32a157e87d Merge pull request 'Changed mul_low algorithm to radix-4 multiplication' (#16) from Micha_i/symphony_stdlib:fast-math into main
Reviewed-on: #16
2026-09-04 08:21:49 +02:00
Michał Isalski a00c7f2a84 Changed mul_low algorithm to radix-4 multiplication 2026-09-04 00:11:33 +02:00
ShatteredMINT c83269fcf7 fix path to stdlib.asm 2026-09-03 20:35:41 +02:00
ShatteredMINT 6bf0c0a4fc add examples directory 2026-09-03 20:34:56 +02:00
ShatteredMINT 697445feec add tests folder 2026-09-03 20:34:16 +02:00
ShatteredMINT 7c49c5212e move assembly files into src directory 2026-09-03 20:32:40 +02:00
ShatteredMINT 6ff1a43c32 Merge pull request 'Added find_index array function' (#9) from Micha_i/symphony_stdlib:array-functions into main
Reviewed-on: #9
2026-09-03 20:30:09 +02:00
Michał Isalski b5249a43b9 Merge branch 'main' into array-functions 2026-09-03 20:29:24 +02:00
ShatteredMINT 0188969dab Merge pull request 'Added read_line console function' (#10) from Micha_i/symphony_stdlib:console-functions into main
Reviewed-on: #10
2026-09-03 14:56:12 +02:00
Micha_i 5c9a33c24d Merge branch 'main' into array-functions 2026-09-03 09:04:11 +02:00
Micha_i e4edb56d08 Merge branch 'main' into console-functions 2026-09-03 09:04:03 +02:00
Michał Isalski aa8eef7b1f Fixed at-address 2026-09-02 22:56:24 +02:00
ShatteredMINT 37d0e556d2 Merge pull request 'clean up confusion about function template' (#14) from meta-documentation into main
Reviewed-on: #14
2026-09-02 20:49:38 +02:00
ShatteredMINT 26d3a4d4f4 clean up confusion about function template 2026-09-02 20:49:22 +02:00
Michał Isalski 870b6ebc39 Merge branch 'main' into console-functions 2026-09-02 20:41:38 +02:00
Michał Isalski 1e4ad8f64c Merge branch 'main' into array-functions 2026-09-02 20:40:49 +02:00
Michal Isalski ca1ba67fd8 Added a shift conversion LUT and finished read_line (except Writeback) 2026-09-02 13:20:55 +02:00
ShatteredMINT 786adfdb1c Merge pull request 'Changed docs of math functions to conform to new guidelines' (#12) from Micha_i/symphony_stdlib:math-functions-docs into main
Reviewed-on: #12
2026-09-02 11:46:14 +02:00
Michał Isalski 84636799b6 Changed docs of math functions to conform to new guidelines 2026-09-02 11:44:30 +02:00
ShatteredMINT aa2cbe4ad8 Merge pull request 'Add basic meta documentation' (#11) from meta-documentation into main
Documentation efforts are ongoing but this should be good enough for now
2026-09-02 11:39:25 +02:00
ShatteredMINT 8301d5988a create teaching directory 2026-09-02 11:32:46 +02:00
ShatteredMINT dbd4865f14 change stack start 2026-09-02 11:31:52 +02:00
ShatteredMINT 8f1b970a2f remove mention of non existent file 2026-09-02 11:31:33 +02:00
ShatteredMINT ddca02d8a8 relax r7 requirement for result stack 2026-09-02 11:21:03 +02:00
ShatteredMINT a3d6cb64b5 remove duplicate documentation from stdlib.asm 2026-09-02 11:17:18 +02:00
Michał Isalski f9bb69f1f5 Added storing shift status 2026-09-02 02:03:00 +02:00
ShatteredMINT 9816111f38 clarify stack arguments 2026-09-01 14:08:20 +02:00
Michal Isalski 20e1f17181 Fixed swapped pop instructions 2026-09-01 13:52:45 +02:00
Michal Isalski 625f01166a Made find_index conform to new doc guidelines 2026-09-01 13:52:26 +02:00
ShatteredMINT f2e5c830b3 explain inline comment 2026-09-01 13:48:12 +02:00
Michal Isalski 65caf8aff9 Made read_line compliant to new doc guidelines 2026-09-01 13:47:09 +02:00
ShatteredMINT 60e7b6209f basic contribution guidelines 2026-09-01 13:21:17 +02:00
ShatteredMINT 33b7886e70 add arrays to readme 2026-09-01 13:07:13 +02:00
Michal Isalski 1dca814388 One instruction less by using another register 2026-09-01 10:54:29 +02:00
Michal Isalski 9dfb8248a6 Added handling for skipping non-renderable characters
Added handling for backspace character
2026-09-01 10:51:31 +02:00
Michał Isalski 4b962a1f87 Added read_line function 2026-09-01 00:38:37 +02:00
Michał Isalski e6a0739e95 pleegwat's code review fixes 2026-08-31 23:57:55 +02:00
Michał Isalski 1885f304ad Merge branch 'array-functions' of https://gitea.shatteredmint.net/Micha_i/symphony_stdlib into array-functions 2026-08-31 23:55:16 +02:00
Michał Isalski 63b37ab094 Added comment about predicate context 2026-08-31 23:06:59 +02:00
Michał Isalski 6981ff027d Tested and fixed stride->shift conversion missing 2026-08-31 23:06:59 +02:00
Michal Isalski 88c91a8eec Reduced operations to get -1 in register 2026-08-31 23:06:59 +02:00
Michal Isalski a02f0646b4 Fixed the predicate return address 2026-08-31 23:06:59 +02:00
Michal Isalski 7abfcabd73 Added find_index array function 2026-08-31 23:06:59 +02:00
Michał Isalski b476b8aaa3 Added comment about predicate context 2026-08-31 23:06:40 +02:00
Michał Isalski bddb153d9b Tested and fixed stride->shift conversion missing 2026-08-31 23:03:23 +02:00
Michal Isalski 29103d4335 Reduced operations to get -1 in register 2026-08-31 15:30:11 +02:00
Michal Isalski 837e8ba0a6 Fixed the predicate return address 2026-08-31 13:52:27 +02:00
Michal Isalski 6ca77970b8 Added find_index array function 2026-08-31 13:44:07 +02:00
ShatteredMINT daf4168129 format calling convention 2026-08-31 10:17:25 +02:00
ShatteredMINT 4bce47209a fix remaining links 2026-08-31 10:12:57 +02:00
ShatteredMINT af5a750031 link test 2026-08-31 10:10:10 +02:00
ShatteredMINT 8e0fdf0d28 start readme 2026-08-31 10:08:44 +02:00
5 changed files with 24 additions and 46 deletions
-21
View File
@@ -1,21 +0,0 @@
# Memory Map
To not have to allocate a ton of things at run time the Standard Library uses a static memory map for some purposes
## Overview
| Start | Use |
| ---- | ---- |
| `0x0` | Reset Vector |
| `0x16` | Zero Page |
| `0x100` | User Code |
| `?` | Library Code |
| `0x1_0000` | LUTs |
| `?` | heap |
| `0xXXF0_0000` | Stack |
| `0xXXFF_0000` | quick access |
## Zero Page
Some values are needed not often enough to get their own special register, but often enough that it makes sense to keep them at a quickly accessible location.
This is what the zero page is for. its position in memory allows us to load them into a register with a single instruction.
+1 -2
View File
@@ -3,8 +3,7 @@
This is a standard library for symphony.
It is both intended as a practical toolkit to develop more complex software as well as a teaching resource.
If you just want to use the standard library [[stdlib.asm]] is your main header, include it after your code.
You also need to include [[globals.asm]] as the first line in your assembly file.
If you just want to use the standard library [[src/stdlib.asm]] is your main header, include it after your code.
If you are using it as a learning resource have a look at the [teaching folder](teaching).
-10
View File
@@ -1,10 +0,0 @@
jmp 0x100
@0x10
screen:
frambuffer_ptr: U32 0x0
size: U32 0x0
position_xy: U32 0x0
mode: U32 0x0
@0x100
+22 -13
View File
@@ -6,20 +6,29 @@
; r1 - The lower 32 bits of the result
; Clobbers: r2, r3, r4, r5
pub mul_low:
mov r3, 0 ; result
mov r4, 31 ; loop counter
add r3, r2, r2 ; r3 = r2 * 2
mov r4, 0 ; r4 has the result
mul_low_loop:
asr r5, r2, 31
and r5, r5, r1
lsl r5, r5, r4
add r3, r3, r5
lsl r2, r2, 1
sub r4, r4, 1
cmp r4, 0
jge mul_low_loop
mov r1, r3
and r5, r1, 1 ; a0
neg r5, r5 ; mask
and r5, r2, r5 ; a0 ? r2 : 0
add r4, r4, r5
and r5, r1, 2 ; a1 is now 0 or 2
lsr r5, r5, 1 ; normalize to 0/1
neg r5, r5 ; mask
and r5, r3, r5 ; a1 ? r2 * 2 : 0
add r4, r4, r5
lsl r2, r2, 2
lsl r3, r3, 2
lsr r1, r1, 2
cmp r1, zr
jne mul_low_loop
mov r1, r4
jmp r13
; Calculates the absolute value of the value provided in the r1 register
+1
View File
@@ -1,5 +1,6 @@
pub include bit
pub include imath
pub include array
pub include console
; Needs to be last!