Skip to content

Commit

Permalink
feat: add filesys.mac and process.mac
Browse files Browse the repository at this point in the history
  • Loading branch information
kg68k committed Sep 20, 2023
1 parent 3b2f17b commit 4c472cc
Show file tree
Hide file tree
Showing 17 changed files with 319 additions and 31 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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 内のドライブ、ファイル関係の定義は将来削除するかも。

4 changes: 2 additions & 2 deletions src/console.mac
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/doscall.mac
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 15 additions & 2 deletions src/dosdef.mac
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/fefunc.mac
Original file line number Diff line number Diff line change
@@ -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
Expand Down
143 changes: 143 additions & 0 deletions src/filesys.mac
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions src/iocscall.mac
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/iocsdef.mac
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,6 +13,7 @@
__iocsdef_mac__:=1

.include iocscall.mac
.nlist


* Structure ----------------------------------- *
Expand Down
4 changes: 2 additions & 2 deletions src/iocswork.mac
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/iomap.mac
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/keycode.mac
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 12 additions & 5 deletions src/macro.mac
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 4c472cc

Please sign in to comment.