73

Aspects of the Software

The software presented here is that of the Microkit 09. The MOPET one, entitled Micromon-Plus, remains very similar in all its forms and will be presented in volume 2.

Overview

The software consists of the NANOMON REV 1.8 monitor program implemented in EPROM 2716 2 K x 8 bits from the address E000 to the address E7FF. The main programme is structured around the RESET programme as shown in the organisation chart below. When the power is turned on, or as soon as the ‘RESET’ key is pressed, the ‘-’ sign is displayed on the left display. Therefore, only the M.BP. R.CN. L.P.GO. are influential. Pressing one of these keys causes one of the EXMEMO, BPOINT, FONREG, etc. subroutines to execute. to the addresses specified on the general organisation chart. Thus, the M key allows the examination and change of the contents of the memories. The desired memory location must be specified by its hexadecimal address, entered through the keyboard and controlled by the BADD subroutine. The corresponding data is then displayed. This data can be changed.

The essential features of the monitor program are described in the following paragraphs. We will analyze the following programs and sub-programs: - RESET Start-up - Keyboard and display - Review and change of the content of briefs - Viewing and changing the content of the registers - Automatic offset calculation and cassette interface

Getting Started & Initializing

Pressing the ‘RESET’ key forces the up to read the memory slots FFFE, FFFF. As the decoding of the high addresses (A15, A14, A13) of the system is partial in 4 Kbytes (1000 Hexa) increments and in 2 Kbytes (800 Hexa) increments for the lower addresses of RAM and Eprom, the up takes into account the E7FE, E7FF image addresses. There it finds E219 and runs the ‘RESET’ program from that address.

This program initializes the system’s stack pointer to the value 07C0 and the vector NMI to the value E272. The interrupt pointer is in RAM at the 07DD.DE address. The user can change this value and force the NMI interrupt to run a specific interrupt program

RESET 1

RESET 2


74

RTI stack

instead of executing the one starting at the address E272. The composition of the table of interrupt vectors allows us to better understand what has just been said.

vector table

It is then the initialization of the monitor stack pointer, the generation of the “—” symbol and the connection to the GETKEY routine which allows the keyboard to be scanned (to detect any command pressed) and displayed. If the GO key has been pressed, then the starting address of the user program must be entered via the bracket controlled by the BUILD ADDRESS subroutine. These two routines GETKEY and BADDR will be detailed in the following chapters. We go back to the RESET program with the starting address of the program in X. user. The value of X is placed in the memory locations (07CA, 07CB) which will correspond to the contents of the PC when ‘destacking’ happens at the RTI instruction to end the program.

It is then the setting of bit 7 of the memory location 07CC to 1. It is also the setting of the E flag of the CC register to 1 with regard to the destacking. Finally, it’s the reset of the system’s stack pointer and the RTI. This last instruction causes all the registers to be unstacked and the PC is loaded with the starting address of the user program. The system then executes the user program.

NMI - Pressing the NMI key causes the interrupt program to start at the address contained in 07DD.DE. If these memory locations have not been overwitten by the user, they contain the values E272, which is the value set by the RESET program.

ROUNMI loads A with the MSB of the address being programmed (LDA 10.8: i.e. MSP of the PC in A). If the high address weight is Ex EQ, ROUNMI causes a jerk to R POINT. Under monitor control (Address > E000), the NMI key has the same action as the RESET key. If a user program is launched (current address less than E000 and even 07FF in the case of our system), ROUNMI causes 1 connection to RSWI (VISU of the Registries).

Initialisation of the NMI function

    E272 A66A            ROUNMI  LDA 10,S
    E274 84F0                    ANDA #$F0
    E276 81E0                    CMPA #$E0
    E278 27AD                    BEQ RPOINT
    E27A 202B                    BRA RSWI

    E7EA BE07DD          RNMI    LDX >SAVNMI
    E7ED 6E84                    JMP ,X  ; EXECUTE ROUTINE NMI

RSWI2 - is associated with the BP (Break Point) function as follows: when a breakpoint is set, the useful instruction (saved in Memo 07DF, 07FO) is automatically replaced by 10 3F = SWI2 instruction (see BPOINT). The user program stops on this inter- ruption, reads the box Memo E7F4,F5 to find E27C. He then executes the RSWI2 program which consists first of all in refocusing the program counter (2 times DEC 11.5) and then in putting back the original instruction saved in Memo O7DF,EO. A connection to RSWI allows you to view and possibly change the contents of the up registers. After returning to R POINT or after RESET, pressing the

Initialisation of the SWI2 function

     E27C 6A6B            RSWI2   DEC 11,S
     E27E 6A6B                    DEC 11,S        ; POINTER PCR SUR INSTRUC.
     E280 FC07DF                  LDD >SASWI2
     E283 EDF80A                  STD [10,S]      ; REMETRE INSTRUCTION EN MEM.
     E286 201F                    BRA RSWI        ; SCRUTER LES REGISTRES

Insert a breakpoint, save the instruction

     E206 CC756B          BPOINT  LDD #$756B
     E209 DDFE                    STD <DISBUF+4   ; ALLUMER BP
     E20B 17FEA7                  LBSR BADDR      ; AFFICHE ADRESSE
     E20E EC84                    LDD ,X
     E210 DDDF                    STD <SASWI2     ; SAUVE INSTRUCTION
     E212 CC103F                  LDD #$103F
     E215 ED84                    STD ,X          ; PLACE POINT D'ARRET
     E217 200E                    BRA RPOINT      ; RETOUR SCRUT

75

The CN key allows the user program to be restarted from where it left off. We advise readers to return to the study of these two interrupt functions after familiarizing themselves with the GETKEY, DISPRESH, and BADDR subroutines.

Reset Program

Initialization, decoding of the M, R, CN keys. L, P, GO and launch of the user program

RESTAR program

     E219 10CE07C0        RESTAR  LDS #PILE       ; INIT PILE
     E21D 10FF07F8                STS >SAVPIL     ; ET POINTEUR X
     E221 8EE272                  LDX #ROUNMI
     E224 BF07DD                  STX >SAVNMI
     E227 10CE07A0        RPOINT  LDS #PILMON
     E22B 8607                    LDA #$07        ; INIT DP
     E22D 1F8B                    TFR A,DP
     E22F 8D57                    BSR CLRDIS      ; DISBUF=0
     E231 8601                    LDA #$01
     E233 97FA                    STA <DISBUF     ; CHARGEMENT PROMPT
     E235 17FDE8                  LBSR GETKEY     ; ALLUME PROMPT
     E238 8126                    CMPA #$26       ; TOUCHE BP ?
     E23A 27CA                    BEQ BPOINT      ; OUI, PLACER POINT D'ARRET
     E23C 8130                    CMPA #$30       ; TOUCHE REGISTRE?
     E23E 102700C5                LBEQ FONREG     ; OUI, EXECUTE FONCTION DE CHGT REG
     E242 8120                    CMPA #$20       ; TOUCHE=MEMORY?
     E244 1027FEDF                LBEQ EXMEMO     ; OUI, EXECUTE ROUTINE
     E248 8132                    CMPA #$32       ; NON, TOUCHE=CONTINUE?
     E24A 2722                    BEQ EXCN        ; OUI, EXECUTE ROUTINE
     E24C 8134                    CMPA #$34       ; NOU, TOUCHE=LOAD?
     E24E 10270387                LBEQ EXLOAD     ; OUI, EXECUTE ROUTINE
     E252 8135                    CMPA #$35       ; NON, TOUCHE=PUNCH?
     E254 102703E9                LBEQ EXPUNC     ; OUI, EXECUTE ROUTINE
     E258 8131                    CMPA #$31       ; NON, TOUCHE=GO?
     E25A 26CB                    BNE RPOINT      ; NON, RETOUR SCRUTATION
     E25C 867C                    LDA #$7C        ; OUI, CHARGE G DS DERNIER DIGIT
     E25E 97FF                    STA <DISBUF+5
     E260 17FE52                  LBSR BADDR      ; FABRIQUE ADRESSE DEPART
     E263 109EF8                  LDY <SAVPIL     ; DU PROGRAMME
     E266 AF2A                    STX 10,Y        ; ADRESSE PROG DANS PC
     E268 8680                    LDA #$80
     E26A AAA4                    ORA ,Y          ; POSITIONNER PLAG E=1
     E26C A7A4                    STA ,Y          ; POUR PRENDRE EN COMPTE
     E26E 10DEF8          EXCN    LDS <SAVPIL     ; TOUS LES REGISTRES
     E271 3B                      RTI             ; DEPART PROG UTILISATEUR

Display & Keyboard

Both of these functions use the same lines as the PIA. In addition, the two sub-programs:

are intertwined as shown in the general organizational chart opposite. The main monitor program often uses these two essential functions. We will therefore analyse the corresponding hardware and software in detail in the following paragraphs.

GET KEY

Display

It includes 6 common cathode displays. For obvious reasons of simplicity, the data - or more generally - the symbols to be displayed are not memorized but multiplexed. A refreshment (per program) is therefore necessary. The six symbols to be displayed are (after coding 7 segments) arranged in 6 consecutive memory positions of addresses 07FA to 07FF (called DISBUF). After reading the DISBUF and switching via the PIA port A, each symbol bit commands the exctinction or ignition of a light segment by bypassing or not the supply current of the LEDs in the corresponding transistor of the 74LS240 (see below). This is only possible if the display is selected. The selection is made from the PIA port B (SCN REG) decoded by the 7442 which brings the cathode of the display to zero.

GET KEY


76

Keyboard & Display

Knowing that a “0” at the input of the 74240 lights up 1 light segment (transistor blocked) and knowing that the content of the DISBUF memory positions is supplemented by a program (E0A4 address of DISPRESH) before being directed by the PIA, it is easy to check the following correspondence:

Display pattern mapping

This is the DIGTBL table. The different 7-segment codes (7E, 06… 69) are stored in memory from the E010 address.

As for the DISPRESH programme, it does not present any major difficulties. The PIA port A (DISREG) is programmed as an output in order to direct the various command words from DISBUF. A half-port (port B) is enough to select the 6 displays via the 7442 decoder (3 bits would be enough but you also have to add 4 lines of keyboard as we will see in the following $). Indexed addressing makes it easy to scan displays sequentially. The selected display illuminates the desired symbol for 1 ms.

Driving the displays

    E07B 3416            DISPRE  PSHS X,B,A
    E07D 8EA004                  LDX #DISREG
    E080 4F                      CLRA
    E081 A702                    STA 2,X         ; ACCES A DDRA
    E083 A703                    STA 3,X         ; ACCES A DDRB
    E085 867F                    LDA #$7F
    E087 A784                    STA ,X  ; PA EN SORTIE
    E089 860F                    LDA #$0F
    E08B A701                    STA 1,X         ; PB0-3 EN SORTIE
    E08D 8604                    LDA #$04
    E08F A702                    STA 2,X         ; ACCES A PA-DISREG
    E091 A703                    STA 3,X         ; ACCES A PB-DISCNT
    E093 8E07FA                  LDX #DISBUF
    E096 C603                    LDB #$03
    E098 5C              RECOM   INCB
    E099 C10A                    CMPB #$0A       ; TOUS LES AFFICHEURS SCRUTES?
    E09B 2602                    BNE SCRUTA      ; NON, CONTINUER
    E09D 3596                    PULS PC,X,B,A   ; OUI, RETOUR SOUS GETKEY

Keyboard & Display

Displays in memory

Keyboard

The keyboard is organized into a 4-row x 7-column matrix, at the intersection of which are the contacts of the various keys. The figure below illustrates this organization. The detection of a pressed key is carried out as follows: with PIA port A positioned as input and port B as output, the GETKEY subroutine performs an initial analysis of the keyboard by scanning it line by line. Addressing a line number by SCN REG carries the corresponding output of the 7442 to a state of “0”. If one of the keys is pressed on the line being addressed, the line contact


77

Keyboard & Display

column imposes this state “0” on one of the columns, i.e. on one of the entries of the PIA DISREG. A simple reading of the PIA port A tells us about the status of the keyboard. Taking into account the complementation of the reading of the PIA (Ad EO44 of GETKEY) a reading = FF translates the press on one of the keys. |! It is then necessary to proceed with the identification of the key pressed. If the status of port B gives the position of the key in line, the column position is obtained by locating the position of the “1°” (do not forget the completion) of the data of port A: this is the role of the DECKEY part which ends with the entry of the key code into accumulator A. The following detailed flowchart provides a better understanding of the GETKEY sub-program. If no key is pressed, the program starts again by refreshing the displays to return to the detection of a key and so on. | The code af - key code - corresponds to the &° line and to the f B° column. For example, the key is coded 00. The various keycodes are stored in memory 2716 from the address E000 in the following order:

Keyboard mapping table

This is the KEYTBL table. This table includes only the codes for the HEXA keys. The reader will easily establish the code of the function keys (Inc, Dec, Mem…) (i.e. 00, 10, 20…).

Keyboard circuit diagram

Keyboard flow diagram

Keyboard flow diagram


78

     E020 342C            GETKEY  PSHS Y,DP,B
     A0                           SETDP $A0
     E022 86A0                    LDA #$A0
     E024 1F8B                    TFR A,DP
     E026 8D53            FINCLA  BSR DISPRE      ; ALLUMER LES AFFICHEURS
     E028 4F                      CLRA
     E029 9706                    STA <SCNREG     ; ACCES A DDRA
     E02B 9707                    STA <SCNCNT     ; ACCES A DDRB
     E02D 9704                    STA <DISREG     ; PA EN ENTREE
     E02F 860F                    LDA #$0F
     E031 9705                    STA <DISCNT     ; PB EN SORTIE
     E033 8604                    LDA #$04
     E035 9706                    STA <SCNREG     ; ACCES A ORA-DISREG
     E037 9707                    STA <SCNCNT     ; ACCES A DRB-DISCNT
     E039 C6FF                    LDB #$FF
     E03B 5C              LIGSUI  INCB
     E03C C104                    CMPB #$04       ; FIN SCRUT. CLAVIER?
     E03E 27E6                    BEQ FINCLA      ; OUI, SCRUTER AFFICHEURS
     E040 D705                    STB <DISCNT     ; NON, SCRUTER LIGNE PAR LIGNE
     E042 9604                    LDA <DISREG
     E044 43                      COMA            ; PAS DE TOUCHE ENFONCEES?
     E045 27F4                    BEQ LIGSUI      ; OUI, SCRUTER LIGNE SUIV;
     E047 F707F0                  STB SAVCNT     
     E04A B707F1                  STA SAVREG      ; NON, TOUCHE ENFONCEE
     E04D 4F                      CLRA
     E04E C601                    LDB #$01
     E050 F107F1          COLSUI  CMPB SAVREG     ; TOUCHE DETECTEE?
     E053 2706                    BEQ DECKEY      ; OUI, RECONNAITRE LA TOUCHE
     E055 4C                      INCA            ; NON, PASSER A LA COLONNE SUIVANTE
     E056 58                      ASLB            ; TOUTES COLONNES TESTEES?
     E057 27E2                    BEQ LIGSUI      ; OUI, LIGNE SUIVANTE
     E059 20F5                    BRA COLSUI      ; NON,COLONNE SUIVANTE

     E05B F607F0          DECKEY  LDB SAVCNT      ; NUMERO DE LIGNE
     E05E 58                      ASLB
     E05F 58                      ASLB
     E060 58                      ASLB
     E061 58                      ASLB
     E062 3404                    PSHS B  ; REPERE LIGNE
     E064 ABE0                    ADDA ,S+
     E066 3402                    PSHS A  ; SAUVEGARDE CODE TOUCHE
     E068 108E0008                LDY #$0008
     E06C 5F              NOREB   CLRB
     E06D 9604            DLY2    LDA <DISREG
     E06F 43                      COMA REBONDISSEMENT ?
     E070 26FA                    BNE NOREB       ; OUI, ATTENDRE DISPARITION
     E072 5A                      DECB            ; NON, TEMPO=30MS
     E073 26F8                    BNE DLY2
     E075 313F                    LEAY -1,Y
     E077 26F4                    BNE DLY2
     E079 35AE                    PULS PC,Y,DP,B,A        ; RETOUR RESET ROUTINE

GET KEY flow diagram

Inspect and modify the contents of memory

The memory viewer program allows the visualization of the contents of the Memo box bridged by the first four DISBUF Memo boxes. These boxes are filled in by pressing four hexadecimal keys on the keyboard (H H° H° H°") under the control of the BADDR subroutine. If a change in the contents of the memory is necessary, the part of EXMEMO (from address E 155) takes the new data from the last two DISBUF boxes (entries from the keyboard) and stores it in the memory box designated EXINC and EXDEC are called when the INC or DEC keys are used to move to the next memory box or to review the previous memory box. In this chapter, we will analyze:

BADDR
which makes the hexadecimal address entered from the keyboard, refreshes the display and puts this address in X.
EXMEMO
which allows the visualization (and the change if necessary) of the contents of the memory box pointed to by X.
EXINC EXDEC
this increments or decrements the current address. A reading of the hexa box takes place before putting the data away (we were able to try to write in EPROM)
.

Given the number of subroutines involved, we offer the following small checklist:

HEX CON
Converts 1 key code (af) into its hexa equivalent and puts it back into To If the key is not hexadecimal, the program plugs into R POINT.
L7SEG
In the case of two hexa digits (in A), converts the left-hand digit into a 7-segment code (display-compatible) and places it in A.
CON HEX
:(7 TOHEX) converts the 7-segment code (in A) to its hexadecimal equivalent and places it in A.
KEY HEX
combines GETKEY & HEXCON
HEXIN 7
Uses KEYHEX to accept input from two keys and combines the two hexa values (OH & OH') into a single 1 (H H') in A.

We also specify that GETKEY detects 1 hexa key in the form αβ (α row, β column). This key can be converted to its hexa OH equivalent by HEX-CON. It can be transcoded hexa into 7-segment display-compatible code by R7SEG. It can also be reread in hexa from disbuf by CONHEX.

     E112 3414            CONHEX  PSHS X,B
     E114 8EE010                  LDX #DIGTBL
     E117 1F89                    TFR A,B         ; B=DISBUF+4 OU DISBUF+5
     E119 4F                      CLRA
     E11A E180            NONFIN  CMPB ,X+        ; CHERCHE VAL DONNEE
     E11C 2707                    BEQ DONEA       ; A=VAL HEXA DONNEE
     E11E 10270105        FONCTI  LBEQ RPOINT     ; OUI, FONCTION, RETOURNER SCRUTER
     E122 4C                      INCA
     E123 20F5                    BRA NONFIN
     E125 3594            DONEA   PULS PC,X,B

80

CONHEX-INCREM flow diagram

     07                           SETDP $07
     E163 96FE            INCREM  LDA <DISBUF+4 PLACE DONNEE EN MEM.
     E165 8DAB                    BSR CONHEX      ; CONVERTIR VAL CONVERSION
     E167 48                      ASLA
     E168 48                      ASLA
     E169 48                      ASLA
     E16A 48                      ASLA            ; VAL HEXA DANS MSB
     E16B 3402                    PSHS A
     E16D 96FF                    LDA <DISBUF+5
     E16F 8DA1                    BSR CONHEX
     E171 ABE0                    ADDA ,S+        ; A=DONNEE DISBUF+4 ET +5
     E173 1F89                    TFR A,B
     E175 A784                    STA ,X          ; DONNEE DANS CASE X
     E177 39                      RTS

                  ******* EXECUTION DE LA FONCTION INCREMENTATION *******
                  *********** ET DE LA FONCTION DECREMENTATION **********

     E178 0AEE            EXDEC   DEC <COMDEC
     E17A 8DE7            EXINC   BSR INCREM
     E17C 96EE                    LDA <COMDEC     ; INCREMENTE OU DECREMENTE?
     E17E 2628                    BNE DECRE       ; COMDEC<>0, DECREMENTE
     E180 A680                    LDA ,X+         ; PRENDRE DONNEE DS X ET X+1
     E182 3404            PREXIN  PSHS B          ; SAUVE AVANT STOCKAGE
     E184 A1E0                    CMPA ,S+        ; MEMOIRE ABSENTE OU MEMOIRE MORTE?
     E186 1026009D                LBNE RPOINT     ; OUI, ALLUMER PROMPT ET SCRUTER
     E18A 1F10                    TFR X,D         ; NON, AFFICHE CASE MEMOIRE
     E18C 17FF6D                  LBSR L7SEG      ; SUIVANTE OU PRECEDENTE
     E18F 97FA                    STA <DISBUF
     E191 1F10                    TFR X,D
     E193 17FF6A                  LBSR R7SEG
     E196 97FB                    STA <DISBUF+1
     E198 1F98                    TFR B,A
     E19A 17FF5F                  LBSR L7SEG
     E19D 97FC                    STA <DISBUF+2
     E19F 1F98                    TFR B,A
     E1A1 17FF5C                  LBSR R7SEG
     E1A4 97FD                    STA <DISBUF+3
     E1A6 2088                    BRA REMEMO      ; RECOMMENCER EXECUTION MEMOIRE
     E1A8 A684            DECRE   LDA ,X
     E1AA 301F                    LEAX -1,X
     E1AC 20D4                    BRA PREXIN      ; DECREMENTATION EXECUTEE

EXDEC flow diagram

SYMBOL TABLE

ADDARR 02 07EC    ADDDEP 02 07EA    AF2DIG 02 E2E2    AFCLIG 02 E7B9    AFEROR 02 E56A    AFFIAD 02 E7CB    AFFIAR 02 E763    AFICHA 02 E601

AFIVAL 02 E3DD    AFSIGN 02 E5BD     BADDR 02 E0B5    BCOURT 02 E78A    BITCA0 02 E5D3    BITCA1 02 E5C5    BITLSB 02 E5C3    BOUCL1 02 E6F1

BOUCL2 02 E6F9    BOUCL3 02 E6E2    BOUFIN 02 E63C    BPOINT 02 E206    BRANNE 02 E72D    BRANPO 02 E726     CAL16 02 E4DB    CALCON 02 E404

CALCU8 02 E4EC    CALCUL 02 E501    CALOFS 02 E757    CALPOT 02 E1E1    CARRY1 02 E5B0    CARSUI 02 E605    CHAN16 02 E3C8    CHANG8 02 E3B3

CHAR16 02 E49F    CHARGE 02 E738    CHPOST 02 E44D    CHTCHI 02 E4AB    CHTDON 02 E4AE    CLIGNE 02 E7AF    CLIGNO 02 E7B1    CLRDIS 02 E288

CODFIN 02 E675    COLSUI 02 E050    COMDEC 02 07EE    COMPAB 02 E422    COMPAR 02 E4A3    COMPR2 02 E516    COMPR3 02 E522    COMPR4 02 E534

COMPR5 02 E55D    CONHEX 02 E112    CONROT 02 E5CB     CONTI 02 E201    DEBCHA 02 E6D0    DECENC 02 E575    DECHEX 02 E4F4    DECKEY 02 E05B

 DECRE 02 E1A8    DECTJS 02 E57B    DEPLAC 02 E4E2    DERADD 02 E62D    DETECS 02 E5F1    DIGTBL 02 E010    DISBUF 02 07FA    DISCNT 00 A005

DISFIN 02 E637    DISPRE 02 E07B    DISREG 00 A004      DLY1 02 E0AA      DLY2 02 E06D    DLY30U 02 E5A5    DLY5MS 02 E6DA     DONEA 02 E125

ENCDON 02 E140    ENCORE 02 E296    EREURE 02 E428    ERREUR 02 E426     ERROR 02 E7BE      EXCN 02 E26E     EXDEC 02 E178     EXINC 02 E17A

EXLBCL 02 E740    EXLBIL 02 E742    EXLOAD 02 E5D9    EXMEMO 02 E127    EXOFST 02 E705    EXPOCT 02 E1AE    EXPUNC 02 E641    EXREGI 02 E34F

FADDRX 02 E0AF    FINCAL 02 E571    FINCHA 02 E6C5    FINCLA 02 E026    FINENR 02 E6A4    FONCTI 02 E11E    FONREG 02 E307    GETKEY 02 E020

HEXCON 02 E0E7    HEXIN7 02 E0CC    INCREM 02 E163     INTER 02 E2F4    INTER2 02 E29C    INTER3 02 E597    INTR05 02 E434    INTR08 02 E467

INTR16 02 E488    INTVAL 02 E4BF    KEYHEX 02 E0E4    KEYTBL 02 E000     L7SEG 02 E0FC    LIGSUI 02 E03B    LSBDSA 02 E573    M10000 02 E54B

 MOINS 02 E1FB    MSBDON 02 E4B4    MSBLSB 02 E582    MUL100 02 E58B    MULFIN 02 E52E    MULPAR 02 E50D    MUP100 02 E591    NDVALH 02 E107

NEGPOS 02 07E9    NONFIN 02 E11A     NOREB 02 E06C    NOUDLY 02 E59D    OFFSET 02 E1C3    OFPOCT 02 E718      PILE 00 07C0    PILMON 00 07A0

PLUCOU 02 E784      PLUS 02 E1F4    PLUSMS 02 07E3    POCPOS 02 E449   POSITIF 02 E457    PRELOW 02 07E7    PRESEH 02 07E5    PRESEL 02 07E6

PRESER 02 07E1    PREXIN 02 E182    PROMPT 02 E291     R7SEG 02 E100    R8BREG 02 E39D       RCR 02 E484    RE8BIT 02 E33E    REBIT8 02 E343

RECBIT 02 E59B    RECMCE 02 E53F     RECOM 02 E098    RECYCL 02 E66B    REG16B 02 E3A8     REGPC 02 E348    REGPRE 02 E31C    REGSUI 02 E2FB

REGTBL 02 E29E    REMEMO 02 E130    RESTAR 02 E219    RETOU1 02 E790    RETOU2 02 E794    RETOUR 02 E4E1     RFIRQ 00 0775      RIRQ 00 0770

RNMI 02 E7EA    ROUNMI 02 E272    RPOINT 02 E227      RSWI 02 E2A7     RSWI2 02 E27C     RSWI3 00 077A    SADDR1 02 07F2    SADDR2 02 07F4

SASWI2 02 07DF      SAUT 02 E6E8    SAUVER 02 07E2     SAVB1 02 07F6     SAVB2 02 07F7    SAVCNT 02 07F0    SAVNMI 02 07DD    SAVPIL 02 07F8

SAVPOC 02 07E4    SAVREG 02 07F1    SAVRES 02 07EF    SCARRY 02 E59F    SCNCNT 00 A007    SCNREG 00 A006    SCRUDE 02 E316    SCRUTA 02 E09F

SCRUTC 02 E0EE    SECPAR 02 E54D    STADON 02 E482    STOCKA 02 E781    STODON 02 E47A       SUI 02 E4D3    SUICHA 02 E61F    SUITEB 02 E750

SUITEP 02 E4C8    SUITER 02 E2CE     SUIVT 02 E777     TEMPO 02 E7C4    TESTER 02 E557    TESTST 02 E41A    TJTRAN 02 E690    TOUREG 02 E2BB

TRANSM 02 E6D8    TSTDEC 02 E310    TSTPOC 02 E444    TSTSUI 02 E42D    VALHEX 02 E10E

Review and change of registry content

The RSWI program transfers the stack registers into DISBUF for the user to review. The registers are visualised in the order in which they are arranged in a stack. CC. TO B, DP. X, Y, U and PC. A trick also allows you to visualize S. You can switch from one register to another by pressing the INC (next reg.) or DEC (previous reg.) key. The connection to RSWI is automatic when the flow of a user program meets a breakpoint (restart start and init.) or an SWI In the latter case. the interrupt vector E27A leads the HP to run BRA SWI (see Address E27A). After examining the contents of the registers, RSWI continues with a connection to FONREG. This function allows the contents of the registers to be changed. It is understood that this function can be executed directly from a press on the REG key. We will analyze the following parts in turn: - INIT - TOUREG - INTER - FONREG - CHTDON

RSWI flow diagram


81

     E27C 6A6B            RSWI2   DEC 11,S
     E27E 6A6B                    DEC 11,S        ; POINTER PCR SUR INSTRUC.
     E280 FC07DF                  LDD >SASWI2
     E283 EDF80A                  STD [10,S]      ; REMETRE INSTRUCTION EN MEM.
     E286 201F                    BRA RSWI        ; SCRUTER LES REGISTRES

RSWI flow diagram

     E2BB 338D0035        TOUREG  LEAU >INTER,PCR
     E2BF 3440                    PSHS U          ; PC SAUVE EN PILE
     E2C1 A6A0                    LDA ,Y+         ; A=VAL REGISTRE
     E2C3 97FF                    STA <DISBUF+5   ; REGISTRE DS DERNIER DIGIT
     E2C5 108CE2A7                CMPY #RSWI      ; FIN TABLEAU?
     E2C9 2603                    BNE SUITER      ; NON
     E2CB 8E07F8                  LDX #SAVPIL     ; OUI, X POINTE SAVPIL
     E2CE 108CE2A2        SUITER  CMPY #REGTBL+4  ; 1iere MOITIER TEBLEAU?
     E2D2 230E                    BLS AF2DIG      ; OUI, 1iere MOITIER
     E2D4 A684                    LDA ,X          ; NON, 2ieme MOITIER
     E2D6 17FE23                  LBSR L7SEG      ; AFFICHE CONTENU
     E2D9 97FA                    STA <DISBUF     ; SUR 4 DIGITS
     E2DB A680                    LDA ,X+ 
     E2DD 17FE20                  LBSR R7SEG
     E2E0 97FB                    STA <DISBUF+1
     E2E2 A684            AF2DIG  LDA ,X          ; 1iere MOITIER
     E2E4 17FE15                  LBSR L7SEG      ; AFFICHE COTENU SUR
     E2E7 97FC                    STA <DISBUF+2   ; 2 DIGITS
     E2E9 A680                    LDA ,X+ 
     E2EB 17FE12                  LBSR R7SEG
     E2EE 97FD                    STA <DISBUF+3
     E2F0 17FD2D                  LBSR GETKEY     ; ALLUMER AFFICHEURS
     E2F3 39                      RTS             ; RETOUR A CHANGEMENT DE REG

TOUREG flow diagram

     E2F4 5A              INTER   DECB 
     E2F5 2F1F                    BLE SCRUDE      ; DECREMENTE OU INCREMENTE ? 
     E2F7 C101                    CMPB #$01       ; 1er REGISTRE =CCR?
     E2F9 2715                    BEQ TSTDEC      ; OUI, SCUTER r
     E2FB 8100            REGSUI  CMPA #$00       ; REGISTRE SUIVANT?
     E2FD 1026FF26                LBNE RPOINT     ; NON, RETOUR PROMPT
     E301 108CE2A7                CMPY #RSWI      ; OUI, FIN TABLEAU?
     E305 26B4                    BNE TOUREG      ; NON, CONTINUER REGISTRES
     E307 17FF7E          FONREG  LBSR CLRDIS
     E30A 8641                    LDA #$41        ; AFFICHER r
     E30C 97FE                    STA <DISBUF+4
     E30E 203F                    BRA EXREGI      ; SCRUTER REGISTRES
     E310 8110            TSTDEC  CMPA #$10
     E312 27F3                    BEQ FONREG
     E314 20E5                    BRA REGSUI 

INTER flow diagram

     E316 8110            SCRUDE  CMPA #$10       ; DECREMENTATION DEMANDEE?
     E318 2702                    BEQ REGPRE      ; OUI, PASSER AU REGISTRE PRECEDENT
     E31A 20DF                    BRA REGSUI      ; NON, PASSER AU REGISTRE SUIVANT
     E31C 313E            REGPRE  LEAY -2,Y       ; REGTBL POINTE VERS REGISTRE PRECEDENT
     E31E 17FF67                  LBSR CLRDIS     ; ETEINDRE AFFICHAGE
     E321 108CE29D                CMPY #REGTBL-1  ; DEBUT TABLEAU DES REGISTRES?
     E325 27E0                    BEQ FONREG      ; OUI, RETOUR FONCTION REGISTRE
     E327 108CE2A5                CMPY #REGTBL+7  ; POINTE SUR PC?
     E32B 271B                    BEQ REGPC       ; OUI, ALLUMER LE CONTENU
     E32D 10BCE2A1                CMPY REGTBL+3   ; REGISTRES 8 BITS?
     E331 270B                    BEQ RE8BIT
     E333 10BCE2A0                CMPY REGTBL+2
     E337 230A                    BLS REBIT8
     E339 301C                    LEAX -4,X       ; REGISTRE 16 BITS X,Y,U,P,S
     E33B 16FF7D                  LBRA TOUREG     ; VISUALISER CONTENU
     E33E 301D            RE8BIT  LEAX -3,X       ; REGISTRES 8 BITS D,B,A,C
     E340 16FF78                  LBRA TOUREG     ; VISUALISE CONTENU
     E343 301E            REBIT8  LEAX -2,X       ; REGISTRES 8 BITS B,A,C
     E345 16FF73                  LBRA TOUREG     ; VISUALISER CONTENU
     E348 9EF8            REGPC   LDX <SAVPIL
     E34A 300A                    LEAX 10,X       ; X POINTE SUR PC
     E34C 16FF6C                  LBRA TOUREG

INTER flow diagram

     E34F 318DFF4B        EXREGI  LEAY REGTBL,PCR
     E353 9EF8                    LDX <SAVPIL
     E355 17FCC8                  LBSR GETKEY     ; ALLUMER REG
     E358 8130                    CMPA #$30       ; REG DEMANDE?
     E35A 1027FEC9                LBEQ RPOINT     ; OUI, CRUTER TOUCHES
     E35E 8106                    CMPA #$06       ; CCR?
     E360 273B                    BEQ R8BREG      ; OUI
     E362 3001                    LEAX 1,X
     E364 3121                    LEAY 1,Y        ; REG SUIVANT
     E366 8105                    CMPA #$05       ; ACCA?
     E368 2733                    BEQ R8BREG      ; OUI
     E36A 3001                    LEAX 1,X
     E36C 3121                    LEAY 1,Y
     E36E 8104                    CMPA #$04       ; ACCB?
     E370 272B                    BEQ R8BREG      ; OUI
     E372 3001                    LEAX 1,X
     E374 3121                    LEAY 1,Y
     E376 8103                    CMPA #$03       ; DPR?
     E378 2723                    BEQ R8BREG      ; OUI
     E37A 3001                    LEAX 1,X
     E37C 3121                    LEAY 1,Y
     E37E 8102                    CMPA #$02       ; REG X?
     E380 2726                    BEQ REG16B      ; OUI
     E382 3002                    LEAX 2,X
     E384 3121                    LEAY 1,Y
     E386 8101                    CMPA #$01       ; REG Y?
     E388 271E                    BEQ REG16B      ; OUI
     E38A 3002                    LEAX 2,X
     E38C 3121                    LEAY 1,Y 

82

     E38E 8115                    CMPA #$15       ; REG U?
     E390 2716                    BEQ REG16B      ; OUI
     E392 3002                    LEAX 2,X
     E394 3121                    LEAY 1,Y
     E396 8114                    CMPA #$14       ; REG PCR?
     E398 270E                    BEQ REG16B      ; OUI
     E39A 16FE8A                  LBRA RPOINT
     E39D A6A4            R8BREG  LDA ,Y
     E39F 97FF                    STA <DISBUF+5   ; AFFICHE TYPE DE REG
     E3A1 17FF3E                  LBSR AF2DIG     ; AFFICHE LE CONTENU DU REG 8BITS
     E3A4 301F                    LEAX -1,X
     E3A6 200B                    BRA CHANG8      ; CHANGER LE CONTENU
     E3A8 A6A4            REG16B  LDA ,Y
     E3AA 97FF                    STA <DISBUF+5   ; AFFICHE TYPE DE REG
     E3AC 17FF25                  LBSR SUITER+6   ; AFFICHE LE CONTENU DU REGISTRE 16BITS
     E3AF 301E                    LEAX -2,X
     E3B1 2015                    BRA CHAN16      ; CHANGER SON CONTENU
     E3B3 3430            CHANG8  PSHS Y,X        ; SAUVEGARDE DES POINTEURS
     E3B5 8E07FC                  LDX #DISBUF+2
     E3B8 108E0002                LDY #$02
     E3BC 1700EF                  LBSR CHTDON     ; SOUS PROG DE CHGT DES DONNEES
     E3BF 3530                    PULS Y,X
     E3C1 96E5                    LDA <PRESEH 
     E3C3 A784                    STA ,X          ; NELLE DONNEE EN PILE
     E3C5 16FF3F                  LBRA FONREG     ; SCRUTER LES REGISTRES

EXREGI flow diagram

EXREGI flow diagram

     E4AB 17FB72          CHTCHI  LBSR GETKEY     ; SCRUTER CHIFFRES
     E4AE 338D000D        CHTDON  LEAU >INTVAL,PCR
     E4B2 3440                    PSHS U
     E4B4 17FC30          MSBDON  LBSR HEXCON     ; CONVERTI CHIFFRE EN HEXA
     E4B7 1F89                    TFR A,B
     E4B9 17FC44                  LBSR R7SEG
     E4BC A780                    STA ,X+         ; ENVOI CHIFFRE SUR AFFICHEUR
     E4BE 39                      RTS
     E4BF 3404            INTVAL  PSHS B
     E4C1 313F                    LEAY -1,Y
     E4C3 1F20                    TFR Y,D         ; 1 OU 5 OU 3
     E4C5 54                      LSRB 
     E4C6 251A                    BCS DEPLAC
     E4C8 108C0002        SUITEP  CMPY #$02       ; DISBUF+0
     E4CC 270D                    BEQ CAL16       ; REGISTRE 16BITS
     E4CE 1F20                    TFR Y,D         ; 0 OU 4
     E4D0 54                      LSRB
     E4D1 2419                    BCC CALCU8      ; REGISTRE 8BITS
     E4D3 108C0000        SUI     CMPY #$00
     E4D7 2ED2                    BGT CHTCHI      ; CHIFFRE SUIVANT
     E4D9 2706                    BEQ RETOUR
     E4DB 3502            CAL16   PULS A
     E4DD ABE0                    ADDA ,S+
     E4DF 97E6                    STA <PRESEL
     E4E1 39              RETOUR  RTS

     E4E2 3502            DEPLAC  PULS A
     E4E4 48                      ASLA
     E4E5 48                      ASLA
     E4E6 48                      ASLA
     E4E7 48                      ASLA
     E4E8 3402                    PSHS A
     E4EA 20DC                    BRA SUITEP
     E4EC 3502            CALCU8  PULS A
     E4EE ABE0                    ADDA ,S+
     E4F0 97E5                    STA <PRESEH
     E4F2 20DF                    BRA SUI

GETKEY usage flow diagram


83

The figures opposite represent the execution of CHTDON according to the prior initialization of X and Y (Ad E385 and Ad E3CA of BX REGI): a) Loading of the hexadecimal value HH' in the PRESEH 07ES5 memo and transcoding into 7 segments to display this value on the 3° and 4° displays. These hexa values are entered by the keyboard under the control of GETKEY. b) Same as in a) for a hexadecimal value HH' H",H"“. In the latter case H” H"“ are stored in Memo PRESEL 07E6.

 flow diagram

AUTOMATIC OFFSET CALCULATION

The NANOMON software allows automatic calculation in the following two cases: - in relative addressing (prog. EXOFS) - in indexed addressing (prog. EXPOCT) We will successively analyze the two programs EXOFS and EXPOCT. However, we propose, beforehand, 2 tables by way of reminder.

relative address offset branching

relative address offset indexing

EXOFST (Ad E705)

Offset calculation for branches

As shown in the flowchart on the following page, the EXOFST program first checks the last byte entered into RAM (and possibly the penultimate byte) to determine whether the branch offset should be 8 or 16 bits (short or long branch). The execution of OFST then continues with the actual calculation of the offset by calling the CALOFST subroutine, which calculates the difference between the arrival address and the departure address, as shown in the flowchart below:

relative address offset indexing


84

                          ****** CALCULE L'OFFSET SUR 16 BITS ******
                          **** D CONTIENT L'OFFSET,Y=ADRESSE DEP ***
                          *
                          *
                          *
     E757 1F12            CALOFS  TFR X,Y         ; Y=ADRESSE DE DEPART
     E759 109FEA                  STY <ADDDEP
     E75C 8D05                    BSR AFFIAR      ; AFFICHAGE ADRESSE ARRIVEE
     E75E 1F10                    TFR X,D         ; D=ADRESSE DEPART
     E760 93EA                    SUBD <ADDDEP    ; D=ARRIVEE-DEPART=OFFSET
     E762 39                      RTS


                          ****** AFFICHAGE DE L'ADRESSE D'ARRIVEE ******
                          ** STOCKE DS NEGPOS LE SENS DE L'OFFSET<>0 ***
                          *
                          *
                          *
     E763 CC6F41          AFFIAR  LDD #$6F41      ; AFFICHE AR DS DISBUF
     E766 DDFE                    STD <DISBUF+4
     E768 17F94A                  LBSR BADDR      ; AFFICHE ADRESSE ARRIVEE
     E76B 9FEC                    STX <ADDARR
     E76D 17F8B0                  LBSR GETKEY
     E770 8131                    CMPA #$31       ; TOUCHE GO?
     E772 2703                    BEQ SUIVT       ; OUI, CHARGE ADRESSE
     E774 16FAB0                  LBRA RPOINT 
     E777 17FB0E          SUIVT   LBSR CLRDIS     ; ETEINDRE AFFICHAGE
     E77A 86FF                    LDA #$FF
     E77C 9CEA                    CMPX <ADDDEP    ; ARRIVEE<DEPART ?
     E77E 2501                    BLO STOCKA      ; OUI, STOCKE DS NEGPOS
     E780 4C                      INCA
     E781 97E9            STOCKA  STA <NEGPOS     ; NEGPOS=0>0 NEGPOS=FF<0
     E783 39                      RTS

When CALOFST returns, Memo 07E9 contains the direction of travel and the accumulator D the 16-bit offset. The main programme continues with tests on the result of the calculated offset, in particular the verification of the non-exceeding capacity, and the verification of the length (8 bits, 16 bits) of the displacement. The Er symbol is displayed in case of error. The program ends with the storage of the offset in the program. user and by displaying this offset in the new starting address.

                          ****** AFFICHE L'ADRESSE DE CHARGEMENT ******
                          ** DE L'OFFSET DANS LES 4 PREMIERS DIGITS ***
                          *
                          *
                          *
     E7CB 1F21            AFFIAD  TFR Y,X
     E7CD 1F10                    TFR X,D         ; NLLE ADRESSE DE DEP APRES INSTRUC
     E7CF 17F92E                  LBSR R7SEG 
     E7D2 97FB                    STA <DISBUF+1
     E7D4 1F10                    TFR X,D
     E7D6 17F923                  LBSR L7SEG
     E7D9 97FA                    STA <DISBUF
     E7DB 1F98                    TFR B,A
     E7DD 17F920                  LBSR R7SEG
     E7E0 97FD                    STA <DISBUF+3
     E7E2 1F98                    TFR B,A
     E7E4 17F915                  LBSR L7SEG
     E7E7 97FC                    STA <DISBUF+2
     E7E9 39                      RTS

Branch Offset

branch offset

Flow diagram generic branch offset

branch offset

Exofst Organizational Chart

EXOSFT checks the branching instruction and then calculates the offset based on the desired destination address, which is entered by the user via the hex keyboard. The offset will only be placed in RAM (in the user program) if the checks it undergoes are positive.

     E705 17FA5B          EXOFST  LBSR INCREM
     E708 A684                    LDA ,X
     E70A 8116                    CMPA #$16       ; LBRA?
     E70C 2734                    BEQ EXLBIL      ; OUI, BRANCHEMENT LONG INCONDITIONNEL
     E70E 8117                    CMPA #$17       ; LBSR/
     E710 2730                    BEQ EXLBIL      ; OUI, //////////////////////////////
     E712 A682                    LDA ,-X         ; POINTER SUR INSTRUCTION PRECEDENTE
     E714 8110                    CMPA #$10       ; BRANCHEMENT CONDITIONNEL LONG?
     E716 2728                    BEQ EXLBCL      ; OUI
     E718 3003            OFPOCT  LEAX 3,X        ; X CONTIENT ADRESSE DU BRANCHEMENT COURT
     E71A 8D3B                    BSR CALOFS      ; CALCULER OFFSET
     E71C 2972                    BVS RETOU1      ; SI DEPASSEMENT DE CAPACITE, ERREUR
     E71E 95E9                    BITA <NEGPOS
     E720 2704                    BEQ BRANPO      ; TOUT MSB A 0 = BRANCH POS

85

     E722 2B09                    BMI BRANNE      ; MSBIT=1 BRANCH NEG
     E724 206A                    BRA RETOU1      ; BRANCH SUR 16 BITS
     E726 5D              BRANPO  TSTB
     E727 2767                    BEQ RETOU1      ; BRANCH NUL IMPOSSIBLE 
     E729 2B65                    BMI RETOU1      ; N=1, ERREUR BRANCH=16BITS
     E72B 200B                    BRA CHARGE      ; N=0, CHARGE OFFSET DS MEM PROG
     E72D 91E9            BRANNE  CMPA <NEGPOS    ; A=FF?
     E72F 265F                    BNE RETOU1      ; NON, ERREUR BRANCH SUR 16 BITS
     E731 5D                      TSTB            ; POSITIONNER N
     E732 2A5C                    BPL RETOU1      ; N=0, BRANCH SUR 16BITS
     E734 C1FF                    CMPB #$FF
     E736 2758                    BEQ RETOU1
     E738 E7A2            CHARGE  STB ,-Y         ; STOCKE OFFSET DS MEM PROG
     E73A 17008E                  LBSR AFFIAD     ; AFFICHE ADRESSE DE STOCKAGE
     E73D 16F9F0                  LBRA REMEMO     ; RETOUR DS FCT MEMOIRE
     E740 3001            EXLBCL  LEAX 1,X 
     E742 3003            EXLBIL  LEAX 3,X        ; BRANCH LONG, X=ADRESSE DE DEPART
     E744 8D11                    BSR CALOFS      ; CALCULE OFFSET
     E746 294C                    BVS RETOU2      ; SI DEPASSE CAPACITE, ERREUR
     E748 81FF                    CMPA #$FF
     E74A 2738                    BEQ PLUCOU      ; BRANCH COURT PEUT ETRE POSSIBLE
     E74C 8100                    CMPA #$00 
     E74E 273A                    BEQ BCOURT      ; BRANCH>0 COURT POSSIBLE
     E750 EDA3            SUITEB  STD ,--Y        ; STOCKE OFFSET DS MEM PROG
     E752 8D77                    BSR AFFIAD      ; AFFICHE ADRESSE
     E754 16F9D9                  LBRA REMEMO     ; RETOUR DS FCT MEMOIRE

86

Flowchart beginning EXPOCT

The first part of EXPOCT uses the keys [X], [Ofs] then [Inc] or [Dec]. This beginning of the program also checks the postbyte and fills the PLUSMS memory according to the desired direction of travel. The rest of the program is called AFIVAL.

The first part of EXPOCT controls the keys), (9), then O. This beginning of the program also checks the postbyte and fills the PLUSMS memory according to the desired direction of travel. The rest of the program is called AFIVAL.

Flowchart continued EXPOCT early AFIVAL The cascading call of the s/p GETKEY and CHTDON (initialization X = 1° disbuf Y = 06) allows you to enter 4 digits from the keyboard and classify them in Memo 07E5, 07E6 (see RSWI chapter). A new GETKEY/MSBDON call allows you to enter a 5th digit. These 5 digits are converted to hexa. The result is tested in order to measure the length of the offset (5, 8, 16 bits).


87

Loading of 07E5 07E6 Memories by MyM C + D, converted Hexa H H' H'‘ H’‘’ The call of GETKEY by AFIVAL (Ad ES3E1) allows the dz of thousands (My) to be entered by the keyboard (af key A when GETKEY returns). Initializing X Y (X=07FA Y =06) and calling CHTDON converts af to OH and , . enter the other three values M, C, D, convert them to hexa, display them { and store them in RAM (in 07ES5,E6).