
;
;
; h8jpg - High-Quality-HAM8 JPEG image viewer
;
; code by Smack/Infect!
;
;
; requirements:
;  -AGA, MC68020+, OS V39+
;  -jpeg.library V5+
;  -reqtools.library V38+
;
;
; Tue 18-May-99  V0.1
;
;
	incdir	hd2:h8jpg/src/
	include	os_macros.i


	section	code,code
first_
	basereg	first_,a4
	lea	(first_,pc),a4
;--------------------------------------
; libraries
	move.l	(4).w,a6
	move.l	(378,a6),a0	;LibList
	lea	(intuitionname,pc),a1
	CALL	FindName
	move.l	d0,(intuitionbase,a4)
	move.l	(378,a6),a0	;LibList
	lea	(gfxname,pc),a1
	CALL	FindName
	move.l	d0,(gfxbase,a4)
	move.l	(378,a6),a0	;LibList
	lea	(dosname,pc),a1
	CALL	FindName
	move.l	d0,(dosbase,a4)
	move.l	d0,a6

;--------------------------------------
; check system requirements
	move.l	(4).w,a5
	cmp	#39,(20,a5)	;LIB_Version
	blt	err_ende

	lea	(titletxt,pc),a0
	move.l	a0,d1
	CALL	PutStr

	move	(296,a5),d0	;AttnFlags
	and	#2,d0
	beq.b	.syserr
	move.l	(gfxbase,pc),a0
	move.b	(236,a0),d0	;gb_ChipRevBits0
	and.b	#$0c,d0		;GFXF_AA_Alice | GFXF_AA_Lisa
	bne.b	.sysok
.syserr
	lea	(syserrtxt,pc),a0
	move.l	a0,d1
	CALL	PutStr
	bra	err_ende
.sysok

;--------------------------------------
; jpeg library
	moveq	#5,d0
	lea	(jpegname,pc),a1
	CALLEXEC OpenLibrary
	move.l	d0,(jpegbase,a4)
	bne.b	.jpeglib_ok

	lea	(jpegliberrtxt,pc),a0
	move.l	a0,d1
	CALLDOS	PutStr
	bra	err_ende
.jpeglib_ok

;--------------------------------------
; read command line arguments
	lea	(template,pc),a0
	move.l	a0,d1
	lea	(readargs_result,pc),a0
	move.l	a0,d2
	moveq	#0,d3
	CALLDOS	ReadArgs
	move.l	d0,(rdargs,a4)

	move.l	(readargs_result,pc),(filenames_array,a4)
	bne	filenames_ok

;--------------------------------------
; no filenames given
	moveq	#38,d0
	lea	(rtname,pc),a1
	CALLEXEC OpenLibrary	;V38 reqtools.library
	move.l	d0,(rtbase,a4)
	beq	ende

	moveq	#0,d0		;RT_FILEREQ
	lea	(tags_tagdone,pc),a0
	CALLRT	rtAllocRequestA
	move.l	d0,(filerequest,a4)
	beq	err_ende


dofilerequester
	lea	(filereqtags,pc),a0
	move.l	(filerequest,pc),a1
	lea	(rtfilename,pc),a2
	lea	(filereqtitle,pc),a3
	CALLRT	rtFileRequestA
	move.l	d0,(rtfilelist,a4)
	beq	ende
	move.l	d0,(rtfilelist_curr,a4)

	move.l	(filerequest,pc),a5
	move.l	(16,a5),d1	;filereq->dir
	beq.b	.no_currdir_new
	moveq	#-2,d2		;SHARED_LOCK
	CALLDOS	Lock
	move.l	d0,d1
	beq	err_ende

	move.l	d0,(currdir_lock,a4)
	CALL	CurrentDir	;set current dir
	move.l	d0,(currdir_old,a4)
.no_currdir_old

	lea	(currdirtxt,pc),a0
	move.l	a0,d1
	lea	(vprintf_long1,pc),a0
	move.l	(16,a5),(a0)
	move.l	a0,d2
	CALL	VPrintf
.no_currdir_new

filenames_ok

;--------------------------------------
; open intermediate screen
	move.l	(dummyscreen,pc),d0
	bne.b	.no_dummy
	lea	(dummynewscreen,pc),a0
	lea	(screentaglist,pc),a1
	CALLINT	OpenScreenTagList
	move.l	d0,(dummyscreen,a4)
.no_dummy

;--------------------------------------
; open file
files_loop
	clr	(exit,a4)
	moveq	#1,d0
	move.l	d0,(scale_down_factor,a4)

	lea	(linefeedtxt,pc),a0
	move.l	a0,d1
	CALLDOS	PutStr

	move.l	(rtfilelist,pc),d0
	beq.b	.no_rtfiles
	lea	(rtfilelist_curr,pc),a0
	move.l	(a0),d0
	beq	ende
	move.l	d0,a1
	move.l	(a1),(a0)	;rtfl_Next
	move.l	(8,a1),d1	;rtfl_Name
	bra.b	.open_file
.no_rtfiles
	move.l	(filenames_array,pc),a0
	move.l	(a0)+,d1
	beq	ende
	move.l	a0,(filenames_array,a4)
.open_file
	move.l	d1,(filename,a4)

	lea	(filenametxt,pc),a0
	move.l	a0,d1
	lea	(filename,pc),a0
	move.l	a0,d2
	CALL	VPrintf

	move.l	(filename,pc),d1
	move.l	#1005,d2	;MODE_OLDFILE
	CALL	Open
	move.l	d0,(fh,a4)
	bne.b	.fileopen_ok

	lea	(fileopenerrtxt,pc),a0
	move.l	a0,d1
	CALL	PutStr
	bra.b	files_loop
.fileopen_ok

;--------------------------------------
; alloc JPEG decompress
	lea	(jph,pc),a0
	lea	(ajd_taglist,pc),a1
	move.l	(fh,pc),(4,a1)
	move.l	(jpegbase,pc),a6
	jsr	(-30,a6)	;AllocJPEGDecompressA()
	tst.l	d0
	beq.b	.ajd_ok

	cmp.l	#14,d0		;JPGERR_NOTJPEG
	bne.b	.not_err14
	lea	(notjpegerrtxt,pc),a0
	move.l	a0,d1
	CALLDOS	PutStr
	bra	close_file
.not_err14
	lea	(allocjpegerrtxt,pc),a0
	move.l	a0,d1
	lea	(vprintf_long1,pc),a0
	move.l	a0,d2
	move.l	d0,(a0)
	CALLDOS	VPrintf
	bra	close_file
.ajd_ok

;--------------------------------------
; get JPEG info
retry_smaller
	move.l	(jph,pc),a0
	lea	(gji_taglist,pc),a1
	move.l	(scale_down_factor,pc),(gji_scale,a4)
	move.l	(jpegbase,pc),a6
	jsr	(-78,a6)	;GetJPEGInfoA()
	tst.l	d0
	beq.b	.gji_ok

	lea	(jpeginfoerrtxt,pc),a0
	move.l	a0,d1
	lea	(vprintf_long1,pc),a0
	move.l	a0,d2
	move.l	d0,(a0)
	CALLDOS	VPrintf
	bra	free_jph
.gji_ok
	lea	(jpeginfotxt,pc),a0
	move.l	a0,d1
	lea	(vprintf_long1,pc),a0
	move.l	a0,d2
	move.l	(width,pc),(a0)+
	move.l	(height,pc),(a0)
	CALLDOS	VPrintf

	move.b	(colourspace,pc),d1
	subq.b	#1,d1
	bne.b	.not_gray
	lea	(grayerrtxt,pc),a0
	move.l	a0,d1
	CALL	PutStr
	bra	free_jph
.not_gray

;--------------------------------------
; fit image to screen
	move.l	(fitscreen,pc),d0
	beq.b	.no_fitscreen
	move.l	(scale_down_factor,pc),d0
	subq.l	#1,d0
	bne.b	.no_fitscreen

	move.l	(width,pc),d0
	move	#352,d1		;screen width (LoRes visible)
	divu	d1,d0
	swap	d0
	move.l	(height,pc),d2
	move	#280,d3		;screen height
	divu	d3,d2
	swap	d2

	cmp.l	d0,d2
	ble.b	.max_d0
	move.l	d2,d0
	move	d3,d1
.max_d0
	lsr	#1,d1
	sub	d1,d0		;remainder > 1/2 divisor ?
	ble.b	.quot_ok
	add.l	#$10000,d0	;increment quotient
.quot_ok
	swap	d0
	moveq	#0,d1
	move.b	(.fit_table,pc,d0),d1
	cmp.b	#1,d1
	beq.b	.no_fitscreen

	lea	(scale_down_factor,pc),a0
	move.l	a0,d2
	move.l	d1,(a0)
	lea	(fitscreentxt,pc),a0
	move.l	a0,d1
	CALLDOS	VPrintf
	bra	retry_smaller

.fit_table
	dc.b	1,1,2,4,4,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
.no_fitscreen

;--------------------------------------
; allocate chip memory
	move.l	(width,pc),d0
	lsl.l	#2,d0
	add.l	#63,d0
	and.l	#-64,d0
	move.l	d0,(width64,a4)

	move.l	(height,pc),d1
	mulu	d1,d0
	lsr.l	#3,d0
	add.l	#63,d0
	and.l	#-64,d0
	move.l	d0,(bitplanesize,a4)

	move.l	d0,d7
	lsl.l	#2,d0
	add.l	d7,d0
	add.l	d7,d0		;*6
	move.l	d0,(chipmem_6size,a4)
	move.l	#$00050002,d1	;MEMF_CHIP|MEMF_CLEAR|MEMF_REVERSE
	CALLEXEC AllocMem
	move.l	d0,(chipmem_6pt,a4)
	beq.b	.no_chipmem

	move.l	d7,d0
	add.l	d0,d0		;*2
	move.l	d0,(chipmem_2size,a4)
	move.l	#$00040002,d1	;MEMF_CHIP|MEMF_REVERSE
	CALL	AllocMem
	move.l	d0,(chipmem_2pt,a4)
	bne.b	.chipmem_ok
.no_chipmem
	lea	(chipmem_6pt,pc),a0
	move.l	(a0),d0
	beq.b	.no_chip6
	clr.l	(a0)
	move.l	d0,a1
	move.l	(chipmem_6size,pc),d0
	CALL	FreeMem
.no_chip6
	lea	(chipmemerrtxt,pc),a0
	move.l	a0,d1
	lea	(vprintf_long1,pc),a0
	move.l	a0,d2
	move.l	(bitplanesize,pc),d0
	lsr.l	#7,d0
	move.l	d0,(a0)
	CALLDOS	VPrintf

	lea	(scale_down_factor,pc),a0
	move.l	(a0),d0
	cmp.b	#8,d0
	bge	free_chipmem
	lsl.l	#1,d0
	move.l	d0,(a0)
	bra	retry_smaller

.chipmem_ok

;--------------------------------------
; create bitmap structure
	lea	(bmap,pc),a0
	move.l	(width64,pc),d0
	lsr.l	#3,d0
	move	d0,(a0)+	;BytesPerRow
	move.l	(height,pc),d0
	move	d0,(a0)+	;Rows
	clr.b	(a0)+		;Flags
	move.b	#8,(a0)+	;Depth
	clr	(a0)+		;pad

	move.l	(chipmem_6pt,pc),d0
	move.l	(bitplanesize,pc),d1
	move.l	d0,(a0)+	;Plane 0
	add.l	d1,d0
	move.l	d0,(a0)+	;Plane 1
	add.l	d1,d0
	move.l	d0,(a0)+	;Plane 2
	add.l	d1,d0
	move.l	d0,(a0)+	;Plane 3
	add.l	d1,d0
	move.l	d0,(a0)+	;Plane 4
	add.l	d1,d0
	move.l	d0,(a0)+	;Plane 5
	move.l	(chipmem_2pt,pc),d0
	move.l	d0,(a0)+	;Plane 6
	add.l	d1,d0
	move.l	d0,(a0)		;Plane 7

;--------------------------------------
; open screen and window
	lea	(newscreen,pc),a0
	move.l	(width,pc),d0
	lsl	#2,d0
	move	d0,(4,a0)
	move.l	(height,pc),d0
	move	d0,(6,a0)
	lea	(screentaglist,pc),a1
	CALLINT	OpenScreenTagList
	move.l	d0,(screen,a4)
	bne.b	.screen_ok
.screrr	lea	(screenerrtxt,pc),a0
	move.l	a0,d1
	CALLDOS	PutStr
	bra	close_win
.screen_ok
	lea	(newwindow,pc),a0
	move.l	(screen,pc),a1
	move.l	a1,(30,a0)
	move.l	(12,a1),(4,a0)
	lea	(windowtaglist,pc),a1
	CALL	OpenWindowTagList
	move.l	d0,(window,a4)
	beq.b	.screrr

	move.l	d0,a5
	CALLEXEC Disable
	move.l	(86,a5),a5	;window.wd_UserPort
	move.b	#1,(14,a5)	;window.wd_UserPort->mp_Flags=PA_SOFTINT
	lea	(idcmp_softint,pc),a1
	move.l	a1,(16,a5)	;window.wd_UserPort->mp_SigTask/mp_SoftInt
	CALL	Enable

;--------------------------------------
; prepare HAM8 buffer
	move.l	(chipmem_2pt,pc),a0
	move.l	(bitplanesize,pc),d6
	lsr.l	#3,d6
	move.l	d6,d7
	move.l	#$77777777,d0
.loop6	move.l	d0,(a0)+
	move.l	d0,(a0)+
	subq.l	#1,d6
	bgt.b	.loop6
	move.l	#$cccccccc,d0
.loop7	move.l	d0,(a0)+
	move.l	d0,(a0)+
	subq.l	#1,d7
	bgt.b	.loop7

;--------------------------------------
; decompress and display image
	move.l	(chipmem_6pt,pc),(current_chipmem_pt,a4)
	move.l	(jph,pc),a0
	lea	(dj_taglist,pc),a1
	move.l	(scale_down_factor,pc),(dj_scale,a4)
	move.l	(jpegbase,pc),a6
	jsr	(-42,a6)	;DecompressJPEGA()

;--------------------------------------
; wait until user sends "exit"
wait_loop
	moveq	#1,d1
	CALLDOS	Delay
	move	(exit,pc),d0
	beq.b	wait_loop

;--------------------------------------
; close screen and window
close_win
	lea	(window,pc),a0
	move.l	(a0),d0
	beq.b	.nowin
	clr.l	(a0)
	move.l	d0,a0
	CALLINT	CloseWindow
.nowin
	move.l	(dummyscreen,pc),d0
	beq.b	.nodummy
	move.l	d0,a0
	CALLINT	ScreenToFront
.nodummy
	lea	(screen,pc),a0
	move.l	(a0),d0
	beq.b	.noscr
	clr.l	(a0)
	move.l	d0,a0
	CALLINT	CloseScreen
.noscr

;--------------------------------------
; free chip memory
free_chipmem
	lea	(chipmem_6pt,pc),a0
	move.l	(a0),d0
	beq.b	.no_chip6
	clr.l	(a0)
	move.l	d0,a1
	move.l	(chipmem_6size,pc),d0
	CALLEXEC FreeMem
.no_chip6
	lea	(chipmem_2pt,pc),a0
	move.l	(a0),d0
	beq.b	.no_chip2
	clr.l	(a0)
	move.l	d0,a1
	move.l	(chipmem_2size,pc),d0
	CALLEXEC FreeMem
.no_chip2

;--------------------------------------
; free JPEG decompress
free_jph
	lea	(jph,pc),a1
	move.l	(a1),d0
	beq.b	.no_jph
	clr.l	(a1)
	move.l	d0,a0
	move.l	(jpegbase,pc),a6
	jsr	(-36,a6)	;FreeJPEGDecompress()
.no_jph

;--------------------------------------
; close file
close_file
	lea	(fh,pc),a0
	move.l	(a0),d1
	beq.b	.no_file
	clr.l	(a0)
	CALLDOS	Close
.no_file

	move	(exit,pc),d0
	ble	files_loop





;--------------------------------------
; program exit
	bra.b	ende
err_ende
	lea	(returncode,pc),a0
	moveq	#10,d0
	move.l	d0,(a0)
ende
	lea	(dummyscreen,pc),a0
	move.l	(a0),d0
	beq.b	.nodummy
	clr.l	(a0)
	move.l	d0,a0
	CALLINT	CloseScreen
.nodummy
	lea	(currdir_lock,pc),a0
	move.l	(a0),d1
	beq.b	.no_currlock
	clr.l	(a0)
	CALLDOS	UnLock
.no_currlock
	lea	(currdir_old,pc),a0
	move.l	(a0),d1
	beq.b	.no_currold
	clr.l	(a0)
	CALLDOS	CurrentDir
.no_currold
	lea	(rtfilelist,pc),a0
	move.l	(a0),d0
	beq.b	.no_rtfilelist
	clr.l	(a0)
	move.l	d0,a0
	CALLRT	rtFreeFileList

	move.l	(returncode,pc),d0
	beq	dofilerequester
.no_rtfilelist



	move.l	(currdir_old,pc),d1
	beq.b	.no_currdir_old
	CALLDOS	CurrentDir
.no_currdir_old
	move.l	(filerequest,pc),d0
	beq.b	.no_req
	move.l	d0,a1
	CALLRT	rtFreeRequest
.no_req
	move.l	(rtbase,pc),d0
	beq.b	.no_rtlib
	move.l	d0,a1
	CALLEXEC CloseLibrary
.no_rtlib
	move.l	(rdargs,pc),d1
	CALLDOS	FreeArgs

	move.l	(jpegbase,pc),d0
	beq.b	.no_jpeglib
	move.l	d0,a1
	CALLEXEC CloseLibrary
.no_jpeglib
	move.l	(returncode,pc),d0
	rts


	endb	a4



;--------------------------------------
; (called from MsgPort-SoftInt)
check_idcmp
	movem.l	d1-a6,-(a7)
	lea	(exit,pc),a5
	move.l	(window,pc),a0
	move.l	(86,a0),a0	;window.wd_UserPort
	CALLEXEC GetMsg
	tst.l	d0
	beq.b	.exit
	move.l	d0,a0
	move.l	(20,a0),d1	;msg.Class
	move	(24,a0),d0	;msg.Code

	cmp.l	#$00200000,d1	;IDCMP_VANILLAKEY
	bne.b	.no_key

	cmp.b	#27,d0		;ESC
	bne.b	.no_esc
.esc	move	#1,(a5)
	bra.b	.reply
.no_esc
	cmp.b	#32,d0		;Space
	bne.b	.no_space
.space	move	#-1,(a5)
;;	bra.b	.reply
.no_space
	bra.b	.reply
.no_key
	cmp.l	#$00000008,d1	;IDCMP_MOUSEBUTTONS
	bne.b	.no_mb
	cmp	#105,d0		;RMB
	beq.b	.esc
	cmp	#104,d0		;LMB
	beq.b	.space
;;	bra.b	.reply
.no_mb
.reply	move.l	a0,a1
	CALL	ReplyMsg
.exit	movem.l	(a7)+,d1-a6
	moveq	#0,d0
	rts


;--------------------------------------
; DecompressHook()
;
;a0 - scanline (RGB24 input)
;d0 - scanline number (1...height)
;d1 - number of bytes in scanline
;a1 - user data
;
jpgrow
	movem.l	d1-a6,-(a7)

	lea	(current_chipmem_pt,pc),a2
	move.l	(a2),a1
	move.l	(width64,pc),d0
	lsr.l	#3,d0
	add.l	d0,(a2)
	move.l	(bitplanesize,pc),a4
	move.l	(width,pc),d7
	bsr.b	c2p_24h8

	movem.l	(a7)+,d1-a6
	move.l	(exit,pc),d0
	rts


;--------------------------------------
; RGB24_to_HAM8 chunky2planar converter
;
;a0 - chunky input
;a1 - planar output
;a4 - bitplane size
;d7 - number of pixels to convert
;
	include	c2p_24h8.i










;--------------------------------------
; data
intuitionname	dc.b	"intuition.library",0
gfxname		dc.b	"graphics.library",0
dosname		dc.b	"dos.library",0
jpegname	dc.b	"jpeg.library",0
rtname		dc.b	"reqtools.library",0

		dc.b	"$VER: h8jpg 0.1 (Tue 18-May-99)",0
titletxt	dc.b	27,"[1mh8jpg 0.1 (Tue 18-May-99) by Smack/Infect!",27,"[0m",10,0
syserrtxt	dc.b	"** MC68020+, OS V39+, AGA graphics required.",10,0
jpegliberrtxt	dc.b	"** jpeg.library V5+ required.",10,0
linefeedtxt	dc.b	10,0
filenametxt	dc.b	34,"%s",34,10,0
fileopenerrtxt	dc.b	"** can't open file",10,0
notjpegerrtxt	dc.b	"** not a JPEG image",10,0
allocjpegerrtxt	dc.b	"** AllocJPEGDecompressA() returned error #%ld",10,0
jpeginfoerrtxt	dc.b	"** GetJPEGInfoA() returned error #%ld",10,0
jpeginfotxt	dc.b	"   %ld x %ld pixels",10,0
fitscreentxt	dc.b	"   FITSCREEN scaling 1/%ld",10,0
grayerrtxt	dc.b	"** grayscale images are not supported, sorry",10,0
chipmemerrtxt	dc.b	"** not enough chip memory (need %ldK)",10,0
screenerrtxt	dc.b	"** can't open screen and window.",10,0
currdirtxt	dc.b	"current dir set to ",34,"%s",34,10,0

template	dc.b	"FILES/M,FITSCREEN/S",0

		even
intuitionbase	dc.l	0
gfxbase		dc.l	0
dosbase		dc.l	0
jpegbase	dc.l	0
rtbase		dc.l	0
rdargs		dc.l	0

readargs_result	dc.l	0
fitscreen	dc.l	0

filenames_array	dc.l	0
fh		dc.l	0
filename	dc.l	0

ajd_taglist	dc.l	$80080005,0		;JPG_SrcFile, fh
		dc.l	0,0
jph		dc.l	0

gji_taglist	dc.l	$80080014,width		;JPG_Width
		dc.l	$80080015,height	;JPG_Height
		dc.l	$80080016,bpp		;JPG_BytesPerPixel
		dc.l	$80080018,colourspace	;JPG_ColourSpace
		dc.l	$8008000b		;JPG_ScaleDenom
gji_scale	dc.l	1
		dc.l	0,0
width		dc.l	0
height		dc.l	0
bpp		dc.l	0
colourspace	dc.l	0

dj_taglist	dc.l	$80080008,jpgrow	;JPG_DecompressHook
		dc.l	$8008000b		;JPG_ScaleDenom
dj_scale	dc.l	1
		dc.l	0,0

width64		dc.l	0
bitplanesize	dc.l	0
chipmem_6pt	dc.l	0
chipmem_6size	dc.l	0
chipmem_2pt	dc.l	0
chipmem_2size	dc.l	0
exit		dc.l	0
current_chipmem_pt	dc.l	0
scale_down_factor	dc.l	1

dummyscreen	dc.l	0
dummynewscreen	dc	0,0		;leftedge, topedge
		dc	64,64		;width, height
		dc	1		;depth
		dc.b	0,1		;detailpen, blockpen
		dc	0		;viewmodes
		dc	$438f		;type
		dc.l	0,0,0		;textattr, title, gadgets
		dc.l	0		;custombitmap

bmap		ds.l	16
screen		dc.l	0
newscreen	dc	0,0		;leftedge, topedge
		dc	0,0		;width, height
		dc	8		;depth
		dc.b	0,1		;detailpen, blockpen
		dc	0		;viewmodes
		dc	$434f		;type
		dc.l	0,0,0		;textattr, title, gadgets
		dc.l	bmap		;custombitmap
screentaglist	dc.l	$80000032,$8820		;SA_DisplayID
		dc.l	$80000043,palette	;SA_Colors32
		dc.l	$80000034,2		;SA_Overscan
		dc.l	$80000041,1		;SA_BackFill
		dc.l	0,0
palette		dc.l	$00010000,0,0,0,0

window		dc.l	0
newwindow	dc	0,0		;leftedge, topedge
		dc	0,0		;width, height
		dc.b	0,1		;detailpen, blockpen
		dc.l	$00200008	;IDCMP flags
		dc.l	$31900		;window flags
		dc.l	0,0		;firstgadget, checkmark
		dc.l	0		;title
		dc.l	0,0		;screen, bitmap
		dc	0,0,0,0		;min, max width, height
		dc	$000f		;screen type
windowtaglist	dc.l	$8000007f,1		;WA_BackFill
		dc.l	0,0

idcmp_softint	dc.l	0,0		;is_Node ln_Succ, ln_Pred
		dc.b	2,0		;is_Node ln_Type, ln_Pri
		dc.l	0		;is_Node ln_Name
		dc.l	0,check_idcmp	;is_Data, is_Code

filereqtags	dc.l	(1<<31)|40,%00010001	;RTFI_Flags: pattern + multi
tags_tagdone	dc.l	0,0
filereqtitle	dc.b	"h8jpg: select JPEG files",0,0
filerequest	dc.l	0
rtfilename	ds.b	128
rtfilelist	dc.l	0
rtfilelist_curr	dc.l	0
currdir_old	dc.l	0
currdir_lock	dc.l	0

vprintf_long1	dc.l	0
vprintf_long2	dc.l	0
vprintf_long3	dc.l	0
vprintf_long4	dc.l	0
vprintf_long5	dc.l	0

returncode	dc.l	0

