A to Z of C - Beta (v0.0.12)
|
|||
About | Revision History | History | Known Bugs | Download Problems | HTML Version | Bug Report | Errata | E-group/Mailing List | CD | Links | Contact Us! | Contents | Companion Links | |||
Part I: ANSI C |
About
Revision History
History
Known Bugs
Download Problems
HTML Version
Bug Report
Errata
E-group/Mailing List
CD
Links
Contact Us!
|
Many thanks to all the people who sent us bug reports and loving mails. After some struggle we--the authors are well placed. Now, it's not the money, but the time that affects this project. Anyway, keep on sending mails and bug reports; I'll try to update the book now and then (but please don't expect a personal reply). --R. Rajesh Jeba Anbiah, April 13, 2008 |
Part I: ANSI C | Part II: DOS Programming
Part III: Advanced Graphics Programming | Part IV: Advanced Programming
Part V: Mathematics & C | Part VI: Algorithms & C | Part VII: Illegal Codes | Part VIII: Next Step
Part IX: Smart Dictionary | Part X: Postlude
1. First Chapter
1.1 Acknowledgement
1.2 Book Organization
1.3 FAQ about A to Z of C2. Birth of C
3. Coding Style
3.1 Indian Hill Style
3.2 Hungarian Coding Style
3.3 WAR (Wesley And Rajesh) Coding Style4. ANSI C - Prelude
4.1 Myth & Mistakes
4.2 Tips for better Programming
4.2.1 Coding Style
4.2.2 Boolean Variables
4.2.3 How to code better?5. main( ) and Mistakes
5.1 What main( ) returns?
5.2 Arguments of main( )
5.3 exit( )6. Undefined
6.1 Example
6.2 Frequently Asked Undefined Questions7. The Magic XOR
7.1 Swap Macro
7.2 Flip and Flop
7.3 Crypting with XOR8. String Function
8.1 strlen( )
8.2 strcpy( )
8.3 strcat( )
8.4 strcmp( )9. Recursion
9.1 Factorial
9.2 Fibonacci
9.3 GCD
9.4 Power
9.5 Reverse Printing
9.6 Decimal to binary conversion
9.7 Decimal to hexadecimal conversion
9.8 Printing a decimal in words10. Interesting Programs
10.1 Power of 2
10.2 Prime Numbers
10.3 Roman Letters [convert Arabic numerals to Roman numerals]
10.4 Day of Week
10.5 Calendar
10.6 Memory-Swap
10.7 Block Structure
10.7.1 Swap macro using Block Structure
10.8 Printf with %b11. Program that Outputs the same
11.1 Self-replicating program #1
11.2 Self-replicating program #2
11.3 Self-replicating program #312. Pointers
12.1 Memory Overwrite
12.2 Array/Buffer Overflow
12.3 Memory Leak
12.4 Multidimensional array implementation
12.4.1 Version 1
12.4.2 Version 2
12.4.3 Version 3
12.4.4 Version 4
12.5 Linked List13. Code Obfuscation
13.1 Where to contest?
13.2 Guidelines
13.3 Real Code
13.3.1 Wherami
13.3.2 Note14. DOS Secrets
14.1 Prelude
14.1.1 BIOS
14.1.2 Bootstrap Program
14.1.3 Boot Sector
14.2 Memory Layout
14.2.1 Upper Memory Area (UMA)
14.3 Segment Address
14.4 Extended Memory
14.5 Limitations of DOS15. Traits of Turbo C
15.1 Features of TC++3.0
15.2 Configure your TC++3.0
15.3 IDE basics
15.4 Useful Utilities
15.4.1 BASM
15.4.2 TASM
15.4.3 TLINK
15.4.4 TLIB
15.4.5 MAKE
15.4.6 TCC
15.5 main( )
15.5.1 int main( ) or void main( ) ?
15.6 Preprocessor
15.7 Header file
15.8 Pragma
15.8.1 Example 1
15.8.2 Example 2
15.9 Creating library file
15.10 Creating a project file
15.11 Turbo C keywords
15.12 Bugs & Remedy
15.12.1 system( )
15.12.2 delay( )
15.12.3 Floating point formats not linked
15.12.4 Null pointer assignment16. Mating Assembly with C
16.1 Inline Assembly
16.1.1 Example 1
16.1.2 Example 2
16.1.3 Usual Errors
16.2 Calling Assembly routines from C
16.2.1 C’s calling convention
16.2.2 C’s naming convention
16.2.3 Example 1
16.2.4 Example 2
16.3 Creating library file out of assembly language module17. Processor
17.1 Processors
17.2 Processor Modes
17.2.1 Real Mode
17.2.2 Protected Mode
17.2.3 Virtual Real Mode
17.3 Processor Type
17.3.1 C program to find processor type
17.3.2 Assembly routine to find processor type
17.3.3 Another Assembly routine18. File Format
18.1 Example
19. Interrupt Programming
19.1 Logical outline of interrupt routine
19.2 Interrupt Classification
19.3 Programming with interrupts
19.3.1 Inline Assembly Style
19.3.2 Pure Assembly Style
19.3.3 geninterrupt( ) style
19.3.4 int86( ) style
19.3.5 intr( ) style
19.3.6 Benchmarking
19.4 Myth & Mistakes20. Programming Video RAM
20.1 Memory map
20.2 Programming the video RAM
20.2.1 Color Text Mode
20.2.2 Monochrome Text Mode
20.2.3 Graphics Mode21. Programming Ports
21.1 Why use ports?
21.2 Port vs. memory
21.3 Usual Problems
21.4 Programming ports with Turbo C
21.5 Example22. Programming the keys
22.1 Secrets
22.1.1 Keyboard controller
22.1.2 Keyboard Buffer
22.1.3 Keyboard status
22.1.4 Keyboard Interrupt
22.2 Activating the keys without pressing it!
22.2.1 Stuff keys using BIOS interrupt
22.2.2 Stuff keys using keyboard buffer
22.3 Multiple key Input23. Sound Programming with PC Speaker
23.1 Introduction
23.2 Programming PIT
23.3 Producing Sound
23.4 Notes & Frequencies
23.5 Piano Keys and Frequencies
23.6 Piano Program24. Sound Programming with sound card
24.1 Idea
25. Mouse Programming
25.1 Mouse Interrupts
25.2 Useful Mouse functions
25.2.1 Mouselib.h
25.2.2 Mouselib.c
25.2.3 Mouselib.lib
25.3 Mouse Function 0Ch
25.4 Request Mode or Event Mode?26. Playing with Pointers
26.1 Rebooting with pointers
26.2 Identifying machine model and BIOS date27. TSR Programming
27.1 DOS’s non-reentrancy Problem
27.2 Switching Programs
27.3 DOS Busy Flag
27.4 BIOS Functions
27.5 Popping up TSR
27.6 IBM’s Interrupt-Sharing Protocol
27.7 Rules for TSR Programming
27.8 TSR Template
27.9 PC-PILOT
Source code (with EXE) [zip, 48.9 KB]Part III
Advanced Graphics Programming28. Graphics with BGI
28.1 Common Mistake!
28.2 More Colors
28.3 Jordan Hargraphix Software’s SuperVGA/Tweak BGI drivers
28.4 Jordan Hargraphix Software’s HGXMOUSE TSR29. VB Controls
29.1 Paintbrush
29.1.1 Restricting Mouse Pointer
29.1.2 Hiding/Showing Mouse Pointer
29.1.3 Avoiding Flickering of Mouse Pointer
29.1.4 Using setwritemode( ) function
29.2 Note
Source code (with EXE) [zip, 33.8 KB]30. Scribble [CHR file creator/BGI font file creator]
30.1 Prelude
30.2 Storing Fonts
30.3 Scribble screenshots
30.4 Mouselib.lib
30.4.1 Mouselib.h
30.4.2 Mouselib.c
30.4.3 Mouselib.lib
30.5 Scribble.h
30.6 Scribble.c
30.7 Scribble.prj
Source code (with EXE) [zip, 80.7 KB]31. Creating GIF files
31.1 Important Notice
31.2 GIFSAVE
31.3 Gifsave.h
31.4 Gifsave.c
31.5 Example usage of GIFSAVE32. Mode 13h Programming
32.1 Mode 13h
32.1.1 Palette Register
32.1.2 Vertical Retrace
32.2 Optimization Note33. Reading BMP Files
33.1 Programs
34. Fire
34.1 Extracting Palette
34.1.1 PAL Utility
34.1.2 Using PAL
34.2 Fire Program
Source code (with EXE) [zip, 24.2 KB]35. VESA Programming
35.1 Secrets
35.2 Program36. 3D Graphics
36.1 Perspective Projection
36.2 3D Rectangle37. Fractal
37.1 Prelude
37.2 Program38. Game Programming
38.1 Graphics Mode
38.2 Logic
38.3 Alexander Russell’s Guide39. Interfacing
39.1 Interfacing LCD with parallel port
39.1.1 Circuit Diagrams
39.1.2 Logic
39.1.3 Program40. Embedded Systems
40.1 PROM
40.2 EPROM
40.3 EEPROM
40.4 Programming for Embedded Systems
40.5 Locate utility
40.6 ROMable Code
40.7 Applications41. Writing BIOS
41.1 BIOS Code
41.2 Flash BIOS
41.3 Uniflash
Source code (ASM) [zip, 35.3 KB]42. Programming CMOS RAM
42.1 Viewing contents of CMOS RAM
42.1.1 Logic
42.1.2 Code
42.2 Diagnose CMOS RAM
42.2.1 Logic
42.2.2 Code
Source code [zip, 5.05 KB]43. Device Driver Programming
43.1 Secrets
43.2 Types of MS DOS device drivers
43.2.1 Character device drivers
43.2.2 Block device drivers
43.3 Writing our own device driver
43.4 BUF160
43.4.1 Source code
43.4.2 Compiling BUF160
43.4.3 Installing BUF160
43.5 BGI Driver44. Network Programming
44.1 Novell Netware
44.1.1 Network Library
44.1.2 Example – Toserver.c
44.1.3 Example – Ulist.c
44.2 Windows NT
Note: Adrian Cunnelly, author of Netware C Library has informed us about the new/free/better version. File can be downloaded here. [zip, 507 KB]45. Writing Browser
45.1 TCP/IP Programming
45.1.1 WATTCP
45.2 Programming Browser46. Programming Protocols
46.1 Basic Idea!
46.2 Developing a new Protocol47. Writing Operating System
47.1 EZOS_86
47.1.1 Notes
47.1.2 Kernel Source Code
47.2 Good Luck!
Source code (version 2) [zip, 16.4 KB]48. Developing a new language / writing compiler
48.1 Secrets
48.2 Writing a compiler
48.2.1 Compiler
48.2.2 Compiler Secrets
48.3 Compiler-writing tools
48.3.1 lex
48.3.2 YACC
48.3.3 Creating Compiler with lex & YACC49. Writing YACC
49.1 Prelude
49.2 BYACC
49.2.1 Brief History
49.2.2 Source code
49.2.3 Compiling BYACC50. Developing a Database Package
50.1 Basic Idea
50.2 File format for DBF file
50.3 Security51. Decompilation / EXE to C
51.1 Basic Idea
51.2 DCC
51.2.1 Disclaimer
51.2.2 Notice
51.2.3 DCC Facts
51.2.4 Example of Decompilation52. Writing Disassembler
52.1 Prelude
52.2 Secrets
52.3 2asm
52.3.1 Table.c
52.3.2 Disasm.c
52.3.3 2asm.prj53. Printer Programming
53.1 Types of Printers
53.1.1 Dot Matrix Printers
53.1.2 Inkjet Printers
53.1.3 Laser Printers
53.2 Printer Languages
53.2.1 Page Description Language
53.2.2 Escape Codes
53.3 Printing non-printable characters
53.3.1 Epson Extended Character Set
53.3.2 Graphics Mode
53.3.3 Font Map
53.3.4 Optimization Tip
53.3.5 Program
Source code (with EXE) [zip, 14.7 KB]54. Implementing Math Functions
54.1 Range reduction and Chebychev polynomial approximation
54.2 CORDIC Method55. Differentiation
55.1 Program
56. Integration
56.1 Program
56.2 Numerical Analysis57. PI
57.1 π
57.2 Program58. Easter Day
58.1 Oudin’s Algorithm
58.2 Easter Day Program59. CORDIC
59.1 Birth of CORDIC
59.2 Advantages
59.3 Principle
59.4 Algorithm
59.5 Program60. LZW (Lempel Ziv Welch)
60.1 Brief History
60.2 Principle behind LZW
60.3 LZW Compression
60.3.1 Compression Algorithm
60.3.2 Example
60.4 LZW Decompression
60.4.1 Decompression Algorithm
60.4.2 Example61. Backtracking Algorithms
61.1 Recursive Maze Algorithm
61.2 Maze
61.3 Principle of Maze
61.4 Program62. Overcome BIOS Security
62.1 Bypass System password
62.1.1 Default master password
62.1.2 Hardware techniques (clearing CMOS RAM)
62.2 Bypass Setup password
62.2.1 Default master password
62.2.2 Program63. Cracking Techniques
63.1 Brute force technique
63.2 Dictionary attack64. Cracking ZIP file’s Password
64.1 Cracking ZIP passwords
64.2 CrackIt
64.2.1 Logic
64.2.2 Code65. Network Passwords
65.1 Novell Netware
65.1.1 Fake Prompts
65.1.2 TSR program
65.1.3 Brute force Cracking
65.1.4 Cracking from password file
65.2 Windows NT66. Cracking File Format
66.1 DEBUG
66.2 Finding out Signature
66.3 Algorithms
66.4 Standard Format67. Virus Programming
67.1 Logic
67.2 TSR viruses
67.3 Windows viruses
67.4 Anti-Viruses68. 32-bit Compiler
68.1 16-bit Compiler
68.2 32-bit Compiler (DJGPP)
68.2.1 Allegro69. Descendents of C
69.1 C++
69.2 Java
69.3 C#
69.4 D70. Slang & Jargons
71. Ralf Brown’s Interrupt List 1 of 3, 2 of 3, 3 of 3
71.1 Notations
71.2 Interrupt List
71.2.1 Overview
71.2.2 Listing
71.3 Port listing
71.3.1 Notations
71.3.2 Listing
71.4 Memory map
71.5 Other resources72. File format Collections 1 of 2, 2 of 2
72.1 File Formats Encyclopedia
72.2 ARJ
72.2.1 Glimpse
72.2.2 Official documentation
72.3 BMP
72.4 CHR
72.5 COM
72.6 CUR
72.7 DBF (General Format of .dbf files in Xbase languages)
72.8 EXE
72.8.1 Old EXE format (EXE MZ)
72.8.2 New EXE format (EXE NE)
72.9 GIF
72.10 ICO
72.11 JPEG
72.12 LZH
72.13 MIDI
72.14 PCX
72.15 PIF
72.16 RTF
72.17 SCR
72.18 WAV
72.19 ZIP
72.20 ZOO73. Printer Escape Codes
74. ASCII Table
75. Scan Code
76. Test in C
76.1 ANSI C
76.2 Turbo C / DOS Programming
76.3 Windows77. C Resources
77.1 Magazine
77.2 Books
77.3 Jobs
77.4 Associations
77.5 Websites78. Between You and Me
78.1 Our Education System
78.2 Software Industry
78.2.1 Myths & Facts
78.3 Mother tongue
78.4 Next generation people
78.4.1 Shareware
78.4.2 GPL
78.5 Heal the World79. Last Chapter
79.1 Web page – GuideMe.ITgo.com
79.2 Errata
79.3 Contact Info
79.4 Final GreetingsContents of CD
Index
1. First Chapter
2. Birth of C
- The Development of the C Language — Detailed history by Dr. Dennis M. Ritchie
- Dennis Ritchie Home Page — Official home page of Dr. Dennis M. Ritchie
- Timeline of programming languages
3. Coding Style
Part I
ANSI C4. ANSI C - Prelude
5. main( ) and Mistakes
6. Undefined
7. The Magic XOR
8. String Function
9. Recursion
10. Interesting Programs
11. Program that Outputs the same
- The Quine Page with collection of C quines
- Quine
- Quine generator C source code [12.19 KB] by Arthur J. O'Dwyer
12. Pointers
- Pointers and Memory [31 pages, PDF, 61.6 KB] — From Stanford CS Education Library
- Ted Jensen's Tutorial on Pointers and Arrays in C — Online HTML, PDF and downloadable ZIP versions
- Pointer
- Array
- Buffer overflow
- Memory leak
- Linked list
- The Memory Management Reference
- Memory Management
13. Code Obfuscation
Part II
DOS Programming14. DOS Secrets
- common.zip by Alexander Russell (89 KB) — Very nice programs written in Turbo C. Many codes in A to Z of C were highly impressed by Mr. Alexander Russell's work.
- comp.os.msdos.programmer FAQ
- DOS
- DOS Programming, Undocumented DOS, and DOS Secrets - Mostly assembler
- FAT (File Allocation Table) - FAT16 Structure, FAT32 Structure
- Collection of MS DOS related files at Simtel.net — Via FTP Site:ftp.simtel.net Directory:pub/simtelnet/msdos/
15. Traits of Turbo C
- Turbo C version 2.01 - Free download from Borland (1.1 MB)
- Borland® Turbo C++ Suite (includes Turbo® C++ 3 for MS-DOS®) - buy from Borland $49.99
- Borland — About Borland Software Corporation, the company that developed Turbo C
- Philippe Kahn Bio — Biography of Philippe Kahn, founder of Borland
- Turbo Assembler — Factsheet at Borland. Price $???
- x86 Assembly Language FAQ - Borland TASM
- TASM/BASM — Support page at Borland
- Collection of Turbo C related files at Simtel.net — Via FTP Site:ftp.simtel.net Directory:pub/simtelnet/msdos/turbo_c/
16. Mating Assembly with C
- Using 80x87 assembly called from C — From Borland support page
- The Art of Assembly Language Programming (AoA) — The best book on Assembly language. By Randy Hyde. Online and downloadable PDF versions.
17. Processor
18. File Format
(See #72)
19. Interrupt Programming
- Interrupts and Handlers Part 1 and Part 2 by Frederico Jerónimo. Examples based on DJGGP compiler and NASM assembler.
- Interrupt
20. Programming Video RAM
21. Programming Ports
22. Programming the keys
23. Sound Programming with PC Speaker
24. Sound Programming with sound card
25. Mouse Programming
26. Playing with Pointers
27. TSR Programming
- Terminate and Stay Resident
- The History and Technology of TSR Terminate and Stay Resident software [PDF] by Steve Gibson
- IBM’s Interrupt-Sharing Protocol — Via FTP site:ftp.simtel.net Directory:pub/simtelnet/msdos/info/intshare.zip
Part III
Advanced Graphics Programming28. Graphics with BGI
- BGI drivers and documentations [Links]
- Collection of BGI related tools/files [Links] (Need ARC utility to uncompress. Refer WinZip support page for more details)
- bgi256.zip - BGI Drivers for Borland compilers (269 KB)
- svgabg55.zip - The SuperVGA/Tweak BGI drivers by Jordan Hargraphix Software (Shareware, 198 KB)
29. VB Controls
30. Scribble [CHR file creator/BGI font file creator]
- Collection of BGI related tools/files [Links] (bgifont.arc [79.9 KB] has Borland's own Font Editor for CHR files)
31. Creating GIF files
32. Mode 13h Programming
33. Reading BMP Files
34. Fire
- Fire!.asm — Original assembler version of Adam Hyde [7.6 KB]
35. VESA Programming
- SuperVGA/VESA programmer's notes
- Video Electronics Standards Association — Official VESA web page. Standards, Free standards, Public documents
36. 3D Graphics
37. Fractal
Part IV
Advanced Programming38. Game Programming
- Alex Russell's Dos Game Programming in C for Beginners
- Amit's Game Programming Information — With lots of links to various techniques including AI
39. Interfacing
40. Embedded Systems
41. Writing BIOS
- Flashing the BIOS — How-to
42. Programming CMOS RAM
43. Device Driver Programming
- Device driver
- Device driver writing kit (with ASM templates) — Via FTP Site:ftp.simtel.net Directory:pub/simtelnet/msdos/asmutl/ddkit.zip
44. Network Programming
45. Writing Browser
- WATTCP — Free TCP/IP implementation for DOS
- TCP/IP for MS-DOS — Quick introduction to WATTCP. Has list of tools (few with source codes) written with WATTCP library.
- Watt-32 tcp/ip — Claimed to be an enhanced version of WATTCP
46. Programming Protocols
47. Writing Operating System
48. Developing a new language / writing compiler
- Compilers and Compiler Generators - an introduction with C++ — by Pat Terry. Online edition of origianl book. Permission needed to redistribute
49. Writing YACC
50. Developing a Database Package
51. Decompilation / EXE to C
52. Writing Disassembler
53. Printer Programming
Part V
Mathematics & C54. Implementing Math Functions
55. Differentiation
56. Integration
57. PI
58. Easter Day
Part VI
Algorithms & C59. CORDIC
60. LZW (Lempel Ziv Welch)
61. Backtracking Algorithms
Part VII
Illegal Codes62. Overcome BIOS Security
63. Cracking Techniques
64. Cracking ZIP file’s Password
65. Network Passwords
66. Cracking File Format
67. Virus Programming
Part VIII
Next Step68. 32-bit Compiler
69. Descendents of C
Part IX
Smart Dictionary70. Slang & Jargons
71. Ralf Brown’s Interrupt List
- Ralf Brown's Interrupt List — Should download all the zipped files. Hundreds of information contained in text format. Best way to use the information is through a viewer available there; which needs merging of files. More information is available in the files itself.
- Ralf Brown's Interrupt List Indexed HTML Version — Online with search feature.
72. File format Collections
- ffe200.zip - File Formats Encyclopedia (1.87 MB) — Downloadable, with viewer to search and find.
- Wotsit's Format — The Programmer's File Format Collection
- My File Formats — (Yet Another) The Programmer's File Format Collection
73. Printer Escape Codes
74. ASCII Table
75. Scan Code
Part X
Postlude76. Test in C
77. C Resources
78. Between You and Me
79. Last Chapter
Contents of CD
Index
Launched: August 1, 2003
Last Updated: April 13, 2008
Copyright © 2000-2008 R. Rajesh Jeba Anbiah & K. Joseph Wesley
All Rights Reserved.
3309
.
.