Skip to content

avwohl/learn-ada-z80

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ada Programming Examples for uada80 (Z80/CP/M)

This collection contains Ada example programs designed to teach Ada programming concepts for the uada80 compiler targeting the Z80 processor running CP/M.

Free Ada Learning Resources

Official Resources

Free E-Books and Tutorials

Online Courses

Reference


Example Programs

This collection contains 90+ example programs organized by concept:

01_basics/ - Getting Started

02_types/ - Type System

03_variables/ - Variables and Constants

04_operators/ - Operators

05_control_flow/ - Control Structures

06_arrays/ - Arrays

07_records/ - Records

08_subprograms/ - Procedures and Functions

09_packages/ - Packages

10_exceptions/ - Exception Handling

11_access_types/ - Pointers

12_generics/ - Generic Programming

13_tasking/ - Concurrent Programming

14_attributes/ - Attributes

15_strings/ - String Handling

16_io/ - Input/Output

17_derived_types/ - Type Derivation

18_pragmas/ - Compiler Directives

19_contracts/ - Contract Programming

20_applications/ - Practical Examples


Z80/CP/M Considerations

These examples are designed to work with the uada80 compiler which targets the Z80/CP/M environment:

Memory Constraints

  • ~57K TPA (Transient Program Area) on 64K system
  • Use small, focused examples
  • Avoid large arrays when possible

Integer Sizes

  • Standard Integer is 16-bit (-32768 to 32767)
  • Use range types to constrain values
  • No native 32/64-bit without libraries

No Floating Point Hardware

  • Software floating point available but slow
  • Integer arithmetic preferred
  • Use fixed-point or scaled integers when possible

Tasking

  • Supported via timer interrupts
  • Use protected objects for shared data
  • Keep task count minimal

I/O

  • Console via BDOS function calls
  • File I/O in 128-byte sectors
  • 8.3 filename format

How to Use

  1. Study the examples - Each file demonstrates one concept
  2. Read the comments - Explanations are in the code
  3. Compile and run - Use uada80 to compile
  4. Experiment - Modify examples to learn

Compilation Example

# Compile an example
python -m uada80 hello_world.adb -o hello.com

# Run in CP/M emulator
cpmemu hello.com

Learning Path

Suggested order for beginners:

  1. Basics (01_basics/) - Start here!
  2. Types (02_types/) - Ada's strong typing
  3. Variables (03_variables/) - Data storage
  4. Operators (04_operators/) - Expressions
  5. Control Flow (05_control_flow/) - Logic
  6. Arrays (06_arrays/) - Collections
  7. Records (07_records/) - Structures
  8. Subprograms (08_subprograms/) - Functions
  9. Packages (09_packages/) - Modularity
  10. Exceptions (10_exceptions/) - Error handling
  11. Access Types (11_access_types/) - Pointers
  12. Generics (12_generics/) - Templates
  13. Tasking (13_tasking/) - Concurrency
  14. Applications (20_applications/) - Put it together!

Additional Examples Needed?

These examples cover the core language. Additional topics that could be added:

  • File I/O examples specific to CP/M
  • Hardware interfacing (ports, interrupts)
  • More algorithms (graph, tree operations)
  • Text processing utilities
  • Simple games

Contributing

Feel free to add more examples! Guidelines:

  • One concept per file
  • Extensive comments explaining the concept
  • Keep examples small (Z80 memory constraints)
  • Test with uada80 before submitting

Related Projects

  • 80un - Unpacker for CP/M compression and archive formats (LBR, ARC, squeeze, crunch, CrLZH)
  • cpmdroid - Z80/CP/M emulator for Android with RomWBW HBIOS compatibility and VT100 terminal
  • cpmemu - CP/M 2.2 emulator with Z80/8080 CPU emulation and BDOS/BIOS translation to Unix filesystem
  • ioscpm - Z80/CP/M emulator for iOS and macOS with RomWBW HBIOS compatibility
  • mbasic - Modern MBASIC 5.21 Interpreter & Compilers
  • mbasic2025 - MBASIC 5.21 source code reconstruction - byte-for-byte match with original binary
  • mbasicc - C++ implementation of MBASIC 5.21
  • mbasicc_web - WebAssembly MBASIC 5.21
  • mpm2 - MP/M II multi-user CP/M emulator with SSH terminal access and SFTP file transfer
  • romwbw_emu - Hardware-level Z80 emulator for RomWBW with 512KB ROM + 512KB RAM banking and HBIOS support
  • scelbal - SCELBAL BASIC interpreter - 8008 to 8080 translation
  • uada80 - Ada compiler targeting Z80 processor and CP/M 2.2 operating system
  • uc80 - ANSI C compiler targeting Z80 processor and CP/M 2.2 operating system
  • ucow - Unix/Linux Cowgol to Z80 compiler
  • um80_and_friends - Microsoft MACRO-80 compatible toolchain for Linux: assembler, linker, librarian, disassembler
  • upeepz80 - Universal peephole optimizer for Z80 compilers
  • uplm80 - PL/M-80 compiler targeting Intel 8080 and Zilog Z80 assembly language
  • z80cpmw - Z80 CP/M emulator for Windows (RomWBW)

About

Ada programming examples for the uada80 compiler targeting Z80/CP/M (90+ examples)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages