Exemple : un environnement de programmation assembleur
Définissons notre environnement de travail :
- un menu permettant d'éditer, d'assembler et d'exécuter notre programme.
- Un menu gérant les options.
Nous allons commencer à rédiger notre fichier DEFAULT.DSK.
La section AUTO contient les actions à effectuer au lancement (ici, fixer la langue à ENGLISH=1, charger nos options dans les variables 6 à 9 et afficher
la boîte standard d'info de ProgDesk).
Le premier titre du menu, ASSEMBLY, ne contient qu'un item, About... Celui-ci affiche une boîte d'alerte selon la langue (variable spéciale %:)
|
>AUTO
.language 1
.load %6789,C:\ASM\ASM.OPT
.copyright
*ASSEMBLY
@About...
.goto %:
.label 0
.alert [1][ Bureau Assembleur | Demo Progdesk | 2018 Guillaume Tello ][ Confirme ]
.stop
.label 1
.alert [1][ ASM desktop | Progdesk Demo | 2018 Guillaume Tello ][ Confirm ]
 |
Example: a desktop for assembly programming
Let's define our envirnoment:
- A menu to edit, assemble and execute our program.
- A menu to manage the options.
We start writing our file DEFAULT.DSK.
The AUTO section sets the actions to be performed at start (here, set language to ENGLISH=1, load options into variables 6 to 9 and display the standard
copyright box of ProgDesk).
The first menu title, ASSEMBLY, contains only one item, About... This last displays an alert according to the current language (special variable %:) |
Le menu FILE
Son premier item, Select Source, permet de fixer le chemin et le nom du fichier de travail.
L'instuction select ouvre le sélecteur de fichier et elle renvoie:
- Variable %0 : le chemin, ici C:\ASM, qui sera stocké dans la variable %7
- Variable %1 : le fichier dont on coupe l'extention avec cutext et stocké dans la variable %8, ici HELLO
- Variable %2 : le chemin+fichier, dont on coupe l'extension, et stocké dans la variable %9, ici C:\ASM\HELLO
L'instruction input qui permet la saisie d'un texte, ici on entre une description sur 30 caractères et rangée dans la variable %6.
|
*File
@Select Source
.select \*.S,,Pick up source file
; stores path, file, and path+file cutting extension
.%7=%0
.cutext %1
.%8=%1
.cutext %2
.%9=%2
.input %6,30,Enter short description


 |
The FILE menu
The first item, Select Source, sets the path and name to the source file we will work on.
The instuction select opens the fileselector and returns:
- Variable %0 : the path, here C:\ASM, stored into variable %7
- Variable %1 : the file that, using cutext to remove the extension, is stored into variable %8, here HELLO
- Variable %2 : the path+file, with no extension, and stored into variable %9, here C:\ASM\HELLO
The instruction input opens a simple editing field of 30 characters for a short description stored into variable %6.
|
Edition
L'item Edit Source effectue deux actions :
- fixe le chemin courant à C:\QED pour mon éditeur
- Lance l'éditeur avec comme paramètre le chemin complet à mon fichier, doté de l'extension ".S", donc C:\ASM\HELLO.S
La ligne suivante, débutant par @@, est un séparateur en gris.
|
@Edit Source
.setpath C:\QED
.exec QED.APP %9.S
@@-------------
 |
Editing
The item Edit Source performs two actions :
- set the current path to C:\QED for my favorite editor
- Launch QED.APP with one parameter, the full pathname to my source file with extension ".S", here C:\ASM\HELLO.S
The next line, starting with @@, is a grey separator.
|
Assembler
L'item Assemble lance mon assembleur avec l'instruction tos, car ce n'est pas un programme GEM.
On lui fournit en paramètre le chemin d'accès complet au source.
Ensuite, une touche est attendue avec pause et le bureau redessiné avec redraw.
|
@Assemble
.tos F:\ASSEMBLE\ASM.TTP %9.S
.pause
.redraw
 |
Assembling
The item Assemble runs my assembler with the instruction tos, because it's not a GEM program.
It receives as a parameter the whole path to the source file.
Then, is waits for a key press with pause and the desktop is redrawn with redraw.
|
Exécution
L'item Execute ST RAM effectue les actions suivantes:
- fixe les flags de C:\ASM\HELLO.PRG à 0 (pas de fast load, ni de TT Ram)
- démarre le chronomètre
- exécute mon programme C:\ASM\HELLO.PRG
- récupère le temps écoulé et le formate dans la variable %3
- affiche le temps d'exécution dans une alerte
- redessine l'écran
L'item Execute TT RAM fait de même mais avec les flags à 7 (fast load et TT Ram)
La différence de temps est plus liée au Fast Load car l'effacement de 74Mo de RAM est lent! |
@Execute ST RAM
.setflags %9.PRG 0
.starttimer
.exec %9.PRG
.gettimer %3
.alert [2][ Time %3 ][ Ok ]
.redraw
@Execute TT RAM
.setflags %9.PRG 7
.starttimer
.exec %9.PRG
.gettimer %3
.alert [2][ Time %3 ][ Ok ]
.redraw
@@-------------
 |
Running
The item Execute ST RAM performs the following actions:
- set the flags of C:\ASM\HELLO.PRG to 0 (no fast load, no TT Ram)
- starts the chronometer
- execute my program C:\ASM\HELLO.PRG
- gets the running time and formats it into variable %3
- display the time into an alert box
- redraw the screen
The item Execute TT RAM does the same but with flags set to 7 (fast load and TT Ram)
The time difference is mosty due to the Fast Load bit because erasing 74MB takes some time! |
Quitter
L'item Quit affiche une confirmation selon la langue (0=Français, 1=English).
L'alerte renvoie dans la variable %0 les valeurs 1, 2 ou 3 selon le bouton cliqué.
De ce fait goto 1%0 deviendra goto 11, goto 12 ou goto 13 ce qui justifie les trois labels utilisés.
- Label 11: correspond à Yes, on quitte avec l'instruction end
- Label 12: correspond à Save, on save nos quatre variables dans ASM.OPT avant de quitter
- Label 13: correspond à No, ne fait rien.
|
@Quit
.goto %:
.label 0
.alert [2][ Vraiment quitter ? ][ Oui |Sauver| Non ]
.goto 1%0
.label 1
.alert [2][ Really quit ? ][ Yes | Save | No ]
.goto 1%0
.label 11
.end
.label 12
.save %6789,C:\ASM\ASM.OPT
.end
.label 13
 |
Quiting
The item Quit opens a box to confirm your choice according to the language (0=Français, 1=English).
The alert returns into variable %0 a value 1, 2 or 3 according to the selected button.
So, goto 1%0 will be goto 11, goto 12 or goto 13, this justifies the three labels used.
- Label 11: for answer Yes, quit using the instruction end
- Label 12: for answer Save, save the four variables into ASM.OPT and then quit
- Label 13: for answer No, does nothing.
|
Le menu OPTIONS
L'item Load... vous demande de confirmer le chargement des options, car cela efface les réglages courants.
La variable %0 contient 2 si on répond No. Dans ce cas, on saute au label 1 sans rien faire.
Sinon, les options sont chargées dans
les variables %6 à %9 (les chemins, le fichier, la description).
L'item Save... fonctionne de la même manière. |
*Options
@Load...
.alert [2][ Overwrite current settings? ][ Yes | No ]
.if (%0)=(2) 1
.load %6789,C:\ASM\ASM.OPT
.label 1
@Save...
.alert [2][ Overwrite ASM.OPT ? ][ Yes | No ]
.if (%0)=(2) 1
.save %6789,C:\ASM\ASM.OPT
.label 1

 |
The OPTIONS menu
The item Load... waits for you to confirm to load options, because this overwrites the current settings.
The variable %0 contains 2 when the answer is No. In this case, there's a jump to label 1, and ProgDesk does nothing..
Else, options are loaded into variables %6 to %9 (path, file and description).
The item Save... works the same.
|
Informations
L'item Informations vous rappelle dans une alerte le nom du fichier courant stocké en variable %8.
Puis il vous en rappelle la description que vous pouvez d'ailleurs modifier. |
@Informations...
.alert [1][ Current file is | %8 ][ Next ]
.input %6,30,Description

 |
Informations
The item Informations recalls, into an alert box, the current file name stored into variable %8.
Then, it recalls the description that you can modify.
|
Utilisation de plusieurs menus!
Le menuu Play ! contient un seul item Enterntainment qui ouvrira un nouveau bureau PLAY.DSK.
On peut ainsi utiliser une infinité de menus reliés les uns aux autres. |
*Play !
@Entertainment
.menu C:\ASM\PLAY.DSK
 |
More than one menu!
The menu Play ! contains a single item Entertainment that opens another desktop PLAY.DSK.
You can have an infinite number of menus linked the ones to the others.
|
Le second menu
La section LINK
Le second menu nous accueille avec un petit message de bienvenue.
Avant la définition du menu lui-même, il contient une section LINK. Elle associe une série d'extensions de fichiers
à l'exécution d'un bloc de programme.
Ici les fichiers MOV, AVI et autres vidéos lanceront l'exécution de M_PLAYER avec la
vidéo en paramètre. Le paramètre -d indique à M_PLAYER de ne pas afficher ses dialogues.
|
>AUTO
.alert [2][Need a little break ?][Yes!]
@MOV,AVI,FL?,GIF,MPG
.setpath F:\ANIM\0PLAYER
.exec M_PLAYER.PRG -d %0
 |
The second menu
The LINK section
The second menu starts with a welcome message.
Before the definition of the menu, this file contains a LINK section. It associates a serie of file extensions with the execution
of a progam block.
Here, the files with MOV, AVI and other videos will run M_PLAYER with the video as parameter.
The parameter -d tells M_PLAYER to skip its dialog boxes.
|
Une vidéo
Le menu contient toujours le premier titre Play ! avec un seul item de copyright.
Le second titre File contient trois entrées.
L'item Play a video ouvre un sélecteur de fichiers pour choisir une vidéo qui est exécutée. Si l'extention est correcte, cela lancera M_PLAYER.
L'item Play Tetris lance le programme TETRIS.
Vous pouvez voir l'affichage d'une vidéo MPG lancée grâce à la section Link.
|
*Play !
@About...
.copyright
*File
@Play a video
.select \*.*,,Select a video
.exec %2
@Play Tetris
.setpath F:\TETRIS
.exec TETRIS.PRG
<
 |
A video
The menu, as usual, contains a first title Play ! with one only item of copyright.
The second title File contains three items.
The item Play a video opens the fileselector to pick up a video that is executed. If the extension is correct, this will run M_PLAYER.
The item Play Tetris runs the program TETRIS.
You can see a MPG video played thanks to the link section.
|
Retour au premier menu
L'item Back to work permet un retour au menu DEFAULT.DSK.
Le signe * devant le chemin de fichier demande de ne pas éxécuter la section AUTO, elle ne sera donc faite qu'une seule fois
au lancement de ProgDesk.
|
@@------------
@Back to work
.menu *C:\ASM\DEFAULT.DSK
|
Back to the first menu
The item Back to work allows you to return to the previous menu DEFAULT.DSK.
The sign * before the pathname tells to skip the AUTO section, so this last will be executed only once when ProgDesk is run.
|
Le fichier/File DEFAULT.DSK
>AUTO
.language 1
.load %6789,C:\ASM\ASM.OPT
.copyright
*ASSEMBLY
@About...
.goto %:
.label 0
.alert [1][ Bureau Assembleur | Demo Progdesk | 2018 Guillaume Tello ][ Confirme ]
.stop
.label 1
.alert [1][ ASM desktop | Progdesk Demo | 2018 Guillaume Tello ][ Confirm ]
*File
@Select Source
.select \*.S,,Pick up source file
; stores path, file, and path+file cutting extension
.%7=%0
.cutext %1
.%8=%1
.cutext %2
.%9=%2
.input %6,30,Enter short description
@Edit Source
.setpath C:\QED
.exec QED.APP %9.S
@@-------------
@Assemble
.tos F:\ASSEMBLE\ASM.TTP %9.S
.pause
.redraw
@Execute ST RAM
.setflags %9.PRG 0
.starttimer
.exec %9.PRG
.gettimer %3
.alert [2][ Time %3 ][ Ok ]
.redraw
@Execute TT RAM
.setflags %9.PRG 7
.starttimer
.exec %9.PRG
.gettimer %3
.alert [2][ Time %3 ][ Ok ]
.redraw
@@-------------
@Quit
.goto %:
.label 0
.alert [2][ Vraiment quitter ? ][ Oui |Sauver| Non ]
.goto 1%0
.label 1
.alert [2][ Really quit ? ][ Yes | Save | No ]
.goto 1%0
.label 11
.end
.label 12
.save %6789,asm.opt
.end
.label 13
*Options
@Load...
.alert [2][ Overwrite current settings? ][ Yes | No ]
.if (%0)=(2) 1
.load %6789,C:\ASM\ASM.OPT
.label 1
@Save...
.alert [2][ Overwrite ASM.OPT ? ][ Yes | No ]
.if (%0)=(2) 1
.save %6789,C:\ASM\ASM.OPT
.label 1
@Informations...
.alert [1][ Current file is | %8 ][ Next ]
.input %6,30,Description
*Play !
@Entertainment
.menu C:\ASM\PLAY.DSK
|
|
Le fichier/File PLAY.DSK
>AUTO
.alert [2][Need a little break ?][Yes!]
@MOV,AVI,FL?,GIF,MPG
.setpath F:\ANIM\0PLAYER
.exec M_PLAYER.PRG -d %0
*Play !
@About...
.copyright
*File
@Play a video
.select \*.*,,Select a video
.exec %2
@Play Tetris
.setpath F:\TETRIS
.exec TETRIS.PRG
@@------------
@Back to work
.menu *C:\ASM\DEFAULT.DSK
Download all the files in progdesk.zip
- The assembly source file PROGDESK.S
- The executable PROGDESK.PRG
- Documentations in french and english
- Files DEFAULT.DSK and PLAY.DSK
- The HELLO WORLD program as an example.
- The history file of PROGDESK
|