diff --git a/.gitignore b/.gitignore index afba0a7..110687d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace +/.vscode/ +/obj/ +/penetrator.* \ No newline at end of file diff --git a/Makefile b/Makefile index 7cf845d..473d6d1 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ LIBS := # Default: none CONFIG := -# Additional C assembler flags and options. +# Additional C compiler flags and options. # Default: none CFLAGS = @@ -64,6 +64,7 @@ POSTEMUCMD := # VICE emulators. ifeq ($(OS),Windows_NT) VICE_HOME := + CX16_HOME := else UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) @@ -80,22 +81,22 @@ STATEFILE := Makefile.options ################################################################################### ################################################################################### -### Mapping abstract options to the actual assembler, assembler and linker flags ### -### Predefined assembler, assembler and linker flags, used with abstract options ### +### Mapping abstract options to the actual compiler, assembler and linker flags ### +### Predefined compiler, assembler and linker flags, used with abstract options ### ### valid for 2.14.x. Consult the documentation of your cc65 version before use ### ################################################################################### -# assembler flags used to tell the assembler to optimise for SPEED +# Compiler flags used to tell the compiler to optimise for SPEED define _optspeed_ CFLAGS += -Oris endef -# assembler flags used to tell the assembler to optimise for SIZE +# Compiler flags used to tell the compiler to optimise for SIZE define _optsize_ CFLAGS += -Or endef -# assembler and assembler flags for generating listings +# Compiler and assembler flags for generating listings define _listing_ CFLAGS += --listing $$(@:.o=.lst) ASFLAGS += --listing $$(@:.o=.lst) @@ -149,17 +150,8 @@ ifeq ($(OBJDIR),) endif TARGETOBJDIR := $(OBJDIR)/$(TARGETS) -# On Windows it is mandatory to have CC65_HOME set. So do not unnecessarily -# rely on cl65 being added to the PATH in this scenario. -ifdef CC65_HOME - CC := $(CC65_HOME)/bin/cl65 -else - CC := cl65 -endif - # Default emulator commands and options for particular targets. # Set EMUCMD to override. -cx16_EMUCMD := $(VICE_HOME)x16emu -run -prg c64_EMUCMD := $(VICE_HOME)x64 -kernal kernal -VICIIdsize -autostart c128_EMUCMD := $(VICE_HOME)x128 -kernal kernal -VICIIdsize -autoload vic20_EMUCMD := $(VICE_HOME)xvic -kernal kernal -VICdsize -autoload @@ -170,6 +162,9 @@ c16_EMUCMD := $(VICE_HOME)xplus4 -ramsize 16 -TEDdsize -autoload cbm510_EMUCMD := $(VICE_HOME)xcbm2 -model 510 -VICIIdsize -autoload cbm610_EMUCMD := $(VICE_HOME)xcbm2 -model 610 -Crtcdsize -autoload atari_EMUCMD := atari800 -windowed -xl -pal -nopatchall -run +apple2_EMUCMD := $(AWIN_HOME)AppleWin.exe -d1 +atmos_EMUCMD := $(ORIC_HOME)Oricutron.exe -t +cx16_EMUCMD := $(CX16_HOME)x16emu -run -prg ifeq ($(EMUCMD),) EMUCMD = $($(CC65TARGET)_EMUCMD) @@ -181,10 +176,10 @@ endif # The "Native Win32" GNU Make contains quite some workarounds to get along with # cmd.exe as shell. However it does not provide means to determine that it does -# actually activate those workarounds. Especially does $(SHELL) NOT contain the +# actually activate those workarounds. Especially $(SHELL) does NOT contain the # value 'cmd.exe'. So the usual way to determine if cmd.exe is being used is to # execute the command 'echo' without any parameters. Only cmd.exe will return a -# non-empy string - saying 'ECHO is on/off'. +# non-empty string - saying 'ECHO is on/off'. # # Many "Native Win32" programs accept '/' as directory delimiter just fine. How- # ever the internal commands of cmd.exe generally require '\' to be used. @@ -297,29 +292,28 @@ $(TARGETOBJDIR): vpath %.c $(SRCDIR)/$(TARGETLIST) $(SRCDIR) $(TARGETOBJDIR)/%.o: %.c | $(TARGETOBJDIR) - $(CC) -t $(CC65TARGET) -c --create-dep $(@:.o=.d) $(CFLAGS) -o $@ $< + cl65 -t $(CC65TARGET) -c --create-dep $(@:.o=.d) $(CFLAGS) -o $@ $< vpath %.s $(SRCDIR)/$(TARGETLIST) $(SRCDIR) $(TARGETOBJDIR)/%.o: %.s | $(TARGETOBJDIR) - $(CC) -t $(CC65TARGET) -c --create-dep $(@:.o=.d) $(ASFLAGS) -o $@ $< + cl65 -t $(CC65TARGET) -c --create-dep $(@:.o=.d) $(ASFLAGS) -o $@ $< vpath %.asm $(SRCDIR)/$(TARGETLIST) $(SRCDIR) $(TARGETOBJDIR)/%.o: %.asm | $(TARGETOBJDIR) - $(CC) -t $(CC65TARGET) -c --create-dep $(@:.o=.d) $(ASFLAGS) -o $@ $< + cl65 -t $(CC65TARGET) -c --create-dep $(@:.o=.d) $(ASFLAGS) -o $@ $< vpath %.a65 $(SRCDIR)/$(TARGETLIST) $(SRCDIR) $(TARGETOBJDIR)/%.o: %.a65 | $(TARGETOBJDIR) - $(CC) -t $(CC65TARGET) -c --create-dep $(@:.o=.d) $(ASFLAGS) -o $@ $< + cl65 -t $(CC65TARGET) -c --create-dep $(@:.o=.d) $(ASFLAGS) -o $@ $< $(PROGRAM): $(CONFIG) $(OBJECTS) $(LIBS) - $(CC) -t $(CC65TARGET) $(LDFLAGS) -o $@ $(patsubst %.cfg,-C %.cfg,$^) + cl65 -t $(CC65TARGET) $(LDFLAGS) -o $@ $(patsubst %.cfg,-C %.cfg,$^) test: $(PROGRAM) $(PREEMUCMD) - @echo $(EMUCMD) $< $(EMUCMD) $< $(POSTEMUCMD) diff --git a/README.md b/README.md index ae67640..3774482 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # penetrator - Remake of the ZX Spectrum game for the Commander X16. + Remake of the ZX Spectrum game for the Commander X16. (Emu R37) 1. INTRODUCTION diff --git a/src/defs.inc b/src/defs.inc index 2b7a7e5..3213b47 100644 --- a/src/defs.inc +++ b/src/defs.inc @@ -6,45 +6,18 @@ ; This is free and unencumbered software released into the public domain. ;----------------------------------------------------------------------------- -; VERA -VERA_ADDR_LO = $9F20 -VERA_ADDR_MID = $9F21 -VERA_ADDR_HI = $9F22 -VERA_DATA0 = $9F23 -VERA_DATA1 = $9F24 -VERA_CTRL = $9F25 -VERA_IEN = $9F26 -VERA_ISR = $9F27 - -DC_VIDEO = $00 -DC_HSCALE = $01 -DC_VSCALE = $02 -DC_BORDER_COLOR = $03 -DC_HSTART_L = $04 -DC_HSTOP_L = $05 -DC_VSTART_L = $06 -DC_VSTOP_L = $07 -DC_STARTSTOP_H = $08 - -VERA_regs_hi = $0F -VERA_regs_layer0 = $2000 -VERA_regs_layer1 = $3000 +; VRAM locations ram_layer0 = $0000 ; after title, layer 0 memory here ram_layer1 = $5000 ; after title, layer 1 memory here gfx_layer1 = $0000 ; the 4bpp title screen memory start -Ln_CTRL0 = $00 -Ln_CTRL1 = $01 -Ln_TILE_BASE_H = $05 -Ln_BM_PAL_OFFS = $07 ;----------------------------------------------------------------------------- ; System locations -; These are for r34 - find them in rom.sym in the emulator folder -TIME_1 = $0293 ; TIME is at $0292 - +1 is APPROX 3.75 sec/tick -TIME_2 = $0294 ; TIME is at $0292 - +2 is the 16 ms counter -NDX = $029E -JOY1 = $02BC -GETJOY = $FF06 +; These are for r37 - find them in kernal.sym in the emulator folder +NDX = $A00A +TIME_1 = $A038 ; TIMER is at $A037 (bank 0) - +1 is APPROX 3.75 sec/tick +TIME_2 = $A039 ; +2 is the jiffy counter (also at $A03D?) +JOYGET = $FF56 SETLFS = $FFBA SETNAM = $FFBD LOAD = $FFD5 diff --git a/src/draw.inc b/src/draw.inc index 2e4b744..4b93a59 100644 --- a/src/draw.inc +++ b/src/draw.inc @@ -18,15 +18,21 @@ sta backLayer beq :+ - vpoke VERA_regs_hi, VERA_regs_layer0 + Ln_CTRL0, $a1 - vpoke VERA_regs_hi, VERA_regs_layer1 + Ln_CTRL0, $a0 + lda VERA::DISP::VIDEO + and #%11001111 ; both latyers off + ora #%00010000 ; turn layer 0 on + sta VERA::DISP::VIDEO + lda #>ram_layer1 sta zVramH rts : - vpoke VERA_regs_hi, VERA_regs_layer0 + Ln_CTRL0, $a0 - vpoke VERA_regs_hi, VERA_regs_layer1 + Ln_CTRL0, $a1 + lda VERA::DISP::VIDEO + and #%11001111 ; both latyers off + ora #%00100000 ; turn layer 1 on + sta VERA::DISP::VIDEO + lda #>ram_layer0 sta zVramH rts @@ -41,19 +47,19 @@ pha clc lda rowL, y ; strictly also adc layersL, x but always 256-byte aligned - sta VERA_ADDR_LO + sta VERA::ADDR ;LO lda rowH, y adc layersH, x - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ;MID lda #$10 ; 1 byte step size and 0 for top address - sta VERA_ADDR_HI + sta VERA::ADDR + 2 ;HI pla ; put the # of rows in Y tay lda #$00 row: ldx #XSIZE ; and all columns : - sta VERA_DATA0 ; set to 0 + sta VERA::DATA0 ; set to 0 dex bne :- dey @@ -90,22 +96,22 @@ row: asl tax ; use as offset into palette table - lda #$1F ; set vera for palette entry - sta VERA_ADDR_HI - lda #>$1000 - sta VERA_ADDR_MID - lda #<$1000 - sta VERA_ADDR_LO + lda #$11 ; set vera for palette entry + sta VERA::ADDR + 2 ; HI + lda #>$FA00 + sta VERA::ADDR + 1 ; MID + lda #<$FA00 + sta VERA::ADDR ; LO : lda gamePalette, x ; store the palette into vera - sta VERA_DATA0 + sta VERA::DATA0 inx dey bne :- lda #$00 ; restore the HI addr to 0 (is assumed elsewhere) - sta VERA_ADDR_HI + sta VERA::ADDR + 2 ; HI rts @@ -137,19 +143,19 @@ row: sta rows ; save as count for how many rows lda #$10 ; to be sure, set the stride to 1 - sta VERA_ADDR_HI + sta VERA::ADDR + 2 ; HI loop: lda rowL, y adc x0 ; get the x y address - sta VERA_ADDR_LO + sta VERA::ADDR ; LO lda rowH, y adc zVramH - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID lda plotCol ; get the plot color ldx width ; get how wide to go : - sta VERA_DATA0 ; write one row of pixels + sta VERA::DATA0 ; write one row of pixels dex bne :- iny ; keep doing till @@ -186,15 +192,15 @@ column: rows: lda rowL, y ; get the screen row start address, low byte adc zaScreenColLocal ; add the column to the address - sta VERA_ADDR_LO ; set vera low address + sta VERA::ADDR ; set vera low address lda rowH, y ; get the high byte of the screen row start adc zVramH ; add the VRAM high byte (for which layer) - sta VERA_ADDR_MID ; set the Vera MID (high is already = 0) + sta VERA::ADDR + 1 ; set the Vera MID (high is already = 0) offset: lda spriteData, x ; this address is modified by the caller sta zaDrawByte ; save the byte - eor VERA_DATA0 ; get what's on screen xor'd with what's being added - sta VERA_DATA0 ; save that to the screen + eor VERA::DATA0 ; get what's on screen xor'd with what's being added + sta VERA::DATA0 ; save that to the screen and zaDrawByte ; mask off any bits that the sprite isn't setting cmp zaDrawByte ; see if the sprite overlapped something there already clc ; cmp can set carry. keep it clear @@ -589,13 +595,13 @@ bullet: clc ; put the bullet at height y col x on screen adc rowL, y - sta VERA_ADDR_LO + sta VERA::ADDR lda rowH, y adc zVramH - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID lda #$ff ; bullet is a solid line - eor VERA_DATA0 - sta VERA_DATA0 + eor VERA::DATA0 + sta VERA::DATA0 cmp #$ff ; see if it hit something beq next ; no collision, next (prev) column/bullet diff --git a/src/edit.inc b/src/edit.inc index 538a62a..a1f7eb0 100644 --- a/src/edit.inc +++ b/src/edit.inc @@ -13,7 +13,8 @@ jsr drawClearScreen ; make sure the screen is clear before adjusting the - vpoke VERA_regs_hi, DC_VSCALE, VSCALE_GAME ; make the screen shorter to be more spectrum-like for gameplay + lda #VSCALE_GAME ; make the screen shorter to be more spectrum-like for gameplay + sta VERA::DISP::VSCALE jsr editInit jsr editLoadStage @@ -288,7 +289,7 @@ missile: print textEditDnArrow, playerShipX, 0, #$ff ; redraw arrow to fix out of top cursor overwrite lda #$10 ; stride of 1 - sta VERA_ADDR_HI + sta VERA::ADDR + 2 ; HI lda #$87 ; cursor symbol ldy #0 @@ -305,17 +306,17 @@ plotLoop: lda rowL, y ; get the memory address clc adc playerShipX ; add in column - sta VERA_ADDR_LO ; point vera at memory + sta VERA::ADDR ; point vera at memory lda rowH, y adc layersH, x - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID ldy zaFontOffset ; get the offset into the character lda (zaFontL), y ; get the actual left character byte - sta VERA_DATA0 ; plot the left hand side + sta VERA::DATA0 ; plot the left hand side iny ; go to next byte (right hand side of character) lda (zaFontL), y - sta VERA_DATA0 + sta VERA::DATA0 cpy #$0A ; cursor character is 5 rows high, * 2 is 10 bytes long bcs done ; if 10 then done with the cursor inc zaFontOffset ; move 2 bytes for last row plotted diff --git a/src/file.inc b/src/file.inc index d6e7cb8..9eeca21 100644 --- a/src/file.inc +++ b/src/file.inc @@ -19,7 +19,7 @@ ldy #>textFileName jsr SETNAM lda #$00 ; logical number - ldx #$01 ; device 1 + ldx #$08 ; device 8 ldy #$01 ; secondary address jsr SETLFS @@ -44,7 +44,7 @@ ldy #>textFileName jsr SETNAM lda #$00 ; logical number - ldx #$01 ; device 1 + ldx #$08 ; device 8 ldy #$01 ; secondary address jsr SETLFS ldx # 2 - .error "Parameters issue for macro vpokex" - .endif - - lda VERA_ADDR_HI - and $f0 - ora #(argx) - sta VERA_ADDR_HI - lda #>(argy) - sta VERA_ADDR_MID - lda #<(argy) - sta VERA_ADDR_LO - stx VERA_DATA0 - -.endmacro - -;----------------------------------------------------------------------------- -.macro vpoke argx, argy, argz - - .if .paramcount <> 3 - .error "Parameters issue for macro vpoke" - .endif - - ldx #(argz) - vpokex (argx), (argy) - -.endmacro - -;----------------------------------------------------------------------------- -.macro vpeek argx, argy - - .if .paramcount <> 2 - .error "Parameters issue for macro vpeek" - .endif - - lda VERA_ADDR_HI - and $f0 - ora #(argx) - sta VERA_ADDR_HI - lda #>(argy) - sta VERA_ADDR_MID - lda #<(argy) - sta VERA_ADDR_LO - lda VERA_DATA0 - -.endmacro - ;----------------------------------------------------------------------------- .macro printZAStr sx, sy, mask diff --git a/src/penetrator.asm b/src/penetrator.asm index 2bb52b0..e527012 100644 --- a/src/penetrator.asm +++ b/src/penetrator.asm @@ -18,6 +18,7 @@ jmp main ; This ends up at $080d (sys 2061's target) ;----------------------------------------------------------------------------- +.include "cx16.inc" ; cc65 VERA etc defenitions .include "defs.inc" ; constants .include "macros.inc" ; vpoke, vpeek, print* & wait. .include "zpvars.inc" ; Zero Page usage (variables) @@ -53,14 +54,10 @@ jmp main ; This ends up at $080d (sys 206 .proc mainVeraSetup lda #%10000000 ; Reset Vera just to be sure the game starts in a known state - sta VERA_CTRL + ora VERA::CTRL - vpoke VERA_regs_hi, DC_VIDEO , $01 ; this shouldn't be necessary surely? VGA - vpoke VERA_regs_hi, DC_HSTART_L , $00 ; turn the border off - left - vpoke VERA_regs_hi, DC_HSTOP_L , $80 ; right - vpoke VERA_regs_hi, DC_VSTART_L , $00 ; top - vpoke VERA_regs_hi, DC_VSTOP_L , $E0 ; bottom - vpoke VERA_regs_hi, DC_STARTSTOP_H, $28 + lda #0 ; put ram bank 0 in memory + sta VIA1::PRA rts @@ -71,14 +68,23 @@ jmp main ; This ends up at $080d (sys 206 jsr drawClearScreen - vpoke VERA_regs_hi, DC_HSCALE, HSCALE + lda #HSCALE + 1 ; Adjusted this and HSTOP so I don't have to re-encode the + sta VERA::DISP::HSCALE ; logo for the changes from R34 to R37 jsr uiShowLogoGraphic - vpoke VERA_regs_hi, DC_HSTART_L, $51 ; turn the border on - left - vpoke VERA_regs_hi, DC_HSTOP_L , $30 ; right - vpoke VERA_regs_hi, DC_VSTART_L, $12 ; top - vpoke VERA_regs_hi, DC_VSTOP_L , $CC ; bottom + lda #%00000010 + sta VERA::CTRL ; Map border controls in + lda #20 ; now set the borders (h/4 and v/2) + sta VERA::DISP::HSTART + lda #138 + sta VERA::DISP::HSTOP + lda #(20/2) + sta VERA::DISP::VSTART + lda #((480-15)/2) + sta VERA::DISP::VSTOP + lda #%00000000 + sta VERA::CTRL lda #0 sta NDX ; flush the keyboard buffer (before the load display) @@ -89,10 +95,20 @@ jmp main ; This ends up at $080d (sys 206 jsr inputCheckForInput ; wait for user interaction beq :- - vpoke VERA_regs_hi, DC_HSTART_L, $00 ; turn the border off - left - vpoke VERA_regs_hi, DC_HSTOP_L , $80 ; right - vpoke VERA_regs_hi, DC_VSTART_L, $00 ; top - vpoke VERA_regs_hi, DC_VSTOP_L , $E0 ; bottom + lda #%00000010 + sta VERA::CTRL + + lda #0 + sta VERA::DISP::HSTART + lda #640/4 + sta VERA::DISP::HSTOP + lda #0 + sta VERA::DISP::VSTART + lda #480/2 + sta VERA::DISP::VSTOP + + lda #%00000000 + sta VERA::CTRL rts @@ -102,22 +118,30 @@ jmp main ; This ends up at $080d (sys 206 .proc mainGameSetup lda #0 ; Set channel and address lo - sta VERA_CTRL ; all functions leave with low active (convention) + sta VERA::CTRL ; all functions leave with low active (convention) - vpoke VERA_regs_hi, DC_VSCALE, VSCALE_UI ; this is adjusted in the flow - vpoke VERA_regs_hi, DC_HSCALE, HSCALE ; reset because in dev I skip mainIntro + lda #VSCALE_UI ; this is adjusted in the flow + sta VERA::DISP::VSCALE ; reset because in dev I skip mainIntro + lda #HSCALE + sta VERA::DISP::HSCALE -; layer0 mem at ram_layer0 - vpoke VERA_regs_hi, VERA_regs_layer0 + Ln_TILE_BASE_H, (ram_layer0 >> 10) -; layer1 mem at ram_layer1 - vpoke VERA_regs_hi, VERA_regs_layer1 + Ln_TILE_BASE_H, (ram_layer1 >> 10) + + lda #(ram_layer0 >> 9) ; layer0 mem at ram_layer0 + sta VERA::L0::TILE_BASE + + lda #(ram_layer1 >> 9) ; layer1 mem at ram_layer1 + sta VERA::L1::TILE_BASE lda #0 ; mark a layer as inactive sta backLayer -; hide both layers - vpoke VERA_regs_hi, VERA_regs_layer0 + Ln_CTRL0, $a0 - vpoke VERA_regs_hi, VERA_regs_layer1 + Ln_CTRL0, $a0 + lda VERA::DISP::VIDEO + and #%11001111 ; both latyers off + sta VERA::DISP::VIDEO + + lda #%00000101 ; set bitmap mode and 2bpp + sta VERA::L0::CONFIG + sta VERA::L1::CONFIG ldx #((textHSEnd-textHS) - 1) ; empty the high score names to spaces store: diff --git a/src/terrain.inc b/src/terrain.inc index e865f64..f136eb3 100644 --- a/src/terrain.inc +++ b/src/terrain.inc @@ -21,7 +21,7 @@ jsr drawClearRows ; clean the part where the world must draw lda #$00 ; 0 byte step size and 0 for top address - sta VERA_ADDR_HI + sta VERA::ADDR + 2 ; HI ldy terrainOrigin ; set up the column to start drawing sty zScreenCol @@ -81,24 +81,24 @@ done: up: ; new < old so go up lda rowL, y adc zScreenCol - sta VERA_ADDR_LO + sta VERA::ADDR lda rowH, y adc zVramH - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID lda #%01010000 ; start with a 2 pixel flat area - sta VERA_DATA0 + sta VERA::DATA0 dey ; go 1 row up inx beq skup ; if at new height now, skip the "up line" portion : lda rowL, y ; draw the "up line" portion now adc zScreenCol - sta VERA_ADDR_LO + sta VERA::ADDR lda rowH, y adc zVramH - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID lda #%00000100 ; write a single pixel up the rows - sta VERA_DATA0 + sta VERA::DATA0 dey ; row up inx bne :- ; keep going till old = new @@ -106,12 +106,12 @@ up: ; new < old so go up skup: lda rowL, y ; finish off the transition adc zScreenCol - sta VERA_ADDR_LO + sta VERA::ADDR lda rowH, y adc zVramH - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID lda #%00000001 ; by writing a pixel to connect to new - sta VERA_DATA0 ; (which will become old, in next column, to draw from) + sta VERA::DATA0 ; (which will become old, in next column, to draw from) rts eqdown: @@ -121,12 +121,12 @@ eqdown: down: ; new > old so go down - see up, same but inc|dec is reversed lda rowL, y adc zScreenCol - sta VERA_ADDR_LO + sta VERA::ADDR lda rowH, y adc zVramH - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID lda #%01010000 - sta VERA_DATA0 + sta VERA::DATA0 iny dex beq skdn @@ -134,12 +134,12 @@ down: ; new > old so go down - see up, : lda rowL, y adc zScreenCol - sta VERA_ADDR_LO + sta VERA::ADDR lda rowH, y adc zVramH - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID lda #%00000100 - sta VERA_DATA0 + sta VERA::DATA0 iny dex bne :- @@ -147,25 +147,24 @@ down: ; new > old so go down - see up, skdn: lda rowL, y adc zScreenCol - sta VERA_ADDR_LO + sta VERA::ADDR lda rowH, y adc zVramH - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID lda #%00000001 - sta VERA_DATA0 + sta VERA::DATA0 rts eq: ; flat line from old to new when equal lda rowL, y adc zScreenCol - sta VERA_ADDR_LO + sta VERA::ADDR lda rowH, y adc zVramH - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID lda #%01010101 ; 4 pixels in a line - sta VERA_DATA0 + sta VERA::DATA0 rts .endproc - diff --git a/src/text.inc b/src/text.inc index 91e1fec..21d1b82 100644 --- a/src/text.inc +++ b/src/text.inc @@ -149,7 +149,7 @@ szHex: .asciiz " " zaFontOffset = zTemp6 ; 0-15 - index from zaFont lda #$10 ; stride of 1 - sta VERA_ADDR_HI + sta VERA::ADDR + 2 ; HI loop: ldy #0 @@ -167,19 +167,19 @@ plotLoop: ldy yPos ; at the working row offset lda rowL, y ; get the memory address adc textX ; add in column (x pos of text) - sta VERA_ADDR_LO ; point vera at memory + sta VERA::ADDR ; point vera at memory lda rowH, y adc layersH, x - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID ldy zaFontOffset ; get the offset into the font lda (zaFontL), y ; get the actual left character byte and zaFontMask ; mask for color - sta VERA_DATA0 ; plot the left hand side + sta VERA::DATA0 ; plot the left hand side iny ; go to next byte (right hand side of character) lda (zaFontL), y and zaFontMask - sta VERA_DATA0 + sta VERA::DATA0 cpy #15 ; characters are 16 bytes long bcs nextChar ; if 16 then done with this character inc zaFontOffset ; move 2 bytes for last row plotted @@ -428,4 +428,4 @@ digit: ; print the digit inx ; go to next buffer location rts ; and return to self or caller -.endproc \ No newline at end of file +.endproc diff --git a/src/ui.inc b/src/ui.inc index 2af8b3f..b525d27 100644 --- a/src/ui.inc +++ b/src/ui.inc @@ -12,7 +12,8 @@ ;----------------------------------------------------------------------------- .proc uiTitleScreen - vpoke VERA_regs_hi, DC_VSCALE, VSCALE_UI ; make the screen taller (fit more text and font looks nicer) + lda #VSCALE_UI ; make the screen taller (fit more text and font looks nicer) + sta VERA::DISP::VSCALE lda #0 sta NDX ; flush the keyboard buffer before uiWriteName @@ -320,7 +321,8 @@ plot: jsr drawClearScreen - vpoke VERA_regs_hi, DC_VSCALE, VSCALE_UI ; make the screen bigger for UI - the font looks better + lda #VSCALE_UI ; make the screen bigger for UI - the font looks better + sta VERA::DISP::VSCALE print textInstructions, #(2*14), #(8*04), #$FF print textPress , #(2*17), #(8*08), #$FF @@ -331,15 +333,12 @@ plot: print textLoad , #(2*05), #(8*14), #$FF print textSirens , #(2*09), #(8*15), #$55 -; lda JOY1 + 2 joystick detection code appears not to work? -; bmi :+ - print textJoyhead , #(2*14), #(8*19), #$FF print textJoyheadLine , #(2*14), #(8*20), #$FF print textJoy1 , #(2*08), #(8*22), #$FF print textJoy2 , #(2*13), #(8*23), #$FF print textJoy3 , #(2*11), #(8*24), #$FF -; : + print textNotDone , #(2*12), #(8*28), #$55 jsr drawPresent @@ -496,7 +495,8 @@ done: jsr drawClearScreen ; clear the screen - vpoke VERA_regs_hi, DC_VSCALE, VSCALE_UI ; UI scale for nice font + lda #VSCALE_UI ; UI scale for nice font + sta VERA::DISP::VSCALE print textEdtHlp01, #(2*08), #(8*00), #$ff ; show all the help text print textEdtHlp02, #(2*08), #(8*01), #$ff @@ -524,7 +524,8 @@ done: jsr drawClearScreen ; clear the screen - vpoke VERA_regs_hi, DC_VSCALE, VSCALE_GAME ; back to game scale + lda #VSCALE_GAME ; back to game scale + sta VERA::DISP::VSCALE lda #2 ; and force a sta updateHUD ; HUD update @@ -543,7 +544,8 @@ done: jsr drawClearScreen - vpoke VERA_regs_hi, DC_VSCALE, VSCALE_UI ; Get the taller screen + lda #VSCALE_UI ; Get the taller screen + sta VERA::DISP::VSCALE lda #8 ; init the counters - value sta cntrh ; not important what these are init with @@ -596,7 +598,8 @@ loop: bcc loop done: - vpoke VERA_regs_hi, DC_VSCALE, VSCALE_UI ; Back to the shorter screen + lda #VSCALE_UI ; Back to the shorter screen + sta VERA::DISP::VSCALE rts @@ -836,7 +839,8 @@ nameLoop: textLen = tempBlock + 12 ; how many characters the player may enter with uiGetUserText jsr drawClearScreen - vpoke VERA_regs_hi, DC_VSCALE, VSCALE_UI ; set the screen to the nicer font size + lda #VSCALE_UI ; set the screen to the nicer font size + sta VERA::DISP::VSCALE ldy #8 ; UI palette is 8 bytes long lda #UI_PALETTE @@ -890,7 +894,8 @@ enter: done: jsr drawClearScreen - vpoke VERA_regs_hi, DC_VSCALE, VSCALE_GAME ; set the screen back to in-game size for 2 player games + lda #VSCALE_GAME ; set the screen back to in-game size for 2 player games + sta VERA::DISP::VSCALE rts @@ -914,9 +919,10 @@ done: sta forLoad jsr drawClearScreen - vpeek VERA_regs_hi, DC_VSCALE ; see what scale is in effect and save it + lda VERA::DISP::VSCALE ; see what scale is in effect and save it sta scale - vpoke VERA_regs_hi, DC_VSCALE, VSCALE_UI ; set the screen to the nicer font size + lda #VSCALE_UI ; set the screen to the nicer font size + sta VERA::DISP::VSCALE ldy #8 ; UI palette is 8 bytes long lda #UI_PALETTE @@ -1031,10 +1037,10 @@ getkey: jsr inputCheckForInput ; wait for the user to acknowledge beq getkey - jsr drawClearScreen ; + jsr drawClearScreen - ldx scale - vpokex VERA_regs_hi, DC_VSCALE ; restore the screen v scale + lda scale ; restore the screen v scale + sta VERA::DISP::VSCALE rts @@ -1112,18 +1118,20 @@ enter: ROW_LEN = 120 lda #0 ; Set channel and address lo - sta VERA_CTRL ; all functions leave with low active (convention) + sta VERA::CTRL ; all functions leave with low active (convention) - vpoke VERA_regs_hi, DC_VSCALE, VSCALE_GFX + lda #VSCALE_GFX + sta VERA::DISP::VSCALE -; layer1 mem at gfx_layer1 - vpoke VERA_regs_hi, VERA_regs_layer1 + Ln_TILE_BASE_H, (gfx_layer1 >> 10) -; 4bpp but hidden - vpoke VERA_regs_hi, VERA_regs_layer0 + Ln_CTRL0, $c0 + lda #(gfx_layer1 >> 9) ; layer1 mem at gfx_layer1 + sta VERA::L0::TILE_BASE -; 4bpp but hidden - vpoke VERA_regs_hi, VERA_regs_layer1 + Ln_CTRL0, $c0 + lda VERA::DISP::VIDEO + and #%11001111 ; both latyers off + sta VERA::DISP::VIDEO + lda #%00000110 ; set bitmap mode and 4bpp + sta VERA::L0::CONFIG lda #<((logoEnd-logoStart)/3) ; length of all encoded bytes / 3 sta zTemp1 ; is the length to process @@ -1140,13 +1148,13 @@ enter: jsr drawSetPalette lda #$10 ; stride 1 starting at 0,0 - sta VERA_ADDR_HI + sta VERA::ADDR + 2 ; HI lda #>gfx_layer1 sta hi + 1 ; not needed but allows code - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID lda #gfx_layer1 ; update vera - sta VERA_ADDR_MID + sta VERA::ADDR + 1 ; MID lo: lda #