flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > RAD for MenuetOS?

Author
Thread Post new topic Reply to topic
FlierMate



Joined: 21 Jan 2021
Posts: 219
FlierMate
Hi, I just throw an interesting idea on here, to build a RAD (rapid application development) tool for MenuetOS 64!

Currently I have this very primitive "RAD" tool written in Linux x64, when you run "./m64-rad", it accepts a one-liner text string input from screen, and then generates a MSGBOX.ASM customized with the text string that user just entered.

I know this is far from an interesting RAD tool. Any more idea? We can start working on this together, hopefully a RAD tool on MenuetOS for MenuetOS.

Below is the "m64-rad.asm" (Linux ELF64) that I have just mentioned above.

Code:
format ELF64 executable 3

segment readable executable

entry $

      mov     rdx,48
      mov     rsi,buffer      
      xor     edi,edi    ; STDIN
      xor     eax,eax    ; sys_read
      syscall
      cmp     eax,-1
      je      _err

      mov     eax, 85     ;sys_creat
      lea     rdi, [fn]
      mov     rsi, 444    ;modes: u=rw, g=r, o=r
      syscall
      cmp     eax, -1
      je      _err
      mov     dword [fd],eax
      
      mov     rdx,m64_1_len
      lea     rsi,[m64_1]
      call    sys_write

      mov     rdx,m64_2_len
      lea     rsi,[m64_2]
      call    sys_write
      
      mov     rdx,1
      lea     rsi,[quote]
      call    sys_write
      
      mov     edx,len
      lea     rsi,[title]
      call    sys_write

      mov     rdx,1
      lea     rsi,[quote]
      call    sys_write
      
      mov     rdx,1
      lea     rsi,[newline]
      call    sys_write
            
      mov     rdx,m64_3_len
      lea     rsi,[m64_3]
      call    sys_write

      mov     rdx,1
      lea     rsi,[quote]
      call    sys_write
     
      lea     rdi,[buffer]
      mov     ecx, 64  
      xor     eax, eax  
      repnz   scasb     ; scan for null character to get length of buffer
      mov     edx, 64 
      sub     edx, ecx
      dec     edx       ; remove last null character
      dec     edx       ; remove linefeed 
      lea     rsi,[buffer]
      call    sys_write

      mov     rdx,1
      lea     rsi,[quote]
      call    sys_write

      mov     rdx,1
      lea     rsi,[newline]
      call    sys_write

      mov     rdx,m64_4_len
      lea     rsi,[m64_4]
      call    sys_write
      
      mov     edi,dword [fd]
      mov     eax,3    ; sys_close
      syscall      

_err:
      xor     edi,edi
      mov     eax,60   ; sys_exit
      syscall

sys_write:
      mov     edi,dword [fd]
      mov     eax,1    ; sys_write
      syscall
      ret      

segment readable writable

quote    db      39
newline  db      10
fd     dd      ?
fn     db      'MSGBOX.ASM',0     ; Output filename for compilation with MenuetOS flat assembler
m64_1  db      'use64',10,\
               '      org   0x0',10,\
               '      db   ',39,'MENUET64',39,10,\
               '      dq    0x01',10,\
               '      dq    START',10,\
               '      dq    image_end',10,\
               '      dq    0x100000',10,\
               '      dq    0xffff0',10,\
               '      dq    0x00',10,\
               '      dq    0x00',10,\
               'START:',10,\
               '      call  draw_window',10,\
               'still:',10,\
               '      mov   rax , 10          ; Wait here for event',10,\
               '      int   0x60',10,\
               '      test  rax , 1           ; Window redraw',10,\
               '      jnz   window_event',10,\
               '      test  rax , 2           ; Keyboard press',10,\
               '      jnz   key_event',10,\
               '      test  rax , 4           ; Button press',10,\
               '      jnz   button_event',10,\
               '      jmp   still',10,\
               'window_event:',10,\
               '      call  draw_window',10,\
               '      jmp   still',10,\
               'key_event:',10,\
               '      mov   rax , 2          ; Read the key and ignore',10,\
               '      int   0x60',10,\
               '      jmp   still',10,\
               'button_event:',10,\
               '      mov   rax , 17',10,\
               '      int   0x60',10,\
               '      ; rax = status',10,\
               '      ; rbx = button id',10,\
               '      cmp   rbx , 0x10000001',10,\
               '      jne   no_application_terminate_button',10,\
               '      mov   rax , 0x200',10,\
               '      int   0x60',10,\
               '    no_application_terminate_button:',10,\
               '      cmp   rbx , 0x106',10,\
               '      jne   no_application_terminate_menu',10,\
               '      mov   rax , 0x200',10,\
               '      int   0x60',10,\
               '    no_application_terminate_menu:',10,\
               '      jmp   still',10,\
               'draw_window:',10,\
               '      mov   rax , 12                           ; Beginning of window draw',10,\
               '      mov   rbx , 1',10,\
               '      int   0x60',10,\
               '      mov   rax , 0                            ; Draw window',10,\
               '      mov   rbx , 256 shl 32 + 384             ; X start & size',10,\
               '      mov   rcx , 128 shl 32 + 128             ; Y start & size',10,\
               '      mov   rdx , 0x0000000000FFFFFF           ; Type    & border color',10,\
               '      mov   r8  , 0x0000000000000001           ; Flags (set as 1)',10,\
               '      mov   r9  , window_label                 ; 0 or label - asciiz',10,\
               '      mov   r10 , 0                            ; 0 or pointer to menu struct',10,\
               '      int   0x60',10,\
               '      mov   rax , 4                            ; Display text',10,\
               '      mov   rbx , text                         ; Pointer to text',10,\
               '      mov   rcx , 32                           ; X position',10,\
               '      mov   rdx , 64                           ; Y position',10,\
               '      mov   rsi , 0x000000                     ; Color',10,\
               '      mov   r9  , 1                            ; Font',10,\
               '      int   0x60',10,\
               '      mov   rax , 12                           ; End of window draw',10,\
               '      mov   rbx , 2',10,\
               '      int   0x60',10,\
               '      ret',10,\
               '; Data area',10
m64_1_len      = $ - m64_1
m64_2  db      'window_label:',10,\
               '      db    '                 ;'Title'               
m64_2_len      = $ - m64_2               
m64_3  db      '      db    0',10,\
               'text:',10,\
               '      db    '                 ;'Message'
m64_3_len      = $ - m64_3               
m64_4  db      '      db    0',10,\ 
               'image_end:'
m64_4_len      = $ - m64_4
title  db   ''
len            = $ - title
buffer rb   64
    


Description: Generated and compiled MSGBOX.ASM
Filesize: 339.54 KB
Viewed: 932 Time(s)

Screenshot_2022-01-03_08-20-00.png


Post 03 Jan 2022, 00:27
View user's profile Send private message Reply with quote
al_Fazline



Joined: 24 Oct 2018
Posts: 19
al_Fazline
I do not think, that MenuetOS64 worths your time and effort, given it is a proprietary system, which you can't extend or anything.

There is KolibriOS, which is going to be better. The purpose of an OS which fits on a floppy is to run it on old or low power computers. Modern computers use UEFI or CoreBoot and do not have floppy drives, which makes M64 pointless, since it boots from floppy and does not have UEFI bootloader in it.
There are only rather few computer which have x86_64 capable CPU, BIOS and floppy drive in the same time.

It seems that KolibriOS sees much more active development than Menuet and it can already be loaded from UEFI among other things, so it's not limited to floppies.

Though, I also do not think that RAD is a good idea in general, but if you must, I'd suggest you to take Lazarus and see if you can replace the Free Pascal RTL with your own and also replace LCL (Lazarus component library). Plus you'd need to find or write a linker which can produce KolibriOS or MenuetOS (if you must) executables, then you should be good to go and could even try to recompile Lazarus with your libraries and linker, making it run on Kolibri or Menuet, whichever you decide to use.
Post 07 Jan 2022, 03:22
View user's profile Send private message Reply with quote
FlierMate



Joined: 21 Jan 2021
Posts: 219
FlierMate
Thank you for the comment, it is nice to read other opinion from people . Actually MenuetOS 64 is supposed to boot from USB stick although it is in floppy FAT12 image. I know it is difficult to create useful RAD tool for it, let alone to compete with Lazarus.
Post 07 Jan 2022, 13:12
View user's profile Send private message 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.