Author |
Message |
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 16 Sep 2008 06:07:46 pm Post subject: |
|
|
Okay, this is a new progress/help thread for the game. Unlike the other topic, this one is strictly dealing with the efforts to port the existing game over to the TI-83+ series, TI-84+ series, and possibly widescreen calculators such as the TI-86 on a later date. The progress list here includes a few important benchmarks that will map out how far along the 83+/84+ version is coming.
FlashApp Version Progress....
[●] Initial "Hello World" Flash App
[●] Multipage "Hello World"
[●] Grayscale Main screen added
[●] Porting of the main screen
[●] Porting of the Sprite routine
[●] Porting of the Tilemapper
[●] First working tilemap with physics & collisions
[●] Clock rate & Frame Rate compensation
[●] In-game text/dialogs support
[●] Flash version "caught up" to 82 version
[●] Porting of the Savegame creator & loader
[●] On-Calc test of flash version
[●] First Stadium City tilemap completion [Skipped]
[●] Postcards added [Skipped]
[●] Look into 82<->83 savegame conversion [Skipped]
----------------------------------------------------------------------
<span style='font-size:14pt;line-height:100%'>Multipage "Hello World"</span>
Okay, so here's where we are.. The furthest I got in the FlashApp tutorials last year was a single-page "Hello World" app, so the 1-page stuff is pretty much moot by now. What I'm trying to do now is have the code in the 1st page read a string from a 2nd or 3rd page and print "hello" across the screen. Since the game's main loop will have to recall text, sprites and other data from outside pages, I want to make sure I know how to do this. Where do I start?
Also, how exactly does the calc do this? When you run an App, is it executing code straight from flash, or does it move it to user RAM first?
By the way....I have Spasm and TASM for assemblers and PindurTI, WabbitEmu, and VTI for emulation.
Last edited by Guest on 29 May 2010 10:06:11 pm; edited 1 time in total |
|
Back to top |
|
|
asdf
Advanced Newbie
Joined: 17 Aug 2008 Posts: 73
|
Posted: 16 Sep 2008 06:59:23 pm Post subject: |
|
|
It is running the code directly from FLASH (which is why you can't use SMC). From what i understand, when you switch pages, it swaps the page you are currently on out, and swaps the page you are trying to access in. To access information on another page, the two ways i can think of to handle that data is to either have a function on that page which loads it into saferam/buffer or have the code which utilizes it on that same page. |
|
Back to top |
|
|
tr1p1ea
Elite
Joined: 03 Aug 2003 Posts: 870
|
Posted: 16 Sep 2008 07:49:54 pm Post subject: |
|
|
"Hello World Complete."
Next stage ... Preparing.
An easy way to access data from any page is to store some of your routines in RAM and have them swap pages around as required. You could either store info about what page data (like a string for example) lies on in registers before calling or you could arrange it so that all instances of a specific data type reside on the same page (all strings on page1 etc). You should be able to fit your tilemapper and sprite routines in common saferam areas easily enough. As for buffers, you might have to use _insertMem or create a temporary appVar at runtime. |
|
Back to top |
|
|
Spencer
Advanced Newbie
Joined: 06 Nov 2005 Posts: 99
|
Posted: 16 Sep 2008 09:16:14 pm Post subject: |
|
|
Draw everything on page 2 (or 3 if you are a winner)
Likewise store your strings on the same page as your text routines. For the most part you shouldn't have to jockey data around into RAM |
|
Back to top |
|
|
luby I want to go back to Philmont!!
Calc Guru
Joined: 23 Apr 2006 Posts: 1477
|
Posted: 17 Sep 2008 07:19:10 am Post subject: |
|
|
Flash2Ram would be useful if you want to copy things from your app into ram for easier access. However, you need to know what pages your app are on so, in a,(6) is your friend. |
|
Back to top |
|
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 17 Sep 2008 11:54:42 am Post subject: |
|
|
Speaking of InsertMem, where is the best reference for ROM Calls and Saferam locations?
[edit] Well, I just now "discovered" the InsertMemNoUpdateVAT via the Wikiti page. What exactly does InsertMem do? Is it just setting aside space in the userRAM to where it won't overlap with a program?
Last edited by Guest on 17 Sep 2008 03:15:11 pm; edited 1 time in total |
|
Back to top |
|
|
Iambian
Advanced Member
Joined: 13 Mar 2004 Posts: 423
|
Posted: 17 Sep 2008 06:19:55 pm Post subject: |
|
|
DigiTan wrote: Speaking of InsertMem, where is the best reference for ROM Calls and Saferam locations?
[edit] Well, I just now "discovered" the InsertMemNoUpdateVAT via the Wikiti page. What exactly does InsertMem do? Is it just setting aside space in the userRAM to where it won't overlap with a program?
[post="126959"]<{POST_SNAPBACK}>[/post]
To answer your first question, the SDK's guide found on TI's site would be the place to start for both romcalls and saferam locations, but the WikiTI page regarding those contains more information about saferam. As for those lesser known romcalls, you can look at the WikiTI page as well.
If you want just romcalls and you don't want to look through the internet for the SDK, you can find the romcall reference here: http://education.ti.com/guidebooks/sdk/83p...sysroutines.pdf
For your next question, yeah, that's what InsertMem does, but you have to be careful when you do that. In order to prevent any memory leaks, ensure that few if any variables are being created, destroyed, or resized while you're using that memory, and when you're done, use the DelMem call on the same spot you used InsertMem.
There are exceptions to that, but to play it safe, that's what you'd want to do. If you wanted to play it even safer, create a variable and then manually resize it by calling InsertMem/DelMem on its data location. TI's SDK has information on that, but if you choose not to read it, make sure that, first, the variable is unarchived, second, the variable you insert memory into does not occur at its size bytes but at the byte after those, and finally, that you actually have enough RAM to do the insertion; InsertMem assumes that the RAM is available and makes no checks to make sure. After you insert that memory, then you'll have to change the size bytes in the variable to reflect the amount of memory you've inserted. Same for using DelMem to remove that RAM after you're done. The advantage of this approach is that the memory that you have is safe and if you want to recall it after other variables in memory have been moved around, you can perform a ChkFindSym on that variable to find its address again.
[EDIT] For the first part of your second statement/question, I don't think it's a very wise idea to use InsertMemNoVATUpdate for obvious reasons regarding the VAT. You can still use it if you don't plan on moving variables around the calculator for the duration of that memory's use, but you still have to be aware of the remaining RAM since I'd assume that the routine also assumes that the RAM is available, whether or not it actually is.
Last edited by Guest on 17 Sep 2008 06:22:27 pm; edited 1 time in total |
|
Back to top |
|
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 17 Sep 2008 11:55:11 pm Post subject: |
|
|
Okay, I was starting to think InsertMem and InsertMemNoVATUpdate might be the same thing.
Maybe I'd better not dismiss the "Hello World" benchmark so soon. I assembled this code (cut-n-pasted from a devpack) and uploaded it to WabbitEmu. I can see the App in the PGRMs menu, but when I press the "Apps" button, I don't see my app. Where'd it go?
Also Spasm said my program doesn't begin with $BB,$6D or something along those lines. Is this okay for non-RAM programs.
Code: ;---------PAGE 1-------------
.org $4000
#define bcall(xxxx) rst 28h \ .dw xxxx
#define bjump(label) call 50h \ .dw label
_ClrLCDFull .equ 4540h
_GetKey .equ 4972h
_JForceCmdNoChar .equ 4027h
_PutC .equ 4504h
curRow .equ 844Bh
.db $80,$0F ;Field: Program length
.db 0,0,0,0 ;--altered by wabbitsign
.db $80,$12 ;Field: Program type
.db $01,$04 ;--MUST BE FREE
.db $80,$21 ;Field: App ID
.db $01
.db $80,$31 ;Field: App Build
.db $01
.db $80,$48 ;Field: App Name
.db "MY APP "
.db $80,$81 ;Field: App Pages
.db $03 ;--altered by wabbitsign
.db $80,$90 ;No default splash screen
.db $03,$26,$09,$04,$04,$6f,$1b,$80,$02,$0d,$40,$a1
.db $6b,$99,$f6,$59,$bc,$67,$f5,$85,$9c,$09,$6c,$0f
.db $b4,$03,$9b,$c9,$03,$32,$2c,$e0,$03,$20,$e3,$2c
.db $f4,$2d,$73,$b4,$27,$c4,$a0,$72,$54,$b9,$ea,$7c
.db $3b,$aa,$16,$f6,$77,$83,$7a,$ee,$1a,$d4,$42,$4c
.db $6b,$8b,$13,$1f,$bb,$93,$8b,$fc,$19,$1c,$3c,$ec
.db $4d,$e5,$75
.db $80,$7F
.dw 0,0,0,0,0,0,0,0,0,0
Start:
bcall(_ClrLCDFull)
ld de,0
ld (curRow),de
ld hl,Text
call appputs
bcall(_GetKey)
bjump(_JForceCmdNoChar)
appputs:
ld a,(hl)
inc hl
or a
ret z
bcall(_PutC)
jr appputs
Text:
.db "Hello World!",0
.block $8000-$ ;fill remaining data
;---------PAGE 2-------------
.org $4000
xor a
ret
;some more code
.block $8000-$ ;fill remaining data
;---------PAGE 3-------------
.org $4000
ld a,3
ld c,a
ret
Last edited by Guest on 18 Sep 2008 12:00:04 am; edited 1 time in total |
|
Back to top |
|
|
tr1p1ea
Elite
Joined: 03 Aug 2003 Posts: 870
|
Posted: 18 Sep 2008 05:28:06 am Post subject: |
|
|
Well if its complaining like that then it doesnt think you're trying to make an app, and its linked it as a program instead of sigining it n stuff .
have you thought about using Latenite/BRASS at all? Apps are very easy with that package.
Last edited by Guest on 18 Sep 2008 05:30:25 am; edited 1 time in total |
|
Back to top |
|
|
asdf
Advanced Newbie
Joined: 17 Aug 2008 Posts: 73
|
Posted: 18 Sep 2008 07:20:08 am Post subject: |
|
|
Hmm.. it compiled/ran fine for me. It sounds like you are using Wabbit, in which case make sure that you are supplying the correct arguments:
wabbit app.bin app.8xk (or app.hex app.8xk)
It sounds like it is trying to output to app.8xp, in which case it will give that .db $BB,$6D warning. If you are using Burntfuse's IDE, make sure the "Settings » Output Format" is set to 83+ Application. Btw, the .db $BB,$6D at the start of 83+ programs is the AsmPrgm token for running programs from the homescreen. Flash applications don't need this. |
|
Back to top |
|
|
Spencer
Advanced Newbie
Joined: 06 Nov 2005 Posts: 99
|
Posted: 18 Sep 2008 08:15:05 am Post subject: |
|
|
Code: #include app.inc
#include ti83plus.inc
;---------PAGE 1-------------
defpage(0, "MY APP")
Start:
bcall(_ClrLCDFull)
ld de,0
ld (curRow),de
ld hl,Text
call appputs
bcall(_GetKey)
bjump(_JForceCmdNoChar)
appputs:
ld a,(hl)
inc hl
or a
ret z
bcall(_PutC)
jr appputs
;---------PAGE 2-------------
defpage(1)
xor a
ret
;---------PAGE 3-------------
defpage(2)
ld a,3
ld c,a
ret
validate()
http://group.revsoft.org/app.inc
http://group.revsoft.org/ti83plus.inc |
|
Back to top |
|
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 18 Sep 2008 05:11:11 pm Post subject: |
|
|
Okay, say I have the executable stuff in page 1, and the strings "Hello" & "World" strings in pages 2 and 3. Would moving those strings to a saferam be as simple as a LDIR? Or is there a ROM call for that? |
|
Back to top |
|
|
Cryzbl
Newbie
Joined: 20 Jun 2008 Posts: 46
|
Posted: 18 Sep 2008 05:49:33 pm Post subject: |
|
|
DigiTan wrote: Okay, say I have the executable stuff in page 1, and the strings "Hello" & "World" strings in pages 2 and 3. Would moving those strings to a saferam be as simple as a LDIR? Or is there a ROM call for that?
[post="127004"]<{POST_SNAPBACK}>[/post]
Just move 'em. Rom call would be overkill. It does, however, abstract the ports required to show that page if you care. |
|
Back to top |
|
|
Liazon title goes here
Bandwidth Hog
Joined: 01 Nov 2005 Posts: 2007
|
Posted: 18 Sep 2008 10:27:11 pm Post subject: |
|
|
didn't even realize there was a noupdatevat version of insertmem.
keep up the good work Digi!! |
|
Back to top |
|
|
brandonw
Advanced Member
Joined: 12 Jan 2007 Posts: 455
|
Posted: 19 Sep 2008 12:29:41 am Post subject: |
|
|
Liazon wrote: didn't even realize there was a noupdatevat version of insertmem.
[post="127037"]<{POST_SNAPBACK}>[/post]
It's very typical of TI to make BCALLs out of subroutines from their bigger entry points. That's good for us, though...take Arc_Unarc for example. By itself it archives a variable if it's unarchived and vice versa, but it does all sorts of checks to make sure you don't unarchive something you shouldn't or archive something you shouldn't. The subroutines _ArchiveVar and _UnarchiveVar don't do any checks, so you can do some nifty stuff like create group variables in RAM and then "archive" them. |
|
Back to top |
|
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 19 Sep 2008 12:44:52 pm Post subject: |
|
|
Okay, I tried assembling and I got 3 warnings and an error. The error is in my benchmark prog at the "defpage()" argument.
app.inc: line 69 - [WARNING] Ignoring content after macro arguments
Code: #macro
(several lines of defpage macro code)
#endmacro
ti83plus.inc: line 1 - [WARNING] Listing not implemented
Code: .nolist
ti83plus.inc: line 3893 - [WARNING] Listing not implemented
Code: .list
bench.asm: line 4 - [ERR] Can't figure out this line
Code: defpage(0,"MY APP ")
I'm guessing the "ignoring content after macro" is why it's not recognizing the defpage() statements. |
|
Back to top |
|
|
Spencer
Advanced Newbie
Joined: 06 Nov 2005 Posts: 99
|
Posted: 19 Sep 2008 01:27:45 pm Post subject: |
|
|
You are probably still using a really early alpha build of spasm2. Get the new one here:
http://group.revsoft.org/spasm.exe
or you can always check out the svn and build yourself.
Make sure you are using the app.inc on group.revsoft.org, it has been updated to work with spasm and spasm2.
Also about this: Code: defpage(0,"MY APP ") You don't have to pad it, the macro will do it for you. |
|
Back to top |
|
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 19 Sep 2008 11:01:34 pm Post subject: |
|
|
Okay, this time it assembled. But it's doing that thing again where I can't find it in the apps menu. Or in MirageOS. But it is in the PRGMs menu. Did I leave something out?
Last edited by Guest on 19 Sep 2008 11:15:19 pm; edited 1 time in total |
|
Back to top |
|
|
tr1p1ea
Elite
Joined: 03 Aug 2003 Posts: 870
|
Posted: 19 Sep 2008 11:25:37 pm Post subject: |
|
|
So wait, is the assembler+signer/linker giving you an 8xk or an 8xp? |
|
Back to top |
|
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 20 Sep 2008 12:50:12 am Post subject: |
|
|
D'oh! So there's an 8xp and 8xk?
Yeah, that fixed it. It can print text stored within page 0. Now I just gotta get it to print text that came from the other pages.
[edit]
I tried this code and it assembles fine, but I get 5 symbols instead of "Hello." FlashToRam is copying something, but not the right text.
Code: #include "app.inc"
#include "ti83plus.inc"
;---------PAGE 1-------------
defpage(0, "MY APP")
Start:
bcall(_ClrLCDFull) ; Clear screen
;---Do Flash->RAM Transfer-------
ld a,(MemPageAPort) ; Gets current page?
inc a
ld hl,txt_hello ; HL = Offset of source
ld de,PlotSScreen+200 ; DE = Somewhere in Graphics mem
ld bc,6 ; BC = Total bytes to copy
bcall(_FlashToRam) ; Copy flash data to random RAM address
;---Print Page 2's string--------
ld de,0 ; Text to Top left corner
ld (curRow),de
ld hl,PlotSScreen+200
call appputs ; App's version of
bcall(_GetKey)
bjump(_JForceCmdNoChar)
appputs:
ld a,(hl)
inc hl
or a
ret z
bcall(_PutC)
jr appputs
;---------PAGE 2-------------
defpage(1)
xor a
ret
txt_hello:
.db "Hello",0 ; size: 6
;---------PAGE 3-------------
defpage(2)
ld a,3
ld c,a
ret
validate()
Last edited by Guest on 20 Sep 2008 10:51:16 am; edited 1 time in total |
|
Back to top |
|
|
|