|
AN515 |
Product: Domino 1 & 2 |
|
Using the Store Hex program to store Assembly routines in the Domino |
Date: 4/13/01 |
Introduction: This application note gives step by step instructions on how to use the Store Hex program with the Domino 1 and 2. |
|
Background: Writing your code in BASIC is a fast way to develop your product, but sometimes there is a need to write routines in assembly language for speed, or because BASIC doesn’t allow you to access certain functions. The Store Hex program available on your Domino Utilities disk is a simple way to store an assembly routine and a BASIC program into EEPROM. |
|
How it works: The following steps will walk you through using the Store Hex program for the program listed in the Program Listing Section of this application note using HOST52:
The following steps will walk you through using the Store Hex program for the program listed in the Program Listing Section of this application note using HyperTerminal:
|
|
Program Listing:
Sample Assembly Routine: ORG 0D000H CL_R: CLR P3.3 ; Clear *INT1 RET ; Return Back to BASIC ORG 0D003H SE_T: SETB P3.3 ; Set *INT1 RET END Generated Hex file: :06D00000C2B322D2B322EC :00000001FF BASIC52 Program: 10 PRINT "This program demonstrates using an assembly routine that has" 20 PRINT "been stored into EEPROM by using the Store Hex program." 30 PRINT "The program toggles INT1 about every second." 40 PRINT "*INT1 Clear" 50 Call 0D000H : REM Call the assembly routine to clear *INT1 60 CLOCK0 : REM Stop the Real Time Clock 70 TIME=0 : REM Set the Real Time Clock to zero 80 CLOCK1 : REM Start the Real Time Clock 90 IF TIME<=1 THEN GOTO 90 :REM Do not move on in the program unless a second has gone by 100 PRINT "*INT1 Set" 110 Call 0D003H : REM Call the assembly language to set *INT1 120 CLOCK0 130 TIME=0 140 CLOCK1 150 IF TIME<=1 THEN GOTO 150 160 GOTO 40 Store Hex Program: 10 MTOP=0FFFH 20 string 27,12 :$(0)="1.3":$(1)="YOURFILE.HEX" 30 A=7000H:cs=34837 40 READ D 50 IF (D=0A5H.AND.K=0A5H) THEN GOTO 100 60 XBY(A)=D 70 C=C+D:K=D 80 A=A+1 90 GOTO 40 100 IF (C<>CS) THEN PRINT "DATA ERROR -",CS,C : STOP 110 DBY(01EH)=0FFH:DBY(01FH)=0FFH 120 PRINT "Assembly loader for DOMINO, Version ",$(0) 130 PRINT "Enter the address area for which you've assembled/compiled..." 140 PRINT "0 - RAM area MTOP to 5FFFH" 150 PRINT "1 - EEROM area 9000H to 0DFFFH" 160 G=GET 170 G=GET : IF G=0 THEN GOTO 170 180 IF G=30H THEN DBY(20H)=0 : DBY(21H)=0 : GOTO 220 190 IF G=31H THEN DBY(20H)=7EH : DBY(21H)=11H : GOTO 220 200 GOTO 170 210 print 220 PRINT "Ready to Download your HEX file." 225 PRINT "Please use your File/Send HEX option in HOST-52" 226 PRINT "or your Terminal Program to store your hex file." 230 CALL 7000H 240 FORZ=1TO 1000:NEXTZ:PRINT 241 IF dby(19h)<>0 then print"Error in HEX transfer":end 250 PRINT $(1), " was sucessfully read" 260 if g=31h then print"Your EEROM routine has been offset into SRAM" 270 UA=DBY(1BH)*256+DBY(1CH)-1:LA=DBY(1EH)*256+DBY(1FH) 280 ph0."The routine loaded from",la," to",ua 281 if (g=30h.and.la>8000H.or.ua>8000H) then print "protected area, NO SRAM" 290 print 300 IF (LA<MTOP) THEN PH0. "*** WARNING *** FILE LOADS BELOW MTOP",MTOP 310 IF (G=31H.AND.UA>61EEH) THEN PRINT "*** WARNING *** FILE EXCEEDS DFFFH" 320 IF (G=30H.AND.UA>5FFFH) THEN PRINT "*** WARNING *** FILE EXCEEDS 5FFFH" 330 END 340 REM ASSEMBLY LANGUAGE LOAD ROUTINE 350 DATA 0C0H, 0D0H, 0C0H, 0A8H, 0C0H, 0E0H, 0C0H, 0F0H, 0C0H, 083H 360 DATA 0C0H, 082H, 053H, 0A8H, 0F0H, 053H, 0D0H, 0E7H, 075H, 01EH, 000H 370 DATA 075H, 01FH, 000H, 012H, 070H, 0E2H, 075H, 018H, 000H 380 DATA 0B4H, 03AH, 059H, 012H, 070H, 0EAH, 012H, 070H, 0BAH 390 DATA 0BDH, 000H, 054H, 0F5H, 01AH, 0B4H, 000H, 009H, 012H, 070H, 0BAH 400 DATA 012H, 070H, 0BAH, 002H, 070H, 05EH, 012H, 070H, 0BAH 410 DATA 0BDH, 000H, 040H, 0F5H, 01BH, 012H, 070H, 0BAH, 0BDH, 000H, 038H 415 DATA 0C3H, 095H, 021H, 0F5H, 01CH, 0E5H, 01BH, 095H, 020H, 0F5H, 01BH 420 DATA 0E5H, 01EH, 0B4H, 000H, 008H, 0E5H, 01BH 430 DATA 0F5H, 01EH, 0E5H, 01CH, 0F5H, 01FH 440 DATA 012H, 070H, 0BAH, 0BDH, 000H, 01AH, 0F5H, 01DH 460 DATA 075H, 0F0H, 000H, 012H, 070H, 0BAH, 0BDH, 000H, 00FH 470 DATA 0C0H, 0E0H, 0E5H, 01AH, 0B5H, 0F0H, 00CH, 0D0H, 0E0H, 080H, 01CH 480 DATA 0F5H, 019H, 080H, 02FH, 08DH, 019H, 080H, 02BH, 085H, 01BH, 083H 490 DATA 085H, 01CH, 082H, 0D0H, 0E0H, 0F0H 500 DATA 0A3H, 085H, 083H, 01BH, 085H, 082H, 01CH, 005H, 0F0H, 080H, 0D3H 510 DATA 012H, 070H, 0E2H, 0B4H, 00DH, 0DEH, 012H, 070H, 0EAH, 0E5H, 018H 520 DATA 070H, 0D7H, 0E5H, 01DH, 070H, 003H, 002H, 070H, 018H 530 DATA 075H, 019H, 000H, 0D0H, 082H, 0D0H, 083H, 0D0H, 0F0H, 0D0H, 0E0H 540 DATA 0D0H, 0A8H, 0D0H, 0D0H, 022H 550 DATA 012H, 070H, 0E2H, 012H, 070H, 0F2H, 0BDH, 000H, 01EH, 0C0H, 003H 560 DATA 0D0H, 001H, 012H, 070H, 0EAH, 012H, 070H, 0E2H, 012H, 070H, 0F2H 570 DATA 0BDH, 000H, 00EH, 012H, 070H, 0EAH, 0E9H, 0C4H, 0F9H, 0EBH, 049H 580 DATA 0FBH, 025H, 018H, 0F5H, 018H, 0EBH, 022H 590 DATA 030H, 098H, 0FDH, 0C2H, 098H, 0E5H, 099H, 022H 600 DATA 030H, 099H, 0FDH, 0C2H, 099H, 0F5H, 099H, 022H 610 DATA 0FBH, 0FDH, 0C3H, 094H, 030H, 040H, 01FH, 0C3H, 094H, 017H 620 DATA 050H, 01AH, 0EDH, 0C3H, 094H, 03AH, 040H, 006H, 0EDH, 0C3H 630 DATA 094H, 037H, 080H, 004H, 0EDH, 0C3H, 094H, 030H, 0C0H, 003H 640 DATA 0C0H, 0E0H, 0D0H, 003H, 0D0H, 0E0H, 07DH, 000H, 022H 650 DATA 0A5H, 0A5H
|