From: ol.sc Date: Sat, 4 Feb 2012 13:47:31 +0000 (+0000) Subject: Moved the first couple of files from 'geos-cbm' to 'geos-common' which are believed... X-Git-Tag: V2.13.3~30 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2bf9cd2ee14050db34a03829cf8623d6a6034b77;p=cc65 Moved the first couple of files from 'geos-cbm' to 'geos-common' which are believed to work as-is on Apple GEOS too. git-svn-id: svn://svn.cc65.org/cc65/trunk@5435 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/Makefile b/libsrc/Makefile index a3dbc684d..79f720eec 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -16,6 +16,7 @@ LD = ../../src/ld65/ld65 # List of shared directories SHAREDDIRS = cbm \ common \ + geos-common \ conio \ dbg \ em \ @@ -250,7 +251,7 @@ cbm610lib: .PHONY: geos-cbmlib geos-cbmlib: - for i in runtime geos-cbm common conio em joystick tgi zlib; do \ + for i in runtime geos-cbm geos-common common conio em joystick tgi zlib; do \ $(MAKE) SYS=geos-cbm -C $$i || exit 1; \ $(AR) a geos-cbm.lib $$i/*.o || exit 1; \ done diff --git a/libsrc/geos-cbm/Makefile b/libsrc/geos-cbm/Makefile index 5218045a1..787b55cf7 100644 --- a/libsrc/geos-cbm/Makefile +++ b/libsrc/geos-cbm/Makefile @@ -48,7 +48,6 @@ DIRS = common \ conio \ devel \ disk \ - dlgbox \ file \ graph \ menuicon \ diff --git a/libsrc/geos-cbm/dlgbox/Makefile b/libsrc/geos-cbm/dlgbox/Makefile deleted file mode 100644 index 00663c1ca..000000000 --- a/libsrc/geos-cbm/dlgbox/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# -# makefile for CC65 runtime library -# - -#-------------------------------------------------------------------------- -# Object files - -C_OBJS += messagebox.o - -S_OBJS += dodlgbox.o \ - rstrfrmdialogue.o \ - dbget2lines.o \ - dlgboxyesno.o \ - dlgboxokcancel.o \ - dlgboxok.o \ - dlgboxgetstring.o \ - dlgboxfileselect.o diff --git a/libsrc/geos-cbm/dlgbox/dbget2lines.s b/libsrc/geos-cbm/dlgbox/dbget2lines.s deleted file mode 100644 index 6e26b6ae7..000000000 --- a/libsrc/geos-cbm/dlgbox/dbget2lines.s +++ /dev/null @@ -1,37 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 25.12.99 - - .export DB_get2lines - .importzp ptr3,ptr4 - .import popax - -.code - -DB_get2lines: - sta ptr4 ; fetch line 2 - stx ptr4+1 - jsr popax - sta ptr3 ; fetch line 1 - stx ptr3+1 - ldx #ptr3 - jsr checknull - ldx #ptr4 - jmp checknull - -checknull: - lda $0,x - ora $1,x - bne cn_end - lda #nullstring - sta $1,x -cn_end: rts - -.rodata - -nullstring: - .byte 0 diff --git a/libsrc/geos-cbm/dlgbox/dlgboxfileselect.s b/libsrc/geos-cbm/dlgbox/dlgboxfileselect.s deleted file mode 100644 index 4e34f1045..000000000 --- a/libsrc/geos-cbm/dlgbox/dlgboxfileselect.s +++ /dev/null @@ -1,59 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 25.12.99 - -; char DlgBoxFileSelect (char *class, char ftype, char *fname); - - .export _DlgBoxFileSelect - .import popa, popax - .import _DoDlgBox - - .include "jumptab.inc" - .include "geossym.inc" - .include "const.inc" - .include "geosmac.ca65.inc" - -.code - -_DlgBoxFileSelect: - - sta tmp_r5 - stx tmp_r5+1 - jsr popa - sta tmp_r7L - jsr popax - sta tmp_r10 - stx tmp_r10+1 - -DB_FS_reload: - MoveW tmp_r5, r5 - MoveW tmp_r10, r10 - MoveB tmp_r7L, r7L - - lda #paramStrFileSelect - jsr _DoDlgBox - cmp #DISK - bne DB_FS_Fin - jsr OpenDisk - txa - beq DB_FS_reload -DB_FS_Fin: rts - -.rodata - -paramStrFileSelect: - .byte DEF_DB_POS | 1 - .byte DBGETFILES, 4, 4 - .byte OPEN, DBI_X_2, DBI_Y_0+16 - .byte DISK, DBI_X_2, DBI_Y_0+32+1 - .byte CANCEL, DBI_X_2, DBI_Y_0+64+3 - .byte NULL - -.bss - -tmp_r5: .res 2 -tmp_r7L: .res 1 -tmp_r10: .res 2 diff --git a/libsrc/geos-cbm/dlgbox/dlgboxgetstring.s b/libsrc/geos-cbm/dlgbox/dlgboxgetstring.s deleted file mode 100644 index 2b45f9fb9..000000000 --- a/libsrc/geos-cbm/dlgbox/dlgboxgetstring.s +++ /dev/null @@ -1,39 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 25.12.99 - -; char DlgBoxGetString (char *string, char strlen, char *line1,char *line2); - - .export _DlgBoxGetString - .import DB_get2lines, _DoDlgBox - .importzp ptr2, ptr3, ptr4 - .import popa, popax - - .include "geossym.inc" - .include "const.inc" - -.code - -_DlgBoxGetString: - jsr DB_get2lines - jsr popa - sta DB_strlen - jsr popax - sta ptr2 - stx ptr2+1 - lda #paramStrGetString - jmp _DoDlgBox - -.data - -paramStrGetString: - .byte DEF_DB_POS | 1 - .byte DBVARSTR, TXT_LN_X, TXT_LN_1_Y, ptr3 - .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr4 - .byte DBGETSTRING, TXT_LN_X, TXT_LN_3_Y, ptr2 -DB_strlen: .byte 17 - .byte CANCEL, DBI_X_2, DBI_Y_2 - .byte NULL diff --git a/libsrc/geos-cbm/dlgbox/dlgboxok.s b/libsrc/geos-cbm/dlgbox/dlgboxok.s deleted file mode 100644 index 5d3e5e3fc..000000000 --- a/libsrc/geos-cbm/dlgbox/dlgboxok.s +++ /dev/null @@ -1,31 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 25.12.99 - -; char DlgBoxOk (char *line1,char *line2); - - .export _DlgBoxOk - .import DB_get2lines, _DoDlgBox - .importzp ptr3, ptr4 - - .include "geossym.inc" - .include "const.inc" - -.code - -_DlgBoxOk: - jsr DB_get2lines - lda #paramStrOk - jmp _DoDlgBox - -.rodata - -paramStrOk: - .byte DEF_DB_POS | 1 - .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr3 - .byte DBVARSTR, TXT_LN_X, TXT_LN_3_Y, ptr4 - .byte OK, DBI_X_0, DBI_Y_2 - .byte NULL diff --git a/libsrc/geos-cbm/dlgbox/dlgboxokcancel.s b/libsrc/geos-cbm/dlgbox/dlgboxokcancel.s deleted file mode 100644 index 999d037ec..000000000 --- a/libsrc/geos-cbm/dlgbox/dlgboxokcancel.s +++ /dev/null @@ -1,32 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 25.12.99 - -; char DlgBoxOkCancel (char *line1,char *line2); - - .export _DlgBoxOkCancel - .import DB_get2lines, _DoDlgBox - .importzp ptr3, ptr4 - - .include "geossym.inc" - .include "const.inc" - -.code - -_DlgBoxOkCancel: - jsr DB_get2lines - lda #paramStrOkCancel - jmp _DoDlgBox - -.rodata - -paramStrOkCancel: - .byte DEF_DB_POS | 1 - .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr3 - .byte DBVARSTR, TXT_LN_X, TXT_LN_3_Y, ptr4 - .byte OK, DBI_X_0, DBI_Y_2 - .byte CANCEL, DBI_X_2, DBI_Y_2 - .byte NULL diff --git a/libsrc/geos-cbm/dlgbox/dlgboxyesno.s b/libsrc/geos-cbm/dlgbox/dlgboxyesno.s deleted file mode 100644 index 2996c0d43..000000000 --- a/libsrc/geos-cbm/dlgbox/dlgboxyesno.s +++ /dev/null @@ -1,32 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 25.12.99 - -; char DlgBoxYesNo (char *line1,char *line2); - - .export _DlgBoxYesNo - .import DB_get2lines, _DoDlgBox - .importzp ptr3, ptr4 - - .include "geossym.inc" - .include "const.inc" - -.code - -_DlgBoxYesNo: - jsr DB_get2lines - lda #paramStrYesNo - jmp _DoDlgBox - -.rodata - -paramStrYesNo: - .byte DEF_DB_POS | 1 - .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr3 - .byte DBVARSTR, TXT_LN_X, TXT_LN_3_Y, ptr4 - .byte YES, DBI_X_0, DBI_Y_2 - .byte NO, DBI_X_2, DBI_Y_2 - .byte NULL diff --git a/libsrc/geos-cbm/dlgbox/dodlgbox.s b/libsrc/geos-cbm/dlgbox/dodlgbox.s deleted file mode 100644 index 77b3b6b37..000000000 --- a/libsrc/geos-cbm/dlgbox/dodlgbox.s +++ /dev/null @@ -1,20 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 25.12.1999, 2.1.2003 - -; char DoDlgBox (char *myParamString); - - .export _DoDlgBox - - .include "jumptab.inc" - .include "geossym.inc" - -_DoDlgBox: - sta r0L - stx r0H - jsr DoDlgBox - ldx #0 - lda r0L - rts diff --git a/libsrc/geos-cbm/dlgbox/messagebox.c b/libsrc/geos-cbm/dlgbox/messagebox.c deleted file mode 100644 index 4fba1570c..000000000 --- a/libsrc/geos-cbm/dlgbox/messagebox.c +++ /dev/null @@ -1,85 +0,0 @@ - -/* - * char MessageBox (char mode, const char *format, ...) - * - * Maciej 'YTM/Elysium' Witkowiak, 17.08.2003 - * - */ - -#include -#include - -void _mbprintout(void); - -static dlgBoxStr _mbdlg_EMPTY = { - DB_DEFPOS(1), - DB_OPVEC(&RstrFrmDialogue), - DB_USRROUT(&_mbprintout), - DB_END, -}; - -static dlgBoxStr _mbdlg_OK = { - DB_DEFPOS(1), - DB_USRROUT(&_mbprintout), - DB_ICON(OK, DBI_X_1, DBI_Y_2), - DB_END, -}; - -static dlgBoxStr _mbdlg_OKCANCEL = { - DB_DEFPOS(1), - DB_USRROUT(&_mbprintout), - DB_ICON(OK, DBI_X_0, DBI_Y_2), - DB_ICON(CANCEL, DBI_X_2, DBI_Y_2), - DB_END, -}; - -static dlgBoxStr _mbdlg_YESNO = { - DB_DEFPOS(1), - DB_USRROUT(&_mbprintout), - DB_ICON(YES, DBI_X_0, DBI_Y_2), - DB_ICON(NO, DBI_X_2, DBI_Y_2), - DB_END, -}; - -static dlgBoxStr *_mbboxes[] = { - &_mbdlg_EMPTY, - &_mbdlg_OK, - &_mbdlg_OKCANCEL, - &_mbdlg_YESNO -}; - -static char _mbbuffer[256]; - -char MessageBox(char mode, const char *format, ...) -{ - register char *buf; - va_list ap; - - /* first format out things */ - va_start(ap, format); - vsprintf(_mbbuffer, format, ap); - va_end(ap); - - /* replace LFs by CRs */ - buf = &_mbbuffer[0]; - while (*buf) { - if (*buf==LF) *buf=CR; - ++buf; - } - - /* validate mode */ - if (mode>=MB_LAST) - mode = MB_EMPTY; - - return DoDlgBox(_mbboxes[mode]); -} - -void _mbprintout(void) -{ - UseSystemFont(); - curWindow.top = DEF_DB_TOP; - curWindow.left = DEF_DB_LEFT+10; - curWindow.right = DEF_DB_RIGHT-10; - curWindow.bot = DEF_DB_BOT; - PutString(_mbbuffer, DEF_DB_TOP+10+curFontDesc.height, DEF_DB_LEFT+10 ); -} diff --git a/libsrc/geos-cbm/dlgbox/rstrfrmdialogue.s b/libsrc/geos-cbm/dlgbox/rstrfrmdialogue.s deleted file mode 100644 index a676bb440..000000000 --- a/libsrc/geos-cbm/dlgbox/rstrfrmdialogue.s +++ /dev/null @@ -1,13 +0,0 @@ - -; -; Maciej 'YTM/Alliance' Witkowiak -; -; 25.12.99 - -; char RstrFrmDialogue (void); - - .export _RstrFrmDialogue - - .include "jumptab.inc" - -_RstrFrmDialogue = RstrFrmDialogue diff --git a/libsrc/geos-common/Makefile b/libsrc/geos-common/Makefile new file mode 100644 index 000000000..e884c1bd5 --- /dev/null +++ b/libsrc/geos-common/Makefile @@ -0,0 +1,51 @@ +# +# makefile for CC65 runtime library +# + +.SUFFIXES: .o .s .c + +#-------------------------------------------------------------------------- +# Programs and flags + +SYS = geos-cbm + +AS = ../../src/ca65/ca65 +CC = ../../src/cc65/cc65 +LD = ../../src/ld65/ld65 + +AFLAGS = -t $(SYS) --forget-inc-paths -I../$(SYS) -I../../asminc +CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include + +#-------------------------------------------------------------------------- +# Rules + +%.o: %.c + @$(CC) -o $(notdir $(*).s) $(CFLAGS) $< + @$(AS) -o $@ $(AFLAGS) $(*).s + +%.o: %.s + @$(AS) -g -o $@ $(AFLAGS) $< + +#-------------------------------------------------------------------------- +# Directories + +DIRS = dlgbox + +#-------------------------------------------------------------------------- +# Directives + +include $(addsuffix /Makefile, $(DIRS)) +vpath %.c $(DIRS) +vpath %.s $(DIRS) + +#-------------------------------------------------------------------------- +# Targets + +.PHONY: all clean zap + +all: $(C_OBJS) $(S_OBJS) + +clean: + @$(RM) $(C_OBJS:.o=.s) $(C_OBJS) $(S_OBJS) + +zap: clean diff --git a/libsrc/geos-common/dlgbox/Makefile b/libsrc/geos-common/dlgbox/Makefile new file mode 100644 index 000000000..00663c1ca --- /dev/null +++ b/libsrc/geos-common/dlgbox/Makefile @@ -0,0 +1,17 @@ +# +# makefile for CC65 runtime library +# + +#-------------------------------------------------------------------------- +# Object files + +C_OBJS += messagebox.o + +S_OBJS += dodlgbox.o \ + rstrfrmdialogue.o \ + dbget2lines.o \ + dlgboxyesno.o \ + dlgboxokcancel.o \ + dlgboxok.o \ + dlgboxgetstring.o \ + dlgboxfileselect.o diff --git a/libsrc/geos-common/dlgbox/dbget2lines.s b/libsrc/geos-common/dlgbox/dbget2lines.s new file mode 100644 index 000000000..6e26b6ae7 --- /dev/null +++ b/libsrc/geos-common/dlgbox/dbget2lines.s @@ -0,0 +1,37 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 25.12.99 + + .export DB_get2lines + .importzp ptr3,ptr4 + .import popax + +.code + +DB_get2lines: + sta ptr4 ; fetch line 2 + stx ptr4+1 + jsr popax + sta ptr3 ; fetch line 1 + stx ptr3+1 + ldx #ptr3 + jsr checknull + ldx #ptr4 + jmp checknull + +checknull: + lda $0,x + ora $1,x + bne cn_end + lda #nullstring + sta $1,x +cn_end: rts + +.rodata + +nullstring: + .byte 0 diff --git a/libsrc/geos-common/dlgbox/dlgboxfileselect.s b/libsrc/geos-common/dlgbox/dlgboxfileselect.s new file mode 100644 index 000000000..4e34f1045 --- /dev/null +++ b/libsrc/geos-common/dlgbox/dlgboxfileselect.s @@ -0,0 +1,59 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 25.12.99 + +; char DlgBoxFileSelect (char *class, char ftype, char *fname); + + .export _DlgBoxFileSelect + .import popa, popax + .import _DoDlgBox + + .include "jumptab.inc" + .include "geossym.inc" + .include "const.inc" + .include "geosmac.ca65.inc" + +.code + +_DlgBoxFileSelect: + + sta tmp_r5 + stx tmp_r5+1 + jsr popa + sta tmp_r7L + jsr popax + sta tmp_r10 + stx tmp_r10+1 + +DB_FS_reload: + MoveW tmp_r5, r5 + MoveW tmp_r10, r10 + MoveB tmp_r7L, r7L + + lda #paramStrFileSelect + jsr _DoDlgBox + cmp #DISK + bne DB_FS_Fin + jsr OpenDisk + txa + beq DB_FS_reload +DB_FS_Fin: rts + +.rodata + +paramStrFileSelect: + .byte DEF_DB_POS | 1 + .byte DBGETFILES, 4, 4 + .byte OPEN, DBI_X_2, DBI_Y_0+16 + .byte DISK, DBI_X_2, DBI_Y_0+32+1 + .byte CANCEL, DBI_X_2, DBI_Y_0+64+3 + .byte NULL + +.bss + +tmp_r5: .res 2 +tmp_r7L: .res 1 +tmp_r10: .res 2 diff --git a/libsrc/geos-common/dlgbox/dlgboxgetstring.s b/libsrc/geos-common/dlgbox/dlgboxgetstring.s new file mode 100644 index 000000000..2b45f9fb9 --- /dev/null +++ b/libsrc/geos-common/dlgbox/dlgboxgetstring.s @@ -0,0 +1,39 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 25.12.99 + +; char DlgBoxGetString (char *string, char strlen, char *line1,char *line2); + + .export _DlgBoxGetString + .import DB_get2lines, _DoDlgBox + .importzp ptr2, ptr3, ptr4 + .import popa, popax + + .include "geossym.inc" + .include "const.inc" + +.code + +_DlgBoxGetString: + jsr DB_get2lines + jsr popa + sta DB_strlen + jsr popax + sta ptr2 + stx ptr2+1 + lda #paramStrGetString + jmp _DoDlgBox + +.data + +paramStrGetString: + .byte DEF_DB_POS | 1 + .byte DBVARSTR, TXT_LN_X, TXT_LN_1_Y, ptr3 + .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr4 + .byte DBGETSTRING, TXT_LN_X, TXT_LN_3_Y, ptr2 +DB_strlen: .byte 17 + .byte CANCEL, DBI_X_2, DBI_Y_2 + .byte NULL diff --git a/libsrc/geos-common/dlgbox/dlgboxok.s b/libsrc/geos-common/dlgbox/dlgboxok.s new file mode 100644 index 000000000..5d3e5e3fc --- /dev/null +++ b/libsrc/geos-common/dlgbox/dlgboxok.s @@ -0,0 +1,31 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 25.12.99 + +; char DlgBoxOk (char *line1,char *line2); + + .export _DlgBoxOk + .import DB_get2lines, _DoDlgBox + .importzp ptr3, ptr4 + + .include "geossym.inc" + .include "const.inc" + +.code + +_DlgBoxOk: + jsr DB_get2lines + lda #paramStrOk + jmp _DoDlgBox + +.rodata + +paramStrOk: + .byte DEF_DB_POS | 1 + .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr3 + .byte DBVARSTR, TXT_LN_X, TXT_LN_3_Y, ptr4 + .byte OK, DBI_X_0, DBI_Y_2 + .byte NULL diff --git a/libsrc/geos-common/dlgbox/dlgboxokcancel.s b/libsrc/geos-common/dlgbox/dlgboxokcancel.s new file mode 100644 index 000000000..999d037ec --- /dev/null +++ b/libsrc/geos-common/dlgbox/dlgboxokcancel.s @@ -0,0 +1,32 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 25.12.99 + +; char DlgBoxOkCancel (char *line1,char *line2); + + .export _DlgBoxOkCancel + .import DB_get2lines, _DoDlgBox + .importzp ptr3, ptr4 + + .include "geossym.inc" + .include "const.inc" + +.code + +_DlgBoxOkCancel: + jsr DB_get2lines + lda #paramStrOkCancel + jmp _DoDlgBox + +.rodata + +paramStrOkCancel: + .byte DEF_DB_POS | 1 + .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr3 + .byte DBVARSTR, TXT_LN_X, TXT_LN_3_Y, ptr4 + .byte OK, DBI_X_0, DBI_Y_2 + .byte CANCEL, DBI_X_2, DBI_Y_2 + .byte NULL diff --git a/libsrc/geos-common/dlgbox/dlgboxyesno.s b/libsrc/geos-common/dlgbox/dlgboxyesno.s new file mode 100644 index 000000000..2996c0d43 --- /dev/null +++ b/libsrc/geos-common/dlgbox/dlgboxyesno.s @@ -0,0 +1,32 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 25.12.99 + +; char DlgBoxYesNo (char *line1,char *line2); + + .export _DlgBoxYesNo + .import DB_get2lines, _DoDlgBox + .importzp ptr3, ptr4 + + .include "geossym.inc" + .include "const.inc" + +.code + +_DlgBoxYesNo: + jsr DB_get2lines + lda #paramStrYesNo + jmp _DoDlgBox + +.rodata + +paramStrYesNo: + .byte DEF_DB_POS | 1 + .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr3 + .byte DBVARSTR, TXT_LN_X, TXT_LN_3_Y, ptr4 + .byte YES, DBI_X_0, DBI_Y_2 + .byte NO, DBI_X_2, DBI_Y_2 + .byte NULL diff --git a/libsrc/geos-common/dlgbox/dodlgbox.s b/libsrc/geos-common/dlgbox/dodlgbox.s new file mode 100644 index 000000000..77b3b6b37 --- /dev/null +++ b/libsrc/geos-common/dlgbox/dodlgbox.s @@ -0,0 +1,20 @@ + +; +; Maciej 'YTM/Elysium' Witkowiak +; +; 25.12.1999, 2.1.2003 + +; char DoDlgBox (char *myParamString); + + .export _DoDlgBox + + .include "jumptab.inc" + .include "geossym.inc" + +_DoDlgBox: + sta r0L + stx r0H + jsr DoDlgBox + ldx #0 + lda r0L + rts diff --git a/libsrc/geos-common/dlgbox/messagebox.c b/libsrc/geos-common/dlgbox/messagebox.c new file mode 100644 index 000000000..4fba1570c --- /dev/null +++ b/libsrc/geos-common/dlgbox/messagebox.c @@ -0,0 +1,85 @@ + +/* + * char MessageBox (char mode, const char *format, ...) + * + * Maciej 'YTM/Elysium' Witkowiak, 17.08.2003 + * + */ + +#include +#include + +void _mbprintout(void); + +static dlgBoxStr _mbdlg_EMPTY = { + DB_DEFPOS(1), + DB_OPVEC(&RstrFrmDialogue), + DB_USRROUT(&_mbprintout), + DB_END, +}; + +static dlgBoxStr _mbdlg_OK = { + DB_DEFPOS(1), + DB_USRROUT(&_mbprintout), + DB_ICON(OK, DBI_X_1, DBI_Y_2), + DB_END, +}; + +static dlgBoxStr _mbdlg_OKCANCEL = { + DB_DEFPOS(1), + DB_USRROUT(&_mbprintout), + DB_ICON(OK, DBI_X_0, DBI_Y_2), + DB_ICON(CANCEL, DBI_X_2, DBI_Y_2), + DB_END, +}; + +static dlgBoxStr _mbdlg_YESNO = { + DB_DEFPOS(1), + DB_USRROUT(&_mbprintout), + DB_ICON(YES, DBI_X_0, DBI_Y_2), + DB_ICON(NO, DBI_X_2, DBI_Y_2), + DB_END, +}; + +static dlgBoxStr *_mbboxes[] = { + &_mbdlg_EMPTY, + &_mbdlg_OK, + &_mbdlg_OKCANCEL, + &_mbdlg_YESNO +}; + +static char _mbbuffer[256]; + +char MessageBox(char mode, const char *format, ...) +{ + register char *buf; + va_list ap; + + /* first format out things */ + va_start(ap, format); + vsprintf(_mbbuffer, format, ap); + va_end(ap); + + /* replace LFs by CRs */ + buf = &_mbbuffer[0]; + while (*buf) { + if (*buf==LF) *buf=CR; + ++buf; + } + + /* validate mode */ + if (mode>=MB_LAST) + mode = MB_EMPTY; + + return DoDlgBox(_mbboxes[mode]); +} + +void _mbprintout(void) +{ + UseSystemFont(); + curWindow.top = DEF_DB_TOP; + curWindow.left = DEF_DB_LEFT+10; + curWindow.right = DEF_DB_RIGHT-10; + curWindow.bot = DEF_DB_BOT; + PutString(_mbbuffer, DEF_DB_TOP+10+curFontDesc.height, DEF_DB_LEFT+10 ); +} diff --git a/libsrc/geos-common/dlgbox/rstrfrmdialogue.s b/libsrc/geos-common/dlgbox/rstrfrmdialogue.s new file mode 100644 index 000000000..a676bb440 --- /dev/null +++ b/libsrc/geos-common/dlgbox/rstrfrmdialogue.s @@ -0,0 +1,13 @@ + +; +; Maciej 'YTM/Alliance' Witkowiak +; +; 25.12.99 + +; char RstrFrmDialogue (void); + + .export _RstrFrmDialogue + + .include "jumptab.inc" + +_RstrFrmDialogue = RstrFrmDialogue