helloapp.asm (Jul 26, 2007)

(home)
  1. From: "Jeff" Jul 27, 2007
  2. From: "Cyrano Jones" Jul 27, 2007
  3. From: "Cyrano Jones" Jul 27, 2007
  4. From: "Jeff" Jul 27, 2007
  5. From: "Jeff" Jul 27, 2007
  6. From: "Cyrano Jones" Aug 13, 2007


Subject: helloapp.asm

From: "Cyrano Jones" <cyranojones_lalp@...>

Jul 26, 2007


; Hello World, as a mailstation app.

; As best I can recall, this code has=
never been tested, mainly
; because I never finished adding function to ma=
ilbug that will
; load dataflash. I am posting this because I believe it c=
orrectly
; shows the structure of a mailstation app.

; some functions we =
will use from the mailstation rom
localize equ #056b ;localiz=
e(register de =3D -byteslocal)
draw_app_foldertab equ #0827 ;Draw_app_f=
oldertab(stringptr)
set_f_key_menu equ #0638 ;set_f_key_menu(who, d=
ataptr, num_rows)
init_widget_thingy equ #072B ;init_widget_thingy(tab1=
6row,
thingyptr)
draw_icon_wc equ #0743 ;draw_icon_wc(thingyptr, =
x, y, iconnum)
put_event_go_prev_app equ #066e
defaulthandler equ #0=
602 ;defaulthandler(who, tab30.6, signal,
par6, par8)

ORG #4000=
; This is *always* #4000, regardless of what
=
; page you use.

JP eventhandler
DEFW icons
=
DEFW caption
DEFW dunno

dunno: DEFB #00
xpos: DEFW #0000
ypos:=
DEFW #0000

caption:
DEFW #0001 ; ?????
DEFW=
endcap-caption-6 ; num of chars
DEFW #0006 ; offset=
to first char
defm "Hello World" ; the caption string
endcap:=

org #4064 ; not sure this is needed

icons:
de=
fw icon2 - icon1 ; size icon1
defw icon1 - icons ; offset to=
icon1 (icon at #406c)
defw iconend - icon2 ; size icon2
=
defw icon2 - icons ; offset to icon2

icon1:
; The first icon is used i=
n the mailstation menu.
; First the size data (standard mailstation men=
u icons are 34 x 34)
defw #0022 ; icon width (#0022 =3D 34 dec =3D=
4.25 bytes,
; rounded up, means 5 bytes per row)
=
defb #22 ; icon height (34 dec pix rows high)

; Then the icon bitm=
ap (lo order bit displays on LEFT of each
byte!)
defb #55,#55,#55=
,#55,#55, #aa,#aa,#aa,#aa,#aa
defb #55,#55,#55,#55,#55, #aa,#aa,#aa=
,#aa,#aa
defb #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa
defb =
#55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa
defb #55,#55,#55,#55,#55,=
#aa,#aa,#00,#aa,#aa
defb #55,#55,#00,#55,#55, #aa,#aa,#00,#aa,#aa
=
defb #55,#55,#00,#55,#55, #aa,#aa,#00,#aa,#aa
defb #55,#55,=
#00,#55,#55, #aa,#aa,#00,#aa,#aa
defb #55,#55,#00,#55,#55, #aa,#aa,=
#aa,#aa,#aa
defb #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa
de=
fb #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa
defb #55,#55,#55,#55,#=
55, #aa,#aa,#aa,#aa,#aa
defb #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#=
aa
defb #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa
defb #55,#=
55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa
defb #55,#55,#55,#55,#55, #aa,#=
aa,#aa,#aa,#aa
defb #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa

icon=
2:
; In official apps, the second icon would be the TV guide,
; weather, ne=
ws, etc., stored as a full screen (320 x 128) image.
; This is used when th=
e app needs to draw itself.
; Your app may not need this icon.
defw =
#0030 ; width
defb #22 ; height
defb #00,#00,#04,#E0=
,#03,#00, #F0,#01,#0F,#3E,#07,#00
defb #9C,#02,#0F,#7F,#0C,#00, #04=
,#86,#07,#93,#09,#00
defb #42,#C2,#01,#A0,#0B,#00, #F3,#44,#9E,#FF,=
#0A,#00
defb #91,#F6,#F3,#F6,#0D,#00, #99,#8C,#4E,#E6,#07,#00
=
defb #F1,#C1,#46,#2E,#06,#00, #93,#40,#44,#44,#0C,#00
defb #3E,#=
C0,#C0,#40,#08,#00, #10,#80,#C0,#41,#0C,#00
defb #10,#80,#EB,#27,#0=
6,#00, #18,#00,#3F,#7D,#02,#00
defb #08,#00,#00,#C3,#07,#00, #08,#0=
0,#00,#02,#0E,#00
defb #18,#80,#31,#FE,#1F,#80, #70,#00,#1F,#FF,#7F=
,#78
defb #E0,#01,#8C,#F8,#DF,#07, #00,#17,#C8,#F0,#CF,#00
d=
efb #00,#7C,#58,#E0,#87,#FC, #FF,#FF,#B1,#80,#A3,#07
defb #00,#80,=
#7F,#85,#81,#00, #00,#00,#91,#80,#C0,#0F
defb #00,#F0,#FF,#C1,#48,#=
F8, #C0,#1F,#36,#42,#60,#00
defb #7C,#80,#5E,#60,#28,#00, #03,#70,#=
B5,#E0,#1A,#00
defb #00,#0E,#E4,#BB,#07,#00, #80,#01,#24,#06,#01,#0=
0
defb #60,#00,#64,#80,#01,#00, #18,#00,#4C,#60,#00,#00
defb=
#04,#00,#88,#39,#00,#00, #00,#00,#08,#0F,#00,#00
iconend:

; -- Above dat=
a may need to be at fixed addresses, regardless of the
; -- fact that there=
seem to be pointers to them in header. I do
; -- believe there may be cas=
es where mailstation addresses data
; -- directly, without following pointe=
r.
; --
; -- The eventhandler would normally be near end of page, after a
;=
; -- i=
mage). I don't think address matters, as long as jump in header
; -- can f=
ind it.

eventhandler:
;eventhandler(who, appstate, signal, this, that)
=
ld de,-25 ; local: sp0008-sp0020 (25 dec bytes)
call l=
ocalize ; par: sp0025, sp0027, sp0029, sp002b, sp002d

;locals
menuit=
em equ #0008 ; first local is at sp + 8 bytes of
register sa=
ve
mythingy equ menuitem + 5 ; menuitem + size of menuitem

; param=
eters
who equ mythingy + 20 + 4 ; mythingy + size of mythingy + 4 m=
ore
bytes of reg save
appstate equ who + 2
signal equ appstate + 2
t=
his equ signal + 2
that equ this + 2

ld hl,signal =
; a =3D par4 signal
add hl,sp
ld a,(hl)
ex de,hl

=
dec a
jr z,event_appinit ; sig =3D #01 (app init)
sub=
07
jr z,event_keydown ; sig =3D #08 (key down)
sub 02
=
jp z,event_menu ; sig =3D #0A (menu event)
sub 03
j=
r z,event_draw ; sig =3D #0D (draw app)
jp event_other ;=
else

event_appinit:
; draw foldertab
ld hl,foldertabtext ; the s=
tring
push hl
call draw_app_foldertab
pop de

; set up=
the f-key menu
ld hl,menuitem
add hl,sp
ld (hl),#36 =
; string# of "Back" in string table
inc hl
ld (hl),#00
=
inc hl
ld (hl),#64 ; code for menucommand "cm_back"
inc hl
=
ld (hl),#00
inc hl
ld (hl),#03 ; scancode for f1 key
=

ld hl,#0001
push hl ; [-2] push #0001 (n =3D 1 recor=
d)

ld hl,menuitem+2
add hl,sp
push hl ; [-4] pus=
h @menuitem

ld hl,who+4
add hl,sp
ld e,(hl)
ld=
d,#00
push de ; [-6] push who

call set_f_key_menu
=
pop de
pop de
pop de

; return nexstate =3D 1
ld hl=
,#0001
ret

event_draw:
; draws the datascreen (TV listing, weather=
, news, etc.)
; First, we need to init a local thingy
ld hl,mythingy=

add hl,sp
push hl ; push @mythingy
ld hl,#00FF ;=
use whole screen window
push hl
call init_widget_thingy
=
pop de
pop de

; Next we draw whatever needs drawin'.
; For now, =
we just draw the 2nd app icon (see header)
; This is how the standard apps =
display weather, TV listings,
; or news, the displayed info is just a big i=
con.
; But you would draw anything your app needs to display here.

=
ld hl,#0081 ; 2nd app icon, the datascreen
push hl

ld hl,(y=
pos)
push hl

ld hl,(xpos)
push hl

ld hl,mythi=
ngy+6
add hl,sp
push hl

call draw_icon_wc
ld h=
l,#0008
add hl,sp
ld sp,hl
jr ret_samestate ; ret =
par2

event_keydown:
ex de,hl ; hl =3D @par4
inc hl
=
inc hl
ld e,(hl) ; par6 (this)
inc hl
ld d,(hl)
=
dec de ; de =3D this - 1
ld a,d
or e
jr nz,=
ret_samestate ; if this <> 1, we're done

; signal was #08 AND this was =
#01 (it's the "back" key down)
call put_event_go_prev_app
jr=
ret_samestate ; ret par2

event_menu:
ex de,hl ; hl =3D @pa=
r4
inc hl
inc hl
ld e,(hl)
inc hl
ld d,(=
hl) ; par6 (this)
ld hl,#FF9C ; - #64
add hl,de ; hl =
=3D this - cm_back
ld a,h
or l
jr nz,ret_samestate ; =
if this <> #64, then ret par2

; signal was #0A AND "this" was #64
=
call put_event_go_prev_app
jr ret_samestate

event_other:
; signal=
was something else, call default handler.
; I suppose this might be like c=
alling the "inherited" event handler.
; Default handler rets 0 when signal =
was #13
; rets 1 when signal was #14
; rets=
par2 for all other cases

ld hl,that ; par8 that
add hl,s=
p
ld e,(hl)
inc hl
ld d,(hl)
push de

de=
c hl
dec hl
ld d,(hl)
dec hl ; par6 this
=
ld e,(hl)
push de

dec hl
dec hl ; par4 signal=

ld e,(hl)
ld d,00
push de

dec hl
dec h=
l ; par2 appstate
ld e,(hl)
push de

dec hl
=
dec hl ; par0 who
ld e,(hl)
push de

call d=
efaulthandler

ex de,hl ; de =3D retval
ld hl,#000A
=
add hl,sp
ld sp,hl
ld d,00 ;; ret de (we return same ret=
val)
ex de,hl
ret

; after #0D, #08, #0A, return par2 (ap=
pstate)
; iow, app stays in the same state.
ret_samestate:
ld hl,app=
state
add hl,sp
ld e,(hl)
ld d,00
ex de,hl ;=
ret hl =3D sp0078 (par2)
ret

foldertabtext:
db "Hello Wor=
ld!!!", 0


best I can recall, this code has never been tested, mainly<br>; because I =
never finished adding function to mailbug that will<br>; load dataflash.&nb=
sp; I am posting this because I believe it correctly<br>; shows the structu=
re of a mailstation app.<br><br><br>; some functions we will use from the m=
ailstation rom<br>localize        &=
nbsp;     equ #056b  ;localize(register de =3D -by=
teslocal)<br>draw_app_foldertab    equ #0827  ;Draw_app=
_foldertab(stringptr)  <br>set_f_key_menu     =
;   equ #0638  ;set_f_key_menu(who, dataptr, num_rows)<br>in=
it_widget_thingy    equ #072B  ;init_widget_thingy(tab1=
6row, thingyptr)<br>draw_icon_wc       &=
nbsp;  equ #0743  ;draw_icon_wc(thingyptr, x, y, iconnum)<br>put_=
event_go_prev_app equ #066e<br>defaulthandler     =
   equ #0602  ;defaulthandler(who, tab30.6, signal, par6, pa=
r8)<br><br><br>       ORG  #4000 &n=
bsp;      ; This is *always* #4000, regardless of =
what<br>           &=
nbsp;           &nbs=
p; ; page you use.<br><br>       JP &nbs=
p;  eventhandler<br>       DEFW  ic=
ons       <br>     &=
nbsp; DEFW  caption<br>       DEFW =
dunno<br>           =
;             <=
br>dunno: DEFB #00<br>xpos:  DEFW #0000<br>ypos:  DEFW #0000<br>&=
nbsp;           &nbs=
p;           <br>caption:=
          ; ?????<br> &nb=
sp;     DEFW  endcap-caption-6  ; num of char=
s<br>       DEFW  #0006   =
;          ; offset to first c=
har<br>       defm "Hello World"  &=
nbsp;   ; the caption string<br>endcap:<br><br>   =
   org   #4064       =
;     ; not sure this is needed<br><br>icons: &nbs=
p;  <br>      defw  icon2 - icon1 &=
nbsp;  ; size icon1<br>      defw  icon1=
- icons    ; offset to icon1   (icon at #406c)<br=
n2<br>      defw  icon2 - icons  &n=
bsp; ; offset to icon2<br><br>icon1:<br>; The first icon is used in the mai=
lstation menu.<br>;     First the size data (standard m=
ailstation menu icons are 34 x 34)<br>      defw #=
0022  ; icon width  (#0022 =3D 34 dec =3D 4.25 bytes,<br> &n=
bsp;            =
;    ; rounded up, means 5 bytes per row)<br>  &nb=
sp;   defb #22    ; icon height (34 dec pix rows h=
igh)<br><br>;     Then the icon bitmap   (lo =
order bit displays on LEFT of each byte!)<br>     =
defb  #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa<br>   &=
nbsp;  defb  #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa<br> &n=
bsp;    defb  #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa<=
br>      defb  #55,#55,#55,#55,#55, #aa,#aa,#=
aa,#aa,#aa<br>      defb  #55,#55,#55,#55,#55=
, #aa,#aa,#00,#aa,#aa<br>      defb  #55,#55,=
#00,#55,#55, #aa,#aa,#00,#aa,#aa<br>      defb&nbs=
p; #55,#55,#00,#55,#55, #aa,#aa,#00,#aa,#aa<br>    &nbs=
p; defb  #55,#55,#00,#55,#55, #aa,#aa,#00,#aa,#aa<br>   =
;   defb  #55,#55,#00,#55,#55, #aa,#aa,#aa,#aa,#aa<br> =
     defb  #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#a=
a<br>      defb  #55,#55,#55,#55,#55, #aa,#aa=
,#aa,#aa,#aa<br>      defb  #55,#55,#55,#55,#=
55, #aa,#aa,#aa,#aa,#aa<br>      defb  #55,#5=
5,#55,#55,#55, #aa,#aa,#aa,#aa,#aa<br>      defb&n=
bsp; #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa<br>    &n=
bsp; defb  #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa<br>  &nb=
sp;   defb  #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,#aa<br>&nbs=
p;     defb  #55,#55,#55,#55,#55, #aa,#aa,#aa,#aa,=
#aa<br>    <br><br>icon2:<br>; In official apps, the second =
icon would be the TV guide,<br>; weather, news, etc., stored as a full scre=
en (320 x 128) image.<br>; This is used when the app needs to draw itself. =
 <br>; Your app may not need this icon.<br>    &nb=
sp; defw  #0030   ; width<br>      =
defb  #22     ; height<br>    =
  defb  #00,#00,#04,#E0,#03,#00, #F0,#01,#0F,#3E,#07,#00<br> =
;     defb  #9C,#02,#0F,#7F,#0C,#00, #04,#86,#07,#=
93,#09,#00<br>      defb  #42,#C2,#01,#A0,#0B=
,#00, #F3,#44,#9E,#FF,#0A,#00<br>      defb  =
#91,#F6,#F3,#F6,#0D,#00, #99,#8C,#4E,#E6,#07,#00<br>    =
;  defb  #F1,#C1,#46,#2E,#06,#00, #93,#40,#44,#44,#0C,#00<br>&nbs=
p;     defb  #3E,#C0,#C0,#40,#08,#00, #10,#80,#C0,=
#41,#0C,#00<br>      defb  #10,#80,#EB,#27,#0=
6,#00, #18,#00,#3F,#7D,#02,#00<br>      defb =
#08,#00,#00,#C3,#07,#00, #08,#00,#00,#02,#0E,#00<br>   &nbs=
p;  defb  #18,#80,#31,#FE,#1F,#80, #70,#00,#1F,#FF,#7F,#78<br>&nb=
sp;     defb  #E0,#01,#8C,#F8,#DF,#07, #00,#17,#C8=
,#F0,#CF,#00<br>      defb  #00,#7C,#58,#E0,#=
87,#FC, #FF,#FF,#B1,#80,#A3,#07<br>      defb =
; #00,#80,#7F,#85,#81,#00, #00,#00,#91,#80,#C0,#0F<br>   &nb=
sp;  defb  #00,#F0,#FF,#C1,#48,#F8, #C0,#1F,#36,#42,#60,#00<br>&n=
bsp;     defb  #7C,#80,#5E,#60,#28,#00, #03,#70,#B=
5,#E0,#1A,#00<br>      defb  #00,#0E,#E4,#BB,=
#07,#00, #80,#01,#24,#06,#01,#00<br>      defb&nbs=
p; #60,#00,#64,#80,#01,#00, #18,#00,#4C,#60,#00,#00<br>   &n=
bsp;  defb  #04,#00,#88,#39,#00,#00, #00,#00,#08,#0F,#00,#00<br>i=
conend:<br><br>; -- Above data may need to be at fixed addresses, regardles=
s of the<br>; -- fact that there seem to be pointers to them in header.&nbs=
p; I do<br>; -- believe there may be cases where mailstation addresses data=
ler would normally be near end of page, after a<br>; -- large block of grap=
hic data (standard ms apps are mostly just an<br>; -- image).  I don't=
think address matters, as long as jump in header<br>; -- can find it.<br><=
br><br>eventhandler:<br>;eventhandler(who, appstate, signal, this, that)<br=
p;   ; local: sp0008-sp0020  (25 dec bytes)<br>  &=
nbsp;   call localize     ;   par: =
sp0025, sp0027, sp0029, sp002b, sp002d<br><br>;locals<br>menuitem equ #0008=
            &nb=
sp;   ; first local is at sp + 8 bytes of register save<br>mythin=
gy equ menuitem + 5         ; menui=
tem + size of menuitem<br><br>; parameters<br>who    &n=
bsp; equ mythingy + 20 + 4    ; mythingy + size of mythingy =
+ 4 more bytes of reg save<br>appstate equ who     =
; + 2<br>signal   equ appstate + 2<br>this    =
; equ signal   + 2<br>that     equ this =
    + 2<br><br>      ld hl,signal&n=
bsp;   ; a =3D par4   signal<br>    =
;  add hl,sp  <br>      ld a,(hl)  =
;     dec a      <br> &nb=
sp;    jr z,event_appinit   ; sig =3D #01  (a=
pp init)  <br>      sub 07   &=
nbsp;  <br>      jr z,event_keydown &nbs=
p; ; sig =3D #08  (key down)  <br>      =
sub 02      <br>      jp =
z,event_menu      ; sig =3D #0A  (menu event)=
p; ; sig =3D #0D  (draw app)<br>      jp even=
t_other       ; else<br><br><br>event_appinit=
:<br>; draw foldertab<br>      ld hl,foldertabtext=
  ; the string<br>      push hl   &=
nbsp;<br>      call draw_app_foldertab  <br>&=
nbsp;     pop de      <br><br>=
; set up the f-key menu<br>      ld hl,menuitem<br=
;  ld (hl),#36  ; string# of "Back" in string table<br> &nbs=
p;    inc hl      <br>  &=
nbsp;   ld (hl),#00  <br>      inc =
hl      <br>      ld (hl)=
,#64  ; code for menucommand "cm_back"<br>    &nbs=
p; inc hl      <br>      =
ld (hl),#00  <br>      inc hl  &nbs=
p;   <br>      ld (hl),#03  ; scanc=
ode for f1 key<br><br>      ld hl,#0001  <br>=
      push hl      ; [-2]=
push #0001    (n =3D 1 record)<br><br>   &nb=
sp;  ld hl,menuitem+2  <br>      add hl,=
sp  <br>      push hl    =
  ; [-4] push @menuitem<br><br>      ld hl,wh=
o+4<br>      add hl,sp  <br>   =
;   ld e,(hl)  <br>      ld d,#00&n=
bsp;   <br>      push de  &nbs=
p;   ; [-6] push who<br><br>      call s=
et_f_key_menu  <br>      pop de  &n=
bsp;   <br>      pop de   =
;   <br>      pop de   &n=
bsp;  <br><br>; return nexstate =3D 1<br>     =
; ld hl,#0001  <br>      ret   =
;     <br><br><br>event_draw:<br>; draws the datascreen=
(TV listing, weather, news, etc.)<br>; First, we need to init a local thin=
gy<br>      ld hl,mythingy<br>   &n=
bsp;  add hl,sp  <br>      push hl =
    ; push @mythingy<br>      ld hl=
,#00FF  ; use whole screen window<br>      pu=
sh hl    <br>      call init_widget=
_thingy  <br>      pop de   &n=
bsp;  <br>      pop de    =
;  <br><br>; Next we draw whatever needs drawin'.<br>; For now, we jus=
t draw the 2nd app icon (see header)<br>; This is how the standard apps dis=
play weather, TV listings,<br>; or news, the displayed info is just a big i=
con.<br>; But you would draw anything your app needs to display here.<br><b=
r>      ld hl,#0081  ; 2nd app icon, the data=
screen<br>      push hl    <br><br>=
      ld hl,(ypos)<br>    &nbs=
p; push hl    <br><br>      ld hl,(=
xpos)<br>      push hl    <br><br>&=
nbsp;     ld hl,mythingy+6<br>    &=
nbsp; add hl,sp  <br>      push hl  =
;  <br><br>      call draw_icon_wc  &nbs=
p;<br>      ld hl,#0008  <br>  &nbs=
p;   add hl,sp  <br>      ld sp,hl&=
nbsp;   <br>      jr ret_samestate =
    ; ret par2<br> <br> <br>event_keydown:<br>&nbs=
p;     ex de,hl    ; hl =3D @par4<br>&nb=
sp;     inc hl      <br> =
     inc hl      <br> &nb=
sp;    ld e,(hl)   ; par6  (this)<br> &n=
bsp;    inc hl      <br>  =
;    ld d,(hl)  <br>      dec =
de      ; de =3D this - 1<br>   &nb=
sp;  ld a,d      <br>    =
  or e        <br>   =
;   jr nz,ret_samestate  ; if this <> 1, we're done<br=
ey down)<br>      call put_event_go_prev_app  =
;<br>      jr ret_samestate    =
; ; ret par2<br><br><br>event_menu:<br>      ex de=
,hl    ; hl =3D @par4<br>      inc =
hl      <br>      inc hl&=
nbsp;     <br>      ld e,(hl) =
 <br>      inc hl     &nb=
sp;<br>      ld d,(hl)   ; par6 &nb=
sp; (this)<br>      ld hl,#FF9C ; - #64  &nbs=
p;<br>      add hl,de   ; hl =3D this - =
cm_back<br>      ld a,h     &n=
bsp;<br>      or l     &n=
bsp;  <br>      jr nz,ret_samestate  ; i=
f this <> #64, then ret par2<br><br>; signal was #0A  AND  =
"this" was #64<br>      call put_event_go_prev_app=
 <br>      jr ret_samestate   &nbs=
p;<br><br><br>event_other:<br>; signal was something else, call default han=
dler.<br>; I suppose this might be like calling the "inherited" event handl=
er.<br>; Default handler rets 0 when signal was #13<br>;   &=
nbsp;           &nbs=
p; rets 1 when signal was #14<br>;       =
;          rets par2 for all o=
ther cases<br><br>      ld hl,that  ; par8&nb=
sp;  that<br>      add hl,sp  <br> =
     ld e,(hl)  <br>     =
inc hl      <br>      ld=
d,(hl)  <br>      push de    =
;<br>      dec hl      <b=
r>      ld d,(hl)  <br>   &nbs=
p;  dec hl      ; par6   this<br>&n=
bsp;     ld e,(hl)  <br>    &n=
bsp; push de    <br><br>      dec h=
l      <br>      dec hl&n=
bsp;     ; par4   signal<br>   =
;   ld e,(hl)  <br>      ld d,00&nb=
sp;   <br>      push de   &nbs=
p;<br><br>      dec hl     &nb=
sp;<br>      dec hl      =
; par2   appstate<br>      ld e,(hl) &nb=
sp;<br>      push de    <br><br>&nb=
sp;     dec hl      <br> =
     dec hl      ; par0 &=
nbsp; who<br>      ld e,(hl)  <br>  =
;    push de    <br><br>   &nb=
sp;  call defaulthandler  <br><br>      =
ex de,hl    ; de =3D retval<br>     =
; ld hl,#000A  <br>      add hl,sp  <br>=
      ld sp,hl    <br>  &=
nbsp;   ld d,00     ;; ret de (we return same=
retval)<br>      ex de,hl    <br>&=
nbsp;     ret        =
;<br><br><br>; after  #0D, #08, #0A,  return par2  (appstate=
)<br>; iow, app stays in the same state.<br>ret_samestate:<br>  &=
nbsp;   ld hl,appstate  <br>      a=
dd hl,sp  <br>      ld e,(hl)  <br> =
;     ld d,00    <br>   &=
nbsp;  ex de,hl    ; ret hl =3D sp0078  (par2)<br>=
      ret       &nbs=
p;<br><br> <br>foldertabtext:<br>      db "He=
llo World!!!", 0<br>      <br></font>



1: Subject: Re: helloapp.asm

(top)

From: "Jeff" <fyberoptic1979@...>

Jul 27, 2007

Jones" <cyranojones_lalp@...> =
wrote:
, this code has never been tested, mainly
ng function to mailbug that will
ause I believe it correctly

I had recreated the calculator icon in 1-bit-per-pixel format and was
=
searching through the dumped flash in the Files section to see if I
could =
match it up to something that might have some icon header that
I could mak=
e out. Though I have no idea how it even stores those
built-in apps and w=
hether it would have even helped to find the
icon. So thanks for the stru=
cture and icon info!

I compiled with as80 (after fixing some of the assemb=
ler commands in
the beginning there, which it complained about them being =
uppercase)
and manually entered it into the MS via the hex editor. A 721 =
byte
file ends up being a little longer to type in that one might think,
=
but not too bad. I was able to run the app, got a chuckle from the
image =
it displayed, but noticed there was a problem with the tab's
text. It was=
just "! ..." instead of "Hello world!!!". I realized
that I didn't put a=
carriage return after the very last line in the
assembly file, which resu=
lted in as80 not even parsing that line (a
good thing to remember), but ev=
en when I recompiled and tacked the
extra bytes onto the end in the hex ed=
itor, it still gave me the same
"! ..." instead of the caption. So I dunn=
o what's up with that. But
the Back button let me exit and such, so the c=
aption issue seems to
be the only thing possibly wrong. I went back over =
the hex I typed
in, and am fairly sure I didn't mistype anything. Unless =
you spot
anything with the code that could be the issue, I might double-ch=
eck
my typing once more when it's not so late.


2: Subject: Re: helloapp.asm

(top)

From: "Cyrano Jones" <cyranojones_lalp@...>

Jul 27, 2007

searching through the dumped flash in the Files section to see if I
d match it up to something that might have some icon header that
make out. Though I have no idea how it even stores those
and whether it would have even helped to find the
the structure and icon info!

The built-in apps don't use same format. All=
of the icons
are in a big table, right after the font data in codeflash pa=
ge #04

in

Yeah, by default as80 wants lower case only. I add the -i switch
to com=
mand to allow upper or lower. I almost always type lowercase
but I must ha=
ve cut and pasted part of that file from an uppercase
example.

For whateve=
r it's worth, here is my bat file for assembling helloapp,
with a cheat she=
et for the options:

..\as80 -x2 -n -i -l -h0 -w200 -ohelloapp.rom helloapp=

C:\PROGRA~1\ACCESS~1\WORDPAD.EXE helloapp.lst

REM these are the relevant =
options for as80
REM -x2 =3D use z80 extensions to 8080
REM -n =3D no opti=
mizations
REM -i =3D Ignore case in opcodes
REM -l =3D Generate pass 2 li=
sting
REM -h0 =3D use an infinite page length
REM -w200 =3D use 200 column =
page width
REM -dsomevar =3D define variable
REM -osomefilename =3D output =
to file name
REM -lsomefilename =3D listing file name
REM
REM -s2 =3D Writ=
e intel-hex file instead of binary file

he MS via the hex editor. A 721 byte
to type in that one might think,

:-)

run the app, got a chuckle from the

I hope that wa=
s not one of the nudie pix of my girlfriend!
I really don't remember what i=
t is. I guess it is about the
size of an icon???

a problem with the tab's
orld!!!".

I just noticed that my assembly listing shows it to be
713 by=
tes, not 721. This might be at the root of the problem???



3: Subject: Re: helloapp.asm

(top)

From: "Cyrano Jones" <cyranojones_lalp@...>

Jul 27, 2007

721. This might be at the root of the problem???

I just uploaded my assem=
bly listing of helloapp
to root of groups file area.

I wonder if I can ma=
ke a link to it here?
(URL)

Hmmmmm. for some reason, it is leaving off the filename.

This time for s=
ure....
(URL)
MSW23Eq4rYV6ETtnbrMEfZR4M59NkLjszTl5D1JWzMG5MxUQiRh8RD4Hw34ebPhRLkdA/helloa=
pp.lst.txt

Well, that doesn't look right either. Oh well.



4: Subject: Re: helloapp.asm

(top)

From: "Jeff" <fyberoptic1979@...>

Jul 27, 2007

Jones" <cyranojones_lalp@...> =
wrote:

ally don't remember what it is. I guess it is about the
?

lol no such luck on nudie pics. Let's just say that I'm assuming the
i=
con represents who you were at I-Appliance.

ssembly listing shows it to be
root of the problem???

When using your as80 command-line options, I al=
so got 713 bytes. But
when I run the program now, it just says "+V" inste=
ad of the former
"! ..."

So I'm not really sure what could be the problem=
, unless it's
switching pages during the tab drawing routine. I wouldn't =
think so,
but it's all that comes to mind.


5: Subject: Re: helloapp.asm

(top)

From: "Jeff" <fyberoptic1979@...>

Jul 27, 2007

Jones" <cyranojones_lalp@...> =
wrote:
s.yahoo.com/group/mailstation/files/
aving off the filename.
.com/v1/ELSpRqWjDgtU18v23HDt6o742uvu7h8ncRlgZ-
MSW23Eq4rYV6ETtnbrMEfZR4M59N=
kLjszTl5D1JWzMG5MxUQiRh8RD4Hw34ebPhRLkdA/
helloapp.lst.txt
doesn't look right either. Oh well.

I think it's using the user's sess=
ion ID or some other such random
thing in the url, because it's different =
when I go to get it. It's
even different than it was for me a few minutes=
ago. They change it
up to prevent people from using it to host files out=
side of the
group, I guess.


6: Subject: Re: helloapp.asm

(top)

From: "Cyrano Jones" <cyranojones_lalp@...>

Aug 13, 2007


ust says "+V" instead of the former
what could be the problem, unless it's
awing routine. I wouldn't think so,

T=
hat's it!!!

I guess it's not a good idea to pass a pointer to a page that =
might
not stay put!!! :-) :-) :-)

It seemed innocent enough to pass a =
pointer to a constant string
defined within the app. But the app runs from=
slot4000, and the
call to "draw_app_foldertab" uses slot4000, too. By th=
e time
the string is actually used, several other pages have been slapped
i=
nto slot4000, too.

So, I declared a local var on the stack, and copied i=
t there.
(The stack is in slotC000, which never changes.)

It works now!!!
=

Thanks!!!