Author Topic: Just a question from a newbie in assembler  (Read 5871 times)

0 Members and 1 Guest are viewing this topic.

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1982
  • Likes Given: 4650
Re: Just a question from a newbie in assembler
« Reply #25 on: 21:57, 04 April 12 »
Oachkatzlschwoaf!
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 392
  • Likes Given: 60
Re: Just a question from a newbie in assembler
« Reply #26 on: 03:03, 05 April 12 »
Yes, you're right. "denn" has the same meening as "als". So: "than = denn" and "then = dann". Oh, shitty... :-\

They must be teaching German to all the students in the US now then :)

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.839
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4281
  • Likes Given: 450
Re: Just a question from a newbie in assembler
« Reply #27 on: 15:00, 05 April 12 »
Oachkatzlschwoaf!

And who said the Bavarians can't speak Hochdeutsch :D

Bryce.

Offline MaV

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.103
  • Country: at
  • Ius summum saepe summa est malitia.
  • Liked: 400
  • Likes Given: 828
Re: Just a question from a newbie in assembler
« Reply #28 on: 15:40, 05 April 12 »
And who said the Bavarians can't speak Hochdeutsch :D
Ah, but they do. And it's about time that the Northern German speakers accept the Southern dialects as equal because by number of speakers alone we're more (Southern Germany, Switzerland and Austria). Language diversity is the motto, because the language "Hochdeutsch" is but a convention to ease communication. In the end it needs the dialects to enrichen it, otherwise it'd be as clean and sterile as Latin is today.

Imagine English without Cockney, Mancunian, Irish, Scottish, Australian English!
brrr!
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.839
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4281
  • Likes Given: 450
Re: Just a question from a newbie in assembler
« Reply #29 on: 16:10, 05 April 12 »
As someone who normally speaks Kölsch, my comments on Hochdeutsch shouldn't really be taken all that seriously :D

Bryce.

Offline beaker

  • 6128 Plus
  • ******
  • Posts: 810
  • Country: ie
  • Terrible at soldering...
    • index.php?action=treasury
  • Liked: 163
  • Likes Given: 244
Re: Just a question from a newbie in assembler
« Reply #30 on: 18:23, 05 April 12 »
Ah, but they do. And it's about time that the Northern German speakers accept the Southern dialects as equal because by number of speakers alone we're more (Southern Germany, Switzerland and Austria). Language diversity is the motto, because the language "Hochdeutsch" is but a convention to ease communication. In the end it needs the dialects to enrichen it, otherwise it'd be as clean and sterile as Latin is today.

Imagine English without Cockney, Mancunian, Irish, Scottish, Australian English!
brrr!

What? You've never heard of the North/South divide in England? Neither have really ever accepted each other...
 
England North/South Divide
« Last Edit: 18:26, 05 April 12 by beaker »

Offline MugUK

  • CPC664
  • ***
  • Posts: 80
  • Country: gb
  • An old Atari ST music ripper and trainer maker :)
  • Liked: 12
  • Likes Given: 8
Re: Just a question from a newbie in assembler
« Reply #31 on: 21:35, 05 April 12 »
I tried explaining the North/South Divide to my friend in Oldenburg who runs the retro museum there.

I also tried defining how close the gap was between accents (esp. in the North) from the tip of the North Wales coast all the way along to Manchester then onto Yorkshire.

As for the North / South Divide in Germany, I have only visited the South once (last year) and was happy to able to pronounce 'bread' down there as for the life of me I can't get my tongue around the umlauts in the Northern word for it :)


I love poking (and peeking) around files.  I used to write saved-game editors on the Atari ST (and Amiga) using GFA BASIC, so looking forward to having some fun with my 6128 :)

Offline beaker

  • 6128 Plus
  • ******
  • Posts: 810
  • Country: ie
  • Terrible at soldering...
    • index.php?action=treasury
  • Liked: 163
  • Likes Given: 244
Re: Just a question from a newbie in assembler
« Reply #32 on: 22:00, 05 April 12 »
I always use Mars Bars to work out the North/South divide in the UK. You're in the South up to the point where the locals think good food is frying a Mars Bar in batter...  ???

Offline MaV

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.103
  • Country: at
  • Ius summum saepe summa est malitia.
  • Liked: 400
  • Likes Given: 828
Re: Just a question from a newbie in assembler
« Reply #33 on: 11:41, 06 April 12 »
What? You've never heard of the North/South divide in England? Neither have really ever accepted each other...
I've heard of it, but never perceived it to be so problematic.

Then again, my one and only trip to England (and Scotland) has been 18 years ago for three weeks. Not enough to recognise the seriousness of this.
The media distorts the picture somewhat, series like Life on Mars (the guv) rather glorify the North (or perhaps I've just overlooked the movies about the divide.)

Personally, I prefer the pronounciation of the North (sorry, Southerners!). The sounds - especially the vowels - have retained the original qualities and therefore sound more continental. The u-sound in cup should be a shortened "oo". Linguistically the southern dialects are a recent development - measured in hundreds of years, of course.

Yeah, I know. I'm standing in a minefield now waiting about what's to happen next. :D
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

Offline HAL 6128

  • 6128 Plus
  • ******
  • Posts: 516
  • Country: de
    • index.php?action=treasury
  • Liked: 256
  • Likes Given: 1349
Re: Just a question from a newbie in assembler
« Reply #34 on: 22:53, 15 April 12 »
...just another quick question:
could somebody explain me like a six year old child how a floating point number will be brouht into the RAM of the CPC and how to read it out?
I've read something about in the Firmware or "whole memory guide", but... no clue.
for example "43.375" is in memory "00 00 80 35 86". How are the conversion/calculations rules?
I know that most left byte = LSB and the forth byte = MSB and the most right byte = exponent. That's all!??
Cheers!!
...proudly supported Schnapps Demo, Pentomino and NQ-Music-Disc with GFX

Offline MaV

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.103
  • Country: at
  • Ius summum saepe summa est malitia.
  • Liked: 400
  • Likes Given: 828
Re: Just a question from a newbie in assembler
« Reply #35 on: 02:32, 16 April 12 »
...
for example "43.375" is in memory "00 00 80 35 86". How are the conversion/calculations rules?
I know that most left byte = LSB and the forth byte = MSB and the most right byte = exponent. That's all!??
First of all, there is no way a six year old will be able to understand that, unless he's a genius.

Second, your representation of 43.375 in memory is wrong. It should be "00 00 80 2D 86".

This link might help:
Technical information about Locomotive BASIC - CPCWiki - The Ultimate Amstrad

But I have to say the order of the mantissa bits in the structure is also wrong!

The first byte contains the least significant bits of the mantissa, and every following byte up to the fourth byte contain the bits following the first in significance and in exactly that order!

That means that you have to turn around the first four bytes if you want to read the mantissa correctly:
2D800000
or
0010.1101.1000.0000.0000.0000.0000.0000
in binary (the stops are inserted for better readability).

Now the highest significant bit here is 0, so the number is positive.
What's more, you need to clear that bit and substitute the implied highest bit (see description in the link), which is always 1 (regardless of the deleted sign bit!!!).
Thus you get:
AD800000
or
1010.1101.1000.0000.0000.0000.0000.0000
in binary.

The mantissa has an implied decimal point before the number. Since the number is 2^32 bits (i.e. 4 bytes) long you have to divide by 2^32 to get the proper decimal representation.

AD800000 (hex) = 2910846976 (dec)

2910846976 / 2^32 = 0.677734375

The mantissa in a decimal representation is: 0.677734375

Now, the last byte contains the exponent: 86 (hex) or 134 (dec). You need to subtract 128 to get the real exponent, the highest bit tells you that the exponent is positive (1) or negative (0). Your exponent is 6.

0.677734375 * 2^6 = 43.375


Another example:
PI is represented in memory as:
A2 DA 0F 49 82

The mantissa is
490FDAA2 (highest significant bit is zero => number is positive)
The exponent is
82 (=positive mantissa, value=2 thus multiply mantissa with 2^2)

Delete the sign bit (which is 0 anyway), and then add the implied 1 bit:
C90FDAA2 (hex) = 3373259426 (dec) = 1100.1001.0000.1111.1101.1010.1010.0010 (bin)

Calculate the decimal representation of the mantissa:
3373259426 / 2^32 = 0,7853981633670628070831298828125

Then add the exponent (82h - 80h = 2 thus 2^2)
0,7853981633670628070831298828125 * 2^2 = 3,14159265346825122833251953125

Voilà! The internal representation of the number PI on the CPC is: 3,14159265346825122833251953125

If you compare to a (more) correct representation of PI, you'll see that the CPC is correct up to the 9th decimal place:

CPC:
3.14159265346825122833251953125
more correctly:
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986...


Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

Offline HAL 6128

  • 6128 Plus
  • ******
  • Posts: 516
  • Country: de
    • index.php?action=treasury
  • Liked: 256
  • Likes Given: 1349
Re: Just a question from a newbie in assembler
« Reply #36 on: 14:22, 16 April 12 »
Yes, I got it!  ;D
 
Thank you very much for the good reproducible explenation!!!
Now I understand. (Honestly no, I still don't what is happening inside the Z80 when calculating with floatings but for the first it's ok)
Wow, calculation with a floating point is a real pain in the ass / time consuming...

I've changed the wiki page "technical information" for BASIC with the structure information into the right Bit order.
Is it ok for you, if I add your description and explenation to the "technical information"??
« Last Edit: 14:39, 16 April 12 by hal 6128 »
...proudly supported Schnapps Demo, Pentomino and NQ-Music-Disc with GFX

Offline MaV

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.103
  • Country: at
  • Ius summum saepe summa est malitia.
  • Liked: 400
  • Likes Given: 828
Re: Just a question from a newbie in assembler
« Reply #37 on: 16:24, 16 April 12 »
Thank you very much for the good reproducible explenation!!!
You're welcome!

Quote
Now I understand. (Honestly no, I still don't what is happening inside the Z80 when calculating with floatings but for the first it's ok)
Wow, calculation with a floating point is a real pain in the ass / time consuming...
The floating point code in the wiki is the next step. But I don't see quite the need to know it inside out to understand the principles.
And remember that the CPC almost always does the painful work for you.

Quote
I've changed the wiki page "technical information" for BASIC with the structure information into the right Bit order.
Is it ok for you, if I add your description and explenation to the "technical information"??
Yes, if this will help others understand the floating point format in the CPC, copy this into the wiki.

TBH, it was a bit late in the night, and I haven't thought about that.
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."