PANIC
if debug_stop = 0
_Loop_
else
jr $
endif
incdec2si_hl
incdec2di_hl
inc hl
incdecsi_hl
incdecdi_hl
inc hl
ret
ALIGNrm
LEAr16rm
;чруЁєчшЄ№ ¤ЇЇхъЄштэ√щ рфЁхё (эряЁшьхЁ, lea si,shift[bx] - ёыюцшЄ№ bx+shift, яюыюцшЄ№ т si)
UNTESTED
get
next
push af
call ADDRm16_pp
;hl=addr
;abc=?s*16 (not used)
ld b,h
ld c,l
;no ADDRSEGMENT_chl_bHSB
pop af
rra
rra
and 7*2
ld l,a ;reg16 addr
ld h,_AX/256
_PUTr16LoopC
ALIGNrm
LESr16mem
;чруЁєчшЄ№ єърчрЄхы№, шёяюы№чє ES
;шч ярь Єш ўшЄрхь reg, яюЄюь es
UNTESTED
get
next
push af
ADDRm16_GETm16_for_PUTm16 ;TODO nokeepaf ;ADDRm16_GETm16_keeplx_nokeepaf ;bc=rmmem
;єцх яЁюўшЄрэю 2 срщЄр bc шч (hl), эю hl эх ёфтшэєЄ
push bc
skip2b_GETm16 ;bc=new ES
ld (_ES),bc ;new ES
countES
pop bc
pop af
rra
rra
and 7*2
ld l,a ;reg16 addr
ld h,_AX/256
_PUTr16LoopC
ALIGNrm
LDSr16mem
;чруЁєчшЄ№ єърчрЄхы№, шёяюы№чє DS
;lds r16,m16:16
;шч ярь Єш ўшЄрхь reg, яюЄюь ds
UNTESTED
get
next
push af
ADDRm16_GETm16_for_PUTm16 ;TODO nokeepaf ;ADDRm16_GETm16_keeplx_nokeepaf ;bc=rmmem
;єцх яЁюўшЄрэю 2 срщЄр bc шч (hl), эю hl эх ёфтшэєЄ
push bc
skip2b_GETm16 ;bc=new DS
ld (_DS),bc ;new DS
countDS
pop bc
pop af
rra
rra
and 7*2
ld l,a ;reg16 addr
ld h,_AX/256
_PUTr16LoopC
;эр тїюфх т ъюьрэфє:
;схч ёхуьхэЄэюую яЁхЇшъёр: b=l(рфЁхё юсЁрсюЄўшър)
;ё ёхуьхэЄэ√ь яЁхЇшъёюь: b=?s_LSW+1(эхў╕Єэ√щ)
;тёх юсЁрсюЄўшъш rm-ъюьрэф (ш тююс∙х ъюьрэф ё яюфьхэющ ёхуьхэЄр) яю ў╕Єэюьє рфЁхёє
DSer
ld b,1+(ds_LSW&0xff)
get
next
LD L,A
ld H,MAINCOMS/256
LD a,(HL)
INC H
LD H,(HL)
ld L,a
JP (HL)
CSer
ld b,1+(cs_LSW&0xff)
get
next
LD L,A
ld H,MAINCOMS/256
LD a,(HL)
INC H
LD H,(HL)
ld L,a
JP (HL)
ESer
ld b,1+(es_LSW&0xff)
get
next
LD L,A
ld H,MAINCOMS/256
LD a,(HL)
INC H
LD H,(HL)
ld L,a
JP (HL)
SSer
ld b,1+(ss_LSW&0xff)
get
next
LD L,A
ld H,MAINCOMS/256
LD a,(HL)
INC H
LD H,(HL)
ld L,a
JP (HL)
FSer
ld b,1+(fs_LSW&0xff)
get
next
LD L,A
ld H,MAINCOMS/256
LD a,(HL)
INC H
LD H,(HL)
ld L,a
JP (HL)
GSer
ld b,1+(gs_LSW&0xff)
get
next
LD L,A
ld H,MAINCOMS/256
LD a,(HL)
INC H
LD H,(HL)
ld L,a
JP (HL)
ALIGNrm
XLATBer
UNTESTED
;AL = DS:[(E)BX + AL]
ld a,(_AL)
ld hl,(_BX)
add a,l
ld l,a
jr nc,$+3
inc h
call ADDRGETm16_pp_ds_nodisp ;ьюцхЄ яюфьхэшЄ№ ёхуьхэЄ
ld a,(hl)
ld (_AL),a
_LoopC
getflags_bc
ex af,af' ;'
push af
ex af,af' ;'
pop bc
;c=%SZ?H???C
res 5,c
res 3,c
res 2,c
set 1,c ;TODO a
exx
ld a,d ;parity data
exx
or a
jp po,$+5
set 2,c
;c=%SZ0A0P1C
;c=%SF:ZF:0:AF:0:PF:1:CF
ld a,(iff1)
;ld b,0x30 ;+ 2
;or a
;jr z,$+4
;set 1,b ;interrupt enable
and 2
;or 0x30 ;FIXME skip for x86 tests, use for Valery Lis's tests
ld b,a
;ld a,(_DIRECTION) ;TODO from patch
;rra
;jr nc,$+4
;set 2,b
ld a,(incdecsi_hl)
rra
and 4
or b
ld b,a
exx
ld a,e ;overflow data
and 0x40
rla
xor e
exx
ret p ;jp p,$+5
set 3,b
ret
makeflags_frombc
;c=%SF:ZF:0:AF:0:PF:1:CF
if 1
ld a,b
and 2 ;interrupt enable
add a,-1
sbc a,a
ld (iff1),a
ld a,b
;and 4 ;direction
;add a,-1
;sbc a,a
;ld (_DIRECTION),a
rla
and 8
or 0x23 ;"inc hl" ;0x2b ;"dec hl"
ld (incdec2si_hl),a
ld (incdecsi_hl),a
ld a,b
and 8 ;overflow
rlca
rlca
rlca ;a=0x00/0x40
exx
ld e,a ;overflow data ;шыш шэтхЁёэю?
exx
ld a,c
;cpl
or 0xfb;and 4 ;parity
exx
ld d,a ;parity data
exx
endif
push bc
ex af,af' ;'
pop af
ex af,af' ;'
ret
SAHFer
UNTESTED
call getflags_bc
;store AH into flags
ld a,(_AH)
ld c,a
;ld bc,(_AX) ;for megapole
call makeflags_frombc
_Loop_
LAHFer
UNTESTED
;Load Status Flags into AH Register
call getflags_bc
ld a,c
ld (_AH),a
_Loop_
CLIer
xor a
ld (iff1),a
_Loop_
STIer
ld a,-1
ld (iff1),a
_Loop_
CLDer
;xor a
;ld (_DIRECTION),a
ld a,0x23 ;"inc hl"
ld (incdec2si_hl),a
ld (incdecsi_hl),a
NOPer
_Loop_
HLTer ;TODO
jr $
_Loop_
STDer
;ld a,-1
;ld (_DIRECTION),a
ld a,0x2b ;"dec hl"
ld (incdec2si_hl),a
ld (incdecsi_hl),a
_Loop_
STCer
ex af,af' ;'
scf
ex af,af' ;'
_Loop_
CLCer
ex af,af' ;'
scf
ex af,af' ;'
CMCer
ex af,af' ;'
ccf
ex af,af' ;'
_Loop_
PUSHAer
UNTESTED
;╤юїЁрэшЄ№ т ёЄхъх ЁхушёЄЁ√ AX, CX, DX, BX, шёїюфэ√щ (TODO) SP, BP, SI ш DI
ld hl,_AX
ld b,8
_PUSHAer0
push bc
ld c,(hl)
inc l
ld b,(hl)
inc l
push hl
putmemspBC
pop hl
pop bc
djnz _PUSHAer0
_Loop_
PUSHi8
UNTESTED
get
next
ld c,a
rla
sbc a,a
ld b,a
jr _PUSHq
PUSHi16
getBC
jr _PUSHq
PUSHFer
call getflags_bc
jr _PUSHq
PUSHax
ld bc,(_AX)
jr _PUSHq
PUSHcx
ld bc,(_CX)
jr _PUSHq
PUSHdx
ld bc,(_DX)
jr _PUSHq
PUSHbx
ld bc,(_BX)
jr _PUSHq
PUSHsp
ld bc,(_SP)
jr _PUSHq
PUSHbp
ld bc,(_BP)
jr _PUSHq
PUSHsi
ld bc,(_SI)
jr _PUSHq
PUSHdi
ld bc,(_DI)
jr _PUSHq
PUSHes
ld bc,(_ES)
jr _PUSHq
PUSHcs
ld bc,(_CS)
jr _PUSHq
PUSHss
ld bc,(_SS)
jr _PUSHq
PUSHds
ld bc,(_DS)
_PUSHq
putmemspBC
_LoopC
POPAer
UNTESTED
;╟руЁєчшЄ№ шч ёЄхър ЁхушёЄЁ√ DI, SI, BP, BX, DX, CX ш AX
;╩юьрэфр POPA яЁюфхы√трхЄ фхщёЄтш юсЁрЄэ√х ъюьрэфх PUSHA, тюёёЄрэртыштр ЁхушёЄЁ√ юс∙хую эрчэрўхэш ъ чэрўхэш ь, с√т°шь т эшї фю т√яюыэхэш ъюьрэф√ PUSHA, ъЁюьх ЁхушёЄЁр SP, ъюЄюЁ√щ яЁюяєёърхЄё (TODO)
ld hl,_AX+(8*2)
ld b,8
_POPAer0
push bc
push hl
getmemspBC
pop hl
dec l
ld (hl),b
dec l
ld (hl),c
pop bc
djnz _POPAer0
_Loop_
POPFer
getmemspBC
call makeflags_frombc
_LoopC
POPax
getmemspBC
ld (_AX),bc
_LoopC
POPcx
getmemspBC
ld (_CX),bc
_LoopC
POPdx
getmemspBC
ld (_DX),bc
_LoopC
POPbx
getmemspBC
ld (_BX),bc
_LoopC
POPsp
getmemspBC
ld h,b
ld l,c
ld (_SP),hl
encodeSP
_LoopC
LEAVEer
;Set SP to BP, then pop BP
ld hl,(_BP)
ld (_SP),hl
encodeSP
POPbp
getmemspBC
ld (_BP),bc
_LoopC
POPsi
getmemspBC
ld (_SI),bc
_LoopC
POPdi
getmemspBC
ld (_DI),bc
_LoopC
POPes
getmemspBC
ld (_ES),bc
countES
_LoopC
POPcs
getmemspBC
ld (_CS),bc
countCS
_LoopC
POPss
getmemspBC
ld (_SS),bc
countSS
_LoopC
POPds
getmemspBC
ld (_DS),bc
countDS
_LoopC
MOVaxi16
getHL
ld (_AX),hl
_Loop_
MOVcxi16
getHL
ld (_CX),hl
_Loop_
MOVdxi16
getHL
ld (_DX),hl
_Loop_
MOVbxi16
getHL
ld (_BX),hl
_Loop_
MOVspi16
getHL
ld (_SP),hl
encodeSP
_LoopC
MOVbpi16
getHL
ld (_BP),hl
_Loop_
MOVsii16
getHL
ld (_SI),hl
_Loop_
MOVdii16
getHL
ld (_DI),hl
_Loop_
MOVali8
get
next
ld (_AL),a
_Loop_
MOVcli8
get
next
ld (_CL),a
_Loop_
MOVdli8
get
next
ld (_DL),a
_Loop_
MOVbli8
get
next
ld (_BL),a
_Loop_
MOVahi8
get
next
ld (_AH),a
_Loop_
MOVchi8
get
next
ld (_CH),a
_Loop_
MOVdhi8
get
next
ld (_DH),a
_Loop_
MOVbhi8
get
next
ld (_BH),a
_Loop_
;mov [addr],al
ALIGNrm
MOVmemal
getHL
call ADDRGETm16_pp_ds_nodisp
; ADDRSEGMENT_chl_bHSB ;out: hl=zxaddr, c=page (%01..5432), b=?s_HSB
;ld lx,c;push bc
;ld b,tpgs/256
;ld a,(bc)
;SETPGC000
ld a,(_AL)
ld (hl),a
ld c,lx;pop bc
_PUTscreen_logpgc_zxaddrhl_datamhl
_LoopC
;mov [addr],ax
ALIGNrm
MOVmemax
getHL
call ADDRGETm16_pp_ds_nodisp
; ADDRSEGMENT_chl_bHSB ;out: hl=zxaddr, c=page (%01..5432), b=?s_HSB
;ld lx,c;push bc
; ld b,tpgs/256
; ld a,(bc)
;SETPGC000
ld bc,(_AX)
_PUTm16_oldpglx
_LoopC
;mov al,[addr]
ALIGNrm
MOValmem
getHL
call ADDRGETm16_pp_ds_nodisp
;ADDRSEGMENT_chl_bHSB ;out: hl=zxaddr, c=page (%01..5432), b=?s_HSB
;ld b,tpgs/256
;ld a,(bc)
;SETPGC000
ld a,(hl)
ld (_AL),a
_LoopC
;mov ax,[addr]
ALIGNrm
MOVaxmem
getHL
call ADDRGETm16_pp_ds_nodisp
;ADDRSEGMENT_chl_bHSB ;out: hl=zxaddr, c=page (%01..5432), b=?s_HSB
;ld lx,c
;ld b,tpgs/256
;ld a,(bc)
;SETPGC000
ld a,(hl)
inc l
call z,inch_nextsubsegment_pglx
ld b,(hl)
ld c,a
ld (_AX),bc
_LoopC
INCax
ld hl,(_AX)
inchlwithflags
ld (_AX),hl
_Loop_
INCcx
ld hl,(_CX)
inchlwithflags
ld (_CX),hl
_Loop_
INCdx
ld hl,(_DX)
inchlwithflags
ld (_DX),hl
_Loop_
INCbx
ld hl,(_BX)
inchlwithflags
ld (_BX),hl
_Loop_
INCsp
ld hl,(_SP)
inchlwithflags
ld (_SP),hl
encodeSP
_LoopC
INCbp
ld hl,(_BP)
inchlwithflags
ld (_BP),hl
_Loop_
INCsi
ld hl,(_SI)
inchlwithflags
ld (_SI),hl
_Loop_
INCdi
ld hl,(_DI)
inchlwithflags
ld (_DI),hl
_Loop_
DECax
ld hl,(_AX)
dechlwithflags
ld (_AX),hl
_Loop_
DECcx
ld hl,(_CX)
dechlwithflags
ld (_CX),hl
_Loop_
DECdx
ld hl,(_DX)
dechlwithflags
ld (_DX),hl
_Loop_
DECbx
ld hl,(_BX)
dechlwithflags
ld (_BX),hl
_Loop_
DECsp
ld hl,(_SP)
dechlwithflags
ld (_SP),hl
encodeSP
_LoopC
DECbp
ld hl,(_BP)
dechlwithflags
ld (_BP),hl
_Loop_
DECsi
ld hl,(_SI)
dechlwithflags
ld (_SI),hl
_Loop_
DECdi
ld hl,(_DI)
dechlwithflags
ld (_DI),hl
_Loop_
CALLer
getHL
decodePC
add hl,de
ex de,hl ;new IP(PC)
ld b,h
ld c,l ;=old IP(PC)
putmemspBC
_LoopJP
CALLptr1616
UNTESTED
;push cs; push ip (рфЁхё яюёых ъюьрэф√)
ld bc,(_CS)
putmemspBC ;old CS
;рсёюы■Єэ√щ рфЁхё ip, cs
getBC ;ip
push bc
getBC ;cs
ld (_CS),bc ;new CS
countCS
decodePC
LD b,d
ld c,e ;=old PC
pop de ;new PC
putmemspBC
_LoopC_JP
JMPptr1616
;рсёюы■Єэ√щ рфЁхё ip, cs? Єръ эх ЁрсюЄрхЄ rax
;шыш ¤Єю рфЁхё, яю ъюЄюЁюьє ыхцшЄ ip, cs?
UNTESTED
getBC ;ip
push bc
getBC ;cs
pop de
RETFq
ld (_CS),bc
countCS
_LoopJP
RETer
getmemspBC
LD D,B
ld E,C ;new PC
_LoopC_JP
IRETer
getmemspBC
call makeflags_frombc
;ld a,-1
;ld (iff1),a ;єцх хёЄ№ т makeflags
RETFer
getmemspBC ;ip
push bc
getmemspBC ;cs
pop de ;new PC
ld a,b
or c
jr z,IRETer ;эєцэю фы юсЁрсюЄўшър яЁхЁ√трэшщ, ъюЄюЁ√щ т ъюэЎх яхЁхїюфшЄ эр ёЄрЁ√щ BIOSэ√щ юсЁрсюЄўшъ (gamecga (ratillery))
jp RETFq
RETFi16 ;RETF ш яюЄюь SP += i16
getmemspBC ;ip
push bc
getmemspBC ;cs
push bc
getBC
ld hl,(_SP)
add hl,bc
ld (_SP),hl
encodeSP
pop bc
pop de ;new PC
jp RETFq
RETi16 ;RET ш яюЄюь SP += i16
UNTESTED
getmemspBC
push bc
getBC
ld hl,(_SP)
add hl,bc
ld (_SP),hl
encodeSP
pop de ;new PC
_LoopC_JP
JLEer ;jump if not greater (zero or less)
UNTESTED
ex af,af' ;'
jp z,JRYer
ex af,af' ;'
JLer ;jump if less (SF xor OF = 1)
UNTESTED
ex af,af' ;'
jp m,exaJNOer
exaJOer
ex af,af' ;'
JOer ;jump if overflow
UNTESTED
exx
ld a,e ;overflow data
and 0x40
rla
xor e
exx
JP M,JRer
next
_Loop_
JGer ;jump if greater (not zero and not less)
UNTESTED
ex af,af' ;'
jp z,exaNOJP
ex af,af' ;'
JNLer ;jump if not less (SF xor OF = 0)
UNTESTED
ex af,af' ;'
jp m,exaJOer
exaJNOer
ex af,af' ;'
JNOer ;jump if no overflow
UNTESTED
exx
ld a,e ;overflow data
and 0x40
rla
xor e
exx
JP P,JRer
next
_Loop_
JPer ;jump if parity even
UNTESTED
exx
ld a,d ;parity data
exx
or a
JP PE,JRer
next
_Loop_
JNPer ;jump if parity odd
UNTESTED
exx
ld a,d ;parity data
exx
or a
JP PO,JRer
next
_Loop_
JNEer
ex af,af' ;'
JR NZ,JRYer
ex af,af' ;'
next
_Loop_
JEer
ex af,af' ;'
JR Z,JRYer
ex af,af' ;'
next
_Loop_
JNCer
ex af,af' ;'
JR NC,JRYer
ex af,af' ;'
next
_Loop_
JCer
ex af,af' ;'
JR C,JRYer
ex af,af' ;'
next
_Loop_
JBEer ;jump if CF or ZF = 1
UNTESTED
ex af,af' ;'
JR C,JRYer
JR Z,JRYer
ex af,af' ;'
next
_Loop_
JAer ;jump if (CF or ZF) = 0, i.e. CF=ZF=0
UNTESTED
ex af,af' ;'
JR C,$+4
JR nz,JRYer
ex af,af' ;'
next
_Loop_
JRYer
ex af,af' ;'
JRer
get
next
ld l,a
RLA
SBC A,A
LD H,A
decodePC ;a=d
ADD HL,DE
;;ld a,d
;xor h
;and 0xc0
ex de,hl ;new PC
;jr z,JRer_qslow
;_LoopC_JPoldpg
JRer_qslow
_LoopC_JP
JSer ;jump if sign
ex af,af' ;'
jp m,JRYer
ex af,af' ;'
next
_Loop_
JNSer ;jump if no sign
ex af,af' ;'
jp p,JRYer
exaNOJP
ex af,af' ;'
next
_Loop_
LOOPNZer
ld hl,(_CX)
dec hl
ld (_CX),hl
ex af,af' ;'
jr z,exaNOJP
ex af,af' ;'
jr LOOPer_nodec
LOOPZer
ld hl,(_CX)
dec hl
ld (_CX),hl
ex af,af' ;'
jr nz,exaNOJP
ex af,af' ;'
jr LOOPer_nodec
LOOPer
ld hl,(_CX)
dec hl
ld (_CX),hl
LOOPer_nodec
;jump if CX != 0
ld hl,(_CX)
ld a,h
or l
JR nz,JRer
next
_Loop_
JCXZer ;jump if CX == 0
UNTESTED
ld hl,(_CX)
ld a,h
or l
jp z,JRer
next
_Loop_
JMPer
getHL
decodePC
ADD HL,DE
ex de,hl ;new PC ;TODO єсЁрЄ№ фтющэющ ex de,hl
_LoopC_JP
macro XCHGAXRP rp
ld bc,(rp)
ld hl,(_AX)
ld (rp),hl
ld (_AX),bc
_Loop_
endm
XCHGaxcx
XCHGAXRP _CX
XCHGaxdx
XCHGAXRP _DX
XCHGaxbx
XCHGAXRP _BX
XCHGaxsp
UNTESTED
ld bc,(_SP)
ld hl,(_AX)
ld (_AX),bc
ld (_SP),hl
encodeSP
_Loop_
XCHGaxbp
XCHGAXRP _BP
XCHGaxsi
XCHGAXRP _SI
XCHGaxdi
XCHGAXRP _DI
macro INCDEC2HLbyDIRECTION
call incdec2si_hl
endm
macro INCDECSIbyDIRECTION
ld hl,(_SI)
call incdecsi_hl
ld (_SI),hl
endm
macro INCDECDIbyDIRECTION
ld hl,(_DI)
call incdecdi_hl
ld (_DI),hl
endm
macro INCDECSI_DIbyDIRECTION
ld hl,(_SI)
call incdecsi_hl
ld (_SI),hl
ld hl,(_DI)
call incdecdi_hl
ld (_DI),hl
endm
macro INCDEC2SI_DIbyDIRECTION
ld hl,(_SI)
call incdec2si_hl
ld (_SI),hl
ld hl,(_DI)
call incdec2di_hl
ld (_DI),hl
endm
macro INCDEC2SIbyDIRECTION
ld hl,(_SI)
call incdec2si_hl
ld (_SI),hl
endm
macro INCDEC2DIbyDIRECTION
ld hl,(_DI)
call incdec2di_hl
ld (_DI),hl
endm
ALIGNrm
REPZer
REPNZer
;ъюёЄ√ы№! FIXME
;TODO ёЄртшЄ№ ётющ iy т ърцфюь юсЁрсюЄўшъх, ўЄюс√ эх фхырЄ№ jr
get
next
cp 0xa4
jp z,REPMOVSBer
cp 0xa5
jp z,REPMOVSWer
cp 0xa6
jp z,REPCMPSBer
cp 0xa7
jp z,REPCMPSWer ;ms pacman
cp 0xaa
jp z,REPSTOSBer
cp 0xab
jp z,REPSTOSWer
cp 0xae
jp z,REPSCASBer
cp 0xaf
jp z,REPSCASWer ;for ms pacman
cp 0x6e
jp z,NOPer ;TODO rep insw for lkccmini (эрёЄЁющър ярышЄЁ√, яюЁЄ dx=0x03c9 https://bochs.sourceforge.io/techspec/PORTS.LST)
cp 0x66
jr z,REPSTOSDWer ;for blue
if debug_stop = 0
jp PANIC
else
jr $
endif
REPSTOSDWer
get
next
cp 0xab
jr nz,$
ld hl,(_CX)
add hl,hl
ld (_CX),hl
jr c,$
jp REPSTOSWer
REPMOVSWer_scr
ld hl,(_DI)
push hl
ld bc,(_CX)
ld hl,(_SI)
REPMOVSWer_scr0
push bc
push hl
ld bc,(ds_LSW)
ld a,(ds_HSB)
ADDRSEGMENT_chl_bHSB
ld b,tpgs/256
ld a,(bc)
SETPGC000
GETm16
push bc
;ld a,c
ld hl,(_DI)
ld bc,(es_LSW)
ld a,(es_HSB)
ADDRSEGMENT_chl_bHSB
ld lx,c
ld b,tpgs/256
ld a,(bc)
SETPGC000
pop bc
_PUTm16_oldpglx
INCDEC2DIbyDIRECTION
pop hl
INCDEC2HLbyDIRECTION
pop bc
dec bc
ld a,b
or c
jp nz,REPMOVSWer_scr0
;ld hl,0
ld (_CX),bc
ld hl,(_DI)
pop bc ;DI old
sbc hl,bc ;was NC
ld bc,(_SI)
add hl,bc
ld (_SI),hl
_LoopC
ALIGNrm
MOVSWer
;UNTESTED
ld hl,(_SI)
call ADDRGETm16_pp_ds_nodisp
GETm16
push bc
ld a,c
ld hl,(_DI)
putmemES
ld hl,(_DI)
inc hl
pop af
putmemES
INCDEC2SI_DIbyDIRECTION
_LoopC
ALIGNrm
MOVSBer
UNTESTED
ld hl,(_SI)
call ADDRGETm16_pp_ds_nodisp
ld a,(hl)
ld hl,(_DI)
putmemES
INCDECSI_DIbyDIRECTION
_LoopC
;rep movsw
REPMOVSWer
;TODO Ёрчфхы№эю юяЄшьшчшЁютрЄ№ ъюяшЁютрэшх эр ¤ъЁрэ ш эх эр ¤ъЁрэ
;ъюёЄ√ы№: хёыш cx=0, Єю ёЁрчє т√їюфшь (р эх 65536 яютЄюЁют)
ld a,(_ES+1)
cp 0xa0
jp nc,REPMOVSWer_scr
;ld hl,(_CX)
;ld a,h
;or l
;jr z,REPMOVSWerq
ld hl,(_SI)
getmemDS ;TODO яюфьхэр ёхуьхэЄр
ld hl,(_DI)
putmemES
ld hl,(_SI)
inc hl
getmemDS ;TODO яюфьхэр ёхуьхэЄр
ld hl,(_DI)
inc hl
putmemES
INCDEC2SI_DIbyDIRECTION
ld hl,(_CX)
dec hl
ld (_CX),hl
ld a,h
or l
jp nz,REP_repeat ;TODO keep old b
REPMOVSWerq
_LoopC
;rep movsb
REPMOVSBer
;UNTESTED
;TODO Ёрчфхы№эю юяЄшьшчшЁютрЄ№ ъюяшЁютрэшх эр ¤ъЁрэ ш эх эр ¤ъЁрэ
;ъюёЄ√ы№: хёыш cx=0, Єю ёЁрчє т√їюфшь (р эх 65536 яютЄюЁют)
;ld hl,(_CX)
;ld a,h
;or l
;jr z,REPMOVSBerq
ld hl,(_SI)
getmemDS ;TODO яюфьхэр ёхуьхэЄр
ld hl,(_DI)
putmemES
INCDECSI_DIbyDIRECTION
ld hl,(_CX)
dec hl
ld (_CX),hl
ld a,h
or l
jp nz,REP_repeat ;TODO keep old b
REPMOVSBerq
_LoopC
REPSTOSBer
UNTESTED
;TODO Ёрчфхы№эю юяЄшьшчшЁютрЄ№ ъюяшЁютрэшх эр ¤ъЁрэ ш эх эр ¤ъЁрэ
;ъюёЄ√ы№: хёыш cx=0, Єю ёЁрчє т√їюфшь (р эх 65536 яютЄюЁют)
ld hl,(_CX)
ld a,h
or l
jr z,REPSTOSBerq
ld a,(_AL) ;al
ld hl,(_DI)
putmemES
INCDECDIbyDIRECTION
;flags not affected
ld hl,(_CX)
dec hl
ld (_CX),hl
ld a,h
or l
jr nz,REP_repeat
REPSTOSBerq
_LoopC
REPSTOSWer
UNTESTED
;TODO Ёрчфхы№эю юяЄшьшчшЁютрЄ№ ъюяшЁютрэшх эр ¤ъЁрэ ш эх эр ¤ъЁрэ
;ъюёЄ√ы№: хёыш cx=0, Єю ёЁрчє т√їюфшь (р эх 65536 яютЄюЁют)
ld hl,(_CX)
ld a,h
or l
jr z,REPSTOSWerq
ld a,(_AL) ;al
ld hl,(_DI)
putmemES
ld a,(_AH) ;ah
ld hl,(_DI)
inc hl
putmemES ;TODO speedup
INCDEC2DIbyDIRECTION
;flags not affected
ld hl,(_CX)
dec hl
ld (_CX),hl
ld a,h
or l
jr nz,REP_repeat
REPSTOSWerq
_LoopC
REP_repeat ;TODO speedup!!!
decodePC
dec de
dec de ;new PC
_LoopC_JP
;repz cmpsb
REPCMPSBer
UNTESTED
ld hl,(_SI)
getmemDS ;TODO яюфьхэр ёхуьхэЄр
ex af,af' ;'
ld hl,(_DI)
getmemES
ex af,af' ;'
sub (hl)
KEEPCFPARITYOVERFLOW_FROMA
INCDECSI_DIbyDIRECTION
ld hl,(_CX)
dec hl
ld (_CX),hl
ex af,af' ;'
jp nz,exaLoopC
ex af,af' ;'
ld a,h
or l
jp nz,REP_repeat ;TODO keep old b
_LoopC
;repz cmpsw
REPCMPSWer
UNTESTED
ld hl,(_SI)
call ADDRGETm16_pp_ds_nodisp
GETm16
push bc
ld hl,(_DI)
getmemES
pop hl
or a
sbc hl,bc
KEEPCFPARITYOVERFLOW_FROMA
INCDEC2SI_DIbyDIRECTION
ld hl,(_CX)
dec hl
ld (_CX),hl
ex af,af' ;'
jr nz,exaLoopC
ex af,af' ;'
ld a,h
or l
jp nz,REP_repeat ;TODO keep old b
_LoopC
;repnz scasb
REPSCASBer
UNTESTED
ld hl,(_SI)
getmemDS ;TODO яюфьхэр ёхуьхэЄр
ld a,(_AL) ;al
sub (hl)
KEEPCFPARITYOVERFLOW_FROMA
INCDECSIbyDIRECTION
ld hl,(_CX)
dec hl
ld (_CX),hl
ex af,af' ;'
jr z,exaLoopC
ex af,af' ;'
ld a,h
or l
jp nz,REP_repeat ;TODO keep old b
_LoopC
exaLoopC
ex af,af' ;'
_LoopC
;repnz scasw
REPSCASWer
UNTESTED
ld hl,(_SI)
call ADDRGETm16_pp_ds_nodisp
GETm16
ld hl,(_AX)
SBCHLBC_KEEPCFPARITYOVERFLOW_FROMHL
INCDEC2DIbyDIRECTION
ld hl,(_CX)
dec hl
ld (_CX),hl
ex af,af' ;'
jr z,exaLoopC
ex af,af' ;'
ld a,h
or l
jp nz,REP_repeat ;TODO keep old b
_LoopC
ALIGNrm
SCASBer
UNTESTED
ld hl,(_SI)
call ADDRGETm16_pp_ds_nodisp
ld a,(_AL)
sub (hl)
KEEPCFPARITYOVERFLOW_FROMA
INCDECSIbyDIRECTION
_LoopC
ALIGNrm
SCASWer
UNTESTED
ld hl,(_SI)
call ADDRGETm16_pp_ds_nodisp
GETm16
ld hl,(_AX)
SBCHLBC_KEEPCFPARITYOVERFLOW_FROMHL
INCDEC2DIbyDIRECTION
_LoopC
ALIGNrm
CMPSBer
;UNTESTED
ld hl,(_SI)
call ADDRGETm16_pp_ds_nodisp
ld a,(hl)
ex af,af' ;'
ld hl,(_DI)
getmemES
ex af,af' ;'
sub (hl)
KEEPCFPARITYOVERFLOW_FROMA
INCDECSI_DIbyDIRECTION
_LoopC
ALIGNrm
CMPSWer
UNTESTED
ld hl,(_SI)
call ADDRGETm16_pp_ds_nodisp
GETm16
push bc
ld hl,(_DI)
getmemES
pop hl
or a
sbc hl,bc
KEEPCFPARITYOVERFLOW_FROMA
INCDEC2SI_DIbyDIRECTION
_LoopC
ALIGNrm
LODSBer
UNTESTED
ld hl,(_SI)
call ADDRGETm16_pp_ds_nodisp
ld a,(hl)
ld (_AL),a
INCDECSIbyDIRECTION
;flags not affected
;dec cx эх эрфю!
_LoopC
ALIGNrm
LODSWer
UNTESTED
ld hl,(_SI)
call ADDRGETm16_pp_ds_nodisp
GETm16
ld (_AX),bc
;ld hl,(_SI)
;getmemDS ;TODO яюфьхэр ёхуьхэЄр
;ld (_AL),a ;al
;ld hl,(_SI)
;inc hl
;getmemDS ;TODO яюфьхэр ёхуьхэЄр
;ld (_AH),a ;ah
LODSWerincq
INCDEC2SIbyDIRECTION
;flags not affected
;dec cx эх эрфю!
_LoopC
ALIGNrm
OPSIZEr
UNTESTED
;ъюёЄ√ы№ фы para512
get
next
;TODO check
;for lodsd
ld hl,(_SI)
call ADDRGETm16_pp_ds_nodisp
GETm16
ld (_AX),bc
INCDEC2SIbyDIRECTION
jr LODSWerincq
STOSBer
UNTESTED
ld a,(_AL) ;al
ld hl,(_DI)
putmemES
INCDECDIbyDIRECTION
;flags not affected
;dec cx эх эрфю!
_LoopC
STOSWer
UNTESTED
ld a,(_AL) ;al
ld hl,(_DI)
putmemES
ld a,(_AH) ;ah
ld hl,(_DI)
inc hl
putmemES ;TODO speedup
INCDEC2DIbyDIRECTION
;flags not affected
;dec cx эх эрфю!
_LoopC
INTi8
ld a,(curpg4000) ;ok
push af
get
next
push af
ld a,(pgprog)
SETPG4000
pop af
call far_int
pop af
SETPG4000
_Loop_