@@ -617,19 +617,14 @@ BOOT_SPEED EQU BOOT_NORMAL
617
617
; If Cassette enabled, some of the following features must be disabled due to
618
618
; code space limitations.
619
619
;
620
- CAS_RELOCATE = 0 ; keep CAS code in contiguous block
621
-
622
620
IF CASSETTE EQ 1
623
- CAS_RELOCATE = 1 ; relocate cassette code
624
-
625
621
;----------------------------------------------------------------------------;
626
622
; One of the following features may be enabled in addition to cassette support.
627
623
;
628
624
LIGHT_PEN = 1 ; enable light pen
629
625
POST_HD_PARMS = 0 ; enable POST HD size display
630
626
POST_OPT_ROM = 0 ; enable POST option ROM display
631
627
RANDOM_TAGLINE = 0 ; enable random tagline
632
-
633
628
ENDIF
634
629
635
630
IF POST_HD_CHECK EQ 0
@@ -5755,7 +5750,6 @@ IO_WAIT_MS_DONE:
5755
5750
; Output: AX = current counter
5756
5751
; Time: 123 clock cycles (including CALL)
5757
5752
;----------------------------------------------------------------------------;
5758
-
5759
5753
IO_WAIT_LATCH PROC
5760
5754
MOV AL , PIT_CW < 0 , 0 > ; Counter 0, Latch (00b)
5761
5755
PUSHF ; save current IF
@@ -5786,7 +5780,7 @@ IO_DELAY_MS_FDC ENDP
5786
5780
IO_DELAY_MS_FDC EQU IO_DELAY_MS
5787
5781
ENDIF
5788
5782
5789
- IF CAS_RELOCATE EQ 1
5783
+ IF CASSETTE EQ 1
5790
5784
;----------------------------------------------------------------------------;
5791
5785
; CAS_READ_WORD: read 16 bits, add to working CRC
5792
5786
;----------------------------------------------------------------------------;
@@ -5855,8 +5849,7 @@ CAS_READ_BYTE_RET:
5855
5849
5856
5850
CAS_READ_BYTE ENDP
5857
5851
CAS_READ_WORD ENDP
5858
- ENDIF
5859
-
5852
+ ENDIF ; CASSETTE EQ 1
5860
5853
;
5861
5854
; 25 BYTES HERE / 22 BYTES HERE 5150
5862
5855
;
@@ -7358,7 +7351,6 @@ _CAS_PREV EQU BYTE PTR[SI][CAS_PREV-CAS_CRC]
7358
7351
_CAS_TIME_CNT EQU WORD PTR [ SI ][ CAS_TIME_CNT - CAS_CRC ]
7359
7352
_BIOS_BREAK EQU BYTE PTR [ SI ][ BIOS_BREAK - CAS_CRC ]
7360
7353
7361
- IF CAS_RELOCATE EQ 1
7362
7354
;----------------------------------------------------------------------------;
7363
7355
; CAS_CRC_ADD: Add current bit to CRC message
7364
7356
;----------------------------------------------------------------------------;
@@ -7397,8 +7389,7 @@ CAS_CRC_SHIFT:
7397
7389
XCHG _CAS_CRC , AX ; store working CRC, restore AX
7398
7390
RET
7399
7391
CAS_CRC_ADD ENDP
7400
- ENDIF
7401
- ENDIF
7392
+ ENDIF ; IF CASSETTE EQ 1
7402
7393
7403
7394
;
7404
7395
; 7 BYTES HERE / 6 BYTES HERE 5150
@@ -10908,7 +10899,7 @@ WORD_HEX ENDP
10908
10899
DWORD_HEX ENDP
10909
10900
10910
10901
;
10911
- ; 51 BYTES HERE
10902
+ ; 50 BYTES HERE
10912
10903
;
10913
10904
BYTES_HERE INT_12
10914
10905
@@ -11556,118 +11547,6 @@ CAS_READ_CYCLE_LOOP:
11556
11547
CAS_READ_CYCLE ENDP
11557
11548
CAS_READ ENDP
11558
11549
11559
- IF CAS_RELOCATE EQ 0
11560
- ;----------------------------------------------------------------------------;
11561
- ; CAS_READ_WORD: read 16 bits, add to working CRC
11562
- ;----------------------------------------------------------------------------;
11563
- ; Output:
11564
- ; AX = word read (little endian)
11565
- ; CF if error
11566
- ;----------------------------------------------------------------------------;
11567
- CAS_READ_WORD PROC
11568
- CALL CAS_READ_BYTE
11569
- JC CAS_READ_BYTE_RET
11570
-
11571
- ;----------------------------------------------------------------------------;
11572
- ; CAS_READ_BYTE: read 8 bits, add to working CRC
11573
- ;----------------------------------------------------------------------------;
11574
- ; Output:
11575
- ; AL = byte read
11576
- ; CF if error
11577
- ;
11578
- ; Clobbers: AH, BL, DX
11579
- ;----------------------------------------------------------------------------;
11580
- CAS_READ_BYTE PROC
11581
- PUSH CX ; save CX
11582
- MOV CX , 8 ; loop 8 bits
11583
-
11584
- ;----------------------------------------------------------------------------;
11585
- ; CAS_READ_BIT: read 1 bit (2 cycles)
11586
- ;----------------------------------------------------------------------------;
11587
- CAS_READ_BIT PROC
11588
- CAS_READ_BIT_LOOP:
11589
- CALL CAS_READ_CYCLE ; DX = read low cycle length
11590
- STC ; presume failure
11591
- JZ CAS_READ_BYTE_EXIT ; exit if unable to read
11592
- PUSH DX ; save low length
11593
- CALL CAS_READ_CYCLE ; DX = read high cycle length
11594
- POP AX ; AX = low length
11595
- STC ; presume failure
11596
- JZ CAS_READ_BYTE_EXIT
11597
- ADD AX , DX ; AX = full cycle length
11598
-
11599
- ;----------------------------------------------------------------------------;
11600
- ; Determine bit value based on full cycle duration with 33% tolerance.
11601
- ;
11602
- ; 1: 2t * 1193182 (Hz) / 1007 Hz = ~ 2368 ticks
11603
- ; 0: 2t * 1193182 (Hz) / 2014 Hz = ~ 1184 ticks
11604
- ; (Note: raw timer counter readings are doubled, so must be adjusted by 2x)
11605
- ;
11606
- ; BEEP_1K7 = 1184 ticks = ~1007 Hz
11607
- ; BEEP_2K = 592 ticks = ~2014 Hz
11608
- ;
11609
- ; Use median of values to determine maximum length of a '1' bit cycle:
11610
- ; 1184 + 592 -> 1776 / 2 = ~ 1344 Hz = ~ 33% tolerance
11611
- ;
11612
- MOV DX , BEEP_1K7 + BEEP_2K ; DX = median cycle length
11613
- CMP DX , AX ; above or below median freq?
11614
- CALL CAS_CRC_ADD ; add bit to working CRC
11615
- CMP DX , AX ; above or below median freq?
11616
- ADC BL , BL ; add bit to result
11617
- LOOP CAS_READ_BIT_LOOP
11618
- MOV AL , BL ; AL = result
11619
- CAS_READ_BIT ENDP
11620
- CLC ; no error
11621
- CAS_READ_BYTE_EXIT:
11622
- POP CX
11623
- CAS_READ_BYTE_RET:
11624
- RET
11625
-
11626
- CAS_READ_BYTE ENDP
11627
- CAS_READ_WORD ENDP
11628
- ENDIF ; CAS_RELOCATE
11629
-
11630
- IF CAS_RELOCATE EQ 0
11631
- ;----------------------------------------------------------------------------;
11632
- ; CAS_CRC_ADD: Add current bit to CRC message
11633
- ;----------------------------------------------------------------------------;
11634
- ; Input:
11635
- ; CF = bit to add
11636
- ; SI = OFFSET CAS_CRC
11637
- ;----------------------------------------------------------------------------;
11638
- ; This is (effectively) CRC16-CCITT as used by IBM for SDLC/HDLC. It uses a
11639
- ; 0FFFFh initial/preset value, 1021h polynomial and has an expected residue
11640
- ; value of 01D0Fh.
11641
- ;
11642
- ; cf = ( ( crc & 0x8000 ) >> 15 ) ^ CF;
11643
- ; if ( cf ) {
11644
- ; crc = crc ^ 0x0810;
11645
- ; }
11646
- ; crc = crc << 1 | cf;
11647
- ; return crc;
11648
- ;
11649
- ; https://stackoverflow.com/questions/62771192/crc16-ccitt-calculation
11650
- ; http://bitsavers.trailing-edge.com/pdf/ibm/datacomm/GA27-3093-3_SDLC_Concepts_Jun86.pdf
11651
- ;----------------------------------------------------------------------------;
11652
- CAS_CRC_PRE EQU 0FFFFh ; Cassette CRC16-CCITT preset value
11653
- CAS_CRC_RES EQU 01D0Fh ; Cassette CRC16-CCITT residue value
11654
- CAS_CRC_POLY EQU 01021h ; Cassette CRC16-CCITT polynomial
11655
-
11656
- CAS_CRC_ADD PROC
11657
- XCHG AX , _CAS_CRC ; get working CRC, save AX
11658
- RCR AX , 1 ; set up for RCL
11659
- RCL AX , 1 ; OF = MSB(AX) XOR CF
11660
- CLC ; CF = OF
11661
- JNO CAS_CRC_SHIFT ; if OF: AX = AX XOR 0810h
11662
- XOR AX , CAS_CRC_POLY SHR 1 ; divide by polynomial (already shifted)
11663
- STC ; CF = OF
11664
- CAS_CRC_SHIFT:
11665
- ADC AX , AX ; add bit to working CRC value
11666
- XCHG _CAS_CRC , AX ; store working CRC, restore AX
11667
- RET
11668
- CAS_CRC_ADD ENDP
11669
- ENDIF ; CAS_RELOCATE
11670
-
11671
11550
INT_15_CASS ENDP
11672
11551
ENDIF ; ENDIF CASSETTE EQ 1
11673
11552
INT_15 ENDP
0 commit comments