Skip to content

Commit

Permalink
Add cmem.h with dblock and cmem[]
Browse files Browse the repository at this point in the history
  • Loading branch information
mkilgore committed Feb 14, 2024
1 parent 1daea10 commit 839c5c0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/c/libqb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#endif

#include "audio.h"
#include "cmem.h"
#include "completion.h"
#include "command.h"
#include "compression.h"
Expand Down Expand Up @@ -7149,7 +7150,6 @@ extern uint8 *cmem_dynamic_base;

extern uint32 qbs_cmem_sp; //=256;
extern uint32 cmem_sp; //=65536;
extern ptrszint dblock; // 32bit offset of dblock
extern uint64 *nothingvalue;

uint8 wait_needed = 1;
Expand Down
3 changes: 1 addition & 2 deletions internal/c/libqb.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define INC_LIBQB_H
#include "common.h"

#include "cmem.h"
#include "qbs.h"

void sub_shell4(qbs *, int32); //_DONTWAIT & _HIDE
Expand Down Expand Up @@ -41,8 +42,6 @@ int32 gfs_write(int32 i, int64 position, uint8 *data, int64 size);
int32 gfs_read(int32 i, int64 position, uint8 *data, int64 size);
int64 gfs_read_bytes();

extern uint8 cmem[1114099]; // 16*65535+65535+3 (enough for highest referencable dword in conv memory)

// keyhit cyclic buffer
extern int64 keyhit[8192];
// keyhit specific internal flags: (stored in high 32-bits)
Expand Down
6 changes: 6 additions & 0 deletions internal/c/libqb/include/cmem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

#include <stdint.h>

extern uint8_t cmem[1114099]; // 16*65535+65535+3 (enough for highest referencable dword in conv memory)
extern intptr_t dblock; // Required for Play(). Did not find this declared anywhere
3 changes: 1 addition & 2 deletions internal/c/libqb/src/qbs_cmem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
#include <stdlib.h>
#include <string.h>

#include "cmem.h"
#include "error_handle.h"
#include "qbs.h"

// FIXME: conventional memory should be consolidated into libqb soruce and headers
extern uintptr_t dblock;
extern uint32_t qbs_cmem_sp; //=256;
extern uint32_t cmem_sp; //=65536;
extern uint8_t cmem[1114099]; // 16*65535+65535+3 (enough for highest referencable dword in conv memory)

// Used to track strings in 16bit memory
static intptr_t *qbs_cmem_list = (intptr_t *)malloc(65536 * sizeof(intptr_t));
Expand Down
4 changes: 2 additions & 2 deletions internal/c/qbx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ uint16 call_absolute_offsets[256];
uint32 dbgline;
uint32 qbs_cmem_sp = 256;
uint32 cmem_sp = 65536;
ptrszint dblock; // 32bit offset of dblock
intptr_t dblock; // 32bit offset of dblock
uint8 close_program = 0;
int32 tab_spc_cr_size = 1; // 1=PRINT(default), 2=FILE
int32 tab_fileno = 0; // only valid if tab_spc_cr_size=2
Expand All @@ -576,7 +576,7 @@ qbs *nothingstring;
uint32 qbevent = 0;
uint8 suspend_program = 0;
uint8 stop_program = 0;
uint8 cmem[1114099]; // 16*65535+65535+3 (enough for highest referencable dword
uint8_t cmem[1114099]; // 16*65535+65535+3 (enough for highest referencable dword
// in conv memory)
uint8 *cmem_static_pointer = &cmem[0] + 1280 + 65536;
uint8 *cmem_dynamic_base = &cmem[0] + 655360;
Expand Down

0 comments on commit 839c5c0

Please sign in to comment.