Some old and some new demo stuff

Last Updated or created 2023-10-05

A dentro (Combination of demo and intro.) from 1995

It using only background colors behind existing text to display the dentro text. There is (somewhere) a version with animations.

New work:

Booting from floppy, showing a flash screen in mode 13h.
Starting a trackloader, which loads a raw adlib file and plays it.
All sectors written to floppy using my new sector writer.
WOOT .. music at boot time!

Sector writer

use16
org 0100h
; 0 0 1
; bootblock with flashcode
	mov cl,1  ; start
	mov al,1  ; # sectors
	mov dh,0  ; head
	mov bx,bootblock
	call wrtsector

; flash image
	mov cl,8
	mov al,4
	mov dh,0
	mov bx,gfx
	call wrtsector

; Music loader
	mov cl,7  ; start
	mov al,1  ; # sectors
	mov dh,0  ; head
	mov bx,nextpart
	call wrtsector

; Music raw
	mov cl,13  ; start
	mov al,4  ; # sectors
	mov dh,0  ; head
	mov bx,musicraw
	call wrtsector

	jmp do_exit

printerror:
	push cs		; make ds same as cs
	pop ds
	MOV DX,TxtErr1	; error
	MOV AH,09h
	INT 21h
	mov ax,4c00h
	int 21h
do_exit:
	mov ax,4c00h
	int 21h
wrtsector:
;       On entry:      AH         03h
;                      AL         Number of sectors to write
;                      CH         Cylinder number (10-bit value; upper 2 bits
;                                 in CL)
;                      CL         Starting sector number
;                      DH         Head number
;                      DL         Drive number
;                      ES:BX      Address of memory buffer
; 
;       Returns:       AH         Status of operation (See Service 01h)
;                      AL         Number of sectors written
;                      CF         Set if error, else cleared

	cld
	mov ah, 3h    ; int13h function 2
	mov ch, 0     ; from cylinder number 0
	mov dl,0
	push cs 
	pop es
	int 13h
	jc printerror
ret

TxtErr1:	 DB "Error!",7,10,13,"$"

bootblock:
	file 'flash_b.bin'
gfx:
	file 'flashgfx.raw'
nextpart:
	file 'nextpart.bin'
musicraw:
	file 'LVLINTRO.RAW' 

I wanted to know how a floppy differs from a floppy.
So i wrote below code to fill each sector on a floppy disk or image with information at the start of each sector.
(Head, Cylinder and Sector)

empty.bin was made using
dd if=/dev/zero of=empty.bin count=1 bs=512

use16
org 0100h

	mov ch,0  ; cyl
	mov cl,1  ; sector
	mov dh,0  ; head
nextsector:
	mov bx,empty
	mov [empty],dh
	mov [empty+1],ch
	mov [empty+2],cl
	push cx
	push ax
	push dx
	call printer
	call wrtsector
	pop dx
	pop ax
	pop ax
	inc cl
	cmp cl,19
	jnz nextsector
	mov cl,1
	inc ch
	cmp ch,79
	jnz nextsector
; other side
	mov dh,1
	mov ch,0
	mov cl,1

nextsector1:
	mov bx,empty
	mov [empty],dh
	mov [empty+1],ch
	mov [empty+2],cl
	push cx
	push ax
	push dx
	call wrtsector
	pop dx
	pop ax
	pop ax
	inc cl
	cmp cl,19
	jnz nextsector1
	mov cl,1
	inc ch
	cmp ch,79
	jnz nextsector1


	jmp do_exit

printerror:
	push cs		; make ds same as cs
	pop ds
	MOV AX,3	; default text mode 3
	INT 10h
	MOV DX,TxtErr1	; error
	MOV AH,09h
	INT 21h
	mov ax,4c00h
	int 21h


do_exit:
	mov ax,3
	int 10h
	mov ax,4c00h
	int 21h

printer:
	push cx
	push dx
	mov dl,dh
	mov ah, 02h
	add dl, 30h
	int 21h
	mov dl,ch
	add dl, 30h
	int 21h
	mov dl,cl 
	add dl, 30h
	int 21h
	mov dx,13
  mov ah,2
  int 21h  
  mov dx,10
  mov ah,2
  int 21h
	pop dx
	pop cx
	ret

wrtsector:
;       On entry:      AH         03h
;                      AL         Number of sectors to write
;                      CH         Cylinder number (10-bit value; upper 2 bits
;                                 in CL)
;                      CL         Starting sector number
;                      DH         Head number
;                      DL         Drive number
;                      ES:BX      Address of memory buffer
; 
;       Returns:       AH         Status of operation (See Service 01h)
;                      AL         Number of sectors written
;                      CF         Set if error, else cleared
;

	cld
	mov ah, 3h    ; int13h function 2
	mov al,1
	mov dl,0
	push cs 
	pop es
	int 13h
	jc printerror
ret

TxtErr1:	 DB "Error!",7,10,13,"$"

empty:
	file 'empty.bin'

Viewing the floppy image with ghex

Offset 7000 = Head 1, Cylinder 1 and sector 3

When doing
times 512 – ($-$$) db 0
to fill binaries to 512 bytes, you could cat the sectors to a disk/file with this knowledge.

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *