wok rev 24476

Add some current_version
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Feb 18 09:29:30 2022 +0000 (2022-02-18)
parents 7efe09103840
children 73cd26fd8ff2
files BootProg/receipt BootProg/stuff/boot16.asm BootProg/stuff/boot32.asm BootProg/stuff/bootex.asm BootProg/stuff/bootprog.sh SkypeFreak/receipt adbfs-rootless/receipt clicfs/receipt connman-ui/receipt dasm/receipt ecj/receipt eduke32/receipt fuse-rofs/receipt hdf5/receipt imapbox/receipt jsmin/receipt libsde-utils-jansson/receipt libsde-utils-x11/receipt libzen/receipt linux-libre-api-headers/receipt linux-libre/receipt lvmts/receipt mesa-demos/receipt mesa/receipt ocsinventory-agent/receipt ocsinventory/receipt openshot/receipt pi-blaster/receipt piclass-code-examples/receipt pifmrds/receipt pwnat/receipt python-pyajam/receipt python-rpi-adafruit/receipt rcswitch-pi/receipt reiserfsprogs/receipt vanessa_socket/receipt vlc-plugin/receipt vzquota/receipt
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/BootProg/receipt	Fri Feb 18 09:29:30 2022 +0000
     1.3 @@ -0,0 +1,33 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="BootProg"
     1.7 +VERSION="slitaz"
     1.8 +CATEGORY="base-system"
     1.9 +SHORT_DESC="FAT12/16/32 Bootsector for .COMs/.EXEs"
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +LICENSE="MIT"
    1.12 +#TARBALL="$PACKAGE-$VERSION.tar.zip"
    1.13 +WEB_SITE="https://wiki.osdev.org/BootProg"
    1.14 +#WGET_URL="$WEB_SITE/archive/refs/heads/master.zip"
    1.15 +
    1.16 +BUILD_DEPENDS="nasm"
    1.17 +
    1.18 +# Rules to configure and make the package.
    1.19 +compile_rules()
    1.20 +{
    1.21 +	for i in bootex boot16 boot32 ; do
    1.22 +		nasm $stuff/$i.asm -f bin $i.bin -l $i.lst
    1.23 +	done
    1.24 +	sed '1,/^exit 1/!d' $stuff/bootprog.sh > bootprog
    1.25 +	tar czf - boot16.bin boot32.bin bootex.bin > set.tar.gz
    1.26 +	[ "$(which advdef)" ] && advdef -z4 set.tar.gz
    1.27 +	cat set.tar.gz >> bootprog
    1.28 +	chmod +x bootprog
    1.29 +}
    1.30 +
    1.31 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.32 +genpkg_rules()
    1.33 +{
    1.34 +	mkdir -p $fs/usr/bin
    1.35 +	cp -a $src/bootprog $fs/usr/bin
    1.36 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/BootProg/stuff/boot16.asm	Fri Feb 18 09:29:30 2022 +0000
     2.3 @@ -0,0 +1,593 @@
     2.4 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     2.5 +;;                                                                          ;;
     2.6 +;;         "BootProg" Loader v 1.5 by Alexey Frunze (c) 2000-2015           ;;
     2.7 +;;                           2-clause BSD license.                          ;;
     2.8 +;;                                                                          ;;
     2.9 +;;                                                                          ;;
    2.10 +;;                              How to Compile:                             ;;
    2.11 +;;                              ~~~~~~~~~~~~~~~                             ;;
    2.12 +;; nasm boot16.asm -f bin -o boot16.bin                                     ;;
    2.13 +;;                                                                          ;;
    2.14 +;;                                                                          ;;
    2.15 +;;                                 Features:                                ;;
    2.16 +;;                                 ~~~~~~~~~                                ;;
    2.17 +;; - FAT12 and FAT16 supported using BIOS int 13h function 42h or 02h.      ;;
    2.18 +;;                                                                          ;;
    2.19 +;; - Loads a 16-bit executable file in the MS-DOS .COM or .EXE format       ;;
    2.20 +;;   from the root directory of a disk and transfers control to it          ;;
    2.21 +;;   (the "ProgramName" variable holds the name of the file to be loaded)   ;;
    2.22 +;;   Its maximum size can be up to 635KB without Extended BIOS Data area.   ;;
    2.23 +;;                                                                          ;;
    2.24 +;; - Prints an error if the file isn't found or couldn't be read            ;;
    2.25 +;;   ("File not found" or "Read error")                                     ;;
    2.26 +;;   and waits for a key to be pressed, then executes the Int 19h           ;;
    2.27 +;;   instruction and lets the BIOS continue bootstrap.                      ;;
    2.28 +;;                                                                          ;;
    2.29 +;; - cpu 8086 is supported                                                  ;;
    2.30 +;;                                                                          ;;
    2.31 +;;                                                                          ;;
    2.32 +;;                             Known Limitations:                           ;;
    2.33 +;;                             ~~~~~~~~~~~~~~~~~~                           ;;
    2.34 +;; - Works only on the 1st MBR partition which must be a PRI DOS partition  ;;
    2.35 +;;   with FAT12 (File System ID: 1) and FAT16 (File System ID: 4, 6)        ;;
    2.36 +;;                                                                          ;;
    2.37 +;;                                                                          ;;
    2.38 +;;                                Known Bugs:                               ;;
    2.39 +;;                                ~~~~~~~~~~~                               ;;
    2.40 +;; - All bugs are fixed as far as I know. The boot sector has been tested   ;;
    2.41 +;;   on the following types of diskettes (FAT12):                           ;;
    2.42 +;;   - 360KB 5"25                                                           ;;
    2.43 +;;   - 1.2MB 5"25                                                           ;;
    2.44 +;;   - 1.44MB 3"5                                                           ;;
    2.45 +;;   on my HDD (FAT16).                                                     ;;
    2.46 +;;                                                                          ;;
    2.47 +;;                                                                          ;;
    2.48 +;;                               Memory Layout:                             ;;
    2.49 +;;                               ~~~~~~~~~~~~~~                             ;;
    2.50 +;; The diagram below shows the typical memory layout. The actual location   ;;
    2.51 +;; of the boot sector and its stack may be lower than A0000H if the BIOS    ;;
    2.52 +;; reserves memory for its Extended BIOS Data Area just below A0000H and    ;;
    2.53 +;; reports less than 640 KB of RAM via its Int 12H function.                ;;
    2.54 +;;                                                                          ;;
    2.55 +;;                                            physical address              ;;
    2.56 +;;                 +------------------------+ 00000H                        ;;
    2.57 +;;                 | Interrupt Vector Table |                               ;;
    2.58 +;;                 +------------------------+ 00400H                        ;;
    2.59 +;;                 |     BIOS Data Area     |                               ;;
    2.60 +;;                 +------------------------+ 00500H                        ;;
    2.61 +;;                 | PrtScr Status / Unused |                               ;;
    2.62 +;;                 +------------------------+ 00600H                        ;;
    2.63 +;;                 |      Loaded Image      |                               ;;
    2.64 +;;                 +------------------------+ nnnnnH                        ;;
    2.65 +;;                 |    Available Memory    |                               ;;
    2.66 +;;                 +------------------------+ A0000H - 512 - 3KB            ;;
    2.67 +;;                 |       Boot Sector      |                               ;;
    2.68 +;;                 +------------------------+ A0000H - 3KB                  ;;
    2.69 +;;                 |     3KB Boot Stack     |                               ;;
    2.70 +;;                 +------------------------+ A0000H                        ;;
    2.71 +;;                 |        Video RAM       |                               ;;
    2.72 +;;                                                                          ;;
    2.73 +;;                                                                          ;;
    2.74 +;;                   Boot Image Startup (register values):                  ;;
    2.75 +;;                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                  ;;
    2.76 +;;  dl = BIOS boot drive number (e.g. 0, 80H)                               ;;
    2.77 +;;  cs:ip = program entry point                                             ;;
    2.78 +;;  ss:sp = program stack (don't confuse with boot sector's stack)          ;;
    2.79 +;;  COM program defaults: cs = ds = es = ss = 50h, sp = 0, ip = 100h        ;;
    2.80 +;;  EXE program defaults: ds = es = EXE data - 10h (fake MS-DOS psp),       ;;
    2.81 +;;  ax = 0ffffh (both FCB in the PSP don't have a valid drive identifier),  ;;
    2.82 +;;  cs:ip and ss:sp depends on EXE header                                   ;;
    2.83 +;;  Magic numbers:                                                          ;;
    2.84 +;;    si = 16381 (prime number 2**14-3)                                     ;;
    2.85 +;;    di = 32749 (prime number 2**15-19)                                    ;;
    2.86 +;;    bp = 65521 (prime number 2**16-15)                                    ;;
    2.87 +;;  The magic numbers let the program know whether it has been loaded by    ;;
    2.88 +;;  this boot sector or by MS-DOS, which may be handy for universal, bare-  ;;
    2.89 +;;  metal and MS-DOS programs.                                              ;;
    2.90 +;;                                                                          ;;
    2.91 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    2.92 +
    2.93 +%define bx(label)       bx+label-boot
    2.94 +
    2.95 +[BITS 16]
    2.96 +[CPU 8086]
    2.97 +
    2.98 +?                       equ     0
    2.99 +ImageLoadSeg            equ     60h
   2.100 +StackSize               equ     3072            ; Stack + cluster list
   2.101 +
   2.102 +[SECTION .text]
   2.103 +[ORG 0]
   2.104 +
   2.105 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.106 +;; Boot sector starts here ;;
   2.107 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.108 +
   2.109 +boot:
   2.110 +        jmp     short   start                   ; MS-DOS/Windows checks for this jump
   2.111 +        nop
   2.112 +bsOemName               DB      "BootProg"      ; 0x03
   2.113 +
   2.114 +;;;;;;;;;;;;;;;;;;;;;
   2.115 +;; BPB starts here ;;
   2.116 +;;;;;;;;;;;;;;;;;;;;;
   2.117 +
   2.118 +bpbBytesPerSector       DW      ?               ; 0x0B
   2.119 +bpbSectorsPerCluster    DB      ?               ; 0x0D
   2.120 +bpbReservedSectors      DW      ?               ; 0x0E
   2.121 +bpbNumberOfFATs         DB      ?               ; 0x10
   2.122 +bpbRootEntries          DW      ?               ; 0x11
   2.123 +bpbTotalSectors         DW      ?               ; 0x13
   2.124 +bpbMedia                DB      ?               ; 0x15
   2.125 +bpbSectorsPerFAT        DW      ?               ; 0x16
   2.126 +bpbSectorsPerTrack      DW      ?               ; 0x18
   2.127 +bpbHeadsPerCylinder     DW      ?               ; 0x1A
   2.128 +bpbHiddenSectors        DD      ?               ; 0x1C
   2.129 +bpbTotalSectorsBig      DD      ?               ; 0x20
   2.130 +
   2.131 +;;;;;;;;;;;;;;;;;;;
   2.132 +;; BPB ends here ;;
   2.133 +;;;;;;;;;;;;;;;;;;;
   2.134 +
   2.135 +bsDriveNumber           DB      ?               ; 0x24
   2.136 +bsUnused                DB      ?               ; 0x25
   2.137 +bsExtBootSignature      DB      ?               ; 0x26
   2.138 +bsSerialNumber          DD      ?               ; 0x27
   2.139 +bsVolumeLabel           DB      "NO NAME    "   ; 0x2B
   2.140 +bsFileSystem            DB      "FAT12   "      ; 0x36
   2.141 +
   2.142 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.143 +;; Boot sector code starts here ;;
   2.144 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.145 +
   2.146 +start:
   2.147 +        cld
   2.148 +
   2.149 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.150 +;; How much RAM is there? ;;
   2.151 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.152 +
   2.153 +        int     12h             ; get conventional memory size (in KBs)
   2.154 +        mov     cx, 106h
   2.155 +        shl     ax, cl          ; and convert it to 16-byte paragraphs
   2.156 +
   2.157 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.158 +;; Reserve memory for the boot sector and its stack ;;
   2.159 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.160 +
   2.161 +        sub     ax, (512+StackSize) /16 ; reserve bytes for the code and the stack
   2.162 +        mov     es, ax                  ; cs:0 = ds:0 = ss:0 -> top - 512 - StackSize
   2.163 +        mov     ss, ax
   2.164 +        mov     sp, 512+StackSize       ; bytes 0-511 are reserved for the boot code
   2.165 +
   2.166 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.167 +;; Copy ourselves to top of memory ;;
   2.168 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.169 +
   2.170 +        mov     si, 7C00h
   2.171 +        xor     di, di
   2.172 +        mov     ds, di
   2.173 +        mov     [si], dx                ; store BIOS boot drive number
   2.174 +        rep     movsw                   ; move 512 bytes (+ 12)
   2.175 +
   2.176 +;;;;;;;;;;;;;;;;;;;;;;
   2.177 +;; Jump to the copy ;;
   2.178 +;;;;;;;;;;;;;;;;;;;;;;
   2.179 +
   2.180 +        push    es
   2.181 +        mov     cl, byte main
   2.182 +        push    cx
   2.183 +        retf
   2.184 +
   2.185 +main:
   2.186 +     %if ImageLoadSeg != main-boot
   2.187 +      %if ImageLoadSeg >= 100h
   2.188 +        mov     cx, ImageLoadSeg
   2.189 +      %else
   2.190 +        mov     cl, ImageLoadSeg
   2.191 +      %endif
   2.192 +     %endif
   2.193 +        push    cx
   2.194 +
   2.195 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.196 +;; Get drive parameters ;;
   2.197 +;; Update heads count   ;;
   2.198 +;; for current BIOS     ;;
   2.199 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.200 +
   2.201 +        mov     ah, 8
   2.202 +        int     13h                     ; may destroy SI,BP, and DS registers
   2.203 +                                        ; update AX,BL,CX,DX,DI, and ES registers
   2.204 +        push    cs
   2.205 +        pop     ds
   2.206 +        xor     bx, bx
   2.207 +
   2.208 +        and     cx, 3Fh
   2.209 +        cmp     [bx(bpbSectorsPerTrack)], cx
   2.210 +        jne     BadParams               ; verify updated and validity
   2.211 +        mov     al, dh
   2.212 +        inc     ax
   2.213 +        mov     [bpbHeadsPerCylinder], ax
   2.214 +BadParams:
   2.215 +
   2.216 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.217 +;; Load FAT (FAT12: 6KB max, FAT16: 128KB max) ;;
   2.218 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.219 +
   2.220 +        pop     es                      ; ImageLoadSeg
   2.221 +        push    es
   2.222 +
   2.223 +        mul     bx                      ; dx:ax = 0 = LBA (LBA are relative to FAT)
   2.224 +        mov     cx, word [bx(bpbSectorsPerFAT)]
   2.225 +
   2.226 +        call    ReadCXSectors           ; read fat and clear cx
   2.227 +
   2.228 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.229 +;; load the root directory in ;;
   2.230 +;; its entirety (16KB max)    ;;
   2.231 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.232 +
   2.233 +        mov     ax, 32
   2.234 +
   2.235 +        mul     word [bx(bpbRootEntries)]
   2.236 +        div     word [bx(bpbBytesPerSector)]
   2.237 +        xchg    ax, cx                  ; cx = root directory size in sectors, clear ax
   2.238 +
   2.239 +        mov     al, [bpbNumberOfFATs]
   2.240 +        mul     bp                      ; [bx(bpbSectorsPerFAT)], set by ReadCXSectors
   2.241 +
   2.242 +        push    es
   2.243 +        call    ReadCXSectors           ; read root directory, clear cx and di
   2.244 +        pop     es
   2.245 +
   2.246 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.247 +;; Look for the COM/EXE file to load and run ;;
   2.248 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.249 +
   2.250 +                                        ; es:di -> root entries array
   2.251 +
   2.252 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.253 +;; Looks for the file/dir ProgramName    ;;
   2.254 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.255 +;; Input:  ES:DI -> root directory array ;;
   2.256 +;; Output: SI = cluster number           ;;
   2.257 +;;         AX = file sector count        ;;
   2.258 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.259 +
   2.260 +FindNameCycle:
   2.261 +        cmp     byte [es:di], ch
   2.262 +        je      FindNameFailed          ; end of root directory (NULL entry found)
   2.263 +        push    di
   2.264 +        mov     cl, 11
   2.265 +        mov     si, ProgramName         ; ds:si -> program name
   2.266 +        repe    cmpsb
   2.267 +        pop     di
   2.268 +        je      FindNameFound
   2.269 +        add     di, 32
   2.270 +        dec     word [bx(bpbRootEntries)]
   2.271 +        jnz     FindNameCycle           ; next root entry
   2.272 +
   2.273 +FindNameFailed:
   2.274 +        call    Error
   2.275 +        db      "File not found."
   2.276 +
   2.277 +FindNameFound:
   2.278 +        push    si
   2.279 +        mov     si, [es:di+1Ah]         ; si = cluster no.
   2.280 +        les     ax, [es:di+1Ch]         ; file size
   2.281 +        mov     dx, es
   2.282 +        div     word [bx(bpbBytesPerSector)]
   2.283 +        cmp     bx, dx                  ; sector aligned ?
   2.284 +        adc     ax, bx                  ; file last sector
   2.285 +        pop     di                      ; di = ClusterList
   2.286 +
   2.287 +        pop     es                      ; ImageLoadSeg
   2.288 +        push    ax
   2.289 +
   2.290 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.291 +;; build cluster list         ;;
   2.292 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.293 +;; Input:  ES:0 -> FAT        ;;
   2.294 +;;         SI = first cluster ;;
   2.295 +;;         DI = cluster list  :;
   2.296 +;;         CH = 0             ;;
   2.297 +;; Output: SI = cluster list  ;;
   2.298 +;;         CH = 0             ;;
   2.299 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.300 +
   2.301 +        push    di                      ; up to 2 * 635K / BytesPerCluster bytes
   2.302 +        mov     cl, 12
   2.303 +ClusterLoop:
   2.304 +        mov     [di], si
   2.305 +
   2.306 +        mov     ax, es                  ; ax = FAT segment = ImageLoadSeg
   2.307 +        add     si, si                  ; si = cluster * 2
   2.308 +        jnc     First64
   2.309 +        mov     ah, (1000h+ImageLoadSeg)>>8 ; adjust segment for 2nd part of FAT16
   2.310 +First64:
   2.311 +        cmp     [bx(bpbSectorsPerFAT)], cx ; 1..12 = FAT12, 16..256 = FAT16
   2.312 +        mov     ds, ax
   2.313 +        jbe     ReadClusterFat12
   2.314 +
   2.315 +        lodsw                           ; ax = next cluster
   2.316 +        cmp     ax, 0FFF8h
   2.317 +        jmp     ReadClusterDone
   2.318 +
   2.319 +ReadClusterFat12:
   2.320 +        add     si, [cs:di]
   2.321 +        shr     si, 1                   ; si = cluster * 3 / 2
   2.322 +
   2.323 +        lodsw                           ; ax = next cluster
   2.324 +        jnc     ReadClusterEven
   2.325 +
   2.326 +        rol     ax, cl
   2.327 +
   2.328 +ReadClusterEven:
   2.329 +        and     ax, 0FFFh               ; mask cluster value
   2.330 +        cmp     ax, 0FF8h
   2.331 +
   2.332 +ReadClusterDone:
   2.333 +        push    cs
   2.334 +        pop     ds
   2.335 +        inc     di
   2.336 +        inc     di
   2.337 +        xchg    ax, si
   2.338 +        jc      ClusterLoop
   2.339 +        pop     si
   2.340 +        pop     di                      ; file size in sectors
   2.341 +
   2.342 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.343 +;; Load the entire file      ;;
   2.344 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.345 +;; Input:  ES:0 -> buffer    ;;
   2.346 +;;         SI = cluster list ;;
   2.347 +;;         DI = file sectors ;;
   2.348 +;;         CH = 0            ;;
   2.349 +;; Output: BP:0 -> buffer    ;;
   2.350 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.351 +
   2.352 +        push    es
   2.353 +
   2.354 +ReadClusters:
   2.355 +        lodsw
   2.356 +        dec     ax
   2.357 +        dec     ax
   2.358 +
   2.359 +        mov     cl, [bx(bpbSectorsPerCluster)]
   2.360 +        mul     cx                      ; cx = sector count (ch = 0)
   2.361 +
   2.362 +        add     ax, bp                  ; LBA for cluster data
   2.363 +        adc     dx, bx                  ; dx:ax = LBA
   2.364 +
   2.365 +        call    ReadSector              ; clear cx
   2.366 +
   2.367 +        jne     ReadClusters
   2.368 +
   2.369 +        pop     bp                      ; ImageLoadSeg
   2.370 +
   2.371 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.372 +;; Type detection, .COM or .EXE? ;;
   2.373 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.374 +
   2.375 +        mov     ds, bp                  ; bp=ds=seg the file is loaded to
   2.376 +
   2.377 +        add     bp, [bx+08h]            ; bp = image base
   2.378 +        mov     ax, [bx+06h]            ; ax = reloc items
   2.379 +        mov     di, [bx+18h]            ; di = reloc table pointer
   2.380 +
   2.381 +        cmp     word [bx], 5A4Dh        ; "MZ" signature?
   2.382 +        je      RelocateEXE             ; yes, it's an EXE program
   2.383 +
   2.384 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.385 +;; Setup and run a .COM program ;;
   2.386 +;; Set CS=DS=ES=SS SP=0 IP=100h ;;
   2.387 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.388 +
   2.389 +        mov     bp, ImageLoadSeg-10h    ; "org 100h" stuff :)
   2.390 +        mov     ss, bp
   2.391 +        xor     sp, sp
   2.392 +        push    bp                      ; cs, ds and es
   2.393 +        mov     bh, 1                   ; ip
   2.394 +        jmp     short Run
   2.395 +
   2.396 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.397 +;; Relocate, setup and run a .EXE program     ;;
   2.398 +;; Set CS:IP, SS:SP, DS, ES and AX according  ;;
   2.399 +;; to wiki.osdev.org/MZ#Initial_Program_State ;;
   2.400 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.401 +
   2.402 +ReloCycle:
   2.403 +        add     [di+2], bp              ; item seg (abs)
   2.404 +        les     si, [di]                ; si = item ofs, es = item seg
   2.405 +        add     [es:si], bp             ; fixup
   2.406 +        scasw                           ; di += 2
   2.407 +        scasw                           ; point to next entry
   2.408 +
   2.409 +RelocateEXE:
   2.410 +        dec     ax                      ; 32768 max (128KB table)
   2.411 +        jns     ReloCycle               ; leave with ax=0ffffh: both FCB in the
   2.412 +                                        ; PSP don't have a valid drive identifier
   2.413 +        les     si, [bx+0Eh]
   2.414 +        add     si, bp
   2.415 +        mov     ss, si                  ; ss for EXE
   2.416 +        mov     sp, es                  ; sp for EXE
   2.417 +
   2.418 +        lea     si, [bp-10h]            ; ds and es both point to the segment
   2.419 +        push    si                      ; containing the PSP structure
   2.420 +
   2.421 +        add     bp, [bx+16h]            ; cs for EXE
   2.422 +        mov     bx, [bx+14h]            ; ip for EXE
   2.423 +Run:
   2.424 +        pop     ds
   2.425 +        push    bp
   2.426 +        push    bx
   2.427 +        push    ds
   2.428 +        pop     es
   2.429 +
   2.430 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.431 +;; Set the magic numbers so the program knows that it   ;;
   2.432 +;; has been loaded by this bootsector and not by MS-DOS ;;
   2.433 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.434 +        mov     si, 16381 ; prime number 2**14-3
   2.435 +        mov     di, 32749 ; prime number 2**15-19
   2.436 +        mov     bp, 65521 ; prime number 2**16-15
   2.437 +
   2.438 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.439 +;; All done, transfer control to the program now ;;
   2.440 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.441 +        retf
   2.442 +
   2.443 +ReadCXSectors:
   2.444 +        mov     bp, cx
   2.445 +        add     bp, ax                  ; adjust LBA for cluster data
   2.446 +
   2.447 +        mov     di, cx                  ; no file size limit
   2.448 +
   2.449 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.450 +;; Reads sectors using BIOS Int 13h    ;;
   2.451 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.452 +;; Input:  DX:AX = LBA relative to FAT ;;
   2.453 +;;         BX    = 0                   ;;
   2.454 +;;         CX    = sector count        ;;
   2.455 +;;         DI    = file sectors        ;;
   2.456 +;;         ES:BX -> buffer address     ;;
   2.457 +;; Output: ES:BX -> next address       ;;
   2.458 +;;         BX    = 0                   ;;
   2.459 +;;         CX or DI = 0                ;;
   2.460 +;;         DL    = drive number        ;;
   2.461 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.462 +
   2.463 +ReadSector:
   2.464 +        add     ax, [bx(bpbHiddenSectors)]
   2.465 +        adc     dx, [bx(bpbHiddenSectors)+2]
   2.466 +        add     ax, [bx(bpbReservedSectors)]
   2.467 +
   2.468 +        push    si
   2.469 +ReadSectorNext:
   2.470 +        adc     dx, bx
   2.471 +        push    di
   2.472 +        push    cx
   2.473 +
   2.474 +        push    bx
   2.475 +        push    bx
   2.476 +        push    dx      ; 32-bit LBA: up to 2TB
   2.477 +        push    ax
   2.478 +        push    es
   2.479 +        push    bx
   2.480 +        inc     bx      ; sector count word = 1
   2.481 +        push    bx
   2.482 +        dec     bx
   2.483 +        mov     di, 16  ; packet size byte = 16, reserved byte = 0
   2.484 +        push    di
   2.485 +
   2.486 +        xchg    ax, cx                  ; save low LBA
   2.487 +        xchg    ax, dx                  ; get high LBA
   2.488 +        cwd                             ; clear dx (LBA offset <2TB)
   2.489 +        div     word [bx(bpbSectorsPerTrack)] ; up to 8GB disks
   2.490 +
   2.491 +        xchg    ax, cx                  ; restore low LBA, save high LBA / SPT
   2.492 +        div     word [bx(bpbSectorsPerTrack)]
   2.493 +                ; ax = LBA / SPT
   2.494 +                ; dx = LBA % SPT         = sector - 1
   2.495 +        inc     dx
   2.496 +
   2.497 +        xchg    cx, dx                  ; restore high LBA / SPT, save sector no.
   2.498 +        div     word [bx(bpbHeadsPerCylinder)]
   2.499 +                ; ax = (LBA / SPT) / HPC = cylinder
   2.500 +                ; dx = (LBA / SPT) % HPC = head
   2.501 +        mov     ch, al
   2.502 +                ; ch = LSB 0...7 of cylinder no.
   2.503 +        mov     al, 64
   2.504 +        mul     ah
   2.505 +        or      cl, al
   2.506 +                ; cl = MSB 8...9 of cylinder no. + sector no.
   2.507 +        mov     dh, dl
   2.508 +                ; dh = head no.
   2.509 +
   2.510 +ReadSectorRetry:
   2.511 +        mov     dl, [bx]
   2.512 +                ; dl = drive no.
   2.513 +        mov     ah, 42h                 ; ah = 42h = extended read function no.
   2.514 +        mov     si, sp
   2.515 +        int     13h                     ; extended read sectors (DL, DS:SI)
   2.516 +        jnc     ReadSectorNextSegment
   2.517 +
   2.518 +        mov     ax, 201h                ; al = sector count = 1
   2.519 +                                        ; ah = 2 = read function no.
   2.520 +        int     13h                     ; read sectors (AL, CX, DX, ES:BX)
   2.521 +
   2.522 +        jnc     ReadSectorNextSegment
   2.523 +        cbw                             ; ah = 0 = reset function
   2.524 +        int     13h                     ; reset drive (DL)
   2.525 +
   2.526 +        dec     di
   2.527 +        jnz     ReadSectorRetry         ; extra attempt
   2.528 +
   2.529 +        call    Error
   2.530 +        db      "Read error."
   2.531 +
   2.532 +ReadSectorNextSegment:
   2.533 +
   2.534 +        pop     ax                      ; al = 16
   2.535 +        mul     byte [bx(bpbBytesPerSector)+1] ;  = (bpbBytesPerSector/256)*16
   2.536 +        pop     cx                      ; sector count = 1
   2.537 +        pop     bx
   2.538 +        add     [si+6], ax              ; adjust segment for next sector
   2.539 +        pop     es                      ; es:0 updated
   2.540 +        pop     ax
   2.541 +        pop     dx
   2.542 +        pop     di
   2.543 +        pop     di
   2.544 +
   2.545 +        add     ax, cx                  ; adjust LBA for next sector
   2.546 +
   2.547 +        pop     cx                      ; cluster sectors to read
   2.548 +        pop     di                      ; file sectors to read
   2.549 +        dec     di                      ; keep C
   2.550 +        loopne  ReadSectorNext          ; until cluster sector count or file sector count is reached
   2.551 +        pop     si
   2.552 +        mov     dx, [bx]                ; pass the BIOS boot drive to Run or Error
   2.553 +
   2.554 +        ret
   2.555 +
   2.556 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.557 +;; Error Messaging Code ;;
   2.558 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.559 +
   2.560 +Error:
   2.561 +        pop     si
   2.562 +        mov     ah, 0Eh
   2.563 +        mov     bl, 7
   2.564 +
   2.565 +PutStr:
   2.566 +        lodsb
   2.567 +        int     10h
   2.568 +        cmp     al, "."
   2.569 +        jne     PutStr
   2.570 +
   2.571 +        cbw
   2.572 +        int     16h                     ; wait for a key...
   2.573 +        int     19h                     ; bootstrap
   2.574 +
   2.575 +Stop:
   2.576 +        hlt
   2.577 +        jmp     short Stop
   2.578 +
   2.579 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.580 +;; Fill free space with zeroes ;;
   2.581 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.582 +
   2.583 +                times (512-13-($-$$)) db 0
   2.584 +
   2.585 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.586 +;; Name of the file to load and run ;;
   2.587 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.588 +
   2.589 +ProgramName     db      "STARTUP BIN"   ; name and extension each must be
   2.590 +                                        ; padded with spaces (11 bytes total)
   2.591 +
   2.592 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.593 +;; End of the sector ID ;;
   2.594 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   2.595 +
   2.596 +ClusterList     dw      0AA55h          ; BIOS checks for this ID
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/BootProg/stuff/boot32.asm	Fri Feb 18 09:29:30 2022 +0000
     3.3 @@ -0,0 +1,543 @@
     3.4 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     3.5 +;;                                                                          ;;
     3.6 +;;         "BootProg" Loader v 1.5 by Alexey Frunze (c) 2000-2015           ;;
     3.7 +;;                           2-clause BSD license.                          ;;
     3.8 +;;                                                                          ;;
     3.9 +;;                                                                          ;;
    3.10 +;;                              How to Compile:                             ;;
    3.11 +;;                              ~~~~~~~~~~~~~~~                             ;;
    3.12 +;; nasm boot32.asm -f bin -o boot32.bin                                     ;;
    3.13 +;;                                                                          ;;
    3.14 +;;                                                                          ;;
    3.15 +;;                                 Features:                                ;;
    3.16 +;;                                 ~~~~~~~~~                                ;;
    3.17 +;; - FAT32 supported using BIOS int 13h function 42h or 02h.                ;;
    3.18 +;;                                                                          ;;
    3.19 +;; - Loads a 16-bit executable file in the MS-DOS .COM or .EXE format       ;;
    3.20 +;;   from the root directory of a disk and transfers control to it          ;;
    3.21 +;;   (the "ProgramName" variable holds the name of the file to be loaded)   ;;
    3.22 +;;   Its maximum size can be up to 636KB without Extended BIOS Data area.   ;;
    3.23 +;;                                                                          ;;
    3.24 +;; - Prints an error if the file isn't found or couldn't be read            ;;
    3.25 +;;   ("File not found" or "Read error")                                     ;;
    3.26 +;;   and waits for a key to be pressed, then executes the Int 19h           ;;
    3.27 +;;   instruction and lets the BIOS continue bootstrap.                      ;;
    3.28 +;;                                                                          ;;
    3.29 +;;                                                                          ;;
    3.30 +;;                             Known Limitations:                           ;;
    3.31 +;;                             ~~~~~~~~~~~~~~~~~~                           ;;
    3.32 +;; - Works only on the 1st MBR partition which must be a PRI DOS partition  ;;
    3.33 +;;   with FAT32 (File System ID: 0Bh,0Ch)                                   ;;
    3.34 +;;                                                                          ;;
    3.35 +;;                                                                          ;;
    3.36 +;;                                Known Bugs:                               ;;
    3.37 +;;                                ~~~~~~~~~~~                               ;;
    3.38 +;; - All bugs are fixed as far as I know. The boot sector has been tested   ;;
    3.39 +;;   on my HDD and an 8GB USB stick.                                        ;;
    3.40 +;;                                                                          ;;
    3.41 +;;                                                                          ;;
    3.42 +;;                               Memory Layout:                             ;;
    3.43 +;;                               ~~~~~~~~~~~~~~                             ;;
    3.44 +;; The diagram below shows the typical memory layout. The actual location   ;;
    3.45 +;; of the boot sector and its stack may be lower than A0000H if the BIOS    ;;
    3.46 +;; reserves memory for its Extended BIOS Data Area just below A0000H and    ;;
    3.47 +;; reports less than 640 KB of RAM via its Int 12H function.                ;;
    3.48 +;;                                                                          ;;
    3.49 +;;                                            physical address              ;;
    3.50 +;;                 +------------------------+ 00000H                        ;;
    3.51 +;;                 | Interrupt Vector Table |                               ;;
    3.52 +;;                 +------------------------+ 00400H                        ;;
    3.53 +;;                 |     BIOS Data Area     |                               ;;
    3.54 +;;                 +------------------------+ 00500H                        ;;
    3.55 +;;                 | PrtScr Status / Unused |                               ;;
    3.56 +;;                 +------------------------+ 00600H                        ;;
    3.57 +;;                 |      Loaded Image      |                               ;;
    3.58 +;;                 +------------------------+ nnnnnH                        ;;
    3.59 +;;                 |    Available Memory    |                               ;;
    3.60 +;;                 +------------------------+ A0000H - 2KB                  ;;
    3.61 +;;                 |       Boot Sector      |                               ;;
    3.62 +;;                 +------------------------+ A0000H - 1.5KB                ;;
    3.63 +;;                 |    1.5KB Boot Stack    |                               ;;
    3.64 +;;                 +------------------------+ A0000H                        ;;
    3.65 +;;                 |        Video RAM       |                               ;;
    3.66 +;;                                                                          ;;
    3.67 +;;                                                                          ;;
    3.68 +;;                   Boot Image Startup (register values):                  ;;
    3.69 +;;                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                  ;;
    3.70 +;;  dl = BIOS boot drive number (e.g. 80H)                                  ;;
    3.71 +;;  cs:ip = program entry point                                             ;;
    3.72 +;;  ss:sp = program stack (don't confuse with boot sector's stack)          ;;
    3.73 +;;  COM program defaults: cs = ds = es = ss = 50h, sp = 0, ip = 100h        ;;
    3.74 +;;  EXE program defaults: ds = es = EXE data - 10h (fake MS-DOS psp),       ;;
    3.75 +;;  ax = 0ffffh (both FCB in the PSP don't have a valid drive identifier),  ;;
    3.76 +;;  cs:ip and ss:sp depends on EXE header                                   ;;
    3.77 +;;  Magic numbers:                                                          ;;
    3.78 +;;    si = 16381 (prime number 2**14-3)                                     ;;
    3.79 +;;    di = 32749 (prime number 2**15-19)                                    ;;
    3.80 +;;    bp = 65521 (prime number 2**16-15)                                    ;;
    3.81 +;;  The magic numbers let the program know whether it has been loaded by    ;;
    3.82 +;;  this boot sector or by MS-DOS, which may be handy for universal, bare-  ;;
    3.83 +;;  metal and MS-DOS programs.                                              ;;
    3.84 +;;                                                                          ;;
    3.85 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    3.86 +
    3.87 +%define bx(label)       bx+label-boot
    3.88 +
    3.89 +[BITS 16]
    3.90 +[CPU 8086]
    3.91 +
    3.92 +?                       equ     0
    3.93 +ImageLoadSeg            equ     60h
    3.94 +StackSize               equ     1536
    3.95 +
    3.96 +[SECTION .text]
    3.97 +[ORG 0]
    3.98 +
    3.99 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.100 +;; Boot sector starts here ;;
   3.101 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.102 +
   3.103 +boot:
   3.104 +        jmp     short   start                   ; MS-DOS/Windows checks for this jump
   3.105 +        nop
   3.106 +bsOemName               DB      "BootProg"      ; 0x03
   3.107 +
   3.108 +;;;;;;;;;;;;;;;;;;;;;;
   3.109 +;; BPB1 starts here ;;
   3.110 +;;;;;;;;;;;;;;;;;;;;;;
   3.111 +
   3.112 +bpbBytesPerSector       DW      ?               ; 0x0B
   3.113 +bpbSectorsPerCluster    DB      ?               ; 0x0D
   3.114 +bpbReservedSectors      DW      ?               ; 0x0E
   3.115 +bpbNumberOfFATs         DB      ?               ; 0x10
   3.116 +bpbRootEntries          DW      ?               ; 0x11
   3.117 +bpbTotalSectors         DW      ?               ; 0x13
   3.118 +bpbMedia                DB      ?               ; 0x15
   3.119 +bpbSectorsPerFAT        DW      ?               ; 0x16
   3.120 +bpbSectorsPerTrack      DW      ?               ; 0x18
   3.121 +bpbHeadsPerCylinder     DW      ?               ; 0x1A
   3.122 +bpbHiddenSectors        DD      ?               ; 0x1C
   3.123 +bpbTotalSectorsBig      DD      ?               ; 0x20
   3.124 +
   3.125 +;;;;;;;;;;;;;;;;;;;;
   3.126 +;; BPB1 ends here ;;
   3.127 +;;;;;;;;;;;;;;;;;;;;
   3.128 +
   3.129 +;;;;;;;;;;;;;;;;;;;;;;
   3.130 +;; BPB2 starts here ;;
   3.131 +;;;;;;;;;;;;;;;;;;;;;;
   3.132 +
   3.133 +bsSectorsPerFAT32               DD      ?               ; 0x24
   3.134 +bsExtendedFlags                 DW      ?               ; 0x28
   3.135 +bsFSVersion                     DW      ?               ; 0x2A
   3.136 +bsRootDirectoryClusterNo        DD      ?               ; 0x2C
   3.137 +bsFSInfoSectorNo                DW      ?               ; 0x30
   3.138 +bsBackupBootSectorNo            DW      ?               ; 0x32
   3.139 +bsreserved             times 12 DB      ?               ; 0x34
   3.140 +bsDriveNumber                   DB      ?               ; 0x40
   3.141 +bsreserved1                     DB      ?               ; 0x41
   3.142 +bsExtendedBootSignature         DB      ?               ; 0x42
   3.143 +bsVolumeSerialNumber            DD      ?               ; 0x43
   3.144 +bsVolumeLabel                   DB      "NO NAME    "   ; 0x47
   3.145 +bsFileSystemName                DB      "FAT32   "      ; 0x52
   3.146 +
   3.147 +;;;;;;;;;;;;;;;;;;;;
   3.148 +;; BPB2 ends here ;;
   3.149 +;;;;;;;;;;;;;;;;;;;;
   3.150 +
   3.151 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.152 +;; Boot sector code starts here ;;
   3.153 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.154 +
   3.155 +start:
   3.156 +        cld
   3.157 +
   3.158 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.159 +;; How much RAM is there? ;;
   3.160 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.161 +
   3.162 +        int     12h             ; get conventional memory size (in KBs)
   3.163 +        mov     cx, 106h
   3.164 +        dec     ax
   3.165 +        dec     ax              ; reserve 2K bytes for the code and the stack
   3.166 +        shl     ax, cl          ; and convert it to 16-byte paragraphs
   3.167 +
   3.168 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.169 +;; Reserve memory for the boot sector and its stack ;;
   3.170 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.171 +
   3.172 +        mov     es, ax                  ; cs:0 = ds:0 = ss:0 -> top - 512 - StackSize
   3.173 +        mov     ss, ax
   3.174 +        mov     sp, 512+StackSize       ; bytes 0-511 are reserved for the boot code
   3.175 +
   3.176 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.177 +;; Copy ourselves to top of memory ;;
   3.178 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.179 +
   3.180 +        mov     si, 7C00h
   3.181 +        xor     di, di
   3.182 +        mov     ds, di
   3.183 +        rep     movsw                   ; move 512 bytes (+ 12)
   3.184 +
   3.185 +;;;;;;;;;;;;;;;;;;;;;;
   3.186 +;; Jump to the copy ;;
   3.187 +;;;;;;;;;;;;;;;;;;;;;;
   3.188 +
   3.189 +        push    es
   3.190 +        mov     cl, main
   3.191 +        push    cx
   3.192 +        retf
   3.193 +
   3.194 +main:
   3.195 +        push    cs
   3.196 +        pop     ds
   3.197 +
   3.198 +        xor     bx, bx
   3.199 +        mov     [bx], dx                ; store BIOS boot drive number
   3.200 +
   3.201 +        and     byte [bx(bsRootDirectoryClusterNo)+3], 0Fh ; mask cluster value
   3.202 +        les     si, [bx(bsRootDirectoryClusterNo)] ; si2:si=cluster # of root dir
   3.203 +        mov     si2, es
   3.204 +
   3.205 +        mov     cl, ImageLoadSeg
   3.206 +        mov     es, cx
   3.207 +
   3.208 +RootDirReadContinue:
   3.209 +        call    ReadCluster             ; read one sector of root dir; clear ch
   3.210 +        pushf                           ; save carry="not last sector" flag
   3.211 +
   3.212 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.213 +;; Look for the COM/EXE file to load and run ;;
   3.214 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.215 +
   3.216 +        xor     di, di                  ; es:di -> root entries array
   3.217 +
   3.218 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.219 +;; Looks for the file/dir ProgramName    ;;
   3.220 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.221 +;; Input:  ES:DI -> root directory array ;;
   3.222 +;;         BP = paragraphs count         ;;
   3.223 +;; Output: ESI = cluster number          ;;
   3.224 +;;         DI = file paragraph count     ;;
   3.225 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.226 +
   3.227 +FindNameCycle:
   3.228 +        cmp     byte [es:di], bh
   3.229 +        je      FindNameFailed          ; end of root directory (NULL entry found)
   3.230 +        push    si
   3.231 +        push    di
   3.232 +        mov     cl, 11
   3.233 +        mov     si, ProgramName         ; ds:si -> program name
   3.234 +        repe    cmpsb
   3.235 +        pop     di
   3.236 +        pop     si
   3.237 +        je      FindNameFound
   3.238 +        add     di, 32                  ; max cluster = 64k
   3.239 +        dec     bp
   3.240 +        dec     bp
   3.241 +        jnz     FindNameCycle           ; next root entry
   3.242 +        popf                            ; restore carry="not last sector" flag
   3.243 +        jc      RootDirReadContinue     ; continue to the next root dir cluster
   3.244 +FindNameFailed:                         ; end of root directory (dir end reached)
   3.245 +        call    Error
   3.246 +        db      "File not found."
   3.247 +FindNameFound:
   3.248 +        mov     si2, word [es:di+14h]
   3.249 +        mov     si, word [es:di+1Ah]    ; si2:si = cluster no; cx = 0.
   3.250 +
   3.251 +==============
   3.252 +        dec     dword [es:di+1Ch]       ; load ((n - 1)/256)*16 +1 paragraphs
   3.253 +        imul    di, [es:di+1Dh], 16     ; file size in paragraphs (full pages)
   3.254 +
   3.255 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.256 +;; Load the entire file ;;
   3.257 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.258 +
   3.259 +        push    es
   3.260 +FileReadContinue:
   3.261 +        push    di
   3.262 +        call    ReadCluster             ; read one more sector
   3.263 +        mov     di, es
   3.264 +        add     di, bp                  ; adjust segment for next sector
   3.265 +        mov     es, di                  ; es:0 updated
   3.266 +        pop     di
   3.267 +        sub     di, bp
   3.268 +        jae     FileReadContinue
   3.269 +==============
   3.270 +        pop     bp
   3.271 +
   3.272 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.273 +;; Type detection, .COM or .EXE? ;;
   3.274 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.275 +
   3.276 +        mov     dl, [bx]                ; pass the BIOS boot drive
   3.277 +        mov     ds, bp                  ; bp=ds=seg the file is loaded to
   3.278 +
   3.279 +        add     bp, [bx+08h]            ; bp = image base
   3.280 +        mov     ax, [bx+06h]            ; ax = reloc items
   3.281 +        mov     di, [bx+18h]            ; di = reloc table pointer
   3.282 +
   3.283 +        cmp     word [bx], 5A4Dh        ; "MZ" signature?
   3.284 +        je      RelocateEXE             ; yes, it's an EXE program
   3.285 +
   3.286 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.287 +;; Setup and run a .COM program ;;
   3.288 +;; Set CS=DS=ES=SS SP=0 IP=100h ;;
   3.289 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.290 +
   3.291 +        mov     bp, ImageLoadSeg-10h    ; "org 100h" stuff :)
   3.292 +        mov     ss, bp
   3.293 +        xor     sp, sp
   3.294 +        push    bp                      ; cs, ds and es
   3.295 +        mov     bh, 1                   ; ip
   3.296 +        jmp     short Run
   3.297 +
   3.298 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.299 +;; Relocate, setup and run a .EXE program     ;;
   3.300 +;; Set CS:IP, SS:SP, DS, ES and AX according  ;;
   3.301 +;; to wiki.osdev.org/MZ#Initial_Program_State ;;
   3.302 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.303 +
   3.304 +ReloCycle:
   3.305 +        add     [di+2], bp              ; item seg (abs)
   3.306 +        les     si, [di]                ; si = item ofs, es = item seg
   3.307 +        add     [es:si], bp             ; fixup
   3.308 +        scasw                           ; di += 2
   3.309 +        scasw                           ; point to next entry
   3.310 +
   3.311 +RelocateEXE:
   3.312 +        dec     ax                      ; 32768 max (128KB table)
   3.313 +        jns     ReloCycle               ; leave with ax=0ffffh: both FCB in the
   3.314 +                                        ; PSP don't have a valid drive identifier
   3.315 +        les     si, [bx+0Eh]
   3.316 +        add     si, bp
   3.317 +        mov     ss, si                  ; ss for EXE
   3.318 +        mov     sp, es                  ; sp for EXE
   3.319 +
   3.320 +        lea     si, [bp-10h]            ; ds and es both point to the segment
   3.321 +        push    si                      ; containing the PSP structure
   3.322 +
   3.323 +        add     bp, [bx+16h]            ; cs for EXE
   3.324 +        mov     bx, [bx+14h]            ; ip for EXE
   3.325 +Run:
   3.326 +        pop     ds
   3.327 +        push    bp
   3.328 +        push    bx
   3.329 +        push    ds
   3.330 +        pop     es
   3.331 +
   3.332 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.333 +;; Set the magic numbers so the program knows that it   ;;
   3.334 +;; has been loaded by this bootsector and not by MS-DOS ;;
   3.335 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.336 +        mov     si, 16381 ; prime number 2**14-3
   3.337 +        mov     di, 32749 ; prime number 2**15-19
   3.338 +        mov     bp, 65521 ; prime number 2**16-15
   3.339 +
   3.340 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.341 +;; All done, transfer control to the program now ;;
   3.342 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.343 +        retf
   3.344 +
   3.345 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.346 +;; Reads a FAT32 cluster         ;;
   3.347 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.348 +;; Input:  ES:0 -> buffer        ;;
   3.349 +;;       EDX:EAX = sector no     ;;
   3.350 +;;          CX = sectors to load ;;
   3.351 +;;           ESI = cluster no    ;;
   3.352 +;;         BX    = 0             ;;
   3.353 +;; Output: ES:0 -> buffer        ;;
   3.354 +;;       EDX:EAX = sector no     ;;
   3.355 +;;          CX = sectors to load ;;
   3.356 +;;           ESI = next cluster  ;;
   3.357 +;;         BX    = 0             ;;
   3.358 +;;         CH    = 0             ;;
   3.359 +;;         BP    = para/sector   ;;
   3.360 +;;         C=0 for last sector   ;;
   3.361 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.362 +
   3.363 +ReadCluster:
   3.364 +==============
   3.365 +        mov     bp, word [bx(bpbBytesPerSector)]
   3.366 +        shr     bp, 4                           ; paragraphs per sector
   3.367 +        inc     cx
   3.368 +        add     ax, 1                           ; adjust LBA for next sector
   3.369 +?        adc     dx, bx
   3.370 +        loop    ReadSectorLBANext
   3.371 +
   3.372 +        imul    ax, bp, 2
   3.373 +        cwde                                    ; eax=# of FAT32 entries per sector
   3.374 +        lea     edi, [esi-2]                    ; edi=cluster #-2
   3.375 +        xchg    eax, esi
   3.376 +        cdq
   3.377 +        div     esi                             ; eax=FAT sector #, edx=entry # in sector < 128
   3.378 +
   3.379 +        imul    si, dx, 4                       ; si=entry # offset in sector
   3.380 +
   3.381 +        call    ReadSectorLBA                   ; read 1 FAT32 sector
   3.382 +
   3.383 +        mov     si2, 0FFFh
   3.384 +        and     si2, [es:si+2]                  ; mask cluster value
   3.385 +        mov     si, [es:si]                     ; si2:si=next cluster #
   3.386 +
   3.387 +        movzx   eax, byte [bx(bpbNumberOfFATs)]
   3.388 +        mul     dword [bx(bsSectorsPerFAT32)]   ; edx < 256
   3.389 +
   3.390 +        xchg    eax, edi                        ; get cluster #-2 ; save data offset
   3.391 +
   3.392 +        movzx   ecx, byte [bx(bpbSectorsPerCluster)]
   3.393 +        mul     ecx
   3.394 +
   3.395 +        add     eax, edi                        ; sector # relative to FAT32
   3.396 +
   3.397 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.398 +;; Reads a sector using BIOS Int 13h ;;
   3.399 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.400 +;; Input:  ES:0 -> buffer address    ;;
   3.401 +;;         EAX   = LBA (FAT based)   ;;
   3.402 +;;         BX    = 0                 ;;
   3.403 +;;         CX    = sector count      ;;
   3.404 +;; Output: ES:0 -> buffer address    ;;
   3.405 +;;       EDX:EAX = absolute LBA      ;;
   3.406 +;;         BX    = 0                 ;;
   3.407 +;;         CX    = next sector count ;;
   3.408 +;;         BP    = paragraphs/sector ;;
   3.409 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.410 +
   3.411 +ReadSectorLBA:
   3.412 +
   3.413 +        mov     dx, word [bx(bpbReservedSectors)]
   3.414 +        add     eax, edx
   3.415 +        mov     dx, bx
   3.416 +        adc     dx, bx
   3.417 +        add     eax, [bx(bpbHiddenSectors)]
   3.418 +
   3.419 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.420 +;; Input:  ES:0 -> buffer address    ;;
   3.421 +;;       EDX:EAX = absolute LBA      ;;
   3.422 +;;         BX    = 0                 ;;
   3.423 +;;         CX    = sector count      ;;
   3.424 +;; Output: ES:0 -> buffer address    ;;
   3.425 +;;       EDX:EAX = absolute LBA      ;;
   3.426 +;;         BX    = 0                 ;;
   3.427 +;;         CX    = next sector count ;;
   3.428 +;;         BP    = paragraphs/sector ;;
   3.429 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.430 +
   3.431 +ReadSectorLBANext:
   3.432 +
   3.433 +        adc     dx, bx  ; FAT32 partition can start up to 2TB
   3.434 +
   3.435 +        pusha
   3.436 +
   3.437 +        push    edx     ; 33-bit LBA only: up to 4TB disks
   3.438 +        push    eax     ; 32-bit LBA: up to 2TB FAT32 partition start
   3.439 +        push    es
   3.440 +        push    bx
   3.441 +        push    byte 1  ; sector count word = 1
   3.442 +        push    byte 16 ; packet size byte = 16, reserved byte = 0
   3.443 +        
   3.444 +        push    eax
   3.445 +        pop     cx                      ; low LBA
   3.446 +        pop     ax                      ; high LBA, dx=0 (<2TB)
   3.447 +        div     word [bx(bpbSectorsPerTrack)] ; up to 8GB disks
   3.448 +
   3.449 +        xchg    ax, cx                  ; restore low LBA, save high LBA / SPT
   3.450 +        div     word [bx(bpbSectorsPerTrack)]
   3.451 +                ; ax = LBA / SPT
   3.452 +                ; dx = LBA % SPT         = sector - 1
   3.453 +        inc     dx
   3.454 +
   3.455 +        xchg    cx, dx                  ; restore high LBA / SPT, save sector no.
   3.456 +        div     word [bx(bpbHeadsPerCylinder)]
   3.457 +                ; ax = (LBA / SPT) / HPC = cylinder
   3.458 +                ; dx = (LBA / SPT) % HPC = head
   3.459 +        shl     ah, 6
   3.460 +        mov     ch, al
   3.461 +                ; ch = LSB 0...7 of cylinder no.
   3.462 +        or      cl, ah
   3.463 +                ; cl = MSB 8...9 of cylinder no. + sector no.
   3.464 +        mov     dh, dl
   3.465 +                ; dh = head no.
   3.466 +
   3.467 +ReadSectorLBARetry:
   3.468 +        mov     dl, [bx]
   3.469 +                ; dl = drive no.
   3.470 +        mov     si, sp
   3.471 +        mov     ah, 42h                 ; ah = 42h = extended read function no.
   3.472 +        int     13h                     ; extended read sectors (DL, DS:SI)
   3.473 +        jnc     ReadSectorNextSegment
   3.474 +
   3.475 +ReadSectorCHSRetry:
   3.476 +        mov     ax, 201h                ; al = sector count = 1
   3.477 +                                        ; ah = 2 = read function no.
   3.478 +        int     13h                     ; read sectors (AL, CX, DX, ES:BX)
   3.479 +        jnc     ReadSectorNextSegment
   3.480 +
   3.481 +        cbw                             ; ah = 0 = reset function
   3.482 +        int     13h                     ; reset drive (DL)
   3.483 +
   3.484 +        dec     bp
   3.485 +        jnz     ReadSectorLBARetry
   3.486 +
   3.487 +        call    Error
   3.488 +        db      "Read error."
   3.489 +
   3.490 +ReadSectorNextSegment:
   3.491 +
   3.492 +        popa                            ; sp += 16
   3.493 +        popa                            ; restore real registers
   3.494 +==============
   3.495 +        stc
   3.496 +        loop    ReadSectorDone
   3.497 +
   3.498 +        cmp     si2, 0FFFh
   3.499 +        jne     ReadSectorDone
   3.500 +        cmp     si, 0FFF8h              ; carry=0 if last cluster, and carry=1 otherwise
   3.501 +
   3.502 +ReadSectorDone:
   3.503 +        ret
   3.504 +
   3.505 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.506 +;; Error Messaging Code ;;
   3.507 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.508 +
   3.509 +Error:
   3.510 +        pop     si
   3.511 +        mov     dl, [bx]                ; restore BIOS boot drive number
   3.512 +        mov     ah, 0Eh
   3.513 +        mov     bl, 7
   3.514 +
   3.515 +PutStr:
   3.516 +        lodsb
   3.517 +        int     10h
   3.518 +        cmp     al, "."
   3.519 +        jne     PutStr
   3.520 +
   3.521 +        cbw
   3.522 +        int     16h                     ; wait for a key...
   3.523 +        int     19h                     ; bootstrap
   3.524 +
   3.525 +Stop:
   3.526 +        hlt
   3.527 +        jmp     short Stop
   3.528 +
   3.529 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.530 +;; Fill free space with zeroes ;;
   3.531 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.532 +
   3.533 +                times (512-13-($-$$)) db 0
   3.534 +
   3.535 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.536 +;; Name of the file to load and run ;;
   3.537 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.538 +
   3.539 +ProgramName     db      "STARTUP BIN"   ; name and extension each must be
   3.540 +                                        ; padded with spaces (11 bytes total)
   3.541 +
   3.542 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.543 +;; End of the sector ID ;;
   3.544 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   3.545 +
   3.546 +                dw      0AA55h          ; BIOS checks for this ID
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/BootProg/stuff/bootex.asm	Fri Feb 18 09:29:30 2022 +0000
     4.3 @@ -0,0 +1,485 @@
     4.4 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     4.5 +;;                                                                          ;;
     4.6 +;;         "BootProg" Loader v 1.5 by Alexey Frunze (c) 2000-2015           ;;
     4.7 +;;                           2-clause BSD license.                          ;;
     4.8 +;;                                                                          ;;
     4.9 +;;                                                                          ;;
    4.10 +;;                              How to Compile:                             ;;
    4.11 +;;                              ~~~~~~~~~~~~~~~                             ;;
    4.12 +;; nasm bootex.asm -f bin -o bootex.bin                                     ;;
    4.13 +;;                                                                          ;;
    4.14 +;;                                                                          ;;
    4.15 +;;                                 Features:                                ;;
    4.16 +;;                                 ~~~~~~~~~                                ;;
    4.17 +;; - exFAT supported using BIOS int 13h function 42h.                       ;;
    4.18 +;;                                                                          ;;
    4.19 +;; - Loads a 16-bit executable file in the MS-DOS .COM or .EXE format       ;;
    4.20 +;;   from the root directory of a disk and transfers control to it          ;;
    4.21 +;;   (the "ProgramName" variable holds the name of the file to be loaded)   ;;
    4.22 +;;   Its maximum size can be up to 636KB without Extended BIOS Data area.   ;;
    4.23 +;;                                                                          ;;
    4.24 +;; - Prints an error if the file isn't found or couldn't be read            ;;
    4.25 +;;   ("File not found" or "Read error")                                     ;;
    4.26 +;;   and waits for a key to be pressed, then executes the Int 19h           ;;
    4.27 +;;   instruction and lets the BIOS continue bootstrap.                      ;;
    4.28 +;;                                                                          ;;
    4.29 +;;                                                                          ;;
    4.30 +;;                             Known Limitations:                           ;;
    4.31 +;;                             ~~~~~~~~~~~~~~~~~~                           ;;
    4.32 +;; - Works only on the 1st MBR partition which must be a PRI DOS partition  ;;
    4.33 +;;   with exFAT (File System ID: 07h)                                       ;;
    4.34 +;;                                                                          ;;
    4.35 +;;                                                                          ;;
    4.36 +;;                                Known Bugs:                               ;;
    4.37 +;;                                ~~~~~~~~~~~                               ;;
    4.38 +;; - All bugs are fixed as far as I know. The boot sector has been tested   ;;
    4.39 +;;   on a 128MB qemu image.                                                 ;;
    4.40 +;;                                                                          ;;
    4.41 +;;                                                                          ;;
    4.42 +;;                               Memory Layout:                             ;;
    4.43 +;;                               ~~~~~~~~~~~~~~                             ;;
    4.44 +;; The diagram below shows the typical memory layout. The actual location   ;;
    4.45 +;; of the boot sector and its stack may be lower than A0000H if the BIOS    ;;
    4.46 +;; reserves memory for its Extended BIOS Data Area just below A0000H and    ;;
    4.47 +;; reports less than 640 KB of RAM via its Int 12H function.                ;;
    4.48 +;;                                                                          ;;
    4.49 +;;                                            physical address              ;;
    4.50 +;;                 +------------------------+ 00000H                        ;;
    4.51 +;;                 | Interrupt Vector Table |                               ;;
    4.52 +;;                 +------------------------+ 00400H                        ;;
    4.53 +;;                 |     BIOS Data Area     |                               ;;
    4.54 +;;                 +------------------------+ 00500H                        ;;
    4.55 +;;                 | PrtScr Status / Unused |                               ;;
    4.56 +;;                 +------------------------+ 00600H                        ;;
    4.57 +;;                 |      Loaded Image      |                               ;;
    4.58 +;;                 +------------------------+ nnnnnH                        ;;
    4.59 +;;                 |    Available Memory    |                               ;;
    4.60 +;;                 +------------------------+ A0000H - 2KB                  ;;
    4.61 +;;                 |       Boot Sector      |                               ;;
    4.62 +;;                 +------------------------+ A0000H - 1.5KB                ;;
    4.63 +;;                 |    1.5KB Boot Stack    |                               ;;
    4.64 +;;                 +------------------------+ A0000H                        ;;
    4.65 +;;                 |        Video RAM       |                               ;;
    4.66 +;;                                                                          ;;
    4.67 +;;                                                                          ;;
    4.68 +;;                   Boot Image Startup (register values):                  ;;
    4.69 +;;                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                  ;;
    4.70 +;;  dl = BIOS boot drive number (e.g. 80H)                                  ;;
    4.71 +;;  cs:ip = program entry point                                             ;;
    4.72 +;;  ss:sp = program stack (don't confuse with boot sector's stack)          ;;
    4.73 +;;  COM program defaults: cs = ds = es = ss = 50h, sp = 0, ip = 100h        ;;
    4.74 +;;  EXE program defaults: ds = es = EXE data - 10h (fake MS-DOS psp),       ;;
    4.75 +;;  ax = 0ffffh (both FCB in the PSP don't have a valid drive identifier),  ;;
    4.76 +;;  cs:ip and ss:sp depends on EXE header                                   ;;
    4.77 +;;  Magic numbers:                                                          ;;
    4.78 +;;    si = 16381 (prime number 2**14-3)                                     ;;
    4.79 +;;    di = 32749 (prime number 2**15-19)                                    ;;
    4.80 +;;    bp = 65521 (prime number 2**16-15)                                    ;;
    4.81 +;;  The magic numbers let the program know whether it has been loaded by    ;;
    4.82 +;;  this boot sector or by MS-DOS, which may be handy for universal, bare-  ;;
    4.83 +;;  metal and MS-DOS programs.                                              ;;
    4.84 +;;                                                                          ;;
    4.85 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    4.86 +
    4.87 +%define bx(label)       bx+label-boot
    4.88 +
    4.89 +[BITS 16]
    4.90 +[CPU 386]
    4.91 +
    4.92 +?                       equ     0
    4.93 +ImageLoadSeg            equ     60h
    4.94 +StackSize               equ     1536
    4.95 +
    4.96 +[SECTION .text]
    4.97 +[ORG 0]
    4.98 +
    4.99 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.100 +;; Boot sector starts here ;;
   4.101 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.102 +
   4.103 +boot:
   4.104 +        jmp     short   start                   ; Windows checks for this jump
   4.105 +        nop
   4.106 +bsOemName               DB      "EXFAT   "      ; 0x03
   4.107 +                        times   53 db 0         ; 0x0B
   4.108 +
   4.109 +;;;;;;;;;;;;;;;;;;;;;
   4.110 +;; BPB starts here ;;
   4.111 +;;;;;;;;;;;;;;;;;;;;;
   4.112 +
   4.113 +bpbSectorStart          DQ      ?               ; 0x40 partition first sector
   4.114 +bpbSectorCount          DQ      ?               ; 0x48 partition sectors count
   4.115 +bpbFatSectorStart       DD      ?               ; 0x50 FAT first sector
   4.116 +bpbFatSectorCount       DD      ?               ; 0x54 FAT sectors count
   4.117 +bpbClusterSectorStart   DD      ?               ; 0x58 first cluster sector
   4.118 +bpbClusterCount         DD      ?               ; 0x5C total clusters count
   4.119 +bpbRootDirCluster       DD      ?               ; 0x60 first cluster of the root dir
   4.120 +bpbVolumeSerial         DD      ?               ; 0x64 volume serial number
   4.121 +bpbFSVersionMinor       DB      ?               ; 0x68
   4.122 +bpbFSVersionMajor       DB      ?               ; 0x69
   4.123 +bpbVolumeStateFlags     DW      ?               ; 0x6A 
   4.124 +bpbSectorSizeBits       DB      ?               ; 0x6C sector size as (1 << n)
   4.125 +bpbSectorPerClusterBits DB      ?               ; 0x6D sector per cluster as (1 << n)
   4.126 +bpbNumberOfFATs         DB      ?               ; 0x6E always 1
   4.127 +bpbDriveNumber          DB      ?               ; 0x6F alaways 0x80
   4.128 +bpbAllocatedPercent     DB      ?               ; 0x70 percentage of allocated space
   4.129 +
   4.130 +;;;;;;;;;;;;;;;;;;;
   4.131 +;; BPB ends here ;;
   4.132 +;;;;;;;;;;;;;;;;;;;
   4.133 +
   4.134 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.135 +;; Boot sector code starts here ;;
   4.136 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.137 +
   4.138 +start:
   4.139 +        cld
   4.140 +
   4.141 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.142 +;; How much RAM is there? ;;
   4.143 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.144 +
   4.145 +        int     12h             ; get conventional memory size (in KBs)
   4.146 +        mov     cx, 106h
   4.147 +        dec     ax
   4.148 +        dec     ax              ; reserve 2K bytes for the code and the stack
   4.149 +        shl     ax, cl          ; and convert it to 16-byte paragraphs
   4.150 +
   4.151 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.152 +;; Reserve memory for the boot sector and its stack ;;
   4.153 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.154 +
   4.155 +        mov     es, ax                  ; cs:0 = ds:0 = ss:0 -> top - 512 - StackSize
   4.156 +        mov     ss, ax
   4.157 +        mov     sp, 512+StackSize       ; bytes 0-511 are reserved for the boot code
   4.158 +
   4.159 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.160 +;; Copy ourselves to top of memory ;;
   4.161 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.162 +
   4.163 +        mov     si, 7C00h
   4.164 +        xor     di, di
   4.165 +        mov     ds, di
   4.166 +        rep     movsw                   ; move 512 bytes (+ 12)
   4.167 +
   4.168 +;;;;;;;;;;;;;;;;;;;;;;
   4.169 +;; Jump to the copy ;;
   4.170 +;;;;;;;;;;;;;;;;;;;;;;
   4.171 +
   4.172 +        push    es
   4.173 +        push    main
   4.174 +        retf
   4.175 +
   4.176 +main:
   4.177 +        push    cs
   4.178 +        pop     ds
   4.179 +
   4.180 +        xor     ebx, ebx
   4.181 +        mov     [bx], dx                ; store BIOS boot drive number
   4.182 +
   4.183 +        mov     esi, [bx(bpbRootDirCluster)] ; esi=cluster # of root dir
   4.184 +
   4.185 +        push    ImageLoadSeg
   4.186 +        pop     es
   4.187 +
   4.188 +RootDirReadContinue:
   4.189 +        call    ReadCluster             ; read one sector of root dir
   4.190 +        pushf                           ; save carry="not last sector" flag
   4.191 +
   4.192 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.193 +;; Look for the COM/EXE file to load and run ;;
   4.194 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.195 +
   4.196 +        xor     di, di                  ; es:di -> root entries array
   4.197 +
   4.198 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.199 +;; Looks for the file/dir ProgramName    ;;
   4.200 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.201 +;; Input:  ES:DI -> root directory array ;;
   4.202 +;; Output: ESI = cluster number          ;;
   4.203 +;;         dword [bx+FileSize] file size ;;
   4.204 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.205 +
   4.206 +CurNameSize     equ  3
   4.207 +StartCluster    equ  14h
   4.208 +FileSize        equ  18h
   4.209 +
   4.210 +FindNameCycle:
   4.211 +        pusha
   4.212 +
   4.213 +        xor     ax, ax
   4.214 +        or      al, [es:di]
   4.215 +        je      FindNameFailed
   4.216 +
   4.217 +        cmp     al, 0c0h                ; EXFAT_ENTRY_FILE_INFO ?
   4.218 +        jne     NotFileInfo
   4.219 +
   4.220 +        mov     bl, 30
   4.221 +CopyInfo:
   4.222 +        mov     ax, [es:di+bx]
   4.223 +        mov     [bx], ax
   4.224 +        dec     bx
   4.225 +        dec     bx
   4.226 +        jnz     CopyInfo
   4.227 +
   4.228 +NotFileInfo:
   4.229 +        mov     al, 0c1h                ; EXFAT_ENTRY_FILE_NAME ?
   4.230 +        mov     cx, NameLength+1
   4.231 +        mov     si, ProgramName         ; ds:si -> program name
   4.232 +CheckName:
   4.233 +        scasw                           ; compare UTF-16
   4.234 +        lodsb                           ; with ASCII
   4.235 +        loope   CheckName
   4.236 +        je      FindNameFound           ; cx = 0
   4.237 +        popa                            ; restore ax, cx, si, di
   4.238 +
   4.239 +        add     di, 32
   4.240 +        cmp     di, bp
   4.241 +        jne     FindNameCycle           ; next root entry
   4.242 +        popf                            ; restore carry="not last sector" flag
   4.243 +        jc      RootDirReadContinue     ; continue to the next root dir cluster
   4.244 +FindNameFailed:                         ; end of root directory (dir end reached)
   4.245 +        call    Error
   4.246 +        db      "File not found."
   4.247 +FindNameFound:
   4.248 +        mov     esi, [bx+StartCluster]
   4.249 +
   4.250 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.251 +;; Load the entire file ;;
   4.252 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.253 +
   4.254 +        push    es
   4.255 +        xor     bp, bp
   4.256 +FileReadContinue:
   4.257 +        shr     bp, 4                   ; bytes to paragraphs
   4.258 +        mov     di, es
   4.259 +        add     di, bp                  ; adjust segment for next sector
   4.260 +        mov     es, di                  ; es:0 updated
   4.261 +        call    ReadCluster             ; read one cluster of root dir
   4.262 +        sub     [bx+FileSize], ebp
   4.263 +        ja      FileReadContinue
   4.264 +        pop     bp
   4.265 +
   4.266 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.267 +;; Type detection, .COM or .EXE? ;;
   4.268 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.269 +
   4.270 +        mov     dl, [bx]                ; pass the BIOS boot drive
   4.271 +        mov     ds, bp                  ; bp=ds=seg the file is loaded to
   4.272 +
   4.273 +        add     bp, [bx+08h]            ; bp = image base
   4.274 +        mov     ax, [bx+06h]            ; ax = reloc items
   4.275 +        mov     di, [bx+18h]            ; di = reloc table pointer
   4.276 +
   4.277 +        cmp     word [bx], 5A4Dh        ; "MZ" signature?
   4.278 +        je      RelocateEXE             ; yes, it's an EXE program
   4.279 +
   4.280 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.281 +;; Setup and run a .COM program ;;
   4.282 +;; Set CS=DS=ES=SS SP=0 IP=100h ;;
   4.283 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.284 +
   4.285 +        mov     bp, ImageLoadSeg-10h    ; "org 100h" stuff :)
   4.286 +        mov     ss, bp
   4.287 +        xor     sp, sp
   4.288 +        push    bp                      ; cs, ds and es
   4.289 +        mov     bh, 1                   ; ip
   4.290 +        jmp     short Run
   4.291 +
   4.292 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.293 +;; Relocate, setup and run a .EXE program     ;;
   4.294 +;; Set CS:IP, SS:SP, DS, ES and AX according  ;;
   4.295 +;; to wiki.osdev.org/MZ#Initial_Program_State ;;
   4.296 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.297 +
   4.298 +ReloCycle:
   4.299 +        add     [di+2], bp              ; item seg (abs)
   4.300 +        les     si, [di]                ; si = item ofs, es = item seg
   4.301 +        add     [es:si], bp             ; fixup
   4.302 +        scasw                           ; di += 2
   4.303 +        scasw                           ; point to next entry
   4.304 +
   4.305 +RelocateEXE:
   4.306 +        dec     ax                      ; 32768 max (128KB table)
   4.307 +        jns     ReloCycle               ; leave with ax=0ffffh: both FCB in the
   4.308 +                                        ; PSP don't have a valid drive identifier
   4.309 +        les     si, [bx+0Eh]
   4.310 +        add     si, bp
   4.311 +        mov     ss, si                  ; ss for EXE
   4.312 +        mov     sp, es                  ; sp for EXE
   4.313 +
   4.314 +        lea     si, [bp-10h]            ; ds and es both point to the segment
   4.315 +        push    si                      ; containing the PSP structure
   4.316 +
   4.317 +        add     bp, [bx+16h]            ; cs for EXE
   4.318 +        mov     bx, [bx+14h]            ; ip for EXE
   4.319 +Run:
   4.320 +        pop     ds
   4.321 +        push    bp
   4.322 +        push    bx
   4.323 +        push    ds
   4.324 +        pop     es
   4.325 +
   4.326 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.327 +;; Set the magic numbers so the program knows that it   ;;
   4.328 +;; has been loaded by this bootsector and not by MS-DOS ;;
   4.329 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.330 +        mov     si, 16381 ; prime number 2**14-3
   4.331 +        mov     di, 32749 ; prime number 2**15-19
   4.332 +        mov     bp, 65521 ; prime number 2**16-15
   4.333 +
   4.334 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.335 +;; All done, transfer control to the program now ;;
   4.336 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.337 +        retf
   4.338 +
   4.339 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.340 +;; Reads a exFAT cluster         ;;
   4.341 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.342 +;; Input:  EDX:EAX = LBA         ;;
   4.343 +;;         EBX     = 0           ;;
   4.344 +;;         CX      = sector cnt  ;;
   4.345 +;;         ESI     = cluster no  ;;
   4.346 +;;         ES:0   -> buffer adrs ;;
   4.347 +;; Output: EBX     = 0           ;;
   4.348 +;;         CX      = next cnt    ;;
   4.349 +;;         EBP     = bytes/sector;;
   4.350 +;;         ES:0   -> next adrs   ;;
   4.351 +;;         C=0 for last sector   ;;
   4.352 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.353 +
   4.354 +ReadCluster:
   4.355 +        inc     cx                              ; jcxnz
   4.356 +        add     eax, 1
   4.357 +        loop    ReadSectorC
   4.358 +
   4.359 +        mov     cl, [bx(bpbSectorSizeBits)]
   4.360 +        dec     cx
   4.361 +        dec     cx
   4.362 +        mul     ebx                             ; edx:eax = 0
   4.363 +        inc     ax
   4.364 +        shl     eax, cl                         ; eax=# of exFAT entries per sector
   4.365 +        lea     edi, [esi-2]                    ; edi=cluster #-2
   4.366 +        xchg    eax, esi
   4.367 +        div     esi                             ; eax=FAT sector #, edx=entry # in sector
   4.368 +
   4.369 +        imul    si, dx, 4                       ; si=entry # offset in sector
   4.370 +
   4.371 +        cdq
   4.372 +        add     eax, [bx(bpbFatSectorStart)]    ; sector # relative to FAT32
   4.373 +        call    ReadSectorC                     ; read 1 FAT32 sector
   4.374 +
   4.375 +        mov     esi, [es:si]                    ; esi=next cluster #
   4.376 +
   4.377 +        xor     eax, eax
   4.378 +        inc     ax
   4.379 +        mov     cl, [bx(bpbSectorPerClusterBits)]
   4.380 +        shl     eax, cl                         ; 10000h max (32MB cluster)
   4.381 +        xchg    eax, ecx
   4.382 +        xchg    eax, edi                        ; get cluster #-2
   4.383 +        mul     ecx
   4.384 +
   4.385 +        add     eax, [bx(bpbClusterSectorStart)]
   4.386 +ReadSectorC:
   4.387 +        adc     edx, ebx
   4.388 +
   4.389 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.390 +;; Reads a sector using BIOS Int 13h ;;
   4.391 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.392 +;; Input:  EDX:EAX = LBA             ;;
   4.393 +;;         BX      = 0               ;;
   4.394 +;;         CX      = sector count    ;;
   4.395 +;;         ES:0   -> buffer address  ;;
   4.396 +;; Output: BX      = 0               ;;
   4.397 +;;         CX      = next count      ;;
   4.398 +;;         EBP     = bytes/sector    ;;
   4.399 +;;         ES:0   -> next address    ;;
   4.400 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.401 +
   4.402 +ReadSector:
   4.403 +
   4.404 +        xor     ebp, ebp
   4.405 +        inc     bp
   4.406 +
   4.407 +        pushad
   4.408 +
   4.409 +        add     eax, [bx(bpbSectorStart)]
   4.410 +        adc     edx, [bx(bpbSectorStart)+4]
   4.411 +
   4.412 +        push    edx
   4.413 +        push    eax
   4.414 +        push    es
   4.415 +        push    bx
   4.416 +        push    bp                      ; sector count word = 1
   4.417 +        mov     cx, 16
   4.418 +        push    cx                      ; packet size byte = 16, reserved byte = 0
   4.419 +ReadSectorRetry:        
   4.420 +        mov     si, sp
   4.421 +        mov     ah, 42h                 ; ah = 42h = extended read function no.
   4.422 +        mov     dl, [bx]
   4.423 +        int     13h                     ; extended read sectors (DL, DS:SI)
   4.424 +
   4.425 +        jnc     ReadSuccess
   4.426 +
   4.427 +        xor     ax, ax
   4.428 +        int     13h                     ; reset drive (DL)
   4.429 +        loop    ReadSectorRetry
   4.430 +
   4.431 +        call    Error
   4.432 +        db      "Read error."
   4.433 +
   4.434 +ReadSuccess:
   4.435 +        mov     cl, [bx(bpbSectorSizeBits)]
   4.436 +        shl     word [si+16+8], cl      ; (e)bp si+16: EDI ESI EBP ESP EBX EDX ECX EAX
   4.437 +        popa                            ; sp += 16
   4.438 +        popad                           ; real registers
   4.439 +
   4.440 +        stc
   4.441 +        loop    ReadSectorNext
   4.442 +
   4.443 +        cmp     esi, 0FFFFFFF6h         ; carry=0 if last cluster, and carry=1 otherwise
   4.444 +ReadSectorNext:
   4.445 +        ret
   4.446 +
   4.447 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.448 +;; Error Messaging Code ;;
   4.449 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.450 +
   4.451 +Error:
   4.452 +        pop     si
   4.453 +        mov     dl, [bx]                ; restore BIOS boot drive number
   4.454 +        mov     ah, 0Eh
   4.455 +        mov     bl, 7
   4.456 +
   4.457 +PutStr:
   4.458 +        lodsb
   4.459 +        int     10h
   4.460 +        cmp     al, "."
   4.461 +        jne     PutStr
   4.462 +
   4.463 +        cbw
   4.464 +        int     16h                     ; wait for a key...
   4.465 +        int     19h                     ; bootstrap
   4.466 +
   4.467 +Stop:
   4.468 +        hlt
   4.469 +        jmp     short Stop
   4.470 +
   4.471 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.472 +;; Fill free space with zeroes ;;
   4.473 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.474 +
   4.475 +                times (512-13-($-$$)) db 0
   4.476 +
   4.477 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.478 +;; Name of the file to load and run ;;
   4.479 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.480 +
   4.481 +ProgramName     db      "startup.bin"   ; name and extension
   4.482 +NameLength      equ     $-ProgramName
   4.483 +
   4.484 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.485 +;; End of the sector ID ;;
   4.486 +;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.487 +
   4.488 +                dw      0AA55h          ; BIOS checks for this ID
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/BootProg/stuff/bootprog.sh	Fri Feb 18 09:29:30 2022 +0000
     5.3 @@ -0,0 +1,39 @@
     5.4 +#!/bin/sh
     5.5 +
     5.6 +[ ! -e "$1" ] && cat <<EOT && exit 2
     5.7 +Usage: [FAT=<FAT12|FAT16|FAT32|EXFAT>] $0 device [boot name entry] [boot.bin]
     5.8 +Example: $0 /dev/fd0 STARTUP.BIN
     5.9 +EOT
    5.10 +
    5.11 +while read chk ofs fat bin name; do
    5.12 +	[ $FAT -eq $fat ] || [ "$(dd if="$1" bs=1 count=8 skip=$chk)" = "$fat   " ] || continue
    5.13 +	echo "Install $fat bootsector on $1."
    5.14 +	for arg in "skip=$(($ofs+8)) seek=$(($ofs+8))" "count=11" ; do
    5.15 +		if [ "$3" ]; then
    5.16 +			cat "$3"
    5.17 +		else
    5.18 +			sed '1,/^exit 1/d' $0 | tar xzOf - boot$bin.bin
    5.19 +		fi | dd of="$1" bs=1 conv=notrunc $arg
    5.20 +	done
    5.21 +	[ "$2" ] && echo "Set bootfile '$2'" && echo -en "$name" | \
    5.22 +		dd of="$1" bs=1 conv=notrunc seek=499 count=11
    5.23 +	case "$fat" in
    5.24 +	EXFAT) dd if="$1" bs=512 count=11 | od -v -An -t u1 -w1 - | awk '
    5.25 +BEGIN { chk=0; i=-1 }
    5.26 +{
    5.27 +  i++
    5.28 +  if (i == 106 || i == 107 || i == 112) next
    5.29 +  chk = or(lshift(chk,31),rshift(chk,1)) + $1
    5.30 +}
    5.31 +END { a=chk%256; b=(chk/256)%256; c=(chk/256/256)%256; d=chk/256/256/256
    5.32 +  for (i=0;i<128;i++) printf "echo -en \"\\x%02X\\x%02X\\x%02X\\x%02X\"\n",a,b,c,d
    5.33 +} ' | sh | dd bs=512 of="$1" seek=11
    5.34 +	esac
    5.35 +	exit 0
    5.36 +done 2> /dev/null <<EOT
    5.37 +54	54	FAT12	16	$(A="${2/./       }";echo "${A:0:8}${A##* }          " | tr '[a-z]' '[A-Z]' | sed 's| |\\\\x20|g')
    5.38 +54	54	FAT16	16	$(A="${2/./       }";echo "${A:0:8}${A##* }          " | tr '[a-z]' '[A-Z]' | sed 's| |\\\\x20|g')
    5.39 +82	82	FAT32	32	$(A="${2/./       }";echo "${A:0:8}${A##* }          " | tr '[a-z]' '[A-Z]' | sed 's| |\\\\x20|g')
    5.40 +3	105	EXFAT	ex	$(echo "$2" | sed 's| |.|;s| ||g')\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0\\\\0
    5.41 +EOT
    5.42 +exit 1
     6.1 --- a/SkypeFreak/receipt	Thu Feb 17 17:41:58 2022 +0100
     6.2 +++ b/SkypeFreak/receipt	Fri Feb 18 09:29:30 2022 +0000
     6.3 @@ -14,6 +14,13 @@
     6.4  DEPENDS="python"
     6.5  BUILD_DEPENDS="wget"
     6.6  
     6.7 +# What is the latest version available today?
     6.8 +current_version()
     6.9 +{
    6.10 +	wget -O - ${WGET_URL%/*/*}/commits/master 2>/dev/null | \
    6.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
    6.12 +}
    6.13 +
    6.14  # Rules to gen a SliTaz package suitable for Tazpkg.
    6.15  genpkg_rules()
    6.16  {
     7.1 --- a/adbfs-rootless/receipt	Thu Feb 17 17:41:58 2022 +0100
     7.2 +++ b/adbfs-rootless/receipt	Fri Feb 18 09:29:30 2022 +0000
     7.3 @@ -15,6 +15,13 @@
     7.4  DEPENDS="fuse"
     7.5  BUILD_DEPENDS="pkg-config fuse-dev android-platform-tools"
     7.6  
     7.7 +# What is the latest version available today?
     7.8 +current_version()
     7.9 +{
    7.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
    7.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
    7.12 +}
    7.13 +
    7.14  # Rules to configure and make the package.
    7.15  compile_rules()
    7.16  {
     8.1 --- a/clicfs/receipt	Thu Feb 17 17:41:58 2022 +0100
     8.2 +++ b/clicfs/receipt	Fri Feb 18 09:29:30 2022 +0000
     8.3 @@ -14,6 +14,13 @@
     8.4  DEPENDS="fuse liblzma libcrypto gcc-lib-base"
     8.5  BUILD_DEPENDS="cmake fuse-dev liblzma-dev openssl-dev"
     8.6  
     8.7 +# What is the latest version available today?
     8.8 +current_version()
     8.9 +{
    8.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
    8.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
    8.12 +}
    8.13 +
    8.14  # Rules to configure and make the package.
    8.15  compile_rules()
    8.16  {
     9.1 --- a/connman-ui/receipt	Thu Feb 17 17:41:58 2022 +0100
     9.2 +++ b/connman-ui/receipt	Fri Feb 18 09:29:30 2022 +0000
     9.3 @@ -15,6 +15,13 @@
     9.4  BUILD_DEPENDS="wget autoconf automake libtool connman-dev gtk+3-dev dbus-dev \
     9.5  libxml2-dev"
     9.6  
     9.7 +# What is the latest version available today?
     9.8 +current_version()
     9.9 +{
    9.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
    9.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
    9.12 +}
    9.13 +
    9.14  # Rules to configure and make the package.
    9.15  compile_rules()
    9.16  {
    10.1 --- a/dasm/receipt	Thu Feb 17 17:41:58 2022 +0100
    10.2 +++ b/dasm/receipt	Fri Feb 18 09:29:30 2022 +0000
    10.3 @@ -13,6 +13,13 @@
    10.4  
    10.5  TAGS="6502 6507 6803 68705 68HC11 HD6303 F8"
    10.6  
    10.7 +# What is the latest version available today?
    10.8 +current_version()
    10.9 +{
   10.10 +	wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \
   10.11 +	sed '/archive.*tar/!d;s|.*/v*\(.*\).tar.*|\1|;q'
   10.12 +}
   10.13 +
   10.14  # Rules to configure and make the package.
   10.15  compile_rules()
   10.16  {
    11.1 --- a/ecj/receipt	Thu Feb 17 17:41:58 2022 +0100
    11.2 +++ b/ecj/receipt	Fri Feb 18 09:29:30 2022 +0000
    11.3 @@ -22,6 +22,13 @@
    11.4  DEPENDS=""
    11.5  BUILD_DEPENDS=""
    11.6  
    11.7 +# What is the latest version available today?
    11.8 +current_version()
    11.9 +{
   11.10 +	wget -O - ${WGET_URL%/*/*/*}/ 2>/dev/null | \
   11.11 +	sed '/Latest Release"/!d;s|.*R-||;s|-.*||;q'
   11.12 +}
   11.13 +
   11.14  # Rules to configure and make the package.
   11.15  compile_rules()
   11.16  {
    12.1 --- a/eduke32/receipt	Thu Feb 17 17:41:58 2022 +0100
    12.2 +++ b/eduke32/receipt	Fri Feb 18 09:29:30 2022 +0000
    12.3 @@ -14,6 +14,13 @@
    12.4  DEPENDS="libsdl libsdl-mixer libvorbis gtk+ eduke32-data"
    12.5  BUILD_DEPENDS="libsdl-dev libsdl-mixer-dev libvorbis-dev gtk+-dev nasm mesa-dev"
    12.6  
    12.7 +# What is the latest version available today?
    12.8 +current_version()
    12.9 +{
   12.10 +	wget -O - ${WGET_URL%/*/*}/ 2>/dev/null | \
   12.11 +	sed '/folder.png/!d;s|.*href="||;s|/".*||;q'
   12.12 +}
   12.13 +
   12.14  # Rules to configure and make the package.
   12.15  compile_rules()
   12.16  {
    13.1 --- a/fuse-rofs/receipt	Thu Feb 17 17:41:58 2022 +0100
    13.2 +++ b/fuse-rofs/receipt	Fri Feb 18 09:29:30 2022 +0000
    13.3 @@ -14,6 +14,13 @@
    13.4  DEPENDS="fuse"
    13.5  BUILD_DEPENDS="wget fuse-dev"
    13.6  
    13.7 +# What is the latest version available today?
    13.8 +current_version()
    13.9 +{
   13.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
   13.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
   13.12 +}
   13.13 +
   13.14  # Rules to configure and make the package.
   13.15  compile_rules()
   13.16  {
    14.1 --- a/hdf5/receipt	Thu Feb 17 17:41:58 2022 +0100
    14.2 +++ b/hdf5/receipt	Fri Feb 18 09:29:30 2022 +0000
    14.3 @@ -14,6 +14,15 @@
    14.4  DEPENDS="zlib"
    14.5  BUILD_DEPENDS="cmake szip zlib-dev"
    14.6  
    14.7 +# What is the latest version available today?
    14.8 +current_version()
    14.9 +{
   14.10 +	wget -O - https://support.hdfgroup.org/ftp/HDF5/releases/$( \
   14.11 +	wget -O - https://support.hdfgroup.org/ftp/HDF5/releases/ 2>/dev/null | \
   14.12 +	sed '/\/">hdf5-[0-9]/!d;s|.*hdf5-|hdf5-|;s|/.*|/|' | sort -Vr | sed q) 2>/dev/null | \
   14.13 +	sed '/\/">hdf5-[0-9]/!d;s|.*hdf5-||;s|/.*||' | sort -Vr | sed q
   14.14 +}
   14.15 +
   14.16  # Rules to configure and make the package.
   14.17  compile_rules()
   14.18  {
    15.1 --- a/imapbox/receipt	Thu Feb 17 17:41:58 2022 +0100
    15.2 +++ b/imapbox/receipt	Fri Feb 18 09:29:30 2022 +0000
    15.3 @@ -14,6 +14,13 @@
    15.4  DEPENDS="python-chardet python-six"
    15.5  SUGGESTED="python-pdfkit"
    15.6  
    15.7 +# What is the latest version available today?
    15.8 +current_version()
    15.9 +{
   15.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
   15.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
   15.12 +}
   15.13 +
   15.14  # Rules to configure and make the package.
   15.15  compile_rules()
   15.16  {
    16.1 --- a/jsmin/receipt	Thu Feb 17 17:41:58 2022 +0100
    16.2 +++ b/jsmin/receipt	Fri Feb 18 09:29:30 2022 +0000
    16.3 @@ -15,6 +15,13 @@
    16.4  DEPENDS=""
    16.5  BUILD_DEPENDS=""
    16.6  
    16.7 +# What is the latest version available today?
    16.8 +current_version()
    16.9 +{
   16.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
   16.11 +	sed '/commits_list_item/!d;s|.*commits/\(..........\).*|\1|;q'
   16.12 +}
   16.13 +
   16.14  # Rules to configure and make the package.
   16.15  compile_rules()
   16.16  {
    17.1 --- a/libsde-utils-jansson/receipt	Thu Feb 17 17:41:58 2022 +0100
    17.2 +++ b/libsde-utils-jansson/receipt	Fri Feb 18 09:29:30 2022 +0000
    17.3 @@ -16,6 +16,13 @@
    17.4  libsde-utils libsde-utils-gtk"
    17.5  #libsde-utils-dev libsde-utils-gtk-dev"
    17.6  
    17.7 +# What is the latest version available today?
    17.8 +current_version()
    17.9 +{
   17.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
   17.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
   17.12 +}
   17.13 +
   17.14  # Rules to configure and make the package.
   17.15  compile_rules()
   17.16  {
    18.1 --- a/libsde-utils-x11/receipt	Thu Feb 17 17:41:58 2022 +0100
    18.2 +++ b/libsde-utils-x11/receipt	Fri Feb 18 09:29:30 2022 +0000
    18.3 @@ -14,6 +14,13 @@
    18.4  DEPENDS="libsde-utils xorg-libX11"
    18.5  BUILD_DEPENDS="git cmake xorg-dev libsde-utils"
    18.6  
    18.7 +# What is the latest version available today?
    18.8 +current_version()
    18.9 +{
   18.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
   18.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
   18.12 +}
   18.13 +
   18.14  # Rules to configure and make the package.
   18.15  compile_rules()
   18.16  {
    19.1 --- a/libzen/receipt	Thu Feb 17 17:41:58 2022 +0100
    19.2 +++ b/libzen/receipt	Fri Feb 18 09:29:30 2022 +0000
    19.3 @@ -14,6 +14,13 @@
    19.4  DEPENDS=""
    19.5  BUILD_DEPENDS="automake libtool"
    19.6  
    19.7 +# What is the latest version available today?
    19.8 +current_version()
    19.9 +{
   19.10 +	wget -O - ${WGET_URL%/*/*}/ 2>/dev/null | \
   19.11 +	sed '/folder.png/!d;s|.*href="||;s|/.*||;q'
   19.12 +}
   19.13 +
   19.14  # Rules to configure and make the package.
   19.15  compile_rules()
   19.16  {
    20.1 --- a/linux-libre-api-headers/receipt	Thu Feb 17 17:41:58 2022 +0100
    20.2 +++ b/linux-libre-api-headers/receipt	Fri Feb 18 09:29:30 2022 +0000
    20.3 @@ -12,6 +12,13 @@
    20.4  WEB_SITE="http://www.fsfla.org/svnwiki/selibre/linux-libre/"
    20.5  WGET_URL="http://www.fsfla.org/svnwiki/selibre/linux-libre/download/releases/$VERSION/$TARBALL"
    20.6  
    20.7 +# What is the latest version available today?
    20.8 +current_version()
    20.9 +{
   20.10 +	wget -O - http://linux-libre.fsfla.org/pub/linux-libre/releases/ 2> /dev/null | \
   20.11 +	sed '/-gnu/!d;s|.*ref="||;s|/".*||' | sed '$!d'
   20.12 +}
   20.13 +
   20.14  # Rules to compile & install the temporary toolchain.
   20.15  cook_tmp_toolchain()
   20.16  {
    21.1 --- a/linux-libre/receipt	Thu Feb 17 17:41:58 2022 +0100
    21.2 +++ b/linux-libre/receipt	Fri Feb 18 09:29:30 2022 +0000
    21.3 @@ -15,6 +15,7 @@
    21.4  BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod bc \
    21.5  sysfsutils-dev libtool glib-dev libwrap libwrap-dev udev-dev"
    21.6  
    21.7 +# What is the latest version available today?
    21.8  current_version()
    21.9  {
   21.10  	wget -O - http://linux-libre.fsfla.org/pub/linux-libre/releases/ 2> /dev/null | \
    22.1 --- a/lvmts/receipt	Thu Feb 17 17:41:58 2022 +0100
    22.2 +++ b/lvmts/receipt	Fri Feb 18 09:29:30 2022 +0000
    22.3 @@ -14,6 +14,13 @@
    22.4  DEPENDS="lvm2 blktrace libconfuse"
    22.5  BUILD_DEPENDS="wget lvm2-dev libconfuse"
    22.6  
    22.7 +# What is the latest version available today?
    22.8 +current_version()
    22.9 +{
   22.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
   22.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
   22.12 +}
   22.13 +
   22.14  # Rules to configure and make the package.
   22.15  compile_rules()
   22.16  {
    23.1 --- a/mesa-demos/receipt	Thu Feb 17 17:41:58 2022 +0100
    23.2 +++ b/mesa-demos/receipt	Fri Feb 18 09:29:30 2022 +0000
    23.3 @@ -13,6 +13,13 @@
    23.4  DEPENDS="glew"
    23.5  BUILD_DEPENDS="glew-dev mesa-dev talloc-dev libegl-mesa pkg-config udev-dev"
    23.6  
    23.7 +# What is the latest version available today?
    23.8 +current_version()
    23.9 +{
   23.10 +	wget -O - ${WGET_URL%/*/*}/ 2>/dev/null | \
   23.11 +	sed "/latest/d;/$PACKAGE-[0-9]/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*|\\1|" | sort -Vr | sed q
   23.12 +}
   23.13 +
   23.14  # Rules to configure and make the package.
   23.15  compile_rules()
   23.16  { 
    24.1 --- a/mesa/receipt	Thu Feb 17 17:41:58 2022 +0100
    24.2 +++ b/mesa/receipt	Fri Feb 18 09:29:30 2022 +0000
    24.3 @@ -22,6 +22,13 @@
    24.4  	xorg-libXdamage-dev xorg-libXt-dev xorg-libXxf86vm-dev 
    24.5  	xorg-makedepend xorg-server-dev"
    24.6  
    24.7 +# What is the latest version available today?
    24.8 +current_version()
    24.9 +{
   24.10 +	wget -O - ftp://ftp.freedesktop.org/pub/mesa/ 2>/dev/null | \
   24.11 +	sed "/latest/d;/$PACKAGE-[0-9]/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*|\\1|" | sort -Vr | sed q
   24.12 +}
   24.13 +
   24.14  # Rules to configure and make the package.
   24.15  compile_rules()
   24.16  {
    25.1 --- a/ocsinventory-agent/receipt	Thu Feb 17 17:41:58 2022 +0100
    25.2 +++ b/ocsinventory-agent/receipt	Fri Feb 18 09:29:30 2022 +0000
    25.3 @@ -15,6 +15,13 @@
    25.4  DEPENDS="perl perl-libwww perl-uri dmidecode"
    25.5  BUILD_DEPENDS="perl wget"
    25.6  
    25.7 +# What is the latest version available today?
    25.8 +current_version()
    25.9 +{
   25.10 +	wget -O - https://launchpad.net/ocsinventory-unix-agent/ 2>/dev/null | \
   25.11 +	sed '/Latest version/!d;s|.*is ||'
   25.12 +}
   25.13 +
   25.14  # Rules to configure and make the package.
   25.15  compile_rules()
   25.16  {
    26.1 --- a/ocsinventory/receipt	Thu Feb 17 17:41:58 2022 +0100
    26.2 +++ b/ocsinventory/receipt	Fri Feb 18 09:29:30 2022 +0000
    26.3 @@ -15,6 +15,13 @@
    26.4  DEPENDS="ocsinventory-server ocsinventory-agent ocsreports"
    26.5  BUILD_DEPENDS="perl perl-dbd-mysql perl-apache-dbi perl-net-ip wget"
    26.6  
    26.7 +# What is the latest version available today?
    26.8 +current_version()
    26.9 +{
   26.10 +	wget -O - https://launchpad.net/ocsinventory-server/ 2>/dev/null | \
   26.11 +	sed '/Latest version/!d;s|.*is ||'
   26.12 +}
   26.13 +
   26.14  # Rules to configure and make the package.
   26.15  compile_rules()
   26.16  {
    27.1 --- a/openshot/receipt	Thu Feb 17 17:41:58 2022 +0100
    27.2 +++ b/openshot/receipt	Fri Feb 18 09:29:30 2022 +0000
    27.3 @@ -17,6 +17,13 @@
    27.4  BUILD_DEPENDS="mlt-dev librsvg-dev libsdl-dev frei0r-plugins-dev sox-dev \
    27.5  ffmpeg-dev goocanvas-dev wget"
    27.6  
    27.7 +# What is the latest version available today?
    27.8 +current_version()
    27.9 +{
   27.10 +	wget -O - https://launchpad.net/openshot/ 2>/dev/null | \
   27.11 +	sed '/Latest version/!d;s|.*is ||'
   27.12 +}
   27.13 +
   27.14  # Rules to configure and make the package.
   27.15  compile_rules() {
   27.16  	python setup.py install --root=$DESTDIR --optimize=1
    28.1 --- a/pi-blaster/receipt	Thu Feb 17 17:41:58 2022 +0100
    28.2 +++ b/pi-blaster/receipt	Fri Feb 18 09:29:30 2022 +0000
    28.3 @@ -12,6 +12,13 @@
    28.4  WGET_URL="https://codeload.github.com/sarfata/pi-blaster/zip/$GITHASH"
    28.5  HOST_ARCH="arm"
    28.6  
    28.7 +# What is the latest version available today?
    28.8 +current_version()
    28.9 +{
   28.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
   28.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
   28.12 +}
   28.13 +
   28.14  # Rules to configure and make the package.
   28.15  compile_rules()
   28.16  {
    29.1 --- a/piclass-code-examples/receipt	Thu Feb 17 17:41:58 2022 +0100
    29.2 +++ b/piclass-code-examples/receipt	Fri Feb 18 09:29:30 2022 +0000
    29.3 @@ -15,6 +15,13 @@
    29.4  TAGS="python raspberrypi rpi"
    29.5  DEPENDS="python python-smbus i2c-tools slitaz-arm-rpi"
    29.6  
    29.7 +# What is the latest version available today?
    29.8 +current_version()
    29.9 +{
   29.10 +	wget -O - https://github.com/piclass/code-examples/commits/master 2>/dev/null | \
   29.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
   29.12 +}
   29.13 +
   29.14  # Rules to configure and make the package.
   29.15  compile_rules()
   29.16  {
    30.1 --- a/pifmrds/receipt	Thu Feb 17 17:41:58 2022 +0100
    30.2 +++ b/pifmrds/receipt	Fri Feb 18 09:29:30 2022 +0000
    30.3 @@ -17,6 +17,13 @@
    30.4  DEPENDS="libsndfile"
    30.5  BUILD_DEPENDS="wget libsndfile-dev"
    30.6  
    30.7 +# What is the latest version available today?
    30.8 +current_version()
    30.9 +{
   30.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
   30.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
   30.12 +}
   30.13 +
   30.14  # Rules to configure and make the package.
   30.15  compile_rules()
   30.16  {
    31.1 --- a/pwnat/receipt	Thu Feb 17 17:41:58 2022 +0100
    31.2 +++ b/pwnat/receipt	Fri Feb 18 09:29:30 2022 +0000
    31.3 @@ -12,6 +12,13 @@
    31.4  WGET_URL="https://github.com/samyk/pwnat/archive/$GITHASH.zip"
    31.5  TAGS="vpn nat traversal icmp tunnel"
    31.6  
    31.7 +# What is the latest version available today?
    31.8 +current_version()
    31.9 +{
   31.10 +	wget -O - ${WGET_URL%/*/*}/commits/master 2>/dev/null | \
   31.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
   31.12 +}
   31.13 +
   31.14  # Rules to configure and make the package.
   31.15  compile_rules()
   31.16  {
    32.1 --- a/python-pyajam/receipt	Thu Feb 17 17:41:58 2022 +0100
    32.2 +++ b/python-pyajam/receipt	Fri Feb 18 09:29:30 2022 +0000
    32.3 @@ -14,6 +14,13 @@
    32.4  DEPENDS="python"
    32.5  BUILD_DEPENDS="python-setuptools"
    32.6  
    32.7 +# What is the latest version available today?
    32.8 +current_version()
    32.9 +{
   32.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
   32.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
   32.12 +}
   32.13 +
   32.14  # Rules to configure and make the package.
   32.15  compile_rules()
   32.16  {
    33.1 --- a/python-rpi-adafruit/receipt	Thu Feb 17 17:41:58 2022 +0100
    33.2 +++ b/python-rpi-adafruit/receipt	Fri Feb 18 09:29:30 2022 +0000
    33.3 @@ -16,6 +16,13 @@
    33.4  # Leds support for now
    33.5  DEPENDS="python python-smbus i2c-tools slitaz-arm-rpi"
    33.6  
    33.7 +# What is the latest version available today?
    33.8 +current_version()
    33.9 +{
   33.10 +	wget -O - https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/commits/master 2>/dev/null | \
   33.11 +	sed '/commits_list_item/!d;s|.*commits/\(......\).*|\1|;q'
   33.12 +}
   33.13 +
   33.14  # Rules to gen a SliTaz package suitable for Tazpkg.
   33.15  genpkg_rules()
   33.16  {
    34.1 --- a/rcswitch-pi/receipt	Thu Feb 17 17:41:58 2022 +0100
    34.2 +++ b/rcswitch-pi/receipt	Fri Feb 18 09:29:30 2022 +0000
    34.3 @@ -15,6 +15,13 @@
    34.4  DEPENDS="wiringpi"
    34.5  BUILD_DEPENDS="wiringpi-dev"
    34.6  
    34.7 +# What is the latest version available today?
    34.8 +current_version()
    34.9 +{
   34.10 +	wget -O - $WEB_SITE/commits/master 2>/dev/null | \
   34.11 +	sed '/commits_list_item/!d;s|.*commits/\(.......\).*|\1|;q'
   34.12 +}
   34.13 +
   34.14  # Rules to configure and make the package.
   34.15  compile_rules()
   34.16  {
    35.1 --- a/reiserfsprogs/receipt	Thu Feb 17 17:41:58 2022 +0100
    35.2 +++ b/reiserfsprogs/receipt	Fri Feb 18 09:29:30 2022 +0000
    35.3 @@ -14,6 +14,13 @@
    35.4  DEPENDS="linux-reiserfs util-linux-uuid libcomerr"
    35.5  BUILD_DEPENDS="libcomerr-dev"
    35.6  
    35.7 +# What is the latest version available today?
    35.8 +current_version()
    35.9 +{
   35.10 +	wget -O - http://cdn.kernel.org/pub/linux/kernel/people/jeffm/reiserfsprogs/ 2>/dev/null | \
   35.11 +	sed '/href="v[0-9]/!d;s|.*"v||;s|/.*||;/x/d' | sort -Vr | sed q
   35.12 +}
   35.13 +
   35.14  # Rules to configure and make the package.
   35.15  compile_rules()
   35.16  {
    36.1 --- a/vanessa_socket/receipt	Thu Feb 17 17:41:58 2022 +0100
    36.2 +++ b/vanessa_socket/receipt	Fri Feb 18 09:29:30 2022 +0000
    36.3 @@ -14,6 +14,13 @@
    36.4  DEPENDS="popt vanessa_logger"
    36.5  BUILD_DEPENDS="popt-dev vanessa_logger-dev"
    36.6  
    36.7 +# What is the latest version available today?
    36.8 +current_version()
    36.9 +{
   36.10 +	wget -O - https://projects.horms.net/projects/vanessa/download/vanessa_socket/ 2>/dev/null | \
   36.11 +	sed '/href="[0-9]/!d;s|.*href="||;s|/.*||' | sort -Vr | sed q
   36.12 +}
   36.13 +
   36.14  # Rules to configure and make the package.
   36.15  compile_rules()
   36.16  {
    37.1 --- a/vlc-plugin/receipt	Thu Feb 17 17:41:58 2022 +0100
    37.2 +++ b/vlc-plugin/receipt	Fri Feb 18 09:29:30 2022 +0000
    37.3 @@ -15,6 +15,13 @@
    37.4  BUILD_DEPENDS="firefox-dev libvlc-dev dbus-dev gtk+-dev util-linux-uuid-dev"
    37.5  TAGS="browser plug-in"
    37.6  
    37.7 +# What is the latest version available today?
    37.8 +current_version()
    37.9 +{
   37.10 +	wget -O - http://download.videolan.org/pub/videolan/vlc/ 2>/dev/null | \
   37.11 +	sed '/href="[0-9]/!d;s|.*href="||;s|/.*||' | sort -Vr | sed q
   37.12 +}
   37.13 +
   37.14  # Rules to configure and make the package.
   37.15  compile_rules()
   37.16  {
    38.1 --- a/vzquota/receipt	Thu Feb 17 17:41:58 2022 +0100
    38.2 +++ b/vzquota/receipt	Fri Feb 18 09:29:30 2022 +0000
    38.3 @@ -13,6 +13,13 @@
    38.4  
    38.5  DEPENDS=""
    38.6  
    38.7 +# What is the latest version available today?
    38.8 +current_version()
    38.9 +{
   38.10 +	wget -O - http://download.openvz.org/utils/$PACKAGE/ 2>/dev/null | \
   38.11 +	sed '/href="[0-9]/!d;s|.*href="||;s|/.*||' | sort -Vr | sed q
   38.12 +}
   38.13 +
   38.14  # Rules to configure and make the package.
   38.15  compile_rules()
   38.16  {