section .bss
extern _mMAIN
extern _RAM0r
extern _RAM0w
section .text
global @memrd8_ecx_al@4
global @memwr8_ecx_dl@8
global lea_ecx_ecx
global memfetch
global memrd8_ecx_al
global memrd8_ecx_dl
global memwr8_ecx_dl
global memrd16_ecx_ax
global memwr16_ecx_dx
align 16
lea_ecx_ecx: cmp ecx, 8000h
jc short .low
add ecx, _mMAIN
ret
.low: add ecx, [_RAM0r]
ret
align 16
memfetch: cmp ecx, 8000h
jc short .low
movzx eax, byte [_mMAIN + ecx]
ret
.low: mov edx, [_RAM0r]
movzx eax, byte [edx + ecx]
ret
align 16
@memrd8_ecx_al@4:
memrd8_ecx_al: cmp ecx, 8000h
jc short .low
mov al, [_mMAIN + ecx]
ret
.low: mov edx, [_RAM0r]
mov al, [edx + ecx]
ret
align 16
memrd8_ecx_dl: cmp ecx, 8000h
jc short .low
mov dl, [_mMAIN + ecx]
ret
.low: mov edx, [_RAM0r]
mov dl, [edx + ecx]
ret
align 16
@memwr8_ecx_dl@8:
memwr8_ecx_dl: cmp ecx, 8000h
jc short .low
mov [_mMAIN + ecx], dl
ret
.low: mov eax, [_RAM0w]
mov [eax + ecx], dl
ret
align 16
memrd16_ecx_ax: cmp cx, 0xffff
jo short .a7fff
js short .a8000
je short .affff
mov eax, [_RAM0r]
mov ax, [eax + ecx]
ret
.a7fff: mov eax, [_RAM0r]
mov al, [eax + ecx]
mov ah, [_mMAIN + ecx + 1]
ret
.a8000: mov ax, [_mMAIN + ecx]
ret
.affff: mov eax, [_RAM0r]
mov ah, [eax]
mov al, [_mMAIN + ecx]
ret
align 16
memwr16_ecx_dx: cmp cx, 0xffff
jo short .a7fff
js short .a8000
je short .affff
mov eax, [_RAM0w]
mov [eax + ecx], dx
ret
.a7fff: mov eax, [_RAM0w]
mov [_mMAIN + ecx + 1], dh
mov [eax + ecx], dl
ret
.a8000: mov [_mMAIN + ecx], dx
ret
.affff: mov eax, [_RAM0w]
mov [_mMAIN + ecx], dl
mov [eax], dh
ret
ends
RetroPC.NET-CVS <cvs@retropc.net>