AKAEM HAK CCCP
        OPEHA EHHA CPCKOE OTEEHE
                 BCTEH EHTP


       AOOB OTAOH KOMEKC (OK)
          POPAMMHO CCTEM "KOHA"
                    BM "AAT"

                     HOBOCPCK
                        1987

       ------------------------------------

 Coca: B.A.oa          (C) 1987
630090, Hoocpc-90,
p- a.apeea, 6,
    B CO AH CCCP,
  oe opa
 e. 8(3832)-32-4256

a oe coep ooaecoe ocae ocox execx cpec BM AAT, cce oa acceepa popapoa ax oaax, a ae cpec oa ax popa, cocax OK. Paca a po p ooaee, aaxc papaoo paoo cceoo popaoo oecee a ao BM.

 

COEPAHE

 1. OE CBEEH
 2. CCTEMA KOMAH BM "AAT"
  2.1. Xapaepc poeccopa 6502
  2.2. oeca cppa a
  2.3. Pecp poeccopa 6502
  2.4. Aapaa oa  apea
  2.5. Opaoa pepa
  2.6. Cppa oa   apeca
  2.7. Ocae oa
  2.8. Coa oa poeccopa 6502.
 3. APXTEKTPA BM "AAT"
  3.1. Cppa a
  3.2. Ocae peeo epeca
  3.3. aa oceoaeoo  apaeoo epeca ()
  3.4. paee cooo
  3.5. Opeeee opa BM
 4. PEAKTOP OK
 5. ACCEMEP
  5.1. Oe cee  ocoe o
  5.2. Cppa popa
  5.3. Opeeee  cooae eo
  5.4. Oepa
  5.5. ceooa Acceepa
  5.6. Me Acceepa
  5.7. Accepoae
 6. OTAK
  6.1. Oe cee
  6.2. pecaee ax
  6.3. paa ac ax
  6.4. Baa  oa a
  6.5. Kopoae, cpaee, oc
  6.6. Peaccepoae
  6.7. ac popa  opaa opox oe
  6.8. epeee ao a
  6.9. ooo oe c co
  6.10. Paoa c aa
  6.11. Bxo  Oaa
  6.12. M-acceep
 7. AOBE OPOPAMM BBOA-BBOA
  7.1. Haaee
  7.2. Opaa aoa
  7.3. ocoe apaep aoa
  7.4. Ocae opopa
 8. CKOBA OEPAOHHA CCTEMA
  8.1. Haaee  cooae OC
  8.2. paep cooa RWTS
  8.3. opa oe ao
  8.4. Cppa pee a OC
  8.5. Ocae popa
 9. HAAHA APKA ("XOOH CTAPT")
  9.1. o pocxo p e a
  9.2. Aoapa oepaoo cce
  9.3. Cppa paoeo  cceoo co
 POEHE 1. IOSUB (CTH)
 POEHE 2. DOS (CTH)
 POEHE 3. KAPT AMT

 

1. OE CBEEH

peocaee cceo "oa" cpeca popapoa a e cooo po Papa oaac, a pao, aoe eocao p coa ceapoax aeo pax popa, apep:

- oe cpoece (paa ce),

- a oe oco a (opoae co),

- eaeaoc o ax (opaoa opae po oc a),

- eoooc poo pae epep cpoca cpeca a (pep).

peaa ocaex aa peec oee eaoe aoco c pe cpoco BM ee popapoa a e oee oo po - e acceepa, .e. eocpeceo ax oaax.

Cpeca ooo oa ax popa "oe" peocae aoo Oao Koec (OK).

OK coco 3 ace:

a) Peaop - c ooo, peapoa xpae poox eco, .. eco popa a acceepe;

) Acceep - ocece pac cxox eco eocpeceo o o, oo coe;

) Oa - opae po oc oepao a BM, opoepa ex cpoc, oo eocpeceo pa coee ax popa.

Heoxo ac poe - ooe caape popa oca oa c aap, oa a pa pep oe c co - oeceac po cce "oa": oo oa-oa (IOSUB) coo Oepaoo Cceo (OC). K oo opaac acceepx popa.

B acoe oca poc ooaec epec BM a poe ee, apeco oecx opao ax, o eoxoo paoo cooa oooce BM. Texece opooc peaa o cpoc ocac. oa ocaoo ae ecaaepo cceo cce eeapo eo oo.

 

2. CC ""

2.1. Xapaepc poeccopa BM "AAT"

T poeccopa:           MOSTech/6502
Papoc:              coo - 8  (1 a)
                          apec - 16 (2 aa)
Apeceoe pocpaco:  64 K             
Taoa acoa:         1.023 M
Pecp:                 16:PC, 8:A,X,Y,P,S
T oa:              ooapece, eapece
co o apeca:    8
a oa ():        1-3

2.2. oeca cppa a

2.2.1. o

Pap - aa ea a, xpaa 1 opa (0 1).

Maoe coo - aa apecea opaaaea a pa ea a BM; xapaepec co papo.

Apec - oec oep aoo coa, o oopo poeccop oae oc o co.

He ao ¤ ooaac ca, acae ecaaepo ccee cce.

2.2.2. Maoe coo "AATa" coco 8 papo (o), eae 1 a opa (e 16-pe p) oe aaec ao. Pap aa epc cpaa aeo o 0 o 7. Heo ceo aac, cooeceo, a (LSB) cap (MSB).

Apeco ec co o 0 o ¤FFFF. p paee a apec oo xpac x oceoaex aax, pe ae ae (c e apeco) xpac 2 ae p apeca, a cape (c o apeco) - 2 cape p. p ao paee cap a apeca ope oep cpa a - aca 256 ao, a a - oep aa cpae.

Hapep, apec ¤0123 xpac a a:

ea: ¤76 ¤77

coepoe: ¤23 ¤01

2.3. P a 6502

2.3.1. o

Pecp - ocoa ea a, axoac eocpeceo poeccope. Pecp oeo aae ca epea poeccop ax opao pea peao. Ceapoae pecp opa paee opo oa a.

poeccop 6502 ee 6 pecpo: 16-pap PC 8-pape A,X,Y,P,S.

2.3.2. Ce oa PC

Cepecp. Co a ee oeo poeccopo a.

p oo ope oa C aa ac a a a. p oe oa ecooo epex JMP JSR oeaec a a x . a ea C a a aa aa a a . ee coepoo PC popa cpeca eooo.

a a a a C aa a aa, aa a a a. a, a a a a a a (NMI) a 8 a a a a ¤FFFB, a a 8 a - a a ¤FFFA. a a (IRQ) a a, a a BRK, C a a aa ¤FFFF ¤FFFE.

a aa a C. a JSR BRK aa C (apec ee oa), a 2. a RTI RTS occaaa aee PC cea.

2.3.3. aae cea S

B aaa aa . eo a a a apecax ¤100-1FF . aoee cea pocxo copo ee apeco ec (aaoe aee oo ececeo). Cepp S a a apeca epoo coooo aa cea. a aa a S a a a 1, a aa a a 1.

ac ce aa ocecec oaa PHA, PHP, ee - oaa PLA, PLP.

S opec aoaec p epexoe a opopa (JSR), opao pepa p opae x (RTS, RTI). Bo pe oe opopa cee e apec opaa. oo opa coepoo cea oo po oo co.

2.3.4. Aop A

Pecp oeo aae. ae ceo c pecpo opoo oepaa pecpo peaa apeecx oecx oepa.

2.3.5. ec-p X Y

M a a a eco oceo a, a aa. B ocee cae a pecope o oaoe oepa. Oao paoe cooae p apeca eae x ecep.

Aoaeca oa pecpo A, X, Y e pocxo.

2.3.6. Coo coco poeccopa P

Haop oopapx pecpo, xapaepx eee cocoe poeccopa. pap caaac aoaec acoc o peao oe ee oa popao aa pea pao poeccopa. Coo coco oe eo acao ce (PHP) cao cea (PLP, RTI). p o occaaac cpa ce pap.

Pacooee o coa coco:

     7  6  5  4  3  2  1  0
     N  V  -  B  D  I  Z  C

2.3.6.1. N - pa opaeoo peaa

N pae aee capeo a peaa oepa epeaaeoo aa (poe oa ac pecpa a, oope N e e).

a BIT N a a 7- aa a a aa.

2.3.6.2. V - a

a V a ADC, BIT, CLV, PLP, RTI, SBC.

Kaa CLV aaa V=0.

a BIT V aocc a 6 a a a aa.

V=1 a ADC, a a a aa aa, a SBC, a a a a eaa aa a a. B poo cae oe oa oca V=0.

2.3.6.3. B - pa ocaoa o oae BRK

pa B caaaec 1 p coe oa BRK cpacaec 0 p opae popa ee opao occaoee cea coa coco o oae RTI.

2.3.6.4. D - a ape

aa CLD D=0, aa SED - D=1.

D a ao oa ADC SBC, aaa oo- a a aa.

2.3.6.5. I - pa apea pepa

Koaa SEI oppe I=1 (ape acpex pepa), oaa CLI - I=0.

2.3.6.6. Z - aa aa

Z=1 aa 0 a aa a aa aa (poe oa ac pecpa a, oope eo e e).

2.3.6.7. C - aa a

Koaa CLC oppe C=0, oaa SEC - C=1.

a a ADC SBC, a a CMP, CPX, CPY, a a ASL, ROL a C coep a a aa aa.

a a LSR, ROR a C oaae a ca aa.

2.3.7. Booe epec e pecpa a:

      a: A X Y
       cea: A     P
           A:   X Y     ce a
           X: A       S      a
           Y: A              a
           P:           ce
           S:   X

2.4. Aapaa oa apea

2.4.1. Coepoe aoo coa acoc o oex a ec oe paccapac a:

 - eoe co e aa,
 - eoe co co ao,
 - aop oex o,
 - o oa,
 - ac apeca.

2.4.2. eoe co o 0 o 255 (¤FF) xpac o cex papax coa po oo oe.

ee co ao epaa -128..127 opc ooeo oe:

- 7- pap paccapaec a a ca (0-ooeoo, 1-opaeoo);

- ocae 7 o op o ca: ooex coco pecae o e, a oa o opaeoo ca ce eppc (0<->1), ae pea paec 1.

Ta opao, ee eco opo:

  co: -128 -127 ... -2 -1  0  1  2 ... 126 127
    o:   80   81     FE FF 00 01 02      7E  7F

2.4.3. Apeece oepa a ca: coee (ADC) ae (SBC) - oc a oo pecae oaoo, paa aaec cocoe oa peaa. ex e aa ee cc oepa cpae (oa CMP, CPY, CPX).

Bce ec pooc o o 256: ec pea e a pa pecaoc, e paec eo aec 256 (aec, epc oo 8 ax papo peaa). a o o oo o a coco:

- N=a peaa (7 ): 0-ooeoe o,

1-opaeoe;

- pecp C pae po 9-o papa p ec c e e aa:

C=1, ec p coe epeoc 9 pap, ae 0,

C=0, ec p a o acoae 9 papa, ae 1 (opa a paoc);

- V=1, ec p oepax a e co ao o .. epeoee: epexo epe epa 7F:80 :

     7D+06=83 :  125+6=-125
     90-18=78 : -112-24=120

- Z=1, ec pea eo, ae 0.

Bce pa paaac eaco, o p paoe c e e aa e ee cca V, a p paoe c e co ao - C.

Pecp C coec, apep, p popapoa ooaoo ape paoo epeoca aa a. oo oaa coe ADC pae ce cox apeo aee C, a oaa a SBC ae eppoa C paoc. oo aae peec cao C opao c oo oa CLC SEC, a ae o e oac aoaec. pep ce c paoc x apeco 2 aa:

   ¤1280 + ¤2180 :  1) CLC  , 80+80+0=00  C=1
                    2) C=1  , 12+21+1=34  C=0  => ¤3400

   ¤0001 - ¤0234    1) SEC  , 01-34-0=CD  C=0
                    2) C=0  , 00-02-1=FD  C=1  => ¤FDCD

2.4.4. Koa coe a o oc pee eco ape. p o a paccapaec a ecoe co o 0 o 99, e ax 4 papax axoc o o ae p, a capx 4 - o cape p. Pea ee o e , pa epeoca C paaac o oe pa. pep:

      37 :   0011 0111      92 :  1001 0010
     +82 :   1000 0010     -65 :  0110 0101
    =119 : 1 0001 1001     =27 :  0010 0111

2.4.5. B oecx oepax coa paccapac a aop o: ec a o e ac o ec a p.

oec oepa a a c:

 - oecoe "" (AND),
 - oecoe "" (ORA),
 - caee "" (EOR), coee o o 2;
   pae cee ae a x apeax (opapo a ao ape o):

      AND 0 1     ORA 0 1     EOR 0 1
         ----       ----        ----
      0 ! 0 0     0 ! 0 1     0 ! 0 1
      1 ! 0 1     1 ! 1 1     1 ! 1 0

 - apeec c eo (ASL),
 - apeec c pao (LSR),
 - ec c c epeoco eo (ROL),
 - ec c c epeoco pao (ROR);
   ee opo o a:

 cxooe cocoe:  C  ! d7 d6 d5 d4 d3 d2 d1 d0 !
                ASL:  d7 ! d6 d5 d4 d3 d2 d1 d0 0  !
                LSR:  d0 ! 0  d7 d6 d5 d4 d3 d2 d1 !
                ROL:  d7 ! d6 d5 d4 d3 d2 d1 d0 C  !
                ROR:  d0 ! C  d7 d6 d5 d4 d3 d2 d1 !

epa pa oepa ooe ec oo opao co, e aece opoo apea ac coex o:

                   oepa  o.  aca     pea
 - eee a  xxxxxxxx AND 00010000 = 000x0000
 - cpoc a      xxxxxxxx AND 11101111 = xxx0xxxx
 - caoa a  xxxxxxxx ORA 00001000 = xxxx1xxx
 - epc a   xx1xx0xx EOR 00100100 = xx0xx1xx
   (cpaee)

pa co ooe, apep, opaoa oee eee c ocao a cee 2.

2.4.6. Coepoe coa caec oo oa ac apeca p ope epoe poeccopo oepeo oa ee oepao.

2.5. Opaoa pepa.

pepae - o ca poeccop pepa coee ocoo popa epe popae opao pepa. 6502 opaaae p a pepa:

   - ca oeo cpoca (RESET),
   - acpee pepa (IRQ),
   - eacpee pepa (NMI).

Ca oeo cpoca poxo p aa a "CPOC" ae epexo o apec, eae eax ¤FFFC-FFFD.

p oce px pepa poeccop aoae ce coo coco P apec ee oa PC epexo oe opopa, apec oopo aa ¤FFFA-FFFB eacpex pepa ¤FFFE-FFFF acpex. opopaa opao oe coe pao oa o oa RTI; p o occaaaec cea aee PC P pooaec oee pepao popa c eca ocaoa.

Macpee pepa o apee: oo I coa coco cee cao 1 (SEI). Ce apea - cpoc I 0 (CLI). o oe oaoc, apep, p opae coo, e pe oca po.

He acpec ooceec IRQ pepae o oae ocaoa BRK. opopaa opao oe pacoa eo o 1 e B coa coco.

Heacpee pepa ape e.

2.6. Cppa oa apeca

2.6.1. o

Koaa - o aae poeccop o eoop oepa a aopo pecpo ee a. Coooc oex poeccopo oepa opae cce oa.

Koaa 6502 coco oa e oee 1 oepaa aae a o 1 o 3 ao.

Ko oa (1 a) ooao opeee oe oepa, ace e pecp, coco aa oepaa ( apeca) , ceoaeo, o oa.

Oepa (2 2-3 a) aae oae ape (co), c oop oa oa paoa, cc a ape cc a eco, a ao oec pea. Heocae ape xpac cpoax pecpax, pea (poe oceeo ca) oe oeaec pecp.

eapece oa e e oepaa oc a cpoa pecpa.

Apec e apea peaa a aaec coe.

2.6.2. He p oca o apeca coc ooae:

   M - coe apec,
   N - apec ee oa (aa c oo),
   (A) - apec e eo cpa (a a, .. cap pae 0  oaec aoaec), aca  coe A, 
   (A,A+1) - apec, aca  coax A  A+1.

B aooax oo aa aae, ooaee a apeca a oa p ao e. Bo cex pepax apeo e co ¤78.

2.6.2.1. Heocpecea: # (2 aa).

Ape axoc eocpeceo oe oepaa:

    M=N+1
          N : o
         N+1: 78

2.6.2.2. Heo cpa: Z (2 aa).

Ape axoc aao oepao ee eo cpa:

    M=(N+1)
          N : o        0026: 78
         N+1: 26

2.6.2.3. Acoa: A (3 aa).

coe apec aca oe oepaa, apecec c oca a:

    M=(N+1,N+2)
          N : o        2A65: 78
         N+1: 65
         N+2: 2A

2.6.2.4. Acoe ece: A,X (3 aa),

A,Y (3 aa).

coe apec c ooceo aaoo oepae a coepoe pecpa X Y (eoe e aa):

    M=(N+1,N+2)+X
          N : o  X=12  53C0: 78
         N+1: AE
         N+2: 53
    M=(N+1,N+2)+Y
          N : o  Y=FF  0856: 78
         N+1: 57
         N+2: 07

2.6.2.5. Kopoa eca: Z,X (2 aa).

To e, o A,X , o oepa ooao, eca eec o eo cpae ec!

    M=(N+1)+X
          N : o  X=10  0008: 78
         N+1: F8

2.6.2.6. Koceo-eca: (Z,X) (2 aa).

coe apec xpac x oceoaex aax eo cpa; apec aeo x opeeec o Z,X :

    M=((N+1)+X,(N+1)+X+1)
          N : o  X=06  0040: DE  32DE: 78
         N+1: 3A         0041: 32

2.6.2.7. eco-ocea: (Z),Y (2 aa).

coe apec opeeec paee coepoo Y apec, xpaec x oceoaex aax eo cpa; apec aeo x aa oepae:

    M=((N+1),(N+1)+1)+Y     
          N : o  Y=04  0067: 43  BF47: 78
         N+1: 67         0068: BF

2.6.2.8. Oocea: R (2 aa).

coe apec opeeec ceee ooceo cee oa a aaoe oepae co ao (eoe co ao); coec oo oaax cooo epexoa:

    M=N+2+(N+1),      ec 00 <= (N+1) <= 7F
    M=N+2-¤100+(N+1), ec 80 <= (N+1) <= FF

2.6.2.9. ce.

Kocea apeca e cooa pecpo o aoo apec pecopea oa epexoa:

JMP (A)

pe, oa apec pxoc a pa cpa, o cap a apeca epec eoo aa o e cpa (oa cxe poeccopa):

JMP (¤3FF) - apec oec ao ¤3FF ¤300.

Kopoa eca apeca oaax LDX, STX opaec epe pecp Y:

    LDX Z,Y
    STX Z,Y

B px cax p eoxooc eca eo cpa epe Y cee ocooac acoo eco.

2.7. Ocae oa

He p oca coec eoeca opa ac oa. Meoo ooaaec pe ac a. o M ooaaec ape, p a - coepoe pecpo. aa oce apeca, o oa eee pecpo coco.

2.7.1. Koa epec a pecp:

        M->A   M->X   M->Y   

  Me:  LDA    LDX    LDY

   #  :  A9     A2     A0     N V B D I Z C
   Z  :  A5     A6     A4     * - - - - * -
   A  :  AD     AE     AC
  Z,X :  B5    ^B6     B4
  A,X :  BD     -      BC
  A,Y :  B9     BE     -
 (Z,X):  A1     -      - 
 (Z),Y:  B1     -      -      ^ LDX Z,Y

2.7.2. Koa epec pecpo a:

        A->M   X->M   Y->M

  Me:  STA    STX    STY

   Z  :  85     86     84     N V B D I Z C
   A  :  8D     8E     8C     - - - - - - -
  Z,X :  95    ^96     94
  A,X :  9D     -      -
  Y,X :  99     -      -
 (Z,X):  81     -      -
 (Z),Y:  91     -      -      ^ STX Z,Y

2.7.3. Mepecpoe epec:

 A->X  X->A  A->Y  Y->A  X->S  S->X

  TAX   TXA   TAY   TYA   TXS   TSX      N V B D I Z C
  AA    8A    A8    98    9A    BA       * - - - - * -

2.7.4. Apeece oepa:

     A+M+C->A  A-M-(1-C)->A

  Me:  ADC    SBC

   #  :  69     E9            N V B D I Z C
   Z  :  65     E5            * * - - - * *
   A  :  6D     ED
  Z,X :  75     F5
  A,X :  7D     FD
  A,Y :  79     F9
 (Z,X):  61     E1
 (Z),Y:  71     F1

2.7.5. Oepa cpae:

         A-M    X-M    Y-M  ( o pecp e eec) 

  Me:  CMP    CPX    CPY

   #  :  C9     E0     C0     N V B D I Z C
   Z  :  C5     E4     C4     * - - - - * *
   A  :  CD     EC     CC
  Z,X :  D5     -      -
  A,X :  DD     -      -
  A,Y :  D9     -      -
 (Z,X):  C1     -      -
 (Z),Y:  D1     -      -

2.7.6. oece oepa:

      A&M->A  A!M->A  A%M->A  A&M  (opapo) 

  Me:  AND    ORA    EOR    BIT

   #  :  29     09     49     -     N V B D I Z C
   Z  :  25     05     45     24    * - - - - * -
   A  :  2D     0D     4D     2C   d7d6 - - - * - (BIT)
  Z,X :  35     15     55     -
  A,X :  3D     1D     5D     -
  A,Y :  39     19     49     -    & - o. 
 (Z,X):  21     01     41     -    ! - o. 
 (Z),Y:  31     11     51     -    % - c. 

2.7.7. Oepa ca:

Ape.c M .c M

eo pao eo pao

  Me:  ASL    LSR    ROL    ROR

  a.:  0A     4A     2A     6A    N V B D I Z C
   Z  :  06     46     26     66    * - - - - *d7 (eo)
   A  :  0E     4E     2E     6E    * - - - - *d0 (pao)
  Z,X :  16     56     36     76
  A,X :  1E     5E     3E     7E

Aopa apeca - ece a pecpo A, oepa o cae e aaec.

2.7.8. eee eee a 1:

       M+1->M M-1->M X+1->X Y+1->Y X-1->X  Y-1->Y

  Me:  INC    DEC    INX    INY    DEX    DEY
                       E8     C8     CA     88
   Z  :  E6     C6
   A  :  EE     CE                  N V B D I Z C
  Z,X :  F6     D6                  * - - - - * -
  A,X :  FE     DE

2.7.9. caoa o coa coco:

         C     V     D     I

    0:  CLC   CLV   CLD   CLI      pe 
         18    B8    D8    58       e ec

    1:  SEC    -    SED   SEI      eapece
         38          F8    78

2.7.10. coe epexo:

ece:            PC+2+M->PC
 coe: Z=1  Z=0  N=1  N=0  C=1  C=0  V=1  V=0

          BEQ  BNE  BMI  BPL  BCS  BCC  BVS  BVC
          F0   D0   30   10   B0   90   70   50

oocea apeca, coco e ec

2.7.11. epexo:

                   ec           Me  T:o
eco      : M->PC               JMP  A:4C (A):6C
Ha opopa  : c PC+2,M->PC      JSR  A:20
Bopa  /   : c PC, PC+1->PC   RTS  60
Bopa  pep-: c P, c PC     RTI  40

2.7.12. Oepa co ceo:

     c A  c P  c A  c P

      PHA    PHP     PLA    PLP   (PLA oece
      48     08      68     28     a pa Z,N)

2.7.13. poe:

   He oepa  Ocao(c P,c PC+2,(FFFA,FFFB)->PC)

         NOP      BRK
         EA       00

2.8. Coa oa poeccopa 6502.

B ae epe o aa pe coe oa aax ee ecaaep o.

     (Z,X)   Z     #     A   (Z),Y   Z,X   A,Y   A,X

ORA ! 6.01  3.05  2.09  4.OD  5.11  4.15  4.19  4.1D
AND ! 6.21  3.25  2.29  4.2D  5.31  4.35  4.39  4.3D
EOR ! 6.41  3.45  2.49  4.4D  5.51  4.55  4.59  4.5D
ADC ! 6.61  3.65  2.69  4.6D  5.71  4.75  4.79  4.7D
STA 1 6.81  3.85        4.8D  5.91  4.95  5.99  5.9D
LDA ! 6.A1  3.A5  2.A9  4.AD  5.B1  4.B5  4.B9  4.BD
CMP ! 6.C1  3.C5  2.C9  4.CD  5.D1  4.D5  4.D9  4.DD
SBC ! 6.E1  3.E5  2.E9  4.ED  5.F1  4.F5  4.F9  4.FD
ASL !       5.06  2.0A* 6.0E        6.16        7.1E
ROL !       5.26  2.2A* 6.2E        6.36        7.3E
LSR !       5.46  2.4A* 6.4E        6.76        7.5E
ROR !       5.66  2.6A* 6.6E        6.96        7.7E
DEC !       5.C6        6.CE        6.D6        7.DE
INC !       5.E6        6.EE        6.F6        7.FE
BIT !       3.24        4.8C
STX !       3.84        4.8C        4.94
STY !       3.86        4.8E        4.96*
LDY !       3.A4  2.A0  4.AC        4.B4        4.BC
LDX !       3.A6  2.A2  4.AE        4.B6* 4.BE
CPY !       3.C4  2.C0  4.CC
CPX !       3.E4  2.E0  4.EC
JMP !                   3.4C  5.6C*
JSR !                   6.20
ce: ASL, LSR, ROL, ROR # -> aopa
            LDX, STX Z,X -> Z,Y
            JMP (Z),Y -> (A)

BPL   BMI   BVC   BVS   BCC   BCS   BNE   BEQ
2.10  2.30  2.50  2.70  2.90  2.B0  2.D0  2.F0

CLC   SEC   CLI   SEI   NOP   CLV   CLD   SED
2.18  2.38  2.58  2.78  2.EA  2.B8  2.D8  2.F8

PHP   PLP   PHA   PLA   DEY   INY   DEX   INX
3.08  4.28  3.48  4.68  2.88  2.C8  2.CA  2.E8

TXA   TXS   TAX   TSX   TYA   TAY   RTI   RTI   BRK
2.8A  2.9A  2.AA  2.BA  2.98  2.A8  6.40  6.60  7.00

 

3. Apxepa BM "AAT"

3.1. Cppa a

BM "AAT" 7 coe ee ce cpp a:

 - ocoa  , 32 ,
 - ooea oepaa a, 32K a,
 -  /, 4K a,
 -  , 32K a.

Pacooe ao a apeco pocpace 64K a oaa a pc.3.1.

                 ------------
0000             !          !
                 ! ocooe !
                 !   O    !
7FFF             !          !
             ---------------------
8000         !         !         !
             ! HopO ! oO  !
BFFF         !         !         !
             ---------------------
C000             !          !
                 ! o/ !
CFFF             !          !
     ----------------- -----------------
D000 !       !       ! !       !       !
     ! LC0D0 ! LC0D1 ! ! LC1D0 ! LC1D1 !
DFFF !       !       ! !       !       !
     ----------------- -----------------
E000     !       !         !        !
         !  LC0  !         !  LC1   !
FFFF     !       !         !        !
         ---------         ----------

Pc.3.1. Cppa a

3.1.1. Ocoa o

Ocoa oepaa a (0000-7FFF) pacooea a eae BM ocoo oca a ee ac. B e pacooe:

- 00 cpaa, epe oop oec ocea apeca oaax poeccopa a oopo pacoaac aoee opeee e; ec e axoc ocoe paoe e cce;

- 01 cpaa, coea a ce poeccopa, xpaee ec po opa eoco;

- paa a: 8 32 (¤20) oceoaex cpa, acoc o pea oopae.

3.1.2. ooea oepaa a

ooea oepaa a (8000-BFFF) ae oo paeo X (oo 4), coco x ao a o 16K a, pacoaaxc ox ex e apecax, oe axoc 3 cocox:

- oce a ee ac o HopO (CX08),

- oce a ee ac o oO (CX09),

- e oce o oo (o ce apeca aec ¤FF) (CX00).

B coax aa apec, ac o oopo caaae aoe cocoe. oce cao o cex aax cpa CX aec aa ooa apeca. p e a ooea a oea.

3.1.3. ocoa a

ocoa a (D000-FFFF) pacooea a oeo a a oo paeo Y (oo 2), coco 4 ao o 4K a apecax D000-DFFF, 2 ao o 8K a apecax E000-FFFF. aec a a ec O c ao o ac a oe pee oca oo a ee, oo a ac. Bop coco ocecec ac o apec ¤CYNM, e N M opeec a:

----------------------------------------------
!  N !    0    !    2    !    4    !    6    !
! M  !         !         !         !         !
----------------------------------------------
! 0  !  LC0  !  LC0  !  LC0  !  LC0  !
!    !  LC0D0 !  LC0D0 !  LC0D1 !  LC0D1 !
----------------------------------------------
! 1  !  LC1  !  LC1  !  LC1  !  LC1  !
!    !  LC1D0 !  LC1D0 !  LC1D1 !  LC1D1 !
----------------------------------------------

o ce apeca cpa CY aec eee aee NM c caoe cap o.

B pee e ac a e poo ax ec, pee ac o apeca D000-F7FF aec ¤FF, a o apeca F800-FFFF - popaa "Cce oop".

3.1.4. e oa/oa

a ceoa C000-CFFF c pae epep cpoca e oe cooa xpae opa.

3.2. Ocae peeo epeca

3.2.1. a a/a "" ca a c aa a/a a ac ac caca.

c a/a pecaec a eo, o , o poae a c ca a/a.

c cac, a/a, a aca C000-CFFF. ca C000-C7FF - cc a/a. ca C800-CFFF c cc a/a, .. a c e 2 a.

a / opaeec a:

- pe epec, paee a eae BM;

- , ooe aa, caoe 7 paeax ea.

Pae epc o 0 o 6 (aee oep paea ooaaec X); a ae ae BM o ooae, cooeceo, E2-E8.

B pae 0 (E2) ocoo caoea aa epaoo poeccopa. e c apeca C000-C08F, C0F0-C0FF oee peeo epeca.

Bpe epec ec cocao ac ea oeceae paee oe opae c aapo, acce aooo, aaoo-po a, eooopo ao.

c aoo paea X (1-6) c c CX00-CXFF, C0Y0-C0YF, e Y=X+8. c c c C800-CFFF. Oa caoc oco p opae o o apec cpa CX.

c / c c a, .

3.2.2. c

e C000-C00F a c . c C000-C00F c 1, c - c (7-pap ASCII). ooeo cap pap C063 eec c cpa: o pae 1, C, 0, L. , aapa ooe paa ae oe pcce ace a, o oo o oe coppoa popao acoc o coeo opo.

C ee o c oo pacoa c c c c. e cpoa aap C010-C01F : opaee o oao poeccopa cpacae cap ee C000-C00F 0 o aa cee a.

pep opopa oa coa c aap:

     : LDA ¤C000 ; c 
        BPL M     ; c =0: aa e aaa
        BIT ¤C010 ; cc c
        ASL       ; cpoc capeo papa
        ASL ¤C063 ; C/LAT->C
        ROR       ; C/LAT->cap pap
        RTS

3.2.3.

, pacooeo opce a, ca e C030-C03F. Bce o paoa. o oao poeccopa c c c . eoc opae, .

3.2.4.

c C040-C04F , c C050-C05F - x e (a pe oee aoopo): opaee oo x o oao poeccopa. IRQ c c c 500 , NMI - c c 50 . IRQ , ccc NMI. NMI co c acoo eooopa c .

3.2.5. c cc

p ac e c acceoo aooa opa peopaec popao.

Cc - c-.

c cc c C020-C02F. ee o oa cc c c c acae oceoaeoc co. c 1 oa cc oa c c c, c 0 - c.

C cc c C060. c o coeo ac 060 c epeac c 0 1, c 0 1 , opee aco e co: C020 c eppoae c C060 .

3.2.6. -

c - () ooe a o .

C C061 C062, cooeceo, c c cax .

coc , c c C064 C065, cc. C C CTAHHX .

c pooc ce opao:

- oa cc c c C070 - C07F;

- c c C064 (/ C065), c 0.

C070 1 c e C064 (C065) .

3.2.7. Beooop paa a

opaaea a pae opa xpac a BM. Toee, a pae cea oopaaec coepoe eoopoo aca a. ec 5 peo oopae.

CP BP paa a aae 8K, ocax peo - 2K. Haa apec pao a pae ee e. oopae oeopeo co aca a o pee cee opac o apec C7XY, e XY opeeec o ae.

apec:  00 08 10 18 20 28 30 38 40 48 50 58 60 68 70 78
pe !------------------------------------------------
  HP ! 00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C
  CP ! 01 -- -- -- 11 -- -- -- 21 -- -- -- 31 -- -- --
  C ! 02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E
  HC ! 82 86 8A 8E 92 96 9A 9E A2 A6 AA AE B2 B6 BA BE
  BP ! 03 -- -- -- 13 -- -- -- 23 -- -- -- 33 -- -- --

He p oca opo paeco opa pax peax coc ooae:

    MX,MY - paep paa o opoa  epa  oax pea,
    Y - oep cpo, ca o 0 o MY-1 cepx,
    X - oep o  cpoe, ca o 0 o MX-1 cea,
     - apec aaa pao a,
    A - apec aa, opeo o (X,Y).

1. C: MX = MY = ¤20

           A =  + Y * ¤40 + 2 * X   (2 aa)

B epo ae xpac o coa, o opo - eo e e 00H0M, e

 HM = 00 - epc   = 000 - ep  100 - c
      01 - epa        001 - pac 101 - oeo
      10 - opa       010 - ee 110 - oo
      11 - opa       011 - e  111 - e

2. HC: MX = ¤40, MY = ¤20

           A =  + Y * ¤40 + X

B ae xpac o coa.

Kpae ¤1000 pae oac opaac e epx coo a eo oe, epae - aoopo.

3. HP: MX = MY = ¤40

           A =  + Y * ¤20 + X/2   (oaa)

a coep 2 o: 7-4 - e, 3-0 - pa. e opec a 6-4 2-0, a C.

4. CP: MX = MY = ¤80

           A =  + Y * ¤40 + X/2   (oaa)

Kopoa aa, a HP.

5. BP: MX = MY = ¤100

           A =  + Y * ¤40 + X/8   (o 1 )

a coep 8 oceoaex oe cpo: 1 ope e e, 0 - ep.

3.3. aa oceoaeoo apaeoo epeca ()

3.3.1. aa caaaec oo paeo BM pa cc, apep, c pepo.

a c cc co 58055, c c - co 58051. ee opoa c c c c.

3.3.2. popape apae epec (P)

C0Y0-C0Y3 coaae c e C0Y4-C0Y7 (Y - oep paea+8).

2 ax papa apeca ooaa apece op.

c 24 () /. O opaec : B, 12 . .

ec 8-papx : A, B C. 4 c C cc . B 4 C cc B.

cc c (R)

opa cooec e a:

    A - C0Y0
    B - C0Y1
    C - C0Y2
    R - C0Y3

cp c . ee eo eooo.

c ccc c cc.

3 :

- "0" - c /;

- "1" - c /;

- "2" - .

R eoxoo c (p coa e d0, d1 ..):

 d0 -  C,  : 1-       0-
 d1 -  B:                  1-       0-
 d2 -   B :         1- "1"  0- "0"
 d3 -  C, c : 1-       0-
 d4 -  A:                  1-       0-
 d5 
 d6 -  : 00- "0"
                        01- "1"
                        10- "2"
                        11- "2"
 d7 = 1

3.3.3. e

3.3.3.1. "0" c cc c c . c c. c , .

3.3.3.2. "1" c cc c cc c c . "1" A B c cc C c. , "1" c A B, cc 8- 4- c.

, .

C "1"().

 1. C A - 4-   C (C4).
    C B - C2.

0 , ( A B).

 2.   - C5
      - C1

c ,B ( ) c c "c" cpacc c cc. cc c c .

 3.  - C3
     - C0

c ( B) cc c c c cc. c c c c=1, =1, INTE=1 ccc c c cc cc.

 4. INTE A - C4
    INTE B - C2

c A,B. 1 cc c A B.

C "1"().

 1.   - C7
      - C1

c. 0 cc , cc . C cc p c ccc c "".

 2. .  - C6
    .  - C2

c "" , cc.

 3.  - C3
     - C0

c , "1"(). c , c c .=1, INTE=1. Cpoc , c c c , .

 4. INTE A - C6
    INTE B - C2

c , "1" .

3.3.3.3. "2": c .

"2", c c , c 8- .

c, c c , c cc C.

C "2".

 1.  - C3

c. c .

 2.   - C7

c.

 3. . - C6

c.

 4. INTE1 - C6

c c . c cc c .

 5. C  - C4

Bxoo ca.

 6.   - C5

.

 7. INTE2 - C4

c c ; c c cc .

c "2" o e, o "1", poe c .. eo c . cc.

"2" c C c , (C0-C2) , C "0". C C0-C2 c c c c.

c "1", C0-C2 cc c, c "1".

"1" "2" opa C oo c c cc, cc .

c cc "1":

                     
 p. B d0                
       d1          
       d2  INTE B      INTE B

 p. B d3           
       d4  INTE A      /
       d5         /
       d6  /  INTE A
       d7  /   

c cc "2":

 p. B   d0       
         d1     
                 (0  1)
 p. A   d3   
         d4   INTE 2
         d5    
         d6   INTE 1
         d7    

B "1"() C6 C7 c a e e. c d3 c, c c .

"1"() cc c .

3.3.4. (C)

3.3.4.1. C0Y8-C0YF.

C0Y8 ee - o pecp ax,

C0Y9 eee - o pecp oa.

c cc cc c c c c . c . C cc cc . C cc () cc c (). C .

: .

. , . . . RESET.

: ; ao peo - a pe a epea ax ee cpoc.

. coe . DTR, DSR, CTS, RTS, TxC, RxC (. ) , .

Aop epea acxpoo pee:

1. .

2. ( ).

3. ( ).

4. ( ).

5. .

6. 3,4,5,7.

7. , .

Aop pea acxpoo pee:

1. .

2. .

3. .

4. .

5. 3,4,6,7.

6. ( ).

7. , .

, oo .

.

3.3.4.2. , .

d0,d1 - ( ) .

     00 -  ,
     10 -  ,   1*1 (     ),
     01 -  ,   16*1(   1/16   ),
     11 -  ,   64*1(   1/64   ).

d2,d3 - a :

     00 - 5 ,
     10 - 6 ,
     01 - 7 ,
     11 - 8 .

d4 - e ( ):

     1 -   ,
     0 -   .

d5 - :

     1 -  pocxo,
     0 -   .

d6,d7 - o:

     00 -   ,
     10 - 1 ,
     01 - 2 ,
     11 - 3 .

3.3.4.3. , .

d1,d0 00.

d2,d3 - a (a e a acxpoo pee).

d4,d5 - , c .

d6 - opeee .

d7 - :

     0 - ,
     1 - .

" , , . : , .

3.3.4.4. .

d0 ( xEN) epea.

     1 - ,
     0 - .

d1 (DTR, ) .

d2 (RxE) .

     1 - ,
     0 - .

d3 :

     0 - ,
     1 -     - .

d4 ( ) - PE, OE, FE.

d5 - .

d6 - :

     1 -         .

d7 - .

3.3.4.5. .

TxRDY - ( , , )

TxEMPTY - , .

DSR - .

DTR - .

RTS - .

CTS - , .

TxC - ...

SYNDET - "1" , .

RxRDY - , .

3.3.4.6. .

d1,d2,d6 RxRDY,TxEMPTY,SYNDET.

d5 ( FE- ) - FE , .

d4 ( OE- ) - , .

d3 ( PE- ) - . PE .

d7 (DSR, ) .

d0 (TxRDY, ) - CTS=0, TxEN=1.

3.4. paee cooo

3.4.1. Kopoep HM

"" (). / / () , . -5088.02. .

e o pe ca. . c , c oep. a a e aca . . e .

3.4.2. paee opoepo

pae opoepo ca apeca C0Y0-C0YF, e Y=X+8, a X - oep paea, oopo oe opoep. a oaa poeccopa, ea coe apeco o x ee, oe paee opoepo.

C0YA ae po 1, a C0YB - po 2. po po p o aec.

C0Y9 ae , a C0Y8 ae eo.

C0Y0-C0Y7 . , .

              
              !
         D- <-* ---B
              !
              C          

(ABCD), . ( B , , ). C0Y1, C0Y3, C0Y5, C0Y7 , , A, B, C D, C0Y0, C0Y2, C0Y4, C0Y6 . "ABCDA..." , "ADCBA..."- . 1 . C , C0Y1 C0Y5. 1 2 .

pao pae oepa o ca , poepe cea cecopo. aee, WRITE PROTECT c .

WRITE PROTECT , , .

3.4.3. ee ac ax

, . e ac ca e oa-oa C0YC-C0YF.

Opaee C0YE ae pe e. . C0YC , eo 1. , .

e epx oaxc ( ooa caoea a eoopo pee):

     LDX #¤30    ; oep paea HM * 16
     LDY #¤00
     LDA ¤C08E,X ;   
READ LDA ¤C08C,X ;  
     BPL READ    ; e, oa d7=0
     STA TABL,Y  ;    
     INY
     CPY #¤03
     BNE READ    ;  a 3 paa
     RTS

aeae. cooa pe eca epe pecp X ooe cea popa eaco o oepa paea, oopo axoc opoep HM: o acpo ocaoo e aee pecpa. o pe coec p paoe c p cpoca, ecoooee oopx e cpoao.

opaee o apec C0YF. epe 100 ce . c, oec eo C0YD oo opaee C0YC. c , , :

     LDA TABL
     STA ¤C08D,X ;    
     ORA ¤C08C,X ;      

opae C0YC , e c, ecoo pa . o 32 e C08C.

WRITE PROTECT, opaee C0YD a C0YE. oo aa pae 1, . pep:

     LDA ¤C08D,X
     LDA ¤C08E,X ;   WRITE PROTECT
     BMI WRERR   ;  

3.4.4. opoepa HM

CX00-CXFF (X- ) . a popaa- . "" . , ¤800, ca . Ta, co oepe, apae eoop cce popapoa, pacooe opeeeo ece ce. o poecc aaec "xoo capo" opoo oca 7.

3.4.5. opa ax a ce

, ae c, opoepo aaac o:

- 1 ;

- ;

- .

co oeop 66 ao aaoa 96-FF.

, c, epeopoa ee: 6 8 , c. - 8 6 .

peea caapa opoa coocae 6-o ca 00-3F 64 "pax" cox aa, peepp o D5 AA .

"" 16 ax o 256 ao.

co o .

ee :

    D5 AA 96  Noa Npea Nceopa op.ca DE AA EB

To, pe ceop opoa ca opc aa a, o 1, .

oe ax ee :

    D5 AA AD  342 "pax" aa  op.ca DE AA EB
              coo. 256 aco

Tao opa ax a pee, pao a c eoxoa opoa, oepaec caapo popao-paepo RWTS, eec OC "o" ao OC eca. C o pe ooae oa ae/e 256-a ceop ax o aa oepa pea ceopa a ce, oo ae ecoo opaa ca eo eoaeo. opoo epec o popa oca 8.

3.5. Opeeee opa BM

aoap pao "o" ee oa-oa pax cpoc a ee ooo popa e opee, ae cpoca ae pae oe BM.

paec o opa ae cea oceoaeoc opoca ex ao cpa C1-C6:

     LDA ¤CN00 ; o  cex N=1..6
     BPL ---> aa ooeoo O
     CMP #¤FF
     BEQ ---> co pae  epacoaaoe a e cpoco
     CMP #¤A2
     BEQ ---> coo
     JMP ---> aa 

Bce aae a, poe cooa, oac o e e co o cex aax cpa. coo ee oac CX00-CXFF xapaep popa, o o a oopo oe pacoa. Ta e oo oc x cpoc, ex ae popa.

aa epeca pacoaec e opoca ee C0Y1 (oe 00) C0Y3 (FF) Y=9..E. Toa oep paea X=Y-8.

 

4. PEAKTOP OK

o coe aae oao Peaop OK paec e oaec o Peaopa Papa-eppeaopa. o oe paoe a, oooc oa ox ax eacoc o px popax cpec ea eo po opao pooo ecoo opa.

ooee oooc Peaopa OK:

1. Paoa a pacpea c 8 o 20 Ka.

2. oae a "." "=" epea pecp ox ax a oe. B ox oex BM ec oooc oopae ax . eooe pae ox ax pee C ocaeo paeoc.

3. B e eco pe "BT" ec pea "KOHE PAOT", aa "xoo cap" a.

4. Beco pe "KOHE PAOT" (xo c pace Papa-popa) ec pea "ACCEMPOBAT", oceca o Acceepa c oce opao Peaop.

5. oaea pea "BT B OTAK" c oe cco.

 

5. ACCEMEP

5.1. Oe cee ocoe o

Acceepa - oo po. ae, oop o oeppe, - o e a xpaec x ca eoo papoc.

popao a Acceepe ec oceoaeoc ax oa, acax coeco e. Koa a cooec oaa popoeccopa. Koaa coco eooa e oee ooo oepaa. Meoo opeee o oa eaco o a apeca, a oepa aae ace e ae o o apeca.

poecc pac c Acceepa aaec accepoae. p accepoa aa oaa a opoae o a oa, a c cxoa popaa - oe (o) popa. oco oea popaa oa pacoaac opeo oac a, cxoo popae oe aa ee aa apec, o oopo p accepoa cc acoe apeca paee cex oa.

ooae cox ax opaa epexoo coc coece e. Bce ae eo oce oepa a ca cc p accepoa opoa oeo popae coe oca.

B e cece aop ceooa, oox pa xoo accepoa paeee ax oeo popae.

Accepoae eec a poxoa: a epo cc ce pae opeec ce apeca, a opo pocxo aeca eepa oa.

5.2. Cppa popa

Koa (a ae ceooa, oope e ppaac oaa, ec e ooapaec ocoo) acac o oo a cpoe cee opae (oa H):

   [ ea [:] ] {poe} eoo [ {poe} oepa ] oeap

Koeape caec ce, o ocaec cpoe oce oape eooa , ec ao, oepaa.

Koeap cac ae ca cpoa cpoa, aaac c "*" ";" .

Mea oe ae pacoaac a oeo cpoe. oeoe ee e oocc cca e ee.

Meoo oa coco pex pocx acx coaa c ee p oca cce oa ooae.

5.3. Opeeee cooae eo

Mea aaec c coep poce pcce ace , p, o oep o ope. a e e opaea, ce co aae.

Mea ooaae eoopoe co opeeec cocoa:

- ea epe oao ooecec c apeco paee o oa;

- ea epe ceooao EQU ooecec co aee oepaa o ceooa.

oope opeee eo apee.

aee e eco o ce popae eaco o eca ee opeee.

Me-apeca ca popapoa cco epexoo oeo popae. Ec eoopa oaa caea eo, o epexo a ee aaec aae o e oae epexoa:

        JSR M
        ...
     M: LDA #0
        ...
        BNE M

p accepoa cec pea apec oeeo oa ocaec apec ac oa epexoa.

B oe cae e o pa cca coe ocaa, apep:

     PHA EQU 32
     BCOTA EQU 4
            LDA #PHA*BCOTA

5.4. Oepa

5.4.1. ca

ca Acceepe ca ac apeco coepoo ee a oo, acoc o cca, e pae aao pecae:

 - ooaoe (M-ca) o 0 o 255 - eocpecee oepa  apeca ee 0- cpa;
 - xaoe (A-ca) o 0 o 65535 - pooe apeca.

M-ca ope ee, e pec A-ca, o poc xaoo .

Ocoe pec oo aaa ca 4 cceax cce:

 - eco: 123 , 62236 ;
 - ecaaepo: ¤7B , ¤F31C ;
 - ocepo:  173 ,  171434 ;
 - oo: :01111011 , :1111001100011100 .

5.4.2. Coe oca

Coa ocaa - o poo co, epe oop co aocpo (') aa ("). Tao e a oo ca oce coa. pep:

     'A  "5  '#'  "?"  "'"  '"'

Coa ocaa peopaec M-co: o aaoo coa.

B ceooaax ASC DCI coec ecoa ocaa: oceoaeoc coo, aea poo opae, e cpeac ece:

     .TO TEKCT.   "PBET"   =TEKCT "PBET"=

5.4.3. Bpae

Bpaee ee :

       [ < ] co { a_oepa co }
         >
       a_oepa:  + - * / ! & %

poe ac pae eoc.

Beco ce o opec e, coe oca a * , oaa apec paee ee accepeo oa.

oece oepa (&), (!) caee (%) oc opapo.

Apeece oepa: coee (+), ae (-), oee (*) eee aeo (/), - oc o o 65536 (¤10000):

      65500+200=164
      ¤1234-¤1237=¤FFFD .

ape oepa < > epeo M-co, cooeceo, cap a a A-ca po paee epoo (oep cpa oep aa cpae):

      >¤ABCD  - o ¤CD ,
      <¤ABCD  - o ¤AB .

Bce oepa e pa pope, pae cc cea apao, co eoc. Oepa > < cc oce.

paa opeee a ca pae:

1) Oepa p eocpeceo oceo apeca o aa A-ca, o ooae pea aoaec poc M-c opacae capeo aa:

      LDA (0-1),Y  ;=¤FF
      LDA #¤1234   ;=¤34

2) B px cax apeca (aco 0-cpa) opeeec o epoo ca pae:

      LDA 0-1       LDA ¤20,X   - o 0-cpaa,
      LDA ¤FFFF+1   LDA ¤0020,X - o acoa.

pep pae:

      10*¤A+7    ;=107=¤6B
      10*¤A+7/2  ;=107/2=53=¤35
      < 17* 30   ;=15*24/256=1
      :10110110%:10110111 ;=:00000001
      >¤3FFF+1   ;=0
      <¤3F0F+1   ;=¤3F, a e ¤40
      *+2        ;e.apec+2
      0005*7+*   ;e apec+35

ac apeca ADR e oceoaee e:

      LDA #>ADR
      STA ADRES
      LDA #<ADR
      STA ADRES+1

5.4.4. aae a apeca

B Acceepe coc e e ooae o apeca, oope ee p oca cce oa. Ooaeo, oepa oa ee :

      paee    - acoa, 0-cpaa, oocea,
     #paee    - eocpecea,
      paee,X  - eca o X (oe op),
      paee,Y  - eca o Y,
     (paee,X) - oceo-eca o X,
     (paee),Y - eco-ocea o Y,
     (paee)   - ocea  oa JMP.

Bop acoo 0-cpao apeca pocxo acoc o a ca, opeeeoo paee (A M).

Aopa apeca oaax ca ooaaec o A , ea A eoca.

pep:

       pao           epao
      LDA #>ADRES         LDA (ADRES,X)+1
      ASL A               CMP A
      STA (LOC+2),Y       STA (LOC)+2,Y
      ADC COMMON-1,X      ADC COMMON,X-1
      CMP WORK            STA ADR+#8

5.5. ceooa Acceepa

5.5.1. opa ceooa

ceooa e o e opa ac, o oa (eoo oepa), o ca oa e opoa ca aa Acceep o e e ec c cxoo oeo popao.

Cco ceooa:

     ASC   DEND    DW      FIN    REP
     CHR   DFB     ELSE    LST    SBTL
     CHN   DO      ENTRY   MSB    SKIP
     DCI   DS      EXTRN   PAGE   OBJ
     DDB   DSECT   EQU     REL    ORG

5.5.2. Opaa cxoo popa (CHN)

Ka pao, cxoa popaa pacoaaec oo ecoo ae, o oo ca accepoa ecoo ao. oo ocee cpoe aoo aa, poe oceeo, aaec:

CHN aae ceeo aa

p o coepoe cex cax ao paccaaec, a ea cxoa popaa.

Opae a opo accepoa cax ao c. 5.6.

5.5.3. Opaa oeo popa (ORG)

   opa:   ORG  apec

aae o oe popa, .e.:

- acae a c pe popa, ec oa a (o a ee - c. 5.6);

- caaae apec paee oeo popa (o e - epo oa).

Xo oa ORG popae oaea, ae oea popaa e opoaec.

Paep oeo popa e oe pea 6K a (oe epa Acceepa).

5.5.4. Paeee oeo popa a (OBJ)

   opa:   OBJ  apec

aae a eoxooc paec oce ac oeo popa c aaoo eca oepao a. Paeee pocxo cpa o ooa accepoa e e a oe popa, acae a c.

Boo o p paee oeo popa e a "coe" ece (aao ORG): acoe apeca cex ee oe epexoa ocac pe, o pe a popaa axoc po ece.

oc paeee, cee a cooae oepao a ccee.

5.5.5. Opaa epeeaex ao (REL)

   opa:   REL

ocea oea popaa acaec a c e -aa, xpaeo ocoo opae cc a acoe apeca p ee. a cceo e oepac, acpo x a ope oac a peoaaec oco ap.

5.5.6. Opeeee eo (EQU)

   opa:   ea  EQU  paee

C ooae cox oca ea, o oeae ee popa ee oa. pep:

     KPAH EQU ¤1000
     BEPX EQU 5
     BCOTA EQU 20
     EB EQU 2
     PHA EQU 28
     PAB EQU EB+PHA-1
     H EQU BEPX+BCOTA
     CME EQU BEPX*PHA
     OKHO EQU KPAH+CME

eee x oca pee ee apaepo oa paa o ce popae.

Bpaee pao ac cec p epo poxoe accepoa. oo ce e, coe e, o opeee e.

Bce opeee oo cocpeoo aae popa, pa a ccoe p.

5.5.7. ac ax popae

Bce cee ceooa aca oe popa oceoaeoc ao, aa c eeo apeca paee:

DFB M1,...,Mn - ac aax ce o oo ae;

DW A - ac apeca caapo ope (>A,<A);

DDB A - aoopo (<A,>A);

ASC op ec op - ac ASCII-oo coo eca o oo ae; opae - o co, oopoo e ece;

DCI op ec op - o e, o cex coo, poe oceeo cap e cpoe (aoe aae eco oo p popapoa opao cpo coo).

DS A-co - ac aaoo ca ex ao; coec peeppoa paox oace ee oeo popa.

Bcooaea oaa

     MSB ON    MSB OFF

oc pe xapaep aae aee capeo a (1 0, cooeceo) p opoe cox oca eco ASC . o oa caoeo MSB ON.

5.5.8. aae ee paoe oac (DSECT-DEND)

   opa:
      DSECT
      ...
      DEND

Opaa e opoa oa ac popa. Ta opao oo ccac a eae e oeo popa paoe e a px popaax. Hapep:

      DSECT
       ORG ¤2000
       TAB EQU *    ;Ha  e oo cc
       T.TREK DS 1  ; ao popa
       T.SECT DS 1
       T.BUFF DS 2
      DEND

5.5.9. Oee epepecx cco (ENTRY-EXTRN)

   opa:   ENTRY  ea
              EXTRN  ea

oo aaa epepece cc e pa popaa, ec coec epeeae ap.

epa oaa aaec popae, coepae opeee e, opa - coe e popae. p o -a oex oex popa aocc e, o ooe p ape acpo c.

Ec -a e coc, o epepece cc aac apeca ecax cxox popa. B o cae oa ENTRY oo copa ao oo ece ca accepoa opa o ex eax x apecax. B cox popaax apeca o aaac o ceooaa EQU cpac p ao x ee.

Mea, opeeea c oo EXTRN, opoae oeo popae eoe A-co.

5.5.10. cooe accepoae (DO-ELSE-FIN)

   opa:   DO paee      DO paee
             ...                  ...
             ELSE                 FIN
             ...
             FIN

Ec aee pae pao 0, o aco popa e DO FIN (DO ELSE) oppec p accepoa. B epo cae eco eo aapec aco ELSE-FIN, oop oppec, ec paee eeoe.

5.5.11. Baa ca accepoa

Ba a a ca oo eocpeceo c aap o pe accepoa c oo ceooa LST ON LST OFF .

Cee ceooa ca oope ca:

1. SBTL op ec op

Opae a ca e cpa c aa aooo. Paep cpa aac e.

2. PAGE

aaae e cpa (ae "P-L" a pep poo ee cpa).

3. CHR coa ocaa

aae co, coe ceooae REP.

4. REP M-co

Bcae c cpo-paee, coco M oaox coo (ec e aa, o "*").

5. SKP M-co

Bae M cx cpo.

5.6. Me Acceepa

accepoa popa cee epe e Peaopa o pe "ACCEMPOBAT". p o a pa aec e Acceepa:

   CTPEK "BBEPX"/"BH" BPAT
   ATEPHATB, <- , -> MEHT EE
     "PE"  - BOBPAT B PEAKTOP
    EPEBO CTPOK - APOC AA
   POE - HAAO ACCEMPOBAH

     CXOH A: TEK_A       - <B AMT>
    OEKTH A: TEK_A.KO1  - <HET>
      CXOHOE : 1              - 2, <HET>
     OEKTHOE : 1              - 2, <HET>
   BBO HA MA: BKEH       - BKEH
   OECKA CTP.: 60             - 1..99, <HET>
   ECKA CTP.: <HET>          - 1..99, <HET>
    T OEKTHOO: KOMAHH      - BINARY

B e epece aa xox ax Acceepa x ae o oa, oope oo e aa cocoo (ooe ae pee ec cpaa). ee e cxooo oeoo aa cee aa epeo cpo ec ooe .

Ec cxooo aa e aao, accepec ec, axoc a Peaopa, ae a caec c ca a. Ta e o epe aooc ooepeo cac a, cae oao CHN.

Opaee: oco Acceep paoae 2 poxoa, ce cae a accepc oo c ca (ae a opo poxoe eoa a, oop a ep).

p a e oeoo aa aa oea popaa (o ORG) acaec a c oe a, pe ee epo e aaoe , a ea ocex opeec pae 1 o oceeo coa. Ta, ce a ao "PMEP.KO1" e a "PMEP.KO2". T oeoo aa (K-a "o" B-a DOS 3.3) opeeec oce apaepo.

Ec oeoo aa e aao, pea accepoa a c e acaec.

Bee oa a a oaae a a pep o ca accepoa. Paep oeco cpa - o co cpo, epe oope o oae SBTL aec aa ooo ca. Paep eco ac o acpo pepa pae c cpo, epe oopoe pep eae ecpa poc (ec eae). Ec oooc e coc, ae apaepo ecece.

5.7. Accepoae

p aa poea e Acceepa aaec accepoae. Ha ao poxoe a pa ac ea oepex cxox ao, oa oeac ae 100 cpo pocopeoo eca.

Ha epo poxoe pocxo opeeee eo o apeca ao oae.

Ha opo poxoe oopeeo c eepae oa aec c accepoa, ec o e apee popae. Oao, eo cea oo (F3) (F2). poe pocaaae a ca, a aa oooe. F1 pepaae accepoae.

Cpoa ca ee :

apec_paee: o oep_cpo ec_cpo

Hapep:

 1C72: 20 13 18  92 METKA    JSR KEYIN    ;EM C
 1C75: C9 8D     93          CMP #RETURN
 1C77: D0 F9     94          BNE METKA
 ***  HEBECTHA METKA B CTPOKE 95
 1C79: 4C 00 00  95          JMP XXXX

p ooe o aec cooee, a e. Ooa cpoa oe opoa eep o.

o ooa accepoa aec co cco oo, oce oea popaa acaec a c eaco o oo, ac e coe a eo x ae (oa opoea o ASCII-o, opa - o opaca apeco), apep:

      1C4A ABS       76 AREASIZE  ?0986 C.TABLE
     N1C72 METKA  *0000 XXXX         8A Z

oao aa oeac:

     ? - e, a oope e cco;
     * - eopeeee e;
     X - EXTRN-e;
     N - ENTRY-e.

o aepe accepoa pocxo epexo pe peapoa. p o epe axoc oce accepoa a.

 

6. OTAK

6.1. Oe cee

Oa oeceae oa oex popa pee eocpeceoo oca a BM. o co oooc o ec pacpee cceoo oopa ooe:

- pa epeee ao a;

- pocapa coepoe ee aco a poo coo e e eo;

- co xpac a o popa, opaoa opoe pepa coe;

- peaccepoa aco a, .e. a eo coepoe, a o popa c aae eoecx aa oa acox apeco ax;

- aca oa, aae eoeco ope.

- epeea ae a, poo cpaee oc o opa;

- ocec oceopo-ocpa oe a c co;

- o OC: ee ac K-ao, oee pocop aaoa;

- co aoe eco a oceoaeoc cox pe.

Paoa c Oao eec pee aoa c oo pe. paee o - a ">". paa aopa, cpae p aope apa oax a caape (a, apep, Papa-eppeaope).

6.2. pecaee ax

Oa oeppe ce a ax.

1) ecaaepe oca:

- 4-ae (xaoe) A-ca ooae apeco a;

- 2-ae (ooaoe) M-ca ooa coepoo ee a;

Koca aac oceoaeoc ecaaepx p pooo e peco. B aece M-ca epc ae 2, a aece A-ca - ae 4 p o oceoaeoc; ec co opoe, cea ocac . pep:

   A-ca:  0 (0000) , 1A7 (01A7) , FDAC , 67AF1 (7AF1) ;
   M-ca:  7 (07) , 6A , 123A (3A) .

ece ca Oae occ, oo e ee ec oo ecaaepe ca.

2) epa, ooaaea aocpoo (') ce a poo coo. epa aea M-c, cooece ee o, aee ocoo e paccapaec. pep:

'A (C0) , ' (E1) , '1 (B1) , '* (AA) .

3) Tpe-ceop apec - A-co ceaoo a, aaee apec ceopa a ce e XXYY, e

0 <= XX < T (paep ca peax) - oep pea,

0 <= YY < S (paep pea ceopax) - oep ceopa.

cooo EC-5089 T=23, S=10, MFM-cooo T=29 (paep ooo oa), S=15.

pep:

    A0F - pe 0A, ceop F;  2005 - pe 20, ceop 5;
      C - pe 00, ceop C.

4) aa - pooa oceoaeoc coo, aaac e c poea, o ao epeoa cpo:

    POPAMMH A
    IOSUB.KO1
    << CPABOHK >>

6.3. paa ac pe

He p oca pe coc cee ooae:

    a - A-co,
     - M-co,
     - pe-ceop apec,
     -  aa,
    oaa - oaa M-acceepa (c. 6.12),
    [ ] - eoaea ac,
    { } - oopac ac,
    '[' - co [ .

B Oae ec cee pe:

    a + a             [ a ] : {  }
    a - a             [ a ] G
     &              [ a ] L
     %              [ a ] T
     !              '[' EDIT
    P                 '[' EXIT
    a < a . a M       '[' CAT
    a < a . a V       '[' LOAD  [ , a ]
    a < a . a S       '[' SAVE  , a , a
    a <  .  R       '[' LOCK 
    a <  .  W       '[' UNLOCK 
    [ a ] . [ X ]     '[' RUN  
    a                 '[' EXEC 
    [ a ] / oaa   '[' DEL 

pe oo aca o oo a cpoe. Pae pe epeoo cpo e.

poe oae oo pee ac (:) paee ce. ocac poe epe ea ca, a ae ac oa M-acceepa. cooae x px ecax e pecopeo po oo epacoaa pe. Bee, e oc 1 poe, oco ecoo.

B oo cpoe oe ecoo pe. Paeee x peec oo p ooe eooaoc p c. Paee c poe ";". pea ac oeec o cee poeo ";". pe "[" o oo oce a cpoe. pep:

    1500G 1500L
    2CAAL L L;L;L;L - o e caoe, o
    2CAALLLLLL
    5463: 10 20 30 ;5466/JMP 6000  - ; oaea
    10/ASL 12/JMP 100  - o e o e, o
    10/ASL;12/JMP 100

p oe ac pe oaec oo ca.

6.4. Baa oa a

a) Baa coepoo e c apeco a:

a

pep:

    > 2567
    2567- FF

) Baa aca a c a1 o a2:

       a1.a2
    > 2565.2573
    2567- 00 00 FF
    2568- 4C 85 1B A9 00 8D 45 12
    2570- AA BD 56 12

) Baa aca a coo e:

       a1.a2X

Beco ce 20-7F A0-FF ac opee co:

    > A783.A78FX
    A783-    P    B  E
    A788-  T  ! 8D 00 00 00 00 00

) eee oceoaex ee:

       a: 1 2 ... N

B e a aocc co 1, ce - 2 .. ec ocaec cooae ep ac a oo coo (cap =1).

    >10.17
    0010- 01 02 03 04 05 06 07 08
    >10:7
    >15:3 D0 EA
    >10.17
    0010- 07 02 03 04 05 03 D0 EA

B x eoopx px peax ep/ece apec oe e aac. B o cae caec e apec: o, a oopo aooc coee pee oa. (Ha cao ee, ec a pax ex apca, .. oa L,G,/,T co po aae).

o ae ee p oooce:

) epeo cpo paoce ae aca a c eeo apeca o aeo, paoo 8:

    > 16
    0016- AA 76
    >
    0018- 04 AE 56 23 76 A5 2F 11

e) pocop eee e:

    > 245A
    245A- FF
    > :19
    > 245A
    245A- 19

6.5. Kopoae, cpaee, oc

a) Kopoae aca a a2.a3 aco a1.a1+a3-a2:

       a1<a2.a3M

Ta a epec e oceoaeo, epec e oae p aco aoe x aco: p a1=a2+N epa a2.a3+N aoec coep cox epx N ao (p N=1 o ooe oc aoe oac aa co).

) Cpaee aca a a2.a3 c aco a1.a1+a3-a2:

       a1<a2.a3V

Ha pa ac ce aee o:

     > 3000<4000.4FFFV
     4456- A3 (A5)
     47AF- 00 (FF)
     4E01- 23 (AE)

) oc eo ao ace a2.a3 o opa a1:

       a1<a2.a3S

o apec a1 oe axoc opae e:

      a1: N 1 ... N

Haaa cex aex xoe ac a pa:

    > 300:3 4C 50 1B
    > 300<2000.27FFS
    2156-
    246A-

6.6. Peaccepoae

o pee

      aL

coepoe aca a, aa c apeca a, aec a pa e oceoaeoc eoecx oa acox apecax. Koa ac op o 30 o oo a cpoe opae:

apec- o oa eoo oepa

pooe peaccepoa ocaoo ec oa L e apeca.

Peaccepoae oe ax popae aco, e coepax popa, eec. Oao p o, copee ceo, oaec ecccea popaa, oa aa ??? oe eooa, - o oaa, o oepeo o oa eceoc ao oae e cooece.

pep:

    >2000L
    2000-  A9 00     LDA  #00
    2002-  8D 10 20  STA  2010
    2005-  EE E6 20  INC  20E6
    2008-  D0 10     BEQ  201A
    200A-  60        RTS
    200B-  FF        ???

...

pea

      aT

ooe ocea ce peaccepoa opaee apec a: o eec pac eo. Tao apec oe oo o, oa pea T ee eo.

6.7. ac popa opaa opox oe

a) pea P acpaae e apec a e Oaa, xpae coepoe pecpo a opox oax. ocee epeo cpo oaa ac oo a x eee cocoe e eo. Pecp coxpac ao ope: A,X,Y,P,S.

    >P
    A=00 X=60 Y=78 P=B6 S=F0
    >:1 2 3
    >P
    A=01 X=02 Y=03 P=B6 S=F0

) pea

       aG

acae pecp a aoee Oae ae epeae paee o apec a ( o ee, ec a e aao).

Bopaee pae Oa pocxo cax:

- opaoo aepe popa (oe oa RTS, oce oopoo S coaae co xo aee p co, o ce cooac pao);

- ccceo epea pae Oa popa (epexo o apec 2000);

- pepa popae o oae BRK.

B ocee cae cpaaae ccea pea a eacpeoe pepae BRK: aec apec ocaoa+2 cocoe pecpo poeccopa oe ocaoa. Oopeeo o coxpac eax Oaa.

cooae oa BRK ooe opaoa poce oa popa: pecope ee ox oax popa aca a Oaa, oo cocoe a oe ocaoa, poaapoa pea pao p eoxooc poo oee peo G co ceeo apeca. p o occaoc aoee oe ocaoa pecp, popaa "e ae" ocaoa.

6.8. epeee ao a

a a epeac po ac cooece e pae a opaee cooec opopaa IOSUB o apeca:

    LC0(D0) - 1B50
    LC1(D0) - 1B54
    LC0D1   - 1B58
    LC1D1   - 1B5C
    NORMOZU - 1B60
    DOPOZU  - 1B64

a ac opopaa oo a ee. oce coco oe e, o e ac o ooe a a paeax BM.

epeee ao Oae, oe o cceoo oopa, epeo, .. ca o axoc ocoo O.

6.9. ooo oe c co

ooo oe c co peec p oae popa, opepoax a pao c co, p oppoa apox co, p po pae ca .. e cee pe oo poa o c 1 o 2 a, aa c apeca a aca x oa:

      a<1.2R
      a<1.2W

c caec eo opoe o opaca pe-ceopoo apeca, apep, a oo 120F cee o 1300.

p opae c aec a oO, .. a axoc OC. Oe c HopO, a opao, eooe.

6.10. Paoa c aa

Oa ooe paoa c co a poe ao, oecea opaee OC. Bce pe OC aac c [ .

a) [CAT

Baa aaoa ca.

) [SAVE , a1 , a2

ac aca a c apeca a1 o a2 e K-aa a c. Haa apec a aoac. ox popa, acax Acceepo, ae xpac aa apec (aa ORG) a popa.

) [LOAD

[LOAD , a

apa K-aa (oo popa ax) a. Haa apeco caec a, a ec o e aa, o epec aa apec, aoe ae. a apaeoo oa ae epec aa.

) [DEL

oee aa oo a.

) [LOCK

[UNLOCK

caoa ce a o ac aa oo a.

e) [RUN

ac oo popa: paoce ape ee a "coe" eco epeae pae a ep oa.

) [EXEC

coee oceoaeoc pe Oaa, acax ecoo ae. paa ac pe e e, o aoe, ec a cpo aa ca xoo cpoo. Cpe x e oo pe [EXEC.

peae. coee pe [EXEC ocecec e op aa acpo a eo cceoo oa. oo e peoeec xoe coe opa pe a, epeacpaa o acceo pepa coee. o oa ac pe oa opae c coee e pepaaec.

6.11. Bxo Oaa

a) [EDIT

Bopa Peaop pe peapoa eeo eca. aea paoa ooa, ec o pe pao Oae o oe OK, a ae ec e cope. oo cee e ap a OK (c ???).

) [EXIT

Bxo aoe e epe "xoo cap" c cceoo ca.

6.12. M-acceep

Bcpoe -acceep ooe o a o ax oa, aax eoeco ope o ce paa:

- eoa oa ooae o apeca oepe;

- oepa aac ecaaep A- M-ca e aa ¤; e pae eoc;

- epexo aac aco apeca;

- poe eoae o co o oece epe eooo, epe oce oepaa;

- aopa apeca oaax ca e ooaaec:

    ASL    - o ASL A
    ASL A  - o ASL ¤0A

pea ac eooa o apec a ee :

a / oaa

Occe apeca paoco ac o ee apec.

p coe o pe a pa aec oepee e peaccepoa o oa. pep:

    > 5000/LDY#0/LDA(64),Y
    5000-  A0 00     LDY #00
    5002-  91 64     LDA (64),Y
    > /BEQ 5007
    5004-  F0 02     BEQ 5007
    > /RTS
    5006-  60        RTS

peae: ac eooa a oec eepo, .. o o op oo a ee oo a ac, a p ac oepaa oa Oa ae ee o.

 

7. AOBE OPOPAMM BBOA-BBOA

7.1. Haaee

ace opopa oa-oa (Input-Output SUBroutines), aee - IOSUB, oecea ae oooc opaa aoa ccee "oa" c cooae aap eeoopa - cpoc, xox a opa execx cpec BM "AAT". opopa oo o poe popapoa a acceepe, oea oee aco coex ec.

Ocoe , oee IOSUB, ao:

1. Bo:

- o oooo coa c aap;

- o cpo coo c aap c pacoaae peapx coo;

- e e op oa c cooae popa oa, aao ooaee, .. o c poo cpoca p coe pa pa;

- epeopoa coo a oe (ce oaox o aca pccx acx );

- oee oax coc coo a oe, .e. ceax ec cae oce oo oo coa.

2. Bo:

- o oooo coa a pa oo x ecox peo;

- o c cooae opopa oa coa, aao ooaee, .. o a poe cpoco;

- oee oax coc coo a oe; ca oocc:

   - paee ea p oe,
   - paee oe oa,
   - paee coepaec a pae opae.

Moe oooc IOSUB ceao oope e opopa oca x cooa acceepo popae. He, p oee eao aoce c IOSUB peoaaec apaeoe aoco c x cxo eco, oeae oae po x pao. oo ae a a c accepoa aa IOSUB (poee 1).

7.2. Opaa aoa

opopa IOSUB oecea o c aap epeopo coo: p, ao, ox acoo pccoo aao, pax (c. a poex "Pooc popaca").

p oe aoe coo coec 2 cpaa O.

Boooc oa c paa. a a pao a, oo opee, ao co opae eoopo o paa, a ae eo eoc.

Oo aoa. IOSUB oca eee aoa e a ce oa paa, a opaeo pooo oac, aaeo oo. Oca ac paa p o o e apaa.

Tea o. opaa aoa eeo oe ee o oe. Bo pe oa oa aae, e e ee oepeo co, a o pe oa opeee o pcopa, oo ae oa eoopa aaec oe pcopa.

o pcopa eec p oe aoo coa a, o opaoa ececeoe aoee paa coa cea apao cepx ; p eoxooc pa "caec" epx, ocooa c cpo (ec "oae" epx). e pe epeee pcopa peaoa a oaa apa a pae co p x oe (apep, co "P-Z" ceae pcop a cpo ).

7.3. ocoe apaep aoa

Cocoe aoa ooc opeeec eco apaepa, oope xpac cex eax eo cpa:

1. Ocoe apaep:

TXPAGE (¤A6) - oep aao cpa pao a;

INVFLG (¤32) - cap - pe aoa: (0-C, 1-HC), ocae e cc oo pee C opee eoc coa (aec, coepoe INVFLG acaec o 2- a pecae coa a pae);

WNDLFT (¤20) - e oc oa: paccoe e e pa oa paa aax ( HC o co coo, C - oeoe co);

WNDWDTH (¤21) - pa oa aax;

WNDTOP (¤22) - epx paa oa (paccoe o 0 cpo paa);

WNDBTM (¤23) - paa oa (paccoe o 0 cpo paa);

CH (¤24) - o pcopa cpoe (o eoo pa oa);

CV (¤25) - ea cpoa (epaa o pcopa), ca c 0 o epxe cpo paa;

CSWL,H (¤36-37) - apec ooaeco popa oa coa; IOSUB oe COUT1;

KSWL,H (¤38-39) - apec ooaeco popa oa coa; IOSUB oe KEYIN.

******************************************
*           ^        ^         ^         *
*           !        !         !         *
*    WNDTOP !     CV !         ! WNDBTM  *
*           !        !         !         *
*           v        !         !         *
*         !----------!------!  !         *
*         ! OKHO     !      !  !         *
*         !          !      !  !         *
*         !          v      !  !         *
*         !<---CH--->       !  !         *
*  WNDLFT !                 !  !         *
*<------->!                 !  !         *
*         !<----WNDWDTH---->!  !         *
*         !_________________!  v         *
*                                        *
******************************************

Pc.7.1. aae oa o pcopa.

2. Bcooaee apaep:

BASL,H (¤28-29) - apec aaa ee cpo oa; cec a pa o p cee ae CV; coec oca ecoo oca o pcopa;

RNDL,RNDH (¤4E-4F) - caoe co, eec KEYIN ee a oa oa a;

PROMPT (¤33) - co-paee o o cpo (GETLN).

7.4. Ocae opopa

7.4.1. Beopa pepa

Bxoe o IRQ, NMI, RESET peaae aa ooaecx opopa opao pepa c o cec oaa epexoa o opeo ooaee apec (X+1, X+2). O ece O oca opae.

epexaa IRQ-pepa eoxoo pecope ooe popa, oeo opaaa ocao o oae BRK. Ee apec oe axoc eax ¤FFFE-FFFF coeoo oa . p paoe o opoe OK eoxooc e e, opao pox IRQ-pepa ocaoo opoa eop IRQ.

Cee e , o p eo a ac aec cce oop co coe cceo opao pepa. ca cee ca p popapoa, a cae eoxooc - cooa cce opao pepa.

7.4.2. opopa oa

7.4.2.1. STROBE - o coa e pcopa.

poco opoc cpoa e o aa a. Bee co epeopec TRANSL a pae e oopaaec.

   Bxo: A=co, c.=1,
          Y<¤0B,
          X e eec.

7.4.2.2. KEYIN - caap o coa c ae pcopa.

   Bxo: CURSOR (¤30) - co, aae  aece pcopa.

Bo pe oa oa eaec coepoe ee RNDL RNDH (caoe 16-papoe co), a pae opaec a pcop: epeoae coa ee o c coo ee CURSOR. Kpcop ee o e e, o co. Bee co epeopec TRANSL.

   Bxo: A=co, c.=1.
          Y=CH,
          X e eec.

7.4.2.3. RDKEY - o c (ooo) ecaapo popao.

Ocece epexo o apec, acao (KSWL, KSWH).

   Bxo: a  o opopa (c. ae ocae KEYIN).

RDKEY1: peapeoe aecee "_" CURSOR.

RDKEY2: peapeoe aecee "^" CURSOR.

7.4.2.4. RDCHAR - o coa c pacoaae peapx coo.

Opaec oa o aa oo coa, poe "cpeo" "PE". Bo x coo ee x eee o epe COUT (.e. epeeee pcopa). Haae "PE" ee pcop (o eec c oo RDKEY1 RDKEY2). o po co pepaae a pa e oc.

   Bxo: a  RDKEY.

7.4.3. opopa oa

B ocaex e opopaax pecp X e coec.

7.4.3.1. COUT1 - caap o coa a pa.

   Bxo: A=co.

Ec co e pa, o poco acaec e o pao a, o ceaec. Ec co ee oa ap - ocecee ee ( ocoo, oa coca coa cooec ocae e opopa).

   Bxo: ce pecp coxpac, P acpaac o A.

7.4.3.2. COUT - o coa c (ooo) ecaapo opopao.

Ocece epexo o apec, acao (CSWL, CSWH).

epec o opopa oe a e, a COUT1.

7.4.3.3. PRBYTE - o aa.

   Bxo: A=a.

epea a oc epe COUT a ecaaepoe co (e p).

   Bxo: A e coxpaec.

PRHEX: o ae oo aa a ecaaepo p.

7.4.3.4. CROUT - epeo cpo.

Boc co "p-M" (epeo cpo) epe COUT. aec cpaaae opopaa CR.

CROUT1: peapea oca ocaa ee cpo poea eeo ea.

7.4.4. opopa pae pao

B x opopaax pecp X ae e coec.

7.4.4.1. BS, ADVANCE, UP, LF - c pcopa a o o peeax oa; ec opeec - c epexoo a p cpo, oo paa.

7.4.4.2. CR - epexo aa oo cpo; ec KBD axoc epoa poe - aepa o aa o a.

7.4.4.3. SCROLL - oa paa a cpo epx; epx cpoa p o poaae.

7.4.4.4. HOME - epeeee pcopa e epx o oa epexo a CLREOP.

7.4.4.5. CLREOP - oca (aoee poea eeo ea) paa eo o pcopa.

   CLREOP1: o e, o a xo oac:
        A=cpoa (CV),
        Y=o (CH).

7.4.4.6. CLREOL - oca ocaa cpo.

   CLEOLZ:  o e, o o epeaec  Y.
   CLEOLZ1: ooeo, eoc epeaec  A.

7.4.4.7. DELCHAR, INSCHAR - c ocaa ee cpo eo (pao) c oee eeo (oceeo) coa; oe cpo ( ee o) oec poe eeo ea.

DELCH32, INSCH32, DELCH64, INSCH64: o e aoo peo, pe a xoe:

     Y=o (CH)
     A=eoc (INVFLG).

7.4.4.8. opopa ee ee eoc (e cooece INVFLG):

SETRED, SETGRN, SETYEL, SETBLUE, SETVIOL, SETNAVY, SETWHIT: caoa ooo 7 eo (poe epoo).

SETINV, SETNORM, SETFLASH: caoa oa (epcoo, opaoo, aeo).

SETCOL: caoa ea, epeaoo A.

7.4.4.9. SETTXT - oa pao a ee ecoo pee (opeeec o cape INVFLG).

7.4.4.10. INIT - caoa caapoo oa o ec pa:

WNDTOP = 0, WNDLFT = 0, WNDWDTH = ¤40, WNDBTM = CV + 1 = ¤20.

SETWND: o e, o aee WNDTOP epeaec A.

7.4.4.11. BASCALC - cee apeca aaa cpo, oep oopo epeaec A:

(BASL, BASH) = ao apec + A * 64

7.4.4.12. VTAB - cee apeca aaa cpo oa:

(BASL, BASH) = BASCALC(CV) + CH

VTABZ: o e, o oep cpo epeaec A.

TABV: ooeo, oep cpo aoaec CV.

7.4.5. poe opopa.

7.4.5.1. WAIT - aa eoc 512*A**2 + 27*A/2 + 13 ce. Pecp X,Y e coc; a xoe A=0.

7.4.5.2. BELL - oo ca (oo, 1 , 0.1 ce). Oe pecp Y; X e eec.

 

8. CKOBA OEPAOHHA CCTEMA

8.1. Haaee cooae OC

OC ec ac pa cce "KOHA" , aaoo IOSUB, c oecee eoo cocoa xpay ax a M x opao.

OC pecae coo aop aocax opopa, oox opaoa pao c co 3-x poe:

- caapa opaoa ao a ce (ee ac eo, oee, caoa ce a, aa aaoa).

- paoa c oe aca ao (oaoo ooo);

- oepa ecaapo pao c aa popaax ooae.

aoo po eeoc OC peocae aop oox opopa.

OC oeceae o o coecoc co a popa oeceee o opa ca cppe ao.

OC ocae 1 2 cooa a oo opoepe.

Apeca cex opopa OC pee poe 2.

8.2. paep cooa RWTS

popaa RWTS ocece ee/ac oa 256 ao, pa o ooae ec opa ax a ce. o apecec apo ce T/S - oepa pea ceopa a e.

RWTS axoc oO. Oac HopO e eoca. paa aa RWTS axoc o apec B000 ee :

--------------------------------------------------
  Me.  a        Coepoe
--------------------------------------------------
T.SLOT    0   pae opoepa * 16 (ocaa)
T.DRIVE   1   pee coo (1  2)
T.OLDDRV  2 * coo peeo opae
T.TRACK   3   pe
T.SECTOR  4   ceop
T.VOLUME  5   pee o ca (0 - o)
T.ACTVOL  6 * ece o ca
T.ACTION  7   ece: 1 - ee, 2 - ac
T.BUFFER 8-9  apec epa ax  a
T.LAST    A    e: coo ao ca
--------------------------------------------------

pea:

a) Oeee * a aocc cao RWTS

) T.SLOT aocc cceo p ape e eec.

) To ca - o epee eo co, oopoe "oe" paec ca opao p opapoa ca aee c opo ce ca cooe. Heeoe aee T.VOLUME acae RWTS poep o ca ep o p ecoae.

) Caapoe ae T.LAST - 0 (ce 256 ao).

RWTS a xoe opaae C=0 A=0 p occ o. B cae o C=1 A e o o:

1 - ecooece oa ca aaao,

2 - oa oea c co,

3 - c ap a ac.

8.3. opa oe ao

Ce poe epa ax ec oea ao. Mao ee a oee ec o e o, poepoa apo T/S.

Pacpee aaec apec (pe-ceopa apa) oa, coepaeo pooee opa, oopa e oecac a o. 0/0 oaae occe pacpe.

aecoe pacpeeee a a ce oeceaec ae cex opaox o:

- oaee ca (11/00): opa o ce, cooo a a e, cca a aao;

- aao ca (oo 11/0F-11/01, o ooo pacpee): opa o aax a ce;

- a a ee coceoe oaee - pe-ceop cco, coepa ae o ax ao oax.

He p oca cpp x o ecoee a aax e aac peoaac e.

8.3.1. Oaee ca VTOC (Volume Table Of Contents)

----------------------------------------------------------
  a aee    Ocae
----------------------------------------------------------
  01-02  11,0F   apec aaa aaoa
   06      ?     oep oa ca - 1-FF
  08-26    ?     aooo ca, oaac 8D,00
   27      7A    ax. co pe-ceopx ap  TC-cce
   30      ?     oep pea ee
   31      ?     apaee ee (1  FF)
   34      23    co peo a ce 
*  35      10    co ceopo a pee
* 36-37  00,01   co ao  ceope (¤0100)
  38-C3  ?,?,0,0 ac ax ceopo: o 4 aa a pe
----------------------------------------------------------

pea:

a) Oeee * a OC e coe, ocaeo oox pacpe x popa.

) Maca ax ceopo pea N:

Apec o VTOC - ¤38 + N * 4 .

 ---------------------------------------------
 ! FEDCBA98 ! 76543210 !   e coc   !
 ---------------------------------------------
    1 a     2 a     3 a     4 a  

Ea pape oaae, o a ceop cooe.

) Tpe apaee ee opee, c aoo pea ao apae e ecc oc coooo ceopa TC-cca p coa oepeoo aa. Ec o apae e aeo ooo coooo ceopa, oc aaec o pea ee pooooo apae. Ceopa ec apae 0F-->00.

8.3.2. Kaao ca

-----------------------------
 a    Coepoe
-----------------------------
 01-02   pacpee aaoa
 0B-2D   pae aa 1
 2E-50     --""--     2
 51-73     --""--     3
 74-96     --""--     4
 97-B9     --""--     5
 BA-DC     --""--     6
 DD-FF     --""--     7
-----------------------------

Pae aa:

------------------------------
 a    Coepoe
------------------------------
 00-01   apec TC-cca aa
  02      aa
 03-20    aa (30 ao)
 21-22   a aa  oax
------------------------------

pea:

a) Koa a oaec, oep pea opec a 20, a a 00 acaec ocaa FF. Oa c pao coo aa. Cao oe a, a opao, oo occao.

) T aa ( coax - a, aaea aaoe):

40 () - a a "ae" (e peaoa),

20 (K) - o a cce "oa",

10 () - epeeae o a (e peaoa),

04 (B) - o a ao OC,

02 (A) - BASIC-a,

00 (T) - eco a.

Ec cap = 1, o a ap a ac.

8.3.3. Tpe-ceop cco aa

------------------------------------------------
  a    Coepoe
------------------------------------------------
  01-02   pacpee TC-cca
* 03-04   cca a pe pae TC-cca
  05-06   ce p oo
* 08-09   a popa  K-ae  aax
* 0A-0B   aa apec popa  K-ae
  0C-FF   pe-ceope ap oo aa
------------------------------------------------

pea:

a) * - Pacpee OC o cpae co ao.

) Cca a pe pae peec oca oopoa e eo ca.

) Ce p oo: aec o opo oep ae epoo oo ao paee TC-cca.

) O pae TC-cca coep apeca o 122 (¤7A) oo aa.

8.3.4. opa K- T-ao

Teco a - o oceoaeoc eex ao, oaaac e aaa poooe oeco oo. aec ce ocee a o oa oceeo oa o e. Heo a 0 oe e coec ( oca oopoa: apec o XXYY oaae a YY oe XX), o coecoc co ao OC e e oe. ecox ao opeee pa oa aa: caoe oo o cae, ec ee o axoc o.

o K-a pecae coo oceoaeoc poox ao, aa poooe co oo. aeca a xpao opa aaec TC-cce.

8.4. Cppa pee a OC

8.4.1. apaep coco cce

FILEQUAN (¤3B0-3B1) - o ao, opx a ao x cooo;

ISVTOC (¤3B2) - pa a o VTOC a:

0 - e; 1,2 - oep cooa;

DRIVER (¤3B3) - e a coo;

VOLNUM (¤3B4-3B5) - oepa oo co cooax;

ec a ce e opx ao - 0;

VTOCHANG (¤3B6) - pa ee VTOC a.

IOERR (¤3B7) - pa eca o: e 0, ec o pe oa-oa.

C oo x apaepo OC:

- opae oa oae oo ca a (a o e opeeec ce ocaoe), ac a c capoo oae, ec eo ece ee (opopaa CHECKVTOC);

- pae coo oepeo oepa;

- opope ce ca cooe, oa a e ec ope a.

8.4.2. Paoe epa

VTOC (BF cp. oO) - ep VTOC ca,

CATAL (05 cp.) - ep oa aaoa,

TSLIST (02 cp.) - ep TC-cca

WORKP (07 cp.) - pao ep;

NAMEBUF (300-31D) - ep e aa.

TC-cco opoo aa xpac epax aa.

8.4.3. Opaa opao ao

Cee e aa opa aoo occe:

MAXFILES (¤400) - acaoe co opx ao;

DATABUFF (¤401) - oep aao cpa epo o ao;

TOPPAGE (¤402) - epx pee ap aa a.

epa oa ao ee :

 ------------------------------------------
 ! TN ! N !  . . .   ! T2 ! 2 ! T1 ! 1 !
 ------------------------------------------

^

! N = MAXFILES

DATABUFF Ti - TC-cco i-o aa

i - opaaae o ax i-o aa

aoo opoo aa xpac 18-ao opao ep, opee cocoe eo opao. opaoe epa ao axoc oac FPAGE (¤400-4FF):

    1: EE-FF   5: A6-B7   9: 5E-6F   13: 16-27
    2: DC-ED   6: 94-A5  10: 4C-5D   14: 04-15
    3: CA-DB   7: 82-93  11: 3A-4B
    4: B8-C9   8: 70-81  12: 28-39

Paep o oac opeee acaoe aee MAXFILES=14.

Ooce apec opaooo epa coec oca a. B acoc, eo o epeaec a xo opopaa oa-oa RDBYTE WRBYTE.

p cee eeo paea ax opao ep aa epecaec a e cpa (¤90-A1), o oece oee o po oc eo ea.

Cppa opaooo epa aa:

----------------------------------------------------------
a  Me.               Ocae
----------------------------------------------------------
  0    DRN     oep cooa, a oopo a  op
  1    TCAT    pe     \
  2    SCAT    ceop    > oop. paea aa  aaoe
  3    SHIFT   ceee /
  4    TLIST   pe     \
  5    SLIST   ceop    > oop. e. paea TC-cca
  6    SHLIST  ceee /
  7    STATUS  aa +  aa
  8    TSLBUF  oep cpa epa TC-cca
  9    BUFF    oep cpa epa oa ax
 A-B   LENGTH  a aa  oax (e TC-cca)
  C    ISCHAN  pa ee  ee oe ax
 D-E   NBLOCK  oep eeo oa ax  ae
  F    BYTE    oep eeo opaaaeoo aa
 10    EOF     pa oa aa ( T-ao)
 11    NAME    eaop aa
----------------------------------------------------------

pea:

a) Ec DRN=0 - ep cooe (aa e o e ap);

) NBLOCK BYTE opa pexao oep o aa;

) NAME OC e coec; oe cooa ea aa opaaae popae ( Papa-eppeaope o oep e, o oop a op).

8.5. Ocae opopa

8.5.1. Beop o

B eax ERRVECT xpac apec ooaeco pea a o OC. p epexoe a ee cae o aope axoc o o:

   1-3 - o RWTS,
   ¤28 - a e ae,
   ¤29 - e cooo a a ce,
   ¤2A - ac  aep a,
   ¤2B - ee  aa p cepa ax,
   ¤2E - oopoe ope e opoo aa,
   ¤2F - eep  aa,
   ¤30 - e coox epo  op aa,
   ¤4F - oee  epeac aepoo aa.

8.5.2. oo oe c co: 1 poe

aoee coex o ax a ee ocoe epa, a aoee acx op opae RWTS e/ac oo pecope ceae o.

epa:

------------------------------------------------
 Cca Apec   Coepae
------------------------------------------------
 0  BUFT   epe  ep /c-cca e.aa
 2  BUFD   epe  ep e.oa ax aa
 4  BVTOC  ¤BF00  ep VTOC e.aoo ca
 6  BTSL   ¤0200  caap ep /c-cca 
 8  BCAT   ¤0500  ep e.oa aaoa
------------------------------------------------

Cca - o apa ee OC, coepaa apec aaoo epa.

Bo:

CALLRTS - ee oa

CALLWTS - ac oa

            Bxo:  A=pe, Y=ceop, X=ec epa
            Bxo: a ERRVECT p oe, ae C=A=0

CALLRWTS- ee/ac oa

            Bxo: o e, C=0  e, 1  ac
            Bxo: o e

PUTCAT - ee paea aaoa ep CATAL

GETCAT - ac paea aaoa epa CATAL

            Bxo: TCAT/SCAT (¤91/92) - /c paea
            Bxo: a  CALLRWTS

PUTVTOC - ac VTOC epa, ec ee e

(VTOCHAN/=0)

WRVTOC - ecoa ac VTOC

GETVTOC - ee VTOC ep

            Bxo: e
            Bxo: a  CALLRWTS, Z=0

CHEKVTOC- poepa, VTOC aoo ca, axoc epe, ac a eco eeo, ec e po, ee ooo, ec o ee e ca

            Bxo: oep cooa  DRIVER (¤3B3)
            Bxo: a  CALLRWTS

eo opopa e opo oa ca: oa ec eape a (VOLNUM/=0), VTOC e e.

GETTSL - ee/ac /c-cca ep TSLIST

            Bxo: TLIST/SLIST (¤94/95) - /c-apec
                  C=0  e, 1  ac
            Bxo: a  CALLRWTS

8.5.3. cpe opao ao: 2 poe

Bo cex opopaax oo po ooe xo a ERRVECT p oax oea c co.

NEWSECT - Beee oa a

            Bxo: A=eae pe
            Bxo: a ERRVECT, c e coox oo,
                   ae A/X - /c eeoo oa

DELSECT - Ocooee oa a

            Bxo: A/X - /c ocooaeoo oa
            Bxo ae e ee

Oe opopa e ac ax oo o VTOC.

ADVANCAT- epexo cee a aaoe

            Bxo:  CATAL axoc e o aaoa
                  TCAT/SCAT (¤91/92) - eo /c-apec
                  SHIFT (¤93) - ceee paea e.aa
            Bxo:C=0, SHIFT - ceee ce.aa (+¤23),
                  p eoxooc  ep ca ce.o
                  TCAT/SCAT - eo apec
                  C=1, ec ce.oa e (pacpee=0/0)

BEGCAT - Hacpoa a aao aaoa

            Bxo: A/Y - /c-apec aaoa (oo  VTOC).

ae pec epexo 1 a, a e

FINDNAME- oc aa aaoe

            Bxo: NAMEBUF (¤300-31D) -  aa
                  FILETYP (¤53) -  aa, a  aaoe,
                      ec d7=1, o o
            Bxo: C=1, ec a e ae
                   C=0 + xo ADVANCAT +  epe TSLIST
                   axoc /c-cco aa, ec ae

FINDMAKE- oc coae aa aaoe

            Bxo: o e
            Bxo: o e; ec a e ae, o ec
                  ep aep a  oe aaoa,
                   aocc opa o coao ae;
                  p eoxooc aao pacpec;
                  coaec co /c-cco aa (INITLIST)

RFIFOP - poepa, op a: eec e cpae ee DRN,TCAT,SCAT,SHIFT (¤90-93) c cooec. aa opaox epo cex ao; aec oo oce FINDNAME FINDMAKE

            Bxo: aae e, op.epa ao
            Bxo: a ERRVECT, ec a e op
                   ae C=1

READFILE- oc aa: o CHECKVTOC, FINDNAME RFIFOP

            Bxo: a  RFIFOP, C=0, ec a e ae

INITLIST- Paea /c-cca aa

            Bxo: oee epa TSLIST,
                   TLIST/SLIST (¤94-95) - /c-apec cca

RWRZER - epec op. epa aa c 4 a 0 cpa

RWRSTOR - epec op. epa aa c 0 a 4 cpa

            Bxo: X=oep epa (ceee a 4 cp.)

PARAMSX - Hacpoa cco a epa ao

            Bxo: X=oep epa aa
            Bxo: ADRTSL (¤3A-3B) = BUFT = apec epa TCC
                   ADRBUF (¤3C-3D) = BUFD = apec epa ax

RDATA - ee oa ax o apec TCC

WDATA - ac oa ax o apec TCC, ec o ec (ISCHAN/=0)

            Bxo: ADRTSL (¤3A-3B) - apec epa TCC,
                  SHLIST (¤96) - ceee /c-apeca  TCC

EXPAND - Pacpee TCC: coae ooo oa acpoa cco a eo eeo eo ee

            Bxo: ADRTSL - apec epa TCC,
                  TLIST/SLIST - /c-apec e.paea
            Bxo: ce o e acpoeo a o pae

RDNEXT - ee ceeo oa aa

            Bxo: X=oep aa
            Bxo:  epe ax - ce o, ce
                  aae  opao ee

8.5.4. Paoa c aa: 3 poe

Ha o poe peac caape oepa a aa, ooe a po x pe opaa.

1 pa opopa coae oepae cpp opaox epo opx ao oooc ocoo pao c .

OPEN - Ope aa: oc coooo epa, oc coae aa a ce, coae op.epa, ee 1 oa aa a, caoa 0 o

            Bxo: NAMEBUF (¤300-31D) -  aa
            Bxo: opa  a ERRVECT

POSITION- oopoae aa

            Bxo: LOCADR (¤2D-2F) - oa o aa
            Bxo: a acpoe a a o
                   xo a ERRVECT, ec ao o e

RDBYTE - ee aa aa: ecox poepa caoa aa EOF (¤A0) op.epe

            Bxo: X=oep aa
            Bxo: A=ca a, X,Y coxpac, ec
                   e o xoa a ERRVECT o oe

WRBYTE - ac aa a: poepa a aa, ecox caoa EOF

            Bxo: A=acae a, X=oep aa
            Bxo: A,X,Y coxpac, ec e o xoa
                   a ERRVECT o oe

aeae. Oe opopa cae o caaa pa IOERR (¤3B7) /= 0, oo o o p oa-oe o px.

SHUTFILE- ape aa: ac a c eeo paea ax, TCC, VTOC, ec o ec, cpaee aa aaoe, ocooee op.epa (ac DRN 0)

            Bxo: FILENUM (¤48) =  aa

2 pa opopa oe eopeee ec e pee ceao acpo.

DELETE - oee aa: poepa a, ac FF ep a paea aaoa, ocooee cex eo ceopo; occe aa o e ae

            Bxo: NAMEBUF -  aa

LOCK - aa aa o ac,

UNLOCK - ce a aa - caoa/cpoc capeo a e aa aaoe

CATALOG - Baa aaoa ca a eee cpoco o (epe COUT)

LOAD - apa aa a

            Bxo: NAMEBUF -  aa
                  FILETYP (¤53) -  aa, a  FINDNAME
                  BEGADR (¤98-99) - apec aaa  a
                  (ec 99 a = 0, apec epec  TCC)
                  a epec  TCC
            Bxo: C=0, ec a e ae, ae C=1

SAVE - ac aca a a c, a aa

            Bxo: NAMEBUF -  aa
                  FILETYP (¤53) -  aa
                  BEGADR (¤98-99) - aa apec
                  LENGTH (¤9A-9B) - a  aax
                  BEGOBJ (¤9C-9D) - oo.opa 
                      epeeaex ao, c  TCC

 

9. HAAHA APKA ("XOOH CTAPT")

9.1. o pocxo p e a

ocoa a BM "AAT" e coep ao cce popapoa, e axoc oo aoe opopa oa-oa cce oop. apa a o oepaoo cce, .. "o", pocxo aoaec p e a aoap ocoo cppe cceoo ca (pc. 9.1) oep co copo aapap. p e a ee eco ce poecc:

a) aec a ac a LC0D0, p o capx apecax aec "cce oop";

) poxo ca oeo cpoca, o oopo pec paoa popoeccopa oec popaa opao caa "CPOC", apec oopo aca capx apecax a (FFFC-$FFFD);

) a popaa:
- opeee o coco a, o aa oo o ea,
- ae epxe cpoe paa ac "** AAT **",
- opeee oep paea X, oopo axoc opoep cooa,
- epeae paee o apec $CX00 ( opoepa ca);

) popaa apae o 0/0 a 8 cpa O epeae paee o apec $801. aea paoa a opeeec apeo popao. o poec "xoo cap", e epea a, ocaoo epea paee o apec $CX00, cea peapeo oc a ee cce oop, .e. a ac a LC0 LC1.

9.2. Aoapa oepaoo cce

popaa e epcaa: oa e oe ca ceop c poooo pea -a coe aoc. o o e pe oa e peape a o e, oo ec p e a a pae op ac "** AAT **", a coo paoae co oo, a aa e oe poa 0/0 o (apep, o aep oxo poa apoa oo).

popaa 0/0 oa, a pao, cae ooee ceopa c oo e 0 pea, co popa e ceopa opoepa o apec $CX5C.

B ccee "oa" a opao aec aa ap, oop ae aoe e, apaae apae o. B DOS 3.3 caaa apaec popaa RWTS, oopa ae ae c 0-2 peo oepao cce, oopa ae apae a c BASIC-eppeaopo ae eo. Ha paox cax "o" eco popa-apa axoc popaa a cooe o eoooc aca.

9.3. Cppa paoeo cceoo co

 ce  0  123456789ABCDEF     ce  0123456789ABC   DEF
pe +--------------------+  pe +---------------------+
  0  !H! e coec !    0  ! a.ap ! XXX !
     +--------------------+       +---------------------+
  1  !                    !    1  !  oee o   !
  2  ! paoee  pocp-o !    2  ! cce "oa" !
  .  !    ooae    !    .  !       ( 60 K )      !
  .  !                    !   $0F !                     !
 $0F !      ( 64 K )      !       +---------------------+
 $10 !                    !   $10 ! paoee p-o (4K)  !
     +--------------------+       +---------------------+
 $11 ! aao ca (4K) !   $11 ! aao ca (4K)  !
     +--------------------+       +---------------------+
 $12 !                    !   $12 !                     !
 $13 ! paoee  pocp-o !   $13 !  ccee ae   !
  .  !    ooae    !    .  !  paoee pocp-o !
  .  !                    !    .  !                     !
 $21 !      ( 68 K )      !   $21 !      ( 68 K )       !
 $22 !                    !   $22 !                     !
     +--------------------+       +---------------------+

   a) Pao c               ) Cce c

Cppa apooo o cceoo ca:

 ce  0 1 2 3 4 5 6 7 8 9 A B C D E F
pe +---------------------------------
  0  ! H H H R R R R R I I I I K   
  1  ! O O O O O O O O         
  2  !                 
  3  !                 
  4  ! 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
  5  ! 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
  6  ! 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
  7  ! 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
  8  ! 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
  9  ! 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
  A  ! 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
  B  ! 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
  C  ! C C & & & P P P P P P P P P P P 
  D  ! P P P P P P P S S S S S A A A A
  E  ! A A A A A A A A A A A A A A A A
  F  ! A A A A A A A A - - - - - - - -
H  (08-0A) - Haa ap cce
R  (0B-0F) - RWTS aaoo apa
I  (18-1B) - IOSUB
K  (  06 ) - Cpaa opox c
  (1C-20) - co e popa
O  (20-27) - Oa (OK)
P  (9E-AF) - Peaop (OK)
S  (D0-D4) - o oa Acceepa  Peaopa (OK)
A  (D5-F0) - Acceep (OK)
&  (1C-1E) - o cope ace OK
  (80-82) - o aa P-.
  (9F-BE) - a OO P-.
1  (D0-DF) - a LC0D1 P-.
2  (D0-FF) - a LC0(D0) P-.
3  (D0-DF) - a LC1D1 P-.
4  (D0-FF) - a LC1(D0) P-.
C  (1C-1D) - o COMOZU P-.

 

poee 1

;                                     poee 1
;  IOSUB : 21.03.1986
;
; ACHE OPOPAMM BBOA/BBOA
; OECEBAT EHE PH COOBAH
; KABATP  KPAHA B CCTEME "KOHA"
;
 ORG ¤1800 MAINFRAME
;
; (1) PABE CMBO

NORMCOL EQU ¤81 CT-A/0
INVCOL EQU ¤82 CT-B/.
FLASHCOL EQU ¤83 CT-C/=
STOPSYM EQU ¤84 CT-D/F1
DCCOD EQU ¤85 CT-E/F2
ICCOD EQU ¤86 CT-F/F3
BELLCOD EQU ¤87 CT-G
LFCOD EQU ¤88 CT-H/<-
LFEED EQU ¤8A CT-J
HOMECOD EQU ¤8C CT-L
RETURN EQU ¤8D CT-M
REDCOL EQU ¤90 CT-P/1
GRNCOL EQU ¤91 CT-Q/2
YELCOL EQU ¤92 CT-R/3
BLUECOL EQU ¤93 CT-S/4
VIOLCOL EQU ¤94 CT-T/5
NAVYCOL EQU ¤9C CT-\/6
WHITCOL EQU ¤9D CT-]/7
RTCOD EQU ¤95 CT-U/->
INSCTRL EQU ¤96 CT-V
CANCOD EQU ¤98 CT-X
UPCOD EQU ¤99 CT-Y
DNCOD EQU ¤9A CT-Z
ESCCOD EQU ¤9B CT-[
EOLCOD EQU ¤9E CT-^/8
EOPCOD EQU ¤9F CT-_/9
;
CTRLCOL EQU ¤03 YELINV
RED EQU 1
GREEN EQU 2
YELLOW EQU 3
BLUE EQU 4
VIOLET EQU 5
NAVY EQU 6
WHITE EQU 7
BIT3 EQU ¤2C
;  (2) OCTOHHE APAMETP AOA
WNDLFT EQU ¤20
WNDWDTH EQU ¤21
WNDTOP EQU ¤22
WNDBTM EQU ¤23
CH EQU ¤24
CV EQU ¤25
BASL EQU ¤28
BASH EQU ¤29
BAS2L EQU ¤2A
BAS2H EQU ¤2B
SAVE EQU BAS2H
CURSOR EQU ¤30
INVFLG EQU ¤32
PROMPT EQU ¤33
YSAV1 EQU ¤35
CSWL EQU ¤36
CSWH EQU ¤37
KSWL EQU ¤38
KSWH EQU ¤39
RNDL EQU ¤4E
RNDH EQU ¤4F
TXPAGE EQU ¤A6
;  (3) EP BBOA
IN EQU ¤200
;  (4)_AAPATHE KOHCTAHT
KBD EQU ¤C000
KBDSTRB EQU ¤C010
SPKR EQU ¤C030 
KBDREG EQU ¤C063
DISPLAY EQU ¤C700
;  (5) BXOHE TOK
 ENTRY IRQ PEAK IRQ
 ENTRY NMI PEAK NMI
 ENTRY RESET PEAK RESET
 ENTRY RDKEY1 BBO CMBOA
 ENTRY RDKEY   C -BA BBOA
 ENTRY KEYIN - C KABATP
 ENTRY STROBE - E KPCOPA
 ENTRY GETLNZ BBO CTPOK
 ENTRY GETLN
 ENTRY CROUT1 C C OCTKO XBOCTA CTPOK
 ENTRY CROUT C E OCTK
 ENTRY COUT BBO CMBOA HA -BO BBOA
 ENTRY COUT1 BBO CMBOA HA KPAH
 ENTRY PRBYTE BBO HEX-ATA
 ENTRY PRHEX BBO HEX-P
 ENTRY BS KPCOP HAA
 ENTRY UP KPCOP BBEPX
 ENTRY VTAB HACTPOKA HA HAAO CTPOK
 ENTRY VTABZ
 ENTRY HOME OCTKA KPAHA TEK.BETOM
 ENTRY CLREOP OCTKA XB. KPAHA
 ENTRY CLEOP1
 ENTRY CR EPEBO CTPOK
 ENTRY LF KPCOP BH
 ENTRY CLREOL OCTKA XB. CTPOK
 ENTRY CLEOLZ
 ENTRY CLEOLZ1
 ENTRY BELL BOHOK
 ENTRY SETINV CTAHOBKA
 ENTRY SETNORM  BETHOCT
 ENTRY SETFLASH  
 ENTRY SETRED  BETOB
 ENTRY SETBLUE
 ENTRY SETVIOL
 ENTRY SETWHIT
 ENTRY SETGRN
 ENTRY SETNAVY
 ENTRY SETCOL
 ENTRY SCROLL KPAH BBEPX
 ENTRY SETTXT CT.KPAHA B TEKCT. PEM
 ENTRY INIT CTAHOBKA CTAH. OKHA
 ENTRY SETWND CTAHOBKA OKHA
 ENTRY TABV
 ENTRY RDCHAR BBO C PACOHABAHEM P.
 ENTRY BASCALC HACTPOKA CTPOK
 ENTRY WAIT AA
 ENTRY TRANSL EPEKO. HA BBOE
;
;_____INTERRUPTS
;
*---IRQ-INTERRUPT-REQUEST
 EXTRN IRQREACT
IRQ JMP IRQREACT
*---NMI-NON-MASKABLE-INTERRUPTS
 EXTRN NMIREACT
NMI JMP NMIREACT
*---RESET
 EXTRN RESREACT
RESET JMP RESREACT
;
;_____I/O_SUBROUTINES
;
;___READ_KEY
RDKEY2 LDA #'^
 DFB BIT3
RDKEY1 LDA #'_
 STA CURSOR
RDKEY JMP (KSWL)
;___GET_KEY_FROM_KEYBOARD
KEYIN LDY CH
 LDA (BASL),Y
 STA YSAV1
 EOR CURSOR
 STA SAVE
KEYIN0 LDA (BASL),Y
 EOR SAVE
 STA (BASL),Y
KEYIN1 INC RNDL
 BNE KEYIN2
 INC RNDH
 LDA RNDH
 AND #¤3F
 BEQ KEYIN0
KEYIN2 LDA KBD
 BPL KEYIN1
 JSR TRANSL
 LDY CH
 PHA
 LDA YSAV1
 STA (BASL),Y
 PLA
 RTS
;---INPUT-WITHOUT-CURSOR
STROBE BIT KBDSTRB
STR LDA KBD
 BPL STR
 JMP TRANSL
;___GET_LINE
NOTCR CMP #' 
 BCC NOTCR3
 CPX #¤FF
 BEQ GLBELL
NOTCR3 JSR COUT
 CMP #LFCOD
 BEQ BCKSPC
 CMP #CANCOD
 BEQ CANCEL
 CMP #' 
 BCC NXTCHAR
NOTCR2 CPX #¤F8
 BCC NOTCR1
GLBELL JSR BELL
NOTCR1 INX
 BNE NXTCHAR
 DEX
 BNE NXTCHAR JMP
CANCEL LDA #'\
 JSR COUT
GETLNZ JSR CROUT
GETLN LDA PROMPT
 JSR COUT
 BIT KBDSTRB
 LDX #1
BCKSPC TXA
 BEQ GETLNZ
 DEX
NXTCHAR JSR RDCHAR
 CMP #RTCOD
 BNE ADDINP
 LDA YSAV1
ADDINP CMP #INSCTRL
 BNE ADDINP1
 JSR KEYIN !!!
 STA IN,X
 CMP #' 
 BCS NOTCR
 CMP #RETURN
 BEQ CROUT1
 CPX #¤FF
 BEQ GLBELL
 LDY INVFLG
 BMI NOTCR2
 PHA
 LDA #CTRLCOL
 STA INVFLG
 PLA
 ORA #¤40
 JSR COUT
 STY INVFLG
 BNE NOTCR2 JMP
ADDINP1 STA IN,X
 CMP #RETURN
 BEQ CROUT1
 JMP NOTCR
CROUT1 JSR CLREOL
CROUT LDA #RETURN 
;___OUTPUT_CHARACTER
COUT JMP (CSWL)
;___OUTPUT_CHAR_TO_SCREEN
COUT1 STY YSAV1 
 PHA
 JSR VIDWAIT
 LDY YSAV1
 PLA
 RTS
;___RECOGNIZE_VIDEO_CTRL_CODES
VIDWAIT ORA #¤80
 CMP #' 
 BCS STORADV
 LDY #VIDSUB-VIDCTRL-1
VIDOUT1 CMP VIDCTRL,Y 
 BEQ VIDOUT2
 DEY
 BPL VIDOUT1 
 RTS
VIDOUT2 LDA #<CR
 PHA
 LDA VIDSUB,Y
 PHA
 RTS  JMP
;___PRINT_HEX_BYTE
PRBYTE PHA
 LSR A
 LSR A
 LSR A
 LSR A
 JSR PRHEXZ
 PLA
PRHEX AND #¤0F
PRHEXZ ORA #¤B0 
 CMP #¤BA 
 BCC JCOUT
 ADC #¤06
JCOUT JMP COUT
;___STORE_CHARACTER_TO_SCREEN
STORADV LDY CH
 STA (BASL),Y
 INY 
 LDA INVFLG
 BMI ADV2
 STA (BASL),Y
ADV1 INY
ADV2 STY CH
 CPY WNDWDTH
 BCS CR
 RTS
;___MOVE_CURSOR_LEFT
BS LDA INVFLG
 BMI BS1
 DEC CH
BS1 DEC CH
 BPL RTS4
 LDY WNDWDTH
 LDA INVFLG 
 BMI BS2
 DEY
BS2 DEY
 STY CH
;___MOVE_CURSOR_UP
UP LDA WNDTOP 
 CMP CV
 BCS RTS4
 DEC CV
;___VERTICAL_TABULATE_CURSOR
VTAB LDA CV
VTABZ JSR BASCALC
 LDA BASL
 ADC WNDLFT
 STA BASL
RTS4 RTS
;___ADVANCE_CURSOR
ADVANCE LDY CH
 INY
 LDA INVFLG
 BMI ADV2
 BPL ADV1
;___CLEAR_SCREEN
HOME LDA WNDTOP
 STA CV
 LDY #¤00
 STY CH
;___CLEAR_END_OF_SCREEN
CLREOP LDY CH
 LDA CV
CLEOP1 PHA 
 JSR VTABZ
 JSR CLEOLZ
 LDY #¤00
 PLA
 ADC #¤00 C=1
 CMP WNDBTM
 BCC CLEOP1
 BCS VTAB
;___CARRIAGE_RETURN
CR LDY KBD
 BPL NOWAIT
 CPY #' 
 BNE NOWAIT
 BIT KBDSTRB
KBDWAIT LDY KBD
 BPL KBDWAIT
 CPY #STOPSYM
 BEQ NOWAIT
 BIT KBDSTRB
NOWAIT LDA #¤00
 STA CH
;___LINE_FEED
LF INC CV
 LDA CV
 CMP WNDBTM
 BCC VTABZ
 DEC CV
 JMP SCROLL
;___CLEAR_END_OF_LINE
CLREOL LDY CH
CLEOLZ LDA INVFLG
CLEOLZ1 PHA
 LDA #' 
 STA (BASL),Y 
 INY          
 PLA
 BIT INVFLG
 BMI CLEOLZ2
 STA (BASL),Y
 INY
CLEOLZ2 CPY WNDWDTH
 BCC CLEOLZ1
 RTS
;___TOGGLE_SPKR_AT_1_KHZ_0.1_SEC
BELL LDA #¤40
 JSR WAIT
 LDY #¤C0
BELL2 LDA #¤0C
 JSR WAIT
 LDA SPKR
 DEY
 BNE BELL2
 RTS
;----SET-COLORS
SETINV LDA INVFLG
 AND #¤87
 BNE STAFLAG
SETNORM LDA INVFLG
 ORA #¤28
 BNE STAFLAG
SETFLASH LDA INVFLG
 AND #¤87
 ORA #¤08
 BNE STAFLAG
SETRED LDA #RED
 DFB BIT3
SETBLUE LDA #BLUE
 DFB BIT3
SETVIOL LDA #VIOLET
 DFB BIT3
SETWHIT LDA #WHITE
 DFB BIT3
SETYEL LDA #YELLOW
 DFB BIT3
SETGRN LDA #GREEN
 DFB BIT3
SETNAVY LDA #NAVY
SETCOL STA SAVE
 LDA INVFLG
 AND #¤F8
 ORA SAVE
STAFLAG STA INVFLG
 RTS
;___DELETE_CHARACTER
DELCHAR LDY CH
 LDA INVFLG
 BMI DELCH64
 BPL DELCH32 -JMP
;___INSERT_CHARACTER
INSCHAR LDY WNDWDTH
 LDA INVFLG
 BMI INSCH64
 BPL INSCH32 -JMP
;___ROLL_SCREEN_UP
SCROLL LDA WNDTOP
 PHA
 JSR VTABZ
SCRL1 LDA BASL
 STA BAS2L
 LDA BASH
 STA BAS2H
 LDY WNDWDTH
 DEY
 PLA
 ADC #¤01
 CMP WNDBTM
 BCS SCRL3
 PHA
 JSR VTABZ
SCRL2 LDA (BASL),Y
 STA (BAS2L),Y
 DEY
 BPL SCRL2
 BMI SCRL1
SCRL3 LDY #¤00 
 LDA INVFLG
 JSR CLEOLZ1
 JMP VTAB 
*
DELCH32 INY
 INY
 LDA (BASL),Y
 DEY
 DEY
 STA (BASL),Y
 INY
 CPY WNDWDTH
 BCC DELCH32
 DEY
 LDA INVFLG
 STA (BASL),Y
 BNE DC2 -JMP
*
INSCH32 DEY
 DEY
 DEY
 LDA (BASL),Y
 INY
 INY
 STA (BASL),Y
 CPY CH
 BNE INSCH32
 LDA #' 
 STA (BASL),Y
 INY
 LDA INVFLG
 STA (BASL),Y
 RTS
*
INSCH64 DEY
 DEY
 LDA (BASL),Y
 INY
 STA (BASL),Y
 CPY CH
 BNE INSCH64
 LDA #' 
 STA (BASL),Y
 RTS
*
DELCH64 INY
 LDA (BASL),Y
 DEY
 STA (BASL),Y
 INY
 CPY WNDWDTH
 BCC DELCH64
DC2 DEY
 LDA #' 
 STA (BASL),Y
 RTS
;___VIDEO_CONTROL_CODES
VIDCTRL DFB ICCOD
 DFB DCCOD
 DFB NORMCOL
 DFB INVCOL
 DFB FLASHCOL
 DFB REDCOL
 DFB GRNCOL
 DFB YELCOL
 DFB VIOLCOL
 DFB NAVYCOL
 DFB BLUECOL
 DFB WHITCOL
 DFB RETURN
 DFB LFEED
 DFB LFCOD
 DFB RTCOD
 DFB UPCOD
 DFB DNCOD
 DFB HOMECOD
 DFB EOLCOD
 DFB EOPCOD
 DFB BELLCOD
;___VIDEO_CONTROL_SUBROUTINES
VIDSUB DFB >INSCHAR-1
 DFB >DELCHAR-1
 DFB >SETNORM-1
 DFB >SETINV-1
 DFB >SETFLASH-1
 DFB >SETRED-1
 DFB >SETGRN-1
 DFB >SETYEL-1
 DFB >SETVIOL-1
 DFB >SETNAVY-1
 DFB >SETBLUE-1
 DFB >SETWHIT-1
 DFB >CR-1
 DFB >CR-1
 DFB >BS-1
 DFB >ADVANCE-1
 DFB >UP-1
 DFB >LF-1
 DFB >HOME-1
 DFB >CLREOL-1
 DFB >CLREOP-1
 DFB >BELL-1
;___SET_SCREEN_MODE
SETTXT LDA INVFLG 
 ASL A
 LDA TXPAGE
 ROR A
 ORA #¤02
 TAY
 STA DISPLAY,Y
 RTS
;___SET_STANDARD_WINDOW
INIT LDA #¤00
SETWND STA WNDTOP
 LDA #¤00 
 STA WNDLFT 
 LDA #¤40 
 STA WNDWDTH 
 LSR A
 STA WNDBTM 
 LDA #¤1F 
TABV STA CV
 JMP VTAB
;___READ_CHAR,_RECOGNIZE_ESC
ESCNEW JSR ESCOLD
ESC JSR RDKEY2
 CMP #RTCOD 
 BEQ ESCNEW
 CMP #LFCOD 
 BEQ ESCNEW
 CMP #UPCOD
 BEQ ESCNEW
 CMP #DNCOD
 BEQ ESCNEW
ESCNOW JSR ESCOLD
RDCHAR: JSR RDKEY1
 CMP #ESCCOD 
 BEQ ESC
 CMP #UPCOD 
 BEQ ESCNOW
 CMP #DNCOD 
 BEQ ESCNOW 
RDCHRTS RTS
ESCOLD CMP #' 
 BCS RDCHRTS
 JMP COUT
;___CALCULATE_BASE_ADDRESS
BASCALC STA BASH 
 LDA #¤00
 LSR BASH
 ROR A
 LSR BASH
 ROR A
 STA BASL
 LDA TXPAGE
 ADC BASH
 STA BASH
 RTS
;__WAIT_(13+27/2*A+512*A*A-USEC)
WAIT SEC
WAIT2 PHA
WAIT3 SBC #¤01
 BNE WAIT3
 PLA
 SBC #¤01
 BNE WAIT2
 RTS
;---TRANSLATE-SYMBOL
TRANSL PHA
 LDA #¤50
 JSR WAIT
 PLA
 BIT KBDSTRB
 CMP #¤C0
 BCC TR2
 BIT KBDREG
 BMI TR4
 EOR #¤20
TR4 LDY #TABLE2-TABLE1-1
TR1 CMP TABLE1,Y
 BEQ TR3
 DEY
 BPL TR1
TR2 RTS
TR3 LDA TABLE2,Y
 RTS
TABLE1 ASC ""
TABLE2 ASC "ABCEHKMOPTX"

 

poee 2

                   poee 2
;  DOS : 27.07.85
;
; HBEPCAH CKOB KOMEKC CCTEM "KOHA"
; OECEBAET OPAHA OTEK AOB,
;  COBMECTMX CO TATHO DOS 3.3
;
 ORG $B657 DOPOZU
;
;  (1) HOPMAOHH EP
DRN EQU $90
TCAT EQU $91
SCAT EQU $92
SHIFT EQU $93
TLIST EQU $94
SLIST EQU $95
SHLIST EQU $96
STATUS EQU $97
TSLBUF EQU $98
BUFF EQU $99
LENGTH EQU $9A (9B)
ISCHAN EQU $9C
NBLOCK EQU $9D (9E)
BYTE EQU $9F
EOF EQU $A0
NAME EQU $A1
;
;  (2) KPAHHE KOHCTAHT
WNDTOP EQU $22
WNDBTM EQU $23
;
;  (3) PAOE EK OC
LOCADR EQU $2D (2F)
NSTREK EQU $2E
DCWORK EQU $2E (2F)
NSPASS EQU $2F
ADRTSL EQU $3A (3B)IO
ADRBUF EQU $3C (3D)IO
COUNT EQU $40
LKPROT EQU $40
SAVLAST EQU $40
PSSTEP EQU $40 (41)
CTYSAV EQU $41
DCRES1 EQU $41
XSAV EQU $42 IO
FINDFLAG EQU $42
PSCONT EQU $42
YSAV EQU $43 IO
PSBOARD EQU $43
DCRES EQU $44 (45)
PSBEG EQU $44
PSWASER EQU $44
PSBYTE EQU $45
FILENUM EQU $48 IO
STA EQU $49 IO
PSOTHER EQU $49
PSDIFF EQU $50 (51)
FILETYP EQU $53
SYMBOL EQU $54 IO
BEGADR EQU LENGTH-2
BEGOBJ EQU LENGTH+2
;
;  (4) CTATCHE EK OC
FILEQUAN EQU $3B0-1
ISVTOC EQU $3B2
DRIVER EQU $3B3
VOLNUM EQU $3B4-1
VTOCHANG EQU $3B6
IOERR EQU $3B7
NAMEBUF EQU $300 ;-31D
;
;  (5) KOHCTAHT
BIT2 EQU $24
BIT EQU $2C
STLEN EQU $1E
FINFLEN EQU NAME-DRN+1
STOPSYM EQU $84
;
;  (6) KO OOK
NOTFOUND EQU $28
DISKFULL EQU $29
FILEPROT EQU $2A
EOFTRUE EQU $2B
OPENALRD EQU $2E
TYPEWRONG EQU $2F
NOFRBUFS EQU $30
FILLOCK EQU $4F
;
;  (7) EPA
TSLIST EQU $200
WORKP EQU $700
FPAGE EQU $400
FB EQU FPAGE-DRN
MAXFILES EQU FPAGE
DATABUFF EQU FPAGE+1
TOPPAGE EQU FPAGE+2
CATAL EQU $500
VTOC EQU $BF00 DOPOZU
;
;  (8) OPOPAMM BBOA-BBOA
PRBYTE EQU $18EC
RDKEY1 EQU $180C
CROUT EQU $18C4
PRHEX EQU $18F5
COUT EQU $18C6
;
;  (9) HTEPEC RWTS
DRIVE EQU $B001
TRACK EQU $B003
SECTOR EQU $B004
VOLUME EQU $B005
ACTVOL EQU $B006
ACTION EQU $B007
BUFFER EQU $B008
LAST EQU $B00A
RWTS EQU $B2FD              
;
; TOK BXOA
 ENTRY ERRVECT BEKTOP OK OC
 ENTRY OPEN OTKPT A
 ENTRY RDBYTE TAT AT
 ENTRY WRBYTE CAT AT
 ENTRY SHUTFILE AKPT A
 ENTRY DELETE CTEPET A
 ENTRY SAVE ACAT A  AMT
 ENTRY LOAD CTAT A B AMT
 ENTRY LOCK AEPET A
 ENTRY UNLOCK OTEPET A
 ENTRY CROUT2 2 C
 ENTRY CATALOG KATAO CKA
 ENTRY RAPCAT  -  P-HT.
 ENTRY PRBL1 BBO POEA
 ENTRY POSITION CT.O AA
;
*********************************
* CKOBA OEPAOHHA CCTEMA *
*     BEPC 3 (08.08.1984)     *
*********************************
*
*>>> BOB RWTS
CALLRTS CLC -TEHE
 DFB BIT2
CALLWTS SEC -AC
CALLRWTS STA TRACK
 STY SECTOR
 LDA BUFT,X
 STA BUFFER
 LDA BUFT+1,X
 STA BUFFER+1
 LDA #0
 ADC #1
 STA ACTION
 JSR RWTS
 BCC RTS0
JMPER1 JMP (ERRVECT) A=ERR
*
*   EPA  BEKTOP
BUFT DS 2
BUFD DS 2
BVTOC DW VTOC
BTSL DW TSLIST
BCAT DW CATAL
ERRVECT DS 2
;
PUTCAT SEC
 DFB BIT2
GETCAT CLC
 LDA TCAT
 LDY SCAT
 LDX #BCAT-BUFT
 BNE CALLRWTS =JMP
*
PUTTSL SEC
GETTSL LDX #0
TSL1 LDY SLIST
 LDA TLIST
 BNE CALLRWTS -JMP
*
*   BET CEKTOP_
NEWSECT LDY #2
 STY NSPASS
 STA NSTREK
NSCYC TAX
 ASL A
 ASL A
 TAY
 LDA VTOC+$38,Y TBMAP
 BNE NSF8
 LDA VTOC+$39,Y
 BNE NS70
 TXA
 ADC VTOC+$31 C=0
 BEQ NSCHAN
 CMP VTOC+$34 TRQUAN
 BCC NSCYC
 LDA #0
NSCHAN SBC VTOC+$31 C=1
 STA VTOC+$31
 LDA NSTREK
 DEC NSPASS
 BNE NSCYC
 LDA #DISKFULL
 BNE JMPER1 -JMP
NS70 INY
 LDA #7
 DFB BIT
NSF8 LDA #$F
 STX NSTREK
 TAX
NSFIND LDA SECTBMAP,X
 AND VTOC+$38,Y
 BNE NSOBTAIN
 DEX
 BPL NSFIND =JMP
NSOBTAIN EOR VTOC+$38,Y
 STA VTOC+$38,Y
 LDA NSTREK
RTS0 RTS
*
*  TEHE/AC VTOC
PUTVTOC LDA VTOCHANG
 BEQ RTS0
WRVTOC SEC
 DFB BIT2
GETVTOC CLC
 LDX DRIVE
 LDA VOLNUM,X
 STA VOLUME
 LDA #$11
 LDY #0
 LDX #BVTOC-BUFT
 JSR CALLRWTS
 STA VTOCHANG A=0
 LDX DRIVE
 STX ISVTOC
 RTS
*
*   POBEPKA HA VTOC B AMT
CHEKVTOC JSR CHECK1
 BEQ CVPUT !!!
 RTS
CHECK1: LDX DRIVER
 STX DRN
CHECK: LDX ISVTOC
 BEQ CVJUST
 STX DRIVE
 CPX DRN
 BEQ RTS1 C=1
CVPUT JSR PUTVTOC
CVJUST LDX DRN
 STX DRIVE
 BNE GETVTOC -JMP
*
*   OCBOOEHE CEKTOPA
DELSECT ASL A
 ASL A
 TAY
 LDA SECTBMAP,X
 CPX #8
 BPL DSSET
 INY
DSSET ORA VTOC+$38,Y TBMAP
 STA VTOC+$38,Y
 RTS
*-------
SECTBMAP DFB 1,2,4,8,$10,$20,$40,$80
 DFB 1,2,4,8,$10,$20,$40,$80
*
*  CB K CE. A B KATAOE
ADVANCAT LDA SHIFT
 CLC
 ADC #$23
 BNE ACBACK C=0
 LDA CATAL+1
 BEQ ACBACK C=1
 LDY CATAL+2
BEGCAT STA TCAT
 STY SCAT
 JSR GETCAT
 LDA #$B
ACBACK STA SHIFT
 TAX
RTS1 RTS
*
*   OCT K POB. A
READFILE SEC
 ROR FILETYP
 JSR CHEKVTOC
 JSR FINDNAME
 LDA #NOTFOUND
 BCC RTS1
RFIFOP LDA MAXFILES
 STA STA
 LDA #0-FINFLEN
RFCLOS PHA
 LDX #3
 TAY
RFCMP LDA FPAGE+3,Y
 CMP DRN,X
 BNE RFNO
 DEY
 DEX
 BPL RFCMP
 LDA #OPENALRD
 DFB BIT
ERRTW LDA #TYPEWRONG
 JMP (ERRVECT)
RFNO PLA
 SEC
 SBC #FINFLEN
 DEC STA
 BNE RFCLOS
 RTS  C=1
*
*>>> OCK AA B KATAOE
FINDMAKE LDY #0 - COABAT
 STY ISVTOC
 LDA #$3F
 DFB BIT
FINDNAME LDA #0 - TOKO CKAT
 STA FINDFLAG
FINDDEL LDA VTOC+1
 LDY VTOC+2
 JSR BEGCAT
 BNE FNBEG -JMP
FNFILE JSR ADVANCAT
 BCS FNNO
FNBEG LDY #0
 LDA CATAL,X
 BMI FNEMPT
 BEQ FNNO
FNCHAR LDA CATAL+3,X
 CMP NAMEBUF,Y
 BNE FNFILE
 INX
 INY
 CPY #STLEN
 BNE FNCHAR
 LDA CATAL-STLEN+2,X
 STA STATUS
 AND #$7F
 LDY FILETYP
 BMI FNANY
 EOR FILETYP
 BNE ERRTW
FNANY LDA CATAL-STLEN,X
 STA TLIST
 LDY CATAL+1-STLEN,X
 STY SLIST
 LDX #BTSL-BUFT
 JSR CALLRTS
 SEC
NO1 RTS
FNEMPT BIT FINDFLAG
 BVS FNPUT
 BVC FNFILE
FNNO ASL FINDFLAG
 BEQ NO1 C=0
 BPL FINDDEL
*  CA, EC ATEPT  OCE.A
FNPUT JSR INITLIST
 LDY SHIFT
 BNE FNPUTNAM
*  CA, EC KOHE KATAOA
 LDA #$12
 JSR NEWSECT
 STA CATAL+1
 STX CATAL+2
 JSR PUTCAT
 LDY CATAL+1
 STY TCAT
 LDY CATAL+2
 STY SCAT
 TAY  A=0
FNZER STA CATAL,Y
 INY
 BNE FNZER
 LDY #$B
 STY SHIFT
FNPUTNAM LDA TLIST
 STA CATAL,Y
 LDA SLIST 
 STA CATAL+1,Y
 LDA FILETYP
 STA CATAL+2,Y
 STA STATUS
 LDX #0
 TXA
 STA CATAL+$21,Y
 STA CATAL+$22,Y
FNPUT2 LDA NAMEBUF,X
 STA CATAL+3,Y
 INX
 INY
 CPX #STLEN
 BNE FNPUT2
 JSR DELPUT
 LDX #BTSL-BUFT
 SEC
 JMP TSL1
*
*  HECKKOKO CEPBCHX POPAMM
RWRZER LDY #FINFLEN-1
RWRS1 LDA FPAGE+FINFLEN-1,X
 STA DRN,Y
 DEX
 DEY
 BPL RWRS1
 RTS
*
RWRSTOR LDX FILENUM
 LDY #FINFLEN
RWRS LDA DRN-1,Y 
 STA FPAGE+FINFLEN-1,X
 DEX
 DEY
 BNE RWRS
 RTS
*   PACCTAHOBKA APECOB
PARAMSX SEC
 ROR IOERR
 STX FILENUM
PARAMSX1 LDA FB+TSLBUF,X
 LDY FB+BUFF,X
PARAMS STA ADRTSL+1
 STA BUFT+1
 STY ADRBUF+1
 STY BUFD+1
 LDY #0
 STY ADRTSL
 STY ADRBUF
 STY BUFT
 STY BUFD
 RTS
*  PAMETKA TS-CCKA
INITLIST LDY #0
 TYA
NL0 STA TSLIST,Y
 INY
 BNE NL0
 LDA VTOC+$30
 JSR NEWSECT
 STA TLIST
 STX SLIST
 ADC #1 C=0
 CMP VTOC+$34
 BNE NLWR
 LDA #1
NLWR STA VTOC+$30
 RTS
*  COAT CEKTOP B TS-CCKE
INTSL TAY A=0
OPNUL STA (ADRBUF),Y
 INY
 BNE OPNUL
 LDA TLIST
 JSR NEWSECT
 LDY SHLIST
 STA (ADRTSL),Y
 INY
 STY VTOCHANG A/=0
 STY ISCHAN
 TXA
 STA (ADRTSL),Y
 INC LENGTH
 BNE OPEND
 INC LENGTH+1
OPEND RTS
*
*>>> OTKPT BHEH A
OPEN LDA #0
 LDX #EOF-LENGTH
OPZ1 STA LENGTH,X
 DEX
 BPL OPZ1
*-- OCK CBO. EPA AA
 LDY #0-FINFLEN
 LDX MAXFILES
 SEC
OPOISK LDA FPAGE,Y
 BEQ OPNAID
 TYA
 SBC #FINFLEN C=1
 TAY
 DEX
 BNE OPOISK
 LDA #NOFRBUFS
 BNE JMPER3
*-- PAMETKA EPOB
OPNAID STY FILENUM
 DEX
 TXA
 ASL A
 ADC DATABUFF C=0
 STA TSLBUF
 TAY
 INY
 STY BUFF
 JSR PARAMS
*-- OCT K A
 JSR CHEKVTOC
 JSR FINDMAKE
 JSR RFIFOP
 LDY #0
OPRWR1 LDA TSLIST,Y Y=0
 STA (ADRTSL),Y
 INY
 BNE OPRWR1
 LDY #$C
 STY SHLIST
 CLC
 JSR RDATA1
 BCC OPEND1
 JSR INTSL A=0
OPEND1 LDY #1
 STY BYTE
 LDA (ADRBUF),Y
 BNE OPEOF
 STY EOF
 DEY
 LDA #$A0
 STA (ADRBUF),Y
OPEOF JSR RWRSTOR
 TAX  (DRN)
 LDA ACTVOL
 STA VOLUME
 INC FILEQUAN,X
 STA VOLNUM,X
 RTS
*
*>>> TEHE ATA  AA
RDBYTE STX XSAV
 STY YSAV
 TAX
 JSR PARAMSX
 LDY FB+BYTE,X
 LDA (ADRBUF),Y
 STA SYMBOL
 BNE COMMONIO
 LDA FB+STATUS,X
 ASL A
 BNE COMMONIO
ERREOF LDA #EOFTRUE
 DFB BIT
WBERR LDA #FILEPROT
JMPER3 JMP (ERRVECT)
*>>> AC ATA B A
WRBYTE STX XSAV
 STY YSAV
 TAX
 JSR PARAMSX
 LDY SYMBOL
 LDA FB+STATUS,X
 BMI WBERR
 ORA SYMBOL
 BNE WBNOR
 LDY #'~G
WBNOR TYA
 LDY FB+BYTE,X
 STA (ADRBUF),Y
 TXA
 STA FB+ISCHAN,X
COMMONIO INY
 BNE WBSCHIT
 JSR RDNEXT Y=0
WBSCHIT LDA (ADRBUF),Y
 BNE WBRET
 LDA #1
 DFB BIT
WBRET LDA #0
 STA FB+EOF,X
 INC FB+BYTE,X
 LDX XSAV
 LDY YSAV
 LDA SYMBOL
 ASL IOERR
WBSEC SEC
 RTS
*
*>>> TEHE CEEO CEKTOPA AHHX
RDNEXT JSR RWRZER
 JSR WDATA
 INC SHLIST
 INC SHLIST
 BNE RNLIST
 JSR CHECK
 JSR EXPAND
RNLIST CLC
 JSR RDATA C=0
 INC NBLOCK+1
 BNE RN1
 INC NBLOCK
RN1 BCC RNVOSST
 JSR CHECK
 JSR INTSL A=0
RNVOSST JSR RWRSTOR
 LDX FILENUM
 RTS
*
*  TEHE/AC CEKTOPA AHHX
WDATA LDA ISCHAN
 BEQ WOUT
 SEC
RDATA LDY SHLIST
RDATA1 LDA (ADRTSL),Y R:C=0
 BEQ WBSEC
 TAX
 INY
 LDA (ADRTSL),Y
 TAY
 TXA
 LDX #BUFD-BUFT
 JSR CALLRWTS
 STA ISCHAN A=0
WOUT RTS
*
*  PACPEHE TS-CCKA
EXPAND LDY #1
 LDA (ADRTSL),Y
 STA STA
 BNE EXOLD
 LDA TLIST
 JSR NEWSECT
 LDY #1
 STA (ADRTSL),Y
 INY
 TXA
 STA (ADRTSL),Y
EXOLD JSR PUTTSL
 LDX STA
 BNE EXOLD1
 LDY #4
 LDA SLIST
 STA (ADRTSL),Y
 DEY
 LDA TLIST
 STA (ADRTSL),Y
 DEY
 LDA (ADRTSL),Y
 STA SLIST
 DEY
 LDA (ADRTSL),Y
 STA TLIST
 INY
 TXA  A=0
EXZER1 STA (ADRTSL),Y
 DEY
 CPY #4
 BNE EXZER1
 BEQ EXCOM
EXOLD1 STX TLIST
 LDY #2
 LDA (ADRTSL),Y
 STA SLIST
 CLC
 JSR GETTSL
EXCOM LDA #$C
 STA SHLIST
 RTS
*
*>>> AKPT OCT K A
SHUTFILE LDX FILENUM
 JSR PARAMSX1
 JSR RWRZER
 TAX  A=DRN
 LDA VOLNUM,X
 STA VOLUME
 JSR WDATA
 LDX FILENUM
 STA FB+DRN,X A=0
 LDA LENGTH
 ORA LENGTH+1
 BEQ SFNOEX
 JSR PUTTSL
 JSR GETCAT
 LDY SHIFT
 LDA LENGTH
 ADC CATAL+$21,Y C=0
 STA CATAL+$21,Y
 LDA LENGTH+1
 ADC CATAL+$22,Y
 STA CATAL+$22,Y
 JSR PUTCAT
SFNOEX LDX DRN
 CPX ISVTOC
 BNE SFNOWR
 JSR PUTVTOC
 LDX DRN
SFNOWR DEC FILEQUAN,X
 BNE SFRTS
 STA VOLNUM,X A=0
SFRTS RTS
*
*>>> CTEPET BHEH A
DELETE JSR READFILE
 BCC SFRTS
 LDA STATUS
 BMI ERRFP
 LDY SHIFT
 LDA CATAL,Y
 STA CATAL+$20,Y
 TAX
 LDA #$FF
 STA CATAL,Y
 TXA
 LDX CATAL+1,Y
DELTSL1 JSR DELSECT
DELTSL LDY #$C
DLNEXT STY SHLIST
 LDX TSLIST+1,Y
 LDA TSLIST,Y
 BEQ DELPUT
 JSR DELSECT
 LDY SHLIST
 INY
 INY
 BNE DLNEXT
 STY ISVTOC
 LDY TSLIST+2
 LDA TSLIST+1
 BEQ DELPUT
 LDX #BTSL-BUFT
 JSR CALLRTS
 LDA TRACK
 LDX SECTOR
 BCC DELTSL1 -JMP
DELPUT JSR PUTCAT
 JMP WRVTOC
ERRFP LDA #FILLOCK
 JMP JMPER3
*
*>>> AOMHT ATOK AMT KAK POB. A
SAVE JSR CHEKVTOC
 JSR FINDMAKE
 JSR RFIFOP
 LDA #>> CTAT BHEH A B AMT
LOAD JSR CHEKVTOC
 JSR FINDNAME A=0
 BCC LDRTS
 LDX #$80
 LDY BEGADR+1
 ASL STATUS
 BEQ LDLEN1 TEXTFILE
 TYA
 BNE LDLEN
 LDA TSLIST+10
 STA BEGADR
 LDY TSLIST+11
 STY BEGADR+1
LDLEN LDX TSLIST+8
 STX LENGTH
 LDX TSLIST+9
LDLEN1 STX LENGTH+1
 LDA BEGADR
 STA BUFD
 STY BUFD+1
 DEC BEGADR+1
LDLOAD LDX #$C
LD1 LDY #$FF
 LDA LENGTH+1
 BNE LDMID
 LDY LENGTH
 BEQ LDEND
 DEY
LDMID STY SAVLAST
 STX SHLIST
 LDA BUFD+1
 EOR TOPPAGE
 BNE LDCONT1
 STA LENGTH+1 A=0
 CLC
 SBC BUFD
 CMP SAVLAST
 BCS LDCONT
 TAY
LDCONT STY SAVLAST
LDCONT1 INY
 STY LAST
 LDA TSLIST,X
 BEQ LDEND
 LDY TSLIST+1,X
 LDX #BUFD-BUFT
 JSR CALLRTS
 INC BUFD+1
 INC BEGADR+1
 DEC LENGTH+1
 BMI LDEND
 LDX SHLIST
 INX
 INX
 BNE LD1
 LDA TSLIST+1
 BEQ LDEND
 LDY TSLIST+2
 LDX #BTSL-BUFT
 JSR CALLRTS
 BCC LDLOAD -JMP
LDEND SEC
LDRTS RTS
*
 DS 5
*
*>>> OTEPET/AEPET A
LOCK LDA #$80
 DFB BIT
UNLOCK LDA #0
COMLOCK STA LKPROT A=PROTECT.BIT
 JSR READFILE
 BCS LKFR
 JMP JMPER3
LKFR LDA STATUS
 AND #$7F
 ORA LKPROT
 CMP STATUS
 BEQ LKRTS
 LDX SHIFT
 STA CATAL+2,X
 JSR PUTCAT
LKRTS RTS
*
*-- C C OCTAHOBOM OCE AOHEH KPAHA
CROUT1 INC COUNT
CROUT2 STY CTYSAV
 JSR CROUT
 INC COUNT
 LDA COUNT 
 BMI RTS
 SEC
 ADC WNDTOP
 CMP WNDBTM
 BCC RTS
 LDA #0
 STA COUNT
 JSR RDKEY1
 CMP #STOPSYM
 BNE RTS
 PLA
 PLA
RTS LDY CTYSAV
 RTS
*
 DS 2
*
*>>> KATAO CKA
CATALOG LDX #0
 STX COUNT
RAPCAT JSR ONLYCAT
 LDY #17
CATSLOWO LDA SLOWO,Y
 JSR COUT
 DEY
 BPL CATSLOWO
 LDA DCRES+1
 LDX DCRES
 JSR DECPR
 JMP CROUT
*
ONLYCAT JSR CHEKVTOC
 TAX  A=0=C
 STX DCRES
 STX DCRES+1
CATHEAD LDA VTOC+8,X
 STA TSLIST,X
 BEQ CATFREE
 INX
 BNE CATHEAD
CATFREE LDY #$3C BEGVTOC
 SED  C=0
CATREP1 LDA VTOC,Y
CATREP2 PHA
 LDA DCRES 
 ADC #0
 STA DCRES
 PLA
 BCC CATOBHOD
 INC DCRES+1
CATOBHOD ASL A
 BNE CATREP2
 BCS CATREP2
 INY
 CPY #$C4 ENDVTOC
 BCC CATREP1 C=0!
 CLD
 LDA VTOC+1
 LDY VTOC+2
 JSR BEGCAT
 LDY #1
CATTIT LDA TSLIST-1,Y
 BEQ CATEOM
 JSR COUT
 INY
 BNE CATTIT
CATEOM JSR CROUT2 
 BNE CATST -JMP
CATNEXT LDX DRIVER
 STX DRIVE
 JSR ADVANCAT
 BCS CATEND
CATST LDA CATAL,X
 BMI CATNEXT
 BEQ CATEND
 LDA #'*
 LDY CATAL+2,X
 BMI CATPROT
 LDA #' 
CATPROT JSR COUT
 TYA
 LDY #0
CATTIP ASL A
 BEQ CATPRTIP
 INY
 BNE CATTIP -JMP
CATPRTIP LDA TIPTABLE,Y
 JSR COUT
 JSR PRBL1
 LDA CATAL+$21,X
 STA DCWORK
 LDA CATAL+$22,X
 STA DCWORK+1
 LDX #0
 STX DCRES1
 SED
 CLC
 LDY #16
DCYCLE LDA DCRES1
 ADC DCRES1
 STA DCRES1
 BCC DCC
 INX
DCC ASL DCWORK
 ROL DCWORK+1
 DEY
 BPL DCYCLE
 CLD
 TXA
 LDX DCRES1
 JSR DECPR
 LDX SHIFT Y=FF
CATPRID LDA CATAL+3,X
 JSR COUT
 INX
 INY
 CPY #STLEN-1
 BNE CATPRID
 JSR CROUT1 AGAT
 BNE CATNEXT -JMP
CATEND RTS
*
DECPR JSR PRHEX
 TXA
 JSR PRBYTE
PRBL1 LDA #' 
 JMP COUT
*-------
TIPTABLE ASC .TK?BAI.
SLOWO ASC . :BOKO XHOOBC.
*
 DS 5
*
*>>> CTAHOBKA O KAATE AA
POSITION JSR PARAMSX
 STY PSOTHER Y=0
 JSR RWRZER
 LDA LOCADR+2
 STA PSBYTE
 LDA LOCADR+1
 SEC
 SBC NBLOCK+1
 STA PSDIFF+1
 LDA LOCADR
 SBC NBLOCK
 STA PSDIFF
 LDY #8
 BCS PSFORWRD
 LDY #4
PSFORWRD LDX #4
PSCYCL LDA PSTABLE,Y
 STA PSSTEP,X
 DEY
 DEX
 BPL PSCYCL
*  OCK CEKTOPA AHHX C TPE.OE
PSMOVE LDA PSDIFF
 ORA PSDIFF+1
 BEQ PSINPAGE
 JSR WDATA
 LDA PSSTEP+1
 STA PSOTHER
 ASL A
 CLC
 ADC SHLIST
 TAX
 CMP PSBOARD
 BEQ PSNEXTSL
 TAY
 LDA (ADRTSL),Y
 BEQ PSINPAG
 STX SHLIST
 LDX #1
 SEC
PSADC LDA PSDIFF,X
 SBC PSSTEP,X
 STA PSDIFF,X
 DEX
 BPL PSADC
 LDX #1
 CLC
PSSBC1 LDA NBLOCK,X
 ADC PSSTEP,X
 STA NBLOCK,X
 DEX
 BPL PSSBC1
 BMI PSMOVE
*  TEHE CE.PAEA TS-CCKA
PSNEXTSL LDY PSCONT
 LDA (ADRTSL),Y
 BEQ PSINPAG
 JSR PUTTSL
 LDA PSBEG
 STA SHLIST
 LDY PSCONT
 LDA (ADRTSL),Y
 STA TLIST
 INY
 LDA (ADRTSL),Y
 STA SLIST
 JSR GETTSL C=0
 BCC PSMOVE -JMP
*  OCK ATA B CEKTOPE AHHX
PSINPAG LDA #$FF
 STA PSBYTE
PSINPAGE STA PSWASER
 LDA PSOTHER
 BEQ PSINPAG1
 CLC
 JSR RDATA
PSINPAG1 LDY #$FF
PSREPT INY
 CPY PSBYTE
 BEQ PSOK
 LDA (ADRBUF),Y
 BNE PSREPT
 DEC PSWASER
 BNE PSEOFT -JMP
PSOK LDA (ADRBUF),Y
 BEQ PSEOFT
 LDA #0
 DFB BIT
PSEOFT LDA #1
 STA EOF
 STY BYTE
 JSR RWRSTOR
 ASL IOERR
 LDA PSWASER
 BEQ PSRTS
 JMP ERREOF
PSRTS RTS
PSTABLE DFB $FF,$FF,3,$A (0)
 DFB 0,1,1,0,$A

 

poee 3

                                      poee 3
   KAPT AMT

   1. cooae 0 cpa  OK

    0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
   -----------------------------------------------
00     p  p                             P  P  P  P
10  p  p  p  p  p  p  p  p  p  p  p  p  p  p  p  p
20  I  I  I  I  Ip Ip d  d  Ip Ip id id o opd do do
30  I  o  I  I  o  Ip Ip Ip I  I  do do do do pdopdo
40  do do do do do d  d  d  d  d              Ip Ip
50  d  d     d  d           a  a
60  pa pa pa pa p  p  pa pa a  a  a  a  pa pa pa pa
70  pa pa a  a  a  a  pa pa a  a  a  a  a  a  a  pa
80  pa pa pa p  p  p  pa pa pa pa pa pa pa pa pa pa
90  da d  d  d  d  d  d  d  d  d  d  d  d  d  d  d
A0  da da a  a  a  a  Ip a  a  a  a  a  p        a
B0  a  a  a  a  p  p  a  a  a  a  a  a  a  a  a  a
C0  a  a  a  a  a
D0
E0
F0
   Ooae:
   oe  - ocoe e
   ae  - paoe e (oo cooa)
   P - Peaop    D - OC, RWTS
   A - Acceep   I - IOSUB
   O - Oa

   2. cooae 0 cpa  Papa-eppeaope
 
    0 1 2 3 4 5 6 7 8 9 A B C D E F
    -------------------------------
00  * * * * *   * * * * * * * * * *   * - ocoe
10  . . . . . . . . . . . . . . . .   . - peee
20  * * * * * * * * * * * * * * * *
30  * * * * * * * * * * * * * * * *
40  . . . . . . . . . . . . . . * *
50  . . . . . * * * * * . . . . * *
60  * * * * * * * * . . . . . . . .
70  . . . . . . . . . . . . . . . .
80  . . . . . . . . . . . . . . . .
90  . . . . . . . . . . . . . . . .
A0  . . . . * * * * * * . . * * * *
B0  * * * * . . * * * * * * * * . .
C0  * * * * * * * * * * * * * * * *
D0  * * * * * * * * * * * * * 
E0  . . . . . . . . . . . . . . . .
F0  * * * *                     . .

   oee e 0 cpa  Pape:

RNDLOC    4E-4F      caoe co
FILETYP   53          aa oceeo opae
TIPOUT    55         oo oa
GRMODE    A4         e paec pe
GRPAGE    A5         apec paeco a
TXPAGE    A6         apec paa aoa
GRSYMBOL  A7         e. paec co
GRCOLOR   A8         e. e
ISCALL    C9         pa oa poep
WASDEF    CC         pa ecoo epa peaopa
PROMPTR   DD         paee  pe. BBO

   3. e 3- cpa

NAMEBUF   300-31D    ep e aa  OC
COEFF     31E-31F    acape oe pa(P)
          320-324    paoa oac(P)
REGIM     325        pe: Papa/Po
BASEX,Y   326-327    aao oopa pa (P)
          328-3A0    paoa a (P)
SYMTADR   36E-36F    apec a coo TKC (P)
FILEQUAN  3B0-3B1    OC: co opx ao (2cooa)
ISVTOC    3B2        OC: pa  oep VTOC  epe
DRIVER    3B3        OC: a coo
VOLNUM    3B4-3B5    OC: oepa oo co (0-e op.ao)
VTOCHANG  3B6        OC: pa ee VTOC  epe
IOERR     3B7        OC: pa o oa-oa
          3B8-3CB    paoa oac (P)
 (P -  Papa-eppeaope)

   4. Kapa a Papa-eppeaopa

   Ocooe O:
0000-00FF   ea cpaa
0100-01FF   aapa ce
0200-02FF   ep oa c aap  TC-cca aa
0300-03FF   paoa cpaa
0400-04FF   ep ooo oa  op.epa ao
0500-05FF * ep aaoa
0600-06FF : ep coxpae xoca cpo oa
0700-07FF * paoa cpaa
0800-0CFF   popae ce
0D00-0FFF   aa e
1000-17FF : 1 paa a
1800-1D16   IOSUB  c.opopa
1D17-1DE9 * cooo
1DEA-1DFF   popaa ap K-aa
1E00-1FFF   aa e
2000-3FFF : paeca a, ep Peaopa
4000-7FFF : o  aeco a

   HopO:
8000-BFFF   o  aeco a

   oO:
8000-82FF   eppeaop
8300-8F7F * cooo
8F80-8FFF : ep ocea oo
9000-90FF * cooo
9100-9EFF : epa ao (7 o 2 cpa)
9F00-AFFF   Peaop
B000-BE40   RWTS, OC
BE41-BEFF   aa pepa
BF00-BFFF   ep VTOC

   Bce  ao eppeaopo. Cooe oac:
D635-D9FF    LC1D1
DCB8-DCFF    LC0D1
DF18-DF90    LC0D1

  * - oo cooa
  : - oo cooa c opae
  ac a 4005-7FFE oo cooa p eoo (ee oo) apeoc paoe a.

   5. Kapa a OK

   Ocooe O:
0000-00FF   ea cpaa
0100-01FF   aapa ce
0200-02FF   ep oa c aap  TC-cca aa
0300-03FF : paoa cpaa (aco)
0400-04FF   op.epa ao
0500-05FF * ep aaoa
0600-06FF : paoa a Peaopa
0700-07FF * paoa cpaa OC
0800-0FFF * Aoap,  aee cooo
1000-17FF : paa a
1800-1BFF   IOSUB
1C00-1E7E   o cope OK
1E7F-1FFF * cooo
2000-27FF   Oa
2800-2FFF * cooo
3000-7FFF : ep Peaopa

   HopO:
8000-BFFF : ep eaopo Acceepa

   oO:
8000-9DFF : ep oeoo oa Acceepa
8200-9DFF : epa ao (14 o 2 cpa)
9E00-AFFF   Peaop
B000-BE40   RWTS, OC
BE41-BEFF   aa pepa
BF00-BFFF   ep VTOC

   LC1D0:
D000-F202   Acceep
F203-FFFF * cooo

  * - oo cooa
  : - oo cooa c opae