b673971f8861 — Laurens Holst 4 years ago
neonlib: Update to latest.
M .hgsubstate +1 -1
@@ 1,1 1,1 @@ 
-1ac84a131087f16ca3dd4413f90397ef64f08bc7 lib/neonlib
+d0251f469b20f4e741a3dbeee0467e1d0d053ca3 lib/neonlib

          
M src/Application.asm +7 -33
@@ 14,13 14,6 @@ Application_template: Application
 
 ;
 Application_Main:
-	ld hl,DOS_Terminate
-	call System_SetTerminateHandler
-
-	call DOS_IsDOS2
-	ld hl,Application_dos2RequiredError
-	jp c,System_TerminateWithError
-
 	call Application_CheckStack
 
 	ld ix,Heap_main

          
@@ 32,22 25,13 @@ Application_Main:
 
 	call Application_class.New
 	call Application_Construct
-	ld (Application_instance),ix
-	ld de,Application_Abort
-	call DOS_DefineAbortExitRoutine
-	call Application_EnterMainLoop
-	call Application_Abort
-	ret
-
-; DOS error or abort handler
-Application_Abort:
-	push af
-	push bc
-	ld ix,(Application_instance)
+	push ix
+	ld hl,Application_EnterMainLoop
+	call System_TryCall
+	pop ix
 	call Application_Destruct
 	call Application_class.Delete
-	pop bc
-	pop af
+	call System_Rethrow
 	ret
 
 ; ix = this

          
@@ 101,7 85,7 @@ Application_ParseCLI:
 	ld a,l
 	or h
 	ld hl,Application_usageInstructions
-	jp z,System_TerminateWithError
+	jp z,System_ThrowExceptionWithMessage
 	pop ix
 	ret
 

          
@@ 369,7 353,7 @@ Application_CheckStack:
 	ld hl,-(HEAP + HEAP_SIZE + STACK_SIZE)
 	add hl,sp
 	ld hl,Application_insufficientTPAError
-	jp nc,System_TerminateWithError
+	jp nc,System_ThrowExceptionWithMessage
 	ret
 
 ;

          
@@ 385,9 369,6 @@ Application_testingFile:
 Application_dotDotDot:
 	db "...",13,10,0
 
-Application_dos2RequiredError:
-	db "MSX-DOS 2 is required.",13,10,0
-
 Application_insufficientTPAError:
 	db "Insufficient TPA space.",13,10,0
 

          
@@ 399,10 380,3 @@ Application_usageInstructions:
 	db "  /f  Fast, no checksum validation.",13,10
 	db 13,10
 	db "If no output file is specified, the archive will be tested.",13,10,0
-
-	SECTION RAM
-
-Application_instance:
-	dw 0
-
-	ENDS

          
M src/CLI.asm +3 -3
@@ 83,7 83,7 @@ CLI_ParseOption: PROC
 	cp "F"
 	jr z,OptionFast
 	ld hl,CLI_unknownOptionError
-	jp System_TerminateWithError
+	jp System_ThrowExceptionWithMessage
 OptionQuiet:
 	ld (ix + CLI.quiet),-1
 	inc de

          
@@ 99,7 99,7 @@ Next:
 	cp " "
 	ret z
 	ld hl,CLI_unknownOptionError
-	jp System_TerminateWithError
+	jp System_ThrowExceptionWithMessage
 	ENDP
 
 ; de = buffer position

          
@@ 124,7 124,7 @@ OutputPath:
 	ld a,(ix + CLI.outputPath)
 	or (ix + CLI.outputPath + 1)
 	ld hl,CLI_multiplePathsError
-	jp nz,System_TerminateWithError
+	jp nz,System_ThrowExceptionWithMessage
 	ld (ix + CLI.outputPath),e
 	ld (ix + CLI.outputPath + 1),d
 	jp Continue

          
M src/COM.asm +2 -5
@@ 24,17 24,14 @@ HEAP: ds VIRTUAL HEAP_SIZE
 
 	SECTION TPA
 
-;
-; Program entry point
-;
-COM_Main:
-	jp Application_Main
+	DOS2Runtime Application_Main
 
 	INCLUDE "DOS.asm"
 	INCLUDE "BIOS.asm"
 	INCLUDE "System.asm"
 	INCLUDE "Heap.asm"
 	INCLUDE "Class.asm"
+	INCLUDE "DOS2Runtime.asm"
 	INCLUDE "Application.asm"
 	INCLUDE "CLI.asm"
 	INCLUDE "GzipArchive.asm"

          
M src/GzipArchive.asm +6 -6
@@ 91,15 91,15 @@ GzipArchive_ReadHeader:
 	call Reader_Read_IY
 	cp GzipArchive_SIGNATURE_1
 	ld hl,GzipArchive_notGzipError
-	jp nz,System_TerminateWithError
+	jp nz,System_ThrowExceptionWithMessage
 	call Reader_Read_IY
 	cp GzipArchive_SIGNATURE_2
 	ld hl,GzipArchive_notGzipError
-	jp nz,System_TerminateWithError
+	jp nz,System_ThrowExceptionWithMessage
 	call Reader_Read_IY
 	cp GzipArchive_DEFLATE_ID
 	ld hl,GzipArchive_notDeflateError
-	jp nz,System_TerminateWithError
+	jp nz,System_ThrowExceptionWithMessage
 
 	call Reader_Read_IY
 	ld (ix + GzipArchive.flags),a

          
@@ 116,7 116,7 @@ GzipArchive_ReadHeader:
 	ld a,(ix + GzipArchive.flags)
 	and GzipArchive_RESERVED
 	ld hl,GzipArchive_unknownFlagError
-	jp nz,System_TerminateWithError
+	jp nz,System_ThrowExceptionWithMessage
 
 	ld a,(ix + GzipArchive.flags)
 	and GzipArchive_FEXTRA

          
@@ 236,12 236,12 @@ GzipArchive_Inflate:
 GzipArchive_Verify:
 	call GzipArchive_VerifyISIZE
 	ld hl,GzipArchive_isizeMismatchError
-	jp nz,System_TerminateWithError
+	jp nz,System_ThrowExceptionWithMessage
 
 	IF GZIP_CRC32
 	call GzipArchive_VerifyCRC32
 	ld hl,GzipArchive_crc32MismatchError
-	jp nz,System_TerminateWithError
+	jp nz,System_ThrowExceptionWithMessage
 	ENDIF
 	ret
 

          
M src/ZlibArchive.asm +5 -5
@@ 80,12 80,12 @@ ZlibArchive_ReadHeader:
 	call Reader_ReadWordBE_IY
 	call ZlibArchive_CheckFCHECK
 	ld hl,ZlibArchive_invalidFCHECKError
-	jp nz,System_TerminateWithError
+	jp nz,System_ThrowExceptionWithMessage
 	ld a,d
 	and 00001111B
 	cp ZlibArchive_DEFLATE_ID
 	ld hl,ZlibArchive_notDeflateError
-	jp nz,System_TerminateWithError
+	jp nz,System_ThrowExceptionWithMessage
 	ld (ix + ZlibArchive.cm),a
 	ld a,d
 	and 11110000B

          
@@ 95,12 95,12 @@ ZlibArchive_ReadHeader:
 	rrca
 	cp ZlibArchive_MAX_WINDOW + 1
 	ld hl,ZlibArchive_invalidWindowError
-	jp nc,System_TerminateWithError
+	jp nc,System_ThrowExceptionWithMessage
 	ld (ix + ZlibArchive.cinfo),a
 	ld a,e
 	and 00100000B
 	ld hl,ZlibArchive_unsupportedPresetDictionaryError
-	jp nz,System_TerminateWithError
+	jp nz,System_ThrowExceptionWithMessage
 	ld a,e
 	and 11000000B
 	rlca

          
@@ 228,7 228,7 @@ ZlibArchive_Verify:
 	IF ZLIB_ADLER32
 	call ZlibArchive_VerifyAdler32
 	ld hl,ZlibArchive_adler32MismatchError
-	jp nz,System_TerminateWithError
+	jp nz,System_ThrowExceptionWithMessage
 	ENDIF
 	ret
 

          
M src/deflate/Inflate.asm +2 -2
@@ 84,7 84,7 @@ Inflate_InflateBlock:
 	jp c,Inflate_InflateFixedCompressed
 	jp z,Inflate_InflateDynamicCompressed
 	ld hl,Inflate_invalidBlockTypeError
-	jp System_TerminateWithError
+	jp System_ThrowExceptionWithMessage
 
 ; ix = this
 ; iy = reader

          
@@ 98,7 98,7 @@ Inflate_InflateUncompressed:
 	scf
 	adc hl,bc
 	ld hl,Inflate_invalidLengthError
-	jp nz,System_TerminateWithError
+	jp nz,System_ThrowExceptionWithMessage
 	ld a,c
 	or b
 	ret z