# WILL \$\$\$\$ PAY FOR HELP WRITING THIS PROGRAM !!!!!!!!!!! Z80

Discussion in 'Programmer's Corner' started by nocmsa, Nov 22, 2008.

Not open for further replies.
1. ### nocmsa Thread Starter New Member

Nov 22, 2008
1
0
20 - 50 DOLLARS FOR HELP MY EMAIL ADDRESS IS : NOCMSA@YAHOO.COM CONTACT ME FOR MORE INFORMATION

1.Write a Z80 program that reads 10 bytes of data from and array
whose base address starts at 2020H, adds each data byte to 2H and then stores
the sum at a 10 byte array whose base address is 3020H. Show solution with
comments for each line & fully explain how it works.

2: Interpret and fully explain the function of the following program.
Provide a full explanation and comments for each line. Hint: 2040H contains
the data byte 22H. What is the resulting number, in hex, which is contained in
the address 2070H after the program when the program halts?
300A 21 #
300B 40 #
300C 20 #
300D 01 #
300E 70 #
300F 20 #
3010 7E #
3011 3C #
3012 A6 #
3013 02 #
3014 36 #
3015 00 #
3016 76 #

3: Write a PIC 18 Series Assembly Program, (i.e. just the Main), to
take in an 8 bit literal number, A, and an 8 bit literal number, B, and to
obtain C = A x B, and to store C in variables, Shigh, and Slow, respectively,
Then have the program multiply each of them, i.e. Shigh and Slow by 4, Mod 256,
without using the multiply function.

4: Interpret and fully explain the following program (next sheet),
which is written in PIC 18 Assembly language. Provide comments and a general
explanation of what the program does.

Solution / Explanation:
;******************************************************************************
; This file is a basic template for creating relocatable assembly code for *
; a PIC18F4520. Copy this file into your project directory and modify or *
; add to it as needed. Create a project with MPLINK as the language tool *
; for the hex file. Add this file and the 18F4520.LKR file to the project. *
; *
; The PIC18FXXXX architecture allows two interrupt configurations. This *
; template code is written for priority interrupt levels and the IPEN bit *
; in the RCON register must be set to enable priority levels. If IPEN is *
; left in its default zero state, only the interrupt vector at 0x008 will *
; be used and the WREG_TEMP, BSR_TEMP and STATUS_TEMP variables will not *
; be needed. *
; *
; Refer to the MPASM User's Guide for additional information on the *
; features of the assembler and linker. *
; *
; Refer to the PIC18Fxx20 Data Sheet for additional *
; information on the architecture and instruction set. *
; *
;******************************************************************************
; *
; Filename: *
; Date: *
; File Version: *
; *
; Author: *
; Company: *
; *
;******************************************************************************
; *
; Files required: P18F4520.INC *
; 18F4520.LKR *
; *
;******************************************************************************
LIST P=18F4520, F=INHX32 ;directive to define processor and file format
#include <P18F4520.INC> ;processor specific variable definitions
;******************************************************************************
;Configuration bits
;Microchip has changed the format for defining the configuration bits, please
;see the .inc file for futher details on notation. Below are a few examples.
; Oscillator Selection:
CONFIG OSC = LP ;LP
;******************************************************************************
;Variable definitions
; These variables are only needed if low priority interrupts are used.
; More variables may be needed to store other special function registers used
; in the interrupt routines.
; Test variables, simple sum
UDATA
WREG_TEMP RES 1 ;variable in RAM for context saving
STATUS_TEMP RES 1 ;variable in RAM for context saving
BSR_TEMP RES 1 ;variable in RAM for context saving
MUL RES 1 ;
SPECIAL RES 1 ;
INTDIV1 RES 1 ;
IntDiv RES 1 ;
UDATA_ACS
EXAMPLE RES 1 ;example of a variable in access RAM
;******************************************************************************
;EEPROM data
; Data to be programmed into the Data EEPROM is defined here
DATA_EEPROM CODE 0xf00000
DE "Test Data",0,1,2,3,4,5
;******************************************************************************
;Reset vector
; This code will start executing when a reset occurs.
RESET_VECTOR CODE 0x0000
goto Main ;go to start of main code
;******************************************************************************
;High priority interrupt vector
; This code will start executing when a high priority interrupt occurs or
; when any interrupt occurs if interrupt priorities are not enabled.
HI_INT_VECTOR CODE 0x0008
bra HighInt ;go to high priority interrupt routine
;******************************************************************************
;Low priority interrupt vector
; This code will start executing when a low priority interrupt occurs.
; This code can be removed if low priority interrupts are not used.
LOW_INT_VECTOR CODE 0x0018
bra LowInt ;go to low priority interrupt routine
;******************************************************************************
;High priority interrupt routine
; The high priority interrupt code is placed here.
CODE
HighInt:
; *** high priority interrupt code goes here ***
retfie FAST
;******************************************************************************
;Low priority interrupt routine
; The low priority interrupt code is placed here.
; This code can be removed if low priority interrupts are not used.
LowInt:
movff STATUS,STATUS_TEMP ;save STATUS register
movff WREG,WREG_TEMP ;save working register
movff BSR,BSR_TEMP ;save BSR register
btfsc PIR1,0 ;
goto int_timer1 ;
btfsc INTCON, 1 ;
goto int_extpin33 ;
goto int_end ;
int_timer1 ;
incf SPECIAL
movf SPECIAL,W
movwf TXREG
movlw Timer1L ;
movwf TMR1L ;
movlw Timer1H ;
movwf TMR1H ;
bcf PIR1,0 ;
decfsz INTDIV1 ;
goto int_end
int_extpin33
movwf TXREG
movlw IntDiv
movwf INTDIV1 ;
bcf INTCON, 1
int_end ;
movff _w, w
movff _status, STATUS
movff _bsr, BSR
retfie ; return from int
movff BSR_TEMP,BSR ;restore BSR register
movff WREG_TEMP,WREG ;restore working register
movff STATUS_TEMP,STATUS ;restore STATUS register
retfie
;******************************************************************************
;Start of main program
; The main program code is placed here.
Main:
; *** main code goes here ***
bsf INTCON, 6 ;
clrf MUL ;
movlw 0x44 ;
movwf MUL ;
movlw 0x44 ;
mulwf MUL ;
goto \$
;******************************************************************************
;End of program
END