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

Special !



Mobile version of
the aldweb Site

m.aldweb.com


Neither French, nor English?

Try one of these flags then:
[de] [es] [it] [pt]
Search




Weather / Spam / www

Lyon Weather


aldweb against spam


Newsletter
To receive news about this website, consider subscribing to our Newsletter.
Subscribe
Unsubscribe
298 Subscribers
Family's web sites

Webmaster - Infos
Friends News
Visits

   visitors

   visitors online

Poll
What do you think of the new design of the aldweb Site?
 
Great !
Beautiful
Average
So ugly...
Results
forum.gifForum - Pocket Computer - Topic #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

active  Topic # 953  assembler program

05/07/2004 @ 20:08
by jack

Anonymous



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 !
Write to jack   Post an answer  Top

[]   

StartPrevious [ 1 2 ] NextEnd

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

Anonymous

visitor
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
Write to aldweb   Post an answer  Top

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

Anonymous

visitor
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...

Write to jack   Post an answer  Top

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

Anonymous

visitor
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
Write to aldweb   Post an answer  Top

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

Anonymous

visitor
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!
Write to jack   Post an answer  Top

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

Anonymous

visitor
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
Write to aldweb   Post an answer  Top

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

Anonymous

visitor
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 ...

Write to jack   Post an answer  Top

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

Anonymous

visitor
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
Write to aldweb   Post an answer  Top

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

Anonymous

visitor
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
Write to edgar   Post an answer  Top

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

Anonymous

visitor
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
  Post an answer  Top

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

Anonymous

visitor
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
Write to destroyedlolo   Post an answer  Top
StartPrevious [ 1 2 ] NextEnd
active topic active   closed topic closed   Sticky Sticky   New New message   -   Correct Correct message   Close Close topic   Make sticky Make sticky
[]
Forum Topic  Forum 



 
^ Top ^