HP Articles Forum
[Return to the Index ]
[ Previous | Next ]
HP41 - How to mix and match UCODE and MCODE in a module
Posted by PeterP on 13 Feb 2009, 7:37 p.m.
Hi,
I had a few times the wish to combine normal usercode programs and MCODE functions in a custom module. The procedure below works yet I wonder if there is a more efficient way to accomplish this.
Building MCODE functions is most easily done via the SDK41 package from WF. It allows the use of a normal text-editor on a PC to write the code and comment it. Additionally it provides a rapid testing environment where the newly written code can be immediately checked for errors and tested (in single step mode if wanted). AFAIK there is no faster MCODE development environment around. However, sometimes the need arises to add a user-code program to the MCODE functions in the same module and there is no fast way to convert a user-code program into the correct MCODE bytes that have to be loaded that I know of. So I am using emu41 and then SDK41 or M2k to generate the dissasembled code that can then be easily meshed with the MCODE to create one annotated text-file for the whole module.
;-------------------------------------------------------------- ; emu41.ini emu41 init fileIt has the W&W Rambox OS on page 8, the 2 pages of free MLDL Ram on pages A&B and the CCD-OSX for convenience on page 15 (Thank you Raymond…)[MODULES] ; page size filename 0 12 rom41cx.bin 3 4 cxfcn2d.bin 5 8 cxtime2c.bin 7 4 hpil1h.bin ; ------------ 8 4 WWOSa.bin 10 8 mldlram.dat 15 4 CCD_osx.bin
[DEVICES] DISPLAY HDRIVE1 ;----------------------------------------------------------------
;---------------------------------------------------------------------- 06BD 013 #013 ;UserCode: 137 bytes (19 regs + 4 bytes) NONPRIVATE 06BE 240 #240 06BF 1CC [LDRSU] #1CC ;*LBL "LDRSU" ; 4C 44 52 53 55 06C0 000 #000 06C1 0F6 #0F6 06C2 000 #000 06C3 04C #04C 06C4 044 #044 06C5 052 #052 06C6 053 #053 06C7 055 #055 06C8 1F9 #1F9 ;... 002 "RSU1-FL:?" ; 06C9 052 #52 06CA 053 #53 06CB 055 #55 06CC 031 #31 06CD 02D #2D 06CE 046 #46 06CF 04C #4C 06D0 03A #3A 06D1 03F #3F 06D2 18C #18C ;... 003 AON 06D3 18E #18E ;... 004 PROMPT 06D4 18B #18B ;... 005 AOFF 06D5 111 #111 ;... 006 1 06D6 1A8 #1A8 06D7 000 #000 ;... 007 SF 00 06D8 1A1 #1A1 06D9 003 #003 ;... 008 XROM 04,03 - SETBANK 06DA 111 #111 ;... 009 14 06DB 1A1 #1A1 06DC 011 #011 ;... 010 XROM 04,17 – GETROM ;----------------------------------------------------------------------
This code can now easily be combined with the rest of your MCODE source file that you can compile with A41 & L41. Just remember that with the M2K Manager you can easily convert .ROM files into .MOD files in case you need them (for your iPhone for example or V41)
Please let me know of any improvements to this process.
Cheers
Peter
Edited: 17 Feb 2009, 12:29 p.m.