Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 1 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 1 ; 2 ; Courtney Duncan, N5BF, 13 Dec 88, KCT version 09 Jan 90 3 ; GT support added 11 Jan 90 4 ; SA-3843 Instant Track Version 1.3 VK1KNP 01 Feb 97 5 ; 6 ; AutoTrack is adapted from the GrafTraks AT TSR version and 7 ; modified extensively for the KCT calling format. Command line 8 ; sets, calibrations, limits and inversion are supported from STOW. 9 ; 10 ; Command line format: 11 ; 12 ; sa comm# 13 ; comm# is DOS comm number for port used 14 ; 15 ; The printer port of the same number is defined for 8 bit 16 ; parallel data and has hooks for diagnostic purposes. 17 ; 18 ; Hooks into the KCT driving interrupt (63h) and sends data serially 19 ; to the Scientific Atlanta 3843 Antenna Control Unit via a Comm port 20 ; Extra resolution is obtained by reading the pointing angles directly 21 ; from the Instant Track screen in either Map or Text mode. These 22 ; positions are converted to a 24 bit Binary Coded Angle before being 23 ; serially transferred to the ACU at 9600 baud. The ACU must be manually 24 ; Placed in remote mode, and the Rotor drive command activated in 25 ; Instant Track (R). The data is written as Ascii Hexadecimal bytes 26 ; to the following locations in the ACU 27 ; 28 ; Az 8060H LLSB 29 ; 8061H LSB 24 bit Hex Binary Coded Angle 30 ; 8062H MSB 31 ; 32 ; El 8063H LLSB 33 ; 8064H LSB 24 bit Hex Binary Coded Angle 34 ; 8065H MSB 35 ; 36 ; Binary Coded Angles 000.001 deg = 00 00 2E 37 ; 000.010 deg = 00 01 D2 38 ; 000.100 deg = 00 12 34 39 ; 001.000 deg = 00 B6 0B 40 ; 001.406 deg = 01 00 00 41 ; 005.625 deg = 04 00 00 42 ; 022.500 deg = 10 00 00 43 ; 090.000 deg = 40 00 00 44 ; 180.000 deg = 80 00 00 45 ; 46 ; All limits are now the responsibility of the ACU and this software 47 ; does not account for negative angles which will be reflected into 48 ; positive angles. eg -2.05 degrees will be tracked as +2.05 degrees. 49 ; 50 ; The serial driver does not read the busy lines on the interface, 51 ; it just writes, the rest is up to the ACU hardware. There is no 52 ; clearing of the serial receive buffer to acknowledge commands so 53 ; a permanant receive overrun condition will be present on the comm 54 ; port while tracking. This code could be further optimised to do 55 ; calculations concurrently while waiting for serial bytes to be 56 ; sent by the UART. 57 ; Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 2 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 58 ; The driver goes through the motions and echos back via the interupt 59 ; the commanded AZ & EL that it was sent even though real tracking 60 ; data is solely derived from the screen reads. 61 ; 62 ; No Time/Target features are implemented. 63 ; 64 ; The following driver calls and features are implemented: 65 ; 66 ; Signature: The interrupt vector 63h points to the execution 67 ; routine. Following the entry point by 0Ah is the string "RotorDRV" 68 ; which is used to identify existence of a working driver. 69 ; 70 ; Status: 71 ; Entry: AH=0 72 ; Exit: AL=0 meaning, response to I/O poll is correct, 73 ; controller is enabled, nothing is stalled, 74 ; nothing is disabled, nothing is moving. 75 ; BH=1 az/el installation 76 ; BL=0 computer runs in UTC 77 ; CH=0, current elevation not returned 78 ; CL=0, current azimuth not returned 79 ; 80 ; Read position 81 ; Entry: AH=3 82 ; Exit: AX current elevation, degrees (-90 to 269, signed) 83 ; BX current azimuth, degrees (0 to 359, signed) 84 ; CX target elevation, same as AX (no feedback) 85 ; DX target azimuth, same as BX (no feedback) 86 ; 87 ; Set position 88 ; Entry: AH=4 89 ; Exit: CX target elevation (-90 to 269 degrees, signed binary) 90 ; DX target azimuth (0 to 359 degrees, signed binary) 91 ; Both values must be in range. 92 ; 93 ; All other features are ignored or returned so as to be consistent 94 ; with inaction as follows: 95 ; 96 ; Read slew setting 97 ; Entry: AH=1 98 ; Exit: CH=0, no elevation setting 99 ; CL=0, no azimuth setting 100 ; 101 ; Write slew setting 102 ; Entry: AH=2, command non-destructively ignored 103 ; Exit: none 104 ; 105 ; Clear Time/Target table 106 ; Entry: AH=5 107 ; Exit: none 108 ; 109 ; Get Time/Target table data 110 ; Entry: AH=6 111 ; Exit: AL=0, normal mode 112 ; CX=0, no table records 113 ; DX=0, no relative entry 114 ; Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 3 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 115 ; Add Time/Target table entry 116 ; Entry: AH=7 117 ; Exit: AL=2, [non-existent] table full, entry not added 118 ; 119 ; Read driver's date and time 120 ; Entry: AH=8 121 ; Exit: AX=BX=CX=DX=0, all zeroes, obviously invalid 122 ; 123 ; Disable/Enable driver 124 ; Entry: AH=9 125 ; AL ignored 126 ; Exit: none 127 ; 128 ; All these and other unused functions clear all registers and return. 129 ; 130 ; Commands added for 'stow' user interface. 131 ; 132 ; Change to invert mode, antennas "over on back" 133 ; Entry: AH=96 134 ; Exit: none 135 ; 136 ; Set mechanical errors 137 ; Entry: AH=97 138 ; CX= elevation error, degrees, signed binary (-9 to 9) 139 ; DX= azimuth error, same 140 ; Exit: none 141 ; 142 ; Set elevation stall limits (before mechanical error removal) 143 ; Entry: AH=98 144 ; CX= elevation upper limit, degrees, signed binary 145 ; DX= elevation lower limit 146 ; 147 ; Set azimuth stall limits (before mechanical error removal) 148 ; Entry: AH=99 149 ; CX= azimuth upper limit, degrees, signed binary 150 ; DX= azimuth lower limit 151 ; 152 ; GT support: two functions 153 ; 154 ; Write value to rotors 155 ; Entry: AL=0 156 ; BX=azimuth 157 ; DX=elevation 158 ; CL=satellite number (1-16,90,91-92) not used 159 ; CH=user number (1-16) verified to be 0 (manual) or 1 160 ; ES:SI:DI=frequency info, not used 161 ; Exit: same as Read value below 162 ; 163 ; Read value of rotors (faked to previously commanded values as in KCT) 164 ; Entry: AL=2 165 ; Exit: BX=azimuth 166 ; DX=elevation 167 168 =0063 int_at equ 63h ;interrupt service routine 169 =0068 int_gt equ 104d 170 =0067 id_gt equ 103d 171 Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 4 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 172 =0060 invflp equ 96d ;user number for inverted mode toggle 173 =0061 mechst equ 97d ;user number for mechanical errors set 174 =0062 stlste equ 98d ;user number for stall settings, elevation 175 =0063 stlsta equ 99d ;user number for stall settings, azimuth 176 177 =000C baudra equ 00Ch ;Baud Rate Divisor for 9600 baud 178 =0037 mapcol equ 055d ;column position of RotorDRV signature in Map mode 179 =0013 mapos equ 019d ;row for RotorDRV signature of IT in Map mode 180 =0033 rtrpos equ 051d ;column position of RotorDRV signature in Text mode 181 =03E7 ATNULL equ 999d ;value used to indicate 'no data' in KCT reads 182 =FFFF GTNULL equ 0FFFFh ;value used to indicate 'no data' in gt reads 183 ; 184 ; macros 185 ; 186 187 conout macro message ;console output 188 mov dx,offset message ;message string, '$' terminator 189 mov ah,09h ;CP/M like system call 190 int 21h ;invoke DOS 191 endm 192 193 command macro number,process ;command dispatch macro 194 local next 195 cmp ah,number ;determine command number 196 jnz next 197 call process ;when number found 198 jmp at_ret ;then, outta here 199 next: 200 endm 201 202 ; 203 ; This strobe routine sends data in al to the parallel port without strobing it 204 ; 205 206 strobe macro ;strobe the byte in al out to port 207 push dx ;save dx 208 mov dx,prnport ;by Murphy, dx is used for ports 209 out dx,al ;write it to port 210 pop dx ;restore dx 211 endm ;return to caller 212 213 ; 214 ; now, the installing at.com program, to be run before IT on boot 215 ; 216 217 0000 code segment public 218 219 org 100h ;who knows why they put us 220 assume cs:code,ds:code,es:code ; through this 221 222 ; 223 ; load time entry point 224 ; 225 226 0100 start: 227 0100 0E push cs 228 0101 1F pop ds ;so the assume statement works Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 5 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 229 230 0102 C6 06 0183r 63 90 mov at_i,int_at ;software interrupt vectors 231 0108 C6 06 0184r 68 90 mov gt_i,int_gt 232 010E C6 06 0185r 67 90 mov gt_id,id_gt 233 234 conout start_msg ;display signon message 1 235 0114 BA 02BAr mov dx,offset start_msg ;start_msg string, '$' terminator 1 236 0117 B4 09 mov ah,09h ;CP/M like system call 1 237 0119 CD 21 int 21h ;invoke DOS 238 239 ; 240 ; get stuff from command line 241 ; ds:81h - space 242 ; ds:82h - comm number, must be '1,' '2,' or '3' 243 ; ds:83h - CR 244 ; 245 011B BB 0081 mov bx,81h ;1st byte should be a space 246 011E 8A 07 mov al,[bx] 247 0120 3C 20 cmp al,' ' 248 0122 75 4F jne cline_bad 249 250 0124 43 inc bx 251 0125 8A 07 mov al,[bx] ;2nd byte 252 0127 2C 30 sub al,'0' ;valid check, must be 253 0129 7C 48 jl cline_bad ; between 1 and 3 inclusive 254 012B 3C 03 cmp al,3d ; (also convert to binary) 255 012D 7F 44 jg cline_bad 256 012F A2 0186r mov prnnr,al ;stored 257 258 ; 259 ; Now determine the address of the ports, the last thing that can 260 ; go wrong. . . 261 ; 262 263 0132 8A 1E 0186r prndet: mov bl,prnnr 264 0136 FE CB dec bl ;change from 1 based to 0 based index 265 0138 32 FF xor bh,bh ;bx now contains LPT/COMM number 266 013A D1 E3 shl bx,1 ; * 2, word addressing 267 013C 1E push ds 268 assume ds:nothing 269 013D 33 C0 xor ax,ax ;Zero Ax and put in ds for 270 013F 8E D8 mov ds,ax ;base segment, where DOS stuff is 271 0141 8B 97 0408 mov dx,[bx][0408h] ;where DOS keeps the LPT port numbers 272 0145 1F pop ds ;Restore our data segment 273 assume ds:code 274 0146 0B D2 or dx,dx ;check for zero, means no port 275 0148 74 20 jz port_bad 276 014A 89 16 018Br mov prnport,dx ;save the address of lpt port 277 014E 1E push ds ;Save our data segment 278 assume ds:nothing 279 014F 33 C0 xor ax,ax ;Zero Ax and put in ds for 280 0151 8E D8 mov ds,ax ;base segment, where DOS stuff is 281 0153 8B 97 0400 mov dx,[bx][0400h] ;where DOS keeps the COMM port numbers 282 0157 1F pop ds ;Restore our data segment 283 assume ds:code 284 0158 0B D2 or dx,dx ;check for zero, means no port 285 015A 74 0E jz port_bad Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 6 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 286 015C 89 16 0189r mov comport,dx ;save the address of comm port 287 0160 83 C2 05 add dx,5 ;calculate offset to Line Status Reg 288 0163 89 16 018Dr mov comlsr,dx ;save the line status register 289 0167 E9 0123 jmp setup ;continue 290 291 ; 292 ; invalid command line processing 293 ; 294 295 016A port_bad: 296 conout badprn 1 297 016A BA 01A9r mov dx,offset badprn ;badprn string, '$' terminator 1 298 016D B4 09 mov ah,09h ;CP/M like system call 1 299 016F CD 21 int 21h ;invoke DOS 300 0171 EB 07 jmp short quit 301 302 0173 cline_bad: 303 conout usage 1 304 0173 BA 01F0r mov dx,offset usage ;usage string, '$' terminator 1 305 0176 B4 09 mov ah,09h ;CP/M like system call 1 306 0178 CD 21 int 21h ;invoke DOS 307 017A quit: conout noload 1 308 017A BA 01D4r mov dx,offset noload ;noload string, '$' terminator 1 309 017D B4 09 mov ah,09h ;CP/M like system call 1 310 017F CD 21 int 21h ;invoke DOS 311 0181 CD 20 int 20h ;return to dos, old style 312 313 ; 314 ; the general data declaration area 315 ; 316 317 0183 ?? at_i db ? ;value of interrupt number 318 0184 ?? gt_i db ? ;value of interrupt number 319 0185 ?? gt_id db ? ;value of interrupt number 320 0186 ?? prnnr db ? ;number of printer port used 321 0187 00 onback db 00h ;"on back" track, 00h = no, FFh = yes 322 0188 00 parow db 00h ;IT's parameter row number 0=not found 323 0189 ???? comport dw ? ;port number for Serial output 324 018B ???? prnport dw ? ;port number for parallel output 325 018D ???? comlsr dw ? ;port number for Serial Line Status Reg 326 018F 03E7 oldaz dw ATNULL ;last azimuth command or none (0FFFFh) 327 0191 03E7 oldel dw ATNULL ;last elevation command or none (0FFFFh) 328 0193 0000 elcorr dw 0d ;mechanical elevation correction 329 0195 0000 azcorr dw 0d ;mechanical azimuth correction 330 0197 0000 ellostl dw 0d ;minimum uncorrected value for el 331 0199 00B4 elhistl dw 180d ;maximum uncorrected value for el 332 019B 0000 azlostl dw 0d ;minimum uncorrected value for az -180 333 019D 0167 azhistl dw 359d ;maximum uncorrected value for az +180 334 019F FFFF azcmd dw -1d ;previous word strobed 335 01A1 FFFF elcmd dw -1d ;previous word strobed 336 01A3 0000 azbcal dw 0000h ;3843 azimuth bca storage lower word 337 01A5 80 azbcam db 80h ;3843 azimuth bca storage upper byte 180 degrees 338 01A6 0000 elbcal dw 0000h ;3843 elevation bca storage lower word 339 01A8 40 elbcam db 40h ;3843 elevation bca storage upper byte 90 degrees 340 ; 341 ; stuff to print 342 ; Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 7 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 343 344 01A9 0D 0A 6E 6F 20 73 75+ badprn db 0Dh,0Ah,'no such comm and printer ports installed','$' 345 63 68 20 63 6F 6D 6D+ 346 20 61 6E 64 20 70 72+ 347 69 6E 74 65 72 20 70+ 348 6F 72 74 73 20 69 6E+ 349 73 74 61 6C 6C 65 64+ 350 24 351 01D4 0D 0A 0A 73 61 20 61+ noload db 0Dh,0Ah,0Ah,'sa aborted, not loaded',0Dh,0Ah,'$' 352 62 6F 72 74 65 64 2C+ 353 20 6E 6F 74 20 6C 6F+ 354 61 64 65 64 0D 0A 24 355 01F0 0D 0A 63 6F 6D 6D 61+ usage db 0Dh,0Ah,'command line must be either:' 356 6E 64 20 6C 69 6E 65+ 357 20 6D 75 73 74 20 62+ 358 65 20 65 69 74 68 65+ 359 72 3A 360 020E 0D 0A 20 db 0Dh,0Ah,' ' 361 0211 0D 0A 20 20 20 73 61+ db 0Dh,0Ah,' sa n' 362 20 6E 363 021A 0D 0A 20 db 0Dh,0Ah,' ' 364 021D 0D 0A 20 20 20 20 20+ db 0Dh,0Ah,' where' 365 20 20 77 68 65 72 65 366 022B 0D 0A 20 20 20 20 20+ db 0Dh,0Ah,' n = comm port, 1, 2, or 3,' 367 20 20 20 20 6E 20 3D+ 368 20 63 6F 6D 6D 20 70+ 369 6F 72 74 2C 20 31 2C+ 370 20 32 2C 20 6F 72 20+ 371 33 2C 372 0250 0D 0A 20 20 20 20 20+ db 0Dh,0Ah,' the equivilent printer port must also be present.' 373 20 20 74 68 65 20 65+ 374 71 75 69 76 69 6C 65+ 375 6E 74 20 70 72 69 6E+ 376 74 65 72 20 70 6F 72+ 377 74 20 6D 75 73 74 20+ 378 61 6C 73 6F 20 62 65+ 379 20 70 72 65 73 65 6E+ 380 74 2E 381 028A 0D 0A 24 db 0Dh,0Ah,'$' 382 383 028D setup: 384 385 028D E8 045C call initser ;initalise the serial port 386 387 ; 388 ; set up the interrupt vectors and indicator 389 ; 390 0290 B4 25 mov ah,25h ;DOS set interrupt command 391 0292 A0 0183r mov al,at_i ;the interrupt service itself 392 0295 BA 03CBr mov dx,offset at_svc ;interrupt service routine, ds: ok 393 0298 CD 21 int 21h ;do the deed 394 395 029A B4 25 mov ah,25h ;DOS set interrupt command 396 029C A0 0184r mov al,gt_i ;the interrupt service itself 397 029F BA 04DFr mov dx,offset gt_svc ;interrupt service routine, ds: ok 398 02A2 CD 21 int 21h ;do the deed 399 Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 8 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 400 02A4 B4 25 mov ah,25h ;DOS set interrupt command 401 02A6 A0 0185r mov al,gt_id ;the interrupt service itself 402 02A9 BA DEAF mov dx,0DEAFh ;interrupt present code, ds: ok 403 02AC CD 21 int 21h ;do the deed 404 405 ; 406 ; done, now exit, staying resident in the old style 407 ; 408 409 02AE tsr: 410 conout loadok ;final message 1 411 02AE BA 039Ar mov dx,offset loadok ;loadok string, '$' terminator 1 412 02B1 B4 09 mov ah,09h ;CP/M like system call 1 413 02B3 CD 21 int 21h ;invoke DOS 414 02B5 BA 072Dr lea dx,at_end ;end of memory now in use 415 02B8 CD 27 int 27h ;tsr exit 416 417 ; ---------------------------------------------------------------- 418 ; End of Transient Loader code Rest of Code is Resident Code (TSR) 419 ; ---------------------------------------------------------------- 420 421 02BA start_msg: 422 02BA 0D 0A 49 54 20 74 6F+ db 0Dh,0Ah,'IT to COMMn SA-3843 ACU AutoTracker control TSR loading' 423 20 43 4F 4D 4D 6E 20+ 424 53 41 2D 33 38 34 33+ 425 20 41 43 55 20 41 75+ 426 74 6F 54 72 61 63 6B+ 427 65 72 20 63 6F 6E 74+ 428 72 6F 6C 20 54 53 52+ 429 20 6C 6F 61 64 69 6E+ 430 67 431 02F3 0D 0A 45 6D 75 6C 61+ db 0Dh,0Ah,'Emulates KCT and GT Int 63 with SA-3843 hardware interface' 432 74 65 73 20 4B 43 54+ 433 20 61 6E 64 20 47 54+ 434 20 49 6E 74 20 36 33+ 435 20 77 69 74 68 20 53+ 436 41 2D 33 38 34 33 20+ 437 68 61 72 64 77 61 72+ 438 65 20 69 6E 74 65 72+ 439 66 61 63 65 440 032F 0D 0A 57 69 74 68 20+ db 0Dh,0Ah,'With Full Angle Resolution read from IT map or text display' 441 46 75 6C 6C 20 41 6E+ 442 67 6C 65 20 52 65 73+ 443 6F 6C 75 74 69 6F 6E+ 444 20 72 65 61 64 20 66+ 445 72 6F 6D 20 49 54 20+ 446 6D 61 70 20 6F 72 20+ 447 74 65 78 74 20 64 69+ 448 73 70 6C 61 79 449 036C 0D 0A 20 56 65 72 73+ db 0Dh,0Ah,' Version 1.32, 1 February 97, N5BF/VK1KNP' 450 69 6F 6E 20 31 2E 33+ 451 32 2C 20 31 20 46 65+ 452 62 72 75 61 72 79 20+ 453 39 37 2C 20 4E 35 42+ 454 46 2F 56 4B 31 4B 4E+ 455 50 456 0397 0D 0A 24 db 0Dh,0Ah,'$' Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 9 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 457 458 039A 0D 0A 53 41 2D 33 38+ loadok: db 0Dh,0Ah,'SA-3843 AutoTrack control succesfully loaded' 459 34 33 20 41 75 74 6F+ 460 54 72 61 63 6B 20 63+ 461 6F 6E 74 72 6F 6C 20+ 462 73 75 63 63 65 73 66+ 463 75 6C 6C 79 20 6C 6F+ 464 61 64 65 64 465 03C8 0D 0A 24 db 0Dh,0Ah,'$' 466 467 ; ------------------------------------------------- 468 ; Here follows the actual interrupt service routine 469 ; ------------------------------------------------- 470 471 03CB at_svc proc far ;must be 'far' since interrupt svc. 472 473 03CB 1E push ds ;Save ds on stack, must retrieve B4 iret 474 475 03CC 0E push cs ;copy cs into ds 476 03CD 1F pop ds ;local data, as 'assumed' 477 ;not using much stack, no switch 478 479 03CE EB 61 90 jmp cd ;jump to command dispatcher 480 481 ; ------------- 482 ; TSR Data Area 483 ; ------------- 484 485 03D1 20 20 20 20 db ' ' ;extra bytes to correctly locate signature 486 03D5 52 6F 74 6F 72 44 52+ sig db 'RotorDRV' ;official signature indicates presence 487 56 488 489 03DD 2E 00 00 bcangl db 02Eh,00h,00h ;BCD 000.001 490 03E0 5C 00 00 db 05Ch,00h,00h ;BCD 000.002 491 03E3 B8 00 00 db 0B8h,00h,00h ;BCD 000.004 492 03E6 70 01 00 db 070h,01h,00h ;BCD 000.008 493 494 03E9 D2 01 00 db 0D2h,01h,00h ;BCD 000.010 495 03EC A4 03 00 db 0A4h,03h,00h ;BCD 000.020 496 03EF 48 07 00 db 048h,07h,00h ;BCD 000.040 497 03F2 90 0E 00 db 090h,0Eh,00h ;BCD 000.080 498 499 03F5 34 12 00 db 034h,012h,00h ;BCD 000.100 500 03F8 68 24 00 db 068h,024h,00h ;BCD 000.200 501 03FB D0 48 00 db 0D0h,048h,00h ;BCD 000.400 502 03FE A0 91 00 db 0A0h,091h,00h ;BCD 000.800 503 504 0401 0B B6 00 db 00Bh,0B6h,00h ;BCD 001.000 505 0404 16 6C 01 db 016h,06Ch,01h ;BCD 002.000 506 0407 2C D8 02 db 02Ch,0D8h,02h ;BCD 004.000 507 040A 58 B0 05 db 058h,0B0h,05h ;BCD 008.000 508 509 040D 71 1C 07 db 071h,01Ch,07h ;BCD 010.000 510 0410 E2 38 0E db 0E2h,038h,0Eh ;BCD 020.000 511 0413 C4 71 1C db 0C4h,071h,1Ch ;BCD 040.000 512 0416 88 E3 38 db 088h,0E3h,38h ;BCD 080.000 513 Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 10 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 514 0419 71 1C 47 db 071h,01Ch,47h ;BCD 100.000 515 041C E2 38 8E db 0E2h,038h,8Eh ;BCD 200.000 516 517 041F 50 36 30 57 acucmd db 'P60W' 518 0423 30 30 30 30 30 30 acuaz db '000000' 519 0429 30 30 30 30 34 30 acuel db '000040' 520 042F 0D 0A db 0Dh,0Ah 521 522 ; ------------- 523 ; TSR Code Area 524 ; ------------- 525 526 0431 cd: ;real code begins 527 ; 528 ; command dispatcher 529 ; 530 command 0,at_stat ;status function 1 531 0431 80 FC 00 cmp ah,0 ;determine command 0 1 532 0434 75 06 jnz ??0000 1 533 0436 E8 00E5 call at_stat ;when 0 found 1 534 0439 E9 0092 jmp at_ret ;then, outta here 1 535 043C ??0000: 536 command 1,at_null ;read slew 1 537 043C 80 FC 01 cmp ah,1 ;determine command 1 1 538 043F 75 06 jnz ??0001 1 539 0441 E8 008C call at_null ;when 1 found 1 540 0444 E9 0087 jmp at_ret ;then, outta here 1 541 0447 ??0001: 542 command 2,at_null ;write slew 1 543 0447 80 FC 02 cmp ah,2 ;determine command 2 1 544 044A 75 06 jnz ??0002 1 545 044C E8 0081 call at_null ;when 2 found 1 546 044F EB 7D 90 jmp at_ret ;then, outta here 1 547 0452 ??0002: 548 command 3,at_read ;read antenna position commanded 1 549 0452 80 FC 03 cmp ah,3 ;determine command 3 1 550 0455 75 06 jnz ??0003 1 551 0457 E8 00CA call at_read ;when 3 found 1 552 045A EB 72 90 jmp at_ret ;then, outta here 1 553 045D ??0003: 554 command 4,at_writ ;set antenna position 1 555 045D 80 FC 04 cmp ah,4 ;determine command 4 1 556 0460 75 06 jnz ??0004 1 557 0462 E8 0110 call at_writ ;when 4 found 1 558 0465 EB 67 90 jmp at_ret ;then, outta here 1 559 0468 ??0004: 560 command 5,at_null ;clear table 1 561 0468 80 FC 05 cmp ah,5 ;determine command 5 1 562 046B 75 06 jnz ??0005 1 563 046D E8 0060 call at_null ;when 5 found 1 564 0470 EB 5C 90 jmp at_ret ;then, outta here 1 565 0473 ??0005: 566 command 6,at_null ;get table 1 567 0473 80 FC 06 cmp ah,6 ;determine command 6 1 568 0476 75 06 jnz ??0006 1 569 0478 E8 0055 call at_null ;when 6 found 1 570 047B EB 51 90 jmp at_ret ;then, outta here Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 11 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 1 571 047E ??0006: 572 command 7,at_atbl ;add to table 1 573 047E 80 FC 07 cmp ah,7 ;determine command 7 1 574 0481 75 06 jnz ??0007 1 575 0483 E8 00AA call at_atbl ;when 7 found 1 576 0486 EB 46 90 jmp at_ret ;then, outta here 1 577 0489 ??0007: 578 command 8,at_null ;read time 1 579 0489 80 FC 08 cmp ah,8 ;determine command 8 1 580 048C 75 06 jnz ??0008 1 581 048E E8 003F call at_null ;when 8 found 1 582 0491 EB 3B 90 jmp at_ret ;then, outta here 1 583 0494 ??0008: 584 command 9,at_null ;enable/disable driver 1 585 0494 80 FC 09 cmp ah,9 ;determine command 9 1 586 0497 75 06 jnz ??0009 1 587 0499 E8 0034 call at_null ;when 9 found 1 588 049C EB 30 90 jmp at_ret ;then, outta here 1 589 049F ??0009: 590 command invflp,at_inv ;console invert mode command 1 591 049F 80 FC 60 cmp ah,invflp ;determine command invflp 1 592 04A2 75 06 jnz ??000A 1 593 04A4 E8 0032 call at_inv ;when invflp found 1 594 04A7 EB 25 90 jmp at_ret ;then, outta here 1 595 04AA ??000A: 596 command mechst,at_mch ;console mechanical error command 1 597 04AA 80 FC 61 cmp ah,mechst ;determine command mechst 1 598 04AD 75 06 jnz ??000B 1 599 04AF E8 0084 call at_mch ;when mechst found 1 600 04B2 EB 1A 90 jmp at_ret ;then, outta here 1 601 04B5 ??000B: 602 command stlste,at_ste ;console stall limit command, el 1 603 04B5 80 FC 62 cmp ah,stlste ;determine command stlste 1 604 04B8 75 06 jnz ??000C 1 605 04BA E8 008E call at_ste ;when stlste found 1 606 04BD EB 0F 90 jmp at_ret ;then, outta here 1 607 04C0 ??000C: 608 command stlsta,at_sta ;console stall limit command, az 1 609 04C0 80 FC 63 cmp ah,stlsta ;determine command stlsta 1 610 04C3 75 06 jnz ??000D 1 611 04C5 E8 0092 call at_sta ;when stlsta found 1 612 04C8 EB 04 90 jmp at_ret ;then, outta here 1 613 04CB ??000D: 614 615 04CB E8 0002 call at_null ;all other commands, no-op 616 ; 617 ; command error has occured 618 ; 619 620 04CE 1F at_ret: pop ds 621 04CF CF iret 622 623 04D0 at_svc endp 624 625 04D0 at_null proc near ;does nothing, clears registers 626 04D0 33 C0 xor ax,ax 627 04D2 8B D8 mov bx,ax Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 12 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 628 04D4 8B C8 mov cx,ax 629 04D6 8B D0 mov dx,ax 630 04D8 C3 ret 631 04D9 at_null endp 632 633 04D9 at_inv proc near ;toggle inverted mode 634 04D9 80 36 0187r FF xor onback,0FFh ;flip 635 04DE C3 ret 636 04DF at_inv endp 637 638 ; 639 ; --------------------------- 640 ; GT Interupt Service Routine 641 ; --------------------------- 642 ; 643 644 04DF gt_svc proc ;Graftrak conversion to KCT 645 04DF 1E push ds 646 04E0 0E push cs 647 04E1 1F pop ds ;set up to local ds 648 04E2 3C 02 cmp al,2 ;read only function? 649 04E4 74 1C je gt_rd 650 04E6 3C 00 cmp al,0 ;write function? 651 04E8 74 03 je gt_wr 652 04EA EB 30 90 jmp gt_rt ;all others, no-op 653 654 04ED 80 FD 01 gt_wr: cmp ch,1 ;observer 1? 655 04F0 74 08 je gt_wr0 656 04F2 80 FD 00 cmp ch,0 ;or none 657 04F5 74 03 je gt_wr0 658 04F7 EB 23 90 jmp gt_rt ;if neither, no-op 659 04FA 8B CA gt_wr0: mov cx,dx ;mov elevation to KCT location 660 04FC 8B D3 mov dx,bx ;mov azimuth to KCT location 661 04FE B4 04 mov ah,4 ;KCT write command 662 0500 CD 63 int int_at ;now drive the KCT interface 663 ;and proceed to read function 664 0502 B4 03 gt_rd: mov ah,3 ;KCT read command 665 0504 CD 63 int int_at 666 0506 8B DA mov bx,dx ;mov azimuth from KCT to GT 667 0508 8B D1 mov dx,cx ;mov elevation from KCT to GT 668 050A 81 FB 03E7 cmp bx,ATNULL 669 050E 75 03 jne gt_rd0 670 0510 BB FFFF mov bx,GTNULL ;change clear to GT standard 671 0513 81 FA 03E7 gt_rd0: cmp dx,ATNULL 672 0517 75 03 jne gt_rt 673 0519 BA FFFF mov dx,GTNULL ;change clear to GT standard 674 675 051C 1F gt_rt: pop ds 676 051D CF iret ;outta here 677 051E gt_svc endp 678 679 ; 680 ; --------------------------- 681 ; General AT Service Routines 682 ; --------------------------- 683 ; 684 051E at_stat proc near ;status report Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 13 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 685 051E E8 FFAF call at_null ;clear everything 686 0521 B7 01 mov bh,01 ;as specified 687 0523 C3 ret 688 0524 at_stat endp 689 690 0524 at_read proc near 691 0524 A1 0191r mov ax,oldel ;report what we think we've most 692 0527 8B 1E 018Fr mov bx,oldaz ;recently done 693 052B 8B C8 mov cx,ax 694 052D 8B D3 mov dx,bx 695 052F C3 ret 696 0530 at_read endp 697 698 ; ------------------------------------- 699 ; Other KCT command processing routines 700 ; ------------------------------------- 701 702 0530 at_atbl proc near 703 0530 E8 FF9D call at_null 704 0533 B0 02 mov al,2 ;as desired 705 0535 C3 ret 706 0536 at_atbl endp 707 708 0536 at_mch proc near 709 0536 89 0E 0193r mov elcorr,cx ;store the mechanical correction values 710 053A 89 16 0195r mov azcorr,dx ;KCT convention 711 053E C7 06 018Fr 03E7 mov oldaz,ATNULL ;Clear current settings since they are 712 0544 C7 06 0191r 03E7 mov oldel,ATNULL ; invalidated by new corrections or 713 054A C3 ret 714 054B at_mch endp 715 716 054B at_ste proc near 717 054B 89 16 0197r mov ellostl,dx ;store mechanical stall limits 718 054F 89 0E 0199r mov elhistl,cx 719 0553 C7 06 0191r 03E7 mov oldel,ATNULL ; invalidated by new corrections or 720 0559 C3 ret 721 055A at_ste endp 722 723 055A at_sta proc near 724 055A 89 16 019Br mov azlostl,dx ;KCT convention 725 055E 81 2E 019Br 00B4 sub azlostl,180d ;checked this way because of wrap point 726 0564 89 0E 019Dr mov azhistl,cx 727 0568 81 06 019Dr 00B4 add azhistl,180d ;checked this way because of wrap point 728 056E C7 06 018Fr 03E7 mov oldaz,ATNULL ;Clear current setting 729 0574 C3 ret 730 0575 at_sta endp 731 732 ; --------------------------- 733 ; Routine to Move the Antenna 734 ; --------------------------- 735 736 0575 at_writ proc near 737 0575 51 push cx ;save cx - elevation 738 0576 52 push dx ;save dx - azimuth 739 740 ; Check for the presence of Instant Tracks RotorDRV screen signature before 741 ; attempting to read az & el off the display. The line the signature is Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 14 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 742 ; found on tells us if we are on the map or text tracking screens and sets 743 ; variable parow to the line of the parameters 21=Map 02=Text 744 745 0577 E8 0096 call testsig ;Check RotorDRV signature on Screen 746 057A 74 78 jz sinope ;if failure skip bca number conversions 747 748 ; Read Azimuth off the screen and convert it to a 24 bit binary coded angle 749 750 057C B2 14 mov dl,20 ;pointer to 100ths deg Az 751 057E BE 03DDr mov si,offset bcangl ;si points to bc angle lookup table 752 0581 BF 01A3r mov di,offset azbcal ;point to azimuth bca storage 753 0584 33 C0 xor ax,ax ;zero ax 754 0586 89 05 mov [di],ax ;zero azimuth bca storage 755 0588 88 45 02 mov [di+2],al ;all 3 bytes 756 757 058B B5 03 mov ch,3 ;number of digits below decimal pnt 758 058D E8 00DB call bcadig ;calculate digits below decimal pnt 759 760 0590 FE CA dec dl ;skip decimal point location 761 0592 B5 03 mov ch,3 ;number of digits above decimal pnt 762 0594 E8 00D4 call bcadig ;calculate digits above decimal pnt 763 764 0597 BE 01A3r mov si,offset azbcal ;point at BCA storage 765 059A BF 0423r mov di,offset acuaz ;point at command azimuth 766 059D FC cld ;clear direction flag (increment) 767 059E AC lodsb ;get llsb BCA into al 768 059F E8 0123 call hexasc ;Convert to Ascii & Store 769 05A2 AC lodsb ;get lsb BCA into al 770 05A3 E8 011F call hexasc ;Convert to Ascii & Store 771 05A6 AC lodsb ;get msb BCA into al 772 05A7 E8 011B call hexasc ;Convert to Ascii & Store 773 774 ; First need to determine where the Elevation decimal point is because it is 775 ; in a different position depending on Map or Text screen mode and one place 776 ; further to the left if the sun is being tracked. 777 778 05AA B2 1C mov dl,28 ;possible decimal point position 779 05AC E8 00CD call getnum ;test dec pnt character map screen 780 05AF 72 11 jc found ;carry set if decimal point 781 782 05B1 FE CA dec dl ;point to text screen dec pnt pos 783 05B3 E8 00C6 call getnum ;test dec pnt character text screen 784 05B6 72 0A jc found ;carry set if decimal point 785 786 05B8 FE CA dec dl ;point to text screen dec pnt pos 787 05BA E8 00BF call getnum ;test dec pnt char text screen sun 788 05BD 72 03 jc found ;carry set if decimal point 789 790 05BF EB 33 90 jmp sinope ;decimal point not found so give up 791 792 ; Read Elevation off the screen and convert it to a 24 bit binary coded angle 793 794 05C2 80 C2 03 found: add dl,3 ;point to 100ths degree El digit 795 05C5 BE 03DDr mov si,offset bcangl ;si points to bc angle lookup table 796 05C8 BF 01A6r mov di,offset elbcal ;point to elevation bca storage 797 05CB 33 C0 xor ax,ax ;zero ax 798 05CD 89 05 mov [di],ax ;zero elevation bca storage Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 15 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 799 05CF 88 45 02 mov [di+2],al ;all 3 bytes 800 801 05D2 B5 03 mov ch,3 ;number of digits below decimal pnt 802 05D4 E8 0094 call bcadig ;calculate digits below decimal pnt 803 804 05D7 FE CA dec dl ;skip decimal point location 805 05D9 B5 02 mov ch,2 ;number of digits above decimal pnt 806 05DB E8 008D call bcadig ;calculate digits above decimal pnt 807 808 05DE BE 01A6r mov si,offset elbcal ;point at BCA elevation storage 809 05E1 BF 0429r mov di,offset acuel ;point at command elevation 810 05E4 FC cld ;clear direction flag (increment) 811 05E5 AC lodsb ;get llsb BCA into al 812 05E6 E8 00DC call hexasc ;Convert to Ascii & Store 813 05E9 AC lodsb ;get lsb BCA into al 814 05EA E8 00D8 call hexasc ;Convert to Ascii & Store 815 05ED AC lodsb ;get msb BCA into al 816 05EE E8 00D4 call hexasc ;Convert to Ascii & Store 817 818 ; For diagnostic purposes send one of the 24 bit bytes to the port for display 819 820 ; mov di,offset acuel ;point at elevation ascii data 821 ; mov al,[di+5] ;get result in al 822 ; strobe ;output to port 823 824 05F1 E8 0120 call serout ;send the serial command to ACU 825 826 05F4 5A sinope: pop dx ;restore dx - azimuth 827 05F5 59 pop cx ;restore cx - elevation 828 05F6 39 0E 0191r cmp oldel,cx ;Has elevation changed 829 05FA 75 09 jne atw0 ;then process it 830 05FC 39 16 018Fr cmp oldaz,dx ;Has azimuth changed 831 0600 75 03 jne atw0 ;then process it 832 0602 E9 FF1F jmp at_read ;if nothing has changed 833 834 0605 89 16 018Fr atw0: mov oldaz,dx ;new azimuth for report 835 0609 89 0E 0191r mov oldel,cx ;new elevation for report 836 060D E9 FF14 jmp at_read ;and report back 837 0610 at_writ endp 838 ;------------------------------------------------------------------------------ 839 840 ; ------------------------------- 841 ; Test RotorDRV Signature Routine 842 ; ------------------------------- 843 844 ; This routine tests the signature string that Instant Track displays on the 845 ; screen when RotorDRV is active. This allows us to determine the display 846 ; mode (text or map) that is being used and so locate the on screen 847 ; co-ordinates. 848 849 0610 testsig proc near ;test sig on screen in IT 850 0610 53 push bx ;save bx 851 0611 56 push si ;save si 852 0612 1E push ds ;save ds 853 0613 33 DB xor bx,bx ;set bx to graphics page zero 854 0615 BE 03D5r mov si,offset sig ;sig address is now ds:si 855 0618 B6 13 mov dh,mapos ;set dh to map row (19) Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 16 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 856 061A B2 37 mov dl,mapcol ;Load position of IT Rotor sig 857 061C B1 08 mov cl,08h ;Load character count to 8 858 061E B4 02 simlop: mov ah,02h ;set position cursor DOS command 859 0620 CD 10 int 10h ;position cursor via DOS 860 0622 B4 08 mov ah,08h ;set get character DOS command 861 0624 CD 10 int 10h ;get character bytes via DOS 862 0626 8A 24 mov ah,[si] ;get sig character 863 0628 3A C4 cmp al,ah ;compare with IT's Sig 864 062A 75 0A jne tstext ;Try Text screen pos 865 062C FE C2 inc dl ;point to next IT character 866 062E 46 inc si ;point to next sig character 867 062F FE C9 dec cl ;decrement byte counter 868 0631 75 EB jnz simlop ;loop for next character 869 0633 EB 1F 90 jmp tsok ;return with stored dh value 870 0636 32 F6 tstext: xor dh,dh ;try row 0 for text screen 871 0638 B2 33 mov dl,rtrpos ;Load position of IT Rotor sig 872 063A B1 08 mov cl,08h ;load character counter to 8 873 063C BE 03D5r mov si,offset sig ;sig address is now ds:si 874 063F B4 02 sitlop: mov ah,02h ;set position cursor DOS command 875 0641 CD 10 int 10h ;position cursor via DOS 876 0643 B4 08 mov ah,08h ;set get character DOS command 877 0645 CD 10 int 10h ;get character bytes via DOS 878 0647 8A 24 mov ah,[si] ;get sig character 879 0649 3A C4 cmp al,ah ;compare with IT's Sig 880 064B 75 18 jne tsexit ;Failed to find a signature 881 064D FE C2 inc dl ;point to next IT character 882 064F 46 inc si ;point to next sig character 883 0650 FE C9 dec cl ;decrement byte counter 884 0652 75 EB jnz sitlop ;loop for next character 885 0654 FE C6 tsok: inc dh ;point to co-ordinate 886 0656 FE C6 inc dh ;parameter row 887 0658 88 36 0188r mov parow,dh ;save row in dh to location rtrow 888 065C EB 07 90 jmp tsexit ;exit subroutine 889 065F 32 F6 xor dh,dh ;zero dh for failure 890 0661 88 36 0188r mov parow,dh ;parow = 0 for no sig found 891 0665 0A F6 tsexit: or dh,dh ;Test returned value zero=failure 892 0667 1F pop ds ;restore ds 893 0668 5E pop si ;restore si 894 0669 5B pop bx ;restore bx 895 066A C3 ret ;return to caller 896 066B testsig endp 897 898 ; ---------------------------------------------------------- 899 ; Routine to get Ascii Digits off the screen & Calculate BCA 900 ; ---------------------------------------------------------- 901 ; 902 ; Enter Routine with ch=number of digits to process 903 ; dl = column on screen where Ascii digit is 904 ; 905 066B bcadig proc near ;calculate bca digits 906 066B E8 000E nxtdig: call getnum ;get number 907 066E 8A F8 mov bh,al ;store digit in bh 908 0670 B1 04 mov cl,4 ;4 bits to convert in this digit 909 0672 E8 0031 call bcdbca ;convert number 910 0675 FE CA dec dl ;point to next screen digit 911 0677 FE CD dec ch ;decrement digit count 912 0679 75 F0 jnz nxtdig ;loop for next digit Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 17 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 913 067B C3 ret ;return to caller 914 067C bcadig endp 915 916 ; ---------------------------------------------------- 917 ; Get Position Number Off Instant Track Screen Routine 918 ; ---------------------------------------------------- 919 920 ; This routine uses DOS to read the co-ordinate number from IT's screen data 921 ; area on line 2 rows below RotorDRV during display mode. Destroys ax! 922 ; Character column is in dl on entry between 0 & 1Fh 923 ; Row of Display Co-ordinate Parameters is in parow 924 ; Routine returns the BCD number represented by the character in al. 925 ; Any non numerical Ascii Characters are returned as Zero 926 ; Carry flag is set if decimal point. 927 928 067C getnum proc near ;get co-ordinate number 929 067C 52 push dx ;save dx 930 067D 53 push bx ;save bx 931 067E 8A 36 0188r mov dh,parow ;get parameter row in dh 932 0682 80 E2 1F and dl,1Fh ;mask co-ordinate column < 20H 933 0685 BB 0000 mov bx,0 ;set graphics page 934 0688 B4 02 mov ah,02h ;set position cursor DOS command 935 068A CD 10 int 10h ;position cursor via DOS 936 068C B4 08 mov ah,08h ;set get character DOS command 937 068E CD 10 int 10h ;get character bytes via DOS 938 0690 8A E0 mov ah,al ;copy al into ah 939 0692 80 E4 F0 and ah,0f0h ;mask off most sig nibble 940 0695 80 EC 30 sub ah,30h ;subtract ascii number offset 941 0698 74 07 jz retnum ;zero then return number 942 069A 2C 2E sub al,2Eh ;check for decimal point 943 069C F9 stc ;set the carry flag 944 069D 74 04 jz retdpt ;return with carry set for dec pnt 945 069F 32 C0 xor al,al ;zero al 946 06A1 24 0F retnum: and al,0Fh ;convert ASCII to a BCD number 947 06A3 5B retdpt: pop bx ;restore bx 948 06A4 5A pop dx ;restore dx 949 06A5 C3 ret ;return to caller 950 06A6 getnum endp 951 952 ; ------------------------------------------------------------- 953 ; Binary Coded Decimal to Binary Coded Angle Conversion Routine 954 ; ------------------------------------------------------------- 955 956 ; This routine converts binary coded decimal digits to 24 bit binary coded 957 ; angles ready for output to the Scientific Atlanta 3843 ACU. 958 ; Digit to be converted is in bh while cl contains the conversion bit count 959 ; si contains pointer to bcangl lookup table 960 ; di is a pointer to the 16 bit word angle storage location 961 ; di+2 is an 8 bit byte angle storage location 962 963 06A6 bcdbca proc ;Convert bcd to bca 964 06A6 53 push bx ;save bx 965 06A7 51 push cx ;save cx 966 06A8 8B 05 mov ax,[di] ;get partial bca value 967 06AA 8A 5D 02 mov bl,[di+2] ;get ms byte of partial bca value 968 06AD D0 CF nextbt: ror bh,1 ;put lsb al in carry 969 06AF 73 05 jnc skipad ;if 0 then dont add bca weight Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 18 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 970 06B1 03 04 add ax,[si] ;add weighting factor (16 bits) 971 06B3 12 5C 02 adc bl,[si+2] ;compute ms byte weighting (8 bits inc cy) 972 06B6 83 C6 03 skipad: add si,3 ;point to next bca weight 973 06B9 FE C9 dec cl ;decrement bit counter 974 06BB 75 F0 jnz nextbt ;loop for next bit of bcd digit 975 06BD 89 05 mov [di],ax ;store the resulting bca 976 06BF 88 5D 02 mov [di+2],bl ;store ms byte bca 977 06C2 59 pop cx ;restore cx 978 06C3 5B pop bx ;restore bx 979 06C4 C3 ret ;return to caller 980 06C5 bcdbca endp 981 982 ; ------------------------------------------- 983 ; Hex Byte to 2 Byte Ascii Conversion Routine 984 ; ------------------------------------------- 985 986 ; Hex byte to be converted is in al on entry 987 ; di points to storage location where Ascii will be placed High nibble 988 ; first followed by low nibble. di points to next location on exit 989 990 06C5 hexasc proc near ;Hex to Ascii Conversion 991 06C5 8A E0 mov ah,al ;save al in ah 992 06C7 D0 CC D0 CC D0 CC D0+ ror ah,4 ;move high to low nibble 993 CC 994 06CF 25 0F0F and ax,0F0Fh ;mask off high nibbles 995 06D2 80 FC 0A cmp ah,0Ah ;see if 10 or above 996 06D5 7C 03 jnge numerh ;covert as a numeral (30-39h) 997 06D7 80 C4 07 add ah,7h ;convert to Alpha A-F (41-46h) 998 06DA 80 C4 30 numerh: add ah,30h ;HEX to ASCII conversion 999 06DD 3C 0A cmp al,0Ah ;see if 10 or above 1000 06DF 7C 02 jnge numerl ;covert as a numeral (30-39h) 1001 06E1 04 07 add al,7h ;convert to Alpha A-F (41-46h) 1002 06E3 04 30 numerl: add al,30h ;HEX to ASCII conversion 1003 06E5 88 25 mov [di],ah ;store High ASCII-Hex Nibble 1004 06E7 47 inc di ;point to next location 1005 06E8 88 05 mov [di],al ;store Low ASCII-Hex Nibble 1006 06EA 47 inc di ;point to next location 1007 06EB C3 ret ;return to caller 1008 06EC hexasc endp 1009 1010 ; 1011 ; set up the serial port 1012 ; 1013 1014 06EC initser proc near 1015 06EC 8B 16 0189r mov dx,comport ;get comm port address 1016 06F0 83 C2 03 add dx,3 ;address line control register 1017 06F3 B0 80 mov al,80h ;set baud rate register access 1018 06F5 EE out dx,al ;send it 1019 06F6 8B 16 0189r mov dx,comport ;get comm port address 1020 06FA B0 0C mov al,baudra ;set baud rate divisor 1021 06FC EE out dx,al ;to 9600 baud lsb 1022 06FD 32 C0 xor al,al ;zero al 1023 06FF 42 inc dx ;point to high byte baud rate div 1024 0700 EE out dx,al ;set high byte BRD to zero 1025 0701 83 C2 02 add dx,2 ;point to line control register 1026 0704 B0 07 mov al,07h ;No Parity, 8 bits, 1 stop Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 19 sa.ASM SA-3843 driver - KCT El and Az to a parallel port, resident part 1027 0706 EE out dx,al ;set data parameters 1028 0707 42 inc dx ;point to modem control register 1029 0708 B0 03 mov al,03h ;Set RTS & DTR 1030 070A EE out dx,al ;set modem lines 1031 070B 8B 16 0189r mov dx,comport ;get comm port address 1032 070F 42 inc dx ;point to Interrupt register 1033 0710 32 C0 xor al,al ;zero al 1034 0712 EE out dx,al ;Disable all interrupts 1035 0713 C3 ret 1036 0714 initser endp 1037 1038 ; -------------------------------------- 1039 ; Serial Port ACU Command Output Routine 1040 ; -------------------------------------- 1041 1042 ; This routine is called when 18 bytes of command information are to be sent 1043 ; out the serial port to the ACU using the SA-3843 command structure. 1044 1045 0714 serout proc near ;Serial Output Routine 1046 ; call initser ;initialise serial port 1047 0714 BE 041Fr mov si,offset acucmd ;Point to ACU Command Data 1048 0717 FC cld ;Clear direction flag 1049 0718 B9 0012 mov cx,18d ;18 bytes to send 1050 071B 8B 16 018Dr serlop: mov dx,comlsr ;point to line status register port 1051 071F EC in al,dx ;get line status 1052 0720 A8 20 test al,20H ;mask off all but tx buffer status 1053 0722 74 F7 jz serlop ;if buffer full then loop 1054 1055 0724 AC lodsb ;get command string byte in al 1056 0725 8B 16 0189r mov dx,comport ;point to serial transmit register 1057 0729 EE out dx,al ;put byte in register 1058 072A E2 EF loop serlop ;loop if more bytes to send 1059 1060 072C C3 ret ;return to caller 1061 072D serout endp 1062 1063 072D at_end label byte ;sets tsr memory save location 1064 1065 072D code ends 1066 1067 end start ;the routine to run when run Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 20 Symbol Table SA-3843 driver - KCT El and Az to a parallel port, resident part Symbol Name Type Value ??0000 Near CODE:043C ??0001 Near CODE:0447 ??0002 Near CODE:0452 ??0003 Near CODE:045D ??0004 Near CODE:0468 ??0005 Near CODE:0473 ??0006 Near CODE:047E ??0007 Near CODE:0489 ??0008 Near CODE:0494 ??0009 Near CODE:049F ??000A Near CODE:04AA ??000B Near CODE:04B5 ??000C Near CODE:04C0 ??000D Near CODE:04CB ??DATE Text "02/01/97" ??FILENAME Text "sa " ??TIME Text "22:46:10" ??VERSION Number 0314 @CPU Text 0101H @CURSEG Text CODE @FILENAME Text SA @WORDSIZE Text 2 ACUAZ Byte CODE:0423 ACUCMD Byte CODE:041F ACUEL Byte CODE:0429 ATNULL Number 03E7 ATW0 Near CODE:0605 AT_ATBL Near CODE:0530 AT_END Byte CODE:072D AT_I Byte CODE:0183 AT_INV Near CODE:04D9 AT_MCH Near CODE:0536 AT_NULL Near CODE:04D0 AT_READ Near CODE:0524 AT_RET Near CODE:04CE AT_STA Near CODE:055A AT_STAT Near CODE:051E AT_STE Near CODE:054B AT_SVC Far CODE:03CB AT_WRIT Near CODE:0575 AZBCAL Word CODE:01A3 AZBCAM Byte CODE:01A5 AZCMD Word CODE:019F AZCORR Word CODE:0195 AZHISTL Word CODE:019D AZLOSTL Word CODE:019B BADPRN Byte CODE:01A9 BAUDRA Number 000C BCADIG Near CODE:066B BCANGL Byte CODE:03DD BCDBCA Near CODE:06A6 CD Near CODE:0431 CLINE_BAD Near CODE:0173 COMLSR Word CODE:018D Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 21 Symbol Table SA-3843 driver - KCT El and Az to a parallel port, resident part COMPORT Word CODE:0189 ELBCAL Word CODE:01A6 ELBCAM Byte CODE:01A8 ELCMD Word CODE:01A1 ELCORR Word CODE:0193 ELHISTL Word CODE:0199 ELLOSTL Word CODE:0197 FOUND Near CODE:05C2 GETNUM Near CODE:067C GTNULL Number FFFF GT_I Byte CODE:0184 GT_ID Byte CODE:0185 GT_RD Near CODE:0502 GT_RD0 Near CODE:0513 GT_RT Near CODE:051C GT_SVC Near CODE:04DF GT_WR Near CODE:04ED GT_WR0 Near CODE:04FA HEXASC Near CODE:06C5 ID_GT Number 0067 INITSER Near CODE:06EC INT_AT Number 0063 INT_GT Number 0068 INVFLP Number 0060 LOADOK Near CODE:039A MAPCOL Number 0037 MAPOS Number 0013 MECHST Number 0061 NEXTBT Near CODE:06AD NOLOAD Byte CODE:01D4 NUMERH Near CODE:06DA NUMERL Near CODE:06E3 NXTDIG Near CODE:066B OLDAZ Word CODE:018F OLDEL Word CODE:0191 ONBACK Byte CODE:0187 PAROW Byte CODE:0188 PORT_BAD Near CODE:016A PRNDET Near CODE:0132 PRNNR Byte CODE:0186 PRNPORT Word CODE:018B QUIT Near CODE:017A RETDPT Near CODE:06A3 RETNUM Near CODE:06A1 RTRPOS Number 0033 SERLOP Near CODE:071B SEROUT Near CODE:0714 SETUP Near CODE:028D SIG Byte CODE:03D5 SIMLOP Near CODE:061E SINOPE Near CODE:05F4 SITLOP Near CODE:063F SKIPAD Near CODE:06B6 START Near CODE:0100 START_MSG Near CODE:02BA STLSTA Number 0063 STLSTE Number 0062 Turbo Assembler Version 3.2 02/01/97 22:46:10 Page 22 Symbol Table SA-3843 driver - KCT El and Az to a parallel port, resident part TESTSIG Near CODE:0610 TSEXIT Near CODE:0665 TSOK Near CODE:0654 TSR Near CODE:02AE TSTEXT Near CODE:0636 USAGE Byte CODE:01F0 Macro Name COMMAND CONOUT STROBE Groups & Segments Bit Size Align Combine Class CODE 16 072D Para Public