flat assembler
Message board for the users of flat assembler.
Index
> Tutorials and Examples > BASELIB: General purpose libs for beginners Goto page 1, 2, 3, 4, 5, 6, 7 Next |
Author |
|
fasmnewbie 03 May 2015, 05:33
This is BASELIB, a set of general-purpose library intended for absolute beginners, each for linux and windows, that I hope can help newbies with their assembly programming at the earliest learning curve.
NOTE: I am migrating my BASELIB/CPULIB project to Sourceforge now as the files are getting larger in size. You can download the updates and other goodies from CPU2.0 Good luck and enjoy your coding. Last edited by fasmnewbie on 21 Dec 2018, 10:39; edited 331 times in total |
|||
03 May 2015, 05:33 |
|
fasmnewbie 04 May 2015, 16:24
Alternative download sites;
1. CPU2.0 Hope you'd find them useful and helpful in your entire assembly learning phases. Regards Last edited by fasmnewbie on 21 Dec 2018, 10:40; edited 20 times in total |
|||
04 May 2015, 16:24 |
|
fasmnewbie 04 May 2015, 16:38
I added the Windows DLL versions of the library (base6.zip and base3.zip)
This version also includes a template file (each) so that you can re-compile the DLL source in case you have made any changes. Includes 4 sample files on how to access and use the library. Last edited by fasmnewbie on 05 Apr 2016, 13:30; edited 9 times in total |
|||
04 May 2015, 16:38 |
|
80286 04 May 2015, 17:15
Hello fasmnewbie,
thanks for your detailed answer. Yes, I am actually trying to work with Windows 8.1 64bit, straight from a long time with XP 32bit Those instructions after the 80286 are new to me, so it will become an interesting activity to make things work as I want them to (I hope there will still be enough time for me to learn all that is needed). Your Routines #19 (getstr) and #20 (getstrz) work as expected and don't close the program. That's what I needed for the moment. Still there is some trouble with Cursor Up, but maybe that is because of the local keyboarddriver. I will handle that later. I will test more of your Routines and give you a feedback. I am quite excited what awaits me with these mysterious xmm-Registers |
|||
04 May 2015, 17:15 |
|
fasmnewbie 05 May 2015, 13:26
Here I included the 32-bit library stack version for the sake of beginners who'd have to rely on other assembler source codes for 32-bit examples or to be used along with textbooks / reference that are using 32-bit code.
They are directly adapted from the register-based versions so you might expect some minor bugs in there. If you found none, then praise the lord xD Last edited by fasmnewbie on 23 Mar 2016, 14:13; edited 8 times in total |
|||
05 May 2015, 13:26 |
|
fasmnewbie 05 May 2015, 13:31
Just managed to get my hand on a Linux PC... so this is the Linux SO for 64-bit. I cut down the complicated steps in producing the SO so beginners don't have to play with gcc and other configuration headaches. Read the PDF file on how to access and where to place the library
Last edited by fasmnewbie on 05 Apr 2016, 13:31; edited 6 times in total |
|||
05 May 2015, 13:31 |
|
80286 05 May 2015, 16:32
Hello fasmnewbie,
thanks again for your examplecode. To get a better overwiew I found these tables about the registers on wikipedia: Now it is more clear to me with what I can work. (Somehow I conider this as the "fingers", with wich I will form the code.) Still there are so many fundamentals/basics I have to get to know. So it might take some more days to get my very first real 64bit-assembler-program running (not only compiling examples and ready-to-use-sources). What a luck FASM is available, Tomasz Grysztar is still active after all these years, and also this forum that's like a treasure chest, esp. for newcomers. |
|||
05 May 2015, 16:32 |
|
fasmnewbie 05 May 2015, 18:55
remove post
Last edited by fasmnewbie on 22 May 2015, 04:57; edited 2 times in total |
|||
05 May 2015, 18:55 |
|
fasmnewbie 05 May 2015, 19:11
80286
Good luck to you. There are a bunch of people on this board who can help you with that. Most of them are 5-star programmers (most are my gurus). Stay longer and you can identify who they are. NOT me though. I am quite hopeless in assembly and have the tendency to lose my index register somewhere in the middle. Hahaha!! |
|||
05 May 2015, 19:11 |
|
80286 05 May 2015, 19:16
Hello fasmnewbie,
I was just experimenting with doubles and singles and xmm0. (Subnote: As I tried to code a subroutine for zeroing the doubles-buffer I remarked: There is no DS- and no ES-Register anymore - strange, if you usually used DS:SI and ES:DI for these lods/stos-things) Using your routines #11 (prtdbl) and #12 (prntflt) for inputs 256.554 I got the outputs 256.5439999999999 and 256.5439 I suggest it could only be a fault in presentation because no operations on the values are made. But how could I get a more exact output if ever possible? My complete code (except your routines) actually is: Code: format PE64 console include 'win64axp.inc' jmp codestart ;<place data here> align 64 string1: db 'Testtext#1',0 string2: db 'Danke für Ihre Eingabe!',0 inputbuffer1: db 1024 dup(0) align 64 doubles1: db 227 dup(0) ;<place code here> align 64 codestart: call zerodoubles1 ; Speicher fuer Doubles loeschen mov rcx,256.554 ; MUSS mit Dezimaltrennzeichen geschrieben werden, sonst falscher Wert! movq xmm0,rcx ; NO DIRECT IMMIDIATE call prtdbl call newline call newline call zerodoubles1; Speicher fuer Doubles loeschen mov ecx,256.5540 ; MUSS mit Dezimaltrennzeichen geschrieben werden, sonst falscher Wert! movd xmm0,ecx ; NO DIRECT IMMIDIATE call prtflt call newline call newline call exitp zerodoubles1: pushf push rax push rcx push rdi mov rdi,doubles1 sub al,al mov rcx,227 cld rep stosb pop rdi pop rcx pop rax popf ret I don't know wether the zeroing-subroutine is working as it should; used to manage to handle a disassembler for those purposes. edit: Just saw your new lib and will have a look at it. |
|||
05 May 2015, 19:16 |
|
fasmnewbie 05 May 2015, 20:03
post removed
Last edited by fasmnewbie on 28 May 2015, 14:32; edited 1 time in total |
|||
05 May 2015, 20:03 |
|
80286 05 May 2015, 20:28
Thanks again, fasmnewbie. I will heed your advices.
|
|||
05 May 2015, 20:28 |
|
fasmnewbie 05 May 2015, 20:32
post removed
Last edited by fasmnewbie on 28 May 2015, 14:33; edited 1 time in total |
|||
05 May 2015, 20:32 |
|
fasmnewbie 13 May 2015, 15:04
remove post.
|
|||
13 May 2015, 15:04 |
|
fasmnewbie 23 May 2015, 12:58
post removed
Last edited by fasmnewbie on 26 May 2015, 21:30; edited 1 time in total |
|||
23 May 2015, 12:58 |
|
fasmnewbie 26 May 2015, 20:08
1. I updated my comment in Post #1 to reflect the new update and notes.
2. Notes to beginners on align and unalign data while using SSE-related routines; All SSE-based routines are unaligned because I intend to make those routines to be as flexible as possible in aligned and non-aligned situations. To use aligned instructions (like movdqa, you need to explicitly align your data to be used by the SSE instructions, failure of which will give you segment fault error. Example; Code: format ELF64 executable 3 ;Linux example movdqa xmm3,dqword[x] ;aligned transfer instruction movdqa xmm1,dqword[y] ;aligned transfer instruction divps xmm1,xmm3 mov rax,8 ;option to display 4 packed singles. call dumpxmm ;dump xmm register in packed single format (rax=0). call exit align 16 ;---------> use align 16 x dd 34.557,0.034,-74.323,1.001 y dd 0.23,5.34,7.77,-3.023 Producing this output; Code: XMM0 : 0.0|0.0|0.0|0.0 XMM1 : -3.019980|-0.104543|157.0588|0.006655 XMM2 : 0.0|0.0|0.0|0.0 XMM3 : 1.001000|-74.32300|0.034000|34.55700 XMM4 : 0.0|0.0|0.0|0.0 XMM5 : 0.0|0.0|0.0|0.0 XMM6 : 0.0|0.0|0.0|0.0 XMM7 : 0.0|0.0|0.0|0.0 XMM8 : 0.0|0.0|0.0|0.0 XMM9 : 0.0|0.0|0.0|0.0 XMM10: 0.0|0.0|0.0|0.0 XMM11: 0.0|0.0|0.0|0.0 XMM12: 0.0|0.0|0.0|0.0 XMM13: 0.0|0.0|0.0|0.0 XMM14: 0.0|0.0|0.0|0.0 XMM15: 0.0|0.0|0.0|0.0 If you opted for un-aligned instruction, you can skip the "align 16" part as shown by another example below; Code: format PE64 console ;windows example include 'win64axp.inc' movdqu xmm1,dqword[x] ;unalign transfer movdqu xmm0,dqword[y] ;unalign transfer divpd xmm0,xmm1 mov rax,9 ;option to display as 2 packed doubles call dumpxmm call exitp x dq 34.557,0.034 ;align 16 is missing but recommended y dq 0.23,5.34 Which produces this output; Code: XMM0 : 157.0588235294117|0.006655670341754 XMM1 : 0.033999999999999|34.55700000000000 XMM2 : 0.0|0.0 XMM3 : 0.0|0.0 XMM4 : 0.0|0.0 XMM5 : 0.0|0.0 XMM6 : 0.0|0.0 XMM7 : 0.0|0.0 XMM8 : 0.0|0.0 XMM9 : 0.0|0.0 XMM10: 0.0|0.0 XMM11: 0.0|0.0 XMM12: 0.0|0.0 XMM13: 0.0|0.0 XMM14: 0.0|0.0 XMM15: 0.0|0.0 I hope these 2 examples can clear some confusions while using the supplied SSE-based routines. Good luck. Last edited by fasmnewbie on 17 Jun 2015, 00:41; edited 2 times in total |
|||
26 May 2015, 20:08 |
|
revolution 27 May 2015, 00:31
If you are concerned about performance then using unaligned transfers will hurt you. Even using MOVDQU on aligned data can hurt performance.
|
|||
27 May 2015, 00:31 |
|
fasmnewbie 28 May 2015, 14:40
revolution wrote: If you are concerned about performance then using unaligned transfers will hurt you. Even using MOVDQU on aligned data can hurt performance. Off topic: Revo, if I remove my old posts / attachments, will it help reduce the site load or regain the site quota in some way? I see Haha doing it a lot. |
|||
28 May 2015, 14:40 |
|
revolution 28 May 2015, 15:16
fasmnewbie wrote: Off topic: Revo, if I remove my old posts / attachments, will it help reduce the site load or regain the site quota in some way? I see Haha doing it a lot. I would request that you don't remove or destroy your old posts. It makes the board less useful and hard to follow. Some other people have deleted/destroyed old posts, but the reason was not to help improve the site. |
|||
28 May 2015, 15:16 |
|
Goto page 1, 2, 3, 4, 5, 6, 7 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.