************ * Program CHECKSUM (6811) * * Computes 16-bit checksum by successively adding bytes. * START and STOP adresses are specified in the program. * * Lower 12-bits are displayed on 7-segment LEDs. For address * range $E000 - $EFFF (in our version of the Buffalo Monitor) * the result is $FE0. * * Note that prior to calling DISPLAY, the port adr must be * stored in loc PORT (2 bytes) and the three digits in the lower * nibble of HI_DIG, MID_DIG and LO_DIG. * * To compile type; * * as11 a:checksum.asm a:display.asm -l >a:checksum.lst * * Peter H. Anderson, MSU, 14 Jan 90, Checked 16 Jan 90 * modified 5 Feb 90, 4 Oct 90, 7 Oct 91; 15 Jan 93 ************* PSCT EQU $C000 DSCT EQU $D000 IDSCT EQU $D300 STACKTP EQU $0045 REG_BASE EQU $1000 PORTB EQU $04 ORG PSCT LDS #STACKTP LDY #REG_BASE LDX START_ADR *note extended addressing LDD #$0000 *zero the sum ADD: ADDB 00,X *add memory to sum ADCA #$00 INX *next adr CPX STOP_ADR *past stop_adr? BCS ADD BEQ ADD DONE: STAA HI_DIG *lo nibble of acca STAB LO_DIG *lo nibble of accb LSRB *get hi nibble to lo LSRB LSRB LSRB STAB MID_DIG LDD #PORTB+#REG_BASE *save port adr STD PORT JSR DISPLAY SWI ORG IDSCT START_ADR FDB $E000 STOP_ADR FDB $EFFF ORG DSCT PORT RMB 2 HI_DIG RMB 1 MID_DIG RMB 1 LO_DIG RMB 1