易码技术论坛

 找回密码
 加入易码
搜索
查看: 468141|回复: 15

在TC800及相关机型上实现BASIC的设想和方法

[复制链接]
发表于 2005-8-18 12:11:00 | 显示全部楼层
晕,竟然是回复帖
发表于 2005-8-18 12:12:00 | 显示全部楼层
你搞那么神秘干吗?回个看看你有什么高招。
发表于 2005-8-18 12:14:00 | 显示全部楼层
汗,强烈建议斑竹编辑一下!
否则将有水灾了!!
[em06][em06][em06]
发表于 2005-8-18 13:49:00 | 显示全部楼层
用tc800来运行basic,估计不现实,没有任何和硬件的接口
发表于 2005-8-18 13:51:00 | 显示全部楼层
最多能实现BASIC ALL的程序,对POKE、CALL之类的,汗
发表于 2005-8-18 16:40:00 | 显示全部楼层
如果要能有BASICALL的也很可观了。
 楼主| 发表于 2005-8-26 14:55:00 | 显示全部楼层
我是菜鸟
何为BASICALL
发表于 2006-3-17 01:40:00 | 显示全部楼层
basic all是指一般有BASIC机型都能用的

不包括PEEK POKE CALL
发表于 2006-4-10 13:27:00 | 显示全部楼层
理论上不难 唉 可是..
发表于 2006-4-10 13:51:00 | 显示全部楼层
可是什么?

我的解释器已经做了一半多了。

还有,如果没有peek()和call还有poke的话应该是全支持啊。
[em05]

13780_36974_5656.rar

11 KB, 下载次数: 1616

13780_36974_5723.rar

6 KB, 下载次数: 1707

发表于 2006-4-12 12:58:00 | 显示全部楼层
楼上的已经做了一半多了?强啊!强烈支持!期待软件发布..........
发表于 2006-4-12 14:19:00 | 显示全部楼层
厉害厉害,真的能在LAVA上实现BASIC那真是星迷的福气呀!
发表于 2006-4-16 14:14:00 | 显示全部楼层
以下是引用gameghost在2006-4-10 13:51:00的发言:[BR]可是什么?

我的解释器已经做了一半多了。

还有,如果没有peek()和call还有poke的话应该是全支持啊。
[em05]


加油啊
发表于 2006-4-30 17:27:00 | 显示全部楼层
对啊,加油~TC800就靠你们这2个仙了~
发表于 2006-5-20 14:00:00 | 显示全部楼层
我是个tc800的新用户,强烈支持,不过我想问一下basic又那么好吗
 楼主| 发表于 2005-8-18 11:44:06 | 显示全部楼层 |阅读模式

  星迷大家好,这是本人第二次发贴,以下文字如有不委之处,还望各位多多指证,多多海涵!
    大家都知道TC800的硬件是“牛B插针:真牛B”可是据我所知(本人孤陋寡闻)目前还不能在其上BASIC,所以贴上此贴,希望对大家有所帮助,在此对由于各位星迷看此贴而浪费时间,说声“对不起了”。
   以下贴上源码用C写的不是LAVA:我自己也看不懂,不知道是不是BASIC源码了!(对步步高和名人也所帮吧)
以下文章来自网上,由 University of Washington 提供!大家可是自由修改!当然源码本是在电脑上用的,所以有MOUSE支持,可以去掉。具体的LAVA代码,还请自己修改
static char rcsid[] = "$Id: basic.c,v 1.3 2005/08/16 01:48:04 bbraun Exp $";
#endif
#include        <stdio.h>
#include        "estruct.h"
#include        "edef.h"
#include        "pico.h"
#include        "efunc.h"

#ifdef ANSI
    int getgoal(struct LINE *);
#else
    int getgoal();
#endif

/*
* Move the cursor to the
* beginning of the current line.
* Trivial.
*/
gotobol(f, n)
int f, n;
{
    curwp->w_doto  = 0;
    return (TRUE);
}
/*
* Move the cursor backwards by "n" characters. If "n" is less than zero call
* "forwchar" to actually do the move. Otherwise compute the new cursor
* location. Error if you try and move out of the buffer. Set the flag if the
* line pointer for dot changes.
*/
backchar(f, n)
int             f;
register int    n;
{
    register LINE   *lp;
    if (n < 0)
      return (forwchar(f, -n));
    while (n--) {
if (curwp->w_doto == 0) {
     if ((lp=lback(curwp->w_dotp)) == curbp->b_linep){
  if(Pmaster)
      /*
       * go up into editing the mail header if on
       * the top line and the user hits the left arrow!!!
       *
       * if the editor returns anything except -1, the
       * user requested something special, so let
       * pico know...
       */
    return((HeaderEditor(2, 1) == -2) ? forwpage(0, 1) : FALSE);
  else
    return (FALSE);
     }
     curwp->w_dotp  = lp;
     curwp->w_doto  = llength(lp);
     curwp->w_flag |= WFMOVE;
} else
   curwp->w_doto--;
    }
    return (TRUE);
}

/*
* Move the cursor to the end of the current line. Trivial. No errors.
*/
gotoeol(f, n)
int f, n;
{
    curwp->w_doto  = llength(curwp->w_dotp);
    return (TRUE);
}

/*
* Move the cursor forwwards by "n" characters. If "n" is less than zero call
* "backchar" to actually do the move. Otherwise compute the new cursor
* location, and move ".". Error if you try and move off the end of the
* buffer. Set the flag if the line pointer for dot changes.
*/
forwchar(f, n)
int             f;
register int    n;
{
    if (n < 0)
      return (backchar(f, -n));
    while (n--) {
if (curwp->w_doto == llength(curwp->w_dotp)) {
     if (curwp->w_dotp == curbp->b_linep)
       return (FALSE);
     curwp->w_dotp  = lforw(curwp->w_dotp);
     curwp->w_doto  = 0;
     curwp->w_flag |= WFMOVE;
}
else
   curwp->w_doto++;
    }
   
    return (TRUE);
}

/*
* move to a particular line.
* argument (n) must be a positive integer for
* this to actually do anything
*/
gotoline(f, n)
int f, n;
{
    if (n < 1)  /* if a bogus argument...then leave */
      return(FALSE);
    /* first, we go to the start of the buffer */
    curwp->w_dotp  = lforw(curbp->b_linep);
    curwp->w_doto  = 0;
    return(forwline(f, n-1));
}

/*
* Goto the beginning of the buffer. Massive adjustment of dot. This is
* considered to be hard motion; it really isn't if the original value of dot
* is the same as the new value of dot. Normally bound to "M-<".
*/
gotobob(f, n)
int f, n;
{
    curwp->w_dotp  = lforw(curbp->b_linep);
    curwp->w_doto  = 0;
    curwp->w_flag |= WFHARD;
    return (TRUE);
}

/*
* Move to the end of the buffer. Dot is always put at the end of the file
* (ZJ). The standard screen code does most of the hard parts of update.
* Bound to "M->".
*/
gotoeob(f, n)
int f, n;
{
    curwp->w_dotp  = curbp->b_linep;
    curwp->w_doto  = 0;
    curwp->w_flag |= WFHARD;
    return (TRUE);
}

/*
* Move forward by full lines. If the number of lines to move is less than
* zero, call the backward line function to actually do it. The last command
* controls how the goal column is set. Bound to "C-N". No errors are
* possible.
*/
forwline(f, n)
int f, n;
{
    register LINE   *dlp;
    if (n < 0)
      return (backline(f, -n));
    if ((lastflag&CFCPCN) == 0)             /* Reset goal if last   */
      curgoal = getccol(FALSE);       /* not C-P or C-N       */
    thisflag |= CFCPCN;
    dlp = curwp->w_dotp;
    while (n-- && dlp!=curbp->b_linep)
      dlp = lforw(dlp);
    curwp->w_dotp  = dlp;
    curwp->w_doto  = getgoal(dlp);
    curwp->w_flag |= WFMOVE;
    return (TRUE);
}

/*
* This function is like "forwline", but goes backwards. The scheme is exactly
* the same. Check for arguments that are less than zero and call your
* alternate. Figure out the new line and call "movedot" to perform the
* motion. No errors are possible. Bound to "C-P".
*/
backline(f, n)
int f, n;
{
    register LINE   *dlp;
    register int    status = 0;
    if (n < 0)
      return (forwline(f, -n));
    if(Pmaster){
/*
  * go up into editing the mail header if on the top line
  * and the user hits the up arrow!!!
  */
if (lback(curwp->w_dotp) == curbp->b_linep)
   /*
    * if the editor returns anything except -1 then the user
    * has requested something special, so let pico know...
    */
   status = HeaderEditor(1, 1);
    }
    if ((lastflag&CFCPCN) == 0)             /* Reset goal if the    */
      curgoal = getccol(FALSE);       /* last isn't C-P, C-N  */
    thisflag |= CFCPCN;
    dlp = curwp->w_dotp;
    while (n-- && lback(dlp)!=curbp->b_linep)
      dlp = lback(dlp);
    curwp->w_dotp  = dlp;
    curwp->w_doto  = getgoal(dlp);
    curwp->w_flag |= WFMOVE;
    return (TRUE);
}

/*
* go back to the begining of the current paragraph
* here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE>
* combination to delimit the begining of a paragraph
*/
gotobop(f, n)
int f, n; /* default Flag & Numeric argument */
{
    if (n < 0) /* the other way...*/
      return(gotoeop(f, -n));
    while (n-- > 0) { /* for each one asked for */
/* first scan back until we are in a word */
while(!inword())
   if(lback(curwp->w_dotp) == curbp->b_linep
      && curwp->w_doto == 0)
     /* top line and nowhere else to go */
     return(FALSE);
   else if(backchar(FALSE, 1) == FALSE)
     break;
curwp->w_doto = 0; /* and go to the B-O-Line */
/* and scan back until we hit a <NL><NL> or <NL><TAB>
    or a <NL><SPACE>     */
while (lback(curwp->w_dotp) != curbp->b_linep)
   if (llength(curwp->w_dotp) != 0 &&
       lgetc(curwp->w_dotp, curwp->w_doto).c != TAB &&
       lgetc(curwp->w_dotp, curwp->w_doto).c != ' ')
     curwp->w_dotp = lback(curwp->w_dotp);
   else
     break;
/* and then forward until we are in a word */
while(!inword())
   if(forwchar(FALSE,1) == FALSE)
     break;
    }
    curwp->w_flag |= WFMOVE; /* force screen update */
}

/*
* go forword to the end of the current paragraph
* here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE>
* combination to delimit the begining of a paragraph
*/
gotoeop(f, n)
int f, n; /* default Flag & Numeric argument */
{
    register int suc; /* success of last backchar */
    if (n < 0) /* the other way...*/
      return(gotobop(f, -n));
    while (n-- > 0) { /* for each one asked for */

/* first scan forward until we are in a word */
if(curwp->w_dotp != curbp->b_linep){
     curwp->w_doto = 0;  /* go to the B-O-Line */
     curwp->w_dotp = lforw(curwp->w_dotp);
}
/* and scan forword until we hit a <NL><NL> or <NL><TAB>
    or a <NL><SPACE>     */
while (curwp->w_dotp != curbp->b_linep) {
     if (llength(curwp->w_dotp) != 0 &&
  lgetc(curwp->w_dotp, curwp->w_doto).c != TAB &&
  lgetc(curwp->w_dotp, curwp->w_doto).c != ' ')
       curwp->w_dotp = lforw(curwp->w_dotp);
     else
       break;
}

/* and then backward until we are in a word */
suc = TRUE;
while (suc && !inword()) {
     if(lback(curwp->w_dotp) == curbp->b_linep
        && curwp->w_doto == 0)
       break;
     suc = backchar(FALSE, 1);
}
curwp->w_doto = llength(curwp->w_dotp); /* and to the EOL */
    }
    curwp->w_flag |= WFMOVE; /* force screen update */
    return(TRUE);
}
/*
* This routine, given a pointer to a LINE, and the current cursor goal
* column, return the best choice for the offset. The offset is returned.
* Used by "C-N" and "C-P".
*/
getgoal(dlp)
register LINE   *dlp;
{
    register int    c;
    register int    col;
    register int    newcol;
    register int    dbo;
    col = 0;
    dbo = 0;
    while (dbo != llength(dlp)) {
c = lgetc(dlp, dbo).c;
newcol = col;
if (c == '\t')
   newcol |= 0x07;
else if (c<0x20 || c==0x7F)
   ++newcol;
++newcol;
if (newcol > curgoal)
   break;
col = newcol;
++dbo;
    }
    return (dbo);
}
/*
* Scroll forward by a specified number of lines, or by a full page if no
* argument. Bound to "C-V". The "2" in the arithmetic on the window size is
* the overlap; this value is the default overlap value in ITS EMACS. Because
* this zaps the top line in the display window, we have to do a hard update.
*/
forwpage(f, n)
int             f;
register int    n;
{
    register LINE   *lp;
    register int    nl;
    if (f == FALSE) {
n = curwp->w_ntrows - 2;        /* Default scroll.      */
if (n <= 0)                     /* Forget the overlap   */
   n = 1;                  /* if tiny window.      */
    } else if (n < 0)
      return (backpage(f, -n));
#if     CVMVAS
    else                                    /* Convert from pages   */
      n *= curwp->w_ntrows;           /* to lines.            */
#endif
    nl = n;
    lp = curwp->w_linep;
    while (n-- && lp!=curbp->b_linep)
      lp = lforw(lp);
    curwp->w_dotp  = lp;
    curwp->w_doto  = 0;
    curwp->w_flag |= WFHARD;
    if(lp == curbp->b_linep)
      return(TRUE);
    else
      curwp->w_linep = lp;
    /*
     * if the header is open, close it ...
     */
    if(Pmaster && ComposerTopLine != COMPOSER_TOP_LINE){
n -= ComposerTopLine - COMPOSER_TOP_LINE;
ToggleHeader(0);
    }
    /*
     * scroll down from the top the same number of lines we've moved
     * forward
     */
    if(optimize)
      scrollup(curwp, -1, nl-n-1);
    return (TRUE);
}

/*
* This command is like "forwpage", but it goes backwards. The "2", like
* above, is the overlap between the two windows. The value is from the ITS
* EMACS manual. Bound to "M-V". We do a hard update for exactly the same
* reason.
*/
backpage(f, n)
int             f;
register int    n;
{
    register LINE   *lp;
    register int    nl;
    int             status = 0;
    if (f == FALSE) {
n = curwp->w_ntrows - 2;        /* Default scroll.      */
if (n <= 0)                     /* Don't blow up if the */
   n = 1;                  /* window is tiny.      */
    } else if (n < 0)
      return (forwpage(f, -n));
#if     CVMVAS
    else                                    /* Convert from pages   */
      n *= curwp->w_ntrows;           /* to lines.            */
#endif
    if(Pmaster){
/*
  * go up into editing the mail header if on the top line
  * and the user hits the up arrow!!!
  */
if (lback(curwp->w_dotp) == curbp->b_linep){
     /*
      * if the editor returns anything except -1 then the user
      * has requested something special, so let pico know...
      */
     status = HeaderEditor(1, 1);
}
    }
    nl = n;
    lp = curwp->w_linep;
    while (n-- && lback(lp)!=curbp->b_linep)
      lp = lback(lp);
    curwp->w_linep = lp;
    curwp->w_dotp  = lp;
    curwp->w_doto  = 0;
    curwp->w_flag |= WFHARD;
/*
  * scroll down from the top the same number of lines we've moved
  * forward
  *
  * This isn't too cool, but it has to be this way so we can
  * gracefully scroll in the message header
  */
    if(Pmaster){
if((lback(lp)==curbp->b_linep) && (ComposerTopLine==COMPOSER_TOP_LINE))
   n -= entry_line(1000, TRUE); /* never more than 1000 headers */
if(nl-n-1 < curwp->w_ntrows)
   if(optimize)
     scrolldown(curwp, -1, nl-n-1);
    }
    else
      if(optimize)
scrolldown(curwp, -1, nl-n-1);
    if(Pmaster){
/*
  * if we're at the top of the page, and the header is closed,
  * open it ...
  */
if((lback(lp) == curbp->b_linep)
    && (ComposerTopLine == COMPOSER_TOP_LINE)){
     ToggleHeader(1);
     movecursor(ComposerTopLine, 0);
}
    }
    return (TRUE);
}

/*
* Set the mark in the current window to the value of "." in the window. No
* errors are possible. Bound to "M-.".  If told to set an already set mark
* unset it.
*/
setmark(f, n)
int f, n;
{
    if(!curwp->w_markp){
        curwp->w_markp = curwp->w_dotp;
        curwp->w_marko = curwp->w_doto;
emlwrite("Mark Set", NULL);
    }
    else{
/* clear inverse chars between here and dot */
markregion(0);
curwp->w_markp = NULL;
emlwrite("Mark UNset", NULL);
    }
#ifdef _WINDOWS
    mswin_allowcopycut(curwp->w_markp ? kremove : NULL);
#endif
    return (TRUE);
}

/*
* Swap the values of "." and "mark" in the current window. This is pretty
* easy, bacause all of the hard work gets done by the standard routine
* that moves the mark about. The only possible error is "no mark". Bound to
* "C-X C-X".
*/
swapmark(f, n)
int f, n;
{
    register LINE   *odotp;
    register int    odoto;
    if (curwp->w_markp == NULL) {
if(Pmaster == NULL)
   emlwrite("No mark in this window", NULL);
return (FALSE);
    }
    odotp = curwp->w_dotp;
    odoto = curwp->w_doto;
    curwp->w_dotp  = curwp->w_markp;
    curwp->w_doto  = curwp->w_marko;
    curwp->w_markp = odotp;
    curwp->w_marko = odoto;
    curwp->w_flag |= WFMOVE;
    return (TRUE);
}

/*
* Set the mark in the current window to the value of "." in the window. No
* errors are possible. Bound to "M-.".  If told to set an already set mark
* unset it.
*/
setimark(f, n)
int f, n;
{
    curwp->w_imarkp = curwp->w_dotp;
    curwp->w_imarko = curwp->w_doto;
    return(TRUE);
}

/*
* Swap the values of "." and "mark" in the current window. This is pretty
* easy, bacause all of the hard work gets done by the standard routine
* that moves the mark about. The only possible error is "no mark". Bound to
* "C-X C-X".
*/
swapimark(f, n)
int f, n;
{
    register LINE   *odotp;
    register int    odoto;
    if (curwp->w_imarkp == NULL) {
if(Pmaster == NULL)
   emlwrite("Programmer botch! No mark in this window", NULL);
return (FALSE);
    }
    odotp = curwp->w_dotp;
    odoto = curwp->w_doto;
    curwp->w_dotp  = curwp->w_imarkp;
    curwp->w_doto  = curwp->w_imarko;
    curwp->w_imarkp = odotp;
    curwp->w_imarko = odoto;
    curwp->w_flag |= WFMOVE;
    return (TRUE);
}
   

[em04][upload=rar]viewFile.asp?ID=3946[/upload]
jason:请不要发此类要求回复的帖子以免引起灌水!谢谢合作!!!

您需要登录后才可以回帖 登录 | 加入易码

本版积分规则

Archiver|手机版|小黑屋|EMAX Studio

GMT+8, 2025-8-24 12:39 , Processed in 0.015436 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表