0 Members and 3 Guests are viewing this topic.
; No .org is required because this contains no absolute pointers.wrapChkFindSym:; ChkFindSym(PointerToDestination, PointerToName); Inputs:; - PointerToDestination: Location to write information struct to; This struct has the form; variableStruct {byte type; byte page; word location; word VATLocation};; - PointerToName: Pointer to name. The type must be the byte before the name,; and the name must be terminated with a 0 if less than eight characters.; Output:; - Data written on success, unchanged on failure; - Returns 1 on failure, 0 on success .dw wrapChkFindSymEnd-wrapChkFindSym ; Size .db 1Fh ; Compatible with everything .db what, ever ; Token .db 1 ; Type (subroutine, regular) .db 2 ; Arguments pop bc pop de push bc push de rst 20h ; Mov9ToOP1 rst 28h .dw _ChkFindSym pop ix jr c, +_ ld hl, 1 ret_: and 1Fh ld (ix+0), a ; I'm too lazy to deal with all the register ld (ix+1), b ; swapping ld (ix+2), e ld (ix+3), d ld (ix+4), l ld (ix+5), h ld hl, 0 retwrapChkFindSym:
getCalc(PTR): Finds the object who's name is pointed to and returns a pointer to the start of its data, or zero if it was archived or not found.
.nolist#include "ti83plus.inc".list .org 0h .dw 0C0DEhwrapFlashToRam:; FlashToRam(Page, Address, Destination, Length); Block copies Length data from Page:Address to Destination. Automatically; wraps to the next page as-needed.; Inputs:; - Page, Address: Source; - Destination: Pointer to location to copy the data; - Length: Amount of data to copy .dw wrapFlashToRamEnd-wrapFlashToRam ; Size .db 1Fh ; Compatible with everything .db what, ever ; Token .db 1 ; Type (subroutine, regular) .db 4 ; Arguments ld c, l ld b, h pop ix pop de pop hl pop af push ix rst 28h .dw _FlashToRam retwrapFlashToRamEnd:; No .org is required because this contains no absolute pointers.wrapChkFindSym:; ChkFindSym(PointerToDestination, PointerToName); Returns information about a variable.; Inputs:; - PointerToDestination: Location to write information struct to; This struct has the form; variableStruct {byte type; byte page; word location; word VATLocation};; - PointerToName: Pointer to name. The type must be the byte before the name,; and the name must be terminated with a 0 if less than eight characters.; Output:; - Data written on success, unchanged on failure; - Returns 1 on failure, 0 on success .dw wrapChkFindSymEnd-wrapChkFindSym ; Size .db 1Fh ; Compatible with everything .db what, ever ; Token .db 1 ; Type (subroutine, regular) .db 2 ; Arguments ; Swap return address with destination pointer pop bc pop de push bc push de ; Call rst 20h ; Mov9ToOP1 rst 28h .dw _ChkFindSym ; Check for failure pop ix jr c, +_ ld hl, 1 ret_: ; Success! and 1Fh ld (ix+0), a ; I'm too lazy to deal with all the register ld (ix+1), b ; swapping ld (ix+2), e ld (ix+3), d ld (ix+4), l ld (ix+5), h ld hl, 0 retwrapChkFindSym:wrapLoadCIndPaged:; LoadCIndPaged(Page, Address); Reads a single byte from Page:Address.; Inputs:; - Page: Page to read from; - Address: Offset to read from; Output:; - Data byte .dw wrapLoadCIndPagedEnd-wrapLoadCIndPaged ; Size .db 1Fh ; Compatible with everything .db ; Token .db 1 ; Type (subroutine, regular) .db 2 ; Arguments pop bc pop de push bc ld b, e rst 28h .dw _LoadCIndPaged ld h, 0 ld l, c retwrapLoadCIndPaged:; LoadDEIndPaged(Page, Address); Reads a word from Page:Address.; Inputs:; - Page: Page to read from; - Address: Offset to read from; Output:; - Data word .dw wrapLoadDEIndPagedEnd-wrapLoadDEIndPaged ; Size .db 1Fh ; Compatible with everything .db ; Token .db 1 ; Type (subroutine, regular) .db 2 ; Arguments pop bc pop de push bc ld b, e rst 28h .dw _LoadCIndPaged ex de, hl retwrapLoadDEIndPaged: .dw 0
; B_CALL Axiom; expr(RegisterBlock, BCallAddress); Calls the B_CALL. The data at RegisterBlock is loaded into the registers, and; the register values returned by the B_CALL are written to RegisterBlock; RegisterBlock should have the variables in the following order: ; - If treating all as 16-bit values: AF BC DE HL; - If working with individual bytes: FA CB ED LH; IMPORTANT: REGISTERBLOCK MUST POINT TO THE END OF THE REGISTER BLOCK, NOT THE; START; This uses self-modifing code, so cannot be used from an application. .dw wrapBCALLEnd-wrapBCALL .db 0Fh .db t2ByteTok, tExpr .db 1 ; A subroutine, because B_CALLs aren't fast and might as .db 2 ; well save space; I haven't done any calculations on whether this is remotely optimal.wrapBCALL: ; Write B_CALL address .db 7Fh ; Escape load operation ld de, wrapSysCall ld a, l ld (de), a inc de ld a, h ld (de), a ; Move stack stuff pop de pop hl push de ; Now HL has the address of the data block ld a, i ; Save interrupt state push af di ; Use SP to load values ld (0FE70h), sp ; Replace with 9311h or any other obsecure memory area if desired ld sp, hl pop af pop bc pop de pop hl ld (0FE6Eh), sp ld sp, (0FE70h) ; Perform actual B_CALL rst 28hwrapSysCall: .dw 0 di ; Some B_CALLs DO mess with interrupts ; Save values using SP ld sp, (0FE6Eh) push hl push de push bc push af ld sp, (0FE70h) pop af ret po ei retwrapBCALLEnd:
:[HEXDATA]->Pic1:[MOREHEXDATA:[EVENMOREHEXDATA
Quote from: DrDnar on April 08, 2011, 02:37:24 pmIf you need to read data from the archive and don't care about speed, the OS provides several helpful routines for reading data from the archive: FlashToRam, copies an arbitrary block of data from the archive to RAM; PagedGet, used with SetupPagedPtr, lets you read and process data a byte at a time; LoadCIndPaged, reads a byte from any ROM page; and LoadDEIndPaged, reads a word from any ROM page. All of these automatically deal with wrapping, too.DrDnar: you maybe didnt see that this was in the Axe Language section. Nice explaination, though
If you need to read data from the archive and don't care about speed, the OS provides several helpful routines for reading data from the archive: FlashToRam, copies an arbitrary block of data from the archive to RAM; PagedGet, used with SetupPagedPtr, lets you read and process data a byte at a time; LoadCIndPaged, reads a byte from any ROM page; and LoadDEIndPaged, reads a word from any ROM page. All of these automatically deal with wrapping, too.
Wowowow a b_call axiom would be freakin' cool!EDIT: but very hard to create, I think...EDIT2IN10SECONDS: But 1000 times easier to use than "Asm(hex)"