# HG changeset patch # User Laurens Holst # Date 1542496116 -3600 # Sun Nov 18 00:08:36 2018 +0100 # Node ID b673971f8861bbfa929855e7fb68fc048a773632 # Parent 37a18588ee27cf519c8aef1c2fda697e2ee78bd7 neonlib: Update to latest. diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,1 +1,1 @@ -1ac84a131087f16ca3dd4413f90397ef64f08bc7 lib/neonlib +d0251f469b20f4e741a3dbeee0467e1d0d053ca3 lib/neonlib diff --git a/src/Application.asm b/src/Application.asm --- a/src/Application.asm +++ b/src/Application.asm @@ -14,13 +14,6 @@ ; 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 @@ 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 @@ ld a,l or h ld hl,Application_usageInstructions - jp z,System_TerminateWithError + jp z,System_ThrowExceptionWithMessage pop ix ret @@ -369,7 +353,7 @@ 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_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 @@ 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 diff --git a/src/CLI.asm b/src/CLI.asm --- a/src/CLI.asm +++ b/src/CLI.asm @@ -83,7 +83,7 @@ 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 @@ cp " " ret z ld hl,CLI_unknownOptionError - jp System_TerminateWithError + jp System_ThrowExceptionWithMessage ENDP ; de = buffer position @@ -124,7 +124,7 @@ 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 diff --git a/src/COM.asm b/src/COM.asm --- a/src/COM.asm +++ b/src/COM.asm @@ -24,17 +24,14 @@ 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" diff --git a/src/GzipArchive.asm b/src/GzipArchive.asm --- a/src/GzipArchive.asm +++ b/src/GzipArchive.asm @@ -91,15 +91,15 @@ 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 @@ 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_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 diff --git a/src/ZlibArchive.asm b/src/ZlibArchive.asm --- a/src/ZlibArchive.asm +++ b/src/ZlibArchive.asm @@ -80,12 +80,12 @@ 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 @@ 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 @@ IF ZLIB_ADLER32 call ZlibArchive_VerifyAdler32 ld hl,ZlibArchive_adler32MismatchError - jp nz,System_TerminateWithError + jp nz,System_ThrowExceptionWithMessage ENDIF ret diff --git a/src/deflate/Inflate.asm b/src/deflate/Inflate.asm --- a/src/deflate/Inflate.asm +++ b/src/deflate/Inflate.asm @@ -84,7 +84,7 @@ 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 @@ scf adc hl,bc ld hl,Inflate_invalidLengthError - jp nz,System_TerminateWithError + jp nz,System_ThrowExceptionWithMessage ld a,c or b ret z