Seite 1 von 1

Inline ASM und "invoke LineTo,para1,x,y"

Verfasst: 20.07.2014 13:45
von funker
Hallo, guten Tag.
Wie kann man "invoke LineTo,para1,x,y" in Inline-ASM unterbringen?

Danke.
Gruss

Re: Inline ASM und "invoke LineTo,para1,x,y"

Verfasst: 20.07.2014 15:28
von NicTheQuick
Was erwartest du jetzt von uns? Vielleicht solltest du erst mal erklären, was "invoke LineTo,para1,x,y" sein soll.

Re: Inline ASM und "invoke LineTo,para1,x,y"

Verfasst: 20.07.2014 15:52
von Danilo

Code: Alles auswählen

; ASM: invoke LineTo,para1,x,y
; PB:  LineTo_(para1,x,y)

PUSH y
PUSH x
PUSH para1
CALL _LineTo@12 ; LineTo_
Wie die Argumente genau aussehen, kommt darauf an wo es verwendet wird.
Kann auch etwa so sein:

Code: Alles auswählen

!PUSH dword [p.y]
Evtl. muss auch noch ein "!Extrn _LineTo@12" mit rein.

Schau Dir mal die Commented-Ausgabe von "LineTo_(para1,x,y)" an, oder nimm
es direkt, anstatt das als InlineASM zu machen.

Re: Inline ASM und "invoke LineTo,para1,x,y"

Verfasst: 20.07.2014 17:29
von Danilo
PB /Windows, x86

Code: Alles auswählen

!Extrn _MoveToEx@16
!Extrn _LineTo@12

If OpenWindow(0, 0, 0, 220, 220, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CanvasGadget(0, 10, 10, 200, 200)
    
    Repeat
        Event = WaitWindowEvent()
        
        If Event = #PB_Event_Gadget And EventGadget() = 0 
            If EventType() = #PB_EventType_LeftButtonDown Or (EventType() = #PB_EventType_MouseMove And GetGadgetAttribute(0, #PB_Canvas_Buttons) & #PB_Canvas_LeftButton)
                hDC = StartDrawing(CanvasOutput(0))
                If hDC
                    old_x=x
                    old_y=y
                    x = GetGadgetAttribute(0, #PB_Canvas_MouseX)
                    y = GetGadgetAttribute(0, #PB_Canvas_MouseY)
                    EnableASM
                        PUSH 0
                        PUSH old_y
                        PUSH old_x
                        PUSH hDC
                        CALL _MoveToEx@16
                        
                        PUSH y
                        PUSH x
                        PUSH hDC
                        CALL _LineTo@12
                    DisableASM
                    StopDrawing()
                EndIf
            EndIf
        EndIf    
        
    Until Event = #PB_Event_CloseWindow
EndIf

Re: Inline ASM und "invoke LineTo,para1,x,y"

Verfasst: 21.07.2014 16:57
von funker
Jup, danke.
Danilo, dein Beispiel spiegelt diese Routine wieder in Purebasic.

Gibt es für Purebasic eigentlich eine Auflistung dieser API Routinen?


Danke.
Gruss

Re: Inline ASM und "invoke LineTo,para1,x,y"

Verfasst: 21.07.2014 17:10
von Danilo
APIFunctionsListing.txt / apifunctions.txt im PB-Compiler-Verzeichnis sollte alle automatisch importierten API-Funktionen enthalten.
Hilfe zu den Funktionen findet man in der jeweiligen Platform-API-Dokumentation (MSDN Library, Mac Developer Library, GTK+ Docs).