aldweb

Close I. aldweb

Close II. PC Freeware

Close III. Palm Freeware

Close IV. Palm Shareware

Close V. iziBasic Palm

Close VI. Palm Knowledge

Close VII. Pocket Computer

Close VIII. miniPortail

Search




Newsletter
To receive news about this website, consider subscribing to our Newsletter.
Subscribe
Unsubscribe
298 Subscribers
Webmaster - Infos
Visits

   visitors

   visitors online

article.gifTricks and secret addresses in the Sharp PC-1360 memory

User RAM (Cards of 8 Kb, 16 Kb or 32 Kb in two slots)



All my clues and the given addresses will only work if you have only one RAM card set in slot #1, using SET MEM "C" mode.

Knowledge of the RAM Card memory map

When you refer to the memory map, you find out that the RAM cards have a different first address according to their size, but always have the same last address of &FFFF which is the maximum address that can be managed by a 16 bits address pointer (see PC and DP registers in my page about the Sharp PC-1360 CPU and Machine Language Quick Manual).

Card TypeStart AddressEnd AddressConversion to 32 Kb Card
4 Kb&F000&FFFF+ &7000
8 Kb&E000&FFFF+ &6000
16 Kb&C000&FFFF+ &4000
32 Kb&8000&FFFF+ &0000


All RAM cards will be organized the same way, according to the following map :
  • Small System RAM : 48 bytes
  • Big System RAM : 1584 bytes, including :
    • Reserve Area : 144 bytes
    • standard Variables : 208 bytes
    • copy of Small System RAM : 48 bytes
    • "real" Big System RAM : 1184 bytes
  • Basic Space : RAM Card capacity - 1632 bytes, for Basic programs and variables


Notice : it is not worth giving all addresses for each memory card size. I will give addresses for the 32 Kb card. You will find the addresses for all other cards by adding the value found in the Conversion to 32 Kb Card column of the above table, except for the Big System RAM which is directly correlated to the to top of the card, which has always the same address of &FFFF.

Small System RAM

This is a very small memory area of 48 bytes that holds some important addresses. It ranges from &8000 to &8030 (for 32 Kb RAM card). The Big System RAM has a full copy of the Small System RAM. So PEEKING and POKING in one or the other will have the same result.

Actually, the only interesting thing about the Small System RAM is that it is the only area of the System RAM that you will still be able to read if you use two RAM cards in SET MEM "B" or SET MEM "D" mode.

FunctionSmall System RAMBig System RAM
Basic Start Address[&8007] + 256 x [&8008][&FFD7] + 256 x [&FFD8]
Basic End Address[&8009] + 256 x [&800A][&FFD9] + 256 x [&FFDA]
Merge Basic Start Address[&800B] + 256 x [&800C][&FFDB] + 256 x [&FFDC]
Basic Variables Start Address[&800D] + 256 x [&800E][&FFDD] + 256 x [&FFDE]
Password of Basic programs[&8010]..[&8016][&FFE0]..[&FFE6]

Clue : if you feel like protecting your PRO mode by a password, you have to know that reading the range of addresses for the Password will not give you any result but an Error 1. So, I highly recommand you to insert the following 2 lines of code at the end of your Basic program to recover your password if you were to forget it... by simply typing DEF and = keys.

64999 "=":A$="":FOR J=&FFE0 TO &FFE6:A$=A$+CHR$(PEEK J):IF PEEK J=0 LET J=&FFE6
65000 NEXT J:PRINT A$:END

Big System RAM

This area deals with many relationships and parameters between the PC and mainly its Basic interpreter. It is 1584 bytes long and ranges from &F9D0 to &FFFF.

FunctionBig System RAM
standard Variables[&F9D0]..[&FA9F]
real Big System RAM[&FAA0]..[&FF3E]
Reserve area[&FF3F]..[&FFCF]
copy of Small System RAM[&FFD0]..[&FFFF]
  • Standard Variables

    These are the 26 variables that have to be used in priority since their storage space is reserved whether you use them or not (in opposition to Basic variables space which changes upon use).

    Variable stockageNum.Alpha.Num. TableAlpha. Table
    [&F9D0]..[&F9D7]ZZ$A(26)A$(26)
    [&F9D8]..[&F9DF]YY$A(25)A$(25)
    [&F9E0]..[&F9EF]XX$A(24)A$(24)
    ...............
    [&FA90]..[&FA97]BB$A(2)A$(2)
    [&FA98]..[&FA9F]AA$A(1)A$(1)

    • Alphanumerical variables
      Since a good example is always better than a long explanation, let's put the word "ALDWEBGOOD" in Z$ by simply typing : Z$="ALDWEBGOOD"
      Here is what will succeed :

      AddressZ$Comment
      &F9D0245Token indicating alphanumerical value
      &F9D165ASCII code of A
      &F9D276ASCII code of L
      &F9D368ASCII code of D
      &F9D487ASCII code of W
      &F9D569ASCII code of E
      &F9D666ASCII code of B
      &F9D771ASCII code of G

      Now, let's change the value of Z$ to ZEN, by typing : Z$="ZEN"

      AddressZ$Comment
      &F9D0245Token indicating alphanumerical value
      &F9D190ASCII code of Z
      &F9D269ASCII code of E
      &F9D378ASCII code of N
      &F9D40Token indicating end of alphanumerical value
      &F9D569ASCII code of E
      &F9D666ASCII code of B
      &F9D771ASCII code of G

      Let's just note that standard alphanumerical variables cannot be bigger than 7 characters which is very small indeed. Hopefully user defined variables will allow greater sizes (it is just funny to note that this system of standard Variables already existed in the first Pocket TRS-80).

    • Numerical variables
      The PC-1360 uses a very smart coding system that can store all numbers ranging from 1.E-99 to 9.999999999E+99. It is called BCD and stands for Binary Coded Decimal. The principle is that one byte is made of 8 bits. A group of 4 bits, that we will call a "quartet", can store up to 16 combinations which is enough for our needs.


      Let's explain this BCD system with an example : Z=-1.2E+39

      AddressZQuartet 1Quartet 2
      &F9D0&030 = Positive Exponent3 = Exponent #1
      &F9D1&989 = Exponent #28 = Negative Sign
      &F9D2&121 = Number #12 = Number #2
      &F9D3&000 = Number #30 = Number #4
      &F9D4&000 = Number #50 = Number #6
      &F9D5&000 = Number #70 = Number #8
      &F9D6&000 = Number #90 = Number #10
      &F9D7&00Not usedNot used

  • real Big System RAM

    This area holds many of the parameters and data for the Basic interpreter.
    Just note that from address &FD80 to address &FDDF are stored all ASCII codes for the characters displayed on the LCD screen. This memory storage is 96 bytes long (because 4 lines x 24 characters per line = 96 characters).

  • Reserve area

    This 144 bytes long area is ment to store commands that you input in the Reserve mode.
    The coding is quite strange but I figured it out : a first byte related to the letter pressed in addition to the Shift key (see table below) followed by the data attributed to that letter key. Data is not put in a specific order, the order works according to the rule "last inputed or modified, last in the list". If you delete an entry, the void space is replaced by the data of further commands. Data follows the same rules as for Basic (see below) in its coding rule : 254 coding + Basic Token code + arguments data.

    Reserve LetterLetter Code
    A1
    S19
    D4
    F6
    G7
    H8
    J10
    K11
    L12
    =28
    Z26
    X24
    C3
    V22
    B2
    N14
    M13
    SPC27

  • copy of Small System

    See above paragraph about Small System RAM.

Basic Space

The Basic space is divided in two areas : the Basic programs themselves and the Variables storage.

  • Basic Programs

    Basic programs are put between the Basic Start Address and the Basic End Address (see Small System RAM). These two addresses are filled with a 255 value. The Basic End Address will change according to the size of your Basic programming.

    The Basic lines have a very simple structure :
    Line number HBLine number LBLength of LineData of LineEnd code of Line = CR
    Line number = 256 x HB + LB
    CR : stands for Carriage Return

    The Data of Line has itself a very easy to understand structure :
    Instruction Token = 254Basic Instruction TokenBasic Instruction arguments...

    Let's see how everything works with an example of a simple Basic program :
    10 CLS:WAIT 0
    20 FOR I=0 TO 9
    30 PRINT I;:NEXT I
    40 END


    Address(es)Value(s)ASCII Code(s)Comment
    &8030255Basic Start Address
    &8031 - &80320 10Line number : 0 *256 + 10 = 10
    &80337Line length = 7 bytes (including CR of End of Line)
    &8034 - &8035254 80CLS Instruction
    &803658:Link between instructions
    &8037 - &8038254 42WAIT Instruction
    &8039480Argument for WAIT Instruction
    &803A13CR value. End of line 10
    &803B - &803C0 20Line number : 0 *256 + 20 = 20
    &803D9Line length = 9 bytes
    &803E - &803F254 87FOR Instruction
    &8040 - &804273 61 48 I = 0Argument for FOR Instruction
    &8043 - &8044254 82TO Instruction
    &8045 579Argument for TO Instruction
    &804613CR value. End of line 20
    &8047 - &80480 30Line number : 0 *256 + 30 = 30
    &80499Line length = 9 bytes
    &804A - &804B254 96PRINT Instruction
    &804C - &804D73 59 I ;Argument for PRINT Instruction
    &804E48:Link between instructions
    &804F - &8050254 91NEXT Instruction
    &805173Argument for NEXT Instruction
    &805213CR value. End of line 30
    &8053 - &80540 40Line number : 0 *256 + 40 = 40
    &80553Line length = 3 bytes
    &8056 - &8057254 90END Instruction
    &805813CR value. End of line 40
    &8059255Basic End Address

    As from the above explanations, here is the table of all Basic Instructions Tokens :
       Basic        Hex      Dec
    Instruction Token Token

    ABS &99 153
    ACS &9E 158
    AREAD &63 099
    ARUN &74 116
    ASC &D0 208
    ASN &9D 157
    ATN &9F 159
    AUTOGOTO &75 117
    BASIC &36 054
    BEEP &29 041
    CALL &31 049
    CHAIN &67 103
    CHR$ &F0 240
    CIRCLE &6F 111
    CLEAR &2E 046
    CLOAD &16 022
    CLOSE &22 034
    CLS &50 080
    COLOR &44 068
    CONSOLE &24 036
    CONT &12 018
    COS &96 150
    CROTATE &6E 110
    CSAVE &20 032
    CSIZE &43 067
    CURSOR &51 081
    DATA &5E 094
    DEG &9B 155
    DEGREE &26 038
    DELETE &1B 027
    DIM &30 048
    DMS &9C 156
    END &5A 090
    ERASE &3A 058
    EXP &93 147
    FOR &57 087
    GCURSOR &68 104
    GLCURSOR &6C 108
    GOSUB &62 098
    GOTO &2B 043
    GPRINT &33 051
    GRAD &28 040
    GRAPH &41 065
    IF &56 086
    INKEY$ &E9 233
    INPUT &61 097
    INT &98 152
    LEFT$ &EB 235
    LEN &D2 210
    LET &58 088
    LF &42 066
    LINE &69 105
    LIST &14 020
    LLINE &6A 106
    LLIST &15 021
    LN &91 145
    LOAD &18 024
    LOG &92 146
    LPRINT &64 100
    LTEXT &40 064
    MDF &80 128
    MEM &AF 175
    MERGE &17 023
    MID$ &EA 234
    NEXT &5B 091
    NEW &11 017
    ON &55 085
    OPEN &21 033
    OPEN$ &E8 232
    PAINT &70 112
    PASS &13 019
    PAUSE &5F 095
    PEEK &A4 164
    PI &AE 174
    POINT &AD 173
    POKE &32 050
    PRESET &35 053
    PRINT &60 096
    PSET &34 052
    RADIAN &27 039
    RANDOM &25 037
    READ &5D 093
    REM &59 089
    RENUM &19 025
    RESTORE &66 102
    RETURN &65 101
    RIGHT$ &EC 236
    RLINE &6B 107
    RND &A0 160
    RUN &10 016
    SAVE &23 035
    SET (MEM) &3F(&AF) 063(175)
    SGN &9A 154
    SIN &95 149
    SORGN &6D 109
    SQR &94 148
    STEP &53 083
    STOP &5C 092
    STR$ &F1 241
    TAN &97 151
    TEXT &37 055
    THEN &54 084
    TO &52 082
    TROFF &2D 045
    TRON &2C 044
    USING &2F 047
    VAL &D1 209
    WAIT &2A 042

  • Basic Variables
    Basic variables are put between the Basic Variables Start Address and the Big System RAM Start Address (see Big System RAM). The Basic Variables Start Address will change according to the size of your Basic variables.

    AddressContent of Address / MeaningComment
    Byte #1First ASCII CodeAlways First ASCII Code of variable
    Byte #21-26 : Second ASCII Code - 64
    65-90 : Second ASCII Code
    128 : {null}
    129-154 : Second ASCII Code + 64
    160 : {null}
    193-218 : Second ASCII Code + 128
    1-26 : two letters string array. Ex : LD$(10).
    65-90 : two letters number variable. Ex : LD.
    128 : one letter number array. Ex : L(10).
    129-154 : two letters string variable. Ex : LD$.
    160 : one letter string array. Ex : L$(10).
    193-218 : two letters number array. Ex : LD(10).
    Byte #3HB : Distance to End of Array Distance to End of Array (in bytes) : EoA = HB x 256 +LB
    Byte #4LB : Distance to End of Array
    Byte #5Second Index (*,i)0 if variable
    Byte #6First Index (i,*)0 if variable or if simple array variable (non matrix variable)
    Byte #7Length of a Variable/Array's values8 if number variable/array
    16 if string variable/array (unless specified otherwise in the DIM instruction)
    Byte #8 to EoADataGroups of bytes according to Byte #7 value.

    Let's visualize this stuff with an example :
    CLEAR
    DIM L$(1,0)*2
    L$(0,0)="LD"
    L$(1,0)="SL"


    AddressValueComment
    &F9C576ASCII code of L
    &F9C6160One letter string array, so L$
    &F9C70HB = 0
    &F9C87LB = 7, so End of Array in 7 bytes
    &F9C90L$(*,0)
    &F9CA1L$(1,*), so L$(1,0)
    &F9CB2Length of one array's value (*2)
    &F9CC76L$(0,0) : ASCII code of L
    &F9CD68L$(0,0) : ASCII code of D
    &F9CE83L$(1,0) : ASCII code of S
    &F9CF76L$(1,0) : ASCII code of L

Creation date : 01/01/2003 @ 18:17
Last update : 01/01/2003 @ 18:17
Category :


Print the article Print the article

 
react.gifReactions to this article

Nobody gave a comment yet.
Be the first to do so!

 
Special !



Mobile version of
the aldweb Site

m.aldweb.com


Neither French, nor English?

Try one of these flags then:
[de] [es] [it] [pt]
Weather / Spam / www

Lyon Weather


aldweb against spam


Family's web sites

Friends News
Poll
What do you think of the new design of the aldweb Site?
 
Great !
Beautiful
Average
So ugly...
Results
^ Top ^