RE: A85: Help! :)


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

RE: A85: Help! :)




There is a good H*L routine in the ROM.  There is also a random number 
generator in the ROM, too.  One of the bits (bit 3, I think) does not 
produce an equal number of 1's and 0's.  I have a routine to make a patch 
table of jumps for ROM, if you're interested.  I'm going to use it in my 
next shell, so that people can have their own ROM tables inside their 
programs.  Modify the routine all you want.  It could probably be 
optomized.  By the way, this is ZShell 4.0 code.

NOTE: Shell guys, you're welcome to 'steal' it if you wish.

Here it is:

#include "ti-85.h"

#DEFINE RANDOM                  call TEXT_MEM
#DEFINE MUL_HL                  call TEXT_MEM+3
        ;you can't use the first 6 bytes of the TEXT_MEM
        ;unless perhaps you don't want to use one of the ROM routines
.org 0
MenuTitle:
.db     "Patcher Thing",0

        ld HL,PatchData
        ld DE,(PROGRAM_ADDR)
        add HL,DE
        ld DE,TEXT_MEM

        CALL_(PatchROM)

        cp 'P'
        ret NZ                  ;Exit if patch didn't work

Start:
        ;Insert your own code here.
        ;You can just use 'RANDOM' and 'MUL_HL'.
        ;You don't have to call them.

PatchData:
.db     2       ;the 2 says there are 2 addresses that need to be patched
.dw     $39C2   ;rom 10.0
.dw     $261B

.dw     $39A7   ;rom 9.0
.dw     $2601

.dw     $39EF   ;rom 8.0
.dw     $2656

.dw     $39EB   ;rom 4.0/5.0/6.0
.dw     $2652

.dw     $39E8   ;rom 3.0A
.dw     $264E


;input: DE-> destination address
;       HL-> patch data
;Return:DE-> byte after last patch
;       HL-> byte after last piece of patched data
;       A='I' if incompatible ROM version
;       A='P' if successful patch
PatchROM:
        push DE                 ;save destination address

        ld A,(ROM_VERS)         ;MUST be ZShell 4.0 compatible shell
	ld C,A

	ld E,0

CheckROM:
	cp $35
	jr Z,Found

	inc E
	cp $91
	jr Z,Found

	inc E
	cp $97
	jr Z,Found

	inc E
	cp $3D
	jr Z,Found

	cp $8E
	jr Z,Found

        cp $5E
        jr Z,Found

	inc E
	cp $57
	jr Z,Found

Error3:			;error if no correct ROM version
        ld A,'I'
        ret

Found:
	ld B,(HL)
	inc HL

	push BC

        xor A

        sla E

MulEB:
	add A,E
	djnz MulEB

Silly:
	ld C,A

	ld B,0

	add HL,BC

	pop BC

        pop DE

LoadPatches:
	ld A,$C3
	ld (DE),A
	inc DE			;load jump byte

	ld A,(HL)
	ld (DE),A
	inc HL
	inc DE			;low byte

	ld A,(HL)
	ld (DE),A
	inc HL
	inc DE			;high byte

	djnz LoadPatches

        ld A,'P'
	ret

.end




----------
From: 	DorkReMi@aol.com[SMTP:DorkReMi@aol.com]
Sent: 	Saturday, September 26, 1998 12:17 AM
To: 	assembly-85@lists.ticalc.org
Subject: 	A85: Help! :)


I could use a little guidance... I need 16 bit math routines (B*C, H*L, 
that
kind of thing) and I don't know where to get them. Also, I could really use 
a
good random number routine. Was there one in ztetris or something?  Thanks 
for
any advice.

-Josh Morris
 DorkReMi@aol.com




begin 600 WINMAIL.DAT
M>)\^(AL/`0:0" `$```````!``$``0>0!@`(````Y 0```````#H``$-@ 0`
M`@````(``@`!!) &`$@!```!````# ````,``# #````"P`/#@`````"`?\/
M`0```%<`````````@2L?I+ZC$!F=;@#=`0]4`@````!A<W-E;6)L>2TX-4!L
M:7-T<RYT:6-A;&,N;W)G`%--5% `87-S96UB;'DM.#5 ;&ES=',N=&EC86QC
M+F]R9P``'@`", $````%````4TU44 `````>``,P`0```!T```!A<W-E;6)L
M>2TX-4!L:7-T<RYT:6-A;&,N;W)G``````,`%0P!`````P#^#P8````>``$P
M`0```!\````G87-S96UB;'DM.#5 ;&ES=',N=&EC86QC+F]R9R<```(!"S !
M````(@```%--5% Z05-314U"3%DM.#5 3$E35%,N5$E#04Q#+D]21P````,`
M`#D`````"P! .@$````"`?8/`0````0````````#PD$!"( '`!@```!)4$TN
M36EC<F]S;V9T($UA:6PN3F]T90`Q" $$@ $`$@```%)%.B!!.#4Z($AE;' A
M(#HI`"8$`06 `P`.````S@<)`!H`"0`P`"L`!@!B`0$@@ ,`#@```,X'"0`:
M``D`'@`U``8`6@$!"8 !`"$```!%0CDV-S V0S(S-35$,C$Q044R-C0T-#4U
M,S4T,# P, #-!@$#D 8`C D``!(````+`",```````,`)@``````"P`I````
M```#`#8``````$ `.0`@H\0C9>F]`1X`< `!````$@```%)%.B!!.#4Z($AE
M;' A(#HI`````@%Q``$````6`````;WI92.L;'"6[%4C$=*N)D1%4U0`````
M'@`># $````%````4TU44 `````>`!\,`0```!L```!R:6-H87)D;&5W:7- 
M8V5D87)C:71Y+FYE= ```P`&$*^G+3<#``<0A0<``!X`"! !````90```%1(
M15)%25-!1T]/1$@J3%)/551)3D5)3E1(15)/351(15)%25-!3%-/05)!3D1/
M34Y534)%4D=%3D52051/4DE.5$A%4D]-+%1/3T].14]&5$A%0DE44RA"250S
M+$E42$E.2RD``````@$)$ $````0" ``# @``$(2``!,6D9U<G5F(_\`"@$/
M`A4"J 7K`H,`4 +R"0(`8V@*P'-E=#(W!@`&PP*#,@/%`@!P<D)Q$>)S=&5M
M`H,S-P+D!Q,"@S0$1A,S,2!W"%4'L@* ?0J ",\)V3OQ& \R-34"@ J!#;$+
M8.!N9S$P,Q10"PH5844+\F,`0"!4: 2098(@! `@82!G;P1P("!(*DP@`V!U
M=#<+@!TQ`Z!T'0`'\$]-1"X@'.EL<V\=<7+%`'!D`W @;G4&T!:Q9F<)\ 20
M870%L1ZX+)<>T!VP'U%/'H%O9A[3*&)I= 0@*"/1(#.-(J!)'M$+@&LI(""P
M.0>1;F\%0!-0!'!U8^,=, .197%U!T @YB-AS#$G'6$@H" P)X ?4;LDH!& 
M=B8A'B<AP" `P'9K**(*L'01<![0`:!L]2-#:B$`< 0@`A %P")SZ0:0('D(
M8"<=(@(P'1%U$\%D*"(G(- =H N 9STI4G41L!U !4 >L6UY*2#@97@%0',=
M`&QLGR*@(#$>X"&P);!E;PM071TP8P.1*',>X6DG(7?_`Z ?(2I4!" +@ "0
M#; Q)=,EP0G 86TH$DT$< :0/R[0'N(>-@= `R L$2!WG0!P="@B!4 %H'5L
M'=#])<%B*G$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