Jump to content
IGNORED

Assembly BYTE and more questions


jchase1970

Recommended Posts

L10    BL    @CLS

comes up with a undefined symbol error I don't know why.

 

The END directive has to be at the absolute end of the program. It tells the compiler to cease at that line. That is why it threw an undefined symbol, it never reached the CLS section at all.

 

And 2 I guess this code wont work anyway because I'm BLing in a BLing,

 

Yep, only one BL at a time. It will overwrite the address in R11 each time. You can build a stack address to have multiple levels if you want, like this:

 

RSTACK BSS  32
.
.
.
START  LI   R10,RSTACK
.
.
.
      BL   @HERE
.
.
.
HERE   MOV  R11,*R10+
* Code follows
      B    @SUBRET
.
.
.
SUBRET DECT R10
      B    *R10

 

Adamantyr

Link to comment
Share on other sites

Adam wins the latest round of 'How to Fix What John Has Screwed Up This Time.'

 

I'ld like to think all the contestants for there fine play in the latest round. Stay tuned for more exciting game play on 'How to Fix What John Has Screwed Up This Time.'

 

Just got to get the stack added to the structure now.

Edited by jchase1970
Link to comment
Share on other sites

This code is just clearing the screen but it leaves 1 scrambled character on the screen is there something anyone can see wrong with it? Could it be just cause the program is over and doesn't end?

      DEF   MAIN
*VDP MEMORY MAP

VDPRD  EQU   >8800
VDPSTA EQU   >8802
VDPWD  EQU   >8C00
VDPWA  EQU   >8C02

*WORKSPACE

WRKSP  EQU   >8300
R0LB   EQU   WRKSP+1
R1LB   EQU   WRKSP+3
R2LB   EQU   WRKSP+5
R3LB   EQU   WRKSP+7
R4LB   EQU   WRKSP+9

RSTACK BSS   32

MAIN
      LI    R10,RSTACK
L10    BL    @CLEAR

*BASIC COMMANDS
CLEAR  MOV   R11,R10
      LI    R0,0
      LI    R1,>2000
      LI    R2,768
      BL    @VSMW
      B     @SUBRET

*ASSEMBLY COMMANDS

VSMW   MOVB @R0LB,@VDPWA
      ORI  R0,>4000
      MOVB R0,@VDPWA
VSMWLP MOVB R1,@VDPWD
      DEC  R2
      JNE  VSMWLP
      B    *R11

SUBRET DECT R10
      B    *R10

      END  MAIN

Link to comment
Share on other sites

This code is just clearing the screen but it leaves 1 scrambled character on the screen is there something anyone can see wrong with it? Could it be just cause the program is over and doesn't end?

      DEF   MAIN
*VDP MEMORY MAP

VDPRD  EQU   >8800
VDPSTA EQU   >8802
VDPWD  EQU   >8C00
VDPWA  EQU   >8C02

*WORKSPACE

WRKSP  EQU   >8300
R0LB   EQU   WRKSP+1
R1LB   EQU   WRKSP+3
R2LB   EQU   WRKSP+5
R3LB   EQU   WRKSP+7
R4LB   EQU   WRKSP+9

RSTACK BSS   32

MAIN
      LI    R10,RSTACK
L10    BL    @CLEAR

*BASIC COMMANDS
CLEAR  MOV   R11,R10
      LI    R0,0
      LI    R1,>2000
      LI    R2,768
      BL    @VSMW
      B     @SUBRET

*ASSEMBLY COMMANDS

VSMW   MOVB @R0LB,@VDPWA
      ORI  R0,>4000
      MOVB R0,@VDPWA
VSMWLP MOVB R1,@VDPWD
      DEC  R2
      JNE  VSMWLP
      B    *R11

SUBRET DECT R10
      B    *R10

      END  MAIN

 

Why are you trying to implement a stack on a computer that leans the other other way? You are making this way to complicated.

If you want to clear the screen then write a sub to clear the screen. You won't have any level changes in your clear screen routine so no need for all the stack BS. BTW.... you seem to be branching to R11 when R10 is your stack pointer (mixing and matching.) Forget all this stack nonsense and get with the TI program ;-) Stack programmers tend to spend more time maintaining their stack than they do creating...... Low level context switching rules !!!! ;-)

Link to comment
Share on other sites

I agree with Marc.

 

 DEF START,DRW
 REF VSBW

START LI R0,0  *load into register 0: starting position to print
 LI R1,>2000 *load into register 1: ASCII character (32---or "space")
 LI R2,768  *load into register 2: number of bytes to write
DRW  BLWP @VSBW  *branch and link workspace pointer at the VDP single byte write routine
 INC R0   *increment screen position by 1
 DEC R2   *decrement the "ticker"
 JNE DRW   *if the "ticker" is not zero (0), then jump back to DRW (or VSBW)
 END

 

 

Sorry, this is on my iPhone.... But that should assemble. icon_smile.gif

Edited by Opry99er
Link to comment
Share on other sites

Well if you really want to know what is going on it looks like this,

 

77659668.jpg

 

This is my basic compiler.

 

Features are

Program Tab

Line numbers can be used or not, they become labels in the assembly source.

 

Basic command tab

The whole library of basic commands will be here with the corresponding assembly instructions

 

assembly commands tab

This tab is for needed assembly commands to support the basic command tab

 

Assembly header tab

The tab showing the header you are using, I think selectable multiple headers for ea3 or cartridge output

 

Command index tab

this is for debugging more then anything but as you build the basic command tab you need to make a command index which will tell the compiler what lines in what tabs are for what commands

 

command includes tab

this tab is a list of needed instructions for the current program, only needed code is added to the assembly source.

 

variables tab

a list of variable used in the program converted to assembly and linked to the source output

 

assembly source

is the output source file after you 'make source'

 

The code you see is the first command made into a assemble source output.

Now that I have it working I can add commands as I go to the Basic command tab and 'make index' then new commands are instantly known to the compiler.

 

This is something way new to me, so I may be going about it wrong, I'll learn more as I add more complex commands and deal with their needs but I think I have a flexible enough system to make it workable.

Link to comment
Share on other sites

Only 1 command so far, not sure it that is rolling or not and a buggy phraser to boot.

but I can do this,

Look ma, line number or not it doesn't matter

10 CALL CLEAR
CALL CLEAR
20 CALL CLEAR

 

output source

      DEF   MAIN
*VDP MEMORY MAP

VDPRD  EQU   >8800
VDPSTA EQU   >8802
VDPWD  EQU   >8C00
VDPWA  EQU   >8C02

*WORKSPACE

WRKSP  EQU   >8300
R0LB   EQU   WRKSP+1
R1LB   EQU   WRKSP+3
R2LB   EQU   WRKSP+5
R3LB   EQU   WRKSP+7
R4LB   EQU   WRKSP+9

RSTACK BSS   32

MAIN
      LI    R10,RSTACK
L10    BL    @CLEAR
      BL    @CLEAR
L20    BL    @CLEAR

*BASIC COMMANDS
CLEAR  MOV   R10,R11
      LI    R0,0
      LI    R1,>2000
      LI    R2,768
      BL    @VSMW
      B     @SUBRET

*ASSEMBLE COMMANDS

VSMW   MOVB @R0LB,@VDPWA
      ORI  R0,>4000
      MOVB R0,@VDPWA
VSMWLP MOVB R1,@VDPWD
      DEC  R2
      JNE  VSMWLP
      B    *R11



SUBRET DECT R10
      B    *R10

      END  MAIN

Link to comment
Share on other sites

Looks pretty neat. I will be interesting to see how you progress. I think you will find the variables, expressions, and control constructs the most complicated.

 

By the way, this instruction:

B @SUBRET

 

Takes up as much memory as writing:

DECT R10
B    *R10

 

If memory savings was you goal, that's not giving you anything.

 

Matthew

Link to comment
Share on other sites

Yep, only one BL at a time. It will overwrite the address in R11 each time. You can build a stack address to have multiple levels if you want, like this:

 

RSTACK BSS  32
.
.
.
START  LI   R10,RSTACK
.
.
.
      BL   @HERE
.
.
.
HERE   MOV  R11,*R10+
* Code follows
      B    @SUBRET
.
.
.
SUBRET DECT R10
      B    *R10

 

Adamantyr

 

That won't work. See post #138 on the "Assembly" thread:

 

http://www.atariage.com/forums/topic/162941-assembly-on-the-994a/page__view__findpost__p__2093362

 

Also, why B @SUBRET ?? That does not save memory and it only slows things down. Confused.

 

Matthew

Link to comment
Share on other sites

That won't work. See post #138 on the "Assembly" thread:

 

Ah, good point. Yeah, you have to do a MOV *R10,R11 and then B *R11.

 

 

Also, why B @SUBRET ?? That does not save memory and it only slows things down. Confused.

 

I first saw this used by Bruce Harrison in his Art of Assembly articles.

 

The point of using a stack to store return addresses is it allows you to call BL in a nested situation. Sometimes this is a good thing to have. I've found a nested system useful for building complex code designs that reuse a lot of functions, like the file loader for my CRPG.

 

If the program is sluggish at the wrong place, you optimize for speed there by unrolling loops, removing branches and jumps, etc. Apply the cycle increases to where it matters.

 

Adamantyr

Link to comment
Share on other sites

  • 2 months later...

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...