flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Porting fasm app to hobby OS's

Author
Thread Post new topic Reply to topic
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 04 May 2012, 13:42
Here is a way to make fasm APP's portable to most hobby OS.
Its called FBasic (Fasm Macro Basic), it use fasm macros to make a sort of basic language.
You just need to port the macros over to your OS functions.

Here is a GUI AND text mode example for DexOS.

This is a GUI example with background image:
Image

This is a text mode example:
Image

Here is the source code to each:
GUI example with background:
Code:
include "BasicG\FBasic_G.inc"

FONT_SIZE 2
SCREEN 800 600 32
LOAD_IMAGE file_area_Menu, MenuBuffer
SPRITE 128, 2, MenuBuffer

COLOR  0x0057ffff
LOCATE 150,30
PRINT "This app is written in Macro Basic, for DexOS "
COLOR  0x00ff5757
LOCATE 150,50
PRINT "With the ease of Basic and the power of ASM "
COLOR  0x00ffffff
LOCATE 150,70
PRINT "It user's the basic commands:"
PRINT " "
PRINT "  CLS"
PRINT "  SCREEN"
PRINT "  COLOR"
PRINT "  LOCATE"
PRINT "  PRINT"
PRINT "  GOSUB"
PRINT "  RETURN"
PRINT "  SLEEP"
PRINT "  END"
PRINT " "
GOSUB TestSub
SYNC
SLEEP
END

TestSub:
PRINT "Press any key to quit."
RETURN


align 4
file_area_Menu:
file   'ScrMenu\ScrMenu.dif'
file_area_Menu_FileEnd:
rd 1
align 4
include 'Dex.inc'
align 4
VesaBufferTemp: rd 800*600
align 4
MenuBuffer:     rd 544*512+2
align 4
VesaBuffer:                           
    


text mode:
Code:
include "BasicC\FBasic_C.inc"

SCREEN 0
CLS
COLOR  11
LOCATE 2,1
PRINT "This app is written in Macro Basic, for DexOS "
COLOR  12
LOCATE 2,2
PRINT "With the ease of Basic and the power of ASM "
COLOR  15
LOCATE 2,3
PRINT "It user's the basic commands:"
PRINT " "
PRINT "    CLS"
PRINT "    SCREEN"
PRINT "    COLOR"
PRINT "    LOCATE"
PRINT "    PRINT"
PRINT "    GOSUB"
PRINT "    RETURN"
PRINT "    SLEEP"
PRINT "    END"
PRINT " "
GOSUB TestSub
SLEEP
END

TestSub:
PRINT "  Press any key to quit."
RETURN

include 'Dex.inc'                      
    


Code input by:
Dex
rCX
Steve
TonyMac

We will release the includes when more macro functions added (if you want them now let me know), as we are still changing things and need more macros added.
Post 04 May 2012, 13:42
View user's profile Send private message Reply with quote
STLVNUB



Joined: 08 Aug 2008
Posts: 13
STLVNUB 04 May 2012, 22:53
Looking good
Post 04 May 2012, 22:53
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 15 May 2012, 15:25
Just for fun, i coded a linux ver of the FBasic demos:

Image

Same code, just different include
Code:
include 'FBasic_L.inc'
CLS
COLOR  11
LOCATE 2,1
PRINT "This app is written in Macro Basic, for Linux "
COLOR  12
LOCATE 2,2
PRINT "With the ease of Basic and the power of ASM "
COLOR  15
LOCATE 2,3
PRINT "It user's the basic commands:"
PRINT " "
PRINT "    CLS"
PRINT "    SCREEN"
PRINT "    COLOR"
PRINT "    LOCATE"
PRINT "    PRINT"
PRINT "    GOSUB"
PRINT "    RETURN"
PRINT "    SLEEP"
PRINT "    END"
PRINT " "
GOSUB TestSub
SLEEP
END

TestSub:
PRINT "  Press any key to quit."
RETURN                                    
    

Let me know if anyone wants the linux include.
Post 15 May 2012, 15:25
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 15 May 2012, 17:59
I can include these macros in FreshLib if you don't mind. It seems it will be easy to integrate them in the FreshLib structure. They can be used for debugging purposes and for quick sketching of console applications.
What about variables? Can I print for example value of eax register?
Post 15 May 2012, 17:59
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 15 May 2012, 19:17
JohnFound wrote:
I can include these macros in FreshLib if you don't mind. It seems it will be easy to integrate them in the FreshLib structure. They can be used for debugging purposes and for quick sketching of console applications.
What about variables? Can I print for example value of eax register?

Cool, the DexOS ver "can print for example value of eax register", that Stephen did, i will convert it to the Linux include and post you link to the includes.

Stephen is working on add more command, so will be able to keep you up dated.
Post 15 May 2012, 19:17
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 15 May 2012, 20:14
BTW, FreshLib is especially created to be portable. Do you think it can support DexOS?
It needs some low level and middle level functions to be supported by the OS:

1. dynamic memory allocations (heap).
2. Some basic graphics functions - lines and rectangles.
3. Basic windows functions - create, destroy, paint
4. file functions.
Post 15 May 2012, 20:14
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 16 May 2012, 12:19
JohnFound wrote:
BTW, FreshLib is especially created to be portable. Do you think it can support DexOS?
It needs some low level and middle level functions to be supported by the OS:

1. dynamic memory allocations (heap).
2. Some basic graphics functions - lines and rectangles.
3. Basic windows functions - create, destroy, paint
4. file functions.


Yes, the only one i see a problem is 1. "dynamic memory allocations (heap).", as in DexOS the App its self is in charge of memory allocations, and can use all memory from app load address, to top of memory (top of memory is amount of ram on sys, usable by a 32bit sys, less any drivers loaded).

But there's ways around this, i could use the same method as used in the fasm port.
Post 16 May 2012, 12:19
View user's profile Send private message Reply with quote
Stephen



Joined: 13 Aug 2011
Posts: 30
Stephen 16 May 2012, 14:42
Here's the file for the FASM macro basic that ran on DexOS 3
The stuff after that is lost. I've started working on updating and adding stuff.

home.comcast.net/~dex-os/FBasDx01.zip

It probably isn't going to work in DexOS 6 (pointers got renamed and a few are gone), but is what I'm cleaning up and taking off from. So it's a bit useless other then to look at.
Post 16 May 2012, 14:42
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.