Where to sail next
Alone Coder
The compiler already assembles itself. In it
You can already release releases. This is already a product.
The young employee I was looking at─
gal of hope, refused to port the computer─
lator on ARM. Although I promised earlier when
the compiler was small and not scary.
You'll have to do it yourself.
The acceleration of self-assembly has so far reached
dead end There's no way you can reassemble it in a minute.
Only two more radical ideas appeared:
е)tokenize sources on NedoLang
(keywords and double characters)
g)generate obj (with patches) directly from
compiler (then it is impossible to insert and
asmoprocedures - only asmomodules), make
special linker or loader.
05/15/2017: tried to speed up the lexer─
res reading a line into a buffer. But the problem with
long lines. If you check the length,
then the speed is the same. Limit line length?
So far the source code contains very long lines─
ki. They already need to be reduced so that we can
it was convenient to edit on Speccy. I do─
he drew the smallest font in the world
4x2, wrote a demo and tested it about─
view the source with it. Resultthis ek─
I used the experiment when it was finished─
val design style of the source code.
05/17/18/2017:
- now names of procedures in assembler -
without dots at the end, and autotags - with dots.
- now _ at the beginning of global identification─
no need for drivers. Local labels
temporarily block global ones, and then
are removed from the labels table.
- figured out how to speed up== and != . But not
did.
- thoughts:
How to forward variables: ignore
identical - compatible with C.
How to forward constants? Take the afterbirth─
new (can be both a label and a variable).
It won't work if we assemble for an hour─
yup, it will work if we assemble everything into ku─
chu.
The assembler should glue:
1. module of implicit mathematical functions─
tions (the compiler does not need it, but the code generator
glues the right one? or compilation script
changes depending on the target?) - under─
turn it on at the end so that it is only used─
procedures involved
2. OS header file (the compiler does not
necessary, only the script knows about this file
compilations for this target!!!)
3. launch module? or two - the beginning and
the end? (the compiler doesn't need it, ditto)
4. code + code + code...
5. variables+variables+variables...
6. lines + lines + lines...
It is possible to exclude non-use in under-asma─
procedures forsecond pass?
You need some kind of trickyif,which will check─
Determines whether there is a procedure in the first
pass on the second pass.
But then it will not be possible to exclude the process─
a fool that is only used in non-fiction─
the procedure used.
(So far, NedoAsm doesn’t even have a simple
conditional compilation with creature check─
mark.)
05/19/2017 - added +sizeof() ,
structures and constant arrays of strings. Those─
Now you can write games like Rusted Souls:
const struct state day1s24={
NOSEL, IMG_STREETDAY,
BIGSPR_PAPERBOYO, NOANIM,
&day1m24, NOMSG, NOMSG, NOMSG
};
const struct msg day1m23={
NOCMD,
&day1s24,
"
3n
Boy! Newspaper!"
};
05/21/2017 - nedores utility, converters─
uses graphic resources for games.
Calculations have shown that if at self─
assembly, the entire system will be in memory
(rather than loading from files and cluttering
disk with temporary files, as now), then by─
you will need not48K and not even 128K, but 276K -
this is even if there is only one 32 in memory─
Lobyte source. And these sources on
actually210K!
For now we remain at48K.
05/30/2017 - how to make pointers to
procedures without unnecessary typecast? Digged into
typecode.h - only one free bit left
one, it’s a pity to spend...
06/06/2017 - it turns out that somewhere else os─
typecasts were made via/*+*/(PCHAR) .
Fixed.
06/07/2017 - slightly shortened the assembler
due to the procedurereadf(fin) with one pair─
meter instead of a heap.
06/08/2017:
Now autotags are numbered not with.B. ,a
s.A. It's more logical. And then later, after re─
Lisa, you can’t change it - they’ll write their own
libraries :)
I tried to speed up the tokenizer in the compile─
tore through the label table insteadif-else. A
this slowed him down! Left it like that - about─
The next step will be to localize the tokenizer for ARM.
And abandoned further attempts to accelerate.
To have something to compare with, about speed
original C on PDP-11/70 by the authors─
the following is written:
"In assessing the costs of using C, the
cost of the compilations themselves has to
be considered.This too we deem acceptable.
For example, to compile and link-edit the
entire operating system ("sys-gen") takes
somewhat over nine minutes of clock time
(of which seven minutes are CPU time); the
system consists of about 12,500 lines ofC
code, leading to a rate of about 22 lines
per second from source to executable
object on a PDP-11/70. The compiler is
faster than this figure would indicate;the
system source makes heavy use of "include"
files, so the actual number of lines
processed by the compiler is 38,000 and
the rate is 65 lines per second."
https://archive.org/stream/bstjS7-6-1947/
bstjS7-6-1947_djvu.txt
65 строк в секунду на такой древней си─
стеме против наших 41.
Правда, если вы откроете исходник ори─
гинального компилятора Си (ищите в интер─
нете "Very early C compilers and
language" ), то увидите, что он весь напи─
сан очень короткими строчками без коммен─
тариев:init(s, t)
char s[]; {
extern symbuf, namsiz;
char symbuf[], sp[];
int np[], i;
i = namsiz;
sp = symbuf;
while(i--)
if ((*sp++ = *s++)=='') --s;
np = lookup();
*np++ = 1;
*np = t;
}
И в таком же стиле написан UNIX (см.
листинг в книге"Lions' commentary on UNIX
бth edition" ).
Так что в общем мы наравне.
09.06.2017 - сделал инициализацию таб─
лицы меток в токенизаторе один раз, а не
на каждом файле.
12.06.2017 - идея для построения проек─
та:#include "name.h"
should output:
include "name.dec"
incobj "name.bin","name.rel" or simply
incobj "name"
this can be any place in the source (in
startup includes at the end)
06/14/2017:
How to compile on48K large programs─
frames whose labels do not fit in the assessment─
mbler at one time? Now we are already close and
We can’t develop the compiler...
a) with a linker:
# export declarations from ASMA (and
provide a token?) DONE
# do EXPORT in the compiler
# do assembly of file chain─
fishing - DONE INCLUDE (now you need to do
#include in the compiler)
# export the object file in ASMA
(patches in place and patches back for the future)
# make a linker
b) without linker:
# export declarations from ASMA (and
provide a token?) DONE
# do EXPORT in the compiler - for
procedures, functions, variables, constants,
constant strings/arrays/structures
# do assembly of file chain─
fishing - DONE INCLUDE (now you need to do
#include in the compiler)
# make binary gluing with
label (instead ofnedodefb and for connection
modules) DONE
# export the relocation table
(or obzha?)
# make binary gluing with
relocation (or relocation?)
- after this you can develop the compiler
and asm
How to distinguish in a team where is asm, where is bi─
Narnik? or implement incbin (it’s awkward─
married)? then do USEUNIT (#include),
which translates to incbin? or all
place incbin in a startup?
Relocation table - for all addresses,
i.e. numbers that are calculated from address─
owls? but $-label must have a dimension
numbers! alabel/256(not in the compiler)?
you need the "address" flag in the label:"label=number"
makes a number,"label"makes an address,
"label=label+1"(just after reading
labels like "address" or$in an expression)
does the address?
track for all arithmetic operations─
What type is address/number?
what's easier? or mark expressions like
"number"sign#?
or mark only expressions like
$-label?
(not used in ordinary programs)
or allow$-labelonly in a special
label definition command?
We relocate not only transitions and calls,
but also address calculationsswitchand tablesdw
Resetting to zero_islabelmakes sense only in
commands that are generated with a word entryor write a label(label,=,dw,jp,call, ld)
So far I have done it so that it is impossible$-label
(possible1*($-label))
How to relocate calls to other mo─
dulyam? If it’s like inside, then it won’t be
shove the program into memory in parts...
06/26/2017:
How to transfer module numbering for
requests in the object manager?
Is it possible to change the relative number─
go global? (same module
may be included in different!!!)
The number can be assigned in order of computers─
lations (even if you recompile unchanged─
no need for nyonny)
It is necessary to recompile the unchanged
module, if it uses a modified mo─
blow!!! (this is because it binds to
offsets in the declarations of the used mo─
dulya)
Even if you don't snap to offsets,
and to the character numbers, then insertion function
will require recompiling all modules,
who use it.
It is possible from the first changed recom─peel all subsequent modules.
You still need to recompile everything when from─
changing the structure of module connections.
If this is not done, then in the linker you need
work with symbolic labels, that is
linker cannot become loader (need pa─
crumple under the marks)
What symbol to make for tee declarations─
pametka=+?
or another declaration format?
The assembler file must know its but─
module measures to correctly unload the deck─
larations!
It's not scary if the assembler has one
the same list of files as the compiler?
Or a list of compiler files for nothing
no effect?
06/27/2017: added #include . Before that
all external labels used were necessary
list at the beginning of the source.
06/28/2017: added #define (only for
constants).
06/29/2017: divided the standard Bible─
edema by three -lib (multiplication-division,
shifts, etc.),str (lines) and io (files).
This way you can reduce the size of utilities that─
Some do not use any of the parts.
06/30/2017: broken sourcecompiler
to the code generator and parser, I compile them─
are assembled separately (codegenera─
torus for address 0x6003, parser for address
0x6000 and includes the codegenerato binary─
ra). To do this I had to export
labels from the assembler and directivesinclude,
incbin . But now there is a free one
memory for tags. Then I would like to
also add incbin with relocation - data
for relocation, the assembler is already unloading.
I officially released this version.
The path to multiplatform
07/03/2017: added typed con─
stants:
#define ()()
07/04/2017: added #ifdef/ifndef (for now
non-nested).
I started writing a code generator for ARM Thumb.
07/06/2017: added #undef .
07/07/2017:
How to make macros in assembler?
Insteadusemacro is better # ?
If the label field=command field, then in general
cannot be removed, because from a token point of view─
congestion line "macro1" is a declaration
labels, and the line"macro1 par1,par2" is an error
Or you can without#, if you catch macros in
tokcallbl instead of an error, but at the same time
insert invisible tokenusemacro.
07/08/2017: added typedef. In addition to the approval─
best for the user, now it will be possible
expand the type system in the language itself -
Nowadays the type code always lies in the change─
data and type parametersBYTE. And he will lie
in variables and type parametersTYPE. This
will be, for example,UINT, something like in DRE─
in the C compiler (number of asterisks in
pointers are clearly limited). Or
pointer to a structure, as in the compiler
Oberon.
07/10/2017:
Place macros in a buffer in memory (department
flax branch inreading a file? duplication
main loop? selectswitch in the procedure─
ru? all this is slow!), in a separate file
(how many files will be opened?), patch
callreadfin? (as it is in high language
level?) or unwind the file? From─
You can also do it by mattingdup-edup. But
yet the necessary functionsseek/pos are not in the file─
no library, not evenflush without closing─
file type.
I remade all the scripts.bat so that
they looked more or less cross-platform─
but: consisted of lines
07/11/2017: added sprite library─
currentsprite.
A native command processor is required.
It is desirable that the format of the batch file matches─
gave with MS-DOS and UNIX.
Those. calls without extensions + file names─
fishing without keys, and nothing more.
When the command processor is running, you can
store only resident and open file
batch file, load the rest each time.
In .bat alreadyit will not be possible to call comp.bat -
you need to make separate executables comp, tok,
asm.
C++Builder does not allow you to name the project
asm, so the commands will be nedolang,
nedotok, nedoasm.
How to compile in a temporary folder? and
even if the sources were scattered throughout
catalogues?
MS-DOS and UNIX have different slashes, then ba─
technologies will be incompatible with them. Therefore
there will be a forward slash everywhere, it is according to the standard
is supported in #include, and in utilities
I will recode it for MS-DOS.
You can make a temporary cleaning utility
files - different for all three axes.
07/12/2017: sprite output speeded up to─
added more functions. Corrected the utility
nedores.
07/13/2017: divided the compiler into two
project: nedolang and nedolarm, already issued
some code for ARM Thumb.
07/14/2017: supported pointer types
with stars.
07/17/2017: tested the sprite bib─
lioteka. Started adding support for tiles.
07/18/2017: at the request of Hippiman, add─
plugged into a vertical sprite library
scrolling the window.
07/26/2017: for compatibility with C everything
calls to structural types are preceded
wordstruct .
07/31/2017:
Thoughts on how to shift the entire
active screen:
- linear screen buffer? (on it udo─
more lines and polygons) 0x6000: startup,
ISR, music, data(?), scrbuf, gfx engine,
logic engine, gfx/logic/data (pageable) +
INT vector
- todo drawing panel elements and
dialogues
- todo the ability to display sprites by─
top of the panel??? framed directly on the screen,
like the arrow in the CV?
- todo clip sprites inside the activity─
new screen? ? only with transfer? ?
(128K screen is unlikely to be effective -
there is not enough space for graphics in the lower memory)
08/03/2017: instead of 196 files per heap
I put the compile into different directories─
tor with libraries (SDK) and projects on
NedoLang (each has its own directory). For
this supported the paths wherever necessary (in
MS-DOS - recoding from forward slashes
in obrantye, and on Speccy under TR-DOS - pro─
start until the last slash).
Optimized== and != as intended
before.
08/04/2017: wrote a native utility
batch, which performs those very crosses─
platformcompilation batch files. Lies with
addresses64000, so if there were those before─
no, now it’s very cramped (in reality I’m without
stops was optimizing the compile─
torus in size and marks so that at the end
finally squeeze in a batch). But now it’s not well─
It’s important to write clever basics that don’t
there is enough space (once they even had to
cut in half), you can make a complex one
auto assembly. The batch utility has its own copy
file library shared with the compiler
only disk buffers (they are on the screen -
up to8 files are open at the same time). Here's the EU─
if there was an OS, then the file system would be
only one copy.
08/07/2017: added the libraryprint, and
using it, the diff utility, which shows─
distinguishes between files on the screen. Now mo─
It is possible to test the system automatically, without
manual copying-comparison.
08/08/2017: added nedodel utilities
(file deletion) and movedisk (compaction
disk) because the compiler project does not
was placed on a floppy disk.
08/10-15/2017: translated the io library
from NedoAsm to NedoLang, so that you can
use on ARM. String library
choppedfrom procedures that would have long ago─
Are they made for compilation from C++?
Builder. At this timeHippiman was able to bring out
on the screen a map edited in DizzyAGE,
and move Dizzy along it :)
08/17/2017: bugfix of intersecting names─
values of parameters and local variables in
different functions. This is how I saved memory
under the labels in the compiler.
08/18/2017: fixed the code generator under
ARM Thumb. It turned out that there were both marks and
all sorts of defbs are usually written in another
format, and in different assemblers
in different ways. I chose Keil because
Phyton does not eat numbers of the formOxff. A compilation─
tor does not yet know how to recode constants
- conveys it as it is.
08/19/2017: bugfix for importing attributes
tiles in nedores. It was only noticeable
should I draw it myself in the attributes or in the output─
place sprites on top of tiles.
08/21/2017: my issued assembler
code for ARM Thumb has finally become assembled─
vat.
08/22/2017: tokenizer compiled
underARM Thumb. But some have not yet been determined
other functions.
08/23/2017: added missing functions─
tions. The tokenizer was linked under ARM Thumb.
Started debugging in Phyton. I had to hack
description of the 198bVE1T microcontroller in the computer─
lect Phyton so that from the address0 there will be pain─
very large RAM.
08/24/2017: added the nepadad utility
(cutting or expanding the file to the specified value─
size) for easy downloading of programs
we and the disk image in the Phyton simulator.
08/25/2017: tokenizer, compiled─
under ARM Thumb, works under simulator─
rum! Result of file tokenization on the image
disk matches the sample.
Started writing my own assembler for ARM
Thumb instead of Keil's (or rather, do
NedoAsm branch with changes in the main
switch and some procedures, and the rest
general parts).
08/27/2017: bugfix for empty attributes
familiarity in nedores. Added library
sound effects ayfxplay from the game Ball
Quest and Evo SDK.
08/28/2017: started writing in parallel
tokenizer for ARM Thumb (more precisely, again
make a branch with common parts).
08/29/2017: tokenizer and assembler for
ARM Thumb are working! There was some problem─
ma with generation of procedure labels with offset─
eat+1 . Couldn't do the same as in Keil
(how does he know that the label refers to a pro─
procedure, and not to a variable?). Made nesov─
Replaceable. But I don't need him anymore. I'm about─
hundred compared the result byte by byte.
I also added a runtime library for128K
(interrupts, pages, border).
Released this version.
It was smooth on paper...
I took a proprietary MIC debug board─
rocontroller 198bVE1T from Milandr. C
a bunch of jumpers from the previous owner, who─
some were clearly displayed incorrectly
it was for me. After some digging I found
the desired position of the jumpers and one program
mu, which compiled in Phyton.
It turned out that the real piece of hardware is several─
only differs in behavior from the debugger.
It’s not just about the fact that from address0 there is no
RAM, there is generally only48K RAM (and not
in a row), from which you can use the code─
only16K. That's whyinstead of tokenization─
tor I was debugging just a file copier.
Moreover, when trying to load the code into
Phyton RAM was resetting the system so I
I lost all the numerous settings of the register─
ditch of the processor that she made for me
sample program. So I made my own
bootloader via Ethernet (server in ROM and cli─
ent separately). It only supports two
UDP commands: write bytes to memory
there, run from the given address.
In some cases, the io library is
dealt with unaligned data. I'm naive
used the descriptor structure from
TR-DOS straight in its raw form. But on the real
the hardware, unlike the simulator, is uneven─
unauthorized access caused an interrupt, which
it was quite difficult to track. File
tracing, again, unlike si─
there was no simulator anymore, so I slowly
went through the code procedure after procedure. That─
there was no stop check in RAM either, so I
manually setB {PC} (analogous to jr $), and by─
Tom removed it.
In the end09/12/2017 everything worked─
lo. I also experimented with external
RAM (it turned out the wires were mixed up
sampling bytes, but in general you can work),
light bulbsand buttons, then put it aside
fee.
The next stage is the Mul─ microcontroller
Tikor" by Elvis.
And also - how to support banking, how
bring it even closer to C and how to screw it on
the most 3D engine. And write specialized─
bathroom development environment. And the operating room
system for it :)
09/07/2017 also added to the sprite
the engine works with pixels on the screen and in
screen buffer,09/09/2017 upon request
Hippiman converted the sprite engine to
constant tileset width (28 familiar places,
so that the attributes fit),09.13.2017 co─
reduced the archive into 259 files (added utilities─
that clean), and15.09.2017 described in colors,
how to doHello world. Checking on a neighbor
showed that the instructions work :)
* * *
During the year within the project it was written20000
lines of code (550kilobytes) and under200kilo─
bytes of texts, not counting this article (and in
more to this article80, bon appetit!).
On average60debugged lines of code per day
(with some distractions to other work─
you), which is slightly higher than the industrial standard─
mouth :)
Share your thoughts about the article