cmp #MAX_FDS
bcs error
- .if .sizeof(FD) = 4
; Convert handle to fdtab slot
+ .assert .sizeof(FD) = 4, error
asl
asl
- .else
- .error "Assertion failed"
- .endif
-
; Check for fdtab slot in use
tay
lda fdtab + FD::REF_NUM,y
.data
-fdtab: .if .sizeof(FD) = 4
+fdtab: .assert .sizeof(FD) = 4, error
.byte $80 ; STDIN_FILENO ::REF_NUM
.byte O_RDONLY ; STDIN_FILENO ::FLAGS
.byte O_WRONLY ; STDERR_FILENO::FLAGS
.addr $0000 ; STDERR_FILENO::BUFFER
- .else
- .error "Assertion failed"
- .endif
-
.res (MAX_FDS - 3) * .sizeof(FD)
: lda fdtab + FD::REF_NUM,y
beq found
- .if .sizeof(FD) = 4
-
; Advance to next fdtab slot
+ .assert .sizeof(FD) = 4, error
iny
iny
iny
iny
- .else
- .error "Assertion failed"
- .endif
-
; Check for end of fdtab
cpy #MAX_FDS * .sizeof(FD)
bcc :-
and #O_CREAT
beq open
- .if MLI::CREATE::PATHNAME = MLI::OPEN::PATHNAME
-
; PATHNAME already set
-
- .else
- .error "Assertion failed"
- .endif
+ .assert MLI::CREATE::PATHNAME = MLI::OPEN::PATHNAME, error
; Set all other parameters from template
ldx #(MLI::CREATE::CREATE_TIME+1) - (MLI::CREATE::PATHNAME+1) - 1
beq open
lda #$47 ; "Duplicate filename"
-
+
; Cleanup name
oserr2: jsr popname ; Preserves A
pha ; Save oserror code
jsr freebuffer
pla ; Restore oserror code
-
+
; Return oserror
jmp oserrexit
done: lda tmp1 ; Restore fd
sta fdtab + FD::REF_NUM,y
- .if .sizeof(FD) = 4
-
; Convert fdtab slot to handle
+ .assert .sizeof(FD) = 4, error
tya
lsr
lsr
- .else
- .error "Assertion failed"
- .endif
-
; Cleanup name
jsr popname ; Preserves A
-
+
; Return success
ldx #$00
rts
jsr callmli
bcs oserr
- .if MLI::MARK::REF_NUM = MLI::EOF::REF_NUM
; REF_NUM already set
+ .assert MLI::MARK::REF_NUM = MLI::EOF::REF_NUM, error
- .else
- .error "Assertion failed"
- .endif
-
- .if MLI::MARK::POSITION = MLI::EOF::EOF
; POSITION already set
-
- .else
- .error "Assertion failed"
- .endif
+ .assert MLI::MARK::POSITION = MLI::EOF::EOF, error
; Set file pointer
lda #SET_MARK_CALL
; Return oserror
oserr: jmp oserrexit
+