4 Devices
These modules provide certain devices used to built an emulated computer system.
4.1 Bus Watcher
| (require ledum/define/bus/watcher) | package: ledum-definers |
This module provides a special device that can be attached to any address range on the bus to watch for writes.
The bus-watcher-dirty? field accessor should be used to determine whether something wrote to given range since the last reset-bus-watcher! call.
procedure
procedure
(reset-bus-watcher! bw) → void?
bw : bus-watcher?
4.2 Memory
| (require ledum/define/memory) | package: ledum-definers |
struct
(struct memory (rw? size word data writer))
rw? : boolean? size : exact-positive-integer? word : exact-positive-integer? data : (vectorof exact-positive-integer?)
writer :
(-> memory? exact-nonnegative-integer? exact-nonnegative-integer? void?)
procedure
(make-ram [ #:size size #:word word #:data data #:file fname #:base base]) → memory? size : (or/c #f exact-positive-integer?) = #f word : (or/c #f exact-positive-integer?) = #f data : (or/c #f bytes?) = #f fname : (or/c #f path-string? path?) = #f base : exact-nonnegative-integer? = 0
If base is specified, the data loaded at given base offset.
procedure
(make-rom [ #:size size #:word word #:data data #:file fname #:base base]) → memory? size : (or/c #f exact-positive-integer?) = #f word : (or/c #f exact-positive-integer?) = #f data : (or/c #f bytes?) = #f fname : (or/c #f path-string? path?) = #f base : exact-nonnegative-integer? = 0
4.3 Video
| (require ledum/define/video) | package: ledum-definers |
A video framebuffer device using an already-attached memory on the same bus with procedures for using it in emulation layer.
4.4 Controller
| (require ledum/define/controller) | package: ledum-definers |
A simple controller device providing arrow keys and four other buttons mapped to keyboard keys "a", "s", "z" and "x".
struct
(struct controller (mask))
mask : exact-nonnegative-integer?
Bit | Mask (hex) | Key |
0 | 1 | up |
1 | 2 | down |
2 | 4 | left |
3 | 8 | right |
4 | 10 | a |
5 | 20 | s |
6 | 40 | z |
7 | 80 | x |
8 | 100 | reserved |
9 | 200 | reserved |
10 | 400 | reserved |
11 | 800 | reserved |
12 | 1000 | reserved |
13 | 2000 | reserved |
14 | 4000 | reserved |
15 | 8000 | reserved |
The with-emulator-window uses the gen:emuctrl on this device to provide actual key press and release event notifications. Based on these events the device updates the internal button press mask and the change is immediately visible from within the emulated system.
procedure
4.5 LGA
| (require ledum/define/lga) | package: ledum-definers |
Ledum Graphics Adapter is a video framebuffer device using already-attached memory on the same bus with procedures for using it in the emulation layer.
struct
(struct lga (width height gap base end start bus dirty?))
width : exact-positive-integer? height : exact-positive-integer? gap : exact-nonnegative-integer? base : exact-nonnegative-integer? end : exact-nonnegative-integer? start : exact-nonnegative-integer? bus : busintf? dirty? : boolean?
0 - R/W upper word of the base address
1 - R/W lower word of the base address
2 - R/W upper word of the end address
3 - R/W lower word of the end address
4 - R/W upper word of the start offset
5 - R/W lower word of the start offset
6 - R/W scanline gap
7 - R width
8 - R height
The dirty? field is set to #t whenever any of the configuration registers is written to. See lga-dirty? and reset-emufb-dirty! for details.
procedure
(make-lga [width height addr]) → videofb?
width : exact-positive-integer? = 640 height : exact-positive-integer? = 480 addr : exact-nonnegative-integer? = 0