LANGE%DACTH51.BITNET@WISCVM.WISC.EDU (06/23/86)
Subject : Bug report for KERMIT-80 The following error has been noted: ----------------------------------- It concerns the piece of code starting at label "staspd" (in cp4mit.asm) which is to show the current line speed. The current baud rate value is taken from location "speed" and compared with a corresponding entry into table "spdtab" (linked to "spdtbl" in cp4sys.asm). Unfortunately only an 8-bit comparison is done although this is a 16-bit value. This practice made some trouble as I used the 1st byte of this 16-bit value as a time constant for a Z80-CTC and the 2nd part as prescaler information to cover the total range from 50 up to 19200 Baud. So it happened that the first value (the CTC time constant) was not unique in the table and that it was necessary to check the 2nd byte to identify the correct baud rate. It appears a good programming practice to use a 16-bit comparison where you handle 16-bit values. Jan G. Loeschner (Technical University of Aachen, West Germany) ================================================================== ; Show the current line speed (if known). staspd: lxi d,spdst call prtstr lda speed ;Get current speed. mov c,a ;[JGL] (C) = LSB of speed factor lda speed+1 ;[JGL] Get 2nd part of current speed. mov b,a ;[JGL] (B) = MSB of speed factor lxi h,spdust ;Assume undefined. cpi 0FFH ;Is it? jz stat73 ;Yes. lhld spdtab ;Start scanning keyword table. mov d,m ; get count of entries inx h ; advance over it. stat70: mov e,m ;[JGL] Get string length. inr e ;[JGL] Account for $. inx h shld temp1 ;Save string pointer. stat71: inx h ;Loop over string. dcr e ;[JGL] jnz stat71 mov a,m ;[JGL] Get speed value (1st part) inx h ;[JGL] Skip LSB of speed factor. cmp c ;[JGL] Match? jnz stat711 ;[JGL] No. mov a,m ;[JGL] Get speed value (2nd part). cmp b ;[JGL] Match? jz stat72 ;[JGL] Yes -- a 16 bit match. stat711:inx h ;[JGL] Bump to next keyword. dcr d ; decrement entry count jnz stat70 ; if more left, check them. lxi h,spdust ; can't find it. say it's undefined. jmp stat73 ; print the message. stat72: lhld temp1 ;Restore saved string pointer. stat73: xchg ;Set into DE for display. jmp prtstr ; print it, and return. ==================================================================