' -- powerbasic -> oxygenbasic
'
Declare Function MessageBox Lib "user32.dll" alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
def msgbox messagebox
FUNCTION PBMAIN () AS LONG
LOCAL a,b,c AS INTEGER
a=10 : b=20
c=a*b
FUNCTION=c
MSGBOX 0,"Hello my powerbasic friends: " + STR(c),"PowerBASIC" ,2
END FUNCTION
pbmain()
QuoteTo multiply two numbers in x86 assembly, you can use the mul instruction. Here is an example of how to multiply two numbers stored in the eax and ebx registers:
Move the first number into the eax register:
mov eax, first_number
Move the second number into the ebx register:
mov ebx, second_number
Multiply the two numbers using the mul instruction. The mul instruction multiplies the value in the eax register by the value in the specified register or memory location, and stores the result in the eax (lower 32 bits) and edx (upper 32 bits) registers:
mul ebx
The result of the multiplication is now stored in the eax register (if the result is less than 32 bits) or in the edx:eax register pair (if the result is 64 bits).
Here is the complete code:
section .data
first_number dd 5
second_number dd 10
section .bss
result resd 1
section .text
global _start
_start:
; load the first number into eax
mov eax, [first_number]
; load the second number into ebx
mov ebx, [second_number]
; multiply eax by ebx
mul ebx
; store the result in [result]
mov [result], eax
; exit the program
mov eax, 1
xor ebx, ebx
int 0x80
In this example, the first number is 5 and the second number is 10. The result of the multiplication is 50, which is stored in the eax register.
' multiplication of two values
'
byte val1
byte val2
int result
macro myMul(val1,val2)
val1=5
val2=10
! mov eax,val1
''! mov eax,val2
! mul val2
! mov result,wax
end macro
'print "the result of val1*val2 is " + str(myMul(val1,val2))
'print "the result of val1*val2 is " + str(result)
ASE WM_CTLCOLOREDIT
'by Pierre Bellisle..
select GetDlgCtrlID(lparam)
case ed1ID
if theme = 4 : SetBkColor(wparam, RGB(43,42,54)): end if
SetTextColor(wparam,RGB(240,230,230))
return darkBrush 'darkColor
case else
darkBrush = CreateSolidBrush(RGB(255,255,255))
SetBkColor( wparam, RGB(255,255,255))
if theme <> 4 : SetTextColor( wparam,RGB(0,0,0)) : end if
return darkBrush
end select
Page created in 0.073 seconds with 10 queries.