Browse Source

More fixes

Per Mårtensson 9 months ago
parent
commit
556cef507e
1 changed files with 48 additions and 34 deletions
  1. 48 34
      hw/monroe_oc8820_r3.00.asm

+ 48 - 34
hw/monroe_oc8820_r3.00.asm

@@ -1,4 +1,8 @@
 
+
+
+displaymem equ 0x3000
+nomemchecks equ 9
 	org	00000h
 
 	di					;0000 no interrupt
@@ -136,9 +140,10 @@ displaymsg:
 	;code continues
 	ld a,080h		;0092
 	out (0d4h),a		;0094 out 0d4h,80h Hi-res color
-	ld de,03000h		;0096 point to display upper left corner
-	ld hl,0009fh		;0099 point to message
-	jp displaymsg	;009c go display message at HL 00011h	
+	ld de,displaymem		;0096 point to display upper left corner 03000h
+	ld hl,msgtesting		;0099 point to message 0009fh
+	jp displaymsg	;009c go display message at HL 00011h
+msgtesting:	
 	defb 008h		;009f 8 bytes
 	defb 054h		;00a0 	T
 	defb 065h		;00a1	e
@@ -156,7 +161,7 @@ displaymsg:
 	out (0c8h),a		;00b2 Map and system control
 	ld ix,0c001h		;00b4
 	ld bc,000c5h		;00b8 
-	ld d,009h			;00bb
+	ld d,nomemchecks 	;00bb Start test memory bank (1-9), go to zero afterwards 009h
 	ld a,0a0h			;00bd
 	out (0c5h),a		;00bf Program map B base
 	ld (ix-001h),b		;00c1
@@ -168,19 +173,20 @@ displaymsg:
 	out (0c5h),a		;00cc Program map B base
 	ld b,(ix-001h)		;00ce
 	inc b				;00d1
-	jr z,$+4			;00d2
+	jr z,skipd011			;00d2 $+4 skip for start of memtest 
 	ld d,011h			;00d4
+skipd011:
 	ld b,d				;00d6
-	ld hl,00122h		;00d7
+	ld hl,memtesteval		;00d7 00122h
 	ld de,00000h		;00da
 beginmemtest:
 	outi				;00dd
-	jr z,$+84			;00df
+	jr z,memcmp			;00df
 	exx					;00e1
 	ld b,055h			;00e2 memory check ?
 	ld e,000h			;00e4
 memtestloop:
-	ld hl,0c000h		;00e6 graphic memory address
+	ld hl,0c000h		;00e6 Start for membank that has been switch into
 	ld c,b				;00e9
 memtestwriteloop:	
 	ld (hl),c			;00ea
@@ -208,22 +214,23 @@ memtestreadloop:
 	ld a,e				;010a
 	exx					;010b
 	and a				;010c
-	jr z,memfloppycon			;010d +10
+	jr z,memgood			;010d +10
 	inc a				;010f
-	jr z,memfloppycon2			;0110 +6	monroe_oc8820_r3.00x.asm
+	jr z,memerror			;0110 +6	
 
 	or d				;0112
 	ld d,a				;0113
-	jr memfloppycon		;0114 +3
-memfloppycon2:
+	jr memgood		;0114 +3
+memerror:
 	inc e				;0116
-memfloppycon:
+memgood:
 	ld a,b				;0117
 	cp 004h				;0118
 	jr nz,beginmemtest			;011a -61
 	ld a,020h			;011c
 	out (0c0h),a		;011e Floppy external control
 	jr beginmemtest			;0120 -67
+memtesteval:
 	and c				;0122
 	pop bc				;0123
 	pop hl				;0124
@@ -238,13 +245,15 @@ memfloppycon:
 	ld h,c				;0130
 	add a,c				;0131
 	nop					;0132
+memcmp:
 	xor a				;0133
 	or d				;0134
 	or e				;0135
 	jr z,floppystart			;0136; +43
-	ld ix,0013fh		;0138
-	jp 0058ch			;013c
-	ld de,03000h		;013f
+	ld ix,memcheckdisplay		;0138 013fh
+	jp setupcrt			;013c 0058ch
+memcheckdisplay:
+	ld de,displaymem		;013f  03000h
 	ld hl,00148h		;0142
 	jp displaymsg		;0145  00011h
 	defb 017h		;0148 count 23
@@ -286,8 +295,8 @@ floppystart2:
 	ld hl,005beh		;0171
 	ld bc,0005ah		;0174
 	ldir		;0177
-	call 00503h		;0179
-	call 003d9h		;017c
+	call setupclearscreen2		;0179 00503h
+	call readydisk		;017c 003d9h
 	call 0061ch		;017f
 	ld a,0ffh		;0182
 	jr c,$+3		;0184
@@ -327,7 +336,7 @@ floppystart2:
 	add a,a			;01d4
 	jr c,$+8		;01d5
 	call 0057dh		;01d7
-	call 00262h		;01da
+	call loadingdisk	;01da 00262h
 	inc c			;01dd
 	ld a,b			;01de
 	add a,a			;01df
@@ -342,16 +351,16 @@ floppystart2:
 	ld c,010h		;01f0
 	call 0065ah		;01f2
 	ld b,000h		;01f5
-	call nc,00262h		;01f7
+	call nc,loadingdisk		;01f7 00262h
 	ld c,011h		;01fa
 	call 0065ah		;01fc
 	ld b,000h		;01ff
-	call nc,00262h		;0201
-	call 00503h		;0204
+	call nc,loadingdisk		;0201 00262h
+	call setupclearscreen2		;0204 00503h
 	ld bc,002a3h		;0207
 	ld hl,0061ah		;020a
 	otir		;020d
-	ld de,03000h		;020f
+	ld de,displaymem		;020f 03000h
 	ld hl,00218h		;0212
 	jp displaymsg		;0215 00011h
 	defb 019h		;0218 count 25
@@ -413,6 +422,7 @@ floppystart2:
 	defb 065h		;025f
 	defb 02eh		;0260
 	halt			;0261
+loadingdisk:
 	push bc			;0262
 	xor a			;0263
 	ld (0ff81h),a		;0264
@@ -609,8 +619,8 @@ floppystart2:
 	out (0c8h),a		;0390 Map and system control
 	call 0057dh		;0392
 	call 0057dh		;0395
-	call 00503h		;0398
-	call 003d9h		;039b
+	call setupclearscreen2		;0398 00503h
+	call readydisk		;039b 003d9h
 	exx			;039e
 	pop bc			;039f
 	scf			;03a0
@@ -650,7 +660,8 @@ floppystart2:
 	ld bc,00001h		;03d4
 	or a			;03d7
 	ret			;03d8
-	ld de,03000h		;03d9
+readydisk:
+	ld de,displaymem		;03d9 03000h
 	rst 10h			;03dc
 	defb 01dh		;03dd count 29
 	defb 052h		;03de R3-00C Ready For System Disk 
@@ -750,7 +761,7 @@ floppystart2:
 	call 004b6h		;046c
 	and 09ch		;046f
 	jr nz,$+21		;0471
-	inc h			;0473
+	inc h			;0473setupclearscreen
 	inc bc			;0474
 	dec d			;0475
 	ret z			;0476
@@ -834,6 +845,7 @@ floppystart2:
 	adc a,d			;04fe
 	rst 8			;04ff
 	ld bc,087cfh		;0500
+setupclearscreen2:
 	pop ix		;0503
 setupclearscreen:
 ;entry during initiation with IX=0092
@@ -845,7 +857,7 @@ setupclearscreen:
 	outi				;050f C)=(HL++) and B--
 	jr nz,$-5			;0511 loop until B==0 (14 bytes to write)
 	ld de,03002h		;0513
-	ld hl,03000h		;0516
+	ld hl,displaymem		;0516 03000h
 	ld bc,00ffeh		;0519
 ;RST 08 jump in here HL=300C DE=300E BC=4E IX=032F
 	ld a,004h			;051c Select display memory
@@ -882,9 +894,10 @@ printroutine:
 ;DE screen target
 	ld a,004h			;0541 Select display memory
 	out (0c8h),a		;0543 Output to screen Map and system control
+printcharloop:
 	inc de				;0545 do every other addr
 	ldi					;0546 (DE++)=(HL++) and BC--
-	jp pe,00545h		;0548 repeat while BC not 0
+	jp pe,printcharloop		;0548 repeat while BC not 0 00545h
 	xor a				;054b Reset map
 	out (0c8h),a		;054c Reset to memory Map and system control
 	jp (hl)			;054e
@@ -907,6 +920,7 @@ printroutine:
 	pop hl			;055d
 	jr $+4				;055e
 ;
+
 	otir				;0560 out B bytes from (HL) to (C)
 ;
 	otirloop:
@@ -940,7 +954,7 @@ printroutine:
 	jr nz,$-7			;0587
 	ret					;0589
 	pop ix		;058a
-
+setupcrt:
 	ld a,00fh		;058c
 	out (0b8h),a		;058e CRT register select
 	xor a			;0590
@@ -1123,8 +1137,8 @@ printroutine:
 	call 0057dh		;06af
 	call 0057dh		;06b2
 	call 0057dh		;06b5
-	call 00503h		;06b8
-	call 003d9h		;06bb
+	call setupclearscreen2		;06b8 00503h
+	call readydisk		;06bb 003d9h
 	pop bc			;06be
 	scf			;06bf
 	ret			;06c0
@@ -1312,7 +1326,7 @@ printroutine:
 	rst 38h			;07ef
 	rst 38h			;07f0
 	rst 38h			;07f1
-	rst 38h			;07f2
+	rst 38h			;07f2;
 	rst 38h			;07f3
 	rst 38h			;07f4
 	rst 38h			;07f5
@@ -1325,4 +1339,4 @@ printroutine:
 	rst 38h			;07fc
 	rst 38h			;07fd
 	rst 38h			;07fe
-	rst 38h			;07ff
+	rst 38h			;07ff