Jump to content
IGNORED

Problem loading file using CIO


Recommended Posts

While my latest assemble runs I may as well ask for some help with this one.

 

Still for my abbuc game Ski-It in MAC/65...

 

Trying to make the High Score Table save and load - game is an EXE running on a DOS2.5 disk (and yes I know there is XBIOS out there but one thing at a time!)

 

The I/O code is from Assembly Language Programming for the Atari Computers (Mark Chasin)

 

I have modified the routine to flag read or write (IOWRITEFLAG) and to change the background colour briefly. It looks like the SAVE is working - you can hear it, but the LOAD fails "raspberry" and then timesout back to the program, you see the colour change in both cases.

 

I have my game code at $1D00 which I thought was far enough past what DOS would use :ponder: I'm trying to get as near as I can as my last two games have been boot disks with no DOS so this is really eating into my available RAM for the game.

 

Here's the code (listed from MAC/65 to PC via APE and then pasted here from Memopad (the spurious chars have appeared as part of this process!)

 

10 ; save #d1:hscio.m65
20 ;
30 ; see ALP Ch9-4
40 ;
50 ; ***********
60 ; CIO equates
70 ; ***********
80 ICHID = $0340
90 ICDNO = $0341
0100 ICCOM = $0342
0110 ICSTA = $0343
0120 ICBAL = $0344
0130 ICBAH = $0345
0140 ICPTL = $0346
0150 ICPTH = $0347
0160 ICBLL = $0348
0170 ICBLH = $0349
0180 ICAX1 = $034A
0190 ICAX2 = $034B
0200 CIOV = $E456
0210 ;
0220 ; *= $8000 ; x$0600 ªªª
0230 ;
0240 HSCIO
0250 ;
0260 ; ***************************
0270 ; First, close and open IOCB2
0280 ; ***************************
0290 LDX #$20 ; For IOCB2
0300 LDA #12 ; Close command
0310 STA ICCOM,X ; Into ICCOM
0320 JSR CIOV ; Do the CLOSE
0330 ;
0340 LDX #$20 ; IOCB2 again
0350 LDA #3 ; Open file
0360 STA ICCOM,X ; Is the command
0370 ;
0380 ;
0390 ; check if write flag set
0400 LDA IOWRITEFLAG
0410 BNE HSCIOPREPWRITE
0420 ;
0430 ;
0440 LDA #4 ; Input
0450 STA ICAX1,X ; Open for read
0460 ;
0470 ; dest RAM data table
0480 LDA #HSCTABLE&255 ; Low byte
0490 STA ICBAL,X
0500 LDA #HSCTABLE/256 ; High byt
0510 STA ICBAH,X
0520 ;
0530 BNE HSCIOPREPALL ; æ
0540 ;
0550 ;
0560 HSCIOPREPWRITE
0570 LDA #8 ; Output
0580 STA ICAX1,X ; Open
0590 ;
0600 ; dest disk file (for printer set "P:" in filename)
0610 LDA #FILENAME&255 ; Low byte
0620 STA ICBAL,X
0630 LDA #FILENAME/256 ; High byt
0640 STA ICBAH,X
0650 ;
0660 ;
0670 HSCIOPREPALL
0680 LDA #0
0690 STA ICBLH,X ; H byte length
0700 LDA #$FF
0710 STA ICBLL,X ; L byte length
0720 JSR CIOV ; Do the OPEN
0730 ;
0740 ; ***************************
0750 ; Now we'll print the message
0760 ; ***************************
0770 LDX #$20 ; By using IOCB2
0780 ;
0790 LDA IOWRITEFLAG
0800 BNE HSCIOWRITE
0810 ;
0820 ;HSCIOREAD
0821 LDA #$A4 ;«
0822 STA COLBAK ;«
0823 ;
0830 LDA #5 ; Get record
0840 STA ICCOM,X ; Command
0850 ;
0860 ; source disk file
0870 LDA #FILENAME&255 ; Low byte
0880 STA ICBAL,X
0890 LDA #FILENAME/256 ; High byt
0900 STA ICBAH,X
0910 ;
0920 BNE HSCIOREADY ; æ
0930 ;
0940 ;
0950 HSCIOWRITE
0951 LDA #$42 ;«
0952 STA COLBAK ;«
0953 ;
0960 LDA #9 ; Put record
0970 STA ICCOM,X ; Command
0980 ;
0990 ; source table in RAM
1000 LDA #HSCTABLE&255 ; Low byte
1010 STA ICBAL,X
1020 LDA #HSCTABLE/256 ; High byt
1030 STA ICBAH,X
1040 ;
1050 ;
1060 HSCIOREADY
1070 LDA #0 ; Length tbl
1080 STA ICBLH,X ; High byte
1090 LDA #$FF ;
1100 STA ICBLL,X ; Low byte
1110 JSR CIOV ;Put out the line
1120 RTS ; End of routine
1130 ;
1140 ;
1150 FILENAME .BYTE "D1:RECORDS.SKI",$9B
1160 ; HSCTABLE .BYTE "A SUCCESSFUL WRITE!",$9B

 

Thanks ;)

hscio.txt

Edited by therealbountybob
Link to comment
Share on other sites

Moving a label or two should about fix it.

 

For OPEN, you don't need to worry about the buffer length - just the $9B terminating the filespec is all that's needed. I imagine though that there's probably a 256 char limit on filespec though most handlers rarely use more than about 20.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...