OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 4:08 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: x86 Portable (ASM Source), version 2017-04-14
PostPosted: Sat Apr 15, 2017 9:12 am 
Offline
Member
Member
User avatar

Joined: Tue Mar 06, 2007 11:17 am
Posts: 1225
This is the second version of x86 Portable, a NASM/YASM source-only project which allows writing x86 assembly source code that can be directly and easily ported to 16, 32 and 64-bit modes with little to no changes, thanks mainly to the added capability to select CPU register and stack push/pop sizes automatically and manually.

What's New
I have added the keyword "_CALL_STACK_ADDR_SZ_", which allows calculating the address of the on-stack function parameters after/above the on-stack return address of a function call. It will allow us to use a portable value to skip a 2, 4 or 8-byte return address automatically without modifying the stack frame code of the function in any other way.

I have also added an "align 16" directive near the end of the source file. In this way we can include this file at any point of the program without the need to write a jump label because it already includes one to avoid accidentally executing the code inside "00000000__x86_Portable.asm".


Source Code File:
http://www.archefire.org/_PROJECTS_/x86_Portable/v2017-04-14/src/00000000__x86_Portable.asm

Text Recording (to see how the file has been typed/developed over time):
http:///www.archefire.org/_PROJECTS_/x86_Portable/v2017-04-14/SourceDoc/src/00000000__x86_Portable.asm.html



Current Keywords:
Code:
Automatic size selection for data/variables:
-------------------------------------------------------------------------
wideword    -- Automatic size selection, 2, 4 or 8 bytes.
ww          -- Automatic size selection, define wideword, 2, 4 or 8 bytes.
wideword_SZ -- Automatic size selection, 2, 4 or 8.




Automatic size selection for any on-stack call return addresses:
-------------------------------------------------------------------------
_CALL_STACK_ADDR_SZ_ -- 2, 4 or 8.




Automatic size selection for CPU registers:
-------------------------------------------------------------------------
wideax -- 2, 4 or 8 bytes.
widebx -- 2, 4 or 8 bytes.
widecx -- 2, 4 or 8 bytes.
widedx -- 2, 4 or 8 bytes.
widesi -- 2, 4 or 8 bytes.
widedi -- 2, 4 or 8 bytes.
widesp -- 2, 4 or 8 bytes.
widebp -- 2, 4 or 8 bytes.




Automatic size selection for "Address" and "Operand" prefixes:
-------------------------------------------------------------------------
awide -- a16, a32 or nothing.
owide -- a16, a32 or nothing.




Automatic size selection for CPU instructions:
-------------------------------------------------------------------------
cmpswide -- 2, 4 or 8 bytes.
lodswide -- 2, 4 or 8 bytes.
stoswide -- 2, 4 or 8 bytes.
movswide -- 2, 4 or 8 bytes.
inswide  -- 2 or 4 bytes.
outswide -- 2 or 4 bytes.




Automatic variable or register selection for 64-bit CPU r8-r9 registers:
-------------------------------------------------------------------------
_r8  -- 2, 4 or 8 bytes.
_r9  -- 2, 4 or 8 bytes.
_r10 -- 2, 4 or 8 bytes.
_r11 -- 2, 4 or 8 bytes.
_r12 -- 2, 4 or 8 bytes.
_r13 -- 2, 4 or 8 bytes.
_r14 -- 2, 4 or 8 bytes.
_r15 -- 2, 4 or 8 bytes.



_________________
Live PC 1: Image Live PC 2: Image

YouTube:
http://youtube.com/@AltComp126/streams
http://youtube.com/@proyectos/streams

http://master.dl.sourceforge.net/projec ... 7z?viasf=1


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 26 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group