10 ;BUG/65 APPEND PROGRAM ON MAC/65
20 ;
30 START =   $3000
40 DISPV =   START+$0209
50 MCBEND =  START+$021F
60 USRCMD =  START+$0220
70 GET2HX =  START+$022C
80 ;
90 ;
0100     *=  USRCMD  ; PATCH US INTO BUG/65
0110     JMP USERC1
0120 ;
0130     *=  *+$2000 ; RIGHT AFTER BUG/65 CODE
0140 USERC1 CMP #'1  ; COMMAND "1" ?
0150     BEQ CMDOK   ; YES
0160     RTS         ; ELSE RTN EQUAL RESET - ERR
0170 ;
0180 CMDOK JSR GET2HX ; GET START, END
0190     LDA HEX1    ; MAKE SURE BOTH SPECIFIED
0200     ORA HEX1+1
0210     BEQ PARMER  ; OR ELSE ERROR
0220     LDA HEX2
0230     ORA HEX2+1
0240     BNE PARMOK
0250 ;
0260 PARMER JMP ERRPAR ; REPORT PARAM ERROR
0270 ;
0280 PARMOK LDX LSTPG0 LAST BUG/65 P0 BYTE
0290 ; (WE'LL USE THE NEXT
0300 ;  FOR OUR ACCUMULATOR)
0310     LDA #0      ; CLEAR ACCUMULATOR
0320     STA 1,X
0330     TAY         ; INIT Y PTR INDEX
0340 ;
0350 LOOP LDA HEX2+1 ; PAST END ADDRESS ?
0360     CMP HEX1+1
0370     BCC DONE    ; YES
0380     BNE NXTEOR  ; NO
0390     LDA HEX2
0400     CMP HEX1
0410     BCC DONE    ; YES
0420 ;
0430 NXTEOR LDA (HEX1),Y ; CALC EOR CHKSUM
0440     EOR 1,X     ; EOR WITH ACCUM
0450     STA 1,X     ; AND SAVE IN ACCUM
0460     INC HEX1    ; BUMP PTR
0470     BNE LOOP
0480     INC HEX1+1
0490     JMP LOOP
0500 ;
0510 DONE LDA #EOL   ; TO NEXT SCREEN LINE
0520     JSR DISPV
0530     LDX LSTPG0  ; RESTORE ACCUM ADDRESS
0540     LDA 1,X     ; DISPLAY HEX RESULT
0550     JSR DHXBYT
0560     LDA #0      ; RTN OK (EQUAL SET)
0570     RTS 
0580     *=  MCBEND  ; CHANGE BUG/65 CODE
0590     .BYTE  >[*+$FF] ; END BYTE TO INCLUDE
0600     .END        ; THAT'S ALL FOLKS
