Jump to content

Photo

Assembly BYTE and more questions


64 replies to this topic

#51 jchase1970 OFFLINE  

jchase1970

    Moonsweeper

  • Topic Starter
  • 340 posts
  • Location:Newburgh IN

Posted Tue Nov 30, 2010 4:58 PM

Editor assembler is what I'm using.

I'll check out how you stack up returns.

#52 jchase1970 OFFLINE  

jchase1970

    Moonsweeper

  • Topic Starter
  • 340 posts
  • Location:Newburgh IN

Posted Tue Nov 30, 2010 5:03 PM

think maybe is was a problem with CLS I renamed the label to CLEAR and the same error

#53 adamantyr OFFLINE  

adamantyr

    Dragonstomper

  • 543 posts

Posted Tue Nov 30, 2010 5:20 PM

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

#54 jchase1970 OFFLINE  

jchase1970

    Moonsweeper

  • Topic Starter
  • 340 posts
  • Location:Newburgh IN

Posted Tue Nov 30, 2010 5:32 PM

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, Tue Nov 30, 2010 5:33 PM.


#55 jchase1970 OFFLINE  

jchase1970

    Moonsweeper

  • Topic Starter
  • 340 posts
  • Location:Newburgh IN

Posted Tue Nov 30, 2010 7:15 PM

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


#56 marc.hull OFFLINE  

marc.hull

    Dragonstomper

  • 881 posts
  • Location:Oklahoma CIty.

Posted Tue Nov 30, 2010 7:56 PM

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 !!!! ;-)

#57 Opry99er OFFLINE  

Opry99er

    River Patroller

  • 3,616 posts
  • Location:Denver, CO

Posted Tue Nov 30, 2010 8:04 PM

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

Edited by Opry99er, Tue Nov 30, 2010 8:36 PM.


#58 jchase1970 OFFLINE  

jchase1970

    Moonsweeper

  • Topic Starter
  • 340 posts
  • Location:Newburgh IN

Posted Tue Nov 30, 2010 8:31 PM

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

Posted Image

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.

#59 Opry99er OFFLINE  

Opry99er

    River Patroller

  • 3,616 posts
  • Location:Denver, CO

Posted Tue Nov 30, 2010 8:42 PM

Impressive. =) Glad to see this rollin'.

#60 jchase1970 OFFLINE  

jchase1970

    Moonsweeper

  • Topic Starter
  • 340 posts
  • Location:Newburgh IN

Posted Tue Nov 30, 2010 8:45 PM

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


#61 matthew180 OFFLINE  

matthew180

    Stargunner

  • 1,762 posts
  • Location:Ceresco, Michigan

Posted Tue Nov 30, 2010 10:06 PM

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

#62 matthew180 OFFLINE  

matthew180

    Stargunner

  • 1,762 posts
  • Location:Ceresco, Michigan

Posted Tue Nov 30, 2010 10:31 PM

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

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

Matthew

#63 adamantyr OFFLINE  

adamantyr

    Dragonstomper

  • 543 posts

Posted Wed Dec 1, 2010 12:03 AM

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

#64 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • 2,632 posts
  • Location:Denmark

Posted Wed Dec 1, 2010 3:09 AM

Posted Image

Awesome. :thumbsup:

#65 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • 2,632 posts
  • Location:Denmark

Posted Thu Feb 24, 2011 9:42 AM

Did you take it any further ? :)




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users