Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to move Fonts out of HBIOS area to ROM Bank 3 #486

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
14 changes: 9 additions & 5 deletions Source/HBIOS/Bank Layout.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ ROM Bank Layout

Bank ID Module Start Size
------ ------ ------ ------
0x00 hbios 0x0000 0x8000
0x00 hbios 0x0000 0x7FFF
<crc> 0x7FFF 0x0001
<end> 0x8000

0x01 loader 0x0000 0x1000
dbgmon 0x1000 0x2000
cpm22 0x2000 0x3000
zsys 0x5000 0x3000
zsys 0x5000 0x2FFF
<crc> 0x7FFF 0x0001
<end> 0x8000

0x02 forth 0x0000 0x1700
Expand All @@ -18,10 +20,12 @@ Bank ID Module Start Size
egg 0x4900 0x0200
netboot 0x4B00 0x1000
updater 0x5B00 0x0D00
usrrom 0x6800 0x1800
usrrom 0x6800 0x7FFF
<crc> 0x7FFF 0x0001
<end> 0x8000

0x03 imgpad2 0x0000 0x8000
0x03 [fonts] 0x0000 0x7FFF
<crc> 0x7FFF 0x0001
<end> 0x8000

0x04 - N ROM Disk Data
Expand All @@ -34,7 +38,7 @@ Bank ID Usage
0x00 Boot Bank (HBIOS image)
0x01 ROM Loader, Monitor, ROM OSes
0x02 ROM Applications
0x03 Reserved
0x03 Optional Font storage, Cache.
0x04-0x0F ROM Disk Banks (12)


Expand Down
10 changes: 8 additions & 2 deletions Source/HBIOS/Build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set CPMDIR80=%TOOLS%/cpm/

::
:: This PowerShell script validates the build variables passed in. If
:: necessary, the user is prmopted to pick the variables. It then creates
:: necessary, the user is prompted to pick the variables. It then creates
:: an include file that is imbedded in the HBIOS assembly (build.inc).
:: It also creates a batch command file that sets environment variables
:: for use by the remainder of this batch file (build_env.cmd).
Expand Down Expand Up @@ -114,7 +114,7 @@ copy /b romldr.bin + dbgmon.bin + ..\zsdos\zsys_wbw.bin + ..\cpm22\cpm_wbw.bin o
copy /b ..\Forth\camel80.bin + nascom.bin + ..\tastybasic\src\tastybasic.bin + game.bin + eastaegg.bin + %NETBOOT% + updater.bin + sysconf.bin + usrrom.bin osimg1.bin || exit /b

if %Platform%==S100 (
zxcc slr180 -s100mon/fh
zxcc slr180 -s100mon/fh || exit /b
zxcc mload25 -s100mon || exit /b
copy /b s100mon.com osimg2.bin || exit /b
) else (
Expand All @@ -123,6 +123,12 @@ if %Platform%==S100 (

copy /b romldr.bin + dbgmon.bin + ..\zsdos\zsys_wbw.bin osimg_small.bin || exit /b

::
:: Split off anything above 32K mark of the hbios. This will be relocated to rom bank 3
::

"%TOOLS%\srecord\srec_cat.exe" hbios_rom.bin -Binary -crop 0x8000 0x10000 -offset -0x8000 -o osimg2.bin -Binary || exit /b
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An opinion:

This command overwrites and replaces the logic (116-122) that creates osimg2.bin. This will probably break S100 functionality, It would be easier to understand if you included this line in the above if statement

I don't see any conditional IF FONTS_INLINE around this code, should there be?

The concept of building an oversize hbios.bin file which you then split-up using this command, is counter to the approach used in much of the build. i.e. Generally should build smaller BIN files specifically with the content you need and append these files together using binary copy. better to stick to this approach for clarity and consistency

I didn't see any changes to makefile to support this change

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kiwisincebirth,

I have been having an offline conversation with @b1ackmai1er about this. This conversation probably should have been as part of this PR or a discussion in the repository. Sorry about that.

I had already suggested to @b1ackmai1er that the imbedding of the fonts in the alternate ROM bank be done differently. Specifically, I am advocating that all fonts be imbedded and indexed by a simple table of font id's and pointers. This would allow the fonts to just another chunk within a ROM bank (like all the other .bin chunks).

Thanks, Wayne


::
:: Inject one byte checksum at the last byte of all 4 ROM bank image files.
:: This means that computing a checksum over any of the 32K osimg banks
Expand Down
1 change: 1 addition & 0 deletions Source/HBIOS/cfg_MASTER.asm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ BIOS .EQU BIOS_NONE ; HARDWARE BIOS: BIOS_[WBW|UNA]
BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE
HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD)
USELZSA2 .EQU FALSE ; ENABLE FONT COMPRESSION
FONTS_INLINE .EQU TRUE ; FONT DATA LOCATION: TRUE=IN HBIOS FALSE=IN ROM BANK 3
TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ)
;
BT_REC_TYPE .EQU BT_REC_NONE ; BOOT RECOVERY METHOD TO USE
Expand Down
37 changes: 24 additions & 13 deletions Source/HBIOS/cvdu.asm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
; - IMPLEMENT SET CURSOR STYLE (VDASCS) FUNCTION
; - IMPLEMENT ALTERNATE DISPLAY MODES?
; - IMPLEMENT DYNAMIC READ/WRITE OF CHARACTER BITMAP DATA?
; - IMPLEMENT TIMEOUT ON PROBE
;
;======================================================================
; CVDU DRIVER - CONSTANTS
Expand Down Expand Up @@ -105,7 +104,7 @@ CVDU_INIT1:
CALL CVDU_CRTINIT ; SETUP THE CVDU CHIP REGISTERS
CALL PRTDEC
PRTS("KB$")
CALL CVDU_LOADFONT ; LOAD FONT DATA FROM ROM TO CVDU STRORAGE
CALL CVDU_LOADFONT ; LOAD FONT DATA FROM ROM TO CVDU STORAGE
CALL CVDU_VDARES
CALL KBD_INIT ; INITIALIZE KEYBOARD DRIVER

Expand Down Expand Up @@ -293,12 +292,18 @@ CVDU_VDARDC:
;
CVDU_WR:
PUSH AF ; SAVE VALUE TO WRITE
PUSH BC ;
LD A,C ; SET A TO CVDU REGISTER TO SELECT
OUT (CVDU_REG),A ; WRITE IT TO SELECT THE REGISTER
LD B,0
CVDU_WR1:
IN A,(CVDU_STAT) ; GET CVDU STATUS
BIT 7,A ; CHECK BIT 7
JR Z,CVDU_WR1 ; LOOP WHILE NOT READY (BIT 7 NOT SET)
JR NZ,CVDU_WRR ; EXIT WHEN READY (BIT 7 SET)
DJNZ CVDU_WR1
; ; IF WE GET HERE WE HAVE TIMED OUT
CVDU_WRR:
POP BC
POP AF ; RESTORE VALUE TO WRITE
OUT (CVDU_DATA),A ; WRITE IT
RET
Expand All @@ -320,20 +325,26 @@ CVDU_WRX:
CVDU_RD:
LD A,C ; SET A TO CVDU REGISTER TO SELECT
OUT (CVDU_REG),A ; WRITE IT TO SELECT THE REGISTER
PUSH BC
LD B,0
CVDU_RD1:
IN A,(CVDU_STAT) ; GET CVDU STATUS
BIT 7,A ; CHECK BIT 7
JR Z,CVDU_RD1 ; LOOP WHILE NOT READY (BIT 7 NOT SET)
JR NZ,CVDU_RDR ; EXIT WHEN READY (BIT 7 SET)
DJNZ CVDU_RD1
; ; IF WE GET HERE WE HAVE TIMED OUT
CVDU_RDR:
IN A,(CVDU_DATA) ; READ IT
POP BC
RET
;
CVDU_RDX:
CALL CVDU_RD ; GET VALUE FROM REGISTER IN C
LD H,A ; SAVE IN H
INC C ; BUMP TO NEXT REGISTER OF PAIR
CALL CVDU_RD ; READ THE VALUE
LD L,A ; SAVE IT IN L
RET
;CVDU_RDX:
; CALL CVDU_RD ; GET VALUE FROM REGISTER IN C
; LD H,A ; SAVE IN H
; INC C ; BUMP TO NEXT REGISTER OF PAIR
; CALL CVDU_RD ; READ THE VALUE
; LD L,A ; SAVE IT IN L
; RET
;
;----------------------------------------------------------------------
; PROBE FOR CVDU HARDWARE
Expand Down Expand Up @@ -439,11 +450,11 @@ CVDU_LOADFONT:
LD SP,HL ; HL POINTS TO BUFFER
EX DE,HL ; START OF STACK BUFFER
PUSH DE ; SAVE IT
LD HL,CVDU_FONT ; START OF FONT DATA
LD HL,CVDU_FONT & $7FFF ; START OF FONT DATA
CALL DLZSA2 ; DECOMPRESS TO DE
POP HL ; RECALL STACK BUFFER POSITION
#ELSE
LD HL,CVDU_FONT ; START OF FONT DATA
LD HL,CVDU_FONT & $7FFF ; START OF FONT DATA
#ENDIF

LD DE,$2000 ; LENGTH OF FONT DATA
Expand Down
2 changes: 1 addition & 1 deletion Source/HBIOS/eastaegg.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Adapted from https://rosettacode.org/wiki/Mandelbrot_set#Z80_Assembly
; by Phillip Summers [email protected]
;
; WBWROM SBV V2 Easteregg
; WBWROM Easteregg
;
; Compute a Mandelbrot set on a simple Z80 computer.
;
Expand Down
4 changes: 2 additions & 2 deletions Source/HBIOS/ef.asm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ EF_NOP .EQU $91 ;
EF_IND .EQU $80 ;
EF_CLF .EQU $05 ;
EF_OCT .EQU $30 ;
EF_OCTAUX .EQU $04 ; AUXILIARY POITER
EF_OCTAUX .EQU $04 ; AUXILIARY POINTER
EF_KRF .EQU $00 ; NO AUTOINCREMENT
EF_KRL .EQU $50 ; NO AUTOINCREMENT
EF_INY .EQU $B0 ; INC Y
Expand Down Expand Up @@ -383,7 +383,7 @@ EF_LOAD_INDIR: ; D = TARGET REGISTER, E = VALUE TO WRITE
RET
;
EF_LOAD_MODE: ; LOAD MODE
LD D,EF_TGSREG ; START INDIRECT REGISTER 1 : TGS
LD D,EF_TGSREG ; START INDIRECT REGISTER 1 : TGS
LD B,EF_INIT_CNT ; LOAD 5 INDIRECT REGISTERS
EF_MODEREG:
LD E,(HL)
Expand Down
70 changes: 70 additions & 0 deletions Source/HBIOS/fonts.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
;
;==================================================================================================
; FONTS
;==================================================================================================
;
HB_FONTS_BEG .EQU $
;
ORG_FONTS .EQU $
;
MEMECHO "FONTS"
;
#IFDEF USEFONT8X8
FONT8X8:

; WE NEVER COMPRESS THE 8X8 FONT AS THERE IS NOT ENOUGH SPACE TO DECOMPRESS THEM AT WARM BOOT

#IF USELZSA2 & FALSE
#INCLUDE "font8x8c.asm"
#ELSE
#INCLUDE "font8x8u.asm"
#ENDIF
MEMECHO " 8X8"
#ENDIF
;
#IFDEF USEFONT8X11
FONT8X11:
#IF USELZSA2
#INCLUDE "font8x11c.asm"
#ELSE
#INCLUDE "font8x11u.asm"
#ENDIF
MEMECHO " 8X11"
#ENDIF
;
#IFDEF USEFONT8X16
FONT8X16:
#IF USELZSA2
#INCLUDE "font8x16c.asm"
#ELSE
#INCLUDE "font8x16u.asm"
#ENDIF
MEMECHO " 8X16"
#ENDIF
;
#IFDEF USEFONTCGA
FONTCGA:
#IF USELZSA2
#INCLUDE "fontcgac.asm"
#ELSE
#INCLUDE "fontcgau.asm"
#ENDIF
MEMECHO " CGA"
#ENDIF
;
#IFDEF USEFONTVGARC
FONTVGARC:
#IF USELZSA2
#INCLUDE "fontvgarcc.asm"
#ELSE
#INCLUDE "fontvgarcu.asm"
#ENDIF
MEMECHO " VGARC"
#ENDIF
;
SIZ_FONTS .EQU $ - ORG_FONTS
MEMECHO " occupy "
MEMECHO SIZ_FONTS
MEMECHO " bytes.\n"
;
HB_FONTS_END .EQU $
Loading