Author Topic: NASM Learners Library for 32-bit and 64-bit Linux  (Read 46654 times)

Offline stressful

  • Full Member
  • **
  • Posts: 105
  • Country: 00
    • CPU2.0
Re: NASM Learners Library for 32-bit and 64-bit Linux
« Reply #15 on: August 07, 2016, 07:06:39 PM »
I uploaded the latest version of the library (August 7th update). Please ignore the previous uploads and use this one instead.

Fixed some minor bugs, added some more routines, improved the documentation and also included the static object version for beginners convenience.

If there's no more fatal bugs then take this as the final version.

Good luck.

Offline stressful

  • Full Member
  • **
  • Posts: 105
  • Country: 00
    • CPU2.0
Re: NASM Learners Library for 32-bit and 64-bit Linux
« Reply #16 on: August 20, 2016, 12:08:25 AM »
Sep 14th, 2016 Update

Revision 2.6. Some changes

- change "newline" to "prnline" to avoid potential nameclash with other foreign libs
- "dumpreg" now takes one argument. Other dumpregxx are deleted.
- introduced few more routines
- Documentation format is open and configurable to your needs

Please ignore the other attachments and pick this latest versions.

Code: [Select]
LIST OF ROUTINES
Notes   : The number in braces shows the # of arguments required     
        : /Followed by the return value(s) (if applicable)     
        : The list is for 64-bit versions only
------------------------------------------------------------------
Routines(167)           Descriptions
------------------------------------------------------------------
prnline         - Print a new line
halt            - Pause screen     
prnstreg(1)     - Display short string off RAX   
prnreg(1)       - Display register (hex)     
prnregd(1)      - Display register (decimal)     
prnregdu(1)     - Display register (unsigned decimal)     
dumpreg(1)      - Display register dump (hex)
dumpseg         - Display segment registers dump (hex)
stackview(1)    - Display stack
memview(2)      - Display memory dump   
memviewc(2)     - Display memory dump, emphasis on string
mem_reset(2)    - Reset memory content
mem_set(3)      - Fill up memory content 
mem_insertr(2)  - Insert register content into memory
mem_copy(3)     - Copy memory block
mem_load(1)/2   - Load a file to memory
opcode(2)       - Display encoding between 2 labels
opsize(2)/1     - Get code size between 2 labels.
flags(1)        - Display RFLAG     
prnint(1)       - Display signed integer     
prnintu(1)      - Display unsigned integer     
prnhex(1)       - Display hexadecimal     
prnhexu(1)      - Display unsigned hexadecimal     
prnoct(2)       - Display octal     
prnoctu(2)      - Display unsigned octal     
prnbin(1)       - Display signed binary     
prnbinu(1)      - Display unsigned binary     
prnbinf(3)      - Display formatted binary     
prnbinb(1)      - Display binary with byte separators     
fpbin(1)        - Display 64-bit Floating Point binary     
fpbind(1)       - Display 32-bit Floating Point binary     
prndbl(1)       - Display 64-bit precision value
prndblr(1)      - Display 64-bit precision value (rounded) 
prndble(2)      - Display 64-bit precision with decimal places     
prndblx(1)      - Display 80-bit precision value     
prnflt(1)       - Display 32-bit float value
prnfltr(1)      - Display 32-bit float value (rounded) 
dblsplit(1)/2   - Split a real8 into parts.
fpdinfo(1)      - Display Double binary information     
fpfinfo(1)      - Display Float binary information     
dec2str(2)      - Convert signed decimal to 0-ended string.     
dec2stru(2)     - Convert unsigned decimal to 0-ended string.     
hex2str(2)      - Convert signed hex to 0-ended string.
hex2stru(2)     - Convert signed hex to 0-ended string.
bin2str(2)      - Convert signed binary to 0-ended string.
bin2stru(2)     - Convert unsigned binary to 0-ended string.
dbl2str(3)      - Convert double to 0-ended string.
readint/1       - Get an integer from kboard.
readdbl/1       - Get a double from kboard.
readflt/1       - Get a float from kboard.
fpu_stack       - Display FPU stack     
fpu_sflag       - Display FPU Status flag   
fpu_cflag       - Display FPU Control flag     
fpu_tag         - Display FPU Tag Word status     
fpu_reg(1)      - Display one FPU register     
fpu_copy(1)/1   - Copy a FPU register.
fpu_precision(1)- Set FPU precision 
fpu_round(1)    - Set FPU rounding control. 
sse_round(1)    - Set SSE rounding control. 
sse_flags       - Display SSE flags     
prnmmx(2)       - Display one MMX register.     
dumpmmx(1)      - Display MMX dump.     
prnxmm(2)       - Display one XMM register.     
dumpxmm(1)      - Display XMM dump.     
clearxmm        - Clear all xmm registers     
prnymm(2)       - Display one yMM register.     
dumpymm(1)      - Display yMM dump.     
clearymm        - Clear all ymm registers     
prnintd(2)      - Display 32-bit integer     
prnintw(2)      - Display 16-bit integer     
prnintb(2)      - Display byte integer     
str2int(1)/1    - Convert 0-ended string to integer.
str2dbl(1)/1    - Convert 0-ended string to double.
str2flt(1)/1    - Contert 0-ended string to float.
dbl2int(1)/1    - Convert double to integer.
int2dbl(1)/1    - Convert integer to double.
isint(1)/1      - Check if an FP is a qualified integer.
digitprob(2)/1  - Extract digit from a signed integer
digitprobu(2)/1 - Extract digit from a signed integer
digithprob(2)/1 - Extract digit from a signed integer
digithprobu(2)/1- Extract digit from a signed integer
digitscan(2)/1  - Extract digit from a signed integer
digitscanu(2)/1 - Extract digit from a signed integer
digithscan(2)/1 - Extract digit from a signed integer
digithscanu(2)/1- Extract digit from a signed integer
digitcount(1)/1  - Extract digit from a signed integer
digitcountu(1)/1 - Extract digit from a signed integer
digithcount(1)/1 - Extract digit from a signed integer
digithcountu(1)/1- Extract digit from a signed integer
rndigit(1)/1    - Get one random digit of normal bases.
rndint(1)       - Generate 1 random integer.
factorial(1)/1  - Get factorial.
powint(2)/1     - Calculate x ^ n (Integer).
pow2(1)/1       - Calculate 2 ^ n (Integer).
iseven(1)/1     - Check if a number is even.
isodd(1)/1      - Check if a number is odd.
bconv(2)        - Convert & display from normal bases to other bases     
bitfield(3)     - Extract bitfield of a given data
addf(2)/1       - Floating Point ADD     
subf(2)/1       - Floating Point SUB     
mulf(2)/1       - Floating Point MUL     
divf(2)/1       - Floating Point DIV     
sqroot(1)/1     - Get square root.
fcalc(3)/1      - Two-operands floating point calculator
rad2deg(1)/1    - Convert radian to degree.
deg2rad(1)/1    - Convert degree to radian.
sine(1)/1       - Get sine of a radian.
tangent(1)/1    - Get tangent of a radian.
cosine(1)/1     - Get cosine of a radian.
sincos(1)/2     - Get Sine and Cosine.
atangent(1)/1   - Get arc-tangent of a radian.
log10(1)/1      - Get a common log for a FP value
ln10(1)/1       - Get a natural log for a FP value     
pow(2)/1        - Calculate x ^ n (precision).
chr_isdigit(1)/1- Check if a char byte is a digit.
chr_isalpha(1)/1- Check if a char is an alphabet.
chr_islower(1)/1- Check if a char is a lower case.
chr_isupper(1)/1- Check if a char is an upper case.
chr_chcase(1)/1 - Change a char's case.
chr_toupper(1)/1- Convert a char to uppercase.
chr_tolower(1)/1- Convert a char to lowercase.
chr_find(2)/1   - Find a char from a 0-ended string.
chr_count(2)/1  - Count a char from a 0-ended string.
chr_shuffle(1)  - Shuffle a 0-ended string   
ascii(1)        - Simple ascii byte conversion   
str_copy(3)     - Copy a string to another string     
str_length(1)/1 - Find string length.     
str_cmpz(2)/1   - Compare 2 0-ended strings.
str_cmps(3)/1   - Compare 2 strings, with size.
str_toupper(1)  - Up the case of a 0-ended string
str_tolower(1)  - Lower the case of a 0-ended string
str_reverse(1)  - Reverse a 0-ended string
str_trim(2)     - Trim a 0-ended string     
str_wordcnt(1)/1- Word count of a 0-ended string     
str_token(2)    - Display tokens off a 0-ended string   
str_find(3)/1   - Find a sub-string from a 0-ended string
str_findz(2)/1  - Find a sub-string from a 0-ended string
str_append(5)/1 - Appends two 0-ended strings, with size
str_appendz(4)/1- Appends two 0-ended strings
sort_int(2)     - Sort integer
sort_byte(3)    - Sort char/byte array
sort_dbl(3)     - Sort double   
sort_dblx(3)    - Sort real10   
sort_flt(3)     - Sort integer   
;-----   OS SPECIFICS   -----
prnchr(1)       - Display char in AL
prnchrs(1)      - Display a character from the stack     
prnchar(1)      - Display a character variable     
prnstr(2)       - Display string with size     
prnstrz(1)      - Display 0-ended string     
prnstrd(2)      - Display delimiter-ended string
readch/1        - Get a char from kboard. Return in AL
readchr(1)      - Get a character and save to variable     
readstr(1)/1    - Get a string with size
delay(1)        - Delay execution in milliseconds.
mem_alloc(1)/1  - Get memory
mem_free(1)/1   - Release memory
timer_start     - Start a timer (win only)   
timer_stop/1    - Stop a timer (win only)
file_new(1)     - Create a new file
file_open(2)    - Open a file with options for read or write
file_read(3)/1  - Read from an opened file
file_write(3)/1 - Write to an opened file
file_close(1)   - Close file handle
file_size(1)/1  - Get file size
file_copy(2)    - Copy a file to a new file
exitp           - Pause before exit to system
exit            - Exit to system

Happy learning and good luck.
« Last Edit: September 14, 2016, 01:57:51 PM by stressful »

Offline stressful

  • Full Member
  • **
  • Posts: 105
  • Country: 00
    • CPU2.0
Re: NASM Learners Library for 32-bit and 64-bit Linux
« Reply #17 on: September 09, 2016, 02:14:26 AM »
Updated the library. See previous post.

Offline gabios

  • New Member
  • Posts: 1
Re: NASM Learners Library for 32-bit and 64-bit Linux
« Reply #18 on: November 01, 2017, 12:45:43 AM »
that's cool

Offline stressful

  • Full Member
  • **
  • Posts: 105
  • Country: 00
    • CPU2.0
Re: NASM Learners Library for 32-bit and 64-bit Linux
« Reply #19 on: November 10, 2017, 05:58:13 PM »
that's cool
Thanks for the kind words. Please use the updated version (Revision 2.6) here.

https://forum.nasm.us/index.php?topic=2269.msg10727#msg10727

Thanks.

Offline PLuto

  • New Member
  • Posts: 1
Re: NASM Learners Library for 32-bit and 64-bit Linux
« Reply #20 on: December 15, 2017, 08:16:28 PM »
Perfect for newbies like me, thanks ! :)