HC08 Full Chip Simulation
Configuration Procedure
314
Microcontrollers Debugger Manual
ldhx #0 ; clear H:X pointer
lda wValueH ; check which descriptor is wanted
cbeqa #$1,GETDEVDESC ; is it device descriptor?
cbeqa #$2,GETCONDESC ; is it configuration descriptor?
cbeqa #$21,GETHIDDESC ; is it for HID descriptor?
cbeqa #$22,GETREPDESC ; is it for Report descriptor?
jmp GETDESC_STALL ; else go stall
GETDEVDESC:
lda Dev_Desc,x ; take device descriptor information
sta UE0D0,x ; store in USB endpoint 0 data buffer
incx
cpx #8 ; all descriptors more than 8 bytes
bne GETDEVDESC
ldhx #DDesc_End ; store end location of the descriptor
sthx descendptr
ldhx #Dev_Desc ; store pointer to next byte in
; descriptor
bra GETDESC_END
GETCONDESC:
lda Con_Desc,x ; take configuration descriptor
; information
sta UE0D0,x ; store in USB endpoint 0 data buffer
incx
cpx #8 ; all descriptors more than 8 bytes
bne GETCONDESC
ldhx #E2Desc_End ; store end location of the descriptor
sthx descendptr
ldhx #Con_Desc ; store pointer to next byte in
; descriptor
bra GETDESC_END
GETHIDDESC:
lda HID_Desc,x ; take HID descriptor information
sta UE0D0,x ; store in USB endpoint 0 data buffer
incx
cpx #8 ; all descriptors more than 8 bytes
bne GETHIDDESC
ldhx #HDesc_End ; store end location of the descriptor
sthx descendptr
ldhx #HID_Desc ; store pointer to next byte in descriptor
bra GETDESC_END
GETREPDESC:
lda REP_Desc,x ; take report descriptor information
sta UE0D0,x ; store in USB endpoint 0 data buffer
incx