Conversation
Notices
-
þernia (pernia@cum.salon)'s status on Monday, 02-Sep-2024 19:17:19 JST þernia @Inginsub why are we throwing out the "lowest" dword? just cuz? -
þernia (pernia@cum.salon)'s status on Monday, 02-Sep-2024 19:17:20 JST þernia @Inginsub :hapyday: -
þernia (pernia@cum.salon)'s status on Monday, 02-Sep-2024 19:17:21 JST þernia @Inginsub in this example, dw0h, dw0l, dw1h, dw1l are 16bits, correct? and their multiplications would yield 32bit (stored in dx:ax) results right? like this
dw0h:dw0l * dw1h:dw1l (16:16 * 16:16) high: whole low: fractionaland piecewise multiplication would look like this:
16 * 16 = dx:ax ----------------------------- dw0h*dw1h = resultAh:resultAl dw0h*dw1l = resultBh:resultBl dw1h*dw0l = resultCh:resultCl dw0l*dw1l = resultDh:resultDland so the sum, after multiplying, would look like this:
------------------------------------- whole | fractional ------------------------------------- 16 | 16 | 16 | 16 highest | higher | lower | lowest ------------------------------------- resultAh:resultAl:00000000:00000000 + resultBh:resultBl:00000000 + resultCh:resultCl:00000000 + resultDh:resultDl +for which we will discard the "lowest" dword, and the "lower" dword is the fractional part
did i understand correctly?
-
:ihavenomouth: (inginsub@clubcyberia.co)'s status on Monday, 02-Sep-2024 19:17:21 JST :ihavenomouth: @pernia yes, exactly -
:ihavenomouth: (inginsub@clubcyberia.co)'s status on Monday, 02-Sep-2024 19:17:22 JST :ihavenomouth: dw0h:dw0l * dw1h:dw1l = dw0h*dw1h:0000:0000 + dw0h*dw1l:0000 + dw1h*dw0l:0000 + dw0l*dw1l = | <- you split the number here, discard the lowest dword and the second lowest is your fractional part -
þernia (pernia@cum.salon)'s status on Monday, 02-Sep-2024 19:17:23 JST þernia @Inginsub im jumbled about the piecewise calculations and the floating part.
would it be easier if i just kept the floating part on the lower end of the space and treated it like a whole number (like, i multiplied the entire floating number by a factor of 10 to make it whole), and have a beeg integer, and then do piecewise calculations on whole numbers?then remember which words were "floating" to print them out after the "." to the screen -
:ihavenomouth: (inginsub@clubcyberia.co)'s status on Monday, 02-Sep-2024 19:17:23 JST :ihavenomouth: @pernia if you really want floating point, keep track of the exponent. you can also use fixed point: 16.16 (16 bit whole part, 16 bit fractional) is stored as dword:dword; in this case you'll need to shift the multiplication result 32 bits right -
þernia (pernia@cum.salon)'s status on Monday, 02-Sep-2024 19:17:24 JST þernia @Inginsub yea exactly -
þernia (pernia@cum.salon)'s status on Monday, 02-Sep-2024 19:17:25 JST þernia @Inginsub where
num3 = dworda*dwordc num2 = dworda*dwordd + dwordb*dwordc num1 = dwordb*dowrddand num2 fits in 32bits without overflowing
-
:ihavenomouth: (inginsub@clubcyberia.co)'s status on Monday, 02-Sep-2024 19:17:25 JST :ihavenomouth: @pernia can you even use 32 bit regs on 8068? i thought it was 16 bit only (product is stored in dx:ax instead of eax) and you need to store your variables in ram and do piece wise calculations -
þernia (pernia@cum.salon)'s status on Monday, 02-Sep-2024 19:17:26 JST þernia ok markdown version
num3h:num3l:00000:00000 + 00000:num2h:num2l:00000 + 00000:00000:num1h:num1l -
:ihavenomouth: (inginsub@clubcyberia.co)'s status on Monday, 02-Sep-2024 19:17:27 JST :ihavenomouth: @pernia markdown with ``` tags -
:ihavenomouth: (inginsub@clubcyberia.co)'s status on Monday, 02-Sep-2024 19:17:27 JST :ihavenomouth: @pernia nvm it doesn't escape emoji :heyface: -
þernia (pernia@cum.salon)'s status on Monday, 02-Sep-2024 19:17:28 JST þernia @Inginsub lmfao fuckin ghell :0000: -
þernia (pernia@cum.salon)'s status on Monday, 02-Sep-2024 19:17:29 JST þernia @Inginsub in the order of operations, shifting comes first right?
so it would simplify to 32bit + 32bit << 16 + 32bit << 32
num1 num2 num3
at it would end up like num3:num2:num1
right? i'm too brainlet for this still -
þernia (pernia@cum.salon)'s status on Monday, 02-Sep-2024 19:17:29 JST þernia @Inginsub wait
actually it would be like
num3h:num3l:0000:0000
+0000:num2h:num2l:0000
+0000:0000:num1h:num1l
right?? -
:ihavenomouth: (inginsub@clubcyberia.co)'s status on Monday, 02-Sep-2024 19:17:30 JST :ihavenomouth: @pernia the second one is easy, you have values dwordA:dwordB and dwordC:dwordD, the product is dwordB*dwordD + (dwordA*dwordD + dwordB*dwordC) << 16 + (dwordA*dwordC) << 32 -
:ihavenomouth: (inginsub@clubcyberia.co)'s status on Monday, 02-Sep-2024 19:17:31 JST :ihavenomouth: @pernia what's the problem? -
þernia (pernia@cum.salon)'s status on Monday, 02-Sep-2024 19:17:31 JST þernia @Inginsub hard time going about it. I need to find areas and perimeters of various shapes given user input. its 8086 and cant use an fpu coprocessor.
Adding two (16bit) numbers is easy. i could parse both numbers (between 0 and 9999.99, two decimal place restriction for this assignment) and shove the whole part into a dword and the decimal part into a different dword, then do something like
int1+ int2 + (float1+float2)/100
similar for subtraction
but then multiplication would be like
[INT1*INT2]+[(INT1*FLT2)/100]+[(INT2*FLT1)/100]+[(FLT1*FLT2)/100^2]
and for 16bit numbers, it would be like
[16bit*16bit] + [16bit*16bit/16bit] + [16bit*16bit/16bit] + [16bit*16bit/16bit] =>
32bit + 32bit/16bit + 32bit/16bit + 32bit/16bit =>
32bit + 16bit + 16bit + 16bit =>
16bit(high):[16bit(low) + 16bit + 16bit + 16bit]
First problem is i gotta carry over values into high parts of a register when it overflows from addition. And also i might lose information from dividing a 32bit into a 16bit number, maybe im wrong.
Second, bigger problem is that with that 32bit result from multiplication, i have to multiply that by constants from the formulas of the shapes, which would be (zero extended?) 32bit*32bit, and theres no instructions for that. -
þernia (pernia@cum.salon)'s status on Monday, 02-Sep-2024 19:17:32 JST þernia just got filtered by manual floating point operations in assembly. how upset should i be
-