mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-12-10 07:13:02 +00:00
Upload
Digital Research
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
.text
|
||||
movec usp,d6
|
||||
movec d6,usp
|
||||
movec sfc,d6
|
||||
movec d6,sfc
|
||||
movec vsr,d6
|
||||
movec d6,vsr
|
||||
movec dfc,d6
|
||||
movec d6,dfc
|
||||
rtd #$7f
|
||||
rtd #$31f
|
||||
rtd #$e000
|
||||
moves r5,(a7)
|
||||
moves (a7),r5
|
||||
moves r9,(a1)
|
||||
moves (a1),r9
|
||||
moves r1,(a2)
|
||||
moves (a2),r1
|
||||
moves r3,(a4)
|
||||
moves (a4),r3
|
||||
move ccr,d3
|
||||
move ccr,(a3)
|
||||
move ccr,3(a7)
|
||||
726
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/asmbug1.s
Normal file
726
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/asmbug1.s
Normal file
@@ -0,0 +1,726 @@
|
||||
* SYSTEM TABLE PROGRAM **
|
||||
*
|
||||
TASKNO EQU 16
|
||||
IRTTW0 EQU 0
|
||||
IRTTW1 EQU 1
|
||||
IRTCR1 EQU 0
|
||||
IRTCR1 EQU 0 CRT WRITE
|
||||
*
|
||||
*
|
||||
TAMAX DC.B TASKNO TASK MAX
|
||||
ECMAX DC.B 10 ECB MAX
|
||||
STMAX DC.B 10 SOFT TIMER MAX
|
||||
REMAX DC.B 10
|
||||
IOMAX DC.B 10
|
||||
TNUM DC.B 10
|
||||
TIBTT DC.L TIB0
|
||||
INITT DC.L INTBUF
|
||||
TIBIXAT DC.L TIBIX
|
||||
ECBAT DC.L ECB0
|
||||
DATBAT DC.L DTTBA
|
||||
RCBAT DC.L QARE
|
||||
UCBIXTT DC.L UCBL
|
||||
IOTOAT DC.L TIMOUT
|
||||
INTIXTT DC.L IRTQ
|
||||
IODTT DC.L IOAR
|
||||
TRCBT DC.L TRBUF
|
||||
TRCBL DC.L TRBUF+32
|
||||
URS DC.L USER USER'S PROGRAM LOC
|
||||
UES DC.L 0
|
||||
UMTT DC.L 0
|
||||
MAXPLNO DC.B 1
|
||||
DC.B 0 YOBI
|
||||
PIBADRR DC.L PIB
|
||||
DEVTBL DC.L DVCTBL0 FPK
|
||||
USRVET DC.L UTCB I/O UTCB LOC
|
||||
*
|
||||
*
|
||||
*
|
||||
TIB0 EQU * DBUG
|
||||
DC $0101 ( 1-1 )
|
||||
DC $0100
|
||||
DC $0
|
||||
DC.L $FD400
|
||||
DC.L TCB0
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
*
|
||||
TIB1 EQU * FHS ( A-1 )
|
||||
DC $0A01
|
||||
DC $0100
|
||||
DC $0
|
||||
DC.L $3E200
|
||||
DC.L TCB1
|
||||
DC $500
|
||||
DC.L FHSLQ
|
||||
DC.L $3E204
|
||||
DC $4018 MONITA TASK
|
||||
DC.L $0
|
||||
*
|
||||
TIB2 EQU * IOS
|
||||
DC $0B01
|
||||
DC $0100
|
||||
DC $0
|
||||
DC.L $35D00
|
||||
DC.L TCB2
|
||||
DC $500
|
||||
DC.L IOSQ
|
||||
DC.L $3D504
|
||||
DC.W $4018
|
||||
DC.L $0
|
||||
*
|
||||
TIB3 EQU *
|
||||
DC $0C01
|
||||
DC $0101
|
||||
DC $0
|
||||
DC.L $3A000
|
||||
DC.L TCB3
|
||||
DC $500
|
||||
DC.L DMTQ
|
||||
DC.L $3A004
|
||||
DC $4018
|
||||
DC.L $0
|
||||
*
|
||||
TIB4 EQU * IOED ( D-1 )
|
||||
DC $0D01
|
||||
DC $0100
|
||||
DC $0
|
||||
DC.L $3F700
|
||||
DC.L TCB4
|
||||
DC $500
|
||||
DC.L IOEDQ
|
||||
DC.L $3F704
|
||||
DC.W $4018
|
||||
DC.L $0
|
||||
*
|
||||
TIB5 EQU * FDC ( E-1 )
|
||||
DC $0E01
|
||||
DC $0100
|
||||
DC $0
|
||||
DC.L $3EF00
|
||||
DC.L TCB5
|
||||
DC $500
|
||||
DC.L FDCQ
|
||||
DC.L $3EF04
|
||||
DC.W $4018
|
||||
DC.L $0
|
||||
*
|
||||
*
|
||||
TIB6 EQU * TW0-IRT
|
||||
DC $0000
|
||||
DC $0000
|
||||
DC $0500
|
||||
DC.L IRTTW0
|
||||
DC.L TCB50
|
||||
DC.W $0000
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $0
|
||||
DC.L STACK6 STACK LOC
|
||||
*
|
||||
*
|
||||
TIB7 EQU * TW1 -IRT1
|
||||
DC $0
|
||||
DC.W $0
|
||||
DC.W $600
|
||||
DC.L IRTTW1
|
||||
DC.L TCB60
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $0
|
||||
DC.L STACK7 STACK LOC
|
||||
*
|
||||
TIB8 EQU *
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0700 LAVE
|
||||
DC.L $0 ENTRY
|
||||
DC.L TCB70
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $0
|
||||
DC.L STACK8 STACK
|
||||
*
|
||||
*
|
||||
TIB9 EQU *
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0 LAVEL
|
||||
DC.L $0 ENTRY
|
||||
DC.L TCB80
|
||||
DC.W $0
|
||||
DC.L 0
|
||||
DC.L 0
|
||||
DC.W $0
|
||||
DC.L STACK9 STACK
|
||||
*
|
||||
*
|
||||
TIB10 EQU *
|
||||
DC.W $0
|
||||
DC.W 0
|
||||
DC.W $0 LAVEL
|
||||
DC.L $0 ENTRY
|
||||
DC.L TCB90
|
||||
DC.W 0
|
||||
DC.L 0
|
||||
DC.L 0
|
||||
DC.W 0
|
||||
DC.L STACK10 STACK
|
||||
*
|
||||
*
|
||||
TIB11 EQU *
|
||||
DC.W $0
|
||||
DC.W 0
|
||||
DC.W $0 LAVEL
|
||||
DC.L $0 ENTRY
|
||||
DC.L TCB100
|
||||
DC.W 0
|
||||
DC.L 0
|
||||
DC.L 0
|
||||
DC.W 0
|
||||
DC.L STACK11 STACK
|
||||
*
|
||||
*
|
||||
TIB12 EQU *
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0 LAVEL
|
||||
DC.L $0 ENTRY
|
||||
DC.L TCB110
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $0
|
||||
DC.L STACK12 STACK
|
||||
*
|
||||
*
|
||||
TIB13 EQU *
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0 LAVEL
|
||||
DC.L $0 ENTRY
|
||||
DC.L TCB120
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $0
|
||||
DC.L STACK13 STACK
|
||||
*
|
||||
*
|
||||
TIB14 EQU *
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0 LAVEL
|
||||
DC.L $0 ENTRY
|
||||
DC.L TCB130
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $0
|
||||
DC.L STACK14 STACK
|
||||
*
|
||||
TIB15 EQU *
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0 LAVEL
|
||||
DC.L $0 ENTRY
|
||||
DC.L TCB140
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $0
|
||||
DC.L STACK15 STACK
|
||||
*
|
||||
*
|
||||
TIB16 EQU *
|
||||
DC.W $0 YOBI
|
||||
DC.W $0
|
||||
DC.W $0 LAVEL
|
||||
DC.L $0 ENTRY
|
||||
DC.L TCB150
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $0
|
||||
DC.L STACK16
|
||||
*
|
||||
*
|
||||
TIB17 EQU *
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.L $0 ENTRY
|
||||
DC.L TCB160
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $0
|
||||
DC.L STACK17
|
||||
*
|
||||
DS.B 100 YOBI
|
||||
*
|
||||
INTBUF EQU *
|
||||
DC.B $3 3 KO
|
||||
DC.L DATA1
|
||||
DC.L DATA1+1999
|
||||
DC.L DATA2
|
||||
DC.L DATA2+1999
|
||||
DC.L DATA3
|
||||
DC.L DATA3+1999
|
||||
DS.W 20
|
||||
*
|
||||
UCBL EQU *
|
||||
DC.L UCB0 1
|
||||
DC.L UCB4 2
|
||||
DC.L UCB5 3
|
||||
DC.L UCB6 4
|
||||
DC.L UCB1 1
|
||||
DC.L UCB2 2
|
||||
DC.L UCB3 3
|
||||
DC.L UCB7
|
||||
DC.L UCB8
|
||||
DC.L UCB9
|
||||
*
|
||||
UCB0 EQU * FPK 0
|
||||
DC.B $4,$2 2 LEVEL
|
||||
DC 0
|
||||
DC 0
|
||||
DC.L BCT10
|
||||
DC.L $FF0101 SHARED RAM LOC
|
||||
DC 0
|
||||
DC.L $3FB00 ERROR EXIT
|
||||
*
|
||||
UCB1 DS 30 0
|
||||
UCB2 DS 30 0
|
||||
UCB3 DS 30 3
|
||||
*
|
||||
*
|
||||
UCB4 EQU * CRT( R/W)
|
||||
DC.B $0,$6 6 LEVEL
|
||||
DC 0
|
||||
DC 0
|
||||
DC.L BCT4
|
||||
DC.L $FEE015 AICA LOC
|
||||
DC.B $11
|
||||
DC.B 0
|
||||
DC.B $0A
|
||||
DC.L $0 CODE A
|
||||
DC.B 0 ATTINTION TASK A
|
||||
DC.B $0A
|
||||
DC.B 0 ATT TASK B
|
||||
DC.L $0 CODE B
|
||||
*
|
||||
*
|
||||
UCB5 EQU *
|
||||
DC.B $01,$05 TW0 ( IRT5)
|
||||
DC 0
|
||||
DC $5 5 SEC
|
||||
DC.L BCT5
|
||||
DC.L $FEE009 LOC
|
||||
DC.L $0
|
||||
*
|
||||
*
|
||||
UCB6 EQU * TW1
|
||||
DC.B $1,$6 IRT6
|
||||
DC $0
|
||||
DC $5 5 SEC
|
||||
DC.L BCT6
|
||||
DC.L $FEE001 LOC
|
||||
DC.L 0
|
||||
*
|
||||
UCB7 DS 30 7
|
||||
UCB8 DS 30 8
|
||||
UCB9 DS 30 9
|
||||
*
|
||||
IRTQ EQU *
|
||||
DC.L 0 1 LEVEL
|
||||
DC.L IRT2 2
|
||||
DC.L 0 3
|
||||
DC.L 0 4
|
||||
DC.L IRT5 5
|
||||
DC.L IRT6 6
|
||||
DC.L 0 7
|
||||
*
|
||||
IRT2 EQU * FDC
|
||||
DC.L $0
|
||||
DC.L $FF0101
|
||||
DC.W $0500
|
||||
DC.W $0000
|
||||
DC.W $1
|
||||
*
|
||||
IRT21 EQU * YOBI
|
||||
DC.L $0 NEXT LINK
|
||||
DC.L $0
|
||||
DC.W $400
|
||||
DC.W $0
|
||||
DC.L 0 EXIT(ENTRY)
|
||||
DC.L 0
|
||||
*
|
||||
*
|
||||
IRT22 EQU * YOBI
|
||||
DC.L $0 NEXT LINK
|
||||
DC.L $0
|
||||
DC.W $400 A
|
||||
DC.W $0 B,C
|
||||
DC.L $0 ENTRY
|
||||
DC.L $0
|
||||
*
|
||||
*
|
||||
IRT23 EQU * YOBI
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $400
|
||||
DC.W $0 B,C
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
*
|
||||
*
|
||||
IRT5 EQU * TW0
|
||||
DC.L $0
|
||||
DC.L $FEE009 DEVIC NO.
|
||||
DC.W $100
|
||||
DC.W $0
|
||||
DC.W $6
|
||||
*
|
||||
*
|
||||
IRT51 EQU * YOBI
|
||||
DC.L $0 NEXT LINK
|
||||
DC.L $0 DEVIC NO.
|
||||
DC.W $300
|
||||
DC.W $0
|
||||
DC.W $0 E1,F1
|
||||
DC.L $0 ENTRY
|
||||
DC.W $0 E1,F2
|
||||
DC.L $0 D0
|
||||
*
|
||||
IRT52 EQU * YOBI
|
||||
DC.L $0 NEXT LINK
|
||||
DC.L $0 DEVIC NO.
|
||||
DC.W $300
|
||||
DC.W $0
|
||||
DC.W $0 E1,F1
|
||||
DC.L $0 D0
|
||||
DC.W $0 E2,F2
|
||||
DC.L $0 D0
|
||||
*
|
||||
*
|
||||
IRT53 EQU * YOBI
|
||||
DC.L $0
|
||||
DC.L $0 DEVIC NO.
|
||||
DC.W $300
|
||||
DC.W $0
|
||||
DC.W $0 E1,F1
|
||||
DC.L $0 D0
|
||||
DC.W $0 E2,F2
|
||||
DC.L $0 D0
|
||||
*
|
||||
*
|
||||
IRT6 EQU *
|
||||
DC.L IRT61 CRT
|
||||
DC.L $FEE1005
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $5
|
||||
*
|
||||
IRT61 EQU * TW1
|
||||
DC.L 0
|
||||
DC.L $FEE001
|
||||
DC.W $100
|
||||
DC.W $0
|
||||
DC.W $7
|
||||
*
|
||||
IRT62 EQU * YOBI
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $300
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
*
|
||||
IRT63 EQU * YOBI
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $300
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
*
|
||||
IRT64 EQU * YOBI
|
||||
DC.L $0
|
||||
DC.L $0
|
||||
DC.W $300
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.W $0
|
||||
DC.L $0
|
||||
*
|
||||
*
|
||||
*
|
||||
IOAR EQU *
|
||||
DC.W $0500 CRT
|
||||
DC.W $0000
|
||||
DC.W $0600 TW0
|
||||
DC.W $0000
|
||||
DC.W $0700 TW1
|
||||
DC.W $0000
|
||||
DC.W $0000
|
||||
DC.W $0000
|
||||
*
|
||||
*
|
||||
*
|
||||
DVCTBL0 EQU *
|
||||
DC.B 0
|
||||
DC.B 4 MAX LOGICAL NO.
|
||||
DC 3 FILE TASK
|
||||
DC 2
|
||||
DC 2
|
||||
DC.B 0
|
||||
DC.B 0
|
||||
*
|
||||
* FDC = 0
|
||||
DC 'FD00'
|
||||
DC $1F
|
||||
DC 256
|
||||
DC.B $33
|
||||
DC.B 0 UCB NO.
|
||||
DC.B $0 UINT NO.
|
||||
DC.B $0E
|
||||
*
|
||||
*
|
||||
*
|
||||
DC 'FD01'
|
||||
DC $1F
|
||||
DC 256 BYTE
|
||||
DC.B $33
|
||||
DC.B 0 UCB NO.
|
||||
DC.B 1 UNIT NO.
|
||||
DC.B $0E
|
||||
*
|
||||
*
|
||||
*
|
||||
DC 'FD02'
|
||||
DC $1F
|
||||
DC 256
|
||||
DC.B $33
|
||||
DC.B 0 UCB NO.
|
||||
DC.B 2 UNIT NO.
|
||||
DC.B $0E
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
DC 'FD03'
|
||||
DC $1F
|
||||
DC 256
|
||||
DC.B $33
|
||||
DC.B 0 UCB NO.
|
||||
DC.B 3 UNIT NO.
|
||||
DC.B $0E
|
||||
*
|
||||
DC.B $FF,$FF,$FF,$FF,$FF END
|
||||
*
|
||||
*
|
||||
PIB EQU *
|
||||
DC.L POOL1S
|
||||
DC.L POOL1E
|
||||
*
|
||||
*
|
||||
TIBIX EQU *
|
||||
DS.B 4*TASKNO 16*4
|
||||
*
|
||||
ECB0 EQU *
|
||||
DS.B 20 1
|
||||
DS.B 20 2
|
||||
DS.B 20 3
|
||||
DS.B 20 4
|
||||
DS.B 20 5
|
||||
DS.B 20 6
|
||||
DS.B 20 7
|
||||
DS.B 20 8
|
||||
DS.B 20 9
|
||||
DS.B 20 10
|
||||
*
|
||||
DTTBA EQU *
|
||||
DS.B 24 1
|
||||
DS.B 24 2
|
||||
DS.B 24 3
|
||||
DS.B 24 4
|
||||
DS.B 24 5
|
||||
DS.B 24 6
|
||||
DS.B 24 7
|
||||
DS.B 24 8
|
||||
DS.B 24 9
|
||||
DS.B 24 10
|
||||
*
|
||||
QARE EQU *
|
||||
DS.B 8*10
|
||||
*
|
||||
BCT0 DS.B 16
|
||||
BCT1 DS.B 16
|
||||
BCT2 DS.B 16
|
||||
BCT3 DS.B 16
|
||||
BCT4 DS.B 16 CRT
|
||||
BCT5 DS.B 16 TW0
|
||||
BCT6 DS.B 16 TW1
|
||||
BCT7 DS.B 16
|
||||
BCT8 DS.B 16
|
||||
BCT9 DS.B 16
|
||||
BCT10 DS.B 30 FPK BCT
|
||||
*
|
||||
TIMOUT EQU * TIMER OUT TABLE
|
||||
DS.B 10*6
|
||||
*
|
||||
TCB0 DS.B 130
|
||||
TCB1 DS.B 128 Q BUFFER
|
||||
TCB2 DS.B 128
|
||||
TCB3 DS.B 128
|
||||
TCB4 DS.B 128
|
||||
TCB5 DS.B 128
|
||||
TCB50 DS.B 128 TW-IRT0
|
||||
TCB60 DS.B 128 TW-IRT1
|
||||
TCB70 DS.B 128 CRT-IRT0 ( READ )
|
||||
TCB80 DS.B 128 CRT-IRT1 (WRITE)
|
||||
TCB90 DS.B 128 DENSO -IRT0 ( READ )
|
||||
TCB100 DS.B 128 DENSO -IRT1 (WRITE )
|
||||
TCB110 DS.B 128
|
||||
TCB120 DS.B 128
|
||||
TCB130 DS.B 128
|
||||
TCB140 DS.B 128
|
||||
TCB150 DS.B 128
|
||||
TCB160 DS.B 128
|
||||
*
|
||||
*
|
||||
FHSLQ DS.B $500
|
||||
IOSQ DS.B $500
|
||||
DMTQ DS.B $500
|
||||
IOEDQ DS.B $500
|
||||
FDCQ DS.B $500
|
||||
*
|
||||
TRBUF EQU *
|
||||
DS.B 64 TRACE BUFFER
|
||||
*
|
||||
*
|
||||
POOL1S EQU *
|
||||
DS.B 15000
|
||||
DS.B 512 YOBI
|
||||
POOL1E EQU * POLL BUF END
|
||||
*
|
||||
*
|
||||
STACK0 DS.W 30
|
||||
STACK1 DS.W 30
|
||||
STACK2 DS.W 30
|
||||
STACK3 DS.W 30
|
||||
STACK4 DS.W 30
|
||||
STACK5 DS.W 30
|
||||
STACK6 DS.W 30
|
||||
STACK7 DS.W 30
|
||||
STACK8 DS.W 30
|
||||
STACK9 DS.W 30
|
||||
STACK10 DS.W 30
|
||||
STACK11 DS.W 30
|
||||
STACK12 DS.W 30
|
||||
STACK13 DS.W 30
|
||||
STACK14 DS.W 30
|
||||
STACK15 DS.W 30
|
||||
STACK16 DS.W 30
|
||||
STACK17 DS.W 30
|
||||
*
|
||||
*
|
||||
UTCB EQU *
|
||||
DC.L TW0UCB 0
|
||||
DC.L TW1UCB 1
|
||||
DC.L CRTUCB 2
|
||||
DC.L DENUCB 3
|
||||
DC.L 0 YOBI
|
||||
DC.L 0
|
||||
DC.L 0
|
||||
*
|
||||
*
|
||||
TW0UCB EQU * TW0
|
||||
DC.L 0 DVCENO.
|
||||
DC.L TW0BUFA
|
||||
DC.W 0 BUFCT
|
||||
TW0BUFA DS.B 50 TW0-BUFFER
|
||||
*
|
||||
*
|
||||
TW1UCB EQU * TW0
|
||||
DC.L 0 DVCEN.
|
||||
DC.L TW1BUFA
|
||||
DC.W 0 BUFCT
|
||||
TW1BUFA DS.B 50 TW1-BUFFER
|
||||
*
|
||||
*
|
||||
CRTUCB EQU *
|
||||
DC.L 0 DVCENO.
|
||||
DC.L CRTWBF
|
||||
DC.L CRTRBF
|
||||
DC.W 0 FLAG
|
||||
DC.W 0 W-BUFCT
|
||||
DC.W 0 R-BUFCT
|
||||
CRTWBF DS.B 128
|
||||
CRTRBF DS.B 128
|
||||
*
|
||||
*
|
||||
DENUCB EQU *
|
||||
DC.L 0 DVCENO.
|
||||
DC.L DENBUF DENSO-BUF
|
||||
DC.W 0 FLAG
|
||||
DC.W 0 DATA
|
||||
DENBUF DS.B 128
|
||||
*
|
||||
*
|
||||
DATA1 DS.B 2000
|
||||
DATA2 DS.B 2000
|
||||
DATA3 DS.B 2000
|
||||
*
|
||||
*
|
||||
* USER'S EXTI ( )
|
||||
USER EQU *
|
||||
LEA USTBL,A0
|
||||
*
|
||||
JUS1 EQU *
|
||||
MOVEA.L (A0),A1 USER-TBL LOC
|
||||
BEQ JUS9
|
||||
MOVE.B 1(A1),D0
|
||||
MOVE.B 2(A1),D1
|
||||
*
|
||||
MOVE.B D0,(A1)
|
||||
MOVE.B D1,2(A1)
|
||||
ADDA.L #6,A0
|
||||
BRA JUS1
|
||||
*
|
||||
JUS9 EQU *
|
||||
MOVEA.L #$ABC,A1 DENSO DIVEC NO.
|
||||
MOVE.B #3,D0
|
||||
MOVE.B #$91,D1
|
||||
MOVE.B D0,(A1)
|
||||
MOVE.B D1,(A1)
|
||||
*
|
||||
MOVEA.L #$DCF,A1 DENSO-2 ADDRESS
|
||||
MOVE.B D0,(A1)
|
||||
MOVE.B D1,(A1)
|
||||
RTS
|
||||
*
|
||||
USTBL EQU *
|
||||
DC.L $0 ADDRESS
|
||||
DC.B $0,$0
|
||||
DC.L $0
|
||||
DC.B $0,0
|
||||
DC.L $0
|
||||
DC.B $0,0
|
||||
DC.L $0
|
||||
DC.B 0,0
|
||||
DC.L $0
|
||||
DC.B 0,0
|
||||
END
|
||||
@@ -0,0 +1,6 @@
|
||||
* No error of DC $SYMBOL statement */
|
||||
move.l #1,d0
|
||||
dc.l $XYZ
|
||||
move.l #2,d0
|
||||
XYZ:
|
||||
move.l #3,d0
|
||||
@@ -0,0 +1,6 @@
|
||||
/usr/local/c68 -v test.c -o test -l6
|
||||
/usr/local/c68 -v -a test2.c -o test2
|
||||
# test3 should generate warnings: 5 on 11, 1 on 17, 1 on 22, and 1 on 156
|
||||
/usr/local/c68 test3.c -o test3
|
||||
/usr/local/c68 -a -e fptest.c -o etest
|
||||
/usr/local/c68 -a -f fptest.c -o ftest
|
||||
@@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
main()
|
||||
{
|
||||
WORD i;
|
||||
i = '\f';
|
||||
printf("FF = %d (%x)\n",i,i);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/* divide assign routine for long data is not linked */
|
||||
|
||||
main()
|
||||
{
|
||||
long a, b;
|
||||
|
||||
a=12;
|
||||
b=3;
|
||||
a/=b;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/* comp.b code generated without checking its immediate
|
||||
operand */
|
||||
|
||||
main()
|
||||
{
|
||||
char a;
|
||||
|
||||
a='a';
|
||||
if (a<300)
|
||||
;
|
||||
@@ -0,0 +1,13 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/* diviuision routine for long operands do not act correctly
|
||||
for negative operands */
|
||||
|
||||
main()
|
||||
{
|
||||
long a, b;
|
||||
|
||||
a= -12;
|
||||
b= -3;
|
||||
printf("%ld\n", a/b);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/* externl names which are equal up to 7 characters
|
||||
are not be detected by compiler */
|
||||
|
||||
int abcdefgh;
|
||||
long abcdefgi;
|
||||
@@ -0,0 +1,11 @@
|
||||
/* pre-increment operator always executed before the evaluation
|
||||
of expression, even if it contains conditional operator */
|
||||
|
||||
main()
|
||||
{
|
||||
int a, b;
|
||||
|
||||
a=1;
|
||||
b=1;
|
||||
printf("%d\n", a!=1?++b:b);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
FILE *fopena(), *in, *out;
|
||||
int c;
|
||||
|
||||
in=fopena(*++argv, "r");
|
||||
out=fopena(*++argv, "w");
|
||||
while ((c=getc(in))!=EOF)
|
||||
putc(c, out);
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
rm -rf 1 2 3
|
||||
mkdir 1 2 3
|
||||
cp test.c test.h 1
|
||||
cp test.c test.h 2
|
||||
cp test.c test.h 3
|
||||
cd 1; cc -L -r test.c -l6 &; cd ../2; cc -L -r test.c -l6 &; cd ../3; cc -L -r test.c -l6 &; cd ..
|
||||
5
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/do
Normal file
5
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/do
Normal file
@@ -0,0 +1,5 @@
|
||||
date
|
||||
/usr/local/c68 -v -S stest.c
|
||||
date
|
||||
/usr/local/as68 -u -p stest.s > stest.asmlst
|
||||
/usr/local/lo68 -X /usr/local/lib/c680.o stest.o lib7.a
|
||||
@@ -0,0 +1,7 @@
|
||||
e:vax FPTEST.C r
|
||||
e:vax TEST.C r
|
||||
e:vax TEST2.C r
|
||||
e:vax TEST3.C r
|
||||
e:vax TEST4.C r
|
||||
e:vax TEST5.C r
|
||||
e:vax TEST.H r
|
||||
154
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/fptest.c
Normal file
154
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/fptest.c
Normal file
@@ -0,0 +1,154 @@
|
||||
#include <math.h>
|
||||
|
||||
typedef struct { double a[6]; } joint;
|
||||
|
||||
static joint lower_limit = { 1.1, 2.2, 3.3, 4.4, 5.5, 6.6 };
|
||||
|
||||
float *f1();
|
||||
float f2();
|
||||
float ret_0();
|
||||
|
||||
struct type {
|
||||
float ft;
|
||||
double dt;
|
||||
float *pft;
|
||||
} fstruc;
|
||||
|
||||
char *fstr = "-2.3E-4";
|
||||
char *astr = "8.6324";
|
||||
float ar[10];
|
||||
float global_f;
|
||||
|
||||
int err = 0;
|
||||
|
||||
main()
|
||||
{
|
||||
double d;
|
||||
float f, fp2, *fp;
|
||||
char *s, buf[20];
|
||||
long l;
|
||||
int i;
|
||||
|
||||
if ((fp = f1()) != fstruc.pft) error(0xf1);
|
||||
if ((f = f2()) != 2.0) error(0xf2);
|
||||
d = f;
|
||||
if (d != f) error(0xf3);
|
||||
f = atof(fstr);
|
||||
s = ftoa(f,buf,6);
|
||||
printf("%s => %f => %s\n",fstr,f,s);
|
||||
f = 3.4;
|
||||
l = f;
|
||||
if (l != 3L) { error(0xf4); printf("%f => %ld != 3L\n",f,l); }
|
||||
i = f;
|
||||
if (i != 3) { error(0xf5); printf("%f => %d != 3\n",f,i); }
|
||||
l = 7L;
|
||||
f = l;
|
||||
printf("6.9 < %f < 7.1\n",f);
|
||||
i = 7;
|
||||
f = i;
|
||||
printf("6.9 < %f < 7.1\n",f);
|
||||
f = atof(astr);
|
||||
printf("%s ==> ~ %f or %e\n",astr,f,f);
|
||||
f = 0;
|
||||
if (f != 0.0) error(0xf6);
|
||||
i = 3;
|
||||
ar[i] = 3.0;
|
||||
f = 4.0;
|
||||
fp2 = 10.0;
|
||||
printf("%f += ",ar[i]);
|
||||
printf("%f * %f ==> ",f,fp2);
|
||||
ar[i] += f * fp2;
|
||||
printf("%f\n",ar[i]);
|
||||
global_f = 0.0;
|
||||
f = 0.0;
|
||||
if_test(f);
|
||||
infinity();
|
||||
ar_test();
|
||||
if (!err)
|
||||
printf("Far Freaking Out....\n");
|
||||
else
|
||||
printf("Tough Luck...\n");
|
||||
}
|
||||
|
||||
float *
|
||||
f1()
|
||||
{
|
||||
return(fstruc.pft);
|
||||
}
|
||||
|
||||
float
|
||||
f2()
|
||||
{
|
||||
return(2.0);
|
||||
}
|
||||
|
||||
float
|
||||
ret_0()
|
||||
{
|
||||
return(0.0);
|
||||
}
|
||||
|
||||
if_test(pf)
|
||||
float pf;
|
||||
{
|
||||
float af, *ptr;
|
||||
|
||||
ar[2] = 0.0;
|
||||
af = 0.0;
|
||||
ptr = ⁡
|
||||
if (global_f) error(0x10);
|
||||
if (ar[2]) error(0x11);
|
||||
if (af) error(0x12);
|
||||
if (pf) error(0x13);
|
||||
if (*ptr) error(0x14);
|
||||
if (ret_0()) error(0x14);
|
||||
}
|
||||
|
||||
infinity()
|
||||
{
|
||||
float a, b;
|
||||
|
||||
a = 1.0E+6;
|
||||
b = 0.0;
|
||||
|
||||
while(a > b) {
|
||||
printf("%e > %e\n",a,b);
|
||||
b = a;
|
||||
a = a * a;
|
||||
}
|
||||
printf("%e <= %e\n",a,b);
|
||||
}
|
||||
|
||||
ar_test()
|
||||
{
|
||||
float a[5], b[5], c[5], d[5];
|
||||
int i;
|
||||
|
||||
a[0] = 0.0; b[0] = 0.0; c[0] = 0.0; d[0] = 0.0;
|
||||
a[1] = 1.0; b[1] = 1.0; c[1] = 1.0; d[1] = 1.0;
|
||||
a[2] = 2.0; b[2] = 2.0; c[2] = 2.0; d[2] = 2.0;
|
||||
a[3] = 3.0; b[3] = 3.0; c[3] = 3.0; d[3] = 3.0;
|
||||
a[4] = 4.0; b[4] = 4.0; c[4] = 4.0; d[4] = 4.0;
|
||||
for(i = 0 ; i < 5; i++) {
|
||||
a[i] += b[i];
|
||||
c[i] = c[i] + d[i];
|
||||
}
|
||||
printf("0.0 += 0.0 => %f\n",a[0]);
|
||||
printf("1.0 += 1.0 => %f\n",a[1]);
|
||||
printf("2.0 += 2.0 => %f\n",a[2]);
|
||||
printf("3.0 += 3.0 => %f\n",a[3]);
|
||||
printf("4.0 += 4.0 => %f\n",a[4]);
|
||||
printf("%f = 0.0 + 0.0\n",c[0]);
|
||||
printf("%f = 1.0 + 1.0\n",c[1]);
|
||||
printf("%f = 2.0 + 2.0\n",c[2]);
|
||||
printf("%f = 3.0 + 3.0\n",c[3]);
|
||||
printf("%f = 4.0 + 4.0\n",c[4]);
|
||||
}
|
||||
|
||||
error(enum)
|
||||
int enum;
|
||||
{
|
||||
printf("error: %x\n",enum);
|
||||
err++;
|
||||
}
|
||||
|
||||
105
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/make.sub
Normal file
105
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/make.sub
Normal file
@@ -0,0 +1,105 @@
|
||||
$2cp68 -i 0$1 test.c $1x.i
|
||||
$2c068 $1x.i $1x.1 $1x.2 $1x.3
|
||||
era $1x.i
|
||||
$2c168 $1x.1 $1x.2 test.s
|
||||
era $1x.1
|
||||
era $1x.2
|
||||
$2as68 -f $1 -s 0$1 -l -u test.s
|
||||
era test.s
|
||||
$2lo68 -f $1 -u_nofloat -r -o test.68k 0$1s.o test.o 0$2clib
|
||||
era test.o
|
||||
test.68k
|
||||
era test.68k
|
||||
|
||||
$2cp68 test2.c $1x.i
|
||||
$2c068 $1x.i $1x.1 $1x.2 $1x.3
|
||||
era $1x.i
|
||||
$2c168 $1x.1 $1x.2 test2.s
|
||||
era $1x.1
|
||||
era $1x.2
|
||||
$2as68 -f $1 -s 0$1 -l -u test2.s
|
||||
era test2.s
|
||||
$2lo68 -f $1 -u_nofloat -r -o test2.68k 0$1s.o test2.o 0$2clib
|
||||
era test2.o
|
||||
test2.68k
|
||||
era test2.68k
|
||||
|
||||
$2cp68 test3.c $1x.i
|
||||
$2c068 $1x.i $1x.1 $1x.2 $1x.3
|
||||
era $1x.i
|
||||
$2c168 $1x.1 $1x.2 test3.s
|
||||
era $1x.1
|
||||
era $1x.2
|
||||
$2as68 -f $1 -s 0$1 -l -u test3.s
|
||||
era test3.s
|
||||
$2lo68 -f $1 -u_nofloat -r -o test3.68k 0$1s.o test3.o 0$2clib
|
||||
era test3.o
|
||||
test3.68k
|
||||
era test3.68k
|
||||
|
||||
$2cp68 test4.c $1x.i
|
||||
$2c068 $1x.i $1x.1 $1x.2 $1x.3
|
||||
era $1x.i
|
||||
$2c168 $1x.1 $1x.2 test4.s
|
||||
era $1x.1
|
||||
era $1x.2
|
||||
$2as68 -f $1 -s 0$1 -l -u test4.s
|
||||
era test4.s
|
||||
$2lo68 -f $1 -u_nofloat -r -o test4.68k 0$1s.o test4.o 0$2clib
|
||||
era test4.o
|
||||
test4.68k
|
||||
era test4.68k
|
||||
|
||||
$2cp68 test5.c $1x.i
|
||||
$2c068 $1x.i $1x.1 $1x.2 $1x.3
|
||||
era $1x.i
|
||||
$2c168 $1x.1 $1x.2 test5.s
|
||||
era $1x.1
|
||||
era $1x.2
|
||||
$2as68 -f $1 -s 0$1 -l -u test5.s
|
||||
era test5.s
|
||||
$2lo68 -f $1 -u_nofloat -r -o test5.68k 0$1s.o test5.o 0$2clib
|
||||
era test5.o
|
||||
test5.68k
|
||||
era test5.68k
|
||||
|
||||
$2cp68 fptest.c $1x.i
|
||||
$2c068 $1x.i $1x.1 $1x.2 $1x.3 -f
|
||||
era $1x.i
|
||||
$2c168 $1x.1 $1x.2 fptest.s
|
||||
era $1x.1
|
||||
era $1x.2
|
||||
$2as68 -f $1 -s 0$1 -l -u fptest.s
|
||||
era fptest.s
|
||||
$2lo68 -f $1 -r -o fptest.68k 0$1s.o fptest.o 0$2clib 0$2libf.a
|
||||
era fptest.o
|
||||
fptest.68k
|
||||
era fptest.68k
|
||||
|
||||
$2cp68 fptest.c $1x.i
|
||||
$2c068 $1x.i $1x.1 $1x.2 $1x.3 -e
|
||||
era $1x.i
|
||||
$2c168 $1x.1 $1x.2 fptest.s
|
||||
era $1x.1
|
||||
era $1x.2
|
||||
$2as68 -f $1 -s 0$1 -l -u fptest.s
|
||||
era fptest.s
|
||||
$2lo68 -f $1 -r -o fptest.68k 0$1s.o fptest.o 0$2clib 0$2libe.a
|
||||
era fptest.o
|
||||
fptest.68k
|
||||
era fptest.68k
|
||||
|
||||
$2cp68 -i 0$1 stest.c $1x.i
|
||||
$2c068 $1x.i $1x.1 $1x.2 $1x.3
|
||||
era $1x.i
|
||||
$2c168 $1x.1 $1x.2 stest.s
|
||||
era $1x.1
|
||||
era $1x.2
|
||||
$2as68 -f $1 -s 0$1 -l -u stest.s
|
||||
era stest.s
|
||||
$2lo68 -f $1 -u_nofloat -r -o stest.68k 0$1s.o stest.o 0$2clib
|
||||
era stest.o
|
||||
stest.68k
|
||||
era stest.68k
|
||||
|
||||
user 1!make $1 $2
|
||||
@@ -0,0 +1,17 @@
|
||||
CC = c68
|
||||
CFLAGS = -a
|
||||
|
||||
all:
|
||||
${CC} ${CFLAGS} test.c -o test -l6
|
||||
${CC} ${CFLAGS} test2.c -o test2
|
||||
${CC} ${CFLAGS} test3.c -o test3
|
||||
${CC} ${CFLAGS} -e fptest.c -o etest
|
||||
${CC} ${CFLAGS} -f fptest.c -o ftest
|
||||
|
||||
ar:
|
||||
rm -f t.a
|
||||
ar68 rv t.a test test2 test3 etest ftest
|
||||
|
||||
clean:
|
||||
@rm -f test test2 test3 ftest etest
|
||||
@rm -f t.a core a.out c.out
|
||||
18
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/math.h
Normal file
18
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/math.h
Normal file
@@ -0,0 +1,18 @@
|
||||
long atol();
|
||||
char *ltoa();
|
||||
double atof();
|
||||
char *ftoa();
|
||||
char *etoa();
|
||||
double sin();
|
||||
double cos();
|
||||
double tan();
|
||||
double atan();
|
||||
|
||||
double fabs();
|
||||
double floor();
|
||||
double ceil();
|
||||
double fmod();
|
||||
double log();
|
||||
double pow();
|
||||
double sqrt();
|
||||
double exp();
|
||||
@@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
main()
|
||||
{
|
||||
REG WORD *a,b,c;
|
||||
WORD berr(),zdiv();
|
||||
signal(10,berr);
|
||||
signal( 8,zdiv);
|
||||
a = -1;
|
||||
b = *a;
|
||||
printf("Return from BUSERR\n");
|
||||
c = 0;
|
||||
b = 1;
|
||||
b = b/c;
|
||||
printf("Return from Zero divide\n");
|
||||
}
|
||||
berr()
|
||||
{
|
||||
printf("Buserr exception!\n");
|
||||
}
|
||||
zdiv()
|
||||
{
|
||||
printf("Zero divide exception\n");
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
main()
|
||||
{
|
||||
REG WORD *a,b,c;
|
||||
WORD berr(),zdiv();
|
||||
signal(10,berr);
|
||||
signal( 8,zdiv);
|
||||
a = -1;
|
||||
b = *a;
|
||||
printf("Return from BUSERR\n");
|
||||
c = 0;
|
||||
b = 1;
|
||||
b = b/c;
|
||||
printf("Return from Zero divide\n");
|
||||
}
|
||||
berr()
|
||||
{
|
||||
printf("Buserr exception!\n");
|
||||
}
|
||||
zdiv()
|
||||
{
|
||||
printf("Zero divide exception\n");
|
||||
1120
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/test.c
Normal file
1120
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/test.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
#define test2x
|
||||
626
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/test2.c
Normal file
626
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/test2.c
Normal file
@@ -0,0 +1,626 @@
|
||||
/* Compiler Test Program Part II - version 4.0 plus */
|
||||
|
||||
#define DOHIST '\!'
|
||||
#define QUOTED 128
|
||||
|
||||
struct lbits {
|
||||
unsigned b1 : 4;
|
||||
unsigned b2 : 12;
|
||||
} low;
|
||||
|
||||
struct hbits {
|
||||
unsigned b1 : 12;
|
||||
unsigned b2 : 4;
|
||||
} ;
|
||||
|
||||
struct hbits high; /* be sure global decl ok... */
|
||||
|
||||
int err;
|
||||
int globali = -32768;
|
||||
unsigned globalu = 44000;
|
||||
|
||||
char ca[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||
|
||||
long lconst1 = 5 * 9;
|
||||
long lconst2 = 5L * 9;
|
||||
long lconst3 = 5 * 9L;
|
||||
long lconst4 = 5L * 9L;
|
||||
long lconst5 = (long)(5 * 9);
|
||||
|
||||
char c0[] = {
|
||||
0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15,
|
||||
};
|
||||
|
||||
int i0[] = {
|
||||
0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15,
|
||||
};
|
||||
|
||||
long l0[] = {
|
||||
0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15,
|
||||
};
|
||||
|
||||
struct Proto {
|
||||
char P_id;
|
||||
int (*P_turnon)();
|
||||
int (*P_rdmsg)();
|
||||
int (*P_wrmsg)();
|
||||
int (*P_rddata)();
|
||||
int (*P_wrdata)();
|
||||
int (*P_turnoff)();
|
||||
};
|
||||
|
||||
extern int gturnon(), gturnoff();
|
||||
extern int grdmsg(), grddata();
|
||||
extern int gwrmsg(), gwrdata();
|
||||
|
||||
struct Proto Ptbl[] = {
|
||||
'g', gturnon, grdmsg, gwrmsg, grddata, gwrdata, gturnoff,
|
||||
'\0'
|
||||
};
|
||||
|
||||
struct nroff {
|
||||
int a;
|
||||
char *p;
|
||||
char *ctag[5];
|
||||
char *zz;
|
||||
};
|
||||
|
||||
struct nroff star = {
|
||||
1,
|
||||
"pstring...",
|
||||
"zero",
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"zzstring"
|
||||
};
|
||||
|
||||
struct {
|
||||
int a[2];
|
||||
char b[2];
|
||||
long c[2];
|
||||
char *d[2];
|
||||
} sa = {
|
||||
1, 2,
|
||||
'a', 'b',
|
||||
3, 4,
|
||||
"abc", "def"
|
||||
};
|
||||
|
||||
int gturnon() {}
|
||||
int gturnoff() {}
|
||||
int grdmsg() {}
|
||||
int grddata() {}
|
||||
int gwrmsg() {}
|
||||
int gwrdata() {}
|
||||
|
||||
main()
|
||||
{
|
||||
l_vs_i();
|
||||
rl_vs_i();
|
||||
l_vs_ri();
|
||||
rl_vs_ri();
|
||||
v40();
|
||||
v41();
|
||||
v42();
|
||||
v42_a();
|
||||
if (!err)
|
||||
printf("Far Freaking Out\n");
|
||||
else
|
||||
printf("Tough Luck.....\n");
|
||||
}
|
||||
|
||||
l_vs_i() /* longs versus ints... v. 4.0 addition */
|
||||
{
|
||||
long autol, autol1;
|
||||
int i;
|
||||
|
||||
i = 3;
|
||||
autol = autol1 = 100;
|
||||
autol1 *= i;
|
||||
autol =autol * i;
|
||||
if (autol1 != autol) error(0x00);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 /= i;
|
||||
autol =autol / i;
|
||||
if (autol1 != autol) error(0x01);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 += i;
|
||||
autol =autol + i;
|
||||
if (autol1 != autol) error(0x02);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 -= i;
|
||||
autol =autol - i;
|
||||
if (autol1 != autol) error(0x03);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 %= i;
|
||||
autol =autol % i;
|
||||
if (autol1 != autol) error(0x04);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 <<= i;
|
||||
autol =autol << i;
|
||||
if (autol1 != autol) error(0x05);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 >>= i;
|
||||
autol =autol >> i;
|
||||
if (autol1 != autol) error(0x06);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 &= i;
|
||||
autol =autol & i;
|
||||
if (autol1 != autol) error(0x07);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 |= i;
|
||||
autol =autol | i;
|
||||
if (autol1 != autol) error(0x08);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 ^= i;
|
||||
autol =autol ^ i;
|
||||
if (autol1 != autol) error(0x09);
|
||||
}
|
||||
|
||||
rl_vs_i() /* register longs versus ints... v. 4.0 addition */
|
||||
{
|
||||
register long regl, regl1;
|
||||
int i;
|
||||
|
||||
i = 3;
|
||||
regl = regl1 = 100;
|
||||
regl1 *= i;
|
||||
regl = regl * i;
|
||||
if (regl1 != regl) error(0x10);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 /= i;
|
||||
regl = regl / i;
|
||||
if (regl1 != regl) error(0x11);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 += i;
|
||||
regl = regl + i;
|
||||
if (regl1 != regl) error(0x12);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 -= i;
|
||||
regl = regl - i;
|
||||
if (regl1 != regl) error(0x13);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 %= i;
|
||||
regl = regl % i;
|
||||
if (regl1 != regl) error(0x14);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 <<= i;
|
||||
regl = regl << i;
|
||||
if (regl1 != regl) error(0x15);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 >>= i;
|
||||
regl = regl >> i;
|
||||
if (regl1 != regl) error(0x16);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 &= i;
|
||||
regl = regl & i;
|
||||
if (regl1 != regl) error(0x17);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 |= i;
|
||||
regl = regl | i;
|
||||
if (regl1 != regl) error(0x18);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 ^= i;
|
||||
regl = regl ^ i;
|
||||
if (regl1 != regl) error(0x19);
|
||||
}
|
||||
|
||||
l_vs_ri() /* longs versus register ints... v. 4.0 addition */
|
||||
{
|
||||
long autol, autol1;
|
||||
register int i;
|
||||
|
||||
i = 2;
|
||||
autol = autol1 = 100;
|
||||
autol1 *= i;
|
||||
autol =autol * i;
|
||||
if (autol1 != autol) error(0x20);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 /= i;
|
||||
autol =autol / i;
|
||||
if (autol1 != autol) error(0x21);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 += i;
|
||||
autol =autol + i;
|
||||
if (autol1 != autol) error(0x22);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 -= i;
|
||||
autol =autol - i;
|
||||
if (autol1 != autol) error(0x23);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 %= i;
|
||||
autol =autol % i;
|
||||
if (autol1 != autol) error(0x24);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 <<= i;
|
||||
autol =autol << i;
|
||||
if (autol1 != autol) error(0x25);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 >>= i;
|
||||
autol =autol >> i;
|
||||
if (autol1 != autol) error(0x26);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 &= i;
|
||||
autol =autol & i;
|
||||
if (autol1 != autol) error(0x27);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 |= i;
|
||||
autol =autol | i;
|
||||
if (autol1 != autol) error(0x28);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 ^= i;
|
||||
autol =autol ^ i;
|
||||
if (autol1 != autol) error(0x29);
|
||||
}
|
||||
|
||||
rl_vs_ri() /* reg longs versus reg ints... v. 4.0 addition */
|
||||
{
|
||||
register long regl, regl1;
|
||||
register int i;
|
||||
|
||||
i = 3;
|
||||
regl = regl1 = 100;
|
||||
regl1 *= i;
|
||||
regl = regl * i;
|
||||
if (regl1 != regl) error(0x30);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 /= i;
|
||||
regl = regl / i;
|
||||
if (regl1 != regl) error(0x31);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 += i;
|
||||
regl = regl + i;
|
||||
if (regl1 != regl) error(0x32);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 -= i;
|
||||
regl = regl - i;
|
||||
if (regl1 != regl) error(0x33);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 %= i;
|
||||
regl = regl % i;
|
||||
if (regl1 != regl) error(0x34);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 <<= i;
|
||||
regl = regl << i;
|
||||
if (regl1 != regl) error(0x35);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 >>= i;
|
||||
regl = regl >> i;
|
||||
if (regl1 != regl) error(0x36);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 &= i;
|
||||
regl = regl & i;
|
||||
if (regl1 != regl) error(0x37);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 |= i;
|
||||
regl = regl | i;
|
||||
if (regl1 != regl) error(0x38);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 ^= i;
|
||||
regl = regl ^ i;
|
||||
if (regl1 != regl) error(0x39);
|
||||
}
|
||||
|
||||
v40() /* 4.0 fixed and tested */
|
||||
{
|
||||
long l, l1;
|
||||
register int i;
|
||||
|
||||
/* bit assignments */
|
||||
low.b1 = high.b2;
|
||||
high.b1 = low.b2;
|
||||
|
||||
l = l1 = 45L;
|
||||
/* non-code-generating simple expressions */
|
||||
l *= 1L;
|
||||
if (l != l1) error(0x40);
|
||||
l += 0L;
|
||||
if (l != l1) error(0x41);
|
||||
l -= 0L;
|
||||
if (l != l1) error(0x42);
|
||||
l *= 0L;
|
||||
if (l != 0L) error(0x43);
|
||||
l1 %= 1L;
|
||||
if (l1 != 0L) error(0x44);
|
||||
|
||||
/*SMC Bug - not properly extending i register on stack*/
|
||||
i = 2;
|
||||
ca[i] = f();
|
||||
if( ca[i] != f() ) error(0x45);
|
||||
}
|
||||
|
||||
f()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
struct xyzzytype {
|
||||
long x, y, z;
|
||||
char *xyz, xyzzy;
|
||||
} saray1[3], saray2[4];
|
||||
|
||||
#define max(x,y) ((x > y) ? 'x' : 'y')
|
||||
#define strings(s1,s2) "s1s2"
|
||||
#define substitute(x) "x,"
|
||||
v40a() /* bug fixes and enhancements for v 4.0 ammended */
|
||||
{
|
||||
char ch, *s, *t;
|
||||
|
||||
ch = max(3,9);
|
||||
if(ch != '9') error(0x50);
|
||||
s = strings(s,t);
|
||||
if (strcmp(s,"s1s2") != 0) error(0x51);
|
||||
s = substitute(5);
|
||||
if (strcmp(s,"5,") != 0) error(0x52);
|
||||
saray2[0].y = 4L; saray2[0].xyzzy = 'p'; saray2[0].x = 450L;
|
||||
saray1[2] = saray2[0];
|
||||
}
|
||||
|
||||
int v41_testvalue;
|
||||
v41()
|
||||
{
|
||||
register char *p;
|
||||
register int i;
|
||||
register int j;
|
||||
int form;
|
||||
long m, n;
|
||||
long al[10];
|
||||
int aray[3][4][5];
|
||||
|
||||
aray[2][3][4] = 4; /* multi dimensional arrays */
|
||||
if (aray[2][3][4] != 4) error(0x53);
|
||||
if (lconst1 != 45) error(0x54); /* long constant initialization */
|
||||
if (lconst2 != 45) error(0x55);
|
||||
if (lconst3 != 45) error(0x56);
|
||||
if (lconst4 != 45) error(0x57);
|
||||
if (lconst5 != 45) error(0x58);
|
||||
|
||||
m = 12; n = -1; /* arrays involving long mult for indices */
|
||||
al[2] = 33L;
|
||||
n = al[m + n * 10];
|
||||
if (n != 33L) error(0x59);
|
||||
al[2L] = 31L; /* arrays involving long indices */
|
||||
n = al[2];
|
||||
if (n != 31L) error(0x5a);
|
||||
|
||||
1 ? 0 : 2;
|
||||
1 ? (form = 0) : (form = 1);
|
||||
if (form != 0) error(0x5b);
|
||||
form = 3;
|
||||
0 ? (form = form | ( 1 << 0)) : (form = form & ~(1<<0));
|
||||
if (form != 2) error(0x5c);
|
||||
form = 3;
|
||||
0 ? (form |= (1 << 0)) : (form &= ~(1 << 0));
|
||||
if (form != 2) error(0x5d);
|
||||
|
||||
for( i = 0; i < sizeof(ca); i++ )
|
||||
ca[i] = i;
|
||||
i = 0;
|
||||
p = ca;
|
||||
if( ca[*p++]++ != 0 ) error(0x61);
|
||||
if( p != &ca[1] ) error(0x62);
|
||||
if( ca[0] != 1 ) error(0x63);
|
||||
if( ca[i+=1]++ != 1 ) error(0x64);
|
||||
if( i != 1 ) error(0x65);
|
||||
if( ca[1] != 2 ) error(0x66);
|
||||
if( ca[i+= *p++]++ != 3 ) error(0x67);
|
||||
if( i != 3 ) error(0x68);
|
||||
if( p != &ca[2] ) error(0x69);
|
||||
if( ca[3] != 4 ) error(0x6a);
|
||||
j = 1;
|
||||
i = j++ && j++;
|
||||
if( j != 3 ) error(0x6b);
|
||||
if( i != 1 ) error(0x6c);
|
||||
j = 0;
|
||||
i = j++ && j++;
|
||||
if( j != 1 ) error(0x6d);
|
||||
if( i != 0 ) error(0x6e);
|
||||
j = 1;
|
||||
i = --j || --j;
|
||||
if( j != -1 ) error(0x6f);
|
||||
if( i != 1 ) error(0x70);
|
||||
j = 1;
|
||||
i = j ? --j : --j;
|
||||
if( j != 0 ) error(0x71);
|
||||
if( i != 0 ) error(0x72);
|
||||
|
||||
v41_testvalue = 128;
|
||||
if (v41_testvalue != ((long) 128)) error(0x73);
|
||||
if (v41_testvalue != ((int)(long) 128)) error(0x74);
|
||||
if (v41_testvalue != (int)((long) 128)) error(0x75);
|
||||
v41_testvalue = 128 * 3;
|
||||
if (v41_testvalue != (int)((long) 128*3)) error(0x76);
|
||||
|
||||
if ((long)p & 0x80000000);
|
||||
}
|
||||
|
||||
struct qtest {
|
||||
int sar[10];
|
||||
};
|
||||
|
||||
struct zip {
|
||||
int i; char c[6]; int j;
|
||||
} zippo[] = {
|
||||
0, "zero", 00,
|
||||
1, "one", 11,
|
||||
2, "two", 22,
|
||||
3, "three", 33,
|
||||
4, 'fo', "ur", 44,
|
||||
5, "five", 55,
|
||||
6, 'si', 'x', 0, 0, 0, 66,
|
||||
7, 'se', 've', 'n\0', 77,
|
||||
0
|
||||
};
|
||||
|
||||
struct Abit {
|
||||
char x0;
|
||||
char x1:1;
|
||||
int x2:1;
|
||||
int x3:1;
|
||||
} bit1;
|
||||
|
||||
struct Bbit {
|
||||
char bx1;
|
||||
int bx2:1;
|
||||
int bx3:1;
|
||||
} bit2;
|
||||
|
||||
v42()
|
||||
{
|
||||
int case_val, index, tmp;
|
||||
int aar[10];
|
||||
struct qtest a;
|
||||
|
||||
v41_testvalue = 128 * 3;
|
||||
if (v41_testvalue != ((int)(long) 128*3)) error(0x80);
|
||||
case_val = 0200| 'P';
|
||||
switch(case_val) {
|
||||
case (0200|'P'): break;
|
||||
default: error(0x81); break;
|
||||
}
|
||||
if (sizeof(a.sar) != sizeof(aar)) error(0x82);
|
||||
index = 2;
|
||||
aar[index+1] = 'c';
|
||||
if (aar[index+'\01'] != 'c') error(0x83);
|
||||
if (c0[3] != 3) error(0x84);
|
||||
if (i0[5] != 5) error(0x85);
|
||||
if (l0[12] != 12) error(0x86);
|
||||
|
||||
if (eqstr(zippo[1].c,"one")==0) error(0x87);
|
||||
if (eqstr(zippo[4].c,"four")==0) error(0x88);
|
||||
if (eqstr(zippo[6].c,"six")==0) error(0x89);
|
||||
if (eqstr(zippo[7].c,"seven")==0) error(0x8a);
|
||||
|
||||
tmp = 'd';
|
||||
index = tmp - 'a';
|
||||
if (ca[index] != ca[tmp - 'a']) error(0x8b);
|
||||
|
||||
if (sizeof(struct Proto) != 26) error(0x8c);
|
||||
if ((sizeof(struct Proto)*2) != sizeof(Ptbl)) error(0x8d);
|
||||
tmp = 0x7000;
|
||||
switch(tmp & 0xf000) {
|
||||
default:
|
||||
case_val = tmp&0xf000; error(0x8e); printf("val == %x\n",case_val);
|
||||
case 0x7000:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
struct termio {
|
||||
int c_iflag;
|
||||
int c_oflag;
|
||||
int c_cflag;
|
||||
int c_lflag;
|
||||
int c_line;
|
||||
char c_cc[8];
|
||||
};
|
||||
|
||||
struct termio ttys;
|
||||
int ttysave;
|
||||
|
||||
v42_a()
|
||||
{
|
||||
long l;
|
||||
|
||||
bit1.x2 = 1;
|
||||
bit1.x3 = 0;
|
||||
bit2.bx2 = 1;
|
||||
bit2.bx3 = 0;
|
||||
if( bit1.x2 != bit2.bx2) error(0x90);
|
||||
if( bit1.x3 != bit2.bx3) error(0x91);
|
||||
|
||||
if (ch_test() != (DOHIST|QUOTED)) error(0x92);
|
||||
|
||||
l = 0x8000L;
|
||||
if (!(l & 0x8000)) error(0x93);
|
||||
|
||||
if (iox(0, (('T'<<8)|1), &ttys) >= 0)
|
||||
ttysave = ttys.c_oflag;
|
||||
|
||||
if (eqstr(star.ctag[3],"three")==0) error(0x94);
|
||||
if (sa.a[1] != 2) error(0x95);
|
||||
if (sa.b[1] != 'b') error(0x96);
|
||||
if (sa.c[1] != 4) error(0x97);
|
||||
if (eqstr(sa.d[1],"def")==0) error(0x98);
|
||||
}
|
||||
|
||||
iox(i,j,k)
|
||||
int i, j;
|
||||
long k;
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
eqstr(ap1,ap2)
|
||||
char *ap1, *ap2;
|
||||
{
|
||||
register char *p1, *p2;
|
||||
|
||||
p1 = ap1;
|
||||
p2 = ap2;
|
||||
while(*p1) {
|
||||
if(*p1++ != *p2++)
|
||||
return(0);
|
||||
}
|
||||
if(*p2)
|
||||
return(0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
ch_test()
|
||||
{
|
||||
return(DOHIST|QUOTED);
|
||||
}
|
||||
|
||||
error(ernum)
|
||||
int ernum;
|
||||
{
|
||||
printf("error %x\n",ernum);
|
||||
err++;
|
||||
}
|
||||
|
||||
|
||||
665
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/test3.c
Normal file
665
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/test3.c
Normal file
@@ -0,0 +1,665 @@
|
||||
|
||||
/* Compiler Test Program Part III - version 4.2 plus */
|
||||
char *version = "%W% %G%";
|
||||
|
||||
int x1[5] = { 0, 1, 2, 3, 4, };
|
||||
int x2[5] = { 0, 1, 2, 3, 4 };
|
||||
int x3[5] = { 0, 1, 2, 3, };
|
||||
|
||||
unsigned u = -1;
|
||||
|
||||
char arc[5][3] = {
|
||||
0x1111, 0x1111, 0x1111, 0x1111, 0x1111,
|
||||
0xffff, 0x1ffff, 0xffff, 0xffff, 0xffff /* should have warnings on init */
|
||||
};
|
||||
|
||||
int ari[5][3] = {
|
||||
0x1111, 0x1111, 0x1111, 0x1111, 0x1111,
|
||||
0xffff, 0x1ffff, 0xffff, 0xffff, 0xffff /* should have 1 warning on init */
|
||||
};
|
||||
|
||||
unsigned int aru[5][3] = {
|
||||
0x1111, 0x1111, 0x1111, 0x1111, 0x1111,
|
||||
0xffff, 0x1ffff, 0xffff, 0xffff, 0xffff /* should have 1 warning on init */
|
||||
};
|
||||
|
||||
long arl[5][3] = {
|
||||
0x1111, 0x1111, 0x1111, 0x1111, 0x1111,
|
||||
0xffff, 0x1ffff, 0xffff, 0xffff, 0xffff
|
||||
};
|
||||
|
||||
short ars[2][2] = {
|
||||
0|0100000, 1|0100000, 0xffff, 0x8000|0x040
|
||||
};
|
||||
|
||||
struct Mstruct {
|
||||
int ar[3];
|
||||
char c;
|
||||
} *mtab[] = {
|
||||
0, 1, 2, 'c'
|
||||
};
|
||||
|
||||
typedef int tdefa[(5)];
|
||||
typedef int tdefb [10+(2)];
|
||||
|
||||
tdefa a;
|
||||
tdefb b;
|
||||
|
||||
int ff[(5)];
|
||||
|
||||
struct atype {
|
||||
int a;
|
||||
long b;
|
||||
int c;
|
||||
} A[] = {
|
||||
{ 1, 1, 1 },
|
||||
{ 2, 2, 2 },
|
||||
{ 3, 3, 3 },
|
||||
};
|
||||
|
||||
struct atype *mikeC[] = { /* better not have any warnings on init... */
|
||||
0xf1e010,
|
||||
0xf1e011,
|
||||
0xf1e012,
|
||||
0xf1e013,
|
||||
0,
|
||||
};
|
||||
|
||||
struct btype {
|
||||
char *p1;
|
||||
int i;
|
||||
char c;
|
||||
} B = {
|
||||
"This is a string.....",
|
||||
35,
|
||||
'p'
|
||||
};
|
||||
|
||||
|
||||
int err;
|
||||
char string[] = "9876543210";
|
||||
|
||||
int fun1(), fun2();
|
||||
struct {
|
||||
int sz;
|
||||
int (*func)();
|
||||
} fun[2] = { 1, fun1, 2, fun2 };
|
||||
int fglobal;
|
||||
int global1 = 4, global2 = 5;
|
||||
|
||||
main()
|
||||
{
|
||||
v42();
|
||||
test();
|
||||
test2();
|
||||
aray();
|
||||
do_stass();
|
||||
do_sizeof();
|
||||
dbra_tst();
|
||||
new_test();
|
||||
|
||||
if (err)
|
||||
printf("Tough Luck...\n");
|
||||
else
|
||||
printf("Far Freaking Out...\n");
|
||||
}
|
||||
|
||||
error(ernum)
|
||||
int ernum;
|
||||
{
|
||||
printf("error %x\n",ernum);
|
||||
err++;
|
||||
}
|
||||
|
||||
short mstype;
|
||||
typedef struct MODES {
|
||||
short imap;
|
||||
} MODER, *pMODER;
|
||||
static MODER amode;
|
||||
pMODER vmode;
|
||||
|
||||
v42()
|
||||
{
|
||||
int i;
|
||||
struct test {
|
||||
int a;
|
||||
long b;
|
||||
struct {
|
||||
char c;
|
||||
int d;
|
||||
}y;
|
||||
} x;
|
||||
|
||||
if (A[0].b != 1) error(0x1);
|
||||
if (A[1].c != 2) error(0x2);
|
||||
if (A[2].a != 3) error(0x3);
|
||||
x.y.d = 3;
|
||||
x.a = 0;
|
||||
{
|
||||
if (!x.y.d) error(0x4);
|
||||
}
|
||||
if (x.a) error(0x5);
|
||||
|
||||
{
|
||||
char *s = &string;
|
||||
int i;
|
||||
|
||||
i = *s - '0';
|
||||
if (i != 9) error(0x5);
|
||||
}
|
||||
{
|
||||
register int regi;
|
||||
int i;
|
||||
|
||||
if ((i=f(3)) > f(1)) ; else error(0x6);
|
||||
if ((regi=f(3)) > f(1)) ; else error(0x7);
|
||||
}
|
||||
if (1) {
|
||||
short count = 0;
|
||||
|
||||
mstype = 33;
|
||||
}
|
||||
if (mstype != 33) error(0x8);
|
||||
ff[i=0] = 33;
|
||||
if (ff[0] != 33) error(0x9);
|
||||
if(!main) error(0x10);
|
||||
vmode = &amode;
|
||||
}
|
||||
|
||||
f(val)
|
||||
int val;
|
||||
{
|
||||
return(val);
|
||||
}
|
||||
|
||||
struct fi_index {
|
||||
long fi_flags;
|
||||
unsigned fi_count;
|
||||
char fi_groupid;
|
||||
char fi_nlinks;
|
||||
int fi_ownerid;
|
||||
long fi_fsize;
|
||||
long fi_findblk;
|
||||
int fi_dev;
|
||||
int fi_lock;
|
||||
int fi_spdev;
|
||||
char *fi_rlocks;
|
||||
};
|
||||
|
||||
char ca[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
int ica[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
char cb[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||
char cc[10] = { '01', '23', '45', '67', '89' };
|
||||
|
||||
struct A {
|
||||
int a;
|
||||
long b;
|
||||
} atype[] = {
|
||||
0, 3,
|
||||
1, 4,
|
||||
2, 5
|
||||
};
|
||||
|
||||
int three[3][3][3] = {
|
||||
0,0,0,0,0,0,0,0,0,
|
||||
1,1,1,1,1,1,1,1,1,
|
||||
2,2,2,2,2,2,2,2,2
|
||||
};
|
||||
|
||||
/*char ar_test[0xf0000];*/
|
||||
aray()
|
||||
{
|
||||
register int n;
|
||||
register char c, *bp;
|
||||
register struct fi_index *fip;
|
||||
struct fi_index xxx;
|
||||
|
||||
fip = &xxx;
|
||||
xxx.fi_fsize = 3;
|
||||
n = 5000;
|
||||
if( n > (4096 - fip->fi_fsize) ) {
|
||||
n = 4096 - fip->fi_fsize;
|
||||
if (n != (4096 - fip->fi_fsize)) error(0x20);
|
||||
}
|
||||
else
|
||||
error(0x21);
|
||||
|
||||
if (ca[3] != 3) error(0x22);
|
||||
if (ica[7] != 7) error(0x23);
|
||||
if (cb[5] != '5') error(0x24);
|
||||
if (cc[8] != '8') error(0x25);
|
||||
if (atype[2].a != 2) error(0x26);
|
||||
if (atype[0].b != 3) error(0x27);
|
||||
if (three[0][0][2] != 0) error(0x28);
|
||||
if (three[1][1][1] != 1) error(0x29);
|
||||
if (three[2][2][0] != 2) error(0x2a);
|
||||
|
||||
/*
|
||||
ar_test[0xa000L] = '7'; bp = &ar_test[0];
|
||||
c = bp[0xa000L];
|
||||
if (c != '7') error(0x2b);
|
||||
ar_test[0x10000] = 'T';
|
||||
c = bp[0x10000];
|
||||
if (c != 'T') error(0x2c);
|
||||
*/
|
||||
}
|
||||
|
||||
struct {
|
||||
int _a, _a1, _a2, _a3, _a4;
|
||||
long _b, _b1, _b2, _b3, _b4;
|
||||
char _c, _c2, _c3, _c4;
|
||||
} st, *pt, st2, *pt2, sa[3];
|
||||
|
||||
do_stass()
|
||||
{
|
||||
pt = &st; pt2 = &st2;
|
||||
st._b4 = 3; st2._b4 = 9;
|
||||
st = st2;
|
||||
if (st._b4 != st2._b4) error(0x28);
|
||||
pt->_b1 = 55; pt2->_b1 = 34;
|
||||
*pt = *pt2;
|
||||
if (pt->_b1 != pt2->_b1) error(0x29);
|
||||
st = *pt;
|
||||
*pt = st;
|
||||
sa[0]._c4 = 'd'; sa[1]._c4 = '8';
|
||||
sa[1] = sa[0];
|
||||
if (sa[0]._c4 != sa[1]._c4) error(0x2a);
|
||||
}
|
||||
|
||||
|
||||
struct sz_struc {
|
||||
int za[10];
|
||||
char zc;
|
||||
char zb[3];
|
||||
struct xxx {
|
||||
char zd[5];
|
||||
long ze[2];
|
||||
}zf;
|
||||
} *s, t;
|
||||
int szaray[10];
|
||||
|
||||
typedef struct TDS {
|
||||
char st;
|
||||
unsigned fConstant : 1;
|
||||
unsigned width : 7;
|
||||
unsigned bt : 4;
|
||||
unsigned tq1 : 2;
|
||||
unsigned tq2 : 2;
|
||||
unsigned tq3 : 2;
|
||||
unsigned tq4 : 2;
|
||||
unsigned tq5 : 2;
|
||||
unsigned tq6 : 2;
|
||||
} TDR, *pTDR;
|
||||
|
||||
typedef struct {
|
||||
char sbVar[8];
|
||||
TDR td;
|
||||
long valTy;
|
||||
} TYR, *pTYR;
|
||||
|
||||
TYR vrgTySpc[] = { /* test of short element initialization */
|
||||
{"$cBad", '\0', '\0', '\0', '\0', 0},
|
||||
0
|
||||
};
|
||||
|
||||
struct one {
|
||||
struct two *p2;
|
||||
struct one *p1;
|
||||
};
|
||||
|
||||
struct two {
|
||||
int atwo, btwo, ctwo, dtwo;
|
||||
};
|
||||
|
||||
struct one xyzzy[] = {
|
||||
0, 0
|
||||
};
|
||||
|
||||
char szof[10];
|
||||
|
||||
struct AAAAA {
|
||||
char a[3];
|
||||
int b[3];
|
||||
long c[3];
|
||||
double d[3];
|
||||
char e[3][3];
|
||||
int f[3][3];
|
||||
long g[3][3];
|
||||
double h[3][3];
|
||||
char i;
|
||||
int j;
|
||||
long k;
|
||||
float l;
|
||||
} *abcdef;
|
||||
|
||||
do_sizeof()
|
||||
{
|
||||
char nx[sizeof szof];
|
||||
char ny[sizeof (szof)];
|
||||
int i;
|
||||
long l;
|
||||
char *p;
|
||||
int *pi;
|
||||
|
||||
if ( sizeof(vrgTySpc) != (2 * sizeof(TYR)) ) error(0x30);
|
||||
if ( sizeof(s->za) != 20 ) error(0x31);
|
||||
if ( sizeof(s->zb) != 3 ) error(0x32);
|
||||
if ( sizeof(s->zf) != 14 ) error(0x33);
|
||||
if ( sizeof(s->zf.ze) != 8 ) error(0x34);
|
||||
if ( sizeof(szaray) != 20 ) error(0x35);
|
||||
if ( sizeof(t.za) != 20 ) error(0x36);
|
||||
if ( sizeof(s->za[4]) != 2 ) error(0x37);
|
||||
if ( sizeof(t.zc) != 1 ) error(0x38);
|
||||
if ( sizeof(p) != 4 ) error(0x39);
|
||||
if ( sizeof(pi) != 4 ) error(0x3a);
|
||||
if ( sizeof(xyzzy) != 8 ) error(0x3b);
|
||||
if ( sizeof(l) != 4 ) error(0x3c);
|
||||
if ( sizeof(*p) != 1 ) error(0x3d);
|
||||
if ( sizeof(*pi) != 2 ) error(0x3e);
|
||||
if ( sizeof(szaray[4]) != 2 ) error(0x3f);
|
||||
if ( sizeof(struct one) != 8) error(0x40);
|
||||
if ( sizeof(nx) != sizeof ny) error(0x41);
|
||||
if ( sizeof(ny) != 10) error(0x42);
|
||||
if ( sizeof(abcdef->a) != 3) error(0x43);
|
||||
if ( sizeof(abcdef->b) != 6) error(0x44);
|
||||
if ( sizeof(abcdef->c) != 12) error(0x45);
|
||||
if ( sizeof(abcdef->d) != 12) error(0x46);
|
||||
if ( sizeof(abcdef->e) != 9) error(0x47);
|
||||
if ( sizeof(abcdef->f) != 18) error(0x48);
|
||||
if ( sizeof(abcdef->g) != 36) error(0x49);
|
||||
if ( sizeof(abcdef->h) != 36) error(0x4a);
|
||||
if ( sizeof(abcdef->i) != 1) error(0x4b);
|
||||
if ( sizeof(abcdef->j) != 2) error(0x4c);
|
||||
if ( sizeof(abcdef->k) != 4) error(0x4d);
|
||||
if ( sizeof(abcdef->l) != 4) error(0x4e);
|
||||
}
|
||||
|
||||
|
||||
typedef long ADRT;
|
||||
|
||||
ADRT vfp;
|
||||
|
||||
int PutState()
|
||||
{
|
||||
vfp = 1; /* just needs to compile.... */
|
||||
}
|
||||
|
||||
struct saxer {
|
||||
struct saxer *ptr;
|
||||
unsigned int u_incr;
|
||||
int i_incr;
|
||||
} john[4];
|
||||
|
||||
typedef long X;
|
||||
X typey;
|
||||
#define STL 0x400L
|
||||
|
||||
struct xx {
|
||||
int a, b;
|
||||
};
|
||||
|
||||
test()
|
||||
{
|
||||
register struct saxer *p, *q;
|
||||
register short mask;
|
||||
int dp, z, *zp;
|
||||
long l, lo;
|
||||
register char rc;
|
||||
register int ri;
|
||||
char c;
|
||||
int i;
|
||||
struct xx xa[8/sizeof(struct xx)];
|
||||
struct xx xd[8/4];
|
||||
|
||||
dp = 0x720;
|
||||
mask = ((dp&0xff)<<1) -1;
|
||||
if (mask != 0x3f) error(0x50);
|
||||
|
||||
l = 0x7777ff30;
|
||||
casttest((int)(l&0xff)); /* error 0x51 */
|
||||
lo = 0;
|
||||
l = STL - lo;
|
||||
if (l != 0x400L) error(0x52);
|
||||
l = 0xffffffff;
|
||||
if (!(l & 0x80000000)) error(0x53);
|
||||
l &= 0x80000000;
|
||||
if (l != 0x80000000) error(0x54);
|
||||
|
||||
mask = 1;
|
||||
l = 0xf;
|
||||
mask += (l&1);
|
||||
if (mask != 2) error(0x55);
|
||||
|
||||
z = 1;
|
||||
(*fun[z].func)();
|
||||
if (fglobal != 3) error(0x56);
|
||||
|
||||
typey = 0x71234;
|
||||
fun1(typey); /* error 0x57 */
|
||||
z = 34;
|
||||
z &= 0;
|
||||
if (z) error(0x58);
|
||||
p = &john[0]; q = &john[0];
|
||||
p->u_incr = 2;
|
||||
p->i_incr = 2;
|
||||
p += p->u_incr;
|
||||
q += q->i_incr;
|
||||
if (p != q) error(0x59);
|
||||
if (sizeof(xa) != sizeof(xd)) error(0x5a);
|
||||
zp = &z;
|
||||
*zp = 34;
|
||||
*zp != 0;
|
||||
if (*zp != 34) error(0x5b);
|
||||
if (global1 != 4) error(0x5c);
|
||||
if (global2 != 5) error(0x5d);
|
||||
rc = 6; c = 8; ri = 2; i = 4;
|
||||
c /= ri;
|
||||
if (c != 4) error(0x5e);
|
||||
c /= i;
|
||||
if (c != 1) error(0x5f);
|
||||
rc /= 2;
|
||||
if (rc != 3) error(0x60);
|
||||
}
|
||||
|
||||
casttest(i)
|
||||
int i;
|
||||
{
|
||||
if (i != 0x30) error(0x51);
|
||||
}
|
||||
|
||||
fun1(l)
|
||||
long l;
|
||||
{
|
||||
fglobal = 2;
|
||||
if (l != 0x71234) error(0x57);
|
||||
}
|
||||
|
||||
fun2()
|
||||
{
|
||||
fglobal = 3;
|
||||
}
|
||||
|
||||
char *shifts[4] = { "as", "ls", "rox", "ro" };
|
||||
|
||||
test2()
|
||||
{
|
||||
int i;
|
||||
long l;
|
||||
int y();
|
||||
char *mnem;
|
||||
int opcode;
|
||||
|
||||
l = 0xfe00; /* hex constant should be int value, which should go neg */
|
||||
if (l > 0) error(0x61);
|
||||
l = 32768;
|
||||
if (l < 0) error(0x62);
|
||||
f2(fun2,fun2); /* error 0x63 */
|
||||
|
||||
mnem = shifts[(opcode>>9)&3];
|
||||
is_512L(0x64,512L); /* error 0x64 */
|
||||
is_512L(0x65,(long)512); /* error 0x65 */
|
||||
i = 512;
|
||||
l = 512;
|
||||
is_512L(0x66,l); /* error 0x66 */
|
||||
is_512L(0x67,(long)i); /* error 0x67 */
|
||||
l = 500; i = 12;
|
||||
is_512L(0x68,l+i); /* error 0x68 */
|
||||
is_512L(0x69,512L*1); /* error 0x69 */
|
||||
is_512L(0x6a,511L+1); /* error 0x6a */
|
||||
is_512L(0x6b,1*512L); /* error 0x6b */
|
||||
is_512L(0x6c,1+511L); /* error 0x6c */
|
||||
is_512L(0x6d,(long)(512*1));/* error 0x6d */
|
||||
is_512L(0x6e,513L-1); /* error 0x6e */
|
||||
is_512L(0x6f,512L/1); /* error 0x6f */
|
||||
}
|
||||
|
||||
is_512L(enum,lval)
|
||||
int enum;
|
||||
long lval;
|
||||
{
|
||||
if (lval != 512L)
|
||||
error(enum);
|
||||
}
|
||||
|
||||
static f2(a1,a2)
|
||||
char *a1, *a2;
|
||||
{
|
||||
if (a1 != a2) error(0x63);
|
||||
}
|
||||
|
||||
int i_global;
|
||||
|
||||
dbra_tst()
|
||||
{
|
||||
register long reg_l;
|
||||
register int localreg;
|
||||
int local;
|
||||
long local_l;
|
||||
|
||||
local_l = i_global = local = localreg = reg_l = 1L;
|
||||
if(--i_global == -1) error(0x70);
|
||||
if(--local == -1) error(0x71);
|
||||
if(--localreg == -1) error(0x72);
|
||||
if(--local_l == -1) error(0x73);
|
||||
if(--reg_l == -1) error(0x74);
|
||||
|
||||
if(--i_global == -1) ; else error(0x75);
|
||||
if(--local == -1) ; else error(0x76);
|
||||
if(--localreg == -1) ; else error(0x77);
|
||||
if(--local_l == -1L) ; else error(0x78);
|
||||
if(--reg_l == -1L) ; else error(0x79);
|
||||
}
|
||||
|
||||
typedef char TBOOL;
|
||||
|
||||
TBOOL tboolx[2], tbooly[(2)];
|
||||
|
||||
struct xtype {
|
||||
char *p1;
|
||||
char *ar[20];
|
||||
char *p2;
|
||||
};
|
||||
|
||||
struct xtype newff = {
|
||||
"p1",
|
||||
"zero",
|
||||
"one",
|
||||
};
|
||||
|
||||
char *xfp = "abc";
|
||||
|
||||
struct xtype ff0 = {
|
||||
0L,
|
||||
1L,
|
||||
2L,
|
||||
3L,
|
||||
4L,
|
||||
5L,
|
||||
6L,
|
||||
7L,
|
||||
};
|
||||
|
||||
struct xtype ff1 = {
|
||||
"p1",
|
||||
"zero",
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"five",
|
||||
"p2",
|
||||
};
|
||||
|
||||
struct xtype ff2 = {
|
||||
"p1",
|
||||
"zero",
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"five",
|
||||
"p2"
|
||||
};
|
||||
|
||||
struct xtype ff3 = {
|
||||
"p1",
|
||||
"zero",
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"five",
|
||||
};
|
||||
|
||||
struct xtype ff4 = {
|
||||
"p1",
|
||||
"zero",
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"five"
|
||||
};
|
||||
|
||||
struct xtype ff5 = {
|
||||
"p1",
|
||||
"zero",
|
||||
"one",
|
||||
"two",
|
||||
};
|
||||
|
||||
struct xtype ff6 = {
|
||||
"p1",
|
||||
"zero",
|
||||
"one",
|
||||
"two"
|
||||
};
|
||||
|
||||
new_test()
|
||||
{
|
||||
char *cp;
|
||||
extern int err;
|
||||
char str[9];
|
||||
int i;
|
||||
unsigned u;
|
||||
|
||||
/* typedef and paren'd strangeness */
|
||||
if(sizeof(tboolx) != sizeof(tbooly)) error(0x80);
|
||||
if(sizeof(tbooly) != 2) error(0x81);
|
||||
tboolx[1] = 1; tbooly[1] = 1;
|
||||
cp = tboolx;
|
||||
if(*(cp+1) != 1) error(0x82);
|
||||
cp = tbooly;
|
||||
if(*(cp+1) != 1) error(0x83);
|
||||
/* assignment as a subscript */
|
||||
str[i=0] = 3;
|
||||
if(str[i] != 3) error(0x84);
|
||||
if(i != 0) error(0x85);
|
||||
/* structure pointer array initializations */
|
||||
newff.ar[1] = "xyz";
|
||||
if(*xfp != 'a' || *(xfp+1) != 'b' || *(xfp+2) != 'c') error(0x86);
|
||||
/* unsigned increment to pointer */
|
||||
cp = str; i = u = 3;
|
||||
*(cp+i) = 'c';
|
||||
if (*(cp+u) != 'c') error(0x87);
|
||||
}
|
||||
629
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/test4.c
Normal file
629
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/test/test4.c
Normal file
@@ -0,0 +1,629 @@
|
||||
/* Post 4.2 compilers */
|
||||
char *version = "%W% %G%";
|
||||
|
||||
struct xxx {
|
||||
int x;
|
||||
char m,n,o,p;
|
||||
};
|
||||
|
||||
struct zzz {
|
||||
int b;
|
||||
struct aaa {
|
||||
int f;
|
||||
char g, h, i, j;
|
||||
} bb[3];
|
||||
int c;
|
||||
} A = {
|
||||
1,
|
||||
2, 'a', 'b', 'c', 'd',
|
||||
3, 'e', 'f', 'g', 'h'
|
||||
};
|
||||
|
||||
struct yyy {
|
||||
int a;
|
||||
struct xxx y[3];
|
||||
int q;
|
||||
} B = {
|
||||
1,
|
||||
2, 'a', 'b', 'c', 'd',
|
||||
3, 'e', 'f', 'g', 'h'
|
||||
};
|
||||
|
||||
char ar[3][3] = { 'a', 'b', 'c', 'd', 'e' };
|
||||
int x[2][2][2] = { 1, 2, 3, 4, 5, 6, 7, 8, };
|
||||
int errors;
|
||||
|
||||
main()
|
||||
{
|
||||
xtest();
|
||||
ytest();
|
||||
ztest();
|
||||
dec_inc();
|
||||
div_test();
|
||||
s_u_test();
|
||||
next_to_last_test();
|
||||
last_test();
|
||||
if(!errors)
|
||||
printf("Far Freaking Out\n");
|
||||
else
|
||||
printf("Tough Luck\n");
|
||||
}
|
||||
|
||||
error(enum)
|
||||
int enum;
|
||||
{
|
||||
printf("error %x\n",enum);
|
||||
errors++;
|
||||
}
|
||||
|
||||
char *xstr1 = "8999999988";
|
||||
char *xstr2 = "8999999988";
|
||||
char *xstr3 = "8999999988";
|
||||
|
||||
xtest()
|
||||
{
|
||||
register char *rcp, rc;
|
||||
char *cp, c;
|
||||
int i;
|
||||
long *laddr;
|
||||
int *iaddr;
|
||||
short *saddr;
|
||||
long addr;
|
||||
|
||||
if(A.bb[1].i != 'g') error(0x1);
|
||||
if(A.bb[1].i != B.y[1].o) error(0x2);
|
||||
if(A.c != 0) error(0x3);
|
||||
if(B.y[3].f != 0) error(0x4);
|
||||
i = 257;
|
||||
i = (char)(i + 3);
|
||||
if (i != 4) error(0x5);
|
||||
|
||||
saddr = laddr = iaddr = addr = 0xff000;
|
||||
if(laddr != addr) error(0x6);
|
||||
if(iaddr != addr) error(0x7);
|
||||
if(saddr != addr) error(0x8);
|
||||
|
||||
rcp = &xstr1[6];
|
||||
while((*rcp)++ == '9')
|
||||
*rcp-- = '0';
|
||||
rcp = &xstr2[7];
|
||||
while((*--rcp)++ == '9')
|
||||
*rcp = '0';
|
||||
cp = &xstr3[7];
|
||||
while((*--cp)++ == '9')
|
||||
*cp = '0';
|
||||
if(strcmp(xstr1,"9000000988") != 0) error(0x9);
|
||||
if(strcmp(xstr2,"9000000988") != 0) error(0xa);
|
||||
if(strcmp(xstr3,"9000000988") != 0) error(0xb);
|
||||
|
||||
rc = '9';
|
||||
rc = *rcp++ = '3';
|
||||
if(rc != '3') error(0xc);
|
||||
if(*(rcp-1) != '3') error(0xd);
|
||||
|
||||
c = '8';
|
||||
c = (char)0;
|
||||
if(c != '\0') error(0xe);
|
||||
if(multest() != 4) error(0xf);
|
||||
}
|
||||
|
||||
struct bfs {
|
||||
int bf1: 1;
|
||||
} bfx, *bfa[3] = { (char *)-1, &bfx, (char *)-1} ;
|
||||
|
||||
char xar[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
|
||||
dec_inc()
|
||||
{
|
||||
register struct bfs **bfp;
|
||||
register char *p, *q, c;
|
||||
|
||||
bfx.bf1 = 0;
|
||||
bfp = &bfa[2];
|
||||
(*--bfp)->bf1 += 1;
|
||||
if( bfx.bf1 != 1 ) error(0x10);
|
||||
p = &xar[10];
|
||||
(*--p)++;
|
||||
if( xar[9] != 10 || p != &xar[9] ) error(0x11);
|
||||
c = (*--p)++;
|
||||
if( c != 8 || xar[8] != 9 || p != &xar[8] ) error(0x12);
|
||||
c = 7;
|
||||
if( (*--p)++ != c || xar[7] != 8 || p != &xar[7] ) error(0x13);
|
||||
p = &xar[0];
|
||||
(*p++)++;
|
||||
if( xar[0] != 1 || p != &xar[1] ) error(0x14);
|
||||
c = (*p++)++;
|
||||
if( c != 1 || xar[1] != 2 || p != &xar[2] ) error(0x15);
|
||||
c = 2;
|
||||
if( (*p++)++ != c || xar[2] != 3 || p != &xar[3] ) error(0x16);
|
||||
--(*--p);
|
||||
if( xar[2] != 2 || p != &xar[2] ) error(0x17);
|
||||
c = --(*--p);
|
||||
if( c != 1 || xar[1] != 1 || p != &xar[1] ) error(0x18);
|
||||
c = 0;
|
||||
if( --(*--p) != c || xar[0] != 0 || p != &xar[0] ) error(0x19);
|
||||
--(*p++);
|
||||
if( xar[0] != -1 || p != &xar[1] ) error(0x1a);
|
||||
c = --(*p++);
|
||||
if( c != 0 || xar[1] != 0 || p != &xar[2] ) error(0x1b);
|
||||
c = 1;
|
||||
if( --(*p++) != c || xar[2] != 1 || p != &xar[3] ) error(0x1c);
|
||||
}
|
||||
|
||||
multest()
|
||||
{
|
||||
char *s;
|
||||
register int i;
|
||||
int j;
|
||||
|
||||
s = &j;
|
||||
*s = 2;
|
||||
s[1] = 0;
|
||||
i = 2;
|
||||
return(i * *s);
|
||||
}
|
||||
|
||||
div_test()
|
||||
{
|
||||
int i, i2;
|
||||
long l, l2;
|
||||
register int ri, ri2;
|
||||
register long rl, rl2;
|
||||
|
||||
rl2 = l2 = 70000;
|
||||
ri = rl2 / 10;
|
||||
rl = rl2 / 10;
|
||||
i = l2 / 10;
|
||||
l = l2 / 10;
|
||||
if(ri != i) error(0x20);
|
||||
if(rl != l) error(0x21);
|
||||
if(i != 7000) error(0x22);
|
||||
if(i != l) error(0x23);
|
||||
|
||||
i2 = ri2 = 1;
|
||||
ri = rl2 / ri2;
|
||||
rl = rl2 / ri2;
|
||||
i = l2 / i2;
|
||||
l = l2 / i2;
|
||||
if(ri != i) error(0x24);
|
||||
if(rl != l) error(0x25);
|
||||
if(rl != rl2) error(0x26);
|
||||
if(ri == rl) error(0x27);
|
||||
}
|
||||
|
||||
struct fcbflags {
|
||||
unsigned online : 1;
|
||||
unsigned buffer_dirty : 1;
|
||||
unsigned open_mode : 2;
|
||||
unsigned device_type : 3;
|
||||
unsigned file_type : 2;
|
||||
unsigned unbuffered : 1;
|
||||
};
|
||||
|
||||
struct fcb {
|
||||
int fcbfd;
|
||||
char *fcpfp;
|
||||
struct fcbflags fcbflg;
|
||||
char name;
|
||||
};
|
||||
|
||||
#define ONE 1
|
||||
#define TWO 2
|
||||
|
||||
#define IADDRESS ((int *)0xfff900)
|
||||
#define CADDRESS ((char *)0xfff900)
|
||||
#define LADDRESS ((long *)0xfff900)
|
||||
#define SADDRESS ((struct device *)0xfff900)
|
||||
|
||||
struct device {
|
||||
int mts;
|
||||
char mtc;
|
||||
long mtl;
|
||||
int mti;
|
||||
};
|
||||
|
||||
struct exec {
|
||||
int xx[19];
|
||||
int y;
|
||||
};
|
||||
|
||||
typedef char *charp;
|
||||
struct t {
|
||||
char *p1;
|
||||
char *p2;
|
||||
} ht1 = { 0, ((charp) 30) },
|
||||
ht2 = { 0, 0 };
|
||||
|
||||
ytest()
|
||||
{
|
||||
register struct fcb *p;
|
||||
register long rl;
|
||||
register int *rpi;
|
||||
register long *rpl;
|
||||
register int ri1, ri2;
|
||||
struct fcb fs;
|
||||
long a;
|
||||
int i, j, ari[5];
|
||||
long l, arl[5];
|
||||
char buf[40];
|
||||
struct exec hdr, hdr2;
|
||||
|
||||
/* bit field arguments */
|
||||
i = 1; p = &fs;
|
||||
p->fcbflg.unbuffered = (i == 0) ? 0 : 1;
|
||||
if (!p->fcbflg.unbuffered) error(0x30);
|
||||
i = 0;
|
||||
p->fcbflg.unbuffered = (i == 0) ? 0 : 1;
|
||||
if (p->fcbflg.unbuffered) error(0x31);
|
||||
/* constant coersion */
|
||||
l = 32768;
|
||||
if (l != 32768L) error(0x32);
|
||||
l = 32 * 1024;
|
||||
if (l != 32768L) error(0x33);
|
||||
/* long to integer conversions including as parameters and return values */
|
||||
l = 0xf00030;
|
||||
ctest(0x34,0x35,(int)l,27); /* errors 34 & 35 */
|
||||
ctest2(0x36,(int)l); /* error 36 */
|
||||
l = 0xfff30;
|
||||
ctest(0x37,0x38,((int)l)&0xff,27); /* errors 37 & 38 */
|
||||
ctest2(0x39,((int)l)&0xff); /* error 39 */
|
||||
ctest(0x3a,0x3b,(int)(l&0xff),27); /* errors 3a & 3b */
|
||||
ctest2(0x3c,(int)(l&0xff)); /* errors 3c */
|
||||
if(func1(1) != 0x30) error(0x3d);
|
||||
if(func1(2) != 0x30) error(0x3e);
|
||||
if(func1(3) != 0x30) error(0x3f);
|
||||
/* equal-shift tests */
|
||||
rpi = &ari[3]; rpl = &arl[3];
|
||||
*rpi = 0x3f02;
|
||||
*rpi++ >>= 1;
|
||||
if(ari[3] != 0x1f81) error(0x40);
|
||||
*--rpi <<= 2;
|
||||
if(ari[3] != 0x7e04) error(0x41);
|
||||
*rpl = 0x6af010;
|
||||
*rpl++ >>= 4;
|
||||
if(arl[3] != 0x6af01) error(0x42);
|
||||
*--rpl <<=5;
|
||||
if(arl[3] != 0xd5e020) error(0x43);
|
||||
/* sethy-ulman easy expression */
|
||||
i = 10; j = 3;
|
||||
a = (long)i * (long)i - (long)j * (long)j;
|
||||
if(a != 91) error(0x44);
|
||||
/* tricky coercion of constant to integer pointer with array subscript */
|
||||
/* indexing off of int/long/char/struct pointers */
|
||||
l = &IADDRESS[TWO];
|
||||
if(l != 0xfff904) error(0x45);
|
||||
l = &LADDRESS[TWO];
|
||||
if(l != 0xfff908) error(0x46);
|
||||
l = &CADDRESS[TWO];
|
||||
if(l != 0xfff902) error(0x47);
|
||||
l = &(SADDRESS->mtc);
|
||||
if(l != 0xfff902) error(0x48);
|
||||
l = &(SADDRESS->mtl);
|
||||
if(l != 0xfff904) error(0x49);
|
||||
l = &(SADDRESS->mti);
|
||||
if(l != 0xfff908) error(0x4a);
|
||||
/* structure assigned to non structure item... */
|
||||
hdr.y = 3; hdr2.y = 5;
|
||||
*(struct exec *)buf = hdr;
|
||||
hdr2 = *(struct exec *)buf;
|
||||
if(hdr2.y != 3) error(0x4b);
|
||||
/* typedef cast inside structure initialization */
|
||||
if(ht1.p2 != 30) error(0x4c);
|
||||
/* indexing test with register index variables */
|
||||
i = j = ri1 = ri2 = 1;
|
||||
if (x[ri1][ri2][ri1] != x[1][1][1]) error(0x4d);
|
||||
if (x[i][j][i] != x[1][1][1]) error(0x4e);
|
||||
}
|
||||
|
||||
struct zxx {
|
||||
int a,b,c,d,e;
|
||||
};
|
||||
|
||||
ztest()
|
||||
{
|
||||
register long longtmp;
|
||||
int i, j, k;
|
||||
char *cp1, *cp2;
|
||||
int *ip1, *ip2;
|
||||
long *lp1, *lp2, l;
|
||||
struct zxx *sp1, *sp2;
|
||||
|
||||
/* int's cast to pointers... */
|
||||
i = 0x234;
|
||||
cp1 = i; cp2 = (char *)i;
|
||||
ip1 = i; ip2 = (int *)i;
|
||||
lp1 = i; lp2 = (long *)i;
|
||||
sp1 = i; sp2 = (struct zxx *)i;
|
||||
if(cp1 != cp2) error(0x70);
|
||||
if(ip1 != ip2) error(0x71);
|
||||
if(lp1 != lp2) error(0x72);
|
||||
if(sp1 != sp2) error(0x73);
|
||||
/* long easy code skeleton tests */
|
||||
i = 0x24; j = 0x11;
|
||||
/* addition.... */
|
||||
k = i * i + j * j;
|
||||
longtmp = (long)i * (long)i + (long)j * (long)j;
|
||||
l = (long)i * (long)i + (long)j * (long)j;
|
||||
if(longtmp != l) error(0x74);
|
||||
if(k != l) error(0x75);
|
||||
/* subtraction.... */
|
||||
k = i * i - j * j;
|
||||
longtmp = (long)i * (long)i - (long)j * (long)j;
|
||||
l = (long)i * (long)i - (long)j * (long)j;
|
||||
if(longtmp != l) error(0x76);
|
||||
if(k != l) error(0x77);
|
||||
/* exclusive or.... */
|
||||
k = i * i ^ j * j;
|
||||
longtmp = (long)i * (long)i ^ (long)j * (long)j;
|
||||
l = (long)i * (long)i ^ (long)j * (long)j;
|
||||
if(longtmp != l) error(0x78);
|
||||
if(k != l) error(0x79);
|
||||
/* inclusive or.... */
|
||||
k = i * i | j * j;
|
||||
longtmp = (long)i * (long)i | (long)j * (long)j;
|
||||
l = (long)i * (long)i | (long)j * (long)j;
|
||||
if(longtmp != l) error(0x7a);
|
||||
if(k != l) error(0x7b);
|
||||
}
|
||||
|
||||
struct _b {
|
||||
long y;
|
||||
int x;
|
||||
} bs;
|
||||
|
||||
union rec {
|
||||
struct _b l;
|
||||
struct {
|
||||
char c;
|
||||
int w;
|
||||
} f;
|
||||
} recs;
|
||||
|
||||
struct ty {
|
||||
int c;
|
||||
} tys;
|
||||
|
||||
struct _a {
|
||||
int x;
|
||||
} as;
|
||||
|
||||
union one {
|
||||
int a;
|
||||
long b;
|
||||
struct {
|
||||
int y;
|
||||
int x;
|
||||
} q;
|
||||
} ones, f1, f2;
|
||||
|
||||
struct two {
|
||||
int a;
|
||||
long b;
|
||||
struct {
|
||||
int y;
|
||||
int x;
|
||||
} q;
|
||||
} twos;
|
||||
|
||||
struct _x {
|
||||
long a;
|
||||
int b,c,d,e,f;
|
||||
};
|
||||
|
||||
struct _y {
|
||||
int t;
|
||||
struct _x s;
|
||||
} _yz = {
|
||||
33,
|
||||
{ 1, 2, 3, 4, 5 }
|
||||
};
|
||||
|
||||
struct _y _yq = { 33, 1, 2, 3, 4, 5 };
|
||||
|
||||
struct _s1 {
|
||||
int a;
|
||||
int b;
|
||||
};
|
||||
|
||||
struct _s2 {
|
||||
struct _s1 c;
|
||||
int d;
|
||||
};
|
||||
|
||||
struct _s2 test0 = { { 10, 20 }, 30 };
|
||||
struct _s2 test1 = { { 10, 20 } };
|
||||
struct _s2 test2 = { { 10 }, 30 };
|
||||
struct _s2 test3 = { 10, 20, 30 };
|
||||
|
||||
s_u_test()
|
||||
{
|
||||
bs.y = 1;
|
||||
bs.x = 2;
|
||||
recs.l.y = 3;
|
||||
recs.l.x = 4;
|
||||
tys.c = 'a';
|
||||
as.x = 5;
|
||||
if(bs.y != 1) error(0x50);
|
||||
if(bs.x != 2) error(0x51);
|
||||
if(recs.l.y != 3) error(0x52);
|
||||
if(recs.l.x != 4) error(0x53);
|
||||
if(tys.c != 'a') error(0x54);
|
||||
if(as.x != 5) error(0x55);
|
||||
recs.f.c = 'b';
|
||||
recs.f.w = 6;
|
||||
if(recs.f.c != 'b') error(0x56);
|
||||
if(recs.f.w != 6) error(0x57);
|
||||
if(tys.c != 'a') error(0x58);
|
||||
twos.a = 7;
|
||||
twos.b = 8;
|
||||
twos.q.y = 9;
|
||||
twos.q.x = 10;
|
||||
ones.a = 11; f1.b = 0; f2.b = 0;
|
||||
if(twos.a != 7) error(0x59);
|
||||
if(twos.b != 8) error(0x5a);
|
||||
if(twos.q.y != 9) error(0x5b);
|
||||
if(twos.q.x != 10) error(0x5c);
|
||||
if(ones.a != 11) error(0x5d);
|
||||
ones.b = 12;
|
||||
if(ones.b != 12) error(0x5e);
|
||||
if(f1.b != 0) error(0x5f);
|
||||
if(f2.b != 0) error(0x60);
|
||||
f1.b = f2.b = 0;
|
||||
ones.q.y = 13;
|
||||
if(ones.q.y != 13) error(0x61);
|
||||
if(f1.b != 0) error(0x62);
|
||||
if(f2.b != 0) error(0x63);
|
||||
f1.b = f2.b = 0;
|
||||
ones.q.x = 14;
|
||||
if(ones.q.x != 14) error(0x64);
|
||||
if(f1.b != 0) error(0x65);
|
||||
if(f2.b != 0) error(0x66);
|
||||
|
||||
/* initialization tests */
|
||||
if(_yz.s.c != 3) error(0x67);
|
||||
if(_yq.s.c != 3) error(0x68);
|
||||
if(test0.d != 30) error(0x69);
|
||||
if(test0.c.b != 20) error(0x6a);
|
||||
if(test1.d != 0) error(0x6b);
|
||||
if(test2.c.b != 0) error(0x6c);
|
||||
if(test3.c.b != 20) error(0x6d);
|
||||
if(test3.d != 30) error(0x6e);
|
||||
if(test2.d != 30) error(0x6f);
|
||||
}
|
||||
|
||||
ctest(err1,err2,value1,value2) /* value1 had better be an integer !!! */
|
||||
int err1, err2, value1, value2;
|
||||
{
|
||||
if(value1 != 0x30) error(err1);
|
||||
if(value2 != 27) error(err2);
|
||||
}
|
||||
|
||||
ctest2(err,value) /* value had better be an integer !!! */
|
||||
int err, value;
|
||||
{
|
||||
if(value != 0x30) error(err);
|
||||
}
|
||||
|
||||
func1(ret) /* had better return an integer....... */
|
||||
int ret;
|
||||
{
|
||||
long l;
|
||||
|
||||
l = 0xf0030;
|
||||
if(ret==1) return((int)l);
|
||||
l = 0xfff30;
|
||||
if(ret==2) return(((int)l)&0xff);
|
||||
return((int)(l&0xff)); /* return 3 */
|
||||
}
|
||||
|
||||
struct {
|
||||
char x_p[3][3];
|
||||
} *p_ca2, ca2;
|
||||
|
||||
int artl();
|
||||
|
||||
struct {
|
||||
int ss_x_z;
|
||||
int (*ss_ff)();
|
||||
} sff[] = {3, 0L, 4, &artl};
|
||||
|
||||
next_to_last_test()
|
||||
{
|
||||
char ch;
|
||||
int x, y;
|
||||
char ar[9];
|
||||
register char c;
|
||||
|
||||
/* defined character constants handled properly ?? */
|
||||
x = '\0';
|
||||
if(x != 0) error(0x80);
|
||||
x = '\f';
|
||||
if(x != 014) error(0x81);
|
||||
x = '\t';
|
||||
if(x != 011) error(0x82);
|
||||
x = '\n';
|
||||
if(x != 012) error(0x83);
|
||||
x = '\r';
|
||||
if(x != 015) error(0x84);
|
||||
x = '\b';
|
||||
if(x != 010) error(0x85);
|
||||
x = '\\';
|
||||
if(x != 0134) error(0x86);
|
||||
/* character indices... */
|
||||
ar[1] = '5'; ar[2] = '6'; x = 1;
|
||||
ar[ c = (x==1) ? 2 : 1 ] = '3';
|
||||
if (c != 2) error(0x87);
|
||||
if(ar[2] != '3') error(0x88);
|
||||
ar[c & ~128] = '5';
|
||||
if(ar[2] != '5') error(0x89);
|
||||
/* array indices incrementing with pointers and other strange things */
|
||||
p_ca2 = &ca2;
|
||||
ca2.x_p[1][1] = 'c';
|
||||
x = 1; y = 1;
|
||||
p_ca2->x_p[x][y++] = 'd';
|
||||
if(ca2.x_p[1][1] != 'd') error(0x8a);
|
||||
if(y != 2) error(0x8b);
|
||||
/* struct with function arg return */
|
||||
x = 1;
|
||||
x = (*sff[x].ss_ff)();
|
||||
if (x != 4) error(0x8c);
|
||||
/* character's compared to integer and long constants */
|
||||
ch = 127;
|
||||
if(ch > 0xffffff) error(0x8d);
|
||||
if(ch > 0xfff) error(0x8e);
|
||||
if(ch != 127) error(0x8f);
|
||||
}
|
||||
|
||||
struct {
|
||||
char *a;
|
||||
char *b;
|
||||
char *c[3];
|
||||
} flxtv = {
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"five"
|
||||
};
|
||||
char ln[3] = "ab";
|
||||
struct atbh1 { unsigned sevensta:16, sevenstb:4; };
|
||||
struct atbh2 { unsigned a:4, b:4, c:4; };
|
||||
|
||||
last_test()
|
||||
{
|
||||
struct atbh1 x;
|
||||
struct atbh2 y;
|
||||
int i;
|
||||
char c, *cp;
|
||||
|
||||
/* bit field manipulation */
|
||||
x.sevensta = 2;
|
||||
x.sevenstb = 1;
|
||||
if(x.sevensta != 2) error(0x90);
|
||||
if(x.sevenstb != 1) error(0x91);
|
||||
y.a = 3; y.b = 2; y.c = 1;
|
||||
i = (int)y.a;
|
||||
if (i != 3) error(0x92);
|
||||
i = (int)y.b;
|
||||
if (i != 2) error(0x93);
|
||||
i = (int)y.c;
|
||||
if (i != 1) error(0x94);
|
||||
/* character manipulation */
|
||||
i = ln[0] * ln[1];
|
||||
if(i != 9506) error(0x95);
|
||||
cp = ln;
|
||||
c = 0xf4;
|
||||
*cp++ |= (c & 0xf);
|
||||
if(ln[0] != 0x65) error(0x96); /* 'a' | 0x4 */
|
||||
cp = flxtv.c[1];
|
||||
if(*cp != 'f' || *(cp+1) != 'o' || *(cp+2) != 'u' || *(cp+3) != 'r')
|
||||
error(0x97);
|
||||
}
|
||||
|
||||
artl(last_test)
|
||||
int last_test; /* argument with same name as function !!! */
|
||||
{
|
||||
last_test = 4;
|
||||
return(last_test);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
Copyright 1983
|
||||
Alcyon Corporation
|
||||
8716 Production Ave.
|
||||
San Diego, Ca. 92121
|
||||
*/
|
||||
|
||||
char *version = "@(#)test9.c 1.3 12/12/83";
|
||||
|
||||
/*
|
||||
the following code is a battery of tests directed
|
||||
'against' the C compiler. these tests reflect difficulties
|
||||
dicovered in prior compiler releases.
|
||||
|
||||
cr
|
||||
*/
|
||||
|
||||
char array[33000]; /* test for array size > 32k bytes */
|
||||
|
||||
struct {
|
||||
int a;
|
||||
char b[7];
|
||||
long d;
|
||||
} s[5] = { /* test structure array initialization */
|
||||
1, "one", 10,
|
||||
-32768, "two", 010,
|
||||
0, "three", 0x10,
|
||||
32767, "four h", 1000000000,
|
||||
-1, "five", -99999999
|
||||
};
|
||||
|
||||
main() {
|
||||
int i = 100;
|
||||
register int ri = 1000;
|
||||
long l;
|
||||
register long rl;
|
||||
char *p1, *p2;
|
||||
int *pi;
|
||||
|
||||
if ((array[32999] = 'z') == 'z')
|
||||
printf("array[32999] is accessible\n");
|
||||
else
|
||||
printf("can't access array[32999]\n");
|
||||
pi = &array[0];
|
||||
pi += 0x4000L;
|
||||
if (pi != &array[0x8000L]) error(0x1);
|
||||
printf("1 = %d, ", s[0].a);
|
||||
printf("-32768 = %d, ", s[1].a);
|
||||
printf("0 = %d, ", s[2].a);
|
||||
printf("32767 = %d, ", s[3].a);
|
||||
printf("-1 = %d\n", s[4].a);
|
||||
printf("one = [%s], ", s[0].b);
|
||||
printf("two = [%s], ", s[1].b);
|
||||
printf("three = [%s], ", s[2].b);
|
||||
printf("four h = [%s], ", s[3].b);
|
||||
printf("five = [%s]\n", s[4].b);
|
||||
printf("10 decimal = %ld, ", s[0].d);
|
||||
printf("10 octal = %lo, ", s[1].d);
|
||||
printf("10 hex = %lx\n", s[2].d);
|
||||
printf("100000000 = %ld, ", s[3].d);
|
||||
printf("-99999999 = %ld, ", s[4].d);
|
||||
|
||||
l = i * i; /* test assembler code (long=int*int) */
|
||||
rl = i * i; /* ditto */
|
||||
|
||||
rl = i * ri / i; /* test sign extend of 32-bit product */
|
||||
|
||||
i = 4;
|
||||
printf("-4 / i = %d, ",-4/i);
|
||||
printf("-4 / 4 = %d\n",-4/4);
|
||||
|
||||
p1 = 0;
|
||||
p2 = 4;
|
||||
printf("(0-4)ptr - ptr = (long)%ld, ", p1-p2);
|
||||
printf("(0-4)ptr - ptr = (int)%d\n",(int)(p1-p2));
|
||||
}
|
||||
|
||||
error(enum)
|
||||
int enum;
|
||||
{
|
||||
printf("error - %d\n",enum);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user