-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCPUMODE.ASM
More file actions
57 lines (46 loc) · 1.01 KB
/
Copy pathCPUMODE.ASM
File metadata and controls
57 lines (46 loc) · 1.01 KB
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
51
52
53
54
55
56
57
;-*- tab-width: 8 -*-
CHGCPU: equ 0180h
GETCPU: equ 0183h
fname "CPUMODE.BIN"
;======== Bsave Header ==========
db 0FEh
dw start_of_program
dw end_of_program-1
dw start_of_program
;================================
org 0c000h
start_of_program:
;================================
; CPUモードを変更・取得する
; A=USR(n)
; in: n=0 : Z80
; n=1 : R800(ROM)
; n=2 : R(00(RAM) ※起動時にR800出ない場合は暴走
; n=255 : 問い合わせ
; ret: 呼び出し前のCPUモード
;================================
usr_chgcpu:
cp 2 ;整数でなかったら終了
ret nz
; --> 正式な方法 : hl=(hl+2)
; DAC+2から取得する手抜きもアリ
; LD HL,(0F7F8H)
; <--
push hl
pop ix ;(IX+2) = INT VALUE
; GETCPUとCHGCPUが使えるか
ld a,(GETCPU)
or a
jr z,end_chgcpu
ld a,(ix+2) ;get value(low)
cp 4 ;範囲外は現在のモード取得のみ
jr nc,end_chgcpu0
or 80h ;LEDを変化させる
call CHGCPU ;CPUモード変更
end_chgcpu0:
call GETCPU ;現在のCPUモード
end_chgcpu:
ld (ix+2),a
ld (ix+3),0
ret
end_of_program: