0 Members and 2 Guests are viewing this topic.
Also, for copying code to RAM, how do I get spasm to compute jp addresses as if they were for that RAM? If I don't, the addresses would still point flash, which would not work.
Quote from: fb39ca4 on December 13, 2013, 10:46:44 pmAlso, for copying code to RAM, how do I get spasm to compute jp addresses as if they were for that RAM? If I don't, the addresses would still point flash, which would not work.Just add another .org before the RAM code.
You must not think of flash and RAM as two separate memories. Memory $0000-$7FFF is flash, and $8000-$FFFF is RAM.To make a flash page available, just write its number to port 6 to put it in $4000-$7FFF, and port 5 to put it in $0000-$3FFF (a flash page is 16384 = $3FFF bytes).When code of an app is executed, all addresses between $4000 and $7FFF refers to its own code (since it always takes one full page), so if you want to copy something in RAM, only a ldir instruction is enough.
Well, I guess this should be written somewhere in your app when it's compiled. Then all you'll have to do is get that number and output it to port 6 from RAM.
When your application starts, read the value of port 6, which dictates which page of physical flash the base page of your app resides on. Subsequent pages of your app extend downwards in physical page numbers.
Pass one...Pass two...-----------------------------------------------Beginning APP "MyApp", courtesy of SPASM macros-----------------------------------------------(error)Warning: Skipping page 1 at user request.Page 0 free space: 14895(error)Warning: Skipping page 2 at user request.Page 1 free space: 131Page 2 free space: 144Success: Page sizes validated and "MyApp" is ready for signing. In 3 page(s), 15170 bytes are available.DoneAssembly time: 0.036 seconds
#include "ti83plus.inc"#include "app.inc"defpage(0, "MyApp")[code goes here]#include "pageinc.asm"validate()
#include "page01.asm"#include "page02.asm"#include "page03.asm"[and so on...]
defpage(1).db [data goes here]
#include "pc/redefs.inc"#define main_build#include "pc/defs.inc"#include "pc/app.inc"#define getpagenum(label) label>>16#define cpcall(label) call XPC \ .dw label \ .db getpagenum(label)#define cpjump(label) call XPJ \ .db getpagenum(label) \ .dw label#define loadslot(xx,lbl) call LSL \ .db xx*3 \ .dw lbl \ .db getpagenum(lbl)#DEFINE CLSB(xx) $000000FF&(xx)#DEFINE CMSB(xx) ($0000FF00&xx)>>8#DEFINE MENU_SCREEN_WIDTH 12;-----------------------------------------------------------------------------;DEFINE AREA FOR DEBUGGING PURPOSES. UNCOMMENT TO ALLOW FOR EASIER WORK.;Bypasses menu on app startup into game mode. To change the parameters of;what you're starting up with, check in p0\_0.z80 and search for the define.#DEFINE CADAN_MENUBYPASS;If you're using CADAN_MENUBYPASS, uncomment one of these defines below to;SELECT YOUR CHARACTER automatically.;#DEFINE CADAN_MENUBYPASS_CHARSEL %00000001 ;DevBlock#DEFINE CADAN_MENUBYPASS_CHARSEL %00000010 ;Iambian;#DEFINE CADAN_MENUBYPASS_CHARSEL %00000100 ;Netham45 (spork);#DEFINE CADAN_MENUBYPASS_CHARSEL %00001000 ;Placeholder;#DEFINE CADAN_MENUBYPASS_CHARSEL %00010000 ;Placeholder;#DEFINE CADAN_MENUBYPASS_CHARSEL %00100000 ;Nanami;#DEFINE CADAN_MENUBYPASS_CHARSEL %01000000 ;Netham45 (lobster);#DEFINE CADAN_MENUBYPASS_CHARSEL %10000000 ;Placeholder;Automatically sets hexadecimal mode in-game. Also, changes output to the;scoreboard from curscore to the 4 bytes in scoredebug. Yus.;#DEFINE CADAN_AUTOSCOREDEBUG;-----------------------------------------------------------------------------;=============================================================================defpage(0, "CaDan v2") ;======================================================;;This project is dedicated to my beloved Etri, the Catgirl o' Nine Tails, who;understood me and my desire to extract Red Kool-Aid from all of humanity.;;Coding of the Calculator Danmaku Project was done as a collaborative effort;;Primary coding and planning: Rodger Weisman (Iambian Zenith);Code and script build, test: Timothy (Geekboy);Big time code optimization : "calc84maniac";.echo "------------------"#include "p0/_0.z80"#include "p0/xpage.z80" ;RAM routines held here#include "p0/lib_menu.z80" ;Menu library routines and their supporters#include "p0/lib_txtr.z80" ;text display library routines#include "p0/lib_grfx.z80" ;menu graphics library#include "p0/lib_dcmp.z80" ;decompression library#include "p0/lib_scor.z80" ;score handler libraryMenuGraphicsData: ;menu graphical data. Read tables from this address#include "gfxdat/build/imenu.z80"MenuExecData:#include "gfxdat/build/smenu.z80"MenuTextData:#include "gfxdat/build/tmenu.z80".echo "Space before 7000: ",$7000-$," out of 14366".block $7800-($&$0000FFFF) ;Making room for page-aligned font tables#include "p0/dat_font.z80" ;font, kerning, and ASCII translation data#include "p0/dat/dat_minm.z80" ;danmaku mode mini menu. No more than 213 bytes.echo "------------------";=============================================================================defpage(1) ;=================================================================.echo "------------------"#include "p1/LUTables.z80" ;must not exceed 256 bytes. Page-aligned lookup table.block $4100-($&$0000FFFF)#include "p1/_1.z80" ;interrupt, initialization and tasking routines#include "p1/lib_reso.z80" ;Resource table handlers#include "p1/lib_scrn.z80" ;All LCD driving routines found here#include "p1/lib_shot.z80" ;Bullet system#include "p1/lib_psht.z80" ;Player bullet system. All references in here.#include "p1/lib_scpt.z80" ;Script system. Contains "dat_scpt.z80";.block $7800-($&$0000FFFF) ;### DEBUG SO SCRIPTSYS EDITS DO NOT KILL SCRIPT #include "p1/lib_sprt.z80" ;Sprite library#include "p1/lib_enmy.z80" ;Enemy table handlers and initializers#include "p1/tst_stgs.z80" ;TEST STAGES. DIRECTLY CALLED AND EXECUTED;#include "p1/lib_sldr.z80" ;Loading system. Supports script suspension.echo "------------------";=============================================================================defpage(2) ;=================================================================#include "p2/_2.z80";=============================================================================validate() ;=================================================================