5200 compiles

This commit is contained in:
2022-09-19 08:02:27 -04:00
parent 01160ff4b9
commit d72ca57181
5 changed files with 217 additions and 38 deletions
+146
View File
@@ -0,0 +1,146 @@
;-------------------------------------
.MACRO ROLW
ROL :1
ROL :1+1
.ENDM
;-------------------------------------
.MACRO ASLW
ASL :1
ROL :1+1
.ENDM
;-------------------------------------
.MACRO RORW
ROR :1+1
ROR :1
.ENDM
;-------------------------------------
.MACRO LSRW
LSR :1+1
ROR :1
.ENDM
;-------------------------------------
.MACRO VMAIN
; VMAIN #WORD,interrupt.vector
; interrupt.vector:
; 0 - VIMIRQ
; 1 - TIMCNT1
; 2 - TIMCNT2
; 3 - TIMCNT3
; 4 - TIMCNT4
; 5 - TIMCNT5
; 6 - VVBLKI
; 7 - VVBLKD
; 8 - TIMVEC1
; 9 - TIMVEC2
; Initialises Vertical Blank Interrupts
; (works only with system interrupts ON)
;----------
; on 5200 it sets up deferred VBL ONLY for now
sei
lda #$00 ;Disable all interruptes
sta nmien
sta irqen
@ lda vcount
bne @-
mwa #:1 VVBLKD
lda #$40 ;Enable IRQ interrupts
sta pokmsk
sta irqen
cli
.ENDM
;-------------------------------------
.MACRO VDLI
; VDLI #WORD
; Initialises Display List Interrupts
mwa #:1 VDSLST
mva #$C0 NMIEN
.ENDM
;-------------------------------------
.MACRO halt
?stop
lda RANDOM
and #$05
sta COLBAK
jmp ?stop
.ENDM
;-------------------------------------
.MACRO KEY
; KEY
; waits for releasing and pressing "any key"
.ENDM
;-------------------------------------
.MACRO WAIT
; WAIT
; waits one frame (1/50 s(PAL) or 1/60s(NTSC))
?zero LDA VCOUNT
beq ?zero
bpl ?WA
sbc #10 ; last lines correction
?WA cmp VCOUNT
beq ?WA
bcc ?WA
?WFRAME cmp VCOUNT
beq ?nowait
bcs ?WFRAME
?nowait
.ENDM
;-------------------------------------
.macro negw
; negate the given word (0-a)
;-------------------------------------
sec
lda #$00
sbc :1
sta :1
lda #$00
sbc :1+1
sta :1+1
.endm
;-------------------------------------
.macro randomize
;usage: randomize floor ceiling
;returns (in A) a random .byte between "floor" and "ceiling"
.if :2 < :1
.error "floor higher than ceiling"
.endif
?rand
lda random
cmp #:1 ;floor
bcc ?rand
cmp #:2+1 ;ceiling
bcs ?rand
.endm
;-------------------------------------
.macro phx
txa
pha
.endm
;-------------------------------------
.macro phy
tya
pha
.endm
;-------------------------------------
.macro plx
pla
tax
.endm
;-------------------------------------
.macro ply
pla
tay
.endm
;-------------------------------------
.macro pause
;waits :1 number (byte) of frames
ldx #:1
?PAUSELOOP
wait
dex
bne ?PAUSELOOP
.ENDM
+33 -5
View File
@@ -2,6 +2,8 @@
;* ATARI 5200 CONSOLE * ;* ATARI 5200 CONSOLE *
;* SYSTEM EQUATES * ;* SYSTEM EQUATES *
;**************************************************************************** ;****************************************************************************
; based on https://web.archive.org/web/20200831200348/http://www.atarimuseum.com/videogames/consoles/5200/conv_to_5200.html
;
; OS VARIABLES FOR 5200 ; OS VARIABLES FOR 5200
; ;
; PAGE 0 ; PAGE 0
@@ -9,14 +11,9 @@ POKMSK = $00 ;pokmsk at $00 on Atari 5200 instead of $10 on Atari
RTCLOK = $01 ;Actually $01/$02 RTCLOK = $01 ;Actually $01/$02
CRITIC = $03 CRITIC = $03
ATRACT = $04 ;attact at $04 on Atari 5200 instead of $4D on Atari XL ATRACT = $04 ;attact at $04 on Atari 5200 instead of $4D on Atari XL
; PAGE 2
DLPTRS = $05 ;sdlstl at $05/$06 on Atari 5200 instead of $230 on Atari XL DLPTRS = $05 ;sdlstl at $05/$06 on Atari 5200 instead of $230 on Atari XL
DMACTLS = $07 ;sdmactl at $07 on Atari 5200 instead of $22f on Atari XL DMACTLS = $07 ;sdmactl at $07 on Atari 5200 instead of $22f on Atari XL
SSKCTL = skctl ;There is no shadow on Atari 5200 SSKCTL = skctl ;There is no shadow on Atari 5200
STICK0 = $278 ;There is no stick0 but we will make the analog stick look like a digital one and store it here
STRIG0 = $284 ;There is no strig0 but we will make this the shadow of the TRIG0 ($c010) of GITA
PCOLR0 EQU $08 ;P0 COLOR PCOLR0 EQU $08 ;P0 COLOR
PCOLR1 EQU $09 ;P1 COLOR PCOLR1 EQU $09 ;P1 COLOR
PCOLR2 EQU $0a ;P2 COLOR PCOLR2 EQU $0a ;P2 COLOR
@@ -27,6 +24,36 @@ COLOR2 EQU $0e
COLOR3 EQU $0f COLOR3 EQU $0f
COLOR4 EQU $10 COLOR4 EQU $10
COLBAKS EQU COLOR4 COLBAKS EQU COLOR4
PADDL0 EQU $11
PADDL1 EQU $12
PADDL2 EQU $13
PADDL3 EQU $14
PADDL4 EQU $15
PADDL5 EQU $16
PADDL6 EQU $17
PADDL7 EQU $18
STICK0 = $19 ;There is no stick0 but we will make the analog stick look like a digital one and store it here
STRIG0 = $1a ;There is no strig0 but we will make this the shadow of the TRIG0 ($c010) of GTIA
chbas = $1b ;There is no strig0 but we will make this the shadow of the CHBASE
; PAGE 2
VIMIRQ EQU $0200 ;IMMED IRQ VECTOR
VVBLKI EQU $0202 ;IMM VBLK NMI VECTOR
VVBLKD EQU $0204 ;DEF VBLK NMI VECTOR
VDSLST EQU $0206 ;DSP LIST NMI VECTOR
VKEYBD EQU $0208 ;POKEY KB IRQ VECTOR
VKEYCNT EQU $020A ;Keypad routine continuation vector
BRKKY EQU $023C ;BREAK KEY VECTOR
VBREAK EQU $020E ;BRK INST IRQ VECTOR
VSERIN EQU $0210 ;POKEY INPUT RDY IRQ
VSEROR EQU $0212 ;POKEY OUTPUT RDY
VSEROC EQU $0214 ;POKEY OUTPUT DONE
VTIMR1 EQU $0216 ;POKEY TIMER 1 IRQ
VTIMR2 EQU $0218 ;POKEY TIMER 2 IRQ
VTIMR4 EQU $021A ;POKEY TIMER 4 IRQ
ROM_SETTINGS = $bfe8 ; game ROM info start (24 bytes total, 20b title, 2b year, 2b start vector)
; HARDWARE REGISTERS ; HARDWARE REGISTERS
@@ -108,6 +135,7 @@ COLPF2 EQU GTIA+$18
COLPF3 EQU GTIA+$19 COLPF3 EQU GTIA+$19
COLBAK EQU GTIA+$1a COLBAK EQU GTIA+$1a
PRIOR EQU GTIA+$1b PRIOR EQU GTIA+$1b
GPRIOR = PRIOR ; no PRIOR shadow (GPRIOR)
VDELAY EQU GTIA+$1c VDELAY EQU GTIA+$1c
GRACTL EQU GTIA+$1d GRACTL EQU GTIA+$1d
HITCLR EQU GTIA+$1e HITCLR EQU GTIA+$1e
View File
+31 -26
View File
@@ -5,10 +5,13 @@
;Warsaw 2000, 2001, 2002, 2003, 2009, 2012, 2013 ;Warsaw 2000, 2001, 2002, 2003, 2009, 2012, 2013
;Miami & Warsaw 2022 ;Miami & Warsaw 2022
;---------------------------------------------------
.def target = 5200 ; or 800
;---------------------------------------------------
OPT r+ ; saves 12 bytes :O OPT r+ ; saves 12 bytes :O
.def target = 800 ;5200 ; or 800 ;---------------------------------------------------
.macro build .macro build
dta d"1.15" ; number of this build (4 bytes) dta d"1.15" ; number of this build (4 bytes)
.endm .endm
@@ -18,8 +21,9 @@
jsr RMTSongSelect jsr RMTSongSelect
.endm .endm
;---------------------------------------------------
icl 'definitions.asm' icl 'definitions.asm'
;---------------------------------------------------
.zpvar xdraw .word = $64 ;variable X for plot .zpvar xdraw .word = $64 ;variable X for plot
.zpvar ydraw .word ;variable Y for plot (like in Atari Basic - Y=0 in upper right corner of the screen) .zpvar ydraw .word ;variable Y for plot (like in Atari Basic - Y=0 in upper right corner of the screen)
@@ -122,17 +126,21 @@
displayposition = modify displayposition = modify
LineAddress4x4 = temp LineAddress4x4 = temp
;------------------------------- ;-----------------------------------------------
; libraries
;-----------------------------------------------
.IF TARGET = 5200 .IF TARGET = 5200
icl 'lib/5200SYS.ASM' icl 'lib/5200SYS.ASM'
icl 'lib/5200MACRO.ASM'
.ELSE .ELSE
icl 'lib/ATARISYS.ASM' icl 'lib/ATARISYS.ASM'
icl 'lib/MACRO.ASM'
icl 'artwork/Scorch50.asm' ; splash screen and musix icl 'artwork/Scorch50.asm' ; splash screen and musix
.ENDIF .ENDIF
icl 'lib/macro.hea' ;-----------------------------------------------
; variable declarations in RAM (no code) ; variable declarations in RAM (no code)
;-----------------------------------------------
ORG PMGraph + $0300 - (variablesEnd - OneTimeZeroVariables + 1) ORG PMGraph + $0300 - (variablesEnd - OneTimeZeroVariables + 1)
icl 'variables.asm' icl 'variables.asm'
@@ -142,10 +150,10 @@
WeaponFont WeaponFont
ins 'artwork/weapons_AW6_mod.fnt' ; 'artwork/weapons.fnt' ins 'artwork/weapons_AW6_mod.fnt' ; 'artwork/weapons.fnt'
;----------------------------------------------- ;-----------------------------------------------
;Screen displays go here to avoid crossing 4kb barrier ;Screen displays go here to avoid crossing 4kb barrier
;----------------------------------------------- ;-----------------------------------------------
DisplayCopyRom = * DisplayCopyRom = *
org display, DisplayCopyRom org display, DisplayCopyRom
DisplayCopyStart DisplayCopyStart
@@ -460,13 +468,6 @@ SettingEnergies
jsr SetMainScreen jsr SetMainScreen
jsr ColorsOfSprites jsr ColorsOfSprites
; lda #90 ; barrel fully erect
; ldx #MaxPlayers-1
;@ sta previousBarrelAngle,x
; dex
; bpl @-
jsr drawmountains ;draw them jsr drawmountains ;draw them
jsr drawtanks ;finally draw tanks jsr drawtanks ;finally draw tanks
@@ -635,11 +636,6 @@ ShootNow
jsr Explosion jsr Explosion
continueMainRoundLoopAfterSeppuku continueMainRoundLoopAfterSeppuku
;here we clear offensive text (after a shoot)
;ldy TankNr
;mva #0 plot4x4color
;jsr DisplayOffensiveTextNr
AfterExplode AfterExplode
jsr SoilDown2 ; allways jsr SoilDown2 ; allways
@@ -659,7 +655,6 @@ NoExistNoFall
mvx tempor2 TankNr mvx tempor2 TankNr
missed missed
; TODO: IS IT OK??? possibly a fix here needed for #56
ldy WeaponDepleted ldy WeaponDepleted
bne @+ bne @+
ldx TankNr ldx TankNr
@@ -668,7 +663,6 @@ missed
@ @
;here we clear offensive text (after a shoot) ;here we clear offensive text (after a shoot)
;shit -- it's second time, but it must be like this
ldy TankNr ldy TankNr
mva #$00 plot4x4color mva #$00 plot4x4color
jsr DisplayOffensiveTextNr jsr DisplayOffensiveTextNr
@@ -740,7 +734,6 @@ NoPlayerNoDeath
;clear NoDeathCounter here ;clear NoDeathCounter here
sta noDeathCounter sta noDeathCounter
; display defensive text here (well, defensive ; display defensive text here (well, defensive
; is not the real meaning, it should be pre-death, ; is not the real meaning, it should be pre-death,
; but I am too lazy to change names of variables) ; but I am too lazy to change names of variables)
@@ -1243,7 +1236,16 @@ exitVBL
ply ply
plx plx
pla pla
.IF target = 5200
pla
tay
pla
tax
pla
rti
.ELSE
jmp XITVBV jmp XITVBV
.ENDIF
.endp .endp
;---------------------------------------------- ;----------------------------------------------
.proc RandomizeSequence0 .proc RandomizeSequence0
@@ -1462,7 +1464,7 @@ Bubble
BubbleBobble BubbleBobble
lda TempResults,x lda TempResults,x
cmp TempResults+1,x cmp TempResults+1,x
beq nextishigher ; this is to block hangs when 2 same values meet beq nextishigher ; this is to block hangs when 2 equal values meet
bcc nextishigher bcc nextishigher
;here we must swap values ;here we must swap values
;because next is smaller than previous ;because next is smaller than previous
@@ -1713,14 +1715,17 @@ MODULEND
font4x4 font4x4
ins 'artwork/font4x4s.bmp',+62 ins 'artwork/font4x4s.bmp',+62
;----------------------------------------------
.IF target = 5200 .IF target = 5200
org $bfe8 .IF * > ROM_SETTINGS-1
.ERROR 'Code too long to fit in 5200'
.ENDIF
org ROM_SETTINGS ; 5200 ROM settings address $bfe8
; "01234567890123456789" ; "01234567890123456789"
.byte " SCORCH 5200 v" ;20 characters title .byte " SCORCH 5200 v" ;20 characters title
build ; " " build ; " "
.byte " " .byte " "
.byte '22' ;2 characters year .byte '7A' ;2 characters year .. 1900 + $7A = 2020
.word FirstSTART .word FirstSTART
.ELSE .ELSE
run FirstSTART run FirstSTART
BIN
View File
Binary file not shown.