flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Ville 10 Aug 2019, 13:51
Menuet64 accepts both headers: MENUET01, which starts the application in 32bit mode, and MENUET64, for default 64bit app mode. You can use both 32bit and 64bit system calls (int 0x40 and int 0x60) from both modes. Same applies for the 32/64bit mode switcher, which the app can use from both modes, regardless the original application mode. The 32bit system calls (int 0x40) were added, so that 32bit apps could run out-of the-box in M64 with the new 64bit apps. Also porting 32bit apps is much simpler since the app can choose between 32bit and 64bit code execution.
|
|||
![]() |
|
ProMiNick 10 Aug 2019, 15:48
Thanks. Informative.
That should bu publicated somewhere on menuet oficial site not only here on forum. In some more scientific notation. If syscals could be used from every mode that not answer the question: Why in fasm so many switches? Switch could be only one in start of program switch to 32 and whole rest code could be grabed from menuet32 unchanged. Or initialy it was so? But with time more parts recoded to 64? Or there some system limitation that some things could be realized only in 32 bit mode and some only in 64 bit? |
|||
![]() |
|
ProMiNick 10 Aug 2019, 18:07
As I understand Villy, It is thours fasm port to Menuet32
under thour copyright? http://websvn.kolibrios.org/filedetails.php?repname=Kolibri+OS&path=%2Fprograms%2Fdevelop%2Ffasm%2Ftrunk%2Ffasm.asm&peg=1052 that is not good that such source dont exists in somewhere in http://www.menuetos.net/ It seemed that in menuet M32-086.IMG even more ancient fasm port version. Why? I comparing fasm (M32-086.IMG) after unpacking they are almost identic exept that in source maked optimizations to reduce output size. |
|||
![]() |
|
Ville 11 Aug 2019, 04:52
Fasm was originally a fully 32bit application running in M64. However, I started adding features, like the new window frames and scrollbars., which exist only in the 64bit version.
|
|||
![]() |
|
ProMiNick 11 Aug 2019, 07:03
Are thou use syscalls by numbers or they have standard names?
Because syscalls both 64 and 32 could be used withing single application their name should be unique. Code: ; MenuetOS system functions(int $40): SF_TERMINATE_PROCESS=-1 SF_CREATE_WINDOW=0 ; define and draw the window SF_PUT_PIXEL=1 ; draw pixel to the window SF_GET_KEY=2 ; get code of the pressed key SF_GET_SYS_TIME=3 SF_DRAW_TEXT=4 SF_SLEEP=5 ; pause process SF_PUT_IMAGE=7 ; draw image to the window SF_DEFINE_BUTTON=8 ; define/delete the button SF_THREAD_INFO=9 ; information on execution thread SF_WAIT_EVENT=10 ; wait for event SF_CHECK_EVENT=11 ; check for event and return SF_REDRAW=12 SSF_BEGIN_DRAW=1 SSF_END_DRAW=2 SF_DRAW_RECT=13 ; draw rectangle to the window SF_GET_SCREEN_SIZE=14 ; get screen resolution SF_BACKGROUND_SET=15 ; work with desktop background graphics SSF_SIZE_BG=1 ; set a size of the background image SSF_PIXEL_BG=2 ; put pixel on the background image SSF_REDRAW_BG=3 ; redraw background SSF_MODE_BG=4 ; set drawing mode for the background SSF_IMAGE_BG=5 ; put block of pixels on the background image SF_RD_TO_FLOPPY=16 ; save ramdisk on the floppy SF_GET_BUTTON=17 ; get ID of the pressed button SF_SYSTEM=18 SSF_UNFOCUS_WINDOW=1 ; take focus from the window of the given thread SSF_TERMINATE_THREAD=2 ; terminate process/thread by the slot number SSF_FOCUS_WINDOW=3 ; give focus to the window of the given thread SSF_GET_IDLE_COUNT=4 ; get counter of idle cycles per second SSF_GET_CPU_FREQUENCY=5 ; get CPU clock rate SF_MIDI=20 SSF_RESET=1 SSF_OUTPUT=2 SF_SYSTEM_SET=21 SSF_MPU_MIDI_BASE=1 SSF_KEYBOARD_LAYOUT=2 SSF_CD_BASE=3 SSF_SB16_BASE=4 SSF_SYS_LANG=5 SSF_WSS_BASE=6 SSF_HD_BASE=7 SSF_FAT32_PART_HD=8 SSF_SOUND=10 SF_WAIT_EVENT_TIMEOUT=23; wait for event with timeout SF_CD=24 SSF_PLAY_CD=1 SSF_GET_PLAYLIST=2 SSF_PAUSE_CD=3 SF_SB16_I=25 SSF_MAIN_VOLUME=1 SSF_CD_VOLUME=2 SF_SYSTEM_GET=26 ; Same as SF_SYSTEM_SET, but instead of SSF_SOUND present SSF_TIME_COUNT: SSF_TIME_COUNT=9 SF_WSS=27 ; Same as SF_SB16_I SF_SB16_II=28 ; Same as SF_SB16_I SF_GET_SYS_DATE=29 SF_GET_PIXEL=35 ; read the screen pixel color SF_MOUSE_GET=37 SSF_SCREEN_POSITION=0 SSF_WINDOW_POSITION=1 SSF_BUTTON=2 ; states of the mouse buttons SF_DRAW_LINE=38 SF_BACKGROUND_GET=39 ;SSF_SIZE_BG=1 ;SSF_PIXEL_BG=2 ;SSF_MODE_BG=4 SF_SET_EVENTS_MASK=40 ; turn on/off desired events SF_GET_IRQ_OWNER=41 SF_GET_DATA_READ_BY_IRQ=42 SF_PROGRAM_IRQ=44 SF_RSRV_FREE_IRQ=45 SSF_RSRV=0 SSF_FREE=1 SF_SET_PORTS=46 ; reserve/free a group of input/output ports ; Same as SF_RSRV_FREE_IRQ SF_DRAW_NUMBER=47 ; draw number to the window SF_STYLE_SETTINGS=48 SSF_APPLY=0 ; apply screen settings SSF_SET_BUTTON_STYLE=1 SSF_SET_COLORS=2 SSF_GET_COLORS=3 ; get standard window colors SSF_GET_SKIN_HEIGHT=4 SF_SET_WINDOW_SHAPE=50 SF_CREATE_THREAD=51 SF_STACK_DRIVER_STATUS=52 SSF_GET_LOCAL_IP=1 SSF_WRITE_STACK_INPUT_QUEUE=6 SSF_READ_STACK_OUTPUT_QUEUE=8 SF_SOCKET_INTERFACE=53 SSF_SOCKET_UDP_OPEN=0 SSF_SOCKET_UDP_CLOSE=1 SSF_SOCKET_POLL=2 SSF_SOCKET_READ=3 SSF_SOCKET_UDP_WRITE=4 SSF_SOCKET_TCP_OPEN=5 SSF_SOCKET_TCP_STATUS=6 SSF_SOCKET_TCP_WRITE=7 SSF_SOCKET_TCP_CLOSE=8 SSF_SOCKET_CHECK_PORT=9 SF_SPEAKER_PLAY=55 SF_FILE_SYSTEM=58 SSF_READ_FILE=0 SSF_WRITE_FILE=1 SSF_READ_LBA=8 SSF_START_APP=16 SF_TRACE_SYSTEM_CALLS=59 SF_IPC=60 ; Inter Process Communication SSF_SET_AREA=1 ; set area for IPC receiving SSF_SEND_MESSAGE=2 SF_GET_GRAPHICAL_PARAMS=61 SSF_SCREEN_SIZE=1 SSF_BITS_PER_PIXEL=2 SSF_BYTES_PER_LINE=3 SF_PCI=62 SSF_GET_VERSION=0 ; get version of PCI-interface SSF_GET_LAST_BUS=1 ; get number of the last PCI-bus SSF_GET_ADRR_MODE=2 ; get addressing mode of the PCI configuration space SSF_READ_BYTE=4 SSF_READ_WORD=5 SSF_READ_DWORD=6 SSF_WRITE_BYTE=8 SSF_WRITE_WORD=9 SSF_WRITE_DWORD=10 SF_BOARD=63 SSF_DEBUG_WRITE=1 SSF_DEBUG_READ=2 SF_MEMORY_RESIZE=64 ; resize total application memory SF_UTF=65 SF_KEYBOARD=66 SSF_SET_INPUT_MODE=1 SSF_GET_INPUT_MODE=2 SSF_GET_CONTROL_KEYS=3; get status of control keys SF_CHANGE_WINDOW=67 ; change position/sizes of the window SF_VERT_HORZ_SCROLL=113 SSF_VERT_SCROLL=$10000 SSF_HORZ_SCROLL=$20000 Code: ; MenuetOS system functions(int $60): SF_CREATE_WINDOW=0 ; define and draw the window SF_PUT_PIXEL=1 ; draw pixel to the window SF_GET_KEY=2 ; get code of the pressed key SF_GET_SYS_TIME=3 SSF_GET_TIME=1 SSF_GET_DATE=2 SSF_SET_TIME=11 SSF_SET_DATE=12 SF_DRAW_TEXT=4 SF_SLEEP=5 ; pause process SF_PUT_IMAGE=7 ; draw image to the window SF_DEFINE_BUTTON=8 ; define/delete the button SF_PROCESS_INFO=9 ; information on execution thread SSF_PROCESS_INFO_BY_SLOT=1 SSF_PROCESS_INFO_BY_PID=2 SF_WAIT_EVENT=10 ; wait for event SF_CHECK_EVENT=11 ; check for event and return SF_REDRAW=12 SSF_BEGIN_DRAW=1 SSF_END_DRAW=2 SF_DRAW_RECT=13 ; draw rectangle to the window SF_GET_SCREEN_SIZE=14 ; get screen resolution SF_BACKGROUND_SET=15 ; work with desktop background graphics SSF_REDRAW_BG=1 ; redraw background SSF_SET_DATA_BG=2 SSF_SET_SIZE_BG=3 ; set a size of the background image SSF_GET_DATA_BG=12 SSF_GET_SIZE_BG=13 ; get a size of the background image SF_RD_TO_FLOPPY=16 ; save ramdisk on the floppy SF_GET_BUTTON=17 ; get ID of the pressed button SF_WAIT_EVENT_TIMEOUT=23; wait for event with timeout SF_SYSTEM_INFO=26 SSF_GEN_DATA=1 SSF_WND_STACK=2 SSF_BOOT_INFO=3 SSF_PAGING_TBL=4 SF_GET_PIXEL=35 ; read the screen pixel color SF_MOUSE_GET=37 SSF_SCREEN_POSITION=0 SSF_WINDOW_POSITION=1 SSF_BUTTON=2 ; states of the mouse buttons SSF_SCROLL_DATA=3 SSF_GET_SPEED=10 SSF_SET_SPEED=11 SF_DRAW_LINE=38 SF_SET_EVENTS_MASK=40 ; turn on/off desired events SF_GET_DATA_READ_BY_IRQ=42 SF_PROGRAM_IRQ=44 SF_RSRV_FREE_IRQ=45 SSF_RSRV=0 SSF_FREE=1 SF_SET_PORTS=46 ; reserve/free a group of input/output ports ; Same as SF_RSRV_FREE_IRQ SF_DRAW_NUMBER=47 ; draw number to the window SF_SET_WINDOW_SHAPE_TRANSPARENCY=50 SF_CREATE_THREAD=51 SF_STACK_DRIVER_STATUS=52 SSF_GET_STACK_CFG=0 SSF_GET_LOCAL_IP=1 SSF_SET_STACK_CFG=2 SSF_SET_LOCAL_IP=3 SSF_GET_GATE_IP=9 SSF_GET_SUBNET_IP_MASK=10 SSF_SET_GATE_IP=11 SSF_SET_SUBNET_IP_MASK=12 SSF_GET_DNS_IP=13 SSF_SET_DNS_IP=14 SF_SOCKET_INTERFACE=53 SSF_SOCKET_UDP_OPEN=0 SSF_SOCKET_UDP_CLOSE=1 SSF_SOCKET_POLL=2 SSF_SOCKET_READ=3 SSF_SOCKET_UDP_WRITE=4 SSF_SOCKET_TCP_OPEN=5 SSF_SOCKET_TCP_STATUS=6 SSF_SOCKET_TCP_WRITE=7 SSF_SOCKET_TCP_CLOSE=8 SSF_SOCKET_CHECK_PORT=9 SSF_SOCKET_TCP_WRITE_NOWAIT=17 SSF_SOCKET_READ_BLOCK=13 SSF_SOCKET_REMOTE_INFO=21 SF_FILE_SYSTEM=58 SSF_READ_FILE=0 SSF_WRITE_FILE=1 SSF_DELETE_FILE=2 SSF_READ_FOLDER=3 SSF_APPEND_FILE=4 SF_IPC=60 ; Inter Process Communication SSF_SET_AREA=1 ; set area for IPC receiving SSF_SEND_MESSAGE=2 SF_GET_GRAPHICAL_PARAMS=61 SSF_SCREEN_SIZE=1 SSF_BITS_PER_PIXEL=2 SSF_BYTES_PER_LINE=3 SSF_GET_LFB_MMEM_ADR=3 SF_BOARD=63 SSF_DEBUG_WRITE=1 SSF_DEBUG_READ=2 SF_MEMORY_RESIZE=64 ; resize total application memory SF_KEYBOARD=66 SSF_SET_INPUT_MODE=1 SSF_GET_INPUT_MODE=2 SSF_GET_CONTROL_KEYS=3; get status of control keys SF_CHANGE_WINDOW=67 ; change position/sizes of the window SF_HIGH_PREC_SLEEP=105 SF_RUN_APP_DATA=110 SF_GET_CURRENT_PID=111 SF_GET_CFG_PARAM=112 SF_VERT_HORZ_SCROLL=113 SSF_VERT_SCROLL=$10000 SSF_HORZ_SCROLL=$20000 SF_CD=114 SSF_PLAY_CD=1 SSF_GET_PLAYLIST=2 SSF_PAUSE_CD=3 SF_PCI=115 SSF_GET_VERSION=0 ; get version of PCI-interface SSF_GET_LAST_BUS=1 ; get number of the last PCI-bus SSF_GET_ADRR_MODE=2 ; get addressing mode of the PCI configuration space SSF_READ_BYTE=4 SSF_READ_WORD=5 SSF_READ_DWORD=6 SSF_WRITE_BYTE=8 SSF_WRITE_WORD=9 SSF_WRITE_DWORD=10 SF_DRIVER_STATE=116 SF_AUDIO=117 SF_MIDI=118 SF_DRAW_CIRCLE=119 SF_WND_SKINNING=120 SF_DRAG_N_DROP=121 SF_3D_API=122 SF_HIGH_PREC_WAIT_EVENT=123 SF_SET_WND_STATE=124 SF_WND_TRANSPARENCY=125 SF_32_X_64_SWITCH=126 SF_USB20_DEV_INFO=127 SF_USB20_WEB_CAM=128 SF_USB20_PRINTER=129 SF_USB20_TUNER=130 SF_USB1X_DEV_INFO=131 SF_MULTYCPU=140 SF_SYS_FONT=141 SF_COPY_PASTE=142 SF_GZIP=143 SF_GRAPH_DRV=144 SF_AUDIO_PROCESSING=150 SF_MATHLIB=151 SF_CM_LOSSLESS_DATA_CODEC=152 SF_TIME_CRITICAL_PROCESS=240 SF_START_PROCESS=256 SF_START_PROCESS_MEM=257 SF_SET_PAGE_TYPE=400 SF_SYSTEM=500 SF_TERMINATE_PROCESS=512 what prefix thou use for 32 bit ones & what for 64 ones? it is clear that not "SF_" in both cases. SF_ and SF64_ - or some other? I get names from kolibri but maybe nemes of syscall in menuet has other notations? |
|||
![]() |
|
ProMiNick 11 Aug 2019, 07:03
post created by bug:
The page thou are watching dont recognized of compression method. Please contact with author. (It creates same post twice). second I cleared. |
|||
![]() |
|
Ville 11 Aug 2019, 09:46
For me personally, it is faster to just use the syscall numbers, for both 32bit and 64bit. However, you can find the 64bit syscall notations over here: http://www.menuetos.net/syscall.txt
|
|||
![]() |
|
ProMiNick 11 Aug 2019, 13:59
Ville, this looks more like your port code for FASM (than link I posted previously)
Code: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; flat assembler source ;; ;; Copyright (c) 1999-2005, Tomasz Grysztar ;; ;; All rights reserved. ;; ;; ;; ;; Menuet port by VT ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; use32 org 0x0 db 'MENUET01' ; 8 byte id dd 0x01 ; header version dd START ; program start dd program_end ; program image size dd stacktop ; required amount of memory dd stacktop ; stack dd params,0x0 ; parameters,icon NORMAL_MODE = 8 CONSOLE_MODE = 32 MAX_PATH = 20 START: cmp [params],0 jz red mov ecx, $25 mov al, ' ' mov edi, infile push ecx cld rep stosb mov ecx, [esp] mov edi, outfile rep stosb pop ecx mov edi, path rep stosb mov esi,params mov edi,infile call mov_param_str inc esi mov edi, outfile call mov_param_str inc esi mov edi, path call mov_param_str cmp dword[esi], ',run' jnz loc_86 mov dword[_run_outfile], 1 mov dword[_mode], CONSOLE_MODE jmp start red: call draw_window still: mov eax, 10 int $40 dec eax jz redraw dec eax jz key dec eax jz button jmp still redraw: call draw_window jmp still key: mov eax, 2 int $40 jmp still button: mov eax, 17 int $40 cmp ah, 2 jnz nostart jmp start nostart: cmp ah, 3 jnz norunout mov edx, outfile call make_fullpaths mov eax, 58 mov ebx, $8AB xor ecx, ecx int $40 jmp still norunout: cmp ah, 11 jz f1; Infile cmp ah, 12 jz f2; Outfile cmp ah, 13 jz f3; Path dec ah jnz still or eax, -1 int $40 draw_window: pushad mov eax, 12 xor ebx, ebx inc ebx int $40 xor eax, eax mov ebx, 50 shl 16 + 285 mov ebx, 50 shl 16 + 320 mov edx, $02000000 add edx, [clr_nc_blue] mov edi, esi add esi, $80000000 int $40 mov eax, 8 mov ebx, 266 shl 16 + 12 mov ecx, 5 shl 16 + 12 xor edx, edx inc edx mov esi, [clr_btn_blue] int $40 mov ebx, 28 shl 16 + 105 mov ecx, 132 shl 16 + 13 inc edx int $40 mov ebx, 148 shl 16 + 105 inc edx int $40 mov ebx, 222 shl 16 + 28 mov ecx, 84 shl 16 + 9 mov edx, 11 inc edx mov esi, [clr_btn_blue] int $40 mov ecx, 94 shl 16 + 9 inc edx int $40 mov ecx, 104 shl 16 + 9 inc edx int $40 mov eax, 4 mov ebx, 15 shl 16 + 7 mov ecx, -1 mov edx, wnd_title mov esi, $2F int $40 mov esi, infile mov edi, loc_449 mov ecx, $25 cld rep movsb mov esi, outfile mov edi, loc_47B mov ecx, $25 rep movsb mov esi, path mov edi, loc_4AD mov ecx, $25 rep movsb mov ebx, 25 shl 16 + 35 mov ecx, [clr_white] mov edx, text_copyright mov esi, $28 newline: mov eax, 4 int $40 add ebx, 10 add edx, 50 cmp byte[edx], 'x' jne newline mov eax, 12 mov ebx, 2 int $40 popad ret f1: mov dword[addr], infile mov dword[ya], 85 jmp rk f2: mov dword[addr], outfile mov dword[ya], 95 jmp rk f3: mov dword[addr], path mov dword[ya], 105 rk: mov edi, dword[addr] mov eax, '_' mov ecx, 20 cld rep stosb call print_text mov edi, dword[addr] f11: mov eax, 10 int $40 cmp eax, 2 jnz read_done mov eax, 2 int $40 shr eax, 8 cmp eax, 13 je read_done cmp eax, 8 jne nobs cmp edi,[addr] je f11 sub edi, 1 mov byte[edi], '_' call print_text jmp f11 nobs: cmp eax, $1F jbe f11 cmp eax,'_' jb loc_2C0 sub eax, ' ' mov byte[edi], al call print_text add edi, 1 mov esi, dword[addr] add esi, MAX_PATH cmp esi, edi read_done: jne f11 mov ecx, dword[addr] add ecx, MAX_PATH sub ecx, edi mov eax, ' ' cld rep stosb call print_text jmp still print_text: mov eax, 13 mov ebx, 79 shl 16 + 120 mov ecx, dword[ya] shl ecx, 16 mov cx, 8 mov edx, [clr_bg_blue] int $40 mov eax, 4 mov ebx, 79 shl 16 + 0 add ebx, dword[ya] mov ecx, dword[clr_white] mov edx, dword[addr] mov esi, $25 int $40 ret wnd_title db 'FASM FOR MENUET' text_copyright db 'flat assembler 1.57.1 ',\ 'Copyright (c) 1999-2005, Tomasz Grysztar ',\ 'All rights reserved. ',\ 'Menuet port by VT ',\ '--------------------------------------------------',\ 'infile: <<< ',\ 'outfile: <<< ',\ 'path: <<< ',\ '--------------------------------------------------',\ ' ',\ ' START COMPILE RUN OUTFILE ',\ ' ',\ '--------------------------------------------------',\ 'x ' infile db 'EXAMPLE.ASM ',0 outfile db 'EXAMPLE ',0 path db '/RD/1/ ',0 lf db 13,10,0 addr dd 0 ya dd 0 zero db 0 clr_white dd $FFFFFF clr_bg_blue dd $2030A0 clr_nc_blue dd $4466DD clr_btn_blue dd $6677CC mov_param_str: @@: mov al,[esi] cmp al,',' je @f cmp al,0 je @f mov [edi],al inc esi inc edi jmp @b @@: ret start: cmp [_mode],NORMAL_MODE jne @f mov eax, 13 mov ebx, 10 shl 16 + 260 mov ecx, 168 shl 16 + 90 mov edx, [clr_bg_blue] int $40 mov dword[loc_D0C],25 shl 16 + 168 mov esi, _logo call display_string ; Fasm native code mov [input_file],infile mov [output_file],outfile call init_memory call make_timestamp mov [start_time],eax call preprocessor call parser call assembler call formatter movzx eax,[current_pass] inc eax call display_number mov esi,_passes_suffix call display_string call make_timestamp sub eax,[start_time] xor edx,edx mov ebx,100 div ebx or eax,eax jz display_bytes_count xor edx,edx mov ebx,10 div ebx push edx call display_number mov dl,'.' call display_character pop eax call display_number mov esi,_seconds_suffix call display_string display_bytes_count: mov eax,[written_size] call display_number mov esi,_bytes_suffix call display_string xor al,al cmp [_run_outfile],1 ;... now may be thou share somewhere full sources of 32bit port of fasm - for historical purposes. especialy smart this piece of data - app looks exactly: Code: wnd_title db 'FASM FOR MENUET' text_copyright db 'flat assembler 1.57.1 ',\ 'Copyright (c) 1999-2005, Tomasz Grysztar ',\ 'All rights reserved. ',\ 'Menuet port by VT ',\ '--------------------------------------------------',\ 'infile: <<< ',\ 'outfile: <<< ',\ 'path: <<< ',\ '--------------------------------------------------',\ ' ',\ ' START COMPILE RUN OUTFILE ',\ ' ',\ '--------------------------------------------------',\ 'x ' infile db 'EXAMPLE.ASM ',0 outfile db 'EXAMPLE ',0 path db '/RD/1/ ',0 |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.