Skip to content

Commit

Permalink
Use hub locations to pass parameters to video mode loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
maccasoft committed Apr 19, 2018
1 parent 944c03a commit a70c173
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 24 deletions.
15 changes: 10 additions & 5 deletions bus_interface.s
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

.org 0

start mov OUTA, #0
start mov OUTA, bus_wait
mov DIRA, bus_wait
jmp #init

Expand Down Expand Up @@ -74,7 +74,12 @@ port43_handler or OUTA, bus_wait
// ------------------------------------------------------------------------

init
mov data, #$00 // default video mode
mov ptr, PAR
rdbyte data, ptr
add ptr, #1
rdbyte data1, ptr
add ptr, #1
rdbyte data2, ptr
jmp #set_mode_param_end

loop
Expand Down Expand Up @@ -317,9 +322,8 @@ _drv0 mov i2c_addr, 0-0
neg b, #1
wrlong b, hub_fi

mov a, data
and a, #$FF
shl a, #16
mov a, cog_param_addr
shl a, #14
or a, cog_driver_addr
shl a, #2
or a, #%1000
Expand All @@ -340,6 +344,7 @@ _drv0 mov i2c_addr, 0-0
mov hub_addr, hub_video_ram
mov hub_addr_top, hub_bitmap_ram
mov hub_addr_low, hub_video_ram

movs port41_handler, #_port41_table

andn OUTA, bus_wait
Expand Down
6 changes: 5 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@

extern uint32_t _load_start_cog_bus_interface[];

static uint8_t default_mode[3] = {
0x00, 0x00, 0x00
};

int main()
{
// starts the bus interface code replacing the current cog
coginit(cogid(), _load_start_cog_bus_interface, 0);
coginit(cogid(), _load_start_cog_bus_interface, (uint32_t)default_mode);
return 0;
}
35 changes: 17 additions & 18 deletions video_mode.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@
#include "defines.inc"

start
add cog_param_addr, #1

test vram_expand_h_flag, PAR wz
mov ptr, PAR
rdbyte data, ptr
add ptr, #1
rdbyte data1, ptr
add ptr, #1
rdbyte data2, ptr

test data, #VRAM_EXPAND_H wz
if_nz shl hub_vram_size, #1
test vram_expand_v_flag, PAR wz
test data, #VRAM_EXPAND_V wz
if_nz shl hub_vram_size, #1
add hub_bitmap_ram, hub_vram_size

rdbyte a, cog_param_addr
and a, #$0F wz
and data1, #$0F wz
if_nz add hub_bitmap_ram, #VRAM_TILES_H
if_nz djnz a, #$-1

add cog_param_addr, #1
if_nz djnz data1, #$-1

rdbyte a, cog_param_addr
and a, #$0F wz
and data2, #$0F wz
if_nz add hub_bitmap_ram, #VRAM_TILES_H
if_nz djnz a, #$-1
if_nz djnz data2, #$-1

wrword hub_bitmap_ram, hub_tiles_ptr
wrword hub_bitmap_ram, hub_sprites_ptr
Expand All @@ -39,8 +40,8 @@ start
call #eeprom_read

// start the renderers
mov a, PAR
shl a, #14+3
mov a, data
shl a, #16+3
or a, cog_driver_addr
shl a, #2
or a, #%1000
Expand Down Expand Up @@ -79,7 +80,6 @@ block_boundary long $0000_FFFF

cog_driver_size long 2048
cog_driver_addr long $7600
cog_param_addr long $7E00

inc_par_offset long %00000000000001_00000000000000_0_000

Expand All @@ -93,15 +93,14 @@ hub_tiles_ptr long $7EB0
hub_sprites_ptr long $7EB2
hub_fi long $7EBC

vram_expand_h_flag long VRAM_EXPAND_H << 2
vram_expand_v_flag long VRAM_EXPAND_V << 2

// uninitialised data and/or temporaries

a .res 1
b .res 1
ptr .res 1
data .res 1
data1 .res 1
data2 .res 1
ack .res 1
mask .res 1
ecnt .res 1
Expand Down

0 comments on commit a70c173

Please sign in to comment.