Coders
---------------------------------------
Converting a 16-bit number
to text decimal equivalent
---------------------------------------
Denis Tokarczuk
A problem often arises in practice
double-byte (16-bit) translation
numbers in a form convenient for, for example, transferring
chat on the screen, place in text
file, etc. In general, the goal is conversion
number contained, for example, in the register
three HL into the equivalent sequence
number of symbols.
To solve this problem, remember
what is the decimal system?
topic of reckoning (hereinafter referred to as DSS). Firstly,
somewhere in the nooks and crannies of our immeasurable creation
knowledge, let's dig up the most important thing for us
fact: DSS is a POSITIONAL counting system
mergers. Secondly, when digging pre-
previous fact, we are to greatamazement
ran into another one: the DSS consists of
alphabet of ten characters (Arabic numerals)
ry).
The first fact is decisive for us
shim. It is the position of the digit in the number that determines
divides the weight of a number. From a mathematics course
for preschoolers: first number on the right
stands for units, the second stands for tens,
third - hundreds, etc. Well, since from
schools and kindergarten we still have some
any memories but not knowledge
mathematics, I will reformulate more generally -
powerful and understandable for a programmer: right
the last digit indicates the least significant digit
numbers, the leftmost one is the eldest. In case
c DSS, the “weight” of each digit increases
with a transition to a new digit 10 times.
Visually, the decimal notation of a number can be
represented as the following formula:
a 0
A...N = A*10 +...+ N*10 ,
where A is the most significant digit of the number (digital
ra), its “weight” is calculated by the formula
a
A*10, where a is the position of the number A in our
number (counting from zero); N - youngest time
series of numbers (“zero” position, which denotes
starts multiplying it by ONE). For pain-
For clarity, let's give an example:
4 3 2 1 0
17287 = 1*10 +7*10 +2*10 +8*10 +7*10 <=>
<=>17287 = 1*10000+7*1000+2*100+8*10+7*1
The conclusion suggests itself - for
translation of the HL number, it is necessary to determine
these same numbers A...N, after producing
additional subtractions approximately like this
general algorithm (language of A.P. Ershov):
alg Converting a number from HL to text
string (word HL, string str)
arg HL
res str нач
word _HL, _DE
byte pos
string str[5]
_HL:=HL; _DE=10000; str:="00000"
pos:=1
пока _DE>=1
нц
пока _HL>=_DE
нц
_HL:=_HL-_DE
str[pos]:=str[pos]+1
кц
_DE:=_DE/10
pos:=pos+1
kts
con
I think everything is maximal from the algorithm
understandable and I won’t occupy you with the element -
clear explanations. I'm also sure that y
you will not have any special difficulties
transferring the algorithm to assembly language;
but still, in the attachment is mine
option in ALASM with this simple subroutine
frames.
- - -
Some packaging ideas
sound as a stream of samples
-----------------------------
(sic)maggot|sdc
invsn@ukrpost.net
Obviously, on Speck wavs are at 44kHz
8bit in the full volume of the song (average 4
minutes) you can't lose without 10 floppies and
super|unreal|loader. Accordingly
but there is only one way out - to pack the sound, but specially
kovskie 3.5MHz impose their limitations
At least for the unpacking itself (naky-
let him be a pussy).
My idea does not pretend to be implemented
on Spec, although some theoretical
There is progress (!).
Everyone knows that the signal (as peri-
wild, and not) can be decomposed into
a series of orthogonal functions. In case
sound vibrations are an ideal option
are (1, sin(a), cos(a)) and correspondingly
Indeed, this decomposition will have
title "Fourier series expansion". But in
The Fourier series can be expanded not only
a discontinuous function, but also a stream of samples.
At the same time, the number of coefficients (ampli-
there harmonics) will be equal to the length of itself
samples file. This follows simple
packaging method: arrange the sample into
Fourier series, we save the coefficients accordingly
patients a , b . Next, we introduce the threshold mi-
n n
minimum amplitude, which sets -
depending on the quality ratio
divided by the length of the output file. Next
coefficients less than this threshold apply
pabhubaem to zero. You can do for example
like this: reduce the maximum amplitude
input file so that it does not exceed
pabhubaem to zero. You can do for example
like this: reduce the maximum amplitude
input file so that it does not exceed
shala #7F. Then, if the given byte is in you
in the input file the number is negative, then this
coefficient a , positive - b . Ouch-
n n
it is clear that all zeros in the file can be deleted
pour. Next, the output file can be packaged
huffman, and on the pussy and LZW. Method
unpacking from the above is obvious.
Regarding the implementation on Spec. C
for the purpose of acceleration, you can, for example,
split the file into blocks of 128byte and store
tables of all possible products of amp-
lityd harmonics to the corresponding sines
or cosines. It is clear that with such inaccuracy
arithmetic, you may have to use
double linear oversampling thread
tion.
Awaken second breath
---------------------------------------
Lamurik
For those who don’t know, at the end of nine
Recently a demo came out that surprised everyone.
Firstly, it was a game in the genre of single-player
hakobomy c Elite. Secondly, she npeboc-
I went to Elite according to schedule. And thirdly,
what they promised RAGE in the description, deeds-
would be Awaken a cult game that
would easily overcome Cher-
Nogo Raven. But, as usual, the game is not
came out, the author was forgotten (probably due to
lack of memory).
And a few years ago they came out
walkers of this game. Before that they visited
in manyhands. Availability of six discs
the source code was to some extent happy...
After the transfer of all trd-shniki it became
it is clear that everything is present here except
intro and oytpo. After a few days
viewing the source codes, we were able to obtain them
download and compile. (probably
I was lucky that many of the sources were in Zasm,
and not in some GENS). First we
compiled the arcade part (stan-
tion). Everything in it was radically changed
heho, but the meaning remained the same. Every day
smoke during the day spoiled the mood - basically
anyway, there was nothing new at the station
Done, just the interface. After compi-
lations of the remaining source codes, the situation
repeated. And although in Awaken there was no
completed, what would have been impossible
play it. The absence of all these "fi-
shek", pushed back and pushed back the bar
down.
Well (sic)maggot and I decided to link it,
to play at least somehow. Naturally
he linked and scored. And I decided to finish it
trivia and leave the game to you. In it
not even half of what was promised
by the authors (planet, cruisers and, most
the main thing is GLOBALstoryline), but
still games need to be released no matter what
Why, there are so few of them.
There is nothing complicated in control.
To find out more: in the game, select
"?"
I’ll just say that in order to select
take a star for hypertransition, just
select ee as to find out
info. To change the panel to a normal one
rename "PANELN" to "PANEL",
and that one - to some other one. By the way,
for those who do not have flash, turbo and 512KB, -
you'll have to be upset :)
So upset everyone who is still on-
acted. Although, if you want in the appendix to
It’s time for the source code to appear and an article that
and how. All sources are discussed in great detail
commented, except for the rear engine, consist
from two disks. On other roads
there was all sorts of bullshit, like the intro, which
It was in Deme, a cruel planet.
Enough to soap on
invsn@ukrpost.net.
I won’t describe anything in detail,
because the process of self-disassembly brings satisfaction
freedom, you never know what awaits you there, but
However, if there are difficulties, wash it.
!Under no circumstances save on
discs without download file!
from two disks. On other roads
there was all sorts of bullshit, like the intro, which
It was in Deme, a cruel planet.
Enough to soap on
invsn@ukrpost.net.
I won’t describe anything in detail,
because the process of self-disassembly brings satisfaction
freedom, you never know what awaits you there, but
However, if there are difficulties, wash it.
!Under no circumstances save ondiscs without download file!
!In our hands it was made on the
Mr. Pentagon and was tested specifically on
him!
!The game does not use OUT type chips
(#fd), ah!
Share your thoughts about the article