Started by Donald Darden, June 19, 2007, 10:42:36 PM
0 Members and 1 Guest are viewing this topic.
dim aa as stringdim a as long, b, c, d, e, f, g, hcolor 15,1clsaa="This is a test."a=12345print aa, "a ="; ado while inkey$=""loop
.intel_syntax noprefix #test.bas' compilation started at 22:40:36 (FreeBASIC v0.15b).section .text.balign 16.globl _main_main:push ebpmov ebp, espand esp, 0xFFFFFFF0call ___mainpush dword ptr [ebp+12]push dword ptr [ebp+8]call _fb_Init@8call _fb_CallCTORS.Lt_0001:push 1push 15call _fb_Color@8push -65536call _fb_Cls@4push 0push 16push offset Lt_0003push -1push offset _AAcall _fb_StrAssign@20mov dword ptr [_A], 12345push 2push offset _AApush 0call _fb_PrintString@12push 0push 3push offset Lt_0004call _fb_StrAllocTempDescZEx@8push eaxpush 0call _fb_PrintString@12push 1push dword ptr [_A]push 0call _fb_PrintInt@12.Lt_0005:push 1push offset Lt_0000push -1call _fb_Inkey@0push eaxcall _fb_StrCompare@16test eax, eaxjne .Lt_0006jmp .Lt_0005.Lt_0006:.Lt_0002:push 0call _fb_End@4mov esp, ebppop ebpret #test.bas' compilation took 2.86069876599626e-004 secs #global initialized constants.section .data.balign 16.balign 4Lt_0000: .ascii "\0".balign 4Lt_0003: .ascii "This is a test.\0".balign 4Lt_0004: .ascii "a =\0" #global non-initialized vars.section .bss.balign 16.balign 4 .lcomm _AA,12.balign 4 .lcomm _A,4.balign 4 .lcomm _Bi,4.balign 4 .lcomm _Ci,4.balign 4 .lcomm _Di,4.balign 4 .lcomm _Ei,4.balign 4 .lcomm _Fi,4.balign 4 .lcomm _Gi,4.balign 4 .lcomm _Hi,4
.intel_syntax noprefix #test.bas' compilation started at 22:40:36 (FreeBASIC v0.15b).section .text 'we saw with IDE PRO that this was the CODE section.balign 16.globl _main 'Since no function was started, this must be the main code_main:push ebp 'we've discussed saving EBP contents on stack beforemov ebp, esp 'then using EBP to hold current ESP contents and esp, 0xFFFFFFF0 'here the contents of ESP are forced to align16call ___main 'this is FreeBasic's Main procedure push dword ptr [ebp+12] 'an existing value on stack is pushed on stack againpush dword ptr [ebp+8] 'a second existing stack value is pushed on stack againcall _fb_Init@8 'another FreeBasic procedure is called call _fb_CallCTORS 'and another FreeBasic procedure is called .Lt_0001:push 1 'first parameter pushed is background color (Blue)push 15 '2nd paramter pushed is forground color (Br White) call _fb_Color@8 'this is the COLOR command routine in FreeBasicpush -65536 'This is a parameter for the CLS commandcall _fb_Cls@4 'this it the CLS routine for FreeBASICpush 0 'we are probably singnalling at same location push 16 'we need 15 bytes, plus 1 for a null terminator push offset Lt_0003 'and the stromg constant starts herepush -1 'and we want to assign this to a dynamic stringpush offset _AA 'that we allocated to start here call _fb_StrAssign@20 'this sets our dynamic string to the constant mov dword ptr [_A], 12345 'now we do the "a = 12345" FB instruction push 2 'we signal that we want a tab done first push offset _AA 'and what we want to print next push 0 'probably the device to print to (console)call _fb_PrintString@12 'this will perform our FB "print aa;" instructionpush 0 'print at current location againpush 3 'the string consists of three characterspush offset Lt_0004 'this is where our "a =\0" constant is storedcall _fb_StrAllocTempDescZEx@8 'make this into a temporary dynamic stringpush eax 'eax contains where the temporary string is push 0 'print to the console screen againcall _fb_PrintString@12 'this is what does the string printingpush 1 'indicate that we are pushing a numberic valuepush dword ptr [_A] 'put the value on the stack (12345)push 0 'print to console screen flagcall _fb_PrintInt@12 'this routine is what prints integers .Lt_0005:push 1 'indicate just one byte push offset Lt_0000 'push a null byte on stack push -1 'could indicate device, or nowait state?call _fb_Inkey@0 'This is where FB does the INKEY$ functionpush eax 'put the return code from INKEY$ on stackcall _fb_StrCompare@16 'see if it is a match for the null byte on stacktest eax, eax 'see if the results in EAX are a match jne .Lt_0006 'if no match, we are donejmp .Lt_0005 'it was a null char (or no keypress) so loop .Lt_0006: 'a key was pressed, so here we are .Lt_0002: 'seems there is always a label after a LOOP push 0 'We set a zero as our return code call _fb_End@4 'FreeBasic's END routine, restores saved regsmov esp, ebp 'This is that neat trick that allows the ESP to be wiped of temps pop ebp 'and final step to restore EBP from stackret 'and we are done #test.bas' compilation took 2.86069876599626e-004 secs #global initialized constants.section .data.balign 16.balign 4Lt_0000: .ascii "\0".balign 4Lt_0003: .ascii "This is a test.\0".balign 4Lt_0004: .ascii "a =\0" #global non-initialized vars.section .bss.balign 16.balign 4 .lcomm _AA,12 'this is dynamic string variable AA.balign 4 .lcomm _A,4 'this is long variable a.balign 4 .lcomm _Bi,4 'this is long variable b .balign 4 .lcomm _Ci,4 'this is long variable c .balign 4 .lcomm _Di,4 'this is long variable d .balign 4 .lcomm _Ei,4 'this is long variable e.balign 4 .lcomm _Fi,4 'this is long variable f.balign 4 .lcomm _Gi,4 'this is long variable g.balign 4 .lcomm _Hi,4 'this is long variable h
DECLARE FUNCTION FuncName ALIAS "XFuncName" LIB "test.dll" (a1$, a2$) AS LONG
DECLARE FUNCTION FuncName LIB "test.dll" ALIAS "XFuncName" (a1$, a2$) AS LONG
QuoteThanks for your interest in FbEdit For a first time installation i recomend FbEdit bundlehttp://fbedit.freebasic.net/download.php?id=59&f=15It contains everything you need to get started.
Page created in 0.207 seconds with 22 queries.