Test with easier to implement EQU syntax

This commit is contained in:
Nero 2019-10-15 20:19:55 +00:00
parent 7dec8b6c81
commit 4abfab2812
2 changed files with 26 additions and 27 deletions

View File

@ -1,25 +1,25 @@
; diskbuf needs to be defined
; User-accessible part of FCB (12 bytes)
%define fcb_drv 0 ; 1 byte, 1=A: 2=B: 3=C:
%define fcb_fn 1 ; 8 bytes
%define fcb_ext 9 ; 3 bytes
fcb_drv: equ 0 ; 1 byte, 1=A: 2=B: 3=C:
fcb_fn: equ 1 ; 8 bytes
fcb_ext: equ 9 ; 3 bytes
; Drive & FS data (6 bytes)
%define fcb_spt 12 ; byte sectors per track
%define fcb_nos 13 ; byte number of sides/heads
%define fcb_ss 14 ; byte sector size: 0=128, 1=256, 2=512, ...
%define fcb_cs 15 ; byte cluster size: 0=128, 1=256, 2=512, ...
%define fcb_co 16 ; word start sector for theoretical cluster 0
fcb_spt: equ 12 ; byte sectors per track
fcb_nos: equ 13 ; byte number of sides/heads
fcb_ss: equ 14 ; byte sector size: 0=128, 1=256, 2=512, ...
fcb_cs: equ 15 ; byte cluster size: 0=128, 1=256, 2=512, ...
fcb_co: equ 16 ; word start sector for theoretical cluster 0
; Read/Write pointer (6 bytes)
%define fcb_left 18 ; word number of bytes left to read from diskbuf
%define fcb_off 20 ; dword offset in disk (not in file)
fcb_left: equ 18 ; word number of bytes left to read from diskbuf
fcb_off: equ 20 ; dword offset in disk (not in file)
; Link to directory item (4 bytes)
%define fcb_ds 24 ; dword offset of directory item
fcb_ds: equ 24 ; dword offset of directory item
%define fcb_end 32
fcb_end: equ 32
fcb_open_rootdir:
mov dl, 0x01
@ -40,8 +40,11 @@ fcb_open_rootdir:
; copy sector size
mov ax, [diskbuf + 0x0B]
; ... save as number of valid bytes in diskbuf
mov WORD [bx+fcb_left], ax
call log2
sub ax, 7
; ... save as sector size
mov byte [bx+fcb_ss], al
; copy cluster size
@ -51,17 +54,14 @@ fcb_open_rootdir:
add al, [bx+fcb_ss]
mov byte [bx+fcb_cs], al
; transfer sectors per track
; copy sectors per track
mov al, [diskbuf + 0x18]
mov byte [bx+fcb_spt], al
; transfer number of heads/sides
; copy number of heads/sides
mov al, [diskbuf + 0x1A]
mov byte [bx+fcb_nos], al
; first 128 bytes are always valid
mov WORD [bx+fcb_left], 0x80
ret
fcb_get_sector_mask:

View File

@ -1,24 +1,23 @@
cpu 8086
; Memory layout (starting from top)
%define self 0xF000
; A single sector for deblocking
%define diskbuf (self-0x200)
%define stack (diskbuf)
%define default_drive BYTE [0x4]
self: equ 0xF000
diskbuf: equ (self-0x200) ; deblocking
stack: equ (diskbuf) ; grows down
defdrv: equ 4
org self
jmp init
pad 3
self_offset:
db (self >> 8)
banner:
db "RDOS 2019-09", 0x0A, 0x0D, '$', 0
init:
mov sp, stack
mov default_drive, 0x01
mov byte [defdrv], 0x01
mov dx, banner
call print_string