Skip to content

Commit

Permalink
Update AltirraOS to 3.34, build 5200 ROM from source
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka authored and mikrosk committed Jun 27, 2023
1 parent dc68c7f commit ac92564
Show file tree
Hide file tree
Showing 24 changed files with 1,172 additions and 498 deletions.
17 changes: 16 additions & 1 deletion emuos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,15 @@ SRC_BASIC=\
src_basic/util.s \
src_basic/variables.s

SRC_BIOS_5200=\
src_5200/main.xasm

all:\
$(CDIR)/altirraos_xl.c \
$(CDIR)/altirraos_800.c \
$(CDIR)/altirra_basic.c
$(CDIR)/altirra_basic.c \
$(CDIR)/altirra_5200_os.c \
$(CDIR)/altirra_5200_charset.c

# Rules to assemble ROMs
$(OUT)/altirraos_xl.rom: main.xasm $(SRC_BIOS_XL) $(SRC_BIOS_SHARED) | $(OUT)
Expand All @@ -81,6 +86,12 @@ $(OUT)/altirraos_800.rom: main.xasm $(SRC_BIOS_800) $(SRC_BIOS_SHARED) | $(OUT)
$(OUT)/altirra_basic.rom: src_basic/atbasic.s $(SRC_BASIC) | $(OUT)
$(MADS) -d:CART=1 -s -p -i:src_basic -b:40960 -l:$(@:.rom=.lst) -t:$(@:.rom=.lab) -o:$@ $<

$(OUT)/altirra_5200_os.rom: $(SRC_BIOS_5200) | $(OUT)
$(MADS) -s -p -i:src -b:63488 -l:$(@:.rom=.lst) -o:$@ $<

$(OUT)/altirra_5200_charset.rom: src/atarifont.bin | $(OUT)
cp $< $@

# Rules to convert ROM into HEX file
$(OUT)/%.hex: $(OUT)/%.rom
hexdump -ve '"\t" 8/1 "0x%02x," "\n"' < $< | sed -e '$$ s/,$$//' > $@
Expand All @@ -102,5 +113,9 @@ clean:
-rm -f $(OUT)/altirraos_xl.lab
-rm -f $(OUT)/altirraos_xl.lst
-rm -f $(OUT)/altirraos_xl.rom
-rm -f $(OUT)/altirra_5200_os.lab
-rm -f $(OUT)/altirra_5200_os.lst
-rm -f $(OUT)/altirra_5200_os.rom
-rm -f $(OUT)/altirra_5200_charset.rom
-rmdir $(OUT)

1 change: 1 addition & 0 deletions emuos/README
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ locations:

src/Kernel/source/main.xasm -> main.xasm
src/Kernel/source/Shared/* -> src/
src/Kernel/source/SuperKernel/* -> src_5200/
src/ATBasic/source/* -> src_basic/

If new files were added, you may need to edit the Makefile.
10 changes: 10 additions & 0 deletions emuos/altirra_5200_charset_head.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* altirra_5200_charset.c - 5200 character set ROM
*/

#include "config.h"
#include "atari.h"

#ifndef EMUOS_ALTIRRA
UBYTE const ROM_altirra_5200_os[0x400] =
{
21 changes: 21 additions & 0 deletions emuos/altirra_5200_os_head.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* altirra_5200_os.c - 5200 OS ROM replacement
*
* Compiled from the sources in the emuos folder.
*
* Altirra - Atari 800/800XL emulator
* 5200 OS ROM replacement
* Copyright (C) 2008-2018 Avery Lee
*
* Copying and distribution of this file, with or without modification,
* are permitted in any medium without royalty provided the copyright
* notice and this notice are preserved. This file is offered as-is,
* without any warranty.
*/

#include "config.h"
#include "atari.h"

#ifdef EMUOS_ALTIRRA
UBYTE const ROM_altirra_5200_os[0x800] =
{
2 changes: 2 additions & 0 deletions emuos/altirra_basic_head.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
* without any warranty.
*/

#include "config.h"
#include "atari.h"

#if 1
UBYTE const ROM_altirra_basic[] =
{
1 change: 1 addition & 0 deletions emuos/altirraos_800_head.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@

#include "atari.h"

#if 1
UBYTE const ROM_altirraos_800[0x2800] =
{
1 change: 1 addition & 0 deletions emuos/altirraos_xl_head.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@

#include "atari.h"

#if 1
UBYTE const ROM_altirraos_xl[0x4000] =
{
File renamed without changes.
File renamed without changes.
16 changes: 9 additions & 7 deletions emuos/src/boot.s
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,18 @@ load_failure:

;============================================================================
.proc BootRunLoader
;loader is at load address + 6
;Some tape versions of River Raid is sensitive to both the A
;register value on boot and RAMLO, for some reason. For compatibility,
;we need to return the high byte in A and RAMLO needs to contain the
;run address.

lda bootad
add #$05
tax
add #$06 ;loader is at load address + 6
sta ramlo
lda bootad+1
adc #0
pha
txa
pha
rts
sta ramlo+1
jmp (ramlo)
.endp

;============================================================================
Expand Down
24 changes: 12 additions & 12 deletions emuos/src/sio.s
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ no_send_frame:

;setup for receiving complete
ldx #$ff
stx timflg
stx nocksm

;setup frame delay for complete
Expand All @@ -145,6 +144,7 @@ no_send_frame:
tax

lda #1
sta timflg
jsr setvbv

ldx #<temp
Expand Down Expand Up @@ -251,11 +251,11 @@ no_receive_frame:
.proc SIOWaitForACK
;setup 2 frame delay for ack
ldx #$ff
stx timflg
stx nocksm
inx ;X=0
lda #1
ldy #2
inx ;X=0 (MSB of timeout duration)
lda #1 ;set timer 1
sta timflg
ldy #2 ;LSB of timeout duration
sty bufrhi ;>temp = 2
sty bfenhi ;>temp+1 = 2
jsr setvbv
Expand Down Expand Up @@ -777,17 +777,17 @@ isread:
sta sskctl

;set timeout (approx; no NTSC/PAL switching yet)
mva #$ff timflg
lda #1
sta timflg
ldx #>3600
ldy #<3600
jsr VBISetVector

;wait for beginning of frame
lda #$10 ;test bit 4 of SKSTAT
waitzerostart:
bit timflg
bpl timeout
ldy timflg
beq timeout
bit skstat
bne waitzerostart

Expand All @@ -800,15 +800,15 @@ waitzerostart:
lda #$10 ;test bit 4 of SKSTAT
ldx #10 ;test 10 pairs of bits
waitone:
bit timflg
bpl timeout
ldy timflg
beq timeout
bit skstat
beq waitone
dex
beq waitdone
waitzero:
bit timflg
bpl timeout
ldy timflg
beq timeout
bit skstat
bne waitzero
beq waitone
Expand Down
4 changes: 2 additions & 2 deletions emuos/src/version.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
; without any warranty.

.macro _KERNELSTR_VERSION
dta '3.33'
dta '3.34'
.endm

.macro _KERNELSTR_VERSION_INTERNAL
dta "3.33"
dta "3.34"
.endm
103 changes: 103 additions & 0 deletions emuos/src_5200/includes.xasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
; Altirra - Atari 800/800XL/5200 emulator
; 5200 OS ROM replacement
; Copyright (C) 2008-2016 Avery Lee
;
; Copying and distribution of this file, with or without modification,
; are permitted in any medium without royalty provided the copyright
; notice and this notice are preserved. This file is offered as-is,
; without any warranty.

trig0 equ $c010
trig1 equ $c011
trig2 equ $c012
colpm0 equ $c012
trig3 equ $c013
colpm1 equ $c013
colpm2 equ $c014
colpm3 equ $c015
colpf0 equ $c016
colpf1 equ $c017
colpf2 equ $c018
colpf3 equ $c019
colbk equ $c01a
prior equ $c01b
consol equ $c01f
pot0 equ $e800
audf1 equ $e800
pot1 equ $e801
audc1 equ $e801
pot2 equ $e802
audf2 equ $e802
pot3 equ $e803
audc2 equ $e803
pot4 equ $e804
audf3 equ $e804
pot5 equ $e805
audc3 equ $e805
pot6 equ $e806
audf4 equ $e806
pot7 equ $e807
audc4 equ $e807
audctl equ $e808
kbcode equ $e809
skres equ $e80a
potgo equ $e80b
serin equ $e80d
serout equ $e80d
irqen equ $e80e
irqst equ $e80e
skctl equ $e80f
dmactl equ $d400
chactl equ $d401
dlistl equ $d402
dlisth equ $d403
hscrol equ $d404
vscrol equ $d405
chbase equ $d409
wsync equ $d40a
nmien equ $d40e
nmist equ $d40f
nmires equ $d40f

pokmsk equ $00
rtclok equ $01
; equ $02
critic equ $03
atract equ $04
sdlstl equ $05
sdlsth equ $06
sdmctl equ $07
pcolr0 equ $08
pcolr1 equ $09
pcolr2 equ $0a
pcolr3 equ $0b
color0 equ $0c
color1 equ $0d
color2 equ $0e
color3 equ $0f
color4 equ $10
paddl0 equ $11
paddl1 equ $12
paddl2 equ $13
paddl3 equ $14
paddl4 equ $15
paddl5 equ $16
paddl6 equ $17
paddl7 equ $18

vimirq equ $0200 ;IRQ immediate vector
vvblki equ $0202 ;VBI immediate vector
vvblkd equ $0204 ;VBI deferred vector
vdslst equ $0206 ;display list vector
vkybdi equ $0208 ;keyboard immediate vector
vkybdf equ $020a ;keyboard deferred vector
vtrigr equ $020c ;soft-trigger vector (BREAK key)
vbrkop equ $020e ;BRK opcode vector
vserin equ $0210 ;serial input ready vector
vseror equ $0212 ;serial output ready vector
vseroc equ $0214 ;serial output complete vector
vtimr1 equ $0216 ;POKEY timer #1 vector
vtimr2 equ $0218 ;POKEY timer #2 vector
vtimr4 equ $021a ;POKEY timer #4 vector

jveck equ $021e
Loading

0 comments on commit ac92564

Please sign in to comment.