[A83] Re: Problem with code


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

[A83] Re: Problem with code




I didn't even read the code... it's too long for the time i have on my 
hands...

but my guess is you used B_CALL VPuts (after a search :) yes that's what you 
use!), and that is what is creating the problem. VPutS' actual code is on a 
ROM page different than 0 and therefore when called is switched in place of 
your apps ROM page, so the pointer (HL) is now points to garbage. To get 
past this there are 2 solutions, make a routine that copies the string to 
print into ram.. and then points there and then calls VPutS ... or 
betterway... write your own VPutS routine in your app and CALL (not B_CALL) 
it instead of VPutS.

eg routine (I don't have the one i usually use under hand):

VPutSApp:
ld a, (hl)
or a
inc hl
ret z
push hl     ; or is hl preserved with the ROM call in the next step
B_CALL PutC ; (or is it VPutC??)
pop hl      ; or is hl preserved above ???
jr VPutSApp

-Nicolas Gilles

>
>  Can anyone tell me what is wrong with this app code?
>
>Instead of displaying the text to the screen with vputs, it just displays 
>garbage.
>
>Martin Smith
>
>smity42@yahoo.com
>
>
>
>*************************************************************************************
>
>;Include file needed to access system routines
>  include "ti83plus.inc"
>
>EXT_APP equ 1   ;This definition is required of all apps
>cseg            ;This linker directive is required of all apps.
>;This is the application header definition area required for all apps.
>  db 080h,0Fh    ;Field: Program length
>  db   00h,00h,00h,00h ;Length=0 (N/A for unsigned apps)
>  db 080h,012h    ;Field: Program type
>  db   01h,04h  ;Type= Shareware, TI-83Plus
>  db 080h,021h    ;Field: App ID
>  db   01h       ;Id = 1
>  db 080h,031h    ;Field: App Build
>  db   01h       ;Build = 1
>  db 080h,048h    ;Field: App Name
>  db 049h,06fh,06eh,073h,020h,038h,033h,02bh ;Name = "Ions 83+" must be 8 
>characters
>  db 080h,081h    ;Field: App Pages
>  db 01h         ;App Pages = 1
>  db 080h,090h    ;No default splash screen
>  db 03h,026h ,09h,04h, 04h,06fh,01bh,80h     ;Field: Date stamp- 5/12/1999
>  db 02h,0dh,040h                             ;Dummy encrypted TI date 
>stamp signature
>  db 0a1h ,06bh ,099h ,0f6h ,059h ,0bch ,067h
>  db 0f5h ,085h ,09ch ,09h ,06ch ,0fh ,0b4h ,03h ,09bh ,0c9h
>  db 03h ,032h ,02ch ,0e0h ,03h ,020h ,0e3h ,02ch ,0f4h ,02dh
>  db 073h ,0b4h ,027h ,0c4h ,0a0h ,072h ,054h ,0b9h ,0eah ,07ch
>  db 03bh ,0aah ,016h ,0f6h ,077h ,083h ,07ah ,0eeh ,01ah ,0d4h
>  db 042h ,04ch ,06bh ,08bh ,013h ,01fh ,0bbh ,093h ,08bh ,0fch
>  db 019h ,01ch ,03ch ,0ech ,04dh ,0e5h ,075h
>  db 80h,7Fh      ;Field: Program Image length
>  db   0,0,0,0    ;Length=0, N/A
>  db   0,0,0,0    ;Reserved
>  db   0,0,0,0    ;Reserved
>  db   0,0,0,0    ;Reserved
>  db   0,0,0,0    ;Reserved
>
>;End of header data
>StartApp:                   ;The app starts here
>  RES trigDeg,(IY+trigFlags)  ;use small font
>  B_CALL ClrLCDFull         ;Clear the screen
>  B_CALL RunIndicOff   ;turn off the run indicator
>  ld a, 0       ;set start point of list
>  ld (point), a     ;save it
>MainLoop:       ;main loop of program
>  call DrawScreen    ;draw everything on the screen
>NoRedraw:       ;loop for nothing redrawn
>  B_CALL GetCSC     ;wait for keypress
>  cp skUp       ;check if up arrow
>  jp z, Mup      ;if yes move list
>  cp skDown      ;check if down arrow
>  jp z, Mdown      ;if yes move list
>  cp skClear      ;check if clear
>  jp z, Endo      ;if yes exit
>  cp skMode      ;check if mode
>  jp z, Endo      ;if yes exit
>  cp skMath      ;check if a
>  jp z, SearchA     ;and goto
>  cp skApps      ;check if b
>  jp z, SearchB     ;and goto
>  cp skPrgm      ;check if c
>  jp z, SearchC     ;and goto
>  cp skRecip      ;check if d
>  jp z, SearchD     ;and goto
>  cp skSin       ;check if e
>  jp z, SearchF     ;and goto
>  cp skCos       ;check if f
>  jp z, SearchF     ;and goto
>  cp skTan       ;check if g
>  jp z, SearchG     ;and goto
>  cp skPower      ;check if h
>  jp z, SearchH     ;and goto
>  cp skSquare      ;check if i
>  jp z, SearchI     ;and goto
>  cp skComma      ;check if j
>  jp z, SearchL     ;and goto
>  cp skLParen      ;check if k
>  jp z, SearchL     ;and goto
>  cp skRParen      ;check if l
>  jp z, SearchL     ;and goto
>  cp skDiv       ;check if m
>  jp z, SearchM     ;and goto
>  cp skLog       ;check if n
>  jp z, SearchN     ;and goto
>  cp sk7       ;check if o
>  jp z, SearchO     ;and goto
>  cp sk8       ;check if p
>  jp z, SearchP     ;and goto
>  cp sk9       ;check if q
>  jp z, SearchS     ;and goto
>  cp skMul       ;check if r
>  jp z, SearchS     ;and goto
>  cp skLn       ;check if s
>  jp z, SearchS     ;and goto
>  cp sk4       ;check if t
>  jp z, SearchT     ;and goto
>  cp sk5       ;check if u
>  jp z, SearchZ     ;and goto
>  cp sk6       ;check if v
>  jp z, SearchZ     ;and goto
>  cp skSub       ;check if w
>  jp z, SearchZ     ;and goto
>  cp skStore      ;check if x
>  jp z, SearchZ     ;and goto
>  cp sk1       ;check if y
>  jp z, SearchZ     ;and goto
>  cp sk2       ;check if z
>  jp z, SearchZ     ;and goto
>  jp NoRedraw      ;if not letter, try again.
>
>Endo:
>  B_CALL ClrLCDFull         ;Clear the screen
>  B_JUMP JForceCmdNoChar    ;Exit the application
>Mup:
>  ld a, (point)     ;get current point
>  cp 0        ;check if at top
>  jp z, NoRedraw     ;if yes don't scroll
>  dec a        ;scroll up
>  ld (point), a     ;save
>  jp MainLoop      ;redraw
>Mdown:
>  ld a, (point)     ;get current point
>  cp 103       ;check if at bottom
>  jp z, NoRedraw     ;if yes don't scroll
>  inc a        ;scroll down
>  ld (point), a     ;save
>  jp MainLoop      ;redraw
>SearchA:        ;Letter A jump
>  ld a, 0       ;get point
>  ld (point), a     ;save
>  jp MainLoop      ;redraw
>
>
>SearchB:        ;same again.
>  ld a, 8
>  ld (point), a
>  jp MainLoop
>
>SearchC:
>  ld a, 18
>  ld (point), a
>  jp MainLoop
>SearchD:
>  ld a, 36
>  ld (point), a
>  jp MainLoop
>SearchF:
>  ld a, 38
>  ld (point), a
>  jp MainLoop
>SearchG:
>  ld a, 40
>  ld (point), a
>  jp MainLoop
>SearchH:
>  ld a, 41
>  ld (point), a
>  jp MainLoop
>SearchI:
>  ld a, 50
>  ld (point), a
>  jp MainLoop
>SearchL:
>  ld a, 53
>  ld (point), a
>  jp MainLoop
>SearchM:
>  ld a, 55
>  ld (point), a
>  jp MainLoop
>SearchN:
>  ld a, 63
>  ld (point), a
>  jp MainLoop
>SearchO:
>  ld a, 67
>  ld (point), a
>  jp MainLoop
>SearchP:
>  ld a, 70
>  ld (point), a
>  jp MainLoop
>SearchS:
>  ld a, 82
>  ld (point), a
>  jp MainLoop
>SearchT:
>  ld a, 92
>  ld (point), a
>  jp MainLoop
>SearchZ:
>  ld a, 99
>  ld (point), a
>  jp MainLoop
>DrawScreen:
>  B_CALL grbufclr  ; clear the buffer
>  ld hl, BackGround  ; get address of splash screeen
>  ld de, plotSScreen   ; get address of TI graphic buffer
>  ld bc, 756           ; set number of bytes to copy (96*(64-1)/8
>  ldir      ; copy the bytes
>  B_CALL grbufcpy  ; bind the graphic image
>
>PutIons:      ;draw ions
>  ld a, (point)    ;a = no of lines down
>  ld h, a     ;h = no of lines down
>  ld l, 17     ;l = 17 (length of string for multiply)
>  B_CALL HTimesL   ;hl = no of lines down * 17
>  ld e, l
>  ld d, h     ;de = no of lines down * 17
>  ld hl, Ions    ;hl = start point of list
>  add hl, de    ;hl = point of 1st string on screen
>  ld b, 7     ;7 strings to display (for counter)
>  ld d, 0     ;for pen column
>  ld e, 0     ;for pen row
>PutILoop:     ;loop for seven strings
>    ld a, e
>  ld (penCol), a  ;ld e(0) into pencol and d into penrow
>  ld a, d
>  ld (penRow), a  ;ld e(0) into pencol and d into penrow
>  B_CALL VPutS   ;put string to screen
>  ld a, d
>  add a, 8     ;next penrow
>  ld d, a
>  push bc
>  ld bc, 17
>  pop bc
>  add hl, bc    ;start of next string
>  djnz PutILoop   ;loop 7 times
>
>
>PutForm:      ;draw formulas
>  ld a, (point)   ;a = no of lines down
>  ld h, a     ;h = no of lines down
>  ld l, 11     ;l = 11 (length of string for multiply)
>  B_CALL HTimesL   ;hl = no of lines down * 11
>  ld e, l
>  ld d, h     ;de = no of lines down * 11
>  ld hl, Formulas  ;hl = start point of list
>  add hl, de    ;hl = point of 1st string on screen
>  ld b, 7     ;7 strings to display (for counter)
>  ld d, 58     ;for pen column
>  ld e, 0     ;for pen row
>PutFLoop:     ;loop for seven strings
>  ld (penCol), de  ;ld e(0) into pencol and d into penrow
>  B_CALL VPutS   ;put string to screen
>  ld a, e
>  add a, 8     ;next penrow
>  ld e, a
>  push bc
>  ld bc, 17
>  pop bc
>  add hl, bc    ;start of next string
>  djnz PutFLoop   ;loop 7 times
>  ret      ;return to main loop
>
>point:      ;where in the list it is at
>  db  0
>
>Ions:         ;list of ions
>  db "                ",0
>  db "                ",0
>  db "                ",0
>  db "Acetate         ",0
>  db "Aluminum        ",0
>  db "Amide           ",0
>  db "Ammonium        ",0
>  db "Antimony (3,5)  ",0
>  db "Arsenate,ortho- ",0
>  db "Arsenic (III,V) ",0
>  db "Arsenite        ",0
>  db "Barium          ",0
>  db "Benzoate        ",0
>  db "Beryllium       ",0
>  db "Bicarbonate     ",0
>  db "Bismuth         ",0
>  db "Bisulfate       ",0
>  db "Borate          ",0
>  db "Boron           ",0
>  db "Bromate         ",0
>  db "Bromide         ",0
>  db "Cadmium         ",0
>  db "Calcium         ",0
>  db "Carbonate       ",0
>  db "Cerium (III,IV) ",0
>  db "Cesium          ",0
>  db "Chlorate        ",0
>  db "Chlorate, Per-  ",0
>  db "Chloride        ",0
>  db "Chlorite        ",0
>  db "Chlorite, Hypo- ",0
>  db "Chromate        ",0
>  db "Chromate, Di-   ",0
>  db "Chromium(2,3)   ",0
>  db "Citrate         ",0
>  db "Cobalt (II,III) ",0
>  db "Copper (II)     ",0
>  db "Cyanate         ",0
>  db "Cyanide         ",0
>  db "Diammine slvr(l)",0
>  db "Di-H phosphate  ",0
>  db "Fluoride        ",0
>  db "Formate         ",0
>  db "Gold (I,III)    ",0
>  db "6x cyanoferrate ",0
>  db "6x-cy-frate(3)  ",0
>  db "Hydride         ",0
>  db "Hydrogen        ",0
>  db "H - carbonate   ",0
>  db "H - phosphate   ",0
>  db "H - sulfate     ",0
>  db "H - sulfite     ",0
>  db "Hydroxide       ",0
>  db "Iodate          ",0
>  db "Iodide          ",0
>  db "Iron (II,III)   ",0
>  db "Lead (II,IV)    ",0
>  db "Lithium         ",0
>  db "Magnesium       ",0
>  db "Manganate       ",0
>  db "Manganate, Per- ",0
>  db "Mnganese(1,4,7) ",0
>  db "Mercury (I)     ",0
>  db "Mercury (II)    ",0
>  db "Molybdate       ",0
>  db "Molybdenum(2 6) ",0
>  db "Nickel          ",0
>  db "Nitrate         ",0
>  db "Nitride         ",0
>  db "Nitrite         ",0
>  db "Oxalate         ",0
>  db "Oxide           ",0
>  db "Oxide, Per-     ",0
>  db "Perchlorate     ",0
>  db "Phosphate       ",0
>  db "Phsphate, Hypo- ",0
>  db "Phsphate, Meta- ",0
>  db "Phsphate, Ortho-",0
>  db "Phsphate, Pyro- ",0
>  db "Phosphide       ",0
>  db "Phsphite, Hypo- ",0
>  db "Phsphite, Ortho-",0
>  db "Platinum(2,4)   ",0
>  db "Potassium       ",0
>  db "Propionate      ",0
>  db "Selenide        ",0
>  db "Selenite        ",0
>  db "Silicate, Meta- ",0
>  db "Silicate, Ortho-",0
>  db "Silver          ",0
>  db "Sodium          ",0
>  db "Strontium       ",0
>  db "Sulfate         ",0
>  db "Sulfide         ",0
>  db "Sulfite         ",0
>  db "Tartarate       ",0
>  db "Telluride       ",0
>  db "Thallium (I,III)",0
>  db "Thiocyanate     ",0
>  db "Thiosulfate     ",0
>  db "Tin (II,IV)     ",0
>  db "Titanium(1,3,4) ",0
>  db "Zinc            ",0
>  db "Zirconium(134)  ",0
>  db "                ",0
>  db "                ",0
>  db "                ",0
>Formulas:       ;list of formulas
>  db "          ",0
>  db "          ",0
>  db "          ",0
>  db "C2H3O2 -1 ",0
>  db "Al +3     ",0
>  db "NH2 -1    ",0
>  db "NH4 +1    ",0
>  db "Sb +1     ",0
>  db "AsO4 -3   ",0
>  db "As +1     ",0
>  db "AsO3 -3   ",0
>  db "Ba +2     ",0
>  db "C7H5O2 -1 ",0
>  db "Be +2     ",0
>  db "HCO3 -1   ",0
>  db "Bi +3     ",0
>  db "HSO4 -1   ",0
>  db "BO3 -3    ",0
>  db "B +3      ",0
>  db "BrO3 -1   ",0
>  db "Br -1     ",0
>  db "Cd +2     ",0
>  db "Ca +2     ",0
>  db "CO3 -2    ",0
>  db "Ce +1     ",0
>  db "Cs +1     ",0
>  db "ClO3 -1   ",0
>  db "ClO4 -1   ",0
>  db "Cl -1     ",0
>  db "ClO2 -1   ",0
>  db "ClO -1    ",0
>  db "CrO4 -2   ",0
>  db "Cr2O7 -2  ",0
>  db "Cr +1     ",0
>  db "C6H5O7 -1 ",0
>  db "Co +1     ",0
>  db "Cu +1     ",0
>  db "OCN -1    ",0
>  db "CN -1     ",0
>  db "Ag(NH3)2+1",0
>  db "H2PO4 -1  ",0
>  db "F -1      ",0
>  db "CHO2 -1   ",0
>  db "Au +1     ",0
>  db "Fe(CN)6 -4",0
>  db "Fe(CN)6 -3",0
>  db "H -1      ",0
>  db "H +1      ",0
>  db "HCO3 -1   ",0
>  db "HPO4 -2   ",0
>  db "HSO4 -1   ",0
>  db "HSO3 -1   ",0
>  db "OH -1     ",0
>  db "IO3 -1    ",0
>  db "I -1      ",0
>  db "Fe +1     ",0
>  db "Pb +1     ",0
>  db "Li +1     ",0
>  db "Mg +2     ",0
>  db "MnO3 -2   ",0
>  db "MnO4 -1   ",0
>  db "Mn +2     ",0
>  db "Hg +2     ",0
>  db "Hg +2     ",0
>  db "MoO4 -2   ",0
>  db "Mo +1     ",0
>  db "Ni +2     ",0
>  db "NO3 -1    ",0
>  db "N3 -3     ",0
>  db "NO2 -1    ",0
>  db "C2O4 -2   ",0
>  db "O -2      ",0
>  db "O2 -2     ",0
>  db "ClO4 -1   ",0
>  db "PO4 -3    ",0
>  db "P2O6 -4   ",0
>  db "PO3 -1    ",0
>  db "PO4 -3    ",0
>  db "P2O7 -4   ",0
>  db "P -3      ",0
>  db "H2PO2 -1  ",0
>  db "PO3 -3    ",0
>  db "Pt +1     ",0
>  db "K +1      ",0
>  db "C3H5O2 -1 ",0
>  db "Se -2     ",0
>  db "SeO3 -2   ",0
>  db "SiO3 -2   ",0
>  db "SiO4 -2   ",0
>  db "Ag +1     ",0
>  db "Na +1     ",0
>  db "Sr +2     ",0
>  db "SO4 -2    ",0
>  db "S -2      ",0
>  db "SO3 -2    ",0
>  db "C4H4O6 -2 ",0
>  db "Te -2     ",0
>  db "Tl +1     ",0
>  db "SCN -1    ",0
>  db "S2O3 -2   ",0
>  db "Sn +1     ",0
>  db "Ti +1     ",0
>  db "Zn +2     ",0
>  db "Zr +1     ",0
>  db "          ",0
>  db "          ",0
>  db "          ",0
>BackGround:
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 255,255,255,255,255,255,255,255,255,255,255,255
>  db 0,0,0,0,0,0,0,128,0,0,0,0
>  db 0,0,0,0,0,0,0,128,0,0,0,0
>  db 0,0,0,0,0,0,0,128,0,0,0,0
>  db 0,0,0,0,0,0,0,128,0,0,0,0
>  db 0,0,0,0,0,0,0,128,0,0,0,0
>  db 0,0,0,0,0,0,0,128,0,0,0,0
>  db 0,0,0,0,0,0,0,128,0,0,0,0
>  db 255,255,255,255,255,255,255,255,255,255,255,255
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 0,0,0,0,0,0,0,0,0,0,0,0
>  db 127,255,255,255,255,199,255,255,255,255,255,254
>  db 222,221,255,255,94,238,252,123,255,253,250,247
>  db 142,201,181,179,114,109,127,122,165,159,59,147
>  db 222,213,85,87,86,236,70,234,170,173,90,183
>  db 220,93,85,59,90,237,125,234,170,157,90,215
>  db 222,221,187,147,83,109,124,98,46,189,90,155
>  db 127,255,255,255,255,199,255,255,255,255,255,254
>
>
>Martin Smithsmity42@yahoo.com
>
>
>---------------------------------
>Do You Yahoo!?
>Send FREE Valentine eCards with Yahoo! Greetings!
>
>




Signed by...
_______  .__             .__
\      \ |__| ____  ____ |  | _____    ______
/   |   \|  |/ ___\/  _ \|  | \__  \  /  ___/
/    |    \  \  \__(  <_> )  |__/ __ \_\___ \
\____|__  /__|\___  >____/|____(____  /____  >
        \/        \/                \/     \/


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.