Promised Land #01
31 декабря 2000

Programerstvo - Basic Rulez! Creating a card game in BASIC.

<b>Programerstvo</b> - Basic Rulez! Creating a card game in BASIC.
              PROGRAMMERSTVO



               BASIC RULES!


  Immediately warn: vyshenatsarapannoe not
should be taken seriously! And it is designed for those who do 
not assembler owns, but, nevertheless, wishes to write

something for themselves and for others, even
in Basic ...


  During the years of dialogue with the Spectrum-compatible
computers, I managed to work in the most
different directions, but mostly always
was to create games. Like everyone else, I started with
BASIC - in fact it is so simple and
quickly you can implement many ideas.

  Podnabravshis experience, I began to show
to your programs, serious demands on
part of the design. It was then and appeared MANAGER. But I 
soon realized that the standard methods are not Beysikovskih 
leave. 

  Five years ago I saw a very IBM
STRIP-interesting version of poker. First
I thought it was normal strippoker
the kind that any of you have seen on the Spectrum than once. 
But then I realized that mistaken.


  The basic principle of the game in general, the same as
Here you just play against up to three totally cute girls. And 
I realized that not I have no right to pass such an idea.


  Developing the game went pretty slow.
The main problem was not the program itself, and in the 
schedule. In theory, the screen is divided into 6 parts as 
follows: 



    Girl == == == == Girl

    == == == Number one number two ==


          My Girl == ==

         Card number three == ==


         Window size of the capital

       messages each of the parties



  Now we are interested only in windows with
image of girls (in the remaining information
displayed in plain text format).

  Obtain the necessary images was not difficult: we take 
pictures of PEEP SHOW, compressed fourfold, dorisovyvaetsya 
clothes! But they are also on display once must show ...


  First I would like to connect this assembly, but with my then 
his knowledge of this scheme absolutely nicherta failed. And 
then I come across little book "How to write a game in Basic." 
Even then, for me it was all just to primitive

and understandable. Nevertheless, one brand
unexpected little idea I had dug out ...

  In the chapter on the sprite, was the technique of creating 
small graphics with character sets, and so imagine a system 
variable on named CHARS. And then I hit a shock: "Damn, why did 
only minor??" 

  It was not so difficult: for each
of 6 girls got to three figures
size 8x16 or 8h16h8 = 1024 bytes, and this
only slightly more complete character-
set ... The only thing that bothered me - the performance of 
such a procedure. However, I was destined to make sure my fears 
proved groundless: even in a brake, as the "Horizon", rustled 
very even great!


  To get the image ready for
withdrawal from BASICa, you can use,
For example, Art Studio: scroll box (Define Window), Trip 
option Font Editor menu Text, then Misc - Capture Font.

If, as in our case, the length exceeds
768 bytes (ie 96 familiarity), will perform a few hits and then 
unite the files into one. 

  After downloading the file to some address
in memory, you can now address it
using the system variable CHARS, or
23606/23607.

  Thus, the result was one of the
those games that I'm proud of so far. But
there was still a small part of that
did not give me peace: images of the game quite frankly, and 
the sudden appearance of undesirable persons near the 
battlefield (this Of course, first Father 'Mother)

forced to press RESET, as the saying goes, "on
the most interesting place!

  Upon reflection, I decided to implement something
such that would allow AT ANY TIME cover up the schedule, and 
then recover it - of course, in accordance with the changed 
situation in the game). Of course, it may in no way should 
interfere with the game itself. AND revealed that the only way 
to implement such a possibility - the second mode interrupts. 
And let novice users and programmers are not afraid of such a 
dreadful name, but in fact it means very simple and useful 
thing. 

  50 times per second the computer is
interruption, where the normal operation of the system
suspended and carried out some
Urgent action: poll the keyboard, the increase in reading the 
system clock, etc. 

  So, there is a simple mechanism for
by which the list of urgent action can be "assigned" another 
pair of their own. It only wants to organize the interruption 
of the second kind. 

  I will not dwell on this
technology in detail, at the end of a day,
there are plenty of books covering this issue in detail (eg, 
three-volume Inforkoma by the assembler). Personally, I enjoyed 
one of the first issues of "ZX-Revue" for the 1994-th year.


  In short, our problem boils down to this: somewhere in the 
free section of memory should be placed on the program from Tiny

assembly, which will operate in parallel with the main program, 
only occasionally interfering with her work. Intervention is as 
follows:  1) check that you have pressed a special key 
combination that starts hiding the screen;  2) if pressed, then 
"hiding" the screen.  3) if not depressed - leave nothing

making.

  Such a mechanism, with small twists, implemented in Bedtime 
Poker. But this solution, perhaps, suitable only for 
experienced programmers boleemenee. Let's see Do not make a bit 
easier. 

  The advantage of machine-code of residence
procedures that, once neglected, it can be called absolutely
from anywhere in Basic-program. In our
If it is really necessary, but
you can often avoid the headaches.

  Suppose that in different places in your program is a survey 
of key principle:  10 LET B $ = INKEY $: IF B $ = "" THEN GO TO 
10 

  All you need to do - to create somewhere in the program 
(preferably closer to the beginning) general subroutine and 
access it through GO SUB whenever needed considered key code.


  Somewhere in this routine (probably
all in the end), insert:
 IF CODE INKEY $ = 7 THEN ... ,
followed by a list of actions to clean
screen by pressing Edit (Caps +1).

  Now suppose that you need to hide
a sufficiently small portion of the screen
so that it can be restored. This is done by manipulating the 
attributes. 

  Let the painted area PAPER = 6, INK = 0.
I hope you know that the color information is stored in a file 
system on display at the addresses 22528 .. 23295 (length = 
768). Each cell memory in this area is responsible for one

familiarity. If its coordinates are denoted
X = 0 .. 23 and Y = 0 .. 31, the address is:

    A = 22528 + Y * 1932 + X.

  The values ​​themselves are calculated on the numbers
quite tricky formula:

    B = INK +8 * PAPER +64 * BRIGHT +128 * FLASH;
function result ATTR illustrious names in
this format. For the case of 6 PAPER / INK 0
obtain B = 6. And if the picture is hidden, then
obtain PAPER 6 / INK 6 -> B = 54, 54 +6 = 60.

  Ideally, it would be necessary to combine
procedures to hide and restore one.
Simply, for each section of familiarity, do the following 
construction:  Z = ATTR (X, Y): POKE 22528 + Y * 32 + X, 60-Z,

and all! In principle, you can use
PRINT OVER; but POKE is faster and can handle all 24 of the 
screen. 

At this until everything! Creative success to you!





Other articles:

Fun - a compilation of jokes.

Contents - a short description of the materials of the first issue.

Miscellaneous - a description of programs and games: Sea Quest "Sea Wolf", Kool Eggs, Doman OS, Brujeria, Windword 2.1, Power UP.

expert advice - tips on playing "Black Crow".

Adventyura - passing game adventyurnoy Sea Quest.

little about yourself - Energy Group Welcomes You!

Programerstvo - Basic Rulez! Creating a card game in BASIC.

Informant - description of image file format PCX.

So be it - Computer story on the game LASER SQUAD.

Reading - a couple of excerpts from recent books of Viktor Suvorov - "Suicide".

Two erotic stories - I'm almost thirty years, and my friend Julia nineteen ...

Jaroslav Velinsky - the story "epidemic."


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Scene - Notcon 2004 report from Gasman.
Stuck? - Description of the game "North & South".

В этот день...   21 November