-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdiy.asm
50 lines (44 loc) · 1.3 KB
/
diy.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
org 32768
main:
;; Port 0xfe
;; Every even I/O address will address the ULA, but to avoid problems
;; with other I/O devices only Port 0xfe should be used. If this port
;; is written to, bits have the following meaning:
;;
;; Bit 7 6 5 4 3 2 1 0
;; +-------------------------------+
;; | | | | E | M | Border |
;; +-------------------------------+
;;
;; The lowest three bits specify the border colour a zero in bit 3
;; activates the MIC output, whilst a one in bit 4 activates the EAR
;; output and the internal speaker. However, the EAR and MIC sockets
;; are connected only by resistors, so activating one activates the
;; other the EAR is generally used for output as it produces a louder
;; sound. The upper two bits are unused.
ld hl,4000h
loop:
ld c, 8
ld e, 0 ; target byte
bitloop:
in a,(254) ; query state
;; ld a, %01000000
and %01000000
rl a
rl a
rl a
ld b,c
rotloop:
rl a
djnz rotloop
or e
ld e, a ; e |= a
dec c
cp c
jp nz, bitloop
ld (hl), a ; send to screen
inc hl
ld a, h
cp 58h
jp z, main
jp loop