diff --git a/.Docs/KERNEL.md b/.Docs/KERNEL.md index 5c290ba2..606d158d 100644 --- a/.Docs/KERNEL.md +++ b/.Docs/KERNEL.md @@ -1089,7 +1089,7 @@ Set the file-position indicator for hFILE Test the end-of-file indicator for hFILE ## C -`int feof( short int stream );` +`short int feof( short int stream );` ## ASM **In:** diff --git a/.Floppies/A2OSX.BUILD.po b/.Floppies/A2OSX.BUILD.po index 80f9b4e2..7ab7d4e2 100644 Binary files a/.Floppies/A2OSX.BUILD.po and b/.Floppies/A2OSX.BUILD.po differ diff --git a/BIN/CC.S.CORE.txt b/BIN/CC.S.CORE.txt index d5eef598..ba9dccd9 100644 --- a/BIN/CC.S.CORE.txt +++ b/BIN/CC.S.CORE.txt @@ -128,7 +128,10 @@ CORE.CompileLine jmp DIR -.1 cmp #'/' +.1 bit DirState FALSE state + bmi .8 + + cmp #'/' bne .2 comments ... jmp CORE.Comments @@ -211,7 +214,7 @@ CORE.CompileStmt *-------------------------------------- CORE.Comments jsr CC.GetNextChar TODO : /* ... */ cmp #'/' - beq CORE.SkipLine // skip line..... + beq .8 // skip line..... cmp #'*' bne .9 /* .... @@ -230,6 +233,9 @@ CORE.Comments jsr CC.GetNextChar TODO : /* ... */ jmp CC.GetNextChar +.8 clc + rts + .9 lda #E.CSYN sec rts diff --git a/BIN/CC.S.DIR.txt b/BIN/CC.S.DIR.txt index 306e5461..f7ef203b 100644 --- a/BIN/CC.S.DIR.txt +++ b/BIN/CC.S.DIR.txt @@ -19,7 +19,7 @@ DIR.DEFINE clc bmi .8 jsr CC.CheckSpace - bcs .99 + bcs .90 jsr CC.IsLetter bcs .90 @@ -120,8 +120,56 @@ DIR.INCLUDE lda #0 >STZ.G PathBuf >LDYA pData jmp FIO.FOpen *-------------------------------------- -DIR.IFDEF -DIR.IFNDEF +DIR.IFDEF sec + .HS 90 BCC +DIR.IFNDEF clc + + ror ZPPtr1 + + jsr CC.CheckSpace + bcs DIR.ESYN + + jsr CC.IsLetter + bcs DIR.ESYN + + >PUSHB.G CC.hDefines + >PUSHW ZPLineBufPtr + >PUSHWI 0 ScopeID + >SYSCALL SListLookup + + ror + eor ZPPtr1 + asl + + lda DirState + rol + ora #1 + sta DirState + clc + rts +*-------------------------------------- +DIR.ELSE lda DirState + beq DIR.ESYN + + eor #$80 + sta DirState + clc + rts +*-------------------------------------- +DIR.ENDIF lda DirState + beq DIR.ESYN + + and #$FE + sec + asl + sta DirState + + clc + rts + +DIR.ESYN lda #E.ESYN + sec + rts *-------------------------------------- MAN SAVE usr/src/bin/cc.s.dir diff --git a/BIN/CC.S.txt b/BIN/CC.S.txt index e36d0d12..c7180223 100644 --- a/BIN/CC.S.txt +++ b/BIN/CC.S.txt @@ -117,7 +117,7 @@ ExpState .BS 1 ExpState.AonStack .EQ $20 ExpState.AinPTR .EQ $40 ExpState.VonStack .EQ $80 -ZPState .BS 1 +DirState .BS 1 ZS.END .ED *-------------------------------------- * File Header (16 Bytes) @@ -192,6 +192,8 @@ J.CC.DIRS .DA DIR.DEFINE .DA DIR.INCLUDE .DA DIR.IFDEF .DA DIR.IFNDEF + .DA DIR.ELSE + .DA DIR.ENDIF *-------------------------------------- J.CC.PREOPS .DA EXP.Ref .DA EXP.Deref @@ -768,6 +770,10 @@ CC.BOPS .PS "*" *-------------------------------------- CC.DIRS .PS "define" .PS "include" + .PS "ifdef" + .PS "ifndef" + .PS "else" + .PS "endif" .HS 00 *-------------------------------------- * Reserved Keywords: diff --git a/INCLUDE/SYS/types.h.txt b/INCLUDE/SYS/types.h.txt index 9b0cf612..c81df9fa 100644 --- a/INCLUDE/SYS/types.h.txt +++ b/INCLUDE/SYS/types.h.txt @@ -1,12 +1,14 @@ NEW AUTO 3,1 - +#ifndef _SYS_TYPES_H_ typedef int mode_t; typedef short int dev_t; typedef short int uid_t; typedef short int gid_t; -typedef short int ino_t[8]; +//typedef short int ino_t[8]; typedef int nlink_t; -typedef unsigned long int off_t; +typedef unsigned long off_t; +#define _SYS_TYPES_H_ 1 +#endif MAN TEXT include/sys/types.h diff --git a/INCLUDE/stdio.h.txt b/INCLUDE/stdio.h.txt index 0d9d280e..45b4dcfc 100644 --- a/INCLUDE/stdio.h.txt +++ b/INCLUDE/stdio.h.txt @@ -1,6 +1,10 @@ NEW AUTO 3,1 +#ifndef _SYS_TYPES_H_ +#include +#endif + #define NULL ((void *)0) #define O_RDONLY 1 @@ -22,7 +26,7 @@ int fwrite(short int,const void*,int); int fastcall fflush(short int); int fseek(short int,long,short int); -int fastcall feof(short int); +short int fastcall feof(short int); long fastcall ftell(short int); int fastcall remove(const char*); int rename(const char*,const char*); diff --git a/ROOT/asmtest/TESTTUI.S.txt b/ROOT/asmtest/TESTTUI.S.txt new file mode 100644 index 00000000..faeff060 --- /dev/null +++ b/ROOT/asmtest/TESTTUI.S.txt @@ -0,0 +1,382 @@ +NEW + AUTO 3,1 + .LIST OFF + .OP 65C02 + .OR $2000 + .TF root/asmtest/testtui +*-------------------------------------- + .INB inc/macros.i + .INB inc/a2osx.i + .INB inc/libtui.i +*-------------------------------------- +EV.SAVE .EQ $C0 +EV.OK .EQ $CE +EV.CANCEL .EQ $CF +*-------------------------------------- + .DUMMY + .OR ZPBIN +ZS.START +ZPPtr1 .BS 2 +hCTX .BS 1 +hSCRN .BS 1 +hTBOX1 .BS 1 +hDLGS .BS 1 +ZS.END .ED +*-------------------------------------- +* File Header (16 Bytes) +*-------------------------------------- +CS.START cld + jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA #0 S.PS.F.EVENT + .DA #0 + .DA CS.END-CS.START Code Size (without Constants) + .DA DS.END-DS.START Data Segment Size + .DA #64 Stack Size + .DA #ZS.END-ZS.START Zero Page Size + .DA 0 +*-------------------------------------- +.1 .DA CS.INIT + .DA CS.RUN + .DA CS.DOEVENT + .DA CS.QUIT +L.LIBTUI .DA LIBTUI +*-------------------------------------- +L.SCRN.Title .DA SCRN.Title +L.SCRN.Status .DA SCRN.Status +L.TBOX1.Title .DA TBOX1.Title +L.TBOX1.Status .DA TBOX1.Status +L.LBOX1.List .DA LBOX1.List +L.LABEL.Label .DA LABEL.Label +L.RADIO1.List .DA RADIO1.List +L.CBOX1.Label .DA CBOX1.Label +L.BUTQ.Label .DA BUTQ.Label +L.BUTS.Label .DA BUTS.Label +L.DLGS.Title .DA DLGS.Title +L.BUT.OK .DA BUT.OK +L.BUT.Cancel .DA BUT.Cancel + .DA 0 +*-------------------------------------- +CS.INIT >LDYA L.LIBTUI + >SYSCALL LoadLib + bcs CS.INIT.RTS + sta hLIBTUI +* clc +CS.INIT.RTS rts +*-------------------------------------- +CS.RUN >LIBCALL hLIBTUI,LIBTUI.Init + bcs CS.RUN.RTS + + sta hCTX + jsr CS.SCRN.Init + bcs CS.RUN.RTS + jsr CS.TBOX1.Init + bcs CS.RUN.RTS + jsr CS.LBOX1.Init + bcs CS.RUN.RTS + jsr CS.TLINE.Init + bcs CS.RUN.RTS + jsr CS.RADIO.Init + bcs CS.RUN.RTS + jsr CS.CBOX.Init + bcs CS.RUN.RTS + jsr CS.BUT.Init + bcs CS.RUN.RTS + jsr CS.SCRN.Draw Will Call SCRN.Draw + lda hTBOX1 + >LIBCALL hLIBTUI,LIBTUI.Activate +*-------------------------------------- +CS.RUN.LOOP lda hSCRN + >LIBCALL hLIBTUI,LIBTUI.Exec + bcs .9 + cmp #EV.RESIZE + bne .1 + jsr CS.SCRN.Draw + bcs .9 + bra CS.RUN.LOOP +.1 cmp #EV.SAVE + bne .2 + + jsr CS.RUN.DLGSAVE + bcc CS.RUN.LOOP +.2 cmp #EV.QUIT + bne CS.RUN.LOOP + lda hSCRN + >LIBCALL hLIBTUI,LIBTUI.Destroy + + lda #0 + sec +.9 +CS.RUN.RTS rts +*-------------------------------------- +CS.SCRN.Init >PUSHB hCTX hParent + >PUSHBI S.OBJ.F.bTitle+S.OBJ.F.bStatus + >LIBCALL hLIBTUI,LIBTUI.NewScrn + bcs .9 + sta hSCRN + >PUSHA + >PUSHBI S.OBJ.pTITLE + >PUSHEA.G SCRN.TitleBuf + >LIBCALL hLIBTUI,LIBTUI.SetProp + >PUSHB hSCRN + >PUSHBI S.OBJ.pSTATUS + >PUSHW L.SCRN.Status + >LIBCALL hLIBTUI,LIBTUI.SetProp +.9 rts +*-------------------------------------- +CS.TBOX1.Init >LDYAI 1024 + >SYSCALL GetMem + bcs CS.RUN.RTS + + >STYA ZPPtr1 + + txa + >STA.G TBOX1.hBuf + lda #0 + sta (ZPPtr1) + >PUSHB hSCRN hParent + >PUSHBI 1 X1 + >PUSHBI 1 Y1 + >PUSHBI 44 W + >PUSHBI 20 H + >PUSHBI S.OBJ.F.bHBorder+S.OBJ.F.bVBorder+S.OBJ.F.bTitle+S.OBJ.F.bStatus + >LDA.G TBOX1.hBuf + >SYSCALL GetMemPtr + >PUSHYA + >PUSHWI 1024 + >LIBCALL hLIBTUI,LIBTUI.NewTBox + bcs .9 + sta hTBOX1 + >PUSHA + >PUSHBI S.OBJ.pTITLE + >PUSHW L.TBOX1.Title + >LIBCALL hLIBTUI,LIBTUI.SetProp + >PUSHB hTBOX1 + >PUSHBI S.OBJ.pSTATUS + >PUSHW L.TBOX1.Status + >LIBCALL hLIBTUI,LIBTUI.SetProp +.9 rts +*-------------------------------------- +CS.LBOX1.Init >PUSHB hSCRN hParent + >PUSHBI 50 X1 + >PUSHBI 1 Y1 + >PUSHBI 20 W + >PUSHBI 9 H + >PUSHBI S.OBJ.F.bHBorder+S.OBJ.F.bVBorder + >PUSHW L.LBOX1.List + >PUSHEA.G LBOX1.Var + >LIBCALL hLIBTUI,LIBTUI.NewLBox + rts +*-------------------------------------- +CS.TLINE.Init >PUSHB hSCRN hParent + >PUSHBI 50 X1 + >PUSHBI 11 Y1 + >PUSHW L.LABEL.Label + >LIBCALL hLIBTUI,LIBTUI.NewLabel + bcs .9 + + >PUSHB hSCRN hParent + >PUSHBI 50 X1 + >PUSHBI 12 Y1 + >PUSHBI 25 W + >PUSHEA.G TLINE.Buf + >PUSHWI 65 Len + >LIBCALL hLIBTUI,LIBTUI.NewTLine + +.9 rts +*-------------------------------------- +CS.RADIO.Init >PUSHB hSCRN hParent + >PUSHBI 50 X1 + >PUSHBI 14 Y1 + >PUSHBI 0 + >PUSHBI 0 + >PUSHW L.RADIO1.List + >PUSHEA.G RADIO1.Var + >LIBCALL hLIBTUI,LIBTUI.NewRadio + rts +*-------------------------------------- +CS.CBOX.Init >PUSHB hSCRN hParent + >PUSHBI 50 X1 + >PUSHBI 18 Y1 + >PUSHBI 0 + >PUSHBI 0 + >PUSHW L.CBOX1.Label + >PUSHEA.G CBOX1.Var + >LIBCALL hLIBTUI,LIBTUI.NewCBox + rts +*-------------------------------------- +CS.BUT.Init >PUSHB hSCRN hParent + >PUSHBI 50 X1 + >PUSHBI 20 Y1 + >PUSHBI 19 Ctrl-S + >PUSHBI EV.SAVE + >PUSHW L.BUTS.Label + >LIBCALL hLIBTUI,LIBTUI.NewBut + bcs .9 + >PUSHB hSCRN hParent + >PUSHBI 65 X1 + >PUSHBI 20 Y1 + >PUSHBI 17 Ctrl-Q + >PUSHBI EV.QUIT + >PUSHW L.BUTQ.Label + >LIBCALL hLIBTUI,LIBTUI.NewBut +.9 +CS.BUT.Init.RTS rts +*-------------------------------------- +CS.RUN.DLGSAVE >PUSHB hCTX hParent + >PUSHBI 70 W + >PUSHBI 11 H + >PUSHW L.DLGS.Title + >LIBCALL hLIBTUI,LIBTUI.NewDlg + bcs CS.BUT.Init.RTS + + sta hDLGS + + >PUSHB hDLGS hParent + >PUSHBI 50 X1 + >PUSHBI 7 Y1 + >PUSHBI C.CR + >PUSHBI EV.OK + >PUSHW L.BUT.OK + >LIBCALL hLIBTUI,LIBTUI.NewBut + bcs .9 + sta ZPPtr1 + >PUSHB hDLGS hParent + >PUSHBI 57 X1 + >PUSHBI 7 Y1 + >PUSHBI 3 Ctrl-C + >PUSHBI EV.CANCEL + >PUSHW L.BUT.Cancel + >LIBCALL hLIBTUI,LIBTUI.NewBut + bcs .9 + lda hDLGS + >LIBCALL hLIBTUI,LIBTUI.Draw + bcs .9 + + lda ZPPtr1 + >LIBCALL hLIBTUI,LIBTUI.Activate +.1 lda hDLGS + >LIBCALL hLIBTUI,LIBTUI.Exec + +.9 php + pha + lda hDLGS + >LIBCALL hLIBTUI,LIBTUI.Destroy + + lda hSCRN + >LIBCALL hLIBTUI,LIBTUI.Draw + pla + plp + rts +*-------------------------------------- +CS.DOEVENT sec do not discard TIMER event + rts +*-------------------------------------- +CS.QUIT >LDA.G TBOX1.hBuf + beq .1 + >SYSCALL FreeMem +.1 lda hCTX + beq .2 + + >LIBCALL hLIBTUI,LIBTUI.Close + +.2 lda hLIBTUI + beq .8 + >SYSCALL UnloadLib +.8 clc + rts +*-------------------------------------- +CS.SCRN.Draw lda hSCRN + >SYSCALL GetMemPtr + >STYA ZPPtr1 + >PUSHEA.G SCRN.TitleBuf + >PUSHW L.SCRN.Title + ldy #S.OBJ.X1 + +.1 lda (ZPPtr1),y + >PUSHA + iny + cpy #S.OBJ.InnerH+1 + bne .1 + + >PUSHBI 10 + >SYSCALL sprintf + lda hSCRN + >LIBCALL hLIBTUI,LIBTUI.Draw + rts +*-------------------------------------- +CS.END +*-------------------------------------- +LIBTUI .AZ "libtui" +hLIBTUI .BS 1 +*-------------------------------------- +SCRN.Title .AZ "Window: X1=%d,Y1=%d, W=%d,H=%d, X2=%d,Y2=%d, iX=%d,iY=%d, iW=%d,iH=%d" +SCRN.Status .AZ "Status bar..." +*-------------------------------------- +TBOX1.Title .AZ "Text Box Title" +TBOX1.Status .AZ "Text Box Status" +*-------------------------------------- +LBOX1.List .AS "Item 1" + .DA #C.CR + .AS "Item 2" + .DA #C.CR + .AS "Item 3" + .DA #C.CR + .AS "Item 4" + .DA #C.CR + .AS "Item 5" + .DA #C.CR + .AS "Item 6 very long line" + .DA #C.CR + .AS "Item 7" + .DA #C.CR + .AS "Item 8" + .DA #C.CR + .AS "Item 9" + .DA #C.CR + .AS "Item 10" + .DA #C.CR + .AS "Item 11" + .DA #C.CR + .AS "Item 12" + .DA #C.CR + .AS "Item 13" + .DA #C.CR + .AS "Item 14 last one" + .DA #0 +*-------------------------------------- +LABEL.Label .AZ "This is a label." +*-------------------------------------- +RADIO1.List .DA #C.ESC + .AS "[91mRed" + .DA #C.CR + .DA #C.ESC + .AS "[92mGreen" + .DA #C.CR + .DA #C.ESC + .AS "[96mBlue" + .DA #0 +*-------------------------------------- +CBOX1.Label .AZ "Check Me" +*-------------------------------------- +BUTS.Label .AZ "(^S)ave..." +BUTQ.Label .AZ "(^Q)uit" +DLGS.Title .AZ "Save As..." +BUT.OK .AZ " OK " +BUT.Cancel .AZ "Cancel" +*-------------------------------------- + .DUMMY + .OR 0 +DS.START +SCRN.TitleBuf .BS 80 +CBOX1.Var .BS 1 +TLINE.Buf .BS 65 +RADIO1.Var .BS 1 +LBOX1.Var .BS 1 +TBOX1.hBuf .BS 1 +DS.END .ED +*-------------------------------------- +MAN +SAVE root/asmtest/testtui.s +ASM diff --git a/ROOT/ctest/testif.c.txt b/ROOT/ctest/testif.c.txt index 2632f4a8..774cfbd4 100644 --- a/ROOT/ctest/testif.c.txt +++ b/ROOT/ctest/testif.c.txt @@ -5,6 +5,16 @@ NEW /* C-style comments.... ...multi-lines */ +#ifndef _TESTDEF_ + +int testdef; +#define _TESTDEF_ 1 + +#else + +int testdef2; +#endif + int main(int argc, char *argv[]) { puts("Press a key"); diff --git a/ROOT/ctest/testtdef.c.txt b/ROOT/ctest/testtdef.c.txt index 9dd08fd9..1c150ef0 100644 --- a/ROOT/ctest/testtdef.c.txt +++ b/ROOT/ctest/testtdef.c.txt @@ -1,6 +1,5 @@ NEW AUTO 3,1 -#include #include #include diff --git a/SYS/KERNEL.S.STDIO.txt b/SYS/KERNEL.S.STDIO.txt index a087ef50..0e7fb4f1 100644 --- a/SYS/KERNEL.S.STDIO.txt +++ b/SYS/KERNEL.S.STDIO.txt @@ -605,7 +605,7 @@ K.FSeek.RTS rts * # FEOF * Test the end-of-file indicator for hFILE * ## C -* `int feof( short int stream );` +* `short int feof( short int stream );` * ## ASM * **In:** * `lda stream`