Project Manhattan

User projects written in or related to FreeBASIC.
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Project Manhattan

Post by fatman2021 »

Project Manhattan is a next-generation MOS 6510-based CPU/GPU combo system on a chip emulator for gaming and business applications written in FreeBASIC. See the README.md file for more information:
https://github.com/fatman2021/project-m ... /README.md

GitHub site:
https://github.com/fatman2021/project-manhattan

Image

Image
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Project Manhattan

Post by D.J.Peters »

you used
my: OpenGL shader language FreeBASIC wrapper !
my: Shadertoy FreeBASIC runtime environment !
my: C64 and CPU6510 emulator !
...
and in your ~600MB github are more than 20 books with copyright by Nintendo, OSBORNE, euroPress and other companies
storing stolen books at home on your HD is your private thing but share it via github is a krime !
...
shame on you

Joshy
Last edited by D.J.Peters on Jun 22, 2022 0:28, edited 1 time in total.
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Project Manhattan

Post by fatman2021 »

D.J.Peters wrote: Jun 22, 2022 0:02 you used
my: OpenGL shader language FreeBASIC wrapper !
my: Shadertoy FreeBASIC runtime environment !
my: C64 and CPU6510 emulator !
...

shame on you

Joshy
You are covered under "The FreeBASIC Development Team. " Unless you would like to be instead listed as an individual?

A big chunk of it is my code as well.
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Project Manhattan

Post by fatman2021 »

D.J.Peters wrote: Jun 22, 2022 0:02 and in your ~600MB github are more than 20 books with copyright by Nintendo, OSBORNE, euroPress and other companies
storing stolen books at home on your HD is your private thing but share it via github is a krime !
They are owned by companies who have gone out of business or do not have any interest in enforcing any copyright claims...much like those Commodore ROMs(Copyright © 2020-present Amiga Corporation) you have embedded in c64.bas
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Project Manhattan

Post by fatman2021 »

By the way, you can get the ROMs as part of C64 forever free express edition:
https://www.c64forever.com/

And the books can be downloaded free of charge from archive.org:
http://archive.org/

Cloanto is a subsidiary of Amiga Corporation.
http://www.generationamiga.com/2020/07/ ... rporation/
https://www.reddit.com/r/amiga/comments ... loanto_is/
Last edited by fatman2021 on Jun 22, 2022 3:33, edited 2 times in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Project Manhattan

Post by D.J.Peters »

Microsoft acquired GitHub maybe they thinks in a different way about it ;-)
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Project Manhattan

Post by fatman2021 »

D.J.Peters wrote: Jun 22, 2022 1:36 Microsoft acquired GitHub maybe they thinks in a different way about it ;-)
This former Microsoft operating system engineer seems to think otherwise.

Image

https://www.youtube.com/clip/UgkxKXPa1p ... vu9HmdXN8y
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: Project Manhattan

Post by deltarho[1859] »

fatman2021 wrote:Unless you would like to be instead listed as an individual?
Of course, he should. It is called common courtesy.
You are covered under "The FreeBASIC Development Team."
I have heard it all now.
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Project Manhattan

Post by fatman2021 »

deltarho[1859] wrote: Jun 22, 2022 9:20
fatman2021 wrote:Unless you would like to be instead listed as an individual?
Of course, he should. It is called common courtesy.
You are covered under "The FreeBASIC Development Team."
I have heard it all now.
You must understand that if I listed everyone who contributed to this project in one way or another by name, the license and readme files would contain thousands of names. BSD faced a similar problem.
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: Project Manhattan

Post by deltarho[1859] »

@fatman2021

Posting a link on this forum would not have killed you to give Joshy his due credit, would it?
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: Project Manhattan

Post by deltarho[1859] »

With the file updated 32 minutes ago as I write this.

Anyway, it is nice to see members climbing over themselves to support Joshy. Nothing changes.
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Project Manhattan

Post by fatman2021 »

qb64.bi

Code: Select all

#define ptrszint  longint
#define uptrszint ulongint
#define ptrsz     8

' QB64 string descriptor structure
type qbs_field
    as integer fileno
    as longint fileid
    as longint size
    as longint offset
end type

type qbs 
    as ubyte ptr  str_data ' a 32 bit pointer to the string's data
    as integer    str_len  ' must be signed for comparisons against signed int32s
    as ubyte      in_cmem  ' set to 1 if in the conventional memory DBLOCK
    as ushort ptr cmem_descriptor
    as ushort     cmem_descriptor_offset
    as uinteger   listi    ' the index in the list of strings that references it
    as ubyte      tmp      ' set to 1 if the string can be deleted immediately after being processed
    as uinteger   tmplisti ' the index in the list of strings that references it
    as ubyte      fixed    ' fixed length string
    as ubyte      readonly ' set to 1 if string is read only
    as qbs_field ptr field_data
end type

type img_struct 
    as any ptr  lock_offset
    as longint  lock_id
    as ubyte    valid   ' 0,1 0=invalid
    as ubyte    text    ' if set, surface is a text surface
    as ubyte    console ' dummy surface to absorb unimplemented console functionality
    as ushort   img_width, img_height
    as ubyte    bytes_per_pixel ' 1,2,4
    as ubyte    bits_per_pixel  ' 1,2,4,8,16(text),32
    as uinteger mask            ' 1,3,0xF,0xFF,0xFFFF,0xFFFFFFFF
    as ushort   compatible_mode ' 0,1,2,7,8,9,10,11,12,13,32,256
    as uinteger img_color, background_color, draw_color
    as uinteger font            ' 8,14,16,?
    as short    top_row, bottom_row ' VIEW PRINT settings, unique (as in QB) to each "page"
    as short    cursor_x, cursor_y  ' unique (as in QB) to each "page"
    as ubyte cursor_show, cursor_firstvalue, cursor_lastvalue
    union
        as ubyte  ptr offset
        as uinteger ptr offset32
    end union
    as uinteger flags
    as uinteger ptr pal
    as integer transparent_color ' -1 means no color is transparent
    as ubyte alpha_disabled
    as ubyte holding_cursor
    as ubyte print_mode
    ' BEGIN apm ('active page migration')
    ' everything between apm points is migrated during active page changes
    ' note: apm data is only relevent to graphics modes
    as ubyte apm_p1
    as integer view_x1, view_y1, view_x2, view_y2
    as integer view_offset_x, view_offset_y
    as double x, y
    as ubyte clipping_or_scaling
    as double scaling_x, scaling_y, scaling_offset_x, scaling_offset_y
    as double window_x1, window_y1, window_x2, window_y2
    as double draw_ta
    as double draw_scale
    as ubyte apm_p2
    ' END apm
end type

' img_struct flags
#define IMG_FREEPAL 1 ' free palette data before freeing image
#define IMG_SCREEN  2 ' img is linked to other screen pages
#define IMG_FREEMEM 4 ' if set, it means memory must be freed

' QB64 internal variable type flags (internally referenced by some functions)
#define ISSTRING             1073741824
#define ISFLOAT               536870912
#define ISUNSIGNED            268435456
#define ISPOINTER             134217728
#define ISFIXEDLENGTH          67108864 ' only set for strings with pointer flag
#define ISINCONVENTIONALMEMORY 33554432
#define ISOFFSETINBITS         16777216

type ontimer_struct 
    as ubyte    allocated
    as uinteger id        ' the event ID to trigger (0=no event)
    as longint  pass      ' the value to pass to the triggered event (only applicable to ON ... CALL ...(x)
    as ubyte    active    ' 0=OFF, 1=ON, 2=STOP
    as ubyte    state     ' 0=untriggered,1=triggered
    as double   seconds   ' how many seconds between events
    as double   last_time ' the last time this event was triggered
end type

type onkey_struct 
    as uinteger id                ' the event ID to trigger (0=no event)
    as longint  pass              ' the value to pass to the triggered event (only applicable to ON ... CALL ...(x)
    as ubyte    active            ' 0=OFF, 1=ON, 2=STOP
    as ubyte    state             ' 0=untriggered,1=triggered,2=in progress(TIMER only),2+=multiple events queued(KEY only)
    as uinteger keycode           ' 32-bit code, same as what _KEYHIT returns
    as uinteger keycode_alternate ' an alternate keycode which may also trigger event
    as ubyte    key_scancode
    as ubyte    key_flags
    ' flags:
    ' 0 No keyboard flag, 1-3 Either Shift key, 4 Ctrl key, 8 Alt key,32 NumLock key,64 Caps Lock key, 128 Extended keys on a 101-key keyboard
    ' To specify multiple shift states, add the values together. For example, a value of 12 specifies that the user-defined key is used in combination with the
    ' Ctrl and Alt keys.
    as qbs ptr text
end type

type onstrig_struct 
    as uinteger id     ' the event ID to trigger (0=no event)
    as longint  pass   ' the value to pass to the triggered event (only applicable to ON ... CALL ...(x)
    as ubyte    active ' 0=OFF, 1=ON, 2=STOP
    as ubyte    state  ' 0=untriggered,1=triggered,2=in progress(TIMER only),2+=multiple events queued(KEY only)
end type

type byte_element_struct
    as ulongint offset
    as integer  length
end type

type device_struct
    as integer used
    as integer type_data
    ' 0=Unallocated
    ' 1=Joystick/Gamepad
    ' 2=Keybaord
    ' 3=Mouse
    as byte ptr  name_data
    as integer   connected
    as integer   lastbutton
    as integer   lastaxis
    as integer   lastwheel
    '--------------
    as integer   max_events
    as integer   queued_events
    as ubyte ptr events ' the structure and size of the events depends greatly on the device and its capabilities
    as integer   event_size
    '--------------
    as ubyte     STRIG_button_pressed(256) ' checked and cleared by the STRIG function
    '--------------
    as any ptr      handle_pointer  ' handle as pointer
    as longint      handle_int      ' handle as integer
    as byte ptr     description     ' description provided by manufacturer
    as longint      product_id
    as longint      vendor_id
    as integer      buttons
    as integer      axes
    as integer      balls
    as integer      hats
end type

' device_struct constants
#define QUEUED_EVENTS_LIMIT   1024
#define DEVICETYPE_CONTROLLER    1
#define DEVICETYPE_KEYBOARD      2
#define DEVICETYPE_MOUSE         3


type mem_block
    as ptrszint offset
    as ptrszint size
    as longint lock_id       ' 64-bit key, must be present at lock's offset or memory region is invalid
    as ptrszint lock_offset ' pointer to lock
    as ptrszint type_data
    /'
        memorytype (4 bytes, but only the first used, for flags):
        1 integer values
        2 unsigned (set in conjunction with integer)
        4 floating point values
        8 char string(s) 'element-size is the memory size of 1 string
    '/
    as ptrszint elementsize
    as integer image
    as integer sound
end type

type mem_lock
    as ulongint id
    as integer type_data ' required to know what action to take (if any) when a request is made to free the block
    ' 0=no security (eg. user defined block from _OFFSET)
    ' 1=C-malloc'ed block
    ' 2=image
    ' 3=sub/function scope block
    ' 4=array
    ' 5=sound
    '---- type specific variables follow ----
    as any  ptr offset ' used by malloc'ed blocks to free them
end type
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Project Manhattan

Post by fatman2021 »

120x60 Text Mode framebuffer

Code: Select all

   case in range(&H0000D0000, &H0000D3E70) ' Screen Memory(0x0000D0000(851968)-
                                           '               0x0000D3E70(867952)) 120x60 Text Mode
'  alpha          =$C005(49157)
'  red            =$C002(49154)
'  green          =$C003(49155)
'  blue           =$C003(49156)
'  fg_color       =$C0C9(49353)
'  bg_color       =$C0CA(49354)
'  x0             =$C0CB(49355)
'  y0             =$CDCC(49356)
'  z0             =$CDCD(49357)
'  x1             =$CDCE(49358)
'  y1             =$CDCE(49359)
'  z1             =$CDCF(49360)
'  r0             =$C9D1(49361)
'  r1             =$C0D2(49362)
'  r2             =$C0D3(49363)
'  r3             =$C0D4(49364)
'  r4             =$C0D5(49365)
'  r5             =$C0D6(49366)
'  r6             =$C0D7(49367)
'  r7             =$COD8(49368)
'  scro_x         =$C0E3(49379)
'  scro_y         =$C0E4(49380)
'  Screen Memory(0x000000400(001024)-0x0000007E7(002023)) - 40x25 Text Frame Buffer
'  Screen Memory(0x000004000(016384)-0x000007E70(032368)) - 90x60 Text Frame Buffer
'  Screen Memory(0x00000D800(055296)-0x00000DBFF(056319)) - Reprogrammable Character Set
'  Screen Memory(0x0000C0000(786432)-0x0000C7FF0(819184)) - Reprogrammable Character Set
'  Screen Memory(0x0000D0000(851968)-0x0000D3E70(867952)) - 120x60 Text Frame Buffer 
  
    poke SYSTEM_TYPE,@adr,peek(SYSTEM_TYPE, @adr) subt &H0000D0000     
    mov(c, v)
    mov(c shl,peek(ubyte,@nibbles(&B0011)))
'                   font_o 
    mov(c add,mem64(49384))
    mov(xs,modulo(adr,160))
    mov(xs shl,peek(ubyte,@nibbles(&B0011)))
    mov(xs add,peek(ubyte,@nibbles(&B1000)) mul peek(ubyte,@nibbles(&B0100)))
    mov(ys,adr idiv  160)
    mov(ys shl, peek(ubyte,@nibbles(&B0011)))
    mov(ys add,peek(ubyte,@nibbles(&B1000)) mul peek(ubyte,@nibbles(&B0100)))
    if peek(SYSTEM_TYPE,@mem64(RVS)) ne peek(ubyte,@nibbles(&B0000)) then 
       mov(c and,peek(ubyte,@nibbles(&B1111)) shl peek(ubyte,@nibbles(&B0100)) add peek(ubyte,@nibbles(&B1111)))
    end if   
    if peek(SYSTEM_TYPE,@mem64(49357)) ls peek(ubyte,@nibbles(&B0001)) then 
       poke SYSTEM_TYPE,@mem64(49357),peek(ubyte,@nibbles(&B0001))
    end if   
    poke64(49410,peek(ubyte,@nibbles(&B0000))) 'Screen lock
    poke SYSTEM_TYPE,@y,peek(ubyte,@nibbles(&B0000))
    poke SYSTEM_TYPE,@x,peek(ubyte,@nibbles(&B0000))
'                                    font_h               font_w             
      do until logic_and(mov(y,mem64(49386)),mov(x,mem64(49385)))
#if defined(__FB_WIN32__)  or defined(__FB_LINUX__)   or defined(__FB_CYGWIN__) or defined(__FB_FREEBSD__) or _
    defined(__FB_NETBSD__) or defined(__FB_OPENBSD__) or defined(__FB_DARWIN__) or defined(__FB_XBOX__)    or _
    defined(__FB_UNIX__)   or defined(__FB_64BIT__)   or defined(__FB_ARM__)

        pokeb &H000000002,xs                              ' move r1,[xs]
        pokeb &H000000003,x                               ' move r2,[x]
        pokeb &H000000047,0                               ' add  r1,r2
        pokeb &H000000006,0                               ' move r1,r2
        pokeb &H000000003,3.75                            ' move r2,3.75
        pokeb &H000000049,0                               ' mul  r1,r2
        pokeb &H000000006,0                               ' move r1,r0
        pokeb &H000000003,2                               ' move r2,2
        pokeb &H00000004B,0                               ' idev r1,r2
        pokeb &H000000006,0                               ' move r1,r0
'       scro_x=$C0E3(49379)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49379)) ' move r2,$C0E3 
        pokeb &H000000047,0                               ' add  r1,r2
'       x0=$C0CB(49355)           
        pokeb &H000000022,0                               ' move x0,r0
        
        pokeb &H000000002,ys                              ' move r1,[ys]
        pokeb &H000000003,y                               ' move r2,[y]
        pokeb &H000000047,0                               ' add  r1,r2
        pokeb &H000000006,0                               ' move r1,r2
        pokeb &H000000003,3.75                            ' move r2,3.75
        pokeb &H000000049,0                               ' mul  r1,r2
        pokeb &H000000006,0                               ' move r1,r0
        pokeb &H000000003,2                               ' move r2,2
        pokeb &H00000004B,0                               ' idev r1,r2
        pokeb &H000000006,0                               ' move r1,r0
'       scro_y=$C0E4(49380)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49380)) ' move r2,$C0E4 
        pokeb &H000000047,0                               ' add  r1,r2
'       y0=$CDCC(49356)           
        pokeb &H000000024,0                               ' move y0,r0 
        
        pokeb &H000000002,xs                              ' move r1,[xs]
        pokeb &H000000003,x                               ' move r2,[x]
        pokeb &H000000047,0                               ' add  r1,r2
        pokeb &H000000006,0                               ' move r1,r2
        pokeb &H000000003,3.75                            ' move r2,3.75
        pokeb &H000000049,0                               ' mul  r1,r2
        pokeb &H000000006,0                               ' move r1,r0
        pokeb &H000000003,7                               ' move r2,7
        pokeb &H000000047,0                               ' add  r1,r2
        pokeb &H000000006,0                               ' move r1,r0
        pokeb &H000000003,2                               ' move r2,2
        pokeb &H00000004B,0                               ' idev r1,r2
        pokeb &H000000006,0                               ' move r1,r0
'       scro_x=$C0E3(49379)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49379)) ' move r2,$C0E3 
        pokeb &H000000047,0                               ' add  r1,r2
'       x1=$CDCE(49358)           
        pokeb &H000000023,0                               ' move x0,r0
        
        pokeb &H000000002,ys                              ' move r1,[ys]
        pokeb &H000000003,y                               ' move r2,[y]
        pokeb &H000000047,0                               ' add  r1,r2
        pokeb &H000000006,0                               ' move r1,r2
        pokeb &H000000003,3.75                            ' move r2,3.75
        pokeb &H000000049,0                               ' mul  r1,r2
        pokeb &H000000006,0                               ' move r1,r0
        pokeb &H000000003,4                               ' move r2,4
        pokeb &H000000047,0                               ' add  r1,r2
        pokeb &H000000006,0                               ' move r1,r0
        pokeb &H000000003,2                               ' move r2,2
        pokeb &H00000004B,0                               ' idev r1,r2
        pokeb &H000000006,0                               ' move r1,r0
'       scro_y=$C0E4(49380)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49380)) ' move r2,$C0E4 
        pokeb &H000000047,0                               ' add  r1,r2
'       y1=$CDCE(49359)           
        pokeb &H000000025,0                               ' move y2,r0
      
#elseif defined(__FB_DOS__)

        pokeb &H000000002,xs                              ' move r1,[xs]
        pokeb &H000000003,x                               ' move r2,[x]
        pokeb &H000000047,0                               ' add  r1,r2
        pokeb &H000000006,0                               ' move r1,r2
        pokeb &H000000003,2.08                            ' move r2,2.08
        pokeb &H000000049,0                               ' mul  r1,r2
        pokeb &H000000006,0                               ' move r1,r0
        pokeb &H000000003,2                               ' move r2,2
        pokeb &H00000004B,0                               ' idev r1,r2
        pokeb &H000000006,0                               ' move r1,r0
'       scro_x=$C0E3(49379)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49379)) ' move r2,$C0E3 
        pokeb &H000000047,0                               ' add  r1,r2
'       x0=$C0CB(49355)           
        pokeb &H000000022,0                               ' move x0,r0
        
        pokeb &H000000002,ys                              ' move r1,[ys]
        pokeb &H000000003,y                               ' move r2,[y]
        pokeb &H000000047,0                               ' add  r1,r2
        pokeb &H000000006,0                               ' move r1,r2
        pokeb &H000000003,2.22                            ' move r2,2.22
        pokeb &H000000049,0                               ' mul  r1,r2
        pokeb &H000000006,0                               ' move r1,r0
        pokeb &H000000003,2                               ' move r2,2
        pokeb &H00000004B,0                               ' idev r1,r2
        pokeb &H000000006,0                               ' move r1,r0
'       scro_y=$C0E4(49380)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49380)) ' move r2,$C0E4 
        pokeb &H000000047,0                               ' add  r1,r2
'       y0=$CDCC(49356)           
        pokeb &H000000024,0                               ' move y0,r0 
        
        pokeb &H000000002,xs                              ' move r1,[xs]
        pokeb &H000000003,x                               ' move r2,[x]
        pokeb &H000000047,0                               ' add  r1,r2
        pokeb &H000000006,0                               ' move r1,r2
        pokeb &H000000003,2.08                            ' move r2,2.08
        pokeb &H000000049,0                               ' mul  r1,r2
        pokeb &H000000006,0                               ' move r1,r0
        pokeb &H000000003,7                               ' move r2,7
        pokeb &H000000047,0                               ' add  r1,r2
        pokeb &H000000006,0                               ' move r1,r0
        pokeb &H000000003,2                               ' move r2,2
        pokeb &H00000004B,0                               ' idev r1,r2
        pokeb &H000000006,0                               ' move r1,r0
'       scro_x=$C0E3(49379)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49379)) ' move r2,$C0E3 
        pokeb &H000000047,0                               ' add  r1,r2
'       x1=$CDCE(49358)           
        pokeb &H000000023,0                               ' move x0,r0
        
        pokeb &H000000002,ys                              ' move r1,[ys]
        pokeb &H000000003,y                               ' move r2,[y]
        pokeb &H000000047,0                               ' add  r1,r2
        pokeb &H000000006,0                               ' move r1,r2
        pokeb &H000000003,2.22                            ' move r2,2.22
        pokeb &H000000049,0                               ' mul  r1,r2
        pokeb &H000000006,0                               ' move r1,r0
        pokeb &H000000003,4                               ' move r2,4
        pokeb &H000000047,0                               ' add  r1,r2
        pokeb &H000000006,0                               ' move r1,r0
        pokeb &H000000003,2                               ' move r2,2
        pokeb &H00000004B,0                               ' idev r1,r2
        pokeb &H000000006,0                               ' move r1,r0
'       scro_y=$C0E4(49380)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49380)) ' move r2,$C0E4 
        pokeb &H000000047,0                               ' add  r1,r2
'       y1=$CDCE(49359)           
        pokeb &H000000025,0                               ' move y2,r0
       
#endif
	    poke64(49404,peek64(49404)) 'Flag: Print Reverse Characters?0=No    
        mov(x add,1)
'                     font_w	
        if x gt mem64(49385) then 
          mov(x,0)
          mov(y add,1)
          mov(c add,1)
        end if  
      loop
      poke64(49412,0) 'Screen Unlock
'                scr_ptr      
    mov(adr add,&H0000D0000)
    mov(v,mem64(adr))
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Project Manhattan

Post by fatman2021 »

90x60 Text Mode framebuffer

Code: Select all

   case &H000004000 to &H000007E70 ' Screen Memory(0x000004000(16384)-
                                  '                0x000007E70(32368)) 90x60 Text Mode
#define idev /
'  alpha          =$C005(49157)
'  red            =$C002(49154)
'  green          =$C003(49155)
'  blue           =$C003(49156)
'  fg_color       =$C0C9(49353)
'  bg_color       =$C0CA(49354)
'  x0             =$C0CB(49355)
'  y0             =$CDCC(49356)
'  z0             =$CDCD(49357)
'  x1             =$CDCE(49358)
'  y1             =$CDCE(49359)
'  z1             =$CDCF(49360)
'  r0             =$C9D1(49361)
'  r1             =$C0D2(49362)
'  r2             =$C0D3(49363)
'  r3             =$C0D4(49364)
'  r4             =$C0D5(49365)
'  r5             =$C0D6(49366)
'  r6             =$C0D7(49367)
'  r7             =$COD8(49368)
'  scro_x         =$C0E3(49379)
'  scro_y         =$C0E4(49380)
'  Screen Memory(0x000000400(001024)-0x0000007E7(002023)) - 40x25 Text Frame Buffer
'  Screen Memory(0x000004000(016384)-0x000007E70(032368)) - 90x60 Text Frame Buffer
'  Screen Memory(0x00000D800(055296)-0x00000DBFF(056319)) - Reprogrammable Character Set
'  Screen Memory(0x0000C0000(786432)-0x0000C7FF0(819184)) - Reprogrammable Character Set
'  Screen Memory(0x0000D0000(851968)-0x0000D3E70(867952)) - 120x60 Text Frame Buffer 

    poke SYSTEM_TYPE,@adr,peek(SYSTEM_TYPE, @adr) subt &H000004000    
    mov(c, v)
    mov(c shl,peek(ubyte,@nibbles(&B0011)))
'                   font_o      
    mov(c add,mem64(49384))
    mov(xs,modulo(adr,90))
    mov(xs shl,peek(ubyte,@nibbles(&B0011)))
    mov(xs add,peek(ubyte,@nibbles(&B0111)) mul 3.5)
    mov(ys,adr idiv  90):mov(ys shl, peek(ubyte,@nibbles(&B0011)))
    mov(ys add,peek(ubyte,@nibbles(&B0111)) mul 3.5)
    if peek(SYSTEM_TYPE,@mem64(RVS)) ne peek(ubyte,@nibbles(&B0000)) then 
      mov(c and,peek(ubyte,@nibbles(&B1111)) shl peek(ubyte,@nibbles(&B0100)) _
            add peek(ubyte,@nibbles(&B1111)))
    end if
    if peek(SYSTEM_TYPE,@mem64(49357)) ls peek(ubyte,@nibbles(&B0001)) then 
      poke SYSTEM_TYPE,@mem64(49357),peek(ubyte,@nibbles(&B0001))
    end if  
    poke64(49410,peek(ubyte,@nibbles(&B0000))) 'Screen lock
    poke SYSTEM_TYPE,@y,peek(ubyte,@nibbles(&B0000))
    poke SYSTEM_TYPE,@x,peek(ubyte,@nibbles(&B0000))
'                                    font_h               font_w             
      do until logic_and(mov(y,mem64(49386)),mov(x,mem64(49385)))

#if defined(__FB_DOS__) or defined(__FB_WIN32__) or defined(__FB_WIN64__)

        pokeb &H000000002,xs                              ' move r1,[xs]
        pokeb &H000000003,x                               ' move r2,[x]
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0010))    ' move r2,2
        pokeb &H000000049,peek(ubyte,@nibbles(&B0000))    ' mul  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0010))    ' move r2,2
        pokeb &H00000004B,peek(ubyte,@nibbles(&B0000))    ' idev r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
'       scro_x=$C0E3(49379)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49379)) ' move r2,$C0E3 
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
'       x0=$C0CB(49355)           
        pokeb &H000000022,peek(ubyte,@nibbles(&B0000))    ' move x0,r0
        
        pokeb &H000000002,ys                              ' move r1,[ys]
        pokeb &H000000003,y                               ' move r2,[y]
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0010))    ' move r2,2
        pokeb &H000000049,peek(ubyte,@nibbles(&B0000))    ' mul  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0010))    ' move r2,2
        pokeb &H00000004B,peek(ubyte,@nibbles(&B0000))    ' idev r1,r2
        pokeb &H000000006,0                               ' move r1,r0
'       scro_y=$C0E4(49380)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49380)) ' move r2,$C0E4 
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
'       y0=$CDCC(49356)           
        pokeb &H000000024,peek(ubyte,@nibbles(&B0000))    ' move y0,r0 
        
        pokeb &H000000002,xs                              ' move r1,[xs]
        pokeb &H000000003,x                               ' move r2,[x]
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0010))    ' move r2,2
        pokeb &H000000049,peek(ubyte,@nibbles(&B0000))    ' mul  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0111))    ' move r2,7
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0010))    ' move r2,2
        pokeb &H00000004B,peek(ubyte,@nibbles(&B0000))    ' idev r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
'       scro_x=$C0E3(49379)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49379)) ' move r2,$C0E3 
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
'       x1=$CDCE(49358)           
        pokeb &H000000023,peek(ubyte,@nibbles(&B0000))    ' move x0,r0
        
        pokeb &H000000002,ys                              ' move r1,[ys]
        pokeb &H000000003,y                               ' move r2,[y]
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0010))    ' move r2,2
        pokeb &H000000049,peek(ubyte,@nibbles(&B0000))    ' mul  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0100))    ' move r2,4
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0010))    ' move r2,2
        pokeb &H00000004B,peek(ubyte,@nibbles(&B0000))    ' idev r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
'       scro_y=$C0E4(49380)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49380)) ' move r2,$C0E4 
        pokeb &H000000047,0                               ' add  r1,r2
'       y1=$CDCE(49359)           
        pokeb &H000000025,0                               ' move y2,r0

#else
       
        pokeb &H000000002,xs                              ' move r1,[xs]
        pokeb &H000000003,x                               ' move r2,[x]
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0101))    ' move r2,5
        pokeb &H000000049,peek(ubyte,@nibbles(&B0000))    ' mul  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0010))    ' move r2,2
        pokeb &H00000004B,peek(ubyte,@nibbles(&B0000))    ' idev r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
'       scro_x=$C0E3(49379)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49379)) ' move r2,$C0E3 
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
'       x0=$C0CB(49355)           
        pokeb &H000000022,peek(ubyte,@nibbles(&B0000))    ' move x0,r0
        
        pokeb &H000000002,ys                              ' move r1,[ys]
        pokeb &H000000003,y                               ' move r2,[y]
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,3.5                             ' move r2,3.5
        pokeb &H000000049,peek(ubyte,@nibbles(&B0000))    ' mul  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0010))    ' move r2,2
        pokeb &H00000004B,peek(ubyte,@nibbles(&B0000))    ' idev r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
'       scro_y=$C0E4(49380)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49380)) ' move r2,$C0E4 
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
'       y0=$CDCC(49356)           
        pokeb &H000000024,peek(ubyte,@nibbles(&B0000))    ' move y0,r0 
        
        pokeb &H000000002,xs                              ' move r1,[xs]
        pokeb &H000000003,x                               ' move r2,[x]
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r2
        pokeb &H000000003,peek(ubyte,@nibbles(&B0101))    ' move r2,5
        pokeb &H000000049,peek(ubyte,@nibbles(&B0000))    ' mul  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0111))    ' move r2,7
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0010))    ' move r2,2
        pokeb &H00000004B,peek(ubyte,@nibbles(&B0000))    ' idev r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
'       scro_x=$C0E3(49379)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49379)) ' move r2,$C0E3 
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
'       x1=$CDCE(49358)           
        pokeb &H000000023,peek(ubyte,@nibbles(&B0000))    ' move x0,r0
        
        pokeb &H000000002,ys                              ' move r1,[ys]
        pokeb &H000000003,y                               ' move r2,[y]
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,3.5                             ' move r2,3.5
        pokeb &H000000049,peek(ubyte,@nibbles(&B0000))    ' mul  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0111))    ' move r2,7
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
        pokeb &H000000003,peek(ubyte,@nibbles(&B0010))    ' move r2,2
        pokeb &H00000004B,peek(ubyte,@nibbles(&B0000))    ' idev r1,r2
        pokeb &H000000006,peek(ubyte,@nibbles(&B0000))    ' move r1,r0
'       scro_y=$C0E4(49380)
        pokeb &H000000003,peek(SYSTEM_TYPE,@mem64(49380)) ' move r2,$C0E4 
        pokeb &H000000047,peek(ubyte,@nibbles(&B0000))    ' add  r1,r2
'       y1=$CDCE(49359)           
        pokeb &H000000025,peek(ubyte,@nibbles(&B0000))    ' move y2,r0
        
#endif

	    poke64(49404,peek64(49404)) 'Flag: Print Reverse Characters?0=No
    
        mov(x add,1)
'                     font_w	        
        if x gt mem64(49385) then 
          mov(x,0)
          mov(y add,1)
          mov(c add,1)
       end if   
      loop
      poke64(49412,0) 'Screen Unlock
'                scr_ptr      
    mov(adr add,&H000004000)
    mov(v,mem64(adr))
Post Reply