4Fermer6
deephLe 22/02/2013 à 18:14
Oui mais c'est un peu contraignant pour l'utilisateur qu'on "empiète" sur les saferams, non ? Moi je verrai ça comme ça : l'utilisateur met dans un registre 16-bit l'adresse du buffer où la routine doit décompresser la sprite et dans un autre l'adresse du sprite (dont le premier octet est la taille du sprite), et la routine se charge du reste. Ensuite une autre routine permettrai d'afficher la sprite à partir de l'adresse d'un buffer quelconque, de sa largeur et de sa hauteur.

Comme ça ça ne limite pas les utilisateurs à 256 sprites.
chickendude (./4) :
Ou si tu ne demandais que comment savoir où décompresser les sprites, on peut avoir deux octets dans saferam qui contiennent l'adresse du buffer, si on veux la changer on n'a qu'y écrire la nouvelle adresse.

Autant demander l'adresse du buffer à chaque fois avec hl, de, bc ou af, non ?

edit : une version sans appvar :
zshell.z80
.nolist ;#include "ti84pcse.inc" #include "ti83p.inc" ; only for debug .list .org $4000 .db $80,$0f,$00,$00,$00,$00 ; program length = 0 .db $80,$12,$01,$04 ; program type = shareware for TI 83+ .db $80,$21,$01 ; app id = 1 .db $80,$31,$01 ; app build # = 1 .db $80,$48, "zSHELL " ; app name (must be 8 bytes long) .db $80,$81,$01 ; app page = 1 .db $80,$90 ; no default splash screen .db $03,$26,$09,$04,$04,$06f,$1b,$80 ; date stamp = 5/12/1999 .db $02,$0d,$40 ; encrypted TI date stamp signature .db $a1,$6b,$99,$f6,$59,$bc,$67 .db $f5,$85,$9c,$09,$6c,$0f,$b4,$03,$9b,$c9 .db $03,$32,$2c,$e0,$03,$20,$e3,$2c,$f4,$2d .db $73,$b4,$27,$c4,$a0,$72,$54,$b9,$ea,$7c .db $3b,$aa,$16,$f6,$77,$83,$7a,$ee,$1a,$d4 .db $42,$4c,$6b,$8b,$13,$1f,$bb,$93,$8b,$fc .db $19,$1c,$3c,$ec,$4d,$e5,$75 .db $80,$7f,$00,$00,$00,$00 ; program image length = 0 .dw $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 ; padding (header length must be 128 bytes long) start: di ; disable interrupts (todo : check which bcall may resume them) bcall(_clrlcdfull) ; clear screen bcall(_indicatoroff) ; disable run indicator bcall(_cleargbuf) ; clear graph buffer res texterasebelow,(iy+textflags) ; reset some textflags res textinverse,(iy+textflags) ; reset some textflags ld hl,$0501 ld (currow),hl ld hl,zshell_string call iputs bit parserhookactive,(iy+hookflags4) jr z,install_zshell ; no current hook ;in a,(pmpagea) ;ld hl,parserhookptr+2 ;cp (hl) ;jr nz,quit ; zshell hook already exists uninstall_zshell: ; todo : ask to destroy/chain current hooks or uninstall zshell hook bcall(_disableparserhook) ld hl,$0003 ld (currow),hl ld hl,uninstalling_string call iputs bcall(_getkey) bcall(_jforcecmdnochar) install_zshell: ld hl,zshell_hook ; put hook adress into hl in a,(pmpagea) ; put page # into a bcall(_setparserhook) ; install hook ld hl,$0003 ld (currow),hl ld hl,installing_string call iputs bcall(_getkey) quit: ; todo : ask for destroying or chaining it bcall(_jforcecmdnochar) ; quit the app iputs: ld a,(hl) or a ret z bcall(_putc) inc hl jr iputs zshell_hook: .db $83 ; used by os for hook safety check (add a,e can be used too) or a jr z,zshell_hook_start ; we just want to handle prgm, not TI-Basic functions exit_zshell_hook: xor a ret zshell_hook_start: ;ld a,(parse_var) ; check the currently executed program type ;cp protprogobj ;jr nz,hook_return_nz ;ld hl,parse_var ;rst rmov9toop1 ;bcall(_chkfindsym) ;ex de,hl ;ld a,(parse_var+1) ;cp '#' ;jr nz,exit_zshell_hook run_program: ld hl,test_str call iputs hook_return_nz: or $80 ; reset zero flag, the parser can't continue to parse the variable ret test_str: .db "test",0 zshell_string: .db "zSHELL",0 installing_string: .db "zSHELL has been installed",0 uninstalling_string: .db "zSHELL has been uninstalled",0 .end

Pour l'instant lancer l'app "toggle" l'installation du hook (qui ne fait rien d'autre à part afficher "test" lorsqu'on exécute une fonction).