Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions src/common_post_48k_spectrum.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
;
; 48k spectrum specific definitions here.
;

printinit: ld a,2
jp 0x1601 ; CHAN-OPEN

printchr: push iy
ld iy,0x5c3a ; ERR-NR
push de
push bc
exx
ei
; out (0xff),a
rst 0x10
di
exx
pop bc
pop de
pop iy
ret

ok_print: call print ; print success
db 23,32-2,1,"OK",13,0
ret

failed_print:
call print
db 23,32-6,1,"FAILED",13
db "CRC:",0

call printcrc

call print
db " Expected:",0

ex de,hl
call printcrc

ld a,13
jp printchr

; EOF ;
9 changes: 9 additions & 0 deletions src/common_pre_48k_spectrum.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
;
; 48k spectrum specific definitions here.
;

io_compatible equ 1

org 0x8000

; EOF ;
18 changes: 18 additions & 0 deletions src/common_z80ccf.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; Z80 test - post CCF version.
;
; Copyright (C) 2012-2023 Patrik Rak (patrik@raxoft.cz)
;
; This source code is released under the MIT license, see included license.txt.

macro testname
db "CCF"
endm

maskflags equ 0
onlyflags equ 1
postccf equ 1
memptr equ 0

include main.asm

; EOF ;
18 changes: 18 additions & 0 deletions src/common_z80doc.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; Z80 test - officially documented flags version.
;
; Copyright (C) 2012-2023 Patrik Rak (patrik@raxoft.cz)
;
; This source code is released under the MIT license, see included license.txt.

macro testname
db "doc"
endm

maskflags equ 1
onlyflags equ 0
postccf equ 0
memptr equ 0

include main.asm

; EOF ;
18 changes: 18 additions & 0 deletions src/common_z80docflags.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; Z80 test - officially documented flags, flags only version.
;
; Copyright (C) 2012-2023 Patrik Rak (patrik@raxoft.cz)
;
; This source code is released under the MIT license, see included license.txt.

macro testname
db "doc flags"
endm

maskflags equ 1
onlyflags equ 1
postccf equ 0
memptr equ 0

include main.asm

; EOF ;
18 changes: 18 additions & 0 deletions src/common_z80flags.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; Z80 test - flags only version.
;
; Copyright (C) 2012-2023 Patrik Rak (patrik@raxoft.cz)
;
; This source code is released under the MIT license, see included license.txt.

macro testname
db "flags"
endm

maskflags equ 0
onlyflags equ 1
postccf equ 0
memptr equ 0

include main.asm

; EOF ;
18 changes: 18 additions & 0 deletions src/common_z80full.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; Z80 test - the full version.
;
; Copyright (C) 2012-2023 Patrik Rak (patrik@raxoft.cz)
;
; This source code is released under the MIT license, see included license.txt.

macro testname
db "full"
endm

maskflags equ 0
onlyflags equ 0
postccf equ 0
memptr equ 0

include main.asm

; EOF ;
21 changes: 21 additions & 0 deletions src/common_z80memptr.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; Z80 test - MEMPTR version.
;
; However note that the current set of tests was not designed to stress test MEMPTR
; particularly, so it doesn't detect much - I may eventually add such specific tests later.
;
; Copyright (C) 2012-2023 Patrik Rak (patrik@raxoft.cz)
;
; This source code is released under the MIT license, see included license.txt.

macro testname
db "MEMPTR"
endm

maskflags equ 0
onlyflags equ 1
postccf equ 0
memptr equ 1

include main.asm

; EOF ;
12 changes: 9 additions & 3 deletions src/idea.asm
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ test: ld (.spptr+1),sp
inc de

call .copy


if io_compatible
ld a,0x07 ; Make sure we get 0
out (0xfe),a ; on MIC bit when doing IN.
endif

ld a,0xa9 ; Set I,R,AF' to known values.
ld i,a
Expand Down Expand Up @@ -264,7 +266,8 @@ test: ld (.spptr+1),sp
; If this moves from 0x8800, all tests which use this address
; will need to have their CRCs updated, so don't move it.

align 256
align 0x800
assert data == 0x8800
data
.regs ds datasize-4
.regstop
Expand All @@ -280,12 +283,15 @@ data
jp test.continue

; This entire workspace must be kept within single 256 byte page.

assert (start_of_corework >> 8) == ((end_of_corework - 1) >> 8)
start_of_corework:
vector ds vecsize
counter ds vecsize
countmask ds vecsize
shifter ds 1+vecsize
shiftend
shiftmask ds 1+vecsize
end_of_corework:


; EOF ;
42 changes: 15 additions & 27 deletions src/main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
;
; This source code is released under the MIT license, see included license.txt.

org 0x8000

main: di ; disable interrupts
push iy ; preserve stuff needed by BASIC
exx
Expand Down Expand Up @@ -63,7 +61,13 @@ main: di ; disable interrupts
jr .done

.ok call print ; print success message
db "all tests passed.",13,0
db "all ", 0

ld a,c
call printdeca

call print
db " tests passed.",13,0

.done pop hl ; return to BASIC
exx
Expand Down Expand Up @@ -93,12 +97,15 @@ main: di ; disable interrupts

.failcheck or b ; some prior failure means do the test
jr nz,.pass

if !io_compatible
.incheck
endif
call print ; print that the test was skipped
db 23,32-7,1,"Skipped",13,0

ret ; return success

if io_compatible
.incheck xor a ; expected IN value means do the test
in a,(0xfe)
cp 0xbf ; %10111111 - just MIC bit is zero
Expand All @@ -118,6 +125,7 @@ main: di ; disable interrupts

inc a ; return failure
ret
endif

.pass ld hl,1+3*vecsize ; store expected CRC address
add hl,de
Expand All @@ -142,28 +150,9 @@ main: di ; disable interrupts
ld b,4 ; compare CRCs
call .cmp

jr nz,.mismatch ; check for mismatch

call print ; print success
db 23,32-2,1,"OK",13,0

ret ; return success

.mismatch call print ; print mismatched and expected CRC
db 23,32-6,1,"FAILED",13
db "CRC:",0

call printcrc

call print
db " Expected:",0

ex de,hl
call printcrc

ld a,13
call printchr
jp z,ok_print ; print ok and retunrn

.mismatch call failed_print ; print mismatched and expected CRC
ld a,1 ; return failure
ret

Expand All @@ -179,11 +168,10 @@ main: di ; disable interrupts
pop hl
ret

include print.asm

align 256

include idea.asm
include tests.asm
include print.asm

; EOF ;
25 changes: 25 additions & 0 deletions src/msx/bload_r/common_msx_bload_r.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
;
; This file is part of z80test MSX version.
; Copyright (C) 2025 Suzumizaki-Kimitaka(鈴見咲 君高)
; This source code is released under the MIT license, see included license.txt.
;
org 0x8040 - 7

db 0xFE ; MSX-BASIC BLOAD header
dw bload_loop ; The lowest address to load.
dw last_ptr - 1 ; The highest address to load.
dw bload_loop ; The address to auto-run.
bload_loop:
call common_pre_msx
call main

call print
db "Press any character key to re-run.",0
call waitkeyandput
jr bload_loop

msx_main_starts equ 0x8100
for_bload_r equ 1
for_msx_dos equ 0

; EOF ;
8 changes: 8 additions & 0 deletions src/msx/bload_r/make_bin_for_bload_r.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sjasm z80ccf.asm z80ccf.bin
sjasm z80doc.asm z80doc.bin
sjasm z80docflags.asm z80docfl.bin
sjasm z80flags.asm z80flags.bin
sjasm z80full.asm z80full.bin
sjasm z80memptr.asm z80mempt.bin
sjasm z80ccfscr.asm z80ccfsc.bin
pause
11 changes: 11 additions & 0 deletions src/msx/bload_r/z80ccf.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
;
; This file is part of z80test MSX version.
; Copyright (C) 2025 Suzumizaki-Kimitaka(鈴見咲 君高)
; This source code is released under the MIT license, see included license.txt.
;
include common_msx_bload_r.asm
include ../common_pre_msx.asm
include ../../common_z80ccf.asm
include ../common_post_msx.asm

; EOF ;
30 changes: 30 additions & 0 deletions src/msx/bload_r/z80ccfscr.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
; Z80 test - monitor random behavior of bits 5 and 3 after CCF.
;
; Copyright (C) 2023 Patrik Rak (patrik@raxoft.cz)
;
; This file is part of z80test MSX version.
; Copyright (C) 2025 Suzumizaki-Kimitaka(鈴見咲 君高)
;
; This source code is released under the MIT license, see included license.txt.


WORK equ 09000H

macro call_bios addr
call addr
endm

macro read_bios addr
ld a,(addr)
endm

org 0x8080 - 7

db 0xFE ; MSX-BASIC BLOAD header
dw main ; The lowest address to load.
dw end_of_all_code - 1 ; The highest address to load.
dw start_check ; The address to auto-run.

include ../common_z80ccfscr.asm

; EOF ;
11 changes: 11 additions & 0 deletions src/msx/bload_r/z80doc.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
;
; This file is part of z80test MSX version.
; Copyright (C) 2025 Suzumizaki-Kimitaka(鈴見咲 君高)
; This source code is released under the MIT license, see included license.txt.
;
include common_msx_bload_r.asm
include ../common_pre_msx.asm
include ../../common_z80doc.asm
include ../common_post_msx.asm

; EOF ;
Loading