From 4c472cc13138b70c81fcda1a0002790fb8a6c27b Mon Sep 17 00:00:00 2001 From: kg68k <78926718+kg68k@users.noreply.github.com> Date: Wed, 20 Sep 2023 22:26:55 +0900 Subject: [PATCH] feat: add filesys.mac and process.mac --- CHANGELOG.md | 23 ++++++++ src/console.mac | 4 +- src/doscall.mac | 4 +- src/dosdef.mac | 17 +++++- src/fefunc.mac | 4 +- src/filesys.mac | 143 +++++++++++++++++++++++++++++++++++++++++++++++ src/iocscall.mac | 4 +- src/iocsdef.mac | 5 +- src/iocswork.mac | 4 +- src/iomap.mac | 4 +- src/keycode.mac | 4 +- src/macro.mac | 17 ++++-- src/process.mac | 95 +++++++++++++++++++++++++++++++ src/scsicall.mac | 5 +- src/scsidef.mac | 5 +- src/sram.mac | 8 ++- src/vector.mac | 4 +- 17 files changed, 319 insertions(+), 31 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 src/filesys.mac create mode 100644 src/process.mac diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..378d969 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,23 @@ +# 変更履歴 + +## 3.0.0 - 2023-09-20 + +新機能 +* filesys.mac: 新規作成。ドライブ、ファイル関係の定義。 +* process.mac: 新規作成。メモリブロック、プロセス関係の定義。 +* macro.mac: `STREND`マクロに第二引数`offset`(NUL文字からの相対位置=-7~+9)を追加。 +``` + STREND a0,-1 ;NULの前のアドレスを指す。 + STREND a0,0 ;NULを指す。offset省略時と同じ。 + STREND a0,+1 ;NULの次のアドレスを指す。offsetを指定する場合の主な用途。 +``` +* sram.mac: `SRAM_16KB_END`、`SRAM_32KB_END`、`SRAM_64KB_END`を追加。 + +不具合の修正 +* iocsdef.mac, scsicall.mac, scsidef.mac: マクロファイルの内容がリストファイルに + 出力されてしまう(`.list`状態になる)不具合を修正。 + +その他 +* 各ファイルにバージョン番号ではなく最終更新日を書くようにした。 +* dosdef.mac 内のドライブ、ファイル関係の定義は将来削除するかも。 + diff --git a/src/console.mac b/src/console.mac index 866d677..dc513a3 100644 --- a/src/console.mac +++ b/src/console.mac @@ -1,7 +1,7 @@ .nlist -# console.mac version 2.0.0 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# console.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright diff --git a/src/doscall.mac b/src/doscall.mac index 632d10e..33fc219 100644 --- a/src/doscall.mac +++ b/src/doscall.mac @@ -1,7 +1,7 @@ .nlist -# doscall.mac version 2.0.0 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# doscall.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright diff --git a/src/dosdef.mac b/src/dosdef.mac index e46f094..0724094 100644 --- a/src/dosdef.mac +++ b/src/dosdef.mac @@ -1,7 +1,7 @@ .nlist -# dosdef.mac version 2.0.2 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# dosdef.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright @@ -107,12 +107,15 @@ DOSE_EXISTFILE: .equ -80 EXIT_SUCCESS: .equ 0 EXIT_FAILURE: .equ 1 +.ifndef STDIN STDIN: .equ 0 STDOUT: .equ 1 STDERR: .equ 2 STDAUX: .equ 3 STDPRN: .equ 4 +.endif +.ifndef __RUKA_DISABLE_OBSOLETE_MACRO__ ATR_EXEC: .equ 7 ATR_LINK: .equ 6 ATR_ARC: .equ 5 @@ -130,20 +133,27 @@ VOLUME: .equ 3 SYSTEM: .equ 2 HIDDEN: .equ 1 READONLY: .equ 0 +.endif +.ifndef __RUKA_DISABLE_OBSOLETE_MACRO__ READRV: .equ $40 VIRDRV: .equ $50 VIRDIR: .equ $60 +.endif +.ifndef __RUKA_DISABLE_OBSOLETE_MACRO__ ROPEN: .equ 0 WOPEN: .equ 1 RWOPEN: .equ 2 *COPEN: .equ 3 *DOPEN: .equ 4 +.endif +.ifndef __RUKA_DISABLE_OBSOLETE_MACRO__ SEEK_SET: .equ 0 SEEK_CUR: .equ 1 SEEK_END: .equ 2 +.endif EXEC_LOADEXEC: .equ 0 EXEC_LOAD: .equ 1 @@ -159,7 +169,10 @@ THREAD_ISBUSY: .equ $ffff INPUT_MAX: .equ 256 ENV_MAX: .equ 256 + +.ifndef DRIVE_MAX DRIVE_MAX: .equ 26 +.endif MB_2DD10: .equ $e0 MB_1D9: .equ $e5 diff --git a/src/fefunc.mac b/src/fefunc.mac index ce0db44..e6ead26 100644 --- a/src/fefunc.mac +++ b/src/fefunc.mac @@ -1,7 +1,7 @@ .nlist -# fefunc.mac version 2.0.0 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# fefunc.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright diff --git a/src/filesys.mac b/src/filesys.mac new file mode 100644 index 0000000..eeff8e7 --- /dev/null +++ b/src/filesys.mac @@ -0,0 +1,143 @@ +.nlist + +# filesys.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + + +.ifndef __filesys_mac__ + __filesys_mac__:=1 + + +* Drive --------------------------------------- * + +.ifndef DRIVE_MAX +DRIVE_MAX: .equ 26 +.endif + +* File Attribute ------------------------------ * + +FILEATR_EXEC: .equ 7 ;execd +FILEATR_LINK: .equ 6 ;lndrv +FILEATR_ARCHIVE: .equ 5 +FILEATR_DIRECTORY: .equ 4 +FILEATR_VOLUME: .equ 3 +FILEATR_SYSTEM: .equ 2 +FILEATR_HIDDEN: .equ 1 +FILEATR_READONLY: .equ 0 + +* File Handle --------------------------------- * + +.ifndef STDIN +STDIN: .equ 0 +STDOUT: .equ 1 +STDERR: .equ 2 +STDAUX: .equ 3 +STDPRN: .equ 4 +.endif + +STD_FILEHANDLE_NUM: .equ 5 +MAX_FILEHANDLE_NUM: .equ 96 + +* File Open Mode ------------------------------ * + +OPENMODE_READ: .equ 0 +OPENMODE_WRITE: .equ 1 +OPENMODE_READ_WRITE: .equ 2 + +* Seek Mode ----------------------------------- * + +SEEKMODE_SET: .equ 0 +SEEKMODE_CURRENT: .equ 1 +SEEKMODE_END: .equ 2 + +* Drive Assign Mode --------------------------- * + +ASSIGNMODE_REAL_DRIVE: .equ $40 +ASSIGNMODE_VIRTUAL_DRIVE: .equ $50 +ASSIGNMODE_VIRTUAL_DIR: .equ $60 + +* File Control Block -------------------------- * + +FCB_CACHE_NUM: .equ 7 + +.offset 0 +FCB_Link: .ds.b 1 +FCB_DevAtr: .ds.b 1 +FCB_Dpb: .ds.l 1 +FCB_FilePtr: .ds.l 1 +FCB_Share: .ds.l 1 +FCB_AxsMode: .ds.b 1 +FCB_DirEnt: .ds.b 1 +FCB_CluSector: .ds.b 1 + .even +FCB_Cluster: .ds 1 +FCB_Sector: .ds.l 1 +FCB_IOBuf: .ds.l 1 +FCB_DirSecotr: .ds.l 1 +FCB_LastPtr: .ds.l 1 +FCB_FileName1: .ds.b 8 +FCB_Ext: .ds.b 3 +FCB_FileAtr: .ds.b 1 +FCB_FileName2: .ds.b 10 +FCB_LastTime: .ds 1 +FCB_LastDate: .ds 1 +FCB_Fat: .ds 1 +FCB_FileSize: .ds.l 1 +FCB_FatCache: .ds.l FCB_CACHE_NUM +sizeof_FCB: +.fail $.ne.96 + +* FILES buffer -------------------------------- * + +.offset 0 +FILES_SchAtr: .ds.b 1 +FILES_SchDrv: .ds.b 1 +FILES_SchSec: .ds.l 1 +FILES_SchRest: .ds 1 +FILES_SchOffs: .ds 1 +FILES_SchName: .ds.b 8 +FILES_SchExt: .ds.b 3 +FILES_FileAtr: .ds.b 1 +FILES_Time: .ds 1 +FILES_Date: .ds 1 +FILES_FileSize: .ds.l 1 +FILES_FileName: .ds.b 23 +sizeof_FILES: +.fail $.ne.53 +FILES_Path: .ds.b 88 ;only extended mode +sizeof_FILES_EX: +.fail $.ne.141 + +* NAMESTS buffer ------------------------------ * + +.offset 0 +NAMESTS_Wild: .ds.b 1 +NAMESTS_Drive: .ds.b 1 +NAMESTS_Path: .ds.b 65 +NAMESTS_Name1: .ds.b 8 +NAMESTS_Ext: .ds.b 3 +NAMESTS_Name2: .ds.b 10 +sizeof_NAMESTS: +.fail $.ne.88 + +* NAMECK buffer ------------------------------- * + +.offset 0 +NAMECK_Drive: .ds.b 2 +NAMECK_Path: .ds.b 65 +NAMECK_Name: .ds.b 19 +NAMECK_Ext: .ds.b 5 +sizeof_NAMECK: +.fail $.ne.91 + + +* End of File --------------------------------- * + +.endif + +.list diff --git a/src/iocscall.mac b/src/iocscall.mac index c4a06d8..3e97ef8 100644 --- a/src/iocscall.mac +++ b/src/iocscall.mac @@ -1,7 +1,7 @@ .nlist -# iocscall.mac version 2.0.0 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# iocscall.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright diff --git a/src/iocsdef.mac b/src/iocsdef.mac index 51309bb..fa37dbc 100644 --- a/src/iocsdef.mac +++ b/src/iocsdef.mac @@ -1,7 +1,7 @@ .nlist -# iocsdef.mac version 2.0.1 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# iocsdef.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright @@ -13,6 +13,7 @@ __iocsdef_mac__:=1 .include iocscall.mac +.nlist * Structure ----------------------------------- * diff --git a/src/iocswork.mac b/src/iocswork.mac index 97053c3..e566d87 100644 --- a/src/iocswork.mac +++ b/src/iocswork.mac @@ -1,7 +1,7 @@ .nlist -# iocswork.mac version 2.0.1 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# iocswork.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright diff --git a/src/iomap.mac b/src/iomap.mac index cc59318..d4e98df 100644 --- a/src/iomap.mac +++ b/src/iomap.mac @@ -1,7 +1,7 @@ .nlist -# iomap.mac version 2.0.0 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# iomap.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright diff --git a/src/keycode.mac b/src/keycode.mac index f6671f7..5409009 100644 --- a/src/keycode.mac +++ b/src/keycode.mac @@ -1,7 +1,7 @@ .nlist -# keycode.mac version 2.0.0 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# keycode.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright diff --git a/src/macro.mac b/src/macro.mac index fa34439..5259943 100644 --- a/src/macro.mac +++ b/src/macro.mac @@ -1,7 +1,7 @@ .nlist -# macro.mac version 2.0.0 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# macro.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright @@ -65,15 +65,22 @@ STRCPY: .macro src,dst,rewind move.b (src)+,(dst)+ bne @loop .if argc>=3 - subq.l #-(rewind),dst + subq.l #-rewind,dst .endif .endm -STREND: .macro areg +STREND: .macro areg,offset + .sizem sz,argc @loop: tst.b (areg)+ bne @loop - subq.l #1,areg + .if argc<=1 + subq.l #1,areg + .elif offset<=0 + subq.l #1-offset,areg + .elif offset>=2 + addq.l #offset-1,areg + .endif .endm STRCAT: .macro src,dst,rewind diff --git a/src/process.mac b/src/process.mac new file mode 100644 index 0000000..b31737d --- /dev/null +++ b/src/process.mac @@ -0,0 +1,95 @@ +.nlist + +# process.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + + +.ifndef __process_mac__ + __process_mac__:=1 + + +* Memory Block -------------------------------- * + +MEMBLK_TYPE_SUB: .equ $fd +MEMBLK_TYPE_MEMDRV: .equ $fe +MEMBLK_TYPE_KEEP: .equ $ff + +.offset 0 +MEMBLK_Previous: .ds.l 1 +MEMBLK_Parent: .ds.l 1 +MEMBLK_End: .ds.l 1 +MEMBLK_Next: .ds.l 1 +sizeof_MEMBLK: +.fail $.ne.16 + +* Program Segment Prefix ---------------------- * + +.offset 0 + .ds.b sizeof_MEMBLK +PSP_Env: .ds.l 1 +PSP_Exit: .ds.l 1 +PSP_CtrlC: .ds.l 1 +PSP_Error: .ds.l 1 +PSP_CmdLine: .ds.l 1 +PSP_FileUse: .ds.b 12 +PSP_BSS: .ds.l 1 +PSP_Heap: .ds.l 1 +PSP_Stack: .ds.l 1 +PSP_PareUSP: .ds.l 1 +PSP_PareSSP: .ds.l 1 +PSP_PareSR: .ds 1 +PSP_AbortSR: .ds 1 +PSP_AbortSSP: .ds.l 1 +PSP_Trap10: .ds.l 1 +PSP_Trap11: .ds.l 1 +PSP_Trap12: .ds.l 1 +PSP_Trap13: .ds.l 1 +PSP_Trap14: .ds.l 1 +PSP_ShellFlag: .ds.l 1 +PSP_ModuleNo: .ds.b 1 + .ds.b 3 +PSP_Child: .ds.l 1 + .ds.l 5 +PSP_Drive: .ds.b 2 +PSP_Path: .ds.b 66 +PSP_Filename: .ds.b 24 + .ds.l 9 +sizeof_PSP: +.fail $.ne.$100 + +* Back Ground Process (Thread) ---------------- * + +BG_WAITFLAG_SLEEP: .equ $ff +BG_WAITFLAG_SUSPEND: .equ $fe + +.offset 0 +BG_NextThread: .ds.l 1 +BG_WaitFlag: .ds.b 1 +BG_Count: .ds.b 1 +BG_CountMax: .ds.b 1 +BG_DosCmd: .ds.b 1 +BG_Psp: .ds.l 1 +BG_Usp: .ds.l 1 +BG_Regs .ds.l 15 +BG_Sr: .ds 1 +BG_Pc: .ds.l 1 +BG_Ssp: .ds.l 1 +BG_InDosFlag: .ds.w 1 +BG_InDosPtr: .ds.l 1 +BG_Buffer: .ds.l 1 +BG_Name: .ds.b 16 +BG_WaitTime: .ds.l 1 +sizeof_BG: +.fail $.ne.116 + + +* End of File --------------------------------- * + +.endif + +.list diff --git a/src/scsicall.mac b/src/scsicall.mac index a8d5c70..6da413c 100644 --- a/src/scsicall.mac +++ b/src/scsicall.mac @@ -1,7 +1,7 @@ .nlist -# scsicall.mac version 2.0.0 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# scsicall.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright @@ -13,6 +13,7 @@ __scsicall_mac__:=1 .include iocscall.mac +.nlist * Macro --------------------------------------- * diff --git a/src/scsidef.mac b/src/scsidef.mac index 33acf78..4178e0c 100644 --- a/src/scsidef.mac +++ b/src/scsidef.mac @@ -1,7 +1,7 @@ .nlist -# scsidef.mac version 2.0.0 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# scsidef.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright @@ -13,6 +13,7 @@ __scsidef_mac__:=1 .include scsicall.mac +.nlist * Structure ----------------------------------- * diff --git a/src/sram.mac b/src/sram.mac index a1742ca..d73797d 100644 --- a/src/sram.mac +++ b/src/sram.mac @@ -1,7 +1,7 @@ .nlist -# sram.mac version 2.0.0 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# sram.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright @@ -19,6 +19,10 @@ SRAM: .equ $ed0000 SRAM_END: .equ $ed3fff SRAM_SIZE: .equ 16*1024 +SRAM_16KB_END: .equ $ed4000 +SRAM_32KB_END: .equ $ed8000 +SRAM_64KB_END: .equ $ee0000 + SRAM_CHECKID: .equ $ed0000 SRAM_MEMSIZE: .equ $ed0008 SRAM_ROMBOOT: .equ $ed000c diff --git a/src/vector.mac b/src/vector.mac index 3521f62..368aed2 100644 --- a/src/vector.mac +++ b/src/vector.mac @@ -1,7 +1,7 @@ .nlist -# vector.mac version 2.0.0 -# RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# vector.mac - RUKA assembler macro for X680x0/Human68k(v3) by TcbnErik +# Last-modified: 2023-09-20 # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright