USING HEX LOADER for PC-E500 written by jsurfer last updated on December 05, 2013 ===================================================================== WHAT IS "HEX LOADER for PC-E500"? "HEX LOADER for PC-E500" loads machine language program that is saved in Text Format on your desktop computer to your PC-E500 series pocket computers. PC-E500 does not come with Machine Language Monitor program (also known as "Machine Language Input" program). This means whenever you want to type in machine language program from computer magazine or computer book, you first need to figure out an appropriate space in machine language reserve area in the memory so that the Machine Language Monitor program does not reside in the same memory location as the machine language program you are about to enter, install "re-locatable" machine language monitor in that area, run it so that you can start typing in the machine language program. This has been an hassle for me so I wrote this little BASIC program. With this program, you can now type machine language program on your desktop computer using your favorite text editor, save it as a Text Formatted file, and then load it to your PC-E500 using this "HEX LOADER for PC-E500". This eliminates the need to install Machine Language Monitor program on your PC-E500. ===================================================================== HERE IS THE FLOW: 1) Type in machine language program on your desktop computer using your favorite text editor and save is as a Text Formatted file. 2) Transfer "HEX_LOADER_ENGLISH.BAS" to your PC-E500. 3) On PC-E500, type RUN [RET] to run the program. 4) Transfer machine language program. ===================================================================== SUPPORTED POCKET COMPUTERS: This program will work on all the PC-E500 Pocket computer series. They are: PC-E500 PC-E550 PC-E650 PC-1480U PC-1490U PC-1490UII PC-U6000 ===================================================================== PREPARATIONS: STEP 1) On your desktop computer, type in machine language program and save it as a Text Formatted file. Any filename will do but in this doc, I assume the filename is "HEX.TXT". The content of the file must follow this format: BE700 01 02 03 04 05 06 07 08 : 24 BE708 09 0A 0B 0C 0D 0E 0F 10 : 64 END The starting address in the 1st line (that is "BE700" in the example above) is the address where this program will start to put HEX numbers in so it is important you put the correct starting address in the 1st line. The address in the 2nd line and below (that is "BE708" in the example above) are not used by this program at all so you can put anything there as long as it is 5 digits. The check-sums at the end of each line (": 24" and ": 64" in the example above) are not used by this program so you can just not have them like this: BE700 01 02 03 04 05 06 07 08 BE708 09 0A 0B 0C 0D 0E 0F 10 END You MUST put the word "END" at the end of the file and also a Carriage Return after the word "END". STEP 2) Make sure to reserve a space in the memory for machine langauge program. For example, if you need to reserve 10k bytes (2800h) for machine language program, type this line on your PC-E500: POKE &BFE03,&1A,&FD,&0B,&00,&28,&00:CALL &FFFD8 [RET] STEP 3) If you are planning to save it on the E: drive, check to make sure you have enough space on the E: drive by typing this line: DSKF"E:" [RET] If you don't have enough space, type in this line to reserve space for E: drive: INIT"E:16K" [RET] (The example above will reserve 16k on the E: drive. Change "16k" to whatever space you need.) STEP 4) If you haven't done the COMM settings yet, set it up by typing in these 3 lines: POKE &BFD35,0,255,0,80 [RET] OPEN "COM:9600,N,8,1,A,L,&H1A,X,N" [RET] CLOSE [RET] ===================================================================== TRANSFERRING MACHINE LANGUAGE PROGRAM: STEP 1) First, transfer the "HEX_LOADER_ENGLISH.BAS" to PC-E500. STEP 2) Next, if you have not yet reserved machine language area in the memory, do so now. For example, if you need to reserve 10k bytes (2800h) for machine language program, type this on your PC-E500: POKE &BFE03,&1A,&FD,&0B,&00,&28,&00:CALL &FFFD8 [RET] STEP 3) Switch to 'RUN' mode and then type in this line to run the program: RUN [RET] STEP 4) "You can start sending file now..." is displayed. Use terminal software on your desktop computer to send the "HEX.TXT" file to PC-E500. When the file is being transferred, PC-E500 displays line by line. When the transfer is complete, PC-E500 displays "FINISHED SUCCESSFULLY." and also displays the starting address and ending address. If you do not see this message and if you see this error message: Input past end in 1610 it means the file is most likely transferred successfully but somehow, it couldn't tell the content of the file reached to END so type this line manually to close the comm port: CLOSE [RET] If you get other error messages, type this line any way: CLOSE [RET] and then find out the cause of the error, fix it, and start from the STEP 1 all over again. STEP 5) Now the machine langauge program is loaded to the memory on PC-E500. To make sure of this, pick some address and make sure the expected data is in the address. For example, type this line: PEEK&BE701 [RET] to see the value stored in the address &BE701 and compare the value with what is in the machine language program list to make sure they match. STEP 6) If you want to save the machine language program on E: drive, make sure you have enough space on the E: drive by typing this: DSKF"E:" [RET] and then save it by typing SAVEM followed by filename followed by starting address and ending address. For example, to save it to the file names "ABC.BIN" starting from the address &BE700 and ending at &BFC00, type this line: SAVEM"E:ABC.BIN",&BE700,&BFC00 [RET] ===================================================================== EXTRA INFO: If you followed the steps above and already saved the file on E: drive, to load and to run it from next time on, you can just type these 2 lines: LOADM"E:ABC.BIN" [RET] CALL&BE700 [RET] ===================================================================== Below is the entire program of "HEX_LOADER_ENGLISH.BAS"F 1000 ' 1010 ' Program name: HEX_LOADER.BAS 1020 ' 1030 ' This program loads machine 1040 ' language program that is 1050 ' saved in text format on your 1060 ' personal computer to your 1070 ' pocket computer. 1080 ' 1090 ' Supported Pocket Computers: 1100 ' PC-E500, PC-1480U, PC-1490U 1110 ' PC-E550, PC-1490UII, PC-E650 1120 ' PC-U6000 1130 ' 1140 ER=0 1150 CLS 1160 ' 1170 PRINT "=== HEX LOADER by jsurfer 2013/12/05 ===" 1180 PRINT "If stopped (by user or by system), type:" 1190 PRINT "CLOSE [RET]" 1200 PRINT "You can start sending file now..." 1210 ' 1220 OPEN "9600"AS #1 1230 A$="" 1240 INPUT #1,A$ 1250 IF MID$ (A$,6, 1)<>" " AND MID$ (A$,6, 1)<>":" THEN ER=1:GOTO *ERROR 1260 IF A$="" THEN ER=2:GOTO *ERROR 1270 IF ASC (LEFT$ (A$,1))<48 THEN ER=3:GOTO *ERROR 1280 IF ASC (LEFT$ (A$,1))>57 AND ASC (LEFT$ (A$,1))<65 THEN ER=3:GOTO *ERROR 1290 IF ASC (LEFT$ (A$,1))>70 THEN ER=3:GOTO *ERROR 1300 IF ASC (MID$ (A$,2,2))<48 THEN ER=4:GOTO *ERROR 1310 IF ASC (MID$ (A$,2,2))>57 AND ASC (MID$ (A$,2,2))<65 THEN ER=4:GOTO *ERROR 1320 IF ASC (MID$ (A$,2,2))>70 THEN ER=4:GOTO *ERROR 1330 IF ASC (MID$ (A$,3,3))<48 THEN ER=5:GOTO *ERROR 1340 IF ASC (MID$ (A$,3,3))>57 AND ASC (MID$ (A$,3,3))<65 THEN ER=5:GOTO *ERROR 1350 IF ASC (MID$ (A$,3,3))>70 THEN ER=5:GOTO *ERROR 1360 IF ASC (MID$ (A$,4,4))<48 THEN ER=5:GOTO *ERROR 1370 IF ASC (MID$ (A$,4,4))>57 AND ASC (MID$ (A$,4,4))<65 THEN ER=6:GOTO *ERROR 1380 IF ASC (MID$ (A$,4,4))>70 THEN ER=5:GOTO *ERROR 1390 IF ASC (MID$ (A$,5,5))<48 THEN ER=6:GOTO *ERROR 1400 IF ASC (MID$ (A$,5,5))>57 AND ASC (MID$ (A$,5,5))<65 THEN ER=7:GOTO *ERROR 1410 IF ASC (MID$ (A$,5,5))>70 THEN ER=6:GOTO *ERROR 1420 IF LEN A$>34 THEN ER=8:GOTO *ERROR 1430 ' 1440 A=VAL ("&"+LEFT$ (A$,5)) 1450 AA = A 1460 *START 1470 IF A$="END" THEN *FIN 1480 PRINT HEX$ A;" "; 1490 A$=MID$ (A$,7,23) 1500 PRINT A$ 1510 *NEXTHEX 1520 B$=LEFT$ (A$,2) 1530 IF LEN B$<2 THEN *READLINE 1540 POKE A,VAL ("&"+B$) 1550 A=A+1 1560 A$=MID$ (A$,4,40) 1570 GOTO *NEXTHEX 1580 ' 1590 *READLINE 1600 A$="" 1610 INPUT #1,A$ 1620 GOTO *START 1630 ' 1640 *ERROR 1650 CLOSE 1660 PRINT "!!! ERROR #";ER;" !!!" 1670 IF ER=1 THEN PRINT "6th char in 1st line must be a space or a colon.":GOTO *EXAMPLE 1680 IF ER=2 THEN PRINT "1st line cannot be blank.":GOTO *EXAMPLE 1690 IF ER=3 THEN PRINT "1st char in 1st line is not a valid character.":GOTO *EXAMPLE 1700 IF ER=4 THEN PRINT "2nd char in 1st line is not a valid character.":GOTO *EXAMPLE 1710 IF ER=5 THEN PRINT "3rd char in 1st line is not a valid character.":GOTO *EXAMPLE 1720 IF ER=6 THEN PRINT "4th char in 1st line is not a valid character.":GOTO *EXAMPLE 1730 IF ER=7 THEN PRINT "5th char in 1st line is not a valid character.":GOTO *EXAMPLE 1740 IF ER=8 THEN PRINT "1st line exceeds 34 length.":GOTO *EXAMPLE 1750 ' 1760 *EXAMPLE 1770 PRINT "Press [C] to continue."; 1780 Z$="":Z$=INKEY$ : IF Z$="C" OR Z$="c" THEN 1790 ELSE 1780 1790 PRINT :PRINT "The file must follow this format:" 1800 PRINT "BE700 01 02 03 04 05 06 07 08"; 1810 END 1820 ' 1830 *FIN 1840 CLOSE 1850 PRINT "FINISHED SUCCESSFULLY." 1860 A=A-1:PRINT "START/END ADDRESS: ";HEX$ AA;"/";HEX$ A 1870 END  ===================================================================== Feel free to copy and distribute this program and this doc. No need to let me know... Have a Happy Pocket Computer Life!