[SharpMZ] ROM kod pro MZ1500
Vaclav Peroutka
vaclavpe na seznam.cz
Středa Červen 22 21:28:43 CEST 2016
Ahoj kluci,
podařilo se mi přichystat ROM kod MZ1500, který je disassemblovaný, částečně
okomentovaný a kompilovatelný pod asxxxx. Je to i kvůli tomu, kdyby chtěl
nÄ›kdo části pouĹľĂt, tak to má pĹ™ipravenĂ©.
Jsou tam bloky, co se od 1Z-013B potaĹľmo 9Z-504M nelišĂ, jinĂ© se lišà vĂce
či méně. Chtělo by to vymyslet něco, jak odlišit stejné funkce a funkce
jiné.
Koukni na to, třeba Tě něco napadne.
Rád bych to nÄ›jak dotáhl do konce, ale prostÄ› mi došly sĂly. Pokud bude
nÄ›kdo pokraÄŤovat v komentářĂch, budu jen rád.
Vašek
------------- daląí část ---------------
HTML pĹ™Ăloha byla odstranÄ›na...
URL: http://mail.ordoz.com/pipermail/sharpmz/attachments/20160622/cd6103c9/attachment-0003.html
------------- daląí část ---------------
\opt\asxxxx\asz80.exe -o 1Z-009B.asm
\opt\asxxxx\aslink.exe -i 1Z-009B 1Z-009B.rel
\opt\hex2bin.exe 1Z-009B.ihx
\opt\asxxxx\asz80.exe -o 9Z-502M.asm
\opt\asxxxx\aslink -i 9Z-502M 9Z-502M.rel
\opt\hex2bin.exe -s e800 9Z-502M.ihx
------------- daląí část ---------------
;
;
; 2016-06-22 - vaclavpe na seznam.cz - pridana spousta komentaru, ROM kod je kompilovatelny pomoci asxxxx
;
; definice globalnich promennych
l0000 .equ 0x0000
l073e .equ 0x073e
l0308 .equ 0x0308
l0a32 .equ 0x0a32
l005b .equ 0x005b
l0fb8 .equ 0x0fb8
l0012 .equ 0x0012
l09de .equ 0x09de
l02be .equ 0x02be
l0009 .equ 0x0009
l0577 .equ 0x0577
l00ad .equ 0x00ad
l001b .equ 0x001b
l0006 .equ 0x0006
l001e .equ 0x001e
l0027 .equ 0x0027
l002a .equ 0x002a
l000c .equ 0x000c
l0003 .equ 0x0003
l0410 .equ 0x0410
l04d8 .equ 0x04d8
l04f8 .equ 0x04f8
l001e .equ 0x001e
l05fa .equ 0x05fa
l03b1 .equ 0x03b1
l0920 .equ 0x0920
l02a6 .equ 0x02a6
l041f .equ 0x041f
l0436 .equ 0x0436
l0475 .equ 0x0475
l0588 .equ 0x0588
l005b .equ 0x005b
l05fa .equ 0x05fa
l0bb9 .equ 0x0bb9
l096c .equ 0x096c
l0da6 .equ 0x0da6
l08ca .equ 0x08ca
l0fb1 .equ 0x0fb1
l0fd8 .equ 0x0fd8
l0ddc .equ 0x0ddc
l003e .equ 0x003e
l0918 .equ 0x0918
.area CODE1 (ABS)
.ORG 0xE800
;***************************************************
;* *
;* Studeny start monitoru *
;* *
;***************************************************
nop ; testovani dole, jestli je ROM nebo RAM
jp le810 ; zumpa vektor
jp leaa7
jp le82f
jp le881
le80d: jp lfa00
le810: ld sp,0x10f0 ; stack pointer
im 1
call l073e ; inicializacni rutina 8255
xor a
ld de,l0000
call l0308 ; inicializace realneho casu
di
call l0a32 ; Otestuje stav klaves SHIFT, CTRL a BREAK
jr nc,le82a
cp 0x20
jp z,l005b
le82a: call le82f
jr le83a
le82f: ld b,0x04 ; je to vypnuti vsech PSG kanalu na obou cipech ?
ld a,0x9f
le833: out (0xe9),a
add a,0x20
djnz le833
ret
le83a: ld a,0x01
ld (0xe003),a ; zakaz piskani od 8253
ld a,0x80
out (0xe8),a
ld b,0xff
ld hl,0x10f1
call l0fd8 ; vynuluje 256B RAM od 0x10F1
ld a,0x16
call l0012 ; znak na CRT - ale jaky ?
ld a,0x71
ld hl,0xd800
call l09de ; vynuluje atributovou VRAM
ld hl,0x038d
ld a,0xc3
ld (0x1038),a
ld (0x1039),hl
ld a,0x04
ld (0x119e),a
call l02be ; zastav hudbu
call l0009
call l0577 ; BEEEEEEEEP
ld a,0x01
ld (0x119d),a
call leaa1
call le881
xor a
out (0xf0),a
jr le88d
le881: ld c,0xf1
xor a
ld b,0x08
le886: out (c),a
add a,0x11
djnz le886
ret
le88d: ld hl,0xe89b
ld de,0xc000
ld bc,0x0030
ldir
jp 0xc000
ld a,0x01
ld b,0x03
le89f: out (0xe5),a
inc a
jr le8ab
le8a4: djnz le89f
out (0xe6),a
jp le8e0
le8ab: push af
push bc
xor a
ld hl,0xd000
ld (hl),a
ld de,0xd001
ld bc,0x1fff
ldir
pop bc
pop af
jr le8a4
le8be: ld c,0xfc
xor a
out (c),a
ld a,0xcf
out (c),a
ld a,0x3f
out (c),a
ld a,0x07
out (c),a
ld c,0xfd
xor a
out (c),a
ld a,0xcf
out (c),a
xor a
out (c),a
ld a,0x07
out (c),a
ret
le8e0: call le8be
ld a,0x01
out (0xf7),a
xor a
out (0xf7),a
ld a,(0xffff)
cp 0xa5
jr z,le8f8
ld de,0x06e7
rst 0x18
jp l00ad
le8f8: call l001b
cp 0x4d
jp z,le96a
cp 0x51
jp z,lea0e
cp 0x43
jp z,le974
call le918
jr nz,le924
le90f: call leaa1
call lf47f
jp lea7b
le918: ld a,0xa5
ld b,a
out (0xd9),a
call lf714
in a,(0xd9)
cp b
ret
le924: ld c,0xf8
call lf82e
jr nc,le933
ld c,0xa8
call lf82e
jp c,lea0e
le933: call lf734
jr nz,le939
jp (hl)
le939: ld de,0xee9a
jp lea7b
call lea8a
le942: call lea56
call lf220
le948: ld a,0x02
call lf1a1
cp 0x7f
jp z,lea0e
ld a,0x04
call lf1a1
cp 0xdf
jp z,le974
cp 0xfb
jp z,le90f
ld a,0x03
call lf1a1
cp 0xf7
jr nz,le948
le96a: call leaa1
ld de,0xeeaf
rst 0x18
jp leaa7
le974: ld hl,0xe002
ld a,(hl)
and 0x10
jr nz,le9a1
inc hl
ld a,0x06
ld (hl),a
inc a
ld (hl),a
dec hl
ld a,(hl)
and 0x10
jr nz,le9a1
call leaa1
call l0006
call l0006
ld de,lede6
call lea95
le997: call l001e
jr z,lea03
ld a,(hl)
and 0x10
jr z,le997
le9a1: call leaa1
call l0006
ld de,lee17
rst 0x18
call l0027
jp c,lea01
call leaa1
ld de,0xedd4
rst 0x18
ld de,0x10f1
rst 0x18
xor a
ld (0x11a3),a
ld hl,(0x1104)
ld a,h
or l
jr nz,le9d9
ld hl,(0x1106)
ld a,h
or l
jr nz,le9d9
ld a,0xff
ld (0x11a3),a
ld hl,0x1200
ld (0x1104),hl
le9d9: call l002a
jp c,lea01
le9df: ld a,(0x11a3)
cp 0xff
jr z,le9ed
ld bc,0x0100
ld hl,(0x1106)
jp (hl)
le9ed: out (0xe0),a
ld hl,0x1200
ld de,l0000
ld bc,(0x1102)
ldir
ld bc,0x0100
jp l0000
lea01: cp 0x02
lea03: ld de,lede6
jr z,lea0b
ld de,0xee5e
lea0b: jp lea7b
lea0e: call lef7a
call lefb5
ld de,0xedf7
jr c,lea7b
call leaa1
ld a,0x0d
ld (0x11a3),a
call lf318
ld a,0x01
ld (0x113a),a
ld hl,0xea54
ld sp,0x10ee
ex (sp),hl
call lef85
jp c,lf2bb
ld a,(0x10f0)
cp 0x01
ld de,0xee85
jr nz,lea4a
ld de,0xedd4
rst 0x18
jp lef24
ld de,0xedf7
lea4a: push de
ld a,0x06
ld (0x1130),a
call le80d
pop de
jr lea7b
lea56: call l0006
ld de,0xed85
call lea95
call l0006
ld de,0xed97
call lea95
ld de,0xeda7
call lea95
ld de,0xedb6
call lea95
ld de,0xedc8
call lea95
ret
lea7b: call leaa1
call l0006
call l0006
call lea95
jp le942
lea8a: call leaa1
ld b,0x03
lea8f: call l0006
djnz lea8f
ret
lea95: ld b,0x0c
lea97: call l000c
djnz lea97
rst 0x18
call l0006
ret
leaa1: ld a,0xc6
call l0ddc
ret
leaa7: call l0009
ld a,0x2a
call l0012
ld de,0x11a3
call l0003
leab5: ld a,(de)
inc de
cp 0x0d
jp z,leaa7
cp 0x4a
jp z,lec4d
cp 0x4c
jp z,leb74
cp 0x46
jr z,leb39
cp 0x42
jp z,leca5
cp 0x23
jp z,leca2
cp 0x50
jp z,leba9
cp 0x4d
jp z,lec1a
cp 0x53
jp z,lec51
cp 0x56
jp z,lec95
cp 0x44
jp z,lecb1
cp 0x51
jr z,leaf7
cp 0x45
jr z,leb1e
jr leab5
leaf7: ld hl,l0000
ld (0x113a),hl
ld a,(de)
cp 0x4c
jp z,lef06
cp 0x53
jp z,lefc1
cp 0x43
jp z,lf1b8
cp 0x46
jp z,lf13e
cp 0x58
jp z,lf231
cp 0x44
jp z,lf087
leb1c: jr leaa7
leb1e: ld c,0xf8
call lf82e
jr nc,leb2c
ld c,0xa8
call lf82e
jr c,leb1c
leb2c: ld a,(de)
cp 0x42
jp z,lf72d
cp 0x53
jp z,lf7be
jr leb1c
leb39: ld a,(de)
cp 0x0d
jr nz,leb1c
call le918
jr nz,leb1c
call lf47f
call l0009
rst 0x18
jr leb1c
leb4c: ld de,0xf433
cp 0x02
jr z,leb56
ld de,0x0147
leb56: call l0009
rst 0x18
jr leb1c
leb5c: ex (sp),hl
pop bc
ld de,0x11a3
call l0003
ld a,(de)
cp 0x1b
jr z,leb1c
jp (hl)
leb6a: ex (sp),iy
pop af
call l0410
jr c,leb1c
jp (iy)
leb74: call l04d8
jr c,leb4c
call l0009
ld de,leefb
rst 0x18
ld de,0x10f1
rst 0x18
xor a
ld (0x11a3),a
ld hl,(0x1104)
ld a,h
or l
jr nz,leba1
ld hl,(0x1106)
ld a,h
or l
jr nz,leba1
ld a,0xff
ld (0x11a3),a
ld hl,0x1200
ld (0x1104),hl
leba1: call l04f8
jr c,leb4c
jp le9df
leba9: ld a,(de)
cp 0x26
jr nz,lebc4
lebae: inc de
ld a,(de)
cp 0x4c
jr z,lebca
cp 0x53
jr z,lebcf
cp 0x43
jr z,lebdf
cp 0x47
jr z,lebd8
cp 0x54
jr z,lebd4
lebc4: call lebf9
lebc7: jp leaa7
lebca: ld de,0x0470
jr lebc4
lebcf: ld de,0x03d5
jr lebc4
lebd4: ld a,0x04
jr lebda
lebd8: ld a,0x02
lebda: call lebe3
jr lebae
lebdf: ld a,0x1d
jr lebda
lebe3: ld c,0x00
ld b,a
call lec0a
ld a,b
out (0xff),a
ld a,0x80
out (0xfe),a
ld c,0x01
call lec0a
xor a
out (0xfe),a
ret
lebf9: push de
push bc
push af
lebfc: ld a,(de)
call lebe3
ld a,(de)
inc de
cp 0x0d
jr nz,lebfc
pop af
pop bc
pop de
ret
lec0a: in a,(0xfe)
and 0x0d
cp c
ret z
call l001e
jr nz,lec0a
ld sp,0x10f0
jr lebc7
lec1a: call leb6a
lec1d: call l05fa
call l03b1
call l0920
call leb5c
call l0410
jr c,lec49
call l02a6
inc de
call l041f
jr c,lec1d
cp (hl)
jr nz,lec1d
inc de
ld a,(de)
cp 0x0d
jr z,lec46
call l041f
jr c,lec1d
ld (hl),a
lec46: inc hl
jr lec1d
lec49: ld h,b
ld l,c
jr lec1d
lec4d: call leb6a
jp (hl)
lec51: call led16
ld hl,0x11a3
ld de,0x10f1
ld bc,0x0011
ldir
call led5c
ld (0x1104),hl
call led61
ld bc,(0x1104)
scf
sbc hl,bc
inc hl
inc hl
ld (0x1102),hl
call led66
ld (0x1106),hl
ld a,0x01
ld (0x10f0),a
call l0436
jp c,leb4c
call l0475
jp c,leb4c
call l0009
ld de,0x0942
rst 0x18
jp leaa7
lec95: call l0588
jp c,leb4c
ld de,0x0942
rst 0x18
jp leaa7
leca2: jp l005b
leca5: ld a,(0x119d)
rra
ccf
rla
ld (0x119d),a
jp leaa7
lecb1: call leb6a
call l02a6
push hl
call l0410
pop de
jr c,led10
lecbe: ex de,hl
lecbf: ld b,0x08
ld c,0x17
call l05fa
lecc6: call l03b1
inc hl
push af
ld a,(0x1171)
add a,c
ld (0x1171),a
pop af
cp 0x20
jr nc,lecd9
ld a,0x2e
lecd9: call l0bb9
call l096c
ld a,(0x1171)
inc c
sub c
ld (0x1171),a
dec c
dec c
dec c
push hl
sbc hl,de
pop hl
jr z,led0d
ld a,0xf8
ld (0xe000),a
nop
ld a,(0xe001)
cp 0xfe
jr nz,led00
call l0da6
led00: djnz lecc6
led02: call l08ca
or a
jr z,led02
call l0a32
jr nz,lecbf
led0d: jp leaa7
led10: ld hl,0x00a0
add hl,de
jr lecbe
led16: call l0009
ld de,0xeec7
rst 0x18
ld de,0x11a3
call l0003
ld a,(de)
cp 0x1b
jr nz,led2d
led28: ld hl,leaa7
ex (sp),hl
ret
led2d: ld b,0x00
ld de,0x11af
ld hl,0x11a3
ld a,(de)
cp 0x0d
jr z,led5a
led3a: cp 0x20
jr nz,led42
inc de
ld a,(de)
jr led3a
led42: cp 0x22
jr z,led4e
led46: ld (hl),a
inc hl
inc b
ld a,0x11
cp b
jr z,led16
led4e: inc de
ld a,(de)
cp 0x22
jr z,led58
cp 0x0d
jr nz,led46
led58: ld a,0x0d
led5a: ld (hl),a
ret
led5c: ld de,0xeed4
jr led69
led61: ld de,leee1
jr led69
led66: ld de,leeee
led69: call l0009
rst 0x18
push de
ld de,0x11a3
call l0003
ld a,(de)
cp 0x1b
pop de
jr z,led28
push de
ld de,0x11af
call l0410
pop de
jr c,led69
ret
;
; tady jsou texty
;
led85: .str 'P'
.byte 0x05
.str 'LEASE PUSH KEY'
.byte 0x05,0x0d
led97: .str 'F:F'
.byte 0x05
.str 'LOPPY DISK'
.byte 0x05,0x0d
leda7: .str 'Q:Q'
.byte 0x05
.str 'UICK DISK'
.byte 0x05,0x0d
ledb6: .str 'C:C'
.byte 0x05
.str 'ASSETTE TAPE'
.byte 0x05,0x0d
ledc8: .str 'M:M'
.byte 0x05
.str 'ONITOR'
.byte 0x05,0x0d
ledd4: .str 'IPL '
.byte 0x05
.str 'IS LOADING'
.byte 0x05,0x20,0x0d
lede6: .byte 'M, 0x05
.str 'AKE READY'
.byte 0x05,0x20, 'C, 'M, 'T, 0x0d
ledf7: .byte 'M, 0x05
.str 'AKE READY'
.byte 0x05,0x20, 'Q, 'D, 0x0d
lee07: .byte 'M, 0x05
.str 'AKE READY'
.byte 0x05,0x20, 'F, 'D, 0x0d
lee17: .str ' IPL '
.byte 0x05
.str 'IS LOOKING FOR A PROGRAM'
.byte 0x05,0x0d
lee3b: .str 'FD:L'
.byte 0x05
.str 'OADING ERROR'
.byte 0x05,0x0d
lee4e: .str 'FD:N'
.byte 0x05
.str 'OT MASTER'
.byte 0x05,0x0d
lee5e: .str 'CMT:L'
.byte 0x05
.str 'OADING ERROR'
.byte 0x05,0x0d
lee72: .str 'QD:L'
.byte 0x05
.str 'OADING ERROR'
.byte 0x05,0x0d
lee85: .str 'QD:F'
.byte 0x05
.str 'ILE MODE ERROR'
.byte 0x05,0x0d
lee9a: .str 'SRAM:C'
.byte 0x05
.str 'HECK SUM ERR'
.byte 0x05,0x0d
leeaf: .str '** MONITOR 9Z-502M **'
.byte 0x0d
leec7: .byte 'F, 0x05
.str 'ILENAME'
.byte 0x05,'?, 0x20, 0x0d
leed4: .byte 'T, 0x05
.str 'OP ADRS'
.byte 0x05,'?, 0x20, 0x0d
leee1: .byte 'E, 0x05
.str 'ND ADRS'
.byte 0x05,'?, 0x20, 0x0d
leeee: .byte 'E, 0x05
.str 'XC ADRS'
.byte 0x05,'?, 0x20, 0x0d
leefb: .byte 'L, 0x05
.str 'OADING'
.byte 0x05, 0x20, 0x0d
lef06: call lef7a
call lefb5
jr c,lef55
call led16
call lf318
ld de,leefb
rst 0x18
lef18: call lef85
lef1b: jr c,lef55
ld a,(0x10f0)
cp 0x01
jr nz,lef18
lef24: ld de,0x10f1
rst 0x18
lef28: ld hl,(0x1106)
ld a,h
or l
jr nz,lef34
ld hl,(0x1108)
ld a,h
or l
lef34: jr nz,lef40
ld a,0xff
ld (0x113b),a
ld hl,0x1200
jr lef43
lef40: ld hl,(0x1106)
lef43: ld (0x1132),hl
ld hl,(0x1104)
ld (0x1134),hl
ld hl,0x0103
ld (0x1130),hl
call le80d
lef55: jp c,lf007
ld a,(0x113b)
cp 0xff
jr z,lef66
ld bc,0x0300
ld hl,(0x1108)
jp (hl)
lef66: out (0xe0),a
ld hl,0x1200
ld de,l0000
ld bc,(0x1104)
ldir
ld bc,0x0300
jp l0000
lef7a: xor a
ld (0x1144),a
ld (0x113f),a
ld (0x1141),a
ret
lef85: ld hl,l0003
ld (0x1130),hl
ld hl,0x10f0
ld (0x1132),hl
ld hl,0x0040
ld (0x1134),hl
lef97: call le80d
ret c
ld a,(0x11a3)
cp 0x0d
ret z
ld hl,0x11a3
ld de,0x10f1
ld b,0x11
lefa9: ld a,(de)
cp (hl)
jr nz,lef97
cp 0x0d
ret z
inc de
inc hl
djnz lefa9
ret
lefb5: xor a
ld (0x1131),a
inc a
ld (0x1130),a
call le80d
ret
lefc1: call lef7a
call lf079
jr c,lf007
call led16
ld a,(0x11a3)
cp 0x0d
jr z,lefc1
ld hl,0x11a3
ld de,0x10f1
ld bc,0x0011
ldir
call led5c
ld (0x1106),hl
call led61
or a
ld bc,(0x1106)
sbc hl,bc
inc hl
ld (0x1104),hl
call led66
ld (0x1108),hl
ld a,0x01
ld (0x10f0),a
call lf037
jr c,lf007
cp 0x28
jr z,lf009
scf
lf007: jr c,lf02a
lf009: ld hl,(0x1106)
lf00c: ld (0x1136),hl
ld hl,0x0404
ld (0x1130),hl
ld hl,0x10f0
ld (0x1132),hl
ld hl,0x0040
ld (0x1134),hl
ld hl,(0x1104)
ld (0x1138),hl
call le80d
lf02a: jp c,lf0c3
lf02d: call l0009
ld de,0xf321
rst 0x18
jp leaa7
lf037: call lf318
ld hl,l0003
ld (0x1130),hl
ld hl,0x11a3
ld (0x1132),hl
ld hl,0x0040
ld (0x1134),hl
xor a
ld (0x113c),a
lf050: ld a,(0x113c)
inc a
cp 0x21
ld (0x113c),a
ld a,0x33
ret nc
call le80d
ccf
ret nc
ld de,0x11a4
ld hl,0x10f1
ld b,0x11
lf069: ld a,(de)
cp (hl)
jr nz,lf050
cp 0x0d
jr z,lf075
inc de
inc hl
djnz lf069
lf075: ld a,0x2a
scf
ret
lf079: ld a,0xff
ld (0x1131),a
ld a,0x01
ld (0x1130),a
call le80d
ret
lf087: call lef7a
call lefb5
jr c,lf0c3
call lf318
ld b,0x00
call l0009
ld de,0xf46c
rst 0x18
ld hl,0xcd90
lf09e: ld (0x1132),hl
ld hl,l0003
ld (0x1130),hl
ld hl,0x0040
ld (0x1134),hl
push bc
call le80d
pop bc
jr c,lf0be
inc b
ld hl,(0x1132)
ld de,l0012
add hl,de
jr lf09e
lf0be: cp 0x28
jr z,lf0c6
scf
lf0c3: jp c,lf155
lf0c6: ld a,0x06
ld (0x1130),a
push bc
call le80d
pop bc
xor a
cp b
jr nc,lf13b
call l0009
ld hl,0xcd90
lf0da: ld a,(hl)
ld de,0xf325
dec a
jr z,lf117
ld de,0xf330
dec a
jr z,lf117
ld de,0xf33b
dec a
jr z,lf117
ld de,0xf346
dec a
jr z,lf117
ld de,0xf351
dec a
jr z,lf117
dec a
jr z,lf114
ld de,0xf35c
dec a
jr z,lf117
dec a
jr z,lf114
dec a
jr z,lf114
ld de,0xf367
dec a
jr z,lf117
ld de,0xf372
dec a
jr z,lf117
lf114: ld de,0xf37d
lf117: rst 0x18
ld a,0x22
call l0012
inc hl
push hl
pop de
rst 0x18
ld a,0x22
call l0012
call l0009
ld de,0x0011
add hl,de
lf12d: call l08ca
or a
jr z,lf12d
call l0a32
jp z,leaa7
djnz lf0da
lf13b: jp lf02d
lf13e: ld de,0xf43c
rst 0x18
call lf15a
call lef7a
call lf079
jr c,lf155
ld a,0x02
ld (0x1130),a
call le80d
lf155: jp c,lf1ef
jr lf13b
lf15a: call l0009
ld de,0xf463
rst 0x18
call lf220
call l0fb1
ld a,0xef
lf169: ld (hl),a
call lf177
jr c,lf174
ld a,(hl)
xor 0xef
jr lf169
lf174: xor a
ld (hl),a
ret
lf177: ld bc,l0006
lf17a: dec bc
ld a,b
or c
ret z
ld a,0x01
call lf1a1
cp 0x7f
scf
ret z
ld a,0x03
call lf1a1
cp 0xfb
jr z,lf199
ld a,0x08
call lf1a1
cp 0x7e
jr nz,lf17a
lf199: xor a
ld (hl),a
ld sp,0x10f0
jp leaa7
lf1a1: push hl
ld hl,0xe000
ld (hl),a
inc hl
lf1a7: ld a,(hl)
push af
push bc
ld b,0x14
lf1ac: call lf71b
djnz lf1ac
pop bc
pop af
cp (hl)
jr nz,lf1a7
pop hl
ret
lf1b8: call lef7a
call lefb5
jr c,lf1ef
call led16
ld a,(0x11a3)
cp 0x0d
jr z,lf1b8
call lf318
ld de,leefb
rst 0x18
call lef85
jr c,lf1ef
ld de,0x10f1
rst 0x18
ld hl,0x1200
ld (0x1132),hl
ld hl,(0x1104)
ld (0x1134),hl
ld hl,0x0103
ld (0x1130),hl
call le80d
lf1ef: jr c,lf212
call l003e
call l0009
ld de,0xf44c
rst 0x18
ld a,0x02
ld (0x113a),a
ld hl,0xf1fb
ld sp,0x10ee
ex (sp),hl
call lf15a
call lf079
jr c,lf212
call lf037
lf212: jp c,lf2bb
cp 0x28
jp nz,lf2bb
ld hl,0x1200
jp lf00c
lf220: ld b,0x0a
lf222: ld hl,0xe000
dec b
ld (hl),b
inc b
inc hl
ld a,(hl)
cp 0xff
jr nz,lf220
djnz lf222
ret
lf231: call l04d8
jr c,lf24e
ld hl,(0x1104)
call l0009
ld de,leefb
rst 0x18
ld de,0x10f1
rst 0x18
ld bc,0x1200
ld (0x1104),bc
call l04f8
lf24e: jp c,leb4c
ld (0x1104),hl
call l003e
lf257: call led16
ld a,(0x11a3)
cp 0x0d
jr z,lf257
ld hl,0x11a3
ld de,0x10f1
ld bc,0x0011
ldir
call l0009
ld de,0xf44c
rst 0x18
ld a,(0x10f0)
cp 0x04
jr z,lf280
cp 0x05
jr nz,lf284
dec a
dec a
lf280: dec a
ld (0x10f0),a
lf284: ld a,0x02
ld (0x113a),a
ld hl,lf284
ld sp,0x10ee
ex (sp),hl
call lf15a
ld hl,0x112e
ld de,0x1130
ld bc,0x002d
lddr
ld hl,l0000
ld (0x1102),hl
call lef7a
call lf079
jr c,lf2af
call lf037
lf2af: jr c,lf2bb
cp 0x28
jr nz,lf2bb
ld hl,0x1200
jp lf00c
lf2bb: ld de,0xf388
cp 0x28
jr z,lf2fd
ld de,0xf421
cp 0x39
jr z,lf2fd
ld de,0xf3d6
cp 0x2e
jr z,lf2fd
ld de,0xf3e9
cp 0x32
jr z,lf2fd
ld de,0xf3f8
cp 0x35
jr z,lf2fd
ld de,0xf40f
cp 0x36
jr z,lf2fd
ld de,0xf3c2
cp 0x2a
jr z,lf2fd
ld de,lf39c
cp 0x33
jr z,lf2fd
ld de,0xf433
cp 0x00
jr z,lf2fd
ld de,0xf3b4
;
; Vypni motor a skoc do monitoru
;
QERMF:
lf2fd: ld a,0x06
ld (0x1130),a
call le80d
call lf318
ld a,(0x113a)
rra
ret c
push af
call l0009
rst 0x18
pop af
rra
ret c
jp leaa7
;
; Nastavi ukazatel souboru na zacatek disku
;
HDPCL:
lf318: ld a,0x05
ld (0x1130),a
call le80d
ret
.str 'OK!'
.byte 0x0d
;
; tabulka typu programu
;
TYPP: .str ' OBJ '
.byte 0x0d
.str ' BTX '
.byte 0x0d
.str ' BSD '
.byte 0x0d
.str ' BRD '
.byte 0x0d
.str ' RB '
.byte 0x0d
.str ' LIB '
.byte 0x0d
.str ' SYS '
.byte 0x0d
.str ' GR '
.byte 0x0d
.str ' ??? '
.byte 0x0d
;
; retezce textu
;
.str 'QD:F'
.byte 0x05
.str 'ILE NOT FOUND'
.byte 0x05,0x0d
lf39c: .str 'QD:T'
.byte 0x05
.str 'OO MANY FILES ERR'
.byte 0x05,0x0d
.str 'QD:H'
.byte 0x05
.str 'ARD ERR'
.byte 0x05,0x0d
.str 'A'
.byte 0x05
.str 'LREADY EXIST ERR'
.byte 0x05,0x0d
.str 'QD:W'
.byte 0x05
.str 'RITE PROTECT'
.byte 0x05,0x0d
.str 'QD:N'
.byte 0x05
.str 'OT READY'
.byte 0x05,0x0d
.str 'QD:N'
.byte 0x05
.str 'O FILE SPACE ERR'
.byte 0x05,0x0d
.str 'QD:U'
.byte 0x05
.str 'NFORMAT ERR'
.byte 0x05,0x0d
.str 'QD:B'
.byte 0x05
.str 'AD DISK ERR'
.byte 0x05,0x0d
.str 'B'
.byte 0x05
.str 'REAK'
.byte 0x05,0x21,0x0d
.str 'QD:F'
.byte 0x05
.str 'ORMATTING'
.byte 0x05,0x0d
.str 'S'
.byte 0x05
.str 'ET DESTINATION DISK'
.byte 0x05,0x0d
.str 'OK?(Y/N)'
.byte 0x0d
.str 'D'
.byte 0x05
.str 'IRECTORY OF'
.byte 0x05
.str ' QD:'
.byte 0x0d
;******************************************************
;* *
;* F L O P P Y D I S K *
;* *
;******************************************************
;*
;* Vetsina podprogramu pouziva chybovy navrat,
;* pro tento pripad je potreba nastavit navratovou
;* adresu do FDARET a uvedomit si, ze se zmeni SP.
;*
;
; Precteni programu z FD a spusteni.
; Program muze predat rizeni zpet instrukci RET.
; Jmeno programu musi zacinat IPLPRO, jinak se provadi
; chybovy navrat FDERR1. Na obrazovku se vypisuje
; jen zbytek jmena.
;
; nici: vsechno
;
FDBOOT:
lf47f: ex (SP),HL
ld (0xcefe),hl
call le918
jp nz,lf51b
ld de,0xcee9
ld hl,0xf532
ld bc,0x000b
ldir
call lf591
ld ix,0xcee9
call lf608
ld hl,0xcf00
ld de,0xf52b
ld b,0x07
lf4a6: ld c,(hl)
ld a,(de)
cp c
jp nz,lf50f
inc hl
inc de
djnz lf4a6
ld de,0xedd4
rst 0x18
ld de,0xcf07
rst 0x18
ld hl,(0xcf16)
ld a,h
or l
jr nz,lf4c6
ld hl,(0xcf18)
ld a,h
or l
jr z,lf4cc
lf4c6: xor a
lf4c7: ld hl,(0xcf16)
jr lf4d1
lf4cc: ld a,0xff
ld hl,0x1200
lf4d1: ld (0xcefd),a
ld 0x05(ix),l
ld 0x06(ix),h
ld hl,(0xcf14)
ld 0x03(ix),l
ld 0x04(ix),h
ld hl,(0xcf1e)
ld 0x01(ix),l
ld 0x02(ix),h
call lf608
call lf591
ld a,(0xcefd)
cp 0xff
jr nz,lf508
out (0xe0),a
ld hl,0x1200
ld de,(0xcf16)
ld bc,(0xcf14)
ldir
lf508: ld hl,(0xcf18)
ld bc,0x0200
jp (hl)
FDERR1:
lf50f: call lf591
ld de,0xee4e
jr lf523
FDERR3:
lf517: cp 0x32
jr nz,lf520
FDERR0:
lf51b: ld de,0xee07
jr lf523
lf520: ld de,lee3b
lf523: ld sp,0x10ee
ld hl,(0xcefe)
ex (sp),hl
ret
inc bc
ld c,c
ld d,b
ld c,h
ld d,b
ld d,d
ld c,a
nop
nop
nop
nop
ld bc,0xcf00
nop
nop
nop
nop
lf53d: ld a,(0xcef5)
rrca
call nc,lf578
ld a,0x00(ix)
or 0x84
out (0xdc),a
xor a
ld (0xcef4),a
call lf722
ld hl,l0000
lf555: dec hl
ld a,h
or l
jr z,lf573
in a,(0xd8)
cpl
rlca
jr c,lf555
ld c,0x00(ix)
ld hl,0xcef6
ld b,0x00
add hl,bc
bit 0,(hl)
jr nz,lf572
call lf5a9
set 0,(hl)
lf572: ret
lf573: ld a,0x32
jp lf6f1
lf578: ld a,0x80
out (0xdc),a
ld b,0x10
lf57e: call lf722
djnz lf57e
ld a,0x01
ld (0xcef5),a
ret
lf589: ld a,0x1b
call lf5b6
and 0x99
ret
lf591: push af
call lf71b
xor a
out (0xdc),a
ld (0xcef6),a
ld (0xcef7),a
ld (0xcef8),a
ld (0xcef9),a
ld (0xcef5),a
pop af
ret
lf5a9: ld a,0x0b
call lf5b6
and 0x85
xor 0x04
ret z
jp lf6c2
lf5b6: ld (0xcef4),a
cpl
out (0xd8),a
call lf5c9
call lf722
in a,(0xd8)
cpl
ld (0xcefb),a
ret
lf5c9: push de
push hl
call lf602
lf5ce: ld hl,l0000
lf5d1: dec hl
ld a,h
or l
jr z,lf5de
in a,(0xd8)
rrca
jr nc,lf5d1
pop hl
pop de
ret
lf5de: dec e
jr nz,lf5ce
lf5e1: ld a,0x29
pop hl
pop de
jp lf6f1
lf5e8: push de
push hl
call lf602
lf5ed: ld hl,l0000
lf5f0: dec hl
ld a,h
or l
jr z,lf5fd
in a,(0xd8)
rrca
jr c,lf5f0
pop hl
pop de
ret
lf5fd: dec e
jr nz,lf5ed
jr lf5e1
lf602: call lf714
ld e,0x07
ret
lf608: call lf6f7
call lf65c
lf60e: call lf67c
call lf589
jp nz,lf6f1
call lf68c
di
ld a,0x94
call lf6af
lf620: ld b,0x00
lf622: in a,(0xd8)
rrca
jr c,lf641
rrca
jr c,lf622
ini
jr nz,lf622
inc 0x08(ix)
ld a,0x08(ix)
cp 0x11
jr z,lf63d
dec d
jr nz,lf620
jr lf63e
lf63d: dec d
lf63e: call lf6b9
lf641: ei
in a,(0xd8)
cpl
ld (0xcefb),a
and 0xff
jr nz,lf6c2
call lf69d
jp z,lf657
ld a,0x07(ix)
jr lf60e
lf657: ld a,0x80
out (0xdc),a
ret
lf65c: call lf53d
ld d,0x04(ix)
ld a,0x03(ix)
or a
jr z,lf669
inc d
lf669: ld a,0x0a(ix)
ld 0x08(ix),a
ld a,0x09(ix)
ld 0x07(ix),a
ld l,0x05(ix)
ld h,0x06(ix)
ret
lf67c: srl a
cpl
out (0xdb),a
jr nc,lf687
ld a,0x01
jr lf688
lf687: xor a
lf688: cpl
out (0xdd),a
ret
lf68c: ld c,0xdb
ld a,7(ix)
srl a
cpl
out (0xd9),a
ld a,8(ix)
cpl
out (0xda),a
ret
lf69d: ld a,8(ix)
cp 0x11
jr nz,lf6ac
ld a,0x01
ld 8(ix),a
inc 7(ix)
lf6ac: ld a,d
or a
ret
lf6af: ld (0xcef4),a
cpl
out (0xd8),a
call lf5e8
ret
lf6b9: ld a,0xd8
cpl
out (0xd8),a
call lf5c9
ret
lf6c2: ld a,(0xcef4)
cp 0x0b
jr z,lf6e4
cp 0x1b
jr z,lf6e4
cp 0xf4
jr z,lf6e4
ld a,(0xcefb)
bit 7,a
jr nz,lf6ef
bit 6,a
jr nz,lf6eb
bit 4,a
ld a,0x36
jr nz,lf6f1
jr lf6eb
lf6e4: ld a,(0xcefb)
bit 7,a
jr nz,lf6ef
lf6eb: ld a,0x29
jr lf6f1
lf6ef: ld a,0x32
lf6f1: call lf591
jp lf517
lf6f7: ld b,0x00
ld de,0x0010
ld l,1(ix)
ld h,2(ix)
xor a
lf703: sbc hl,de
jr c,lf70a
inc b
jr lf703
lf70a: add hl,de
ld h,b
inc l
ld 0x09(ix),h
ld 0x0a(ix),l
ret
lf714: push de
ld de,0x000f
jp lf726
lf71b: push de
ld de,0x00a0
jp lf726
lf722: push de
ld de,0x2026
lf726: dec de
ld a,e
or d
jr nz,lf726
pop de
ret
lf72d: call lf734
jp nz,leb4c
jp (hl)
lf734: call lf7a2
jr nz,lf781
in a,(c)
inc c
in a,(c)
ld e,a
in a,(c)
ld d,a
ld (0x110a),de
in a,(c)
ld l,a
in a,(c)
ld h,a
in a,(c)
ld e,a
in a,(c)
ld d,a
push de
in a,(c)
ld e,a
in a,(c)
ld d,a
ld (0x110c),de
ld de,(0x110a)
in a,(c)
push hl
ld a,e
or a
jr z,lf76b
ld b,a
lf769: inir
lf76b: ld b,0x00
dec d
jp p,lf769
pop de
ld bc,(0x110a)
call lf782
ld de,(0x110c)
or a
sbc hl,de
pop hl
lf781: ret
lf782: push bc
push de
exx
ld hl,l0000
ld c,0x08
exx
lf78b: ld a,b
or c
jr z,lf79e
ld a,(de)
exx
ld b,c
lf792: rlca
jr nc,lf796
inc hl
lf796: djnz lf792
exx
inc de
dec bc
jp lf78b
lf79e: exx
pop de
pop bc
ret
lf7a2: in a,(c)
ld b,0x08
ld d,0x00
inc c
lf7a9: in a,(c)
push bc
ld b,0x08
lf7ae: rlca
jr nc,lf7b2
inc d
lf7b2: djnz lf7ae
ld a,d
pop bc
ld d,a
djnz lf7a9
in a,(c)
dec c
cp d
ret
lf7be: ld de,0xf863
call lf857
ld de,0xf87a
call lf85a
call l0027
jp c,leb4c
ld de,leefb
call lf85e
ld de,0x10f1
rst 0x18
call l002a
jp c,leb4c
in a,(c)
ld (0x110a),bc
ld de,(0x1104)
ld bc,(0x1102)
push de
push bc
call lf782
ld (0x1108),hl
ld hl,0x1102
ld bc,(0x110a)
ld b,0x08
inc c
inc c
push hl
push bc
otir
pop bc
pop hl
push de
ld d,0x00
lf80a: push bc
ld b,0x08
ld a,(hl)
lf80e: rlca
jr nc,lf812
inc d
lf812: djnz lf80e
inc hl
pop bc
djnz lf80a
ld a,d
pop de
out (c),a
pop de
pop hl
ld a,e
or a
jr z,lf825
ld b,e
lf823: otir
lf825: ld b,0x00
dec d
jp p,lf823
jp leaa7
lf82e: xor a
in a,(c)
inc c
in a,(c)
ex af,af'
dec c
in a,(c)
ld a,0xa5
inc c
inc c
out (c),a
dec c
dec c
in a,(c)
inc c
in a,(c)
cp 0xa5
jr nz,lf854
dec c
in a,(c)
ex af,af'
inc c
inc c
out (c),a
dec c
dec c
ret
lf854: xor a
scf
ret
lf857: call l0918
lf85a: rst 0x18
jp l0918
lf85e: call l0918
rst 0x18
ret
.byte 'R, 0x05
.str 'AMBOARD PROGRAMMING'
.byte 0x05, 0x0d
.byte 'M, 0x05
.str 'ASTER TAPE SET'
.byte 0x05, 0x0d
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff
;**********************************************************
;* *
;* Q U I C K D I S K *
;* ridici podprogramy *
;* *
;**********************************************************
;*
; QUICK-disk je vnejsi pamet s obrovskou kapacitou
; a skvelou rychlosti. Ma 65536 sektoru, precteni
; celeho disku trva pouhych 8 sekund. Pri sekvencnim
; pristupu ! To jsou parametry velkych disku.
; Oproti tvrdym diskum ma podstatne mensi rozmery
; a nepotrebuje ke svemu rizeni slozity radic.
; Staci mu jen jeden jediny I/O obvod s oznacenim SIO.
; To je ale mozne jen proto, protoze velikost sektoru
; je prave jeden byte.
; Nepredpokladame, ze by se kdokoliv, kdo by byl
; schopnen precist tento text a porozumet mu, ocitl
; v pokuseni si takovy nesmysl zakoupit a proto se
; QUICK-disku venujeme opravdu jen strucne.
; (Mimochodem nazev teto periferie je s nejvetsi
; pravdepodobnosti odvozen od zvuku, ktery vyda clovek
; prave seznameny s technickymi parametry a zpusobem
; rizeni tohoto maleho zazraku).
;
;
; Jediny vykonny podprogram QD: jeho funkce
; zavisi na promenne QDCMD:
; 1 ... kontrola pripravenosti disku
; 2 ... formatovani disku
; 3 ... cteni dat z disku
; 4 ... zapis dat na disk
; 5 ... cteci hlavu na zacatek disku
; 6 ... vypnuti QD:
;
QDISK:
lfa00: ld a,0x05
ld (0x1145),a
lfa05: di
call lfa54
ei
ret nc
push af
cp 0x28
jr z,lfa52
call lfccf
ld a,(0x1130)
cp 0x04
jr nz,lfa37
ld a,(0x1141)
or a
jr z,lfa37
xor a
ld (0x1141),a
ld a,(0x1142)
push hl
ld (0x1148),sp
pop hl
di
call lfc4f
ei
jr c,lfa4c
call lfccf
lfa37: pop af
push af
cp 0x29
jr nz,lfa4c
ld hl,0x1145
dec (hl)
jr z,lfa4c
pop af
ld a,(0x1140)
ld (0x113f),a
jr lfa05
lfa4c: call lfbc1
call lfa6d
lfa52: pop af
ret
;
; Vykona cast podprogramu QDISK
;
QMEIN:
lfa54: ld (0x1148),sp
ld a,(0x1130)
dec a
jr z,lfa74
dec a
jr z,lfa7a
dec a
jr z,lfac4
dec a
jp z,lfb34
dec a
jr z,lfa6d
jr lfabd
;
; Vynuluje pocitadlo souboru
;
QDHPC:
lfa6d: push af
xor a
ld (0x113d),a
pop af
ret
;
; Zjisti, je-li disk pripraven
;
QDRCK:
lfa74: ld a,(0x1131)
jp lfc23
;
; Naformatuje disk
;
QDFM:
lfa7a: xor a
call lfc4f
call lfd4d
ld bc,0xefff
ld a,0xaa
lfa86: cpl
ld d,a
call lfdc4
dec bc
ld a,b
or c
jr z,lfa93
ld a,d
jr lfa86
lfa93: call lfd9a
call lfccf
call lfc82
ld a,(0x1143)
dec a
jr nz,lfac0
call lfce4
ld bc,0xefff
ld e,0x55
lfaaa: cp e
jr nz,lfac0
dec bc
ld a,b
or c
jr z,lfaba
ld a,e
cpl
ld e,a
call lfdda
jr lfaaa
lfaba: call lfdac
lfabd: jp lfccf
lfac0: ld a,0x29
scf
ret
;
; Precte data z QD:
; Zavadeci adresu ma v QDBEG1, max. delku v QDSIZ1
; Skutecna delka je jako prvni slovo na disku
;
QDRD:
lfac4: ld a,(0x1144)
or a
call z,lfc82
call lfafa
ret c
call lfe1f
call lfdda
ld c,a
call lfdda
ld b,a
ld hl,(0x1134)
sbc hl,bc
jp c,lfbcb
ld hl,(0x1132)
;
; Zavede blok delky BC od adresy HL z QD:
;
BDR:
lfae5: call lfdda
ld (hl),a
inc hl
dec bc
ld a,b
or c
jr nz,lfae5
call lfdac
ld a,(0x1131)
bit 0,a
jr nz,lfabd
ret
;
; Hleda soubor, jehoz cislo je v HDPT
;
HPS:
lfafa: ld hl,0x1143
dec (hl)
jr z,lfb30
call lfce4
ld c,a
ld a,(0x113d)
ld hl,0x113e
cp (hl)
jr nz,lfb2d
inc a
ld (0x113d),a
ld (hl),a
ld a,(0x1131)
xor c
rra
ret nc
lfb18: call lfdda
ld c,a
call lfdda
ld b,a
lfb20: call lfdda
dec bc
ld a,b
or c
jr nz,lfb20
call lfdac
jr lfafa
lfb2d: inc (hl)
jr lfb18
lfb30: ld a,0x28
scf
ret
;
; Zapis dat na QD: parametry jako QDRD
;
QDWR:
lfb34: ld a,(0x113f)
ld (0x1140),a
ld a,(0x1144)
or a
jr nz,lfb57
call lfc82
ld a,(0x113f)
ld hl,0x1143
add a,(hl)
ld (0x1143),a
inc a
ld (0x113d),a
call lfafa
jp nc,lfbcb
lfb57: ld a,(0x1131)
ld b,a
and 0x01
jr nz,lfb6b
ld de,0x1132
ld a,b
res 2,a
call lfbd4
call lfe1f
lfb6b: ld de,0x1136
ld a,(0x1131)
set 0,a
call lfbd4
call lfccf
call lfe1f
ld a,(0x1131)
and 0x04
jr z,lfbcf
ld a,(0x1142)
ld hl,0x113f
add a,(hl)
call lfc4f
ld a,0x01
ld (0x1141),a
lfb92: ld a,(0x1142)
ld hl,0x1140
add a,(hl)
inc a
ld (0x1143),a
inc a
ld (0x113d),a
call lfafa
jr nc,lfbcb
ld a,(0x1131)
and 0x01
jr nz,lfbb4
ld de,0x1132
call lfc02
ret c
lfbb4: ld de,0x1136
call lfc02
ret c
ld a,(0x1141)
or a
jr z,lfbc8
;
; Nulovani diskovych parametru a vypnuti motoru
;
WRCAN:
lfbc1: xor a
ld (0x113f),a
ld (0x1141),a
lfbc8: jp lfccf
lfbcb: ld a,0x29
scf
ret
lfbcf: call lfc82
jr lfb92
;
; Zapis dat delky BC od adresy HL
;
BDW:
lfbd4: push af
ld hl,0x113f
inc (hl)
call lfd4d
pop af
call lfdc4
call lfbf8
ld a,c
call lfdc4
ld a,b
call lfdc4
lfbeb: ld a,(hl)
call lfdc4
inc hl
dec bc
ld a,b
or c
jr nz,lfbeb
jp lfd9a
;
; HL <== (DE)
; BC <== (DE+2)
; DE <== DE+3
;
RSET:
lfbf8: ex de,hl
ld e,(hl)
inc hl
ld d,(hl)
inc hl
ld c,(hl)
inc hl
ld b,(hl)
ex de,hl
ret
;
; Verfikace BC bytu od adresy HL
;
lfc02: call lfce4
call lfbf8
call lfdda
cp c
jr nz,lfbcb
call lfdda
cp b
jr nz,lfbcb
lfc14: call lfdda
cp (hl)
jr nz,lfbcb
inc hl
dec bc
ld a,b
or c
jr nz,lfc14
jp lfdac
;*******************************************************
; *
; Fyzicky driver Quick-Disk *
; *
;*******************************************************
;
; Zjisti, je-li QD: pripraven cist nebo zapisovat
; A = 0 ... pro cteni
; A = 1 ... pro zapis
;
QREDY:
lfc23: ld b,a
ld a,0x02
out (0xf7),a
ld a,0x81
out (0xf7),a
ld a,0x02
out (0xf7),a
in a,(0xf7)
and 0x81
cp 0x81
jp nz,lfdf0
ld a,0x10
out (0xf6),a
in a,(0xf6)
ld c,a
and 0x08
jp z,lfdf0
ld a,b
or a
ret z
ld a,c
and 0x20
ret nz
jp lfded
;
; Zapis synchronizacni znacky z A reg
;
QDSVF:
lfc4f: push af
ld hl,0xfe16
ld b,0x09
call lfcbf
lfc58: ld a,0x10
out (0xf6),a
in a,(0xf6)
and 0x08
jp z,lfdf0
ld a,0x10
out (0xf7),a
in a,(0xf7)
and 0x08
jr z,lfc58
ld bc,0x00e9
call lfdfe
call lfd82
call lfd66
pop af
call lfdc4
call lfd9a
jr lfcb5
;
; Zapne motor, precte cislo souboru a CRC
;
MTON:
lfc82: ld hl,0xfe0b
ld b,0x0b
call lfcbf
lfc8a: ld a,0x10
out (0xf6),a
in a,(0xf6)
and 0x08
jp z,lfdf0
call lfe1f
ld a,0x10
out (0xf7),a
in a,(0xf7)
and 0x08
jr z,lfc8a
ld bc,0x00e9
call lfdfe
call lfcfa
ld (0x1142),a
inc a
ld (0x1143),a
call lfdac
lfcb5: ld hl,0x1147
set 3,(hl)
xor a
ld (0x113e),a
ret
;
; Inicializace SIO
; posle B bytu od adresy HL na SIO
;
SIOIN:
lfcbf: ld c,0xf6
otir
ld a,0x05
ld (0x1144),a
out (0xf7),a
ld a,0x80
out (0xf7),a
ret
;
; Vypne motor QD:
;
MTOFF:
lfccf: push af
ld a,0x05
out (0xf6),a
ld a,0x60
out (0xf6),a
ld a,0x05
out (0xf7),a
xor a
ld (0x1144),a
out (0xf7),a
pop af
ret
;
; Precte synchronizacni znacku
;
SYNL2:
lfce4: ld a,0x58
ld b,0x0b
ld hl,0xfe0b
call lfd8b
ld hl,0x1147
bit 3,(hl)
ld bc,l0003
jr z,lfcfd
res 3,(hl)
lfcfa: ld bc,0x00a0
lfcfd: call lfdfe
ld a,0x05
out (0xf7),a
ld a,0x82
out (0xf7),a
ld a,0x03
out (0xf6),a
ld a,0xd3
out (0xf6),a
ld bc,0x2cc0
lfd13: ld a,0x10
out (0xf6),a
in a,(0xf6)
and 0x10
jr z,lfd25
dec bc
ld a,b
or c
jr nz,lfd13
jp lfdf6
lfd25: ld a,0x03
out (0xf6),a
ld a,0xc3
out (0xf6),a
ld b,0x9f
lfd2f: ld a,0x10
out (0xf6),a
in a,(0xf6)
and 0x01
jr nz,lfd3f
dec b
jr nz,lfd2f
jp lfdf6
lfd3f: ld a,0x03
out (0xf6),a
ld a,0xc9
out (0xf6),a
call lfdda
jp lfdda
;
; Zapis synchronizacni znacky
;
SYNS2:
lfd4d: ld a,0x98
ld b,0x09
ld hl,0xfe16
call lfd8b
call lfd82
ld hl,0x1147
bit 3,(hl)
ld bc,0x001d
jr z,lfd69
res 3,(hl)
lfd66: ld bc,0x0140
lfd69: call lfdfe
ld a,0x05
out (0xf6),a
ld a,0xef
out (0xf6),a
ld bc,0x0001
call lfdfe
ld a,0xc0
out (0xf6),a
ld a,0xa5
jr lfdc4
;
; Zastav QD:
;
SBRK:
lfd82: ld a,0x05
out (0xf6),a
ld a,0xff
out (0xf6),a
ret
;
SYNCA:
lfd8b: ld c,0xf6
out (c),a
ld a,0x05
out (0xf7),a
ld a,0x80
out (0xf7),a
otir
ret
;
; Zapise koncovy zaznam souboru, ulozi CRC
;
EOMSG:
lfd9a: ld bc,0x0001
call lfdfe
ld a,0x10
out (0xf7),a
in a,(0xf7)
and 0x08
ret nz
jp lfdf3
;
; Precte CRC a zkontroluje ho
;
QDCRC:
lfdac: ld b,0x03
lfdae: call lfdda
djnz lfdae
lfdb3: in a,(0xf6)
rrca
jr nc,lfdb3
ld a,0x01
out (0xf6),a
in a,(0xf6)
and 0x40
jr nz,lfdea
or a
ret
;
; Zapise byte z A na QD:
;
QWBYT:
lfdc4: push af
lfdc5: in a,(0xf6)
and 0x04
jr z,lfdc5
pop af
out (0xf4),a
lfdce: ld a,0x10
out (0xf6),a
in a,(0xf6)
and 0x08
jp z,lfdf0
ret
;
; Precte byte z QD: do A
;
QRBYT:
lfdda: call lfdce
in a,(0xf6)
rlca
jr c,lfdea
rrca
rrca
jr nc,lfdda
in a,(0xf4)
or a
ret
; tabulka chyb QD, obnovi se hodnota SP a jdeme pryc
lfdea: ld a,0x29
.byte 0x21
lfded: ld a,0x2e
.byte 0x21
lfdf0: ld a,0x32
.byte 0x21
lfdf3: ld a,0x35
.byte 0x21
lfdf6: ld a,0x36
ld sp,(0x1148)
scf
ret
;
; Cekaci smycka, v zavislosti na BC
;
; BC = 001H = 0.7 ms
; 003H = 2 ms
; 01DH = 20 ms
; 0A0H = 110 ms
; 0E9H = 160 ms
; 140H = 220 ms
;
L944BC:
lfdfe: push af
lfdff: ld a,0x98
lfe01: dec a
jr nz,lfe01
dec bc
ld a,b
or c
jr nz,lfdff
pop af
ret
;
; Inicializacni tabulky SIO
;
SIOLD: .byte 0x58,4,0x10,5,4,3,0xD0,6,0x16,7,0x16
SIOSD: .byte 0x98,4,0x10,6,0x16,7,0x16,5,0x6D
;
; Otestuje, je-li stisknuta klavesa SHIFT + BREAK.
; Pokud ano, vypne se motor a vraci se s kodem
; chyby 0
;
BRKC:
lfe1f: ld a,0xe8
ld (0xe000),a
nop
ld a,(0xe001)
and 0x81
ret nz
call lfbc1
ld sp,(0x1148)
scf
ret
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.str ' 84.05.08 V1.0C'
.byte 0xa5
.end
------------- daląí část ---------------
Netextová pĹ™Ăloha byla odstranÄ›na...
Jméno: 1Z-009B.asm
Typ: text/x-asm
Velikost: 70867 bytes
Popis: [žádný popis nenà k dispozici]
Url : http://mail.ordoz.com/pipermail/sharpmz/attachments/20160622/cd6103c9/attachment-0003.bin
Daląí informace o konferenci SharpMZ