aldweb

Fermer I. aldweb

Fermer II. Gratuitiels PC

Fermer III. Gratuitiels Palm

Fermer IV. Partagiciels Palm

Fermer V. iziBasic Palm

Fermer VI. Connaissance Palm

Fermer VII. Ordinateur Poche

Fermer VIII. miniPortail

Spécial !



Version mobile
de l'aldweb Site

m.aldweb.com


Ni Français, ni Anglais ?

Essayez donc l'un de ces drapeaux :
[de] [es] [it] [pt]
Recherche




Météo / Spam / www

Météo Lyon


aldweb contre le SPAM


Newsletter
Pour avoir des nouvelles de ce site, inscrivez-vous à notre Newsletter.
S'abonner
Se désabonner
298 Abonnés
Sites web de la famille

Webmaster - Infos
News Amis
Visites

   visiteurs

   visiteurs en ligne

Sondage
Comment trouve-tu le nouvel habillage de l'aldweb Site ?
 
Superbe !
Joli
Moyen
Moche...
Résultats
forum.gifForum - Pocket Computer - Sujet n°953

Forum - Forum
Pocket Computer - Pocket Computer


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257

actif  Sujet n° 953  assembler program

le 05/07/2004 @ 20:08
par jack

Anonyme



hello.
how can i convert the following program for PC 1261 in machine language (always for this computer) ?

10 print "give me a number"
20 input a
30 a=a+1
40 print "the next number is ";
50 print a


please help me with this problem !!!
thanks very much !
Ecrire à jack   Poster une réponse  Haut

[]   

DébutPrécédent [ 1 2 ] SuivantFin

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 1
--------
le 06/07/2004 @ 23:10
par aldweb

Anonyme

visiteur
The assembler of the Sharp PCs is a little bit tricky to use.

It is very efficient for all calculations, like your a=a+1 because the instructions used in this case are standard.

All input/print are more sophisticated to implement, because of hardware specificities (keyboard). Then, it is more interesting to hack the right ROM routines, but they are specific to each ROM, so to each device... and they were not documented by Sharp! (so it is a "find it by yourself" game...).

I do not know the PC-1261 internals, so I will be of little help to write your program. But does really such a program need to be written in assembler???

Greetz,
aldweb



@+
aldweb
Ecrire à aldweb   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 2
--------
le 07/07/2004 @ 18:27
par jack

Anonyme

visiteur
yes, i understand... the fact is that i'm thinking about building a pascal compiler for pc 1261, and i want that this compiler translates the pascal source onto a machine language program... don't think i'm crazy because of my idea, but i'd like to try...

for example the pascal statement

writeln('hello');

is translated in basic as

10 print "hello"

... but i need to make a translation in machine language...

Ecrire à jack   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 3
--------
le 10/07/2004 @ 00:00
par aldweb

Anonyme

visiteur
Hi jack,

Building a Pascal compiler for the Sharp PC family was long one of my dreams as Pascal is by far my favourite development language. Now, if you build it, this is excellent news

If you give a look to my LaFac project (in the Palm area) you will see that developing a compiler (which can read Basic, Pascal and C source codes) in Pascal is indeed something I worked on just a few weeks ago!

If I were you, I would not work at all on all the I/O aspects (keyboard input, screen display). I would focus on everything else and leave to Basic the management of these tasks.

The benefits that I see to this scope:
1. these things are really hard to manage in the Sharp PCs, except if you know where to hack in the ROM.
2. there is no need for speed with INPUT or PRINT, but there is for about all calculations and other routines
3. your Pascal compiler could be used on all Sharp PCs, not only the PC 1261
4. step by step is a good approach...

Then, you could plan to have some kind of stack area in the memory where Basic could push and pop the data it requires or should provide and let BASIC do some calls to the Pascal compiled code.

What do you think of that?

Greetz,
aldweb

@+
aldweb
Ecrire à aldweb   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 4
--------
le 18/07/2004 @ 16:53
par jack

Anonyme

visiteur
or, we can build a pascal to basic translator, in order to assure the complete compatibility with other sharp pc models...

for example, in the tape there's the text file:

program test;
begin
writeln('hello');
end.


after, this program is loaded into the sharp memory, and can be saved on tape as (in basic format) :

10 print "hello"

so, you can normally CLOAD the program and run it.

naturally i showed you the most simple example, but i think it is useful to explain how could it work.

what do you think ?
let me know!
Ecrire à jack   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 5
--------
le 18/07/2004 @ 21:17
par aldweb

Anonyme

visiteur
Sure you can build such a pascal to basic translator.
But then you will no more build a compiler but you will instead remain with the current basic interpreter at the end for your programs.
If it is funny for you to build such a translator, do it of course. Especially because no more than 10 people on earth would use your tool anyway!

I'd have more personal interest in a real compiler anyway, which would interact in a smart way with the current interpreter to keep the best compatibility among the different SC61860 equipped Sharp PC models.

Greetz,
aldweb

@+
aldweb
Ecrire à aldweb   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 6
--------
le 19/07/2004 @ 02:12
par jack

Anonyme

visiteur
however, if i build the real compiler, the result will appear as a mixture of peek, pokes and instructions like print and input (as i have written in the example below) , or in a different way ?
let me know, so i can decide what could be the best choice to develop...
<just an example!!!>
10 poke x,y : poke x1,y1
20 poke x,y : poke x1,y1
25 print a$­­
30 poke x,y : poke x1,y1
35 input b
40 poke x,y : poke x1,y1
50 call z ...

Ecrire à jack   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 7
--------
le 19/07/2004 @ 15:53
par aldweb

Anonyme

visiteur
Poking the assembler code with a Basic program is one of the ways to do it, rather use DATA/READ instructions in a FOR NEXT loop.

The other way, even smarter, is to make a CLOADM.

At this stage, you should start to work with my PockASM macro assembler tool, because you shall find many answers in it around this kind of topics

@+
aldweb
Ecrire à aldweb   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 8
--------
le 19/07/2004 @ 22:36
par edgar

Anonyme

visiteur
Hello jack!

I have not tried to convert the basic lines you wrote to machine language, but I did it with the following code:

10 A$­­=INKEY$­­;IF A$­­<>"" THEN PRINT A$­­;
20 GOTO 10

Currently I'm working on a collectiction of basic input/output functions for the PC1403(H), PC1350, PC1360, PC1262 and PC1402. It is a kind of a simple operating system and, for the PC1350, it is in alpha stage because there is a good emulator from lolo.

The basic code would look like this (assembled with asxxxx and linked with my i/o functions called "pshell"):

.area pshell (REL)

.include "pshell.h"

; --8x------------------------------------------------
; Start of input/output demo applikation
; ----------------------------------------------------
iod_st:
.dw iod_end-iod_st ; size of the programm
.if __PC_HAS_LOWERCASE_CHARS__
.ascii "I/O Demo" ; name of the programm
.else
.ascii "I/O DEMO" ; name of the programm
.endif
.db 0x00 ; end of string
.db 0x05 ; number of graphic
; icon bytes
.dw 0x5555 ; icon pattern
.dw 0x5555
.db 0x55

iod: CALL ps_getchar
CALL ps_putchar
JRM iod

iod_end:
.dw 0x0000 ; trailing 0 to indicate
; the end of the pshell
; program series; this
; may be overwritten by
; the next program in
; memory

If you are interested, I would make
the code of ps_getchar and ps_puchar public.

If you want to write a compiler, NEVER
start from scratch. Use an existing open
source compiler and write a backend for
the 61860 or use a compiler-compiler
tool like YACC. I think, pascal is a
nice language, but I would prefer to
have a C compiler, because there is
more software around to use with a C
compiler.

regards,

edgar
Ecrire à edgar   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 9
--------
le 29/07/2004 @ 17:12
par Pierre Brial

Anonyme

visiteur
Jack,
Programming in SC-61860 Machine Language is not that simple. For example, adding two 8 bit integers needs 15 ML instruction, and this without the input/output. So translating your small basic program need a fair amount of work.
I think you should first learn to program in Sharp ML. There is good examples within Aldweb's site. It will be slow at first, but after you build some basic bricks, it will be more and more easier.
A simple Pascal to basic translator will not be usefull at all, because if you know pascal it is very easy to learn Sharp's basic. But writing a desktop Pascal or C compiler for SC-61860 will be great.
Good luck !
Pierre
  Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 10
--------
le 24/08/2004 @ 00:31
par destroyedlolo

Anonyme

visiteur
Hi all,

I worked on the past to build a C compiler for PC-1350 : some stuffs are easy like reading a number or printing a character (I have most of ROM entries).

But I stop it because ... SC61860 is not designed for this king of work (no real stack manipulation, no easy way to save context, nothing about pointer manipulation...) so the code generated is fast compared to the BASIC but very very large. And as this wanderfull machine has only few KB, it's realy a wast of memory.
So I swithed back to ML.

Bye

Lolo
Ecrire à destroyedlolo   Poster une réponse  Haut
DébutPrécédent [ 1 2 ] SuivantFin
actif sujet actif   clos sujet clos   Important! Important!   Nouveau Nouveau message   -   Rectifier Rectifier message   Clôturer Clôturer sujet   Remonter Remonter
[]
Catégories de discussion  Forum 



 
^ Haut ^