; File: BANK1ROM.A51 Date: 09/09/93 ; ; /* (c) Copyright BLUE EARTH RESEARCH, MANKATO, MN 1993. */ ; /* All rights reserved. */ ; $ DATE (09-09-93) $ PW(107) PL(60) $ ERRORPRINT DEBUG XREF ; NOTES: ; When running a BASIC program from RAM Bank0 of the Micro-485, the user ; cannot switch to RAM Bank1 and continue execution of the program. ; This routine will allow the user to write/read data to/from almost any ; location in Bank1. From BASIC, the user loads the upper and lower ; bytes of the target location into internal memory locations 19H and 18H, ; respectively. Location 1AH is either loaded with data to be written or ; contains data that was read. After loading the appropriate locations, the ; BASIC program should then CALL location 0 (4100H) to read data, or CALL ; location 2 (4104H) to write data. Using this program allows the user to ; log data in RAM Bank1 from location 0-0FBFFH (0-64,511). ; ********************* IMPORTANT NOTE ********************** ; THE ASSEMBLY ROUTINE MUST BE EXECUTED OUT OF EPROM ACCESSED ; AS CODE MEMORY ONLY. THE SYSTEM PLD MUST BE REPROGRAMMED. ; *********************************************************** ; This file is similar to the BANK1LOG.A51 program, except that this program ; assumes that the Micro-485 PLD program has been modified to access code ; memory out of EPROM and data memory out of RAM at addresses 4000H through ; at least 4200H ; The following sample BASIC program demonstrates loading the value 99H into ; RAM Bank1 location 5000H. It then reads back the contents of that location. ; 1 REM SAMPLE PROGRAM TO USE BANK1LOG.A51 ; 10 ADDR_LO=18H : ADDR_HI=19H : DAT=1AH : DP=5FFEH ; 30 A=5000H : REM Pick arbitrary location for this example ; REM Store data pointer in Bank0 memory ; 40 XBY(DP)=INT(A/256) : XBY(DP+1)=A.AND.255 ; REM Lines 50-60 demonstrate how to load the value 99H into the ; REM location in Bank1 pointed to by DP and DP+1. ; 50 DBY(ADDR_HI)=XBY(DP) : DBY(ADDR_LO)=XBY(DP+1) : DBY(DAT)=99H ; 60 CALL 2 : REM Call routine to log data to Bank1 ; REM Lines 70-80 demonstrate how to read a value in Bank1 which is ; REM pointed to by DP and DP+1 ; 70 DBY(ADDR_HI)=XBY(DP) : DBY(ADDR_LO)=XBY(DP+1) ; 80 CALL 0 : REM Call routine to read data from Bank1 ; 90 PRINT DBY(DAT) : REM Print data DSEG AT 18H ADDR_LO: DS 1 ADDR_HI: DS 1 DATA_LOG: DS 1 RD_WR BIT 0 START EQU 4100H ; Beginning Code address BANK0 CODE 0FD00H ; Address to select Bank 0 BANK1 CODE 0FE00H ; Address to select Bank 1 CSEG AT START RD_DATA: SETB RD_WR ; CALL here to read data SJMP START1 WR_DATA: CLR RD_WR ; CALL here to write data START1: PUSH DPH PUSH DPL PUSH ACC PUSH PSW MOV DPTR,#BANK1 ; Switch to Bank1 MOVC A,@A+DPTR MOV DPL,ADDR_LO ; Point to location MOV DPH,ADDR_HI ; specified by user. JB RD_WR,READ ; Read data if set else write data. MOV A,DATA_LOG ; Get the byte to be stored and MOVX @DPTR,A ; write it to memory in Bank1 SJMP BOTTOM READ: MOVX A,@DPTR ; Read the data from Bank1 MOV DATA_LOG,A ; and save the byte. BOTTOM: MOV DPTR,#BANK0 ; Now jump back to Bank 0 and MOVC A,@A+DPTR ; return to BASIC. POP PSW POP ACC POP DPL POP DPH RET ; Return to BASIC. END ; Following is the HEX file derived from the assembled source ; file. This can be used for directly loading the program via ; MONITOR-51 and almost any terminal program. ; IMPORTANT: THIS HEX FILE MUST BE IN ROM ACCESSED AS CODE MEMORY ONLY :10410000D2008002C200C083C082C0E0C0D090FE56 :104110000093851882851983200005E51AF0800335 :10412000E0F51A90FD0093D0D0D0E0D082D0832269 :00000001FF