[A83] Re: Ambivalent Ion programs [83/83+] ADDED in P.P.S., Ambivalent


[Prev][Next][Index][Thread]

[A83] Re: Ambivalent Ion programs [83/83+] ADDED in P.P.S., Ambivalent Miragos Programs




There's a few problems with your suggested schem.  First of all, your code
to detect whether TIOS or Ion ran the program will not work.  When the
program is run from Ion, even though the xor a is skipped, A is still zero.
Before running programs, Ion executes an xor a so that the carry flag will
be reset and the no-carry jump will be taken.  So that wont work.

On the subject of MirageOS programs, I'm not going to change the format at
this point to support not-running them from TIOS.  I mean, if you could
actually run them from TIOS, that would be one thing (though obviously
impossible because of all the library routines).  But to waste the space in
every program just to tell you that you can't run it from TIOS anyhow seems
an incredibly silly thing to do.  If the program doesn't start, you can't
run it, end of story.  The code you propose for MirageOS adds approx.
another 80 bytes to each program.  If you have 30 programs, you've just
spend about 2.5K just to display a little message that you can't run the
program from TIOS, which would have been obvious to anyone who tried to.

Sorry to be so negative, bad pizza,
-Dan Englender


----- Original Message -----
From: "Hyperbyte" <central@hyperfield.com>
To: <assembly-83@lists.ticalc.org>
Sent: Sunday, March 18, 2001 9:50 AM
Subject: [A83] Re: Ambivalent Ion programs [83/83+] ADDED in P.P.S.,
Ambivalent Miragos Programs


>
> Summarized:
>
> when you start from TIOS (83+)/ZASMLOAD(83) it executes the xor a, which
> zeroes
> register a and sets the zero flag.
> when you start from ion, this part is skipped, so the a register has some
> value.
> subsequently, register a will be zero when you run it from TIOS/ZASMLOAD,
so
> you can
> check for that to see if it is executed from ion or not.
>
> A nice feature would then be a template for these programs :
>
>
> .nolist
> #include "ion.inc"
> .list.
>  #ifdef TI83P
>        .org progstart-2     ;// add Special bytes, so you can do
> asm(prgmPROGNAME)
>        .db $BB,$6D          ;// on the 83+
>  #else
>        .org progstart
>  #endif
>        xor a                ;// set register a to zero if we started from
> TIOS/ZASMLOAD
>        jr nc,start
>        .db "Programname",0 ;// put your programs name here
>  start:
>         or      a
>         jr      z,__TIOS__  ;// jump to the TIOS/ZASMLOAD-version if
executed
> from there
> __ION__:
>
>  ...place your ion-program here...
>
> __ion_quit__:               ;// jump to here if your program uses a quit
> routine
>        ret                  ;// program finished, quit. Make sure the
stack is
> correct!
>
> _TIOS__:                    ;// this part of the program handle a message
>        bcall(_clrlcdf)      ;// to inform the user that he/she should use
ION
>        bcall(_homeup)       ;// when they started from the TIOS/ZASMLOAD
>        ld hl,__TIOS_Text1__ ;//
>        bcall(_puts)         ;// Feel free to change it into something else
if
> you feel
>        bcall(_newline)      ;// you're up to it!
>        ld hl,__TIOS_Text2__
>        bcall(_puts)
>        bcall(_newline)
>        ld hl,__TIOS_Text3__
>        bcall(_puts)
>        bcall(_newline)
>
>        ret
> __TIOS_Text1__:
>        .db "Please run this",0
> __TIOS_Text2__:
>        .db "program through,0
> __TIOS_Text1__:
>        .db "the ION-Shell!",0
>
>  .end
>  END
>
> I'll put it in a file, and post it to TICalc someday
>
> Henk, could you convert it into a Z80ASM version?
>
> --Peter Martijn
>
> P.S. Is it an idea to "implement" this into the C-Compiler?
>
> P.P.S    I checked the Mirageos Header format, but that doesn't seem to
> support these kinds of programs, it has
> a header format of:
>
> .org progstart -2
> .db $bb,$6D
> ret    ;// for TIOS returning
> .db identifier
> .db icon-data......
>
> it doesn;t seem to support "TIOS-parts", because of the icon-data, which
would
> couse the calc to hang,.
> Unless... suppose we use the following format:
>
> #include "ti83plus.inc" ;//General TI-83 Plus include file
> #include "mirage.inc"   ;//MirageOS include file
> .org $9d93              ;//Origin (set back two to account for AsmPrgm)
> .db $BB,$6D             ;//Compiled AsmPrgm token
>
> ;//it was:  ret  ;So TIOS wont run the program
> ;//        .db 1 ;Identifier as MirageOS program
> ;//we'll exchange it with:
>            jr +1 ;//so it still has the header part
>
> ;//we'll then have to adapt the image, so it says:
>
> .db %00000000
> xor a //to set register a to zero
> jr __start__            ;// the only problem with this is that we mess up
the
> image
>                         ;// it will look something like this:
> .db %00000000,%00000000 ;// -:still icon, O: white pixel - forced, X:
black
> pixel-forced
> .db %00000000,%00000000 ;// ?:unknown, because it depends on the
descriptino
> below
> .db %00000000,%00000000 ;//
> .db %00000000,%00000000 ;// --------XOXOXXXX
> .db %00000000,%00000000 ;// OOOXXOOO????????
> .db %00000000,%00000000 ;// ...rest of icon...
> .db %00000000,%00000000
> .db %00000000,%00000000
> .db %00000000,%00000000
> .db %00000000,%00000000
> .db %00000000,%00000000
> .db %00000000,%00000000
> .db %00000000,%00000000
> .db "Description",0 ;Zero terminated description
>
> __start__:
>         or      a
>         jr      z,__TIOS__  ;// jump to the TIOS/ZASMLOAD-version if
executed
> from there
> __MIROS__:
>
>  ...place your mirageos-program here...
>
> __MIROS_quit__:             ;// jump to here if your program uses a quit
> routine
>        ret                  ;// program finished, quit. Make sure the
stack is
> correct!
>
> _TIOS__:                    ;// this part of the program handle a message
>        bcall(_clrlcdf)      ;// to inform the user that he/she should use
ION
>        bcall(_homeup)       ;// when they started from the TIOS/ZASMLOAD
>        ld hl,__TIOS_Text1__ ;//
>        bcall(_puts)         ;// Feel free to change it into something else
if
> you feel
>        bcall(_newline)      ;// you're up to it!
>        ld hl,__TIOS_Text2__
>        bcall(_puts)
>        bcall(_newline)
>        ld hl,__TIOS_Text3__
>        bcall(_puts)
>        bcall(_newline)
>
>        ret
> __TIOS_Text1__:
>        .db "Please run this",0
> __TIOS_Text2__:
>        .db "program through,0
> __TIOS_Text1__:
>        .db "MirageOs!",0
>
>  .end
>  END
>
>
>
> with the modified-with-quit-program it would be like this:
>
>
>
> #include "ti83plus.inc" ;//General TI-83 Plus include file
> #include "mirage.inc"   ;//MirageOS include file
> .org $9d93              ;//Origin (set back two to account for AsmPrgm)
> .db $BB,$6D             ;//Compiled AsmPrgm token
>
> ;// it was: ret ;So TIOS wont run the program
> ;//         .db 3 ;Identify modified MirageOS with quit routine
> ;//we'll exchange it with:
>             jr +3 ;//, so it still has the header part
>
> ;//we'll then have to adapt the image, so it says:
>
> .db %00000000,%00000000
> .db %00000000
> xor a ;//to set register a to zero
> jr __start__            ;// with this, we'll mes up the first 3 lines...
>                         ;// it will look something like this:
> .db %00000000,%00000000 ;// -:still icon, O: empty pixel - forced, X:
black
> pixel-forced
> .db %00000000,%00000000 ;// ?:unknown, becuase it depends on the progname
> .db %00000000,%00000000 ;//
> .db %00000000,%00000000 ;// ----------------
> .db %00000000,%00000000 ;// --------XOXOXXXX
> .db %00000000,%00000000 ;// OOOXXOOO????????
> .db %00000000,%00000000 ;// ...rest of icon...
> .db %00000000,%00000000
> .db %00000000,%00000000
> .db %00000000,%00000000
> .db %00000000,%00000000
> .db %00000000,%00000000
> .dw __MIROS_quit__ ;pointer to address of quit routine
> .db "Description",0 ;Zero terminated description
>
> __start__:
>         or      a
>         jr      z,__TIOS__  ;// jump to the TIOS-version if executed from
> there
> __MIROS__:
>
>  ...place your mirageos-program here...
>
> __MIROS_quit__:             ;// jump to here if your program uses a quit
> routine
>        ret                  ;// program finished, quit. Make sure the
stack is
> correct!
>
> _TIOS__:                    ;// this part of the program handle a message
>        bcall(_clrlcdf)      ;// to inform the user that he/she should use
ION
>        bcall(_homeup)       ;// when they started from the TIOS
>        ld hl,__TIOS_Text1__ ;//
>        bcall(_puts)         ;// Feel free to change it into something else
if
> you feel
>        bcall(_newline)      ;// you're up to it!
>        ld hl,__TIOS_Text2__
>        bcall(_puts)
>        bcall(_newline)
>        ld hl,__TIOS_Text3__
>        bcall(_puts)
>        bcall(_newline)
>
>        ret
> __TIOS_Text1__:
>        .db "Please run this",0
> __TIOS_Text2__:
>        .db "program through,0
> __TIOS_Text1__:
>        .db "MirageOs!",0
>
>  .end
>  END
>
>
>
> Dan Englender, any ideas about if this works?
>
>
>
>
> Henk Poley wrote:
>
> > > Van: Emir Sakic <saka@hotmail.com>
> > >
> > > But you had a good point.
> >
> > Yes, but I've thought about something else, Ion calls to progstart+1, so
it
> > jumps over the potential RET or XOR A (!).
> > The TIOS (hmm, realy ZASMLOAD on the Ti-83) jumps to progstart...
> > So it would execute the RET or XOR A.
> >
> > Well, since it doesn't matter if you put a RET or an XOR A in your
> > Ion-header (Ion will ALWAYS load the lib-vectors, if you don't believe
me,
> > look at the source...) you could just do a check for A = 0.
> >
> > To be sure you also check if the zero-flag is set, it could be that Ion
has
> > set A to zero before jumping to your code.
> >
> > So it would be:
> > >       .nolist
> > >       #include "ion.inc"
> > >       .list
> > >
> > > #ifdef TI83P
> > >       .org progstart-2
> > >       .db $BB,$6D
> > > #else
> > >       .org progstart
> > > #endif
> > >       xor a
> > >       jr nc,start
> > >       .db "ION vs. TI-OS",0
> > > start:
> >         jr      nz,_Ion_start
> >         or      a
> >         jr      z,_TIOS_start
> > _Ion_start:
> > >       bcall(_clrlcdf)
> > >       bcall(_homeup)
> > >       ld hl,txt
> > >       bcall(_puts)
> > >       bcall(_getkey)
> > >       ret
> > >
> > > _TIOS_start:
> > >       bcall(_clrlcdf)
> > >       bcall(_homeup)
> > >       ld hl,txt2
> > >       bcall(_puts)
> > >       bcall(_newline)
> > >       ret
> > > txt:
> > >       .db "OK..Ion is cool!",0
> > > txt2:
> > >       .db "I hate TI-OS!",0
> > >
> > > .end
> > > END
> >
> > Should work (I think)
> >
> >         Henk Poley
>
>
>
>





Follow-Ups: References: