flat assembler
Message board for the users of flat assembler.
Index
> Windows > FasmScript ? |
Author |
|
Akujin 14 Oct 2011, 04:59
FasmScript?
Open file _sample.asc (any text editor) study/modify the script, save and run fasmscript.exe. Test & Feedback please!
_________________ CLI HLT Last edited by Akujin on 14 Oct 2011, 16:04; edited 1 time in total |
|||||||||||
14 Oct 2011, 04:59 |
|
wht36 14 Oct 2011, 09:48
Hi, the program ran, asked for & displayed input, and closed fine....
|
|||
14 Oct 2011, 09:48 |
|
AsmGuru62 14 Oct 2011, 14:22
What this program does?
|
|||
14 Oct 2011, 14:22 |
|
Akujin 14 Oct 2011, 16:10
AsmGuru62 wrote: What this program does? almost everything... _________________ CLI HLT |
|||
14 Oct 2011, 16:10 |
|
AsmGuru62 14 Oct 2011, 22:49
Cool!
|
|||
14 Oct 2011, 22:49 |
|
Madis731 17 Oct 2011, 07:37
Yes, a start of something cool. I don't know what ... yet
|
|||
17 Oct 2011, 07:37 |
|
Akujin 17 Oct 2011, 10:30
Qbasic code stolen from me239:
http://board.flatassembler.net/topic.php?t=13515 Code: ; Original code (c) me239 ALIGN 4 ;! alert1 db 13,10,"ALERT! Tank spotted ",0 alert2 db "meters away",0 alert3 db 13,10,"You have 3 shell types: ",13,10,\ " Short range: 50 m/s and 255 meter max",13,10,\ " Medium range: 100 m/s 1,020 meter max",13,10,\ " Long range: 200 m/s 4,081 meter max",13,10,0 input1 db "Short range(1), Medium range(2), Long range(3): ",0 input2 db "Launch angle (Integer degree only): ",0 hitT db 13,10,"HIT! Enemy tank has been destroyed!",0 missT db 13,10,"MISS! The enemy tank has shot AND killed you ",0 distT db 13,10,"Distance: ",0 timeT db 13,10,"Time: ",0 return db 13,10,0 ALIGN 4 rdist dd 0 veloc dd 0 angle dd 0 t dd 0 d dd 0 vtable dd 50.0,100.0,200.0 d2r dd 0.017453292519943295769236907685 cn2 dd 0.204081632653061224489795918366 hsize dd 10.0 ALIGN 16 start: rdtsc shr eax,21 mov [rdist],eax ;mov [rdist],109 ;mov [rdist],1698 mov eax,alert1 PSTR mov eax,[rdist] PINT mov eax,alert2 PSTR mov eax,alert3 PSTR mov eax,return PSTR askRange: mov eax,input1 ASKI test eax,eax jz askRange cmp eax,3 ja askRange mov eax,[vtable+eax*4-4] mov [veloc],eax mov eax,return PSTR askAngle: mov eax,input2 ASKI ;need ASKF test eax,eax jz askAngle cmp eax,180 ja askAngle mov [angle],eax ;mov [angle],24 ;mov [angle],12 lazyFPUcoder: fild [angle] fmul [d2r] fsincos ;RTFIM mov eax,missT fxch fmul [veloc] fmul [cn2] fst [t] ;! fmul [veloc] fmulp; [t] ;! fstp [d] fild [rdist] ;jxx safe fsub [hsize] fld [d] fcomip st,st1 fstp st jb miss fild [rdist] ;jxx safe fadd [hsize] fld [d] fcomip st,st1 fstp st ja miss hit: mov eax,hitT miss: PSTR mov eax,distT PSTR mov eax,[d] PFLT mov eax,timeT PSTR mov eax,[t] PFLT mov eax,return PSTR ret ;cli ;hlt Usage: Copy and paste this code over the _sample.asc file included in the .rar of the first post, save and run fasmscript.exe, for info about the game please refer to the link above Random number not fully tested. Sadly my program only accept Integers as input so testing the second picture in the original thread fails! _________________ CLI HLT |
|||
17 Oct 2011, 10:30 |
|
TmX 18 Oct 2011, 09:48
Cool. A kind of interpreter..
BTW is the source code available? |
|||
18 Oct 2011, 09:48 |
|
Akujin 18 Oct 2011, 18:19
Source code for fasm.dll at http://board.flatassembler.net/topic.php?t=6239
The fasmscript.exe its just an host for fasm.dll with some function to display data. The Trick At run time the file _sample.asc is loaded in memory... A VirtualAlloc call prepare a Buffer to store the assembled code... A Prologue file is made in memory... Code:
format binary
use32
org 00000000h
jmp start
org directive is filled with the address of the VirtualAlloc Buffer... An Epilogue file is made in memory... Code:
ret ;
Prologue+ _sample.asc+Epilogue are send to fasm.dll for assembly and the resulting bytecode! stored in the VirtualAlloc Buffer.... Host app call Buffer and execution start... Easy! In fasmscript.exe a bug allow to see my Prologue code ... Regards. _________________ CLI HLT |
|||
18 Oct 2011, 18:19 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.