Previous Thread
Next Thread
Print Thread
Page 6 of 80 1 2 4 5 6 7 8 79 80
Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
Hi Sean,

Thanks for looking that up. I was totally bewildered why machine language would work, but Applesoft pokes would not. That may explain why the Third Millennium Arcade Board has its write register port at $C0C1 and $C0C3 and the read register port at $C0C1 so it could work from both machine language and also Applesoft BASIC POKEing. If you POKE to $C0C3, on the Arcade Board, the STA ($50),Y read is harmless.

I was trying to do a little demo with both the Third Millennium Arcade Board in slot 4 and the Super Sprite in slot 7 and both have them display something, Now I know why my POKEs were ineffective. Man, that was driving me bats.


Last edited by Golden Child; 09/24/17 01:40 AM.
Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
I was using PR#1 along with specifying the ssc and a printer, but for some reason the DIP switches would reset themselves to "Communications Mode" along with "19200 baud". I'd set them to "Printer Mode / 9600" and that would disappear sometimes.

./mame64 apple2e -sl1 ssc -sl1:ssc:ssc_rs232 printer -printout myprintout.bin

What I discovered is that you have to keep specifying the "-sl1 ssc -sl1:ssc:ssc_rs232 printer -printout myprintout.bin" part on the command line.

If you don't, the DIP switches disappear from the UI menus and the next time you specify the ssc, those values will reset themselves to communications mode/19200 and your printout file will be scrambled eggs instead of sunny side up.


Is there a way to specify those settings from the command line?

Last edited by Golden Child; 09/24/17 01:04 PM.
Joined: Mar 2001
Posts: 17,217
Likes: 234
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,217
Likes: 234
Right, the switches are only saved if the card is present, because otherwise you could put a different card with different switches in slot 1 and really confuse things. Your best bet is probably to make a batch file that runs MAME with the -sl1 ssc and so on.

Joined: Feb 2004
Posts: 2,598
Likes: 301
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,598
Likes: 301
There's no way to set DIP switches on the command line right now, and the options system is rather buggy and limited. It's being rewritten, it's just time-consuming. This will open up more possibilities.

Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
One last question for today: I was trying to edit my basic program in a text editor and paste it into the apple2e driver with UI Paste (Left Shift+Scroll Lock).

Some characters on the PC keyboard don't get typed properly:

" turns into @
* turns into nothing
() turns into *(
& turns into ^
@ turns into nothing

which makes it hard to paste programs.

pasting the following text into the apple2e driver:

Code
    exclaim!atsign@hash#dollarsign$percent%caret^amper&asterisk*leftparen(rightparen)
    dash-underscore_plus+equals=bracket[]curly{}backslash\verticalbar|
    tick`tilde~
    comma,period.lessthan<greaterthan>slash/question?semicolon;colon:singlequote'doublequote"
    abcdefghijklmnopqrstuvwxyz
    ABCDEFGHJIJKLMNOPQRSTUVWXYZ
[Linked Image from i.imgur.com]



so for instance:
Code
50 PRINT "ADDR WRITE SLOT=";S;" VALUE LO=";W0;" HI=";W1
51 SB = 49280:S0 = SB + 16 * S:S1 = S0 + 1:IP = 16384+20:I0=IP
52 POKE IP,160 + 13: POKE IP + 1, FN LO(S1): POKE IP + 2, FN HI(S1): IP = IP + 3 REM  AD LDA $C0C1
turns into:

Code
50 PRINT @ADDR WRITE SLOT=@;S;@ VALUE LO=@;W0;@ HI=@;W1
51 SB = 49280:S0 = SB + 16  S:S1 = S0 + 1:IP = 16384+20:I0=IP
52 POKE IP,160 + 13: POKE IP + 1, FN LO*S1(: POKE IP + 2, FN HI*S1(: IP = IP + 3 REM  AD LDA $C0C1



and a couple of things about UI Paste:

ALT+TAB to switch to my text editor, copy with CTRL+C, ALT+TAB to go back to the apple2e driver, ends up putting a CTRL+I into the text buffer so you have to hit enter to clear the input line.

if you type ? ASC(" then hit alt+tab then go back to mame with alt+tab then type ") you get a 9 (a CTRL+I).



You have to be really quick to hit Left Shift+Scroll Lock and let go of the Left Shift or 1234 PRINT turns into !@#$ PRINT.

It'd be cool if there was a delay before it actually started typing, and maybe even have a notification that comes on screen saying : UI Paste in progress. Perhaps even an abort mechanism that can stop a UI Paste in progress.


When a CR is encountered, the basic interpreter can't keep up with the keystrokes sometimes while it's processing the line and will sometimes drop the first character of the next line which can easily stomp other basic lines since the line number isn't right.

Note how the pasted text has missing characters at the beginning of the line.

Maybe there could be a CR delay that's longer than the normal character send time.


Upper and lowercase is a bit of a problem since caps lock is a must for Applesoft Basic programming, but if you were to paste UI lowercase text it wouldn't come out properly.

Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
Silly fun with having both the Arcade Board and the Super Sprite active.

./mame64 apple2e -sl4 arcbd -sl7 ssprite

[Linked Image from i.imgur.com]

edit:

and even more silly fun:

./mame64 apple2e -sl4 arcbd -sl5 arcbd -sl7 ssprite

[Linked Image from i.imgur.com]

trying to do more gets me a segfault:

./mame64 apple2e -sl7 ssprite -sl4 arcbd -sl5 arcbd -sl2 arcbd
Segmentation fault (core dumped)

Last edited by Golden Child; 09/24/17 11:45 PM.
Joined: Mar 2001
Posts: 17,217
Likes: 234
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,217
Likes: 234
MAME has a hardcoded max of 4 screens. I'm not sure where it comes from, it limits my ability to put 6 NuBus video cards in a Mac II and have real fun frown

Joined: Feb 2004
Posts: 2,598
Likes: 301
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,598
Likes: 301
The maximum screen count comes from the built-in layouts. MAME can't dynamically generate layouts for an arbitrary number of screens. Make a github issue and assign it to me - I'll get around to it at some point.

Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
Some baby steps with lua: I thought I'd see if I could "dump" the Apple 2 text screen memory to the lua console.


./mame64 apple2e -plugin console


Code
cpu = manager:machine().devices[":maincpu"];mem = cpu.spaces["program"]

for i=0,23 do appletextaddress=0x400+(math.floor(i/8)*40+128*(i%8)); print(i.."  "..appletextaddress.."") end

for i=0,23 do appletextaddress=0x400+(math.floor(i/8)*40+128*(i%8)); a="";for k=0,39 do newchar = mem:read_i8(appletextaddress+k); newchar = newchar & 127 ; if newchar < 32 then newchar = newchar + 64; end; a=a..string.char(newchar); end; print (i.."  "..appletextaddress.." "..a); end


There's a minimal amount of character fixing, just take the char, strip the high bit and turn characters less than 32 into something recognizable by adding 64.


Running the little program:

100 HOME : FOR I = 1 TO 24: HTAB 1 : VTAB I: PRINT "Apple Text Line: ";I;: NEXT : VTAB 1

[Linked Image from i.imgur.com]


Code
0  1024 Apple Text Line: 1                      
1  1152 ]pple Text Line: 2                      
2  1280 Apple Text Line: 3                      
3  1408 Apple Text Line: 4                      
4  1536 Apple Text Line: 5                      
5  1664 Apple Text Line: 6                      
6  1792 Apple Text Line: 7                      
7  1920 Apple Text Line: 8                      
8  1064 Apple Text Line: 9                      
9  1192 Apple Text Line: 10                     
10  1320 Apple Text Line: 11                     
11  1448 Apple Text Line: 12                     
12  1576 Apple Text Line: 13                     
13  1704 Apple Text Line: 14                     
14  1832 Apple Text Line: 15                     
15  1960 Apple Text Line: 16                     
16  1104 Apple Text Line: 17                     
17  1232 Apple Text Line: 18                     
18  1360 Apple Text Line: 19                     
19  1488 Apple Text Line: 20                     
20  1616 Apple Text Line: 21                     
21  1744 Apple Text Line: 22                     
22  1872 Apple Text Line: 23                     
23  2000 Apple Text Line: 24                     

and my UI paste test becomes:

Code
0  1024                                         
1  1152 ]    EXCLAIM!ATSIGNHASH#DOLLARSIGN$PERCE
2  1280 NT%CARETAMPER^ASTERISKLEFTPAREN*RIGHTPAR
3  1408 EN(                                     
4  1536                                         
5  1664 ?SYNTAX ERROR                           
6  1792 ]ASH-UNDERSCORE_PLUS+EQUALS=BRACKET[]CUR
7  1920 LY{}BACKSLASH\VERTICALBAR|              
8  1064                                         
9  1192 ?SYNTAX ERROR                           
10  1320 ]TICK`TILDE~                            
11  1448                                         
12  1576 ?SYNTAX ERROR                           
13  1704 ]    COMMA,PERIOD.LESSTHAN<GREATERTHAN>S
14  1832 LASH/QUESTION?SEMICOLON;COLON:SINGLEQUOT
15  1960 E&DOUBLEQUOTE@                          
16  1104                                         
17  1232 ?SYNTAX ERROR                           
18  1360 ]BCDEFGHIJKLMNOPQRSTUVWXYZ              
19  1488                                         
20  1616 ?SYNTAX ERROR                           
21  1744 ]   ABCDEFGHJIJKLMNOPQRSTUVWXYZ         
22  1872                                         
23  2000                                         

Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
This lua stuff is really cool.

I wanted to see if it could write to the TMS9918 on the arcade board and I was able to write to the VRAM, but I couldn't find a way to access the TMS9918 registers programmatically.

I think that the TMS9918 have to be initialized with a real program, because there are side effects from the code that sets the registers. Once it's initialized, then I can just write stuff to the VRAM space and it displays.

Wow, this is so much faster to run than my Applesoft programs. The effects are seen virtually instantaneously.

Now if I just had a way to do an emu.frameadvance() (which doesn't work) or some kind of way to do a delay like wait for vblank.


[Linked Image from i.imgur.com]



A very short program to initialize the TMS 9918 registers.

Code
1  DEF  FN LO(X) = ((X / 256) -  INT (X / 256)) * 256: DEF  FN HI(X) =  INT (X / 256)

4  GOTO 100
5  PRINT "REG WRITE: SLOT=";S;" VALUE=";W0;" REG=";W1
6 SB = 49280:S0 = SB + 16 * S:S1 = S0 + 1
7 IP = 16384
8  POKE IP,160 + 13: POKE IP + 1, FN LO(S1): POKE IP + 2, FN HI(S1): REM LDA $C0C1
9 IP = IP + 3: POKE IP,160 + 9: POKE IP + 1,W0:IP = IP + 2: REM LDA #$W0
10  POKE IP,128 + 13: POKE IP + 1, FN LO(S1): POKE IP + 2, FN HI(S1):IP = IP + 3: REM STA $C0C1
11 IP = IP + 0: POKE IP,160 + 9: POKE IP + 1,W1:IP = IP + 2: REM LDA #$W1
13 IP = IP + 0: POKE IP,128 + 13: POKE IP + 1, FN LO(S1): POKE IP + 2, FN HI(S1):IP = IP + 3: REM STA $C0C1
14  POKE IP,6 * 16:IP = IP + 1: REM  RTS
15  CALL 16384
16  RETURN 

100 S = 4:W0 = 2:W1 = 128 + 0: GOSUB 5
101 S = 4:W0 = 193:W1 = 128 + 1: GOSUB 5
102 S = 4:W0 = 14:W1 = 128 + 2: GOSUB 5
103 S = 4:W0 = 255:W1 = 128 + 3: GOSUB 5
104 S = 4:W0 = 3:W1 = 128 + 4: GOSUB 5
105 S = 4:W0 = 118:W1 = 128 + 5: GOSUB 5
106 S = 4:W0 = 3:W1 = 128 + 6: GOSUB 5
107 S = 4:W0 = 15:W1 = 128 + 7: GOSUB 5
108  END 

Then I can run this lua program with dofile("fontarray_tms.lua")


Code
tms= manager:machine().devices[":sl4:arcbd:arcbd_tms"]
mem = tms.spaces["vram"]

fontarray = {32, 0,0,0,0,0,0,0,0,
33, 24,60,60,24,24,0,24,0,
34, 108,108,0,0,0,0,0,0,
35, 108,108,254,108,254,108,108,0,
36, 24,62,96,60,6,124,24,0,
37, 0,198,204,24,48,102,198,0,
38, 56,108,104,118,220,204,118,0,
39, 24,24,48,0,0,0,0,0,
40, 12,24,48,48,48,24,12,0,
41, 48,24,12,12,12,24,48,0,
42, 0,102,60,255,60,102,0,0,
43, 0,24,24,126,24,24,0,0,
44, 0,0,0,0,0,24,24,48,
45, 0,0,0,126,0,0,0,0,
46, 0,0,0,0,0,24,24,0,
47, 3,6,12,24,48,96,192,0,
48, 60,102,110,126,118,102,60,0,
49, 24,56,24,24,24,24,126,0,
50, 60,102,6,28,48,102,126,0,
51, 60,102,6,28,6,102,60,0,
52, 28,60,108,204,254,12,30,0,
53, 126,96,124,6,6,102,60,0,
54, 28,48,96,124,102,102,60,0,
55, 126,102,6,12,24,24,24,0,
56, 60,102,102,60,102,102,60,0,
57, 60,102,102,62,6,12,56,0,
58, 0,24,24,0,0,24,24,0,
59, 0,24,24,0,0,24,24,48,
60, 12,24,48,96,48,24,12,0,
61, 0,0,126,0,0,126,0,0,
62, 48,24,12,6,12,24,48,0,
63, 60,102,6,12,24,0,24,0,
64, 124,198,222,222,222,192,120,0,
65, 24,60,60,102,126,195,195,0,
66, 252,102,102,124,102,102,252,0,
67, 60,102,192,192,192,102,60,0,
68, 248,108,102,102,102,108,248,0,
69, 254,102,96,120,96,102,254,0,
70, 254,102,96,120,96,96,240,0,
71, 60,102,192,206,198,102,62,0,
72, 102,102,102,126,102,102,102,0,
73, 126,24,24,24,24,24,126,0,
74, 14,6,6,6,102,102,60,0,
75, 230,102,108,120,108,102,230,0,
76, 240,96,96,96,98,102,254,0,
77, 130,198,238,254,214,198,198,0,
78, 198,230,246,222,206,198,198,0,
79, 56,108,198,198,198,108,56,0,
80, 252,102,102,124,96,96,240,0,
81, 56,108,198,198,198,108,60,6,
82, 252,102,102,124,108,102,227,0,
83, 60,102,112,56,14,102,60,0,
84, 126,90,24,24,24,24,60,0,
85, 102,102,102,102,102,102,62,0,
86, 195,195,102,102,60,60,24,0,
87, 198,198,198,214,254,238,198,0,
88, 195,102,60,24,60,102,195,0,
89, 195,195,102,60,24,24,60,0,
90, 254,198,140,24,50,102,254,0,
91, 60,48,48,48,48,48,60,0,
92, 192,96,48,24,12,6,3,0,
93, 60,12,12,12,12,12,60,0,
94, 16,56,108,198,0,0,0,0,
95, 0,0,0,0,0,0,0,254,
96, 24,24,12,0,0,0,0,0,
97, 0,0,60,6,30,102,59,0,
98, 224,96,108,118,102,102,60,0,
99, 0,0,60,102,96,102,60,0,
100, 14,6,54,110,102,102,59,0,
101, 0,0,60,102,126,96,60,0,
102, 28,54,48,120,48,48,120,0,
103, 0,0,59,102,102,60,198,124,
104, 224,96,108,118,102,102,230,0,
105, 24,0,56,24,24,24,60,0,
106, 6,0,6,6,6,6,102,60,
107, 224,96,102,108,120,108,230,0,
108, 56,24,24,24,24,24,60,0,
109, 0,0,102,119,107,99,99,0,
110, 0,0,124,102,102,102,102,0,
111, 0,0,60,102,102,102,60,0,
112, 0,0,220,102,102,124,96,240,
113, 0,0,61,102,102,62,6,7,
114, 0,0,236,118,102,96,240,0,
115, 0,0,62,96,60,6,124,0,
116, 16,48,124,48,48,52,24,0,
117, 0,0,204,204,204,204,118,0,
118, 0,0,204,204,204,120,48,0,
119, 0,0,198,214,214,108,108,0,
120, 0,0,99,54,28,54,99,0,
121, 0,0,102,102,102,60,24,112,
122, 0,0,126,76,24,50,126,0,
123, 14,24,24,112,24,24,14,0,
124, 24,24,24,24,24,24,24,0,
125, 112,24,24,14,24,24,112,0,
126, 114,156,0,0,0,0,0,0,
127, 0,0,0,0,0,0,0,0
}

-- pattern table at 0x0000

i=1
bytepos=0x0000+32*8
while(true) do
 if i>table.maxn(fontarray) then break; end;
  charnum = fontarray[i];
  i = i + 1;
  for j=1,8 do  mem:write_i8(bytepos,fontarray[i]); i = i + 1; bytepos = bytepos+1; end
end

-- name table at 0x3800

bytepos = 0x3800

for j=0,2 do
for i=0,255 do mem:write_i8(bytepos,i); bytepos = bytepos+1; end
end

-- color table at 0x2000

bytepos = 0x2000

for i=0,6143 do mem:write_i8(bytepos,15*16+4); bytepos = bytepos+1; end

-- use our font array for a sprite pattern table also

i=1
bytepos=0x1800+32*8
while(true) do
 if i>table.maxn(fontarray) then break; end;
  charnum = fontarray[i];
  i = i + 1;
  for j=1,8 do  mem:write_i8(bytepos,fontarray[i]); i = i + 1; bytepos = bytepos+1; end
end

function setsprite(sprite,x,y,pattern,color)
bytepos=0x3b00+sprite*4
if y>=0 then mem:write_i8(bytepos,y) end -- vertical first
if x>=0 then mem:write_i8(bytepos+1,x)  end
if pattern>=0 then mem:write_i8(bytepos+2,pattern) end
if color >=0 then mem:write_i8(bytepos+3,color) end
end


a = "MameTMS 99184 spriteper line max"

for i=0,string.len(a)-1 do
 setsprite(i,50+(i%4)*20,30+math.floor(i/4)*20,string.byte(a,i+1),(i*2+1)%16);
end

-- dofile("fontarray_tms.lua")



Page 6 of 80 1 2 4 5 6 7 8 79 80

Link Copied to Clipboard
Who's Online Now
1 members (AJR), 338 guests, and 5 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,320
Posts121,944
Members5,074
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com